Esempio n. 1
0
int si_comm_write(const char message_data[])
{
#ifdef BUILD_ARM_BB
    if (Connection_Ok)
    {
        console_put_string(message_data); 
    }        
    return SI_COMM_OK; 
#else
    int n; 
#ifdef BUILD_X86_WIN_HOST
    int wsa_error; 
#endif

    // printf("si_comm_write: %s\n", message_data); 
    if (Connection_Ok)
    {
#ifdef BUILD_X86_WIN_HOST
        n = send(newsockfd,message_data, strlen(message_data), 0); 
        if (n == SOCKET_ERROR)
        {
            wsa_error = WSAGetLastError(); 
            printf("ERROR writing to socket - wsa_error: %d\n", wsa_error); 
            error("ERROR writing to socket");
        }
#else
        n = write(newsockfd,message_data, strlen(message_data)); 
        if (n < 0) error("ERROR writing to socket");
#endif
    }
    return SI_COMM_OK; 
#endif
}
Esempio n. 2
0
void console_put_newline(void)
{
  if ( m_console == CONSOLE_AVAILABLE )
  {
    console_put_string((uint8_t *)CONSOLE_NEWLINE_OUTPUT);
  }
}
Esempio n. 3
0
void real_time_task(void)
{
    while(1)
    {
        console_put_string("This is a real-time task\n"); 
        si_wait_n_ms(5000); 
    }
}
Esempio n. 4
0
void console_put_mem(mem_address start_address)
{
    int *mem_ref = (int *) start_address; 
    int i; 
    console_put_string("mem from address: "); 
    console_put_hex(start_address); 
    for (i = 0; i < 15; i++)
    {    
	if (i == 13 || i == 14)
	{
            console_put_string("m"); 
    	    console_put_char((char) (i + '0')); 
   	    console_put_string(": "); 
            console_put_hex(*mem_ref); 
	}
        mem_ref++; 
    }
    console_put_string("\n"); 
}
Esempio n. 5
0
void console_put_line(uint8_t const * string)
{
  if ( m_console == CONSOLE_AVAILABLE )
  {
    while(*string != 0)
    {
      hal_uart_putchar(*string++);
    }
    console_put_string((uint8_t *)CONSOLE_NEWLINE_OUTPUT);
  }
}
Esempio n. 6
0
/* si_kernel_start: start real-time kernel */ 
void si_kernel_start(void)
{
    /* task_id for task with highest priority */ 
    int task_id_highest; 
  
    /* the kernel is running */ 
    Kernel_Running = 1; 

    /* print version information */ 
    console_put_string(SIMPLE_OS_VERSION_STRING); 

    /* get task_id for task with highest priority */ 
    task_id_highest = ready_list_get_task_id_highest_prio(); 

    /* start the task with highest priority */ 
    task_start(task_id_highest); 
}
Esempio n. 7
0
void console_get_line(uint8_t * string, uint8_t max_len)
{
  uint8_t c, k, m;

  if ( m_console == CONSOLE_AVAILABLE )
  {
    c = '\0';
    for( k = 0; k < max_len - 1 ; k++ )
    {
      c = hal_uart_getchar();
      if (c == newline_input[0])
      {
        break;
      }
      string[k] = c;
  #ifdef CONSOLE_ENABLE_ECHO
      hal_uart_putchar(c);
  #endif
    }
    string[k] = 0;
    /* Read (and discard) also rest of newline sequence if we found the start of if */
    /* This is were we may discard characters we should not, se the comments in the header file. */
    /* NOTE: We really should check what we read, and notify the caller if it is not really the newline sequence. */
    if( c == newline_input[0] )
    {
      for( m = 0; m < NEWLINE_INPUT_LEN - 1; m++)   /* We have already read the first character */
      {
          c = hal_uart_getchar();
      }
  #ifdef CONSOLE_ENABLE_ECHO
      /* We have read a newline, and since echo is enabled, we should also echo back a newline. */
      /* But this should be the output newline, which may differ from the input newline we read. */
      console_put_string((uint8_t *)CONSOLE_NEWLINE_OUTPUT);    
  #endif
    }
  }
} //lint !e438 Last value assigned to 'c' not used
Esempio n. 8
0
void enable_timer_interrupts(void)
{
    *INTCPS_MIR1 = 0xFFFFFFDF; 
    console_put_string("timer interrupts enabled"); 
}