Example #1
0
/***************************************************************************//**
 * @brief Main function.
 *
 * @return None.
*******************************************************************************/
int main(void)
{

    char          receivedCmd[30] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                                     0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                                     0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
    unsigned char cmd             =  0;
    double        param[5]        = {0, 0, 0, 0, 0};
    char          paramNo         =  0;
    char          cmdType         = -1;
    char          invalidCmd      =  0;


    /*!< Select and initialize the platform. */
    if (PLATFORM_Init(XILINX_KC705) < 0)
    {
        return -1;
    }
    /*!< Initialize the console with selected baud rate for the platform used. */
    CONSOLE_Init(UART_BAUDRATE);
    /*!< Initialize the device. */
    DoDeviceInit();

    while(1)
    {
        /*!< Read the command entered by user through console. */
        CONSOLE_GetCommand(receivedCmd);
        invalidCmd = 0;
        for(cmd = 0; cmd < cmdNo; cmd++)
        {
            paramNo = 0;
            cmdType = CONSOLE_CheckCommands(receivedCmd, cmdList[cmd].name, \
                                            param, &paramNo);
            if(cmdType == UNKNOWN_CMD)
            {
                invalidCmd++;
            }
            else
            {
                cmdFunctions[cmd](param, paramNo);
            }
        }
        /*!< Send feedback to user, if the command entered by user is not a valid one. */
        if(invalidCmd == cmdNo)
        {
            CONSOLE_Print("Invalid command!\r\n");
        }
    }

    return 0;
}
Example #2
0
/**
  * @brief  Initialize the target hardware and the console
  * @param  None
  * @retval None
  */
void MOD_PreInit(void)
{

  memset(MOD_table, 0, sizeof(GROUP_InitTypeDef));

  /* Init Console to save events log*/
  CONSOLE_Init();

  CONSOLE_LOG((uint8_t *)"[SYSTEM] Module Manager running....");

  /* Init Board specific hardware */
  BSP_Init();
  
  /*Init heap memory (located in SRAM)*/ 
  mem_pool_init();
}
Example #3
0
/////////////////////////////////////////////////////////////////////////////
// This hook is called after startup to initialize the application
/////////////////////////////////////////////////////////////////////////////
void APP_Init(void)
{
  MIOS32_BOARD_LED_Init(0xffffffff); // initialize all LEDs

  // initialize console
  CONSOLE_Init(0);

#if DEBUG_VERBOSE_LEVEL >= 1
  // print welcome message on MIOS terminal
  DEBUG_MSG("\n");
  DEBUG_MSG("====================\n");
  DEBUG_MSG("%s\n", MIOS32_LCD_BOOT_MSG_LINE1);
  DEBUG_MSG("====================\n");
  DEBUG_MSG("\n");
  DEBUG_MSG("Please send some characters to the console (e.g. via 'mios_terminal')!");
#endif
}
Example #4
0
/***************************************************************************//**
 * @brief Main function.
 *
 * @return None.
*******************************************************************************/
void main(void)
{
    char   receivedCmd[20];
    double param[5];
    char   cmd        = 0;
    char   paramNo    = 0;
    char   cmdType    = -1;
    char   invalidCmd = 0;

	/*!< Initialize the console. */
    CONSOLE_Init(9600);
    TIME_DelayMs(10);

    /*!< Initialize the device. */
    DoDeviceInit();
        
    while(1)
    {
        /*!< Read the command entered by user through UART. */
        CONSOLE_GetCommand(receivedCmd);
        
        invalidCmd = 0;
        for(cmd = 0; cmd < cmdNo; cmd++)
        {
            paramNo = 0;
            cmdType = CONSOLE_CheckCommands(receivedCmd, cmdList[cmd], param, &paramNo);
            if(cmdType == UNKNOWN_CMD)
            {
                invalidCmd++;
            }
            else
            {
                cmdFunctions[cmd](param, paramNo);
            }
        }
        /*!< Send feedback to user, if the command entered by user is not a valid one. */
        if(invalidCmd == cmdNo)
        {
            CONSOLE_Print("Invalid command!\r\n");
        }
    }
}
Example #5
0
/***********************************************************************
 *           KERNEL process initialisation routine
 */
static BOOL process_attach( HMODULE module )
{
    RTL_USER_PROCESS_PARAMETERS *params = NtCurrentTeb()->Peb->ProcessParameters;

    /* Setup registry locale information */
    LOCALE_InitRegistry();

    /* Setup computer name */
    COMPUTERNAME_Init();

    CONSOLE_Init(params);

    /* copy process information from ntdll */
    ENV_CopyStartupInformation();

    if (!(GetVersion() & 0x80000000))
    {
        /* Securom checks for this one when version is NT */
        set_entry_point( module, "FT_Thunk", 0 );
    }
    else LoadLibraryA( "krnl386.exe16" );

    /* finish the process initialisation for console bits, if needed */
    __wine_set_signal_handler(SIGINT, CONSOLE_HandleCtrlC);

    if (params->ConsoleHandle == KERNEL32_CONSOLE_ALLOC)
    {
        HMODULE mod = GetModuleHandleA(0);
        if (RtlImageNtHeader(mod)->OptionalHeader.Subsystem == IMAGE_SUBSYSTEM_WINDOWS_CUI)
            AllocConsole();
    }
    /* else TODO for DETACHED_PROCESS:
     * 1/ inherit console + handles
     * 2/ create std handles, if handles are not inherited
     * TBD when not using wineserver handles for console handles
     */

    return TRUE;
}