Ejemplo n.º 1
0
int platform_init()
{
  unsigned i;
  TIM_InitTypeDef tim;
  TIM_TypeDef* base;  
        
  // System configuration
  platform_config_scu();
  
  // PIO setup
  for( i = 0; i < 10; i ++ )
    GPIO_DeInit( ( GPIO_TypeDef* )port_data[ i ] );
  
  // UART setup (only STR9_UART is used in this example)
  platform_uart_setup( 0, 115200, 8, PLATFORM_UART_PARITY_NONE, PLATFORM_UART_STOPBITS_1 );
  
  // Initialize timers
  for( i = 0; i < 4; i ++ )
  {
    base = ( TIM_TypeDef* )timer_data[ i ];
    TIM_DeInit( base );
    TIM_StructInit( &tim );
    tim.TIM_Clock_Source = TIM_CLK_APB;
    tim.TIM_Prescaler = 255;      
    TIM_Init( base, &tim );    
    TIM_CounterCmd( base, TIM_START );
  }
  
  // Set the send/recv functions                          
  std_set_send_func( uart_send );
  std_set_get_func( uart_recv );  
     
  return PLATFORM_OK;
} 
Ejemplo n.º 2
0
int platform_init()
{
  cmn_platform_init();
  std_set_send_func(ssend);
  std_set_get_func(srecv);
  return PLATFORM_OK;
} 
Ejemplo n.º 3
0
void cmn_platform_init()
{
  // Set the send/recv functions                          
  std_set_send_func( uart_send );
  std_set_get_func( uart_recv );  

#ifdef BUILD_XMODEM  
  // Initialize XMODEM
  xmodem_init( xmodem_send, xmodem_recv );    
#endif

#ifdef BUILD_TERM  
  // Initialize terminal
  term_init( TERM_LINES, TERM_COLS, term_out, term_in, term_translate );
#endif
}
Ejemplo n.º 4
0
void cmn_platform_init()
{
#ifdef BUILD_INT_HANDLERS
  platform_int_init();
#endif

#ifdef BUILD_SERMUX
  unsigned i;
  unsigned bufsizes[] = SERMUX_BUFFER_SIZES;  

  // Setup the serial multiplexer
  platform_uart_setup( SERMUX_PHYS_ID, SERMUX_PHYS_SPEED, 8, PLATFORM_UART_PARITY_NONE, PLATFORM_UART_STOPBITS_1 );
  platform_uart_set_flow_control( SERMUX_PHYS_ID, SERMUX_FLOW_TYPE );
  cmn_uart_setup_sermux();

  // Set buffers for all virtual UARTs 
  for( i = 0; i < sizeof( bufsizes ) / sizeof( unsigned ); i ++ )
    platform_uart_set_buffer( i + SERMUX_SERVICE_ID_FIRST, bufsizes[ i ] );
#endif // #ifdef BUILD_SERMUX

#if defined( CON_UART_ID ) && CON_UART_ID < SERMUX_SERVICE_ID_FIRST
  // Setup console UART
  platform_uart_setup( CON_UART_ID, CON_UART_SPEED, 8, PLATFORM_UART_PARITY_NONE, PLATFORM_UART_STOPBITS_1 );  
  platform_uart_set_flow_control( CON_UART_ID, CON_FLOW_TYPE );
  platform_uart_set_buffer( CON_UART_ID, CON_BUF_SIZE );
#endif // #if defined( CON_UART_ID ) && CON_UART_ID < SERMUX_SERVICE_ID_FIRST

#ifndef BUILD_WEB_SERVER
  // Set the send/recv functions                          
  std_set_send_func( uart_send );
  std_set_get_func( uart_recv );  
#endif

#ifdef BUILD_XMODEM  
  // Initialize XMODEM
  xmodem_init( xmodem_send, xmodem_recv );    
#endif

#ifdef BUILD_TERM  
  // Initialize terminal
  term_init( TERM_LINES, TERM_COLS, term_out, term_in, term_translate );
#endif
}
Ejemplo n.º 5
0
int platform_init()
{
  // Initialize CPU
  lpc288x_init();
  
  // Initialize UART
  uart_init( 115200, 8, PLATFORM_UART_PARITY_NONE, PLATFORM_UART_STOPBITS_1 );
  
  // Initialize timers
  T0CTRL = 0;
  T1CTRL = 0;
  INT_REQ5 = ( 1 << 28 ) | ( 1 << 27 ) | ( 1 << 26 ) | ( 1 << 16 ) | 0x1;
  INT_REQ6 = ( 1 << 28 ) | ( 1 << 27 ) | ( 1 << 26 ) | ( 1 << 16 ) | 0x1;    
  
  // Set the send/recv functions                          
  std_set_send_func( uart_send );
  std_set_get_func( uart_recv );  
  
  return PLATFORM_OK;
} 
Ejemplo n.º 6
0
int platform_init()
{
  int i;
   
  unsigned int mode = AT91C_US_USMODE_NORMAL | AT91C_US_CLKS_CLOCK | AT91C_US_CHRL_8_BITS | 
      AT91C_US_PAR_NONE | AT91C_US_NBSTOP_1_BIT | AT91C_US_CHMODE_NORMAL;
      
  // Enable the peripherals we use in the PMC
  PMC_EnablePeripheral(AT91C_ID_US0);  
  PMC_EnablePeripheral(AT91C_ID_US1);
  PMC_EnablePeripheral(AT91C_ID_PIOA);
  PMC_EnablePeripheral(AT91C_ID_PIOB);
  PMC_EnablePeripheral(AT91C_ID_TC0);
  PMC_EnablePeripheral(AT91C_ID_TC1);
  PMC_EnablePeripheral(AT91C_ID_TC2);
 
  // Configure pins
  PIO_Configure(platform_uart_pins[ 0 ], PIO_LISTSIZE(platform_uart_pins[ 0 ]));
    
  // Configure the USART in the desired mode @115200 bauds
  USART_Configure(AT91C_BASE_US0, mode, 115200, BOARD_MCK);
  
  // Enable receiver & transmitter
  USART_SetTransmitterEnabled(AT91C_BASE_US0, 1);
  USART_SetReceiverEnabled(AT91C_BASE_US0, 1);  
  
  // Configure the timers
  AT91C_BASE_TCB->TCB_BMR = 7;
  for( i = 0; i < 3; i ++ )
    TC_Configure( ( AT91S_TC* )timer_base[ i ], AT91C_TC_CLKS_TIMER_DIV5_CLOCK | AT91C_TC_WAVE );
  
  // Set the send/recv functions                          
  std_set_send_func( uart_send );
  std_set_get_func( uart_recv );
    
  return PLATFORM_OK;
} 
Ejemplo n.º 7
0
int platform_init()
{ 
  if( memory_start_address == NULL ) 
  {
    hostif_putstr( "platform_init(): mmap failed\n" );
    return PLATFORM_ERR;
  }

  // Set the std input/output functions
  // Set the send/recv functions                          
  std_set_send_func( scr_write );
  std_set_get_func( kb_read );       

  // Set term functions
#ifdef BUILD_TERM  
  term_init( TERM_LINES, TERM_COLS, i386_term_out, i386_term_in, i386_term_translate );
#endif

  term_clrscr();
  term_gotoxy( 1, 1 );
 
  // All done
  return PLATFORM_OK;
}
Ejemplo n.º 8
0
int platform_init()
{
    // Set the clocking to run directly from the crystal.
    SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_8MHZ);

    // Setup PIO
    pios_init();

    // Setup SSIs
    spis_init();

    // Setup UARTs
    uarts_init();

    // Setup timers
    timers_init();

    // Set the send/recv functions
    std_set_send_func( uart_send );
    std_set_get_func( uart_recv );

    // All done
    return PLATFORM_OK;
}