示例#1
0
/**
 * ul_log_redir - redirects default log output function
 * @log_fnc: new log output function. Value NULL resets
 *           to default function
 * @add_flags: some more flags
 */

void
ul_log_redir(ul_log_fnc_t *log_fnc, int add_flags)
{
  if(log_fnc==NULL) log_fnc=ul_log_fnc_default;
  ul_log_output=log_fnc;
}

#ifndef __RTL__
void
ul_log_fnc_default(ul_log_domain_t *domain, int level,
	const char *format, va_list ap)
{
  if(!(level&UL_LOGL_CONT)) {
    level&=UL_LOGL_MASK;
    if(level)
      fprintf(ul_log_default_file,"<%d>",level);
    if(domain && domain->name)
      fprintf(ul_log_default_file,"%s: ",domain->name);
  }
  vfprintf(ul_log_default_file, format, ap);
  fflush(ul_log_default_file);
}


#else /*__RTL__*/
void
ul_log_fnc_default(ul_log_domain_t *domain, int level,
	const char *format, va_list ap)
{
  if(!(level&UL_LOGL_CONT)) {
    level&=UL_LOGL_MASK;
    if(level)
      rtl_printf("<%d>",level);
    if(domain && domain->name)
      rtl_printf("%s: ",domain->name);
  }
  rtl_vprintf(format, ap);
}
示例#2
0
asmlinkage long spark_print(char *str)
{
#ifdef _USE_SEGMENTATION_FOR_PROT_  
	str = str + guestOS_thread[iCurrGuestOsIndex].phyOffset;
#endif
	rtl_printf("%s",str);
	return 0;
}
示例#3
0
/*
 * Module initialization
 */
int init_module(void) {
	
	__do_global_ctors_aux();
	
	rtl_printf("PLC Device manager initialized\n");

	return 0;
}
示例#4
0
void SoftwareSerial::begin(long speed)
{
    pUART = malloc ( sizeof(serial_t) );
    if (pUART == NULL) {
        rtl_printf("fail to malloc\r\n");
    }
    this->speed = speed;
    listen();
}
示例#5
0
void SoftwareSerial::begin(long speed, int data_bits, int parity, int stop_bits)
{
    pUART = malloc ( sizeof(serial_t) );
    if (pUART == NULL) {
        rtl_printf("fail to malloc\r\n");
    }
    this->speed     = speed;
    this->data_bits = data_bits;
    this->parity    = parity;
    this->stop_bits = stop_bits;
    listen();
}
示例#6
0
/* Function to pick the scheduler data from the binary and 
 * fill it in a usable structure
 */
int init_sched()
{
    int i,dummy;
    
    unsigned int *ptr = (unsigned int *)&_scheduler_data_; 
    /* Extract number of guest OSs */
    dummy = *ptr;
    if( dummy < NUM_OF_GUESTOS )
    	rtl_printf ("***ALERT:: Mismatch in the Number of Guest OSes ****");
    
    ptr++;
    /* Extract value of eta. This is the cycle time after which the 
     * execution will repeat 
     */
    eta = *ptr;
    /* Extract the number of switches */
    /* Search for EOF marker 
     * The value previous to that is the value of no_of_switches
     */
    while(*ptr != SPARK_SCHED_EOF)
        ptr++;
    ptr--;
    no_of_switches = *ptr;
    ptr = (unsigned int *)&_scheduler_data_;
    ptr++;
    /* Extract cyclic schedule detaiils */
    for(i=0; i< no_of_switches; i++ )
    {
        ptr++;
        offline_schedule[i].start_t = *ptr;
        ptr++;
        offline_schedule[i].gos_id = *ptr;
        ptr++;
        offline_schedule[i].end_t = *ptr;
    }
    gCurrEtaCount = eta-1;

#ifdef PERF_ANALYSIS_ON
    /* Code inserted for demo START */
    current_schedule[0].no_of_switches = no_of_switches + 1;
    current_schedule[1].no_of_switches = no_of_switches + 1;
    /* Code inserted for demo END */
#endif
    
    return 0;
}
示例#7
0
void *thread_code(void *t) {

	pthread_make_periodic_np (thread, gethrtime(), period);

	do {
		int n;
		char buf[210];
		pthread_wait_np();
		n = rt_com_read(0, buf, sizeof(buf));
		if (n > 0) {
			buf[n] = 0;
			rtl_printf("%s", buf);
		}
		rt_com_write(0, "test\n", 5);
	} while (1);

	return 0;
}
示例#8
0
void main(void)
{
    gpio_t gpio_led;
	int led_status;
	int i2clocalcnt;
	int error;
	uint16_t shtc1_id;
	
	float temperature = 1.123f;
	float humidity = 2.456f;


    DBG_8195A("sleep 10 sec. to wait for UART console\n");
	Mdelay(10000);
	

    DBG_8195A("start i2c example - SHTC1\n");

		
	error = SHTC1_Init(&shtc1_id);
	if ( error == NO_ERROR ) {
	  DiagPrintf("SHTC1 init ok, id=0x%x\r\n", shtc1_id);
	} else {
	  DiagPrintf("SHTC1 init FAILED! \r\n");
	  for(;;);
	}
	
	
	while(1){
		error = SHTC1_GetTempAndHumi(&temperature, &humidity);
		
		rtl_printf("temp=%f, humidity=%f, error=%d\n", 
				  temperature, humidity, error);
		
		Mdelay(1000);

	}
}
示例#9
0
// ulMemSize will decide the size of buffer
asmlinkage long spark_registerMQ (unsigned long ulChannelID, unsigned long ulMemSize)
{
	int i;

	if(no_init_queue == (MAX_QUEUES - 1))
		rtl_printf("Max No of Queues already initialized \n");

	else
	{
		for (i=0; i<no_init_queue; i++)	
		{
			if (msq_queue_arry[i].ulChannelID == ulChannelID )
			{
				//rtl_printf("channel is already registered\n");
				return 0;
			}
		}	

		//Get a new memory page for this queue
		char *new_page;
		new_page = kGetPage();
		memset(new_page, 0, RTL_PAGE_SIZE);

		//Initialize the page, current read, and current write pointers
		msq_queue_arry[no_init_queue].ulChannelID = ulChannelID;
		msq_queue_arry[no_init_queue].start_buff = new_page;
		msq_queue_arry[no_init_queue].end_buff = new_page + ulMemSize - 1;
		msq_queue_arry[no_init_queue].current_read_ptr = new_page;
		msq_queue_arry[no_init_queue].current_write_ptr = new_page;
		msq_queue_arry[no_init_queue].total_size = ulMemSize;
		msq_queue_arry[no_init_queue].q_filled_bytes = 0;
		//rtl_printf("****Inside mq_register function*****\n");
		//rtl_printf("spark_registerMQ queue no = %d , Channel ID = %u \n", no_init_queue, ulChannelID);
		no_init_queue++;
	}
	return 0;
}
示例#10
0
asmlinkage long spark_printLong(unsigned long l)
{
	//rtl_printf("spark_printLong:%u\t0x%x\n" , l , l);
	rtl_printf("%u\t0x%x\n" , l , l);
	return 0;	
}
示例#11
0
asmlinkage long spark_ni_hypercall(void)
{
	rtl_printf("Hyper call not implemented\n");
	return -ENOSYS;
}
示例#12
0
/* Print basic configuration before each run */
static void describe_run() {
#if defined(E_ACSL_VERBOSE)
  rtl_printf("/* ========================================================= */\n");
  rtl_printf(" * E-ACSL instrumented run\n" );
  rtl_printf(" * Memory tracking: %s\n", E_ACSL_MMODEL_DESC);
#ifdef E_ACSL_SEGMENT_MMODEL
  rtl_printf(" *   Heap  %d MB\n", E_ACSL_HEAP_SIZE);
  rtl_printf(" *   Stack %d MB\n", E_ACSL_STACK_SIZE);
#endif
  rtl_printf(" * Temporal checks: %s\n", E_ACSL_TEMPORAL_DESC);
  rtl_printf(" * Execution mode:  %s\n", E_ACSL_DEBUG_DESC);
  rtl_printf(" * Assertions mode: %s\n", E_ACSL_ASSERT_NO_FAIL_DESC);
  rtl_printf(" * Validity notion: %s\n", E_ACSL_VALIDITY_DESC);
  rtl_printf(" * Format Checks:   %s\n", E_ACSL_FORMAT_VALIDITY_DESC);
  rtl_printf("/* ========================================================= */\n");
#endif
}