示例#1
0
文件: dpc.c 项目: animotron/animos
void dpc_init()
{
    SHOW_FLOW0( 1, "Starting DPC");
    hal_cond_init( &dpc_thread_sleep_stone, "DPC" );
    spinlock_init( &dpc_request_lock );

    hal_mutex_init(&unused_dpc_mutex, "DPC");

    SHOW_FLOW0( 1, "Starting DPC thread...");
    //dpc_thread_object =
    hal_start_kernel_thread(dpc_thread);

#if !DPC_WAKE_TIMER
    SHOW_FLOW0( 1, " starting DPC waker thread...");
    //dpc_timed_waker_thread_object =
    hal_start_kernel_thread(dpc_timed_waker_thread);
#else
    dpc_timer_wake(0);
#endif

    while(!dpc_init_ok)
    {
        SHOW_FLOW0( 2, " wait for DPC threads...");
        hal_sleep_msec(1); // wait for thread to start
    }

    SHOW_FLOW0( 0, "DPC start done");
}
示例#2
0
phantom_device_t * driver_isa_ps2m_probe( int port, int irq, int stage )
{
    (void) port;
    (void) stage;

    //dpc_request_init( &mouse_dpc, push_event );
    //hal_mutex_init( &mouse_mutex, "MouseDrv" );
    //hal_cond_init( &mouse_cond );
    hal_sem_init( &mouse_sem, "MouseDrv" );
    hal_spin_init( &elock );

    if( seq_number || ps2ms_do_init() )
        return 0;

    if( hal_irq_alloc( irq, ps2ms_int_handler, 0, HAL_IRQ_SHAREABLE ) )
        return 0;

    phantom_device_t * dev = malloc(sizeof(phantom_device_t));
    dev->name = "ps2-mouse";
    dev->seq_number = seq_number++;

    hal_start_kernel_thread((void*)mouse_push_event_thread);

    return dev;
}
示例#3
0
文件: dpc.c 项目: animotron/animos
static void dpc_timed(void)
{
#if MULTIPLE_DPC_THREADS
    if( idle_dpc_threads < MIN_DPC_IDLE_THREADS )
    {
        SHOW_FLOW( 1, "Starting extra %d DPC thread...", dpc_threads);
        hal_start_kernel_thread(dpc_thread);
    }
#endif


    //hal_cond_broadcast( &dpc_thread_sleep_stone );
    hal_cond_signal( &dpc_thread_sleep_stone ); // Wake one thread
}
示例#4
0
void init_main_event_q()
{
    queue_init(&ev_unused_events);
    queue_init(&ev_main_event_q);

    hal_mutex_init( &ev_main_q_mutex, "Main EvQ" );
    hal_mutex_init( &ev_unused_q_mutex, "Free EvQ" );

    hal_cond_init( &ev_have_event, "UIEvent" );

    hal_mutex_lock( &ev_unused_q_mutex );
    int i = MIN_EVENT_POOL;
    while(i--)
        ev_allocate_event();
    hal_mutex_unlock( &ev_unused_q_mutex );

#if EVENTS_ENABLED
    hal_start_kernel_thread( ev_push_thread );


    ev_engine_active = 1;

#if KEY_EVENTS
    phantom_set_console_getchar( phantom_window_getc );
    hal_start_kernel_thread( ev_keyboard_read_thread );
#endif
#endif

#if DELIVER2THREAD
    hal_start_kernel_thread( w_event_deliver_thread );
#endif

#if VIDEO_NEW_BG_WIN
    w_bg_win_init();
#endif

}
示例#5
0
static void init_stray_checker(void)
{
    hal_start_kernel_thread(&stray_catch_thread);

#if 0
    int i;
    for(i = 0; i < MAXCR; i++ )
    {
        if( cr[i].size == 0 )
            break;

        printf("%03d: %8p (%6d) %s\n", i, cr[i].buf, cr[i].size, cr[i].name );
    }
#endif


}
示例#6
0
void phantom_init_console_window()
{
    hal_mutex_init( &buf_mutex, "console" );

    console_fg = COLOR_LIGHTGRAY;
    console_bg = COLOR_BLACK;

    int xsize = 620, ysize = 300;
    int cw_x = 50, cw_y = 450;
    if( scr_get_ysize() < 600 )
    {
        cw_x = cw_y = 0;
    }

    drv_video_window_t *w = drv_video_window_create( xsize, ysize,
                        cw_x, cw_y, console_bg, "Console", WFLAG_WIN_DECORATED|WFLAG_WIN_DOUBLEBUF );

    phantom_console_window = w;

    w->owner = get_current_tid();

    phantom_set_console_ops( &win_ops );
    phantom_console_window_puts("Phantom console window\n");


    phantom_debug_window = drv_video_window_create(
                        DEBWIN_XS, DEBWIN_YS,
                        DEBWIN_X, DEBWIN_Y, console_bg, "Threads", WFLAG_WIN_DECORATED|WFLAG_WIN_DOUBLEBUF|WFLAG_WIN_FULLPAINT );

    //phantom_debug_window->flags |= WFLAG_WIN_DOUBLEBUF|WFLAG_WIN_FULLPAINT;
    //w_update( phantom_debug_window ); // For dbl buf flags to start working ok

    phantom_debug_window_puts("Phantom debug window\n\nt - threads\nw - windows\ns - stats\np - profiler\n");
    w_update( phantom_debug_window );
    //hal_sleep_msec(4000);

    hal_start_kernel_thread(phantom_debug_window_loop);


    // -------------------------------------------------------------------
    // Launcher window
    // -------------------------------------------------------------------

    color_t la_bg = { 0x19, 0x19, 0x19, 0xFF };
    color_t la_b1 = { 68, 66, 62, 0xFF  };
    color_t la_b2 = { 88, 84, 79, 0xFF  };

    color_t la_txt = { 0x11, 0xd5, 0xff, 0xFF };
//#define BTEXT_COLOR COLOR_YELLOW
#define BTEXT_COLOR la_txt

    phantom_launcher_window = drv_video_window_create( scr_get_xsize(), 32,
                                                       0, 0, console_bg, "Launcher", WFLAG_WIN_ONTOP );

    phantom_launcher_window->inKernelEventProcess = phantom_launcher_event_process;
    w_fill( phantom_launcher_window, la_bg );

    int lb_x = scr_get_xsize();

    lb_x -= power_button_sm_bmp.xsize + 5;
    w_add_button( phantom_launcher_window, -1, lb_x, 2, &power_button_sm_bmp, &power_button_pressed_sm_bmp, BUTTON_FLAG_NOBORDER );

    pool_handle_t bh;


    lb_x = 5;

    int nwin = 0;
    for( nwin = 0; nwin < MAX_LAUNCH_BUTTONS; nwin++ )
    {
        char * wname = "win1";

        // crashes in some configurations??
        //wname[3] = '0' + nwin;

        bh = w_add_button( phantom_launcher_window, nwin, lb_x, 5, &task_button_bmp, &task_button_bmp, BUTTON_FLAG_NOBORDER );
        w_button_set_text( phantom_launcher_window, bh, wname, BTEXT_COLOR );
        lb_x += 5+task_button_bmp.xsize;

        taskbuttons[nwin] = bh;
    }



    w_draw_line( phantom_launcher_window, 0, 31, scr_get_xsize(), 31, la_b1 );
    w_draw_line( phantom_launcher_window, 0, 30, scr_get_xsize(), 30, la_b2 );


    w_update( phantom_launcher_window );

    //hal_start_kernel_thread(phantom_launcher_window_loop);
}