示例#1
0
文件: main.c 项目: Nakrez/zOS
int main(void)
{
    struct video *driver_implem;

    uprint("Video: Launching driver");

    if (!(driver_implem = malloc(sizeof (struct video))))
    {
        uprint("Video: Out of memory");

        return 1;
    }

    if (video_initialize(driver_implem) < 0)
    {
        free(driver_implem);

        return 1;
    }

    driver_implem->opened = 0;

    uprint("Video: Initialization successful");

    return video_driver_run(driver_implem);
}
示例#2
0
void * initializeKernelBinary() {

	load_kernel_modules();

	clearBSS(&bss, &endOfKernel - &bss);


	video_initialize();
	video_clear_screen();

	video_write_line("[x64BareBones]");

	video_write_string("  text: 0x");
	video_write_hex((uint64_t)&text);
	video_write_nl();

	video_write_string("  rodata: 0x");
	video_write_hex((uint64_t)&rodata);
	video_write_nl();

	video_write_string("  data: 0x");
	video_write_hex((uint64_t)&data);
	video_write_nl();

	video_write_string("  bss: 0x");
	video_write_hex((uint64_t)&bss);
	video_write_nl();

	video_write_line("[Done]");

	screensaver_reset_timer();

	video_write_line("Kernel cargado.");

	return getStackBase();
}
示例#3
0
EXPORT int iaxc_initialize(int num_calls)
{
	int i;
	int port;

	os_init();

	setup_jb_output();

	MUTEXINIT(&iaxc_lock);
	MUTEXINIT(&event_queue_lock);

	iaxc_set_audio_prefs(0);

	if ( iaxc_recvfrom != (iaxc_recvfrom_t)recvfrom )
		iax_set_networking(iaxc_sendto, iaxc_recvfrom);

	/* Note that iax_init() only sets up the receive port when the
	 * sendto/recvfrom functions have not been replaced. We need
	 * to call iaxc_init in either case because there is other
	 * initialization beyond the socket setup that needs to be done.
	 */
	if ( (port = iax_init(source_udp_port)) < 0 )
	{
		iaxci_usermsg(IAXC_ERROR,
				"Fatal error: failed to initialize iax with port %d",
				port);
		return -1;
	}

	if ( iaxc_recvfrom == (iaxc_recvfrom_t)recvfrom )
		iaxci_bound_port = port;
	else
		iaxci_bound_port = -1;

	/* tweak the jitterbuffer settings */
	iax_set_jb_target_extra( jb_target_extra );

	max_calls = num_calls;
	/* initialize calls */
	if ( max_calls <= 0 )
		max_calls = 1; /* 0 == Default? */

	/* calloc zeroes for us */
	calls = (struct iaxc_call *)calloc(sizeof(struct iaxc_call), max_calls);
	if ( !calls )
	{
		iaxci_usermsg(IAXC_ERROR, "Fatal error: can't allocate memory");
		return -1;
	}

	selected_call = -1;

	for ( i = 0; i < max_calls; i++ )
	{
		strncpy(calls[i].callerid_name,   DEFAULT_CALLERID_NAME,   IAXC_EVENT_BUFSIZ);
		strncpy(calls[i].callerid_number, DEFAULT_CALLERID_NUMBER, IAXC_EVENT_BUFSIZ);
	}

	if ( !test_mode )
	{
#ifndef AUDIO_ALSA
		if ( pa_initialize(&audio_driver, 8000) )
		{
			iaxci_usermsg(IAXC_ERROR, "failed pa_initialize");
			return -1;
		}
#else
		/* TODO: It is unknown whether this stuff for direct access to
		* alsa should be left in iaxclient. We're leaving it in here for
		* the time being, but unless it becomes clear that someone cares
		* about having it, it will be removed. Also note that portaudio
		* is capable of using alsa. This is another reason why this
		* direct alsa access may be unneeded.
		*/
		if ( alsa_initialize(&audio_driver, 8000) )
			return -1;
#endif
	}
#ifdef USE_VIDEO
	if ( video_initialize() )
		iaxci_usermsg(IAXC_ERROR,
				"iaxc_initialize: cannot initialize video!\n");
#endif

	/* Default audio format capabilities */
	audio_format_capability =
	    IAXC_FORMAT_ULAW |
	    IAXC_FORMAT_ALAW |
#ifdef CODEC_GSM
	    IAXC_FORMAT_GSM |
#endif
	    IAXC_FORMAT_SPEEX;
	audio_format_preferred = IAXC_FORMAT_SPEEX;

	return 0;
}
示例#4
0
EXPORT int iaxc_initialize(int num_calls)
{
    printf("ESTOY IAXC 0\n");
	int i;
	int port;

	os_init();

	setup_jb_output();

	MUTEXINIT(&iaxc_lock);
	MUTEXINIT(&event_queue_lock);

	iaxc_set_audio_prefs(0);

	if ( iaxc_recvfrom != (iaxc_recvfrom_t)recvfrom )
		iax_set_networking(iaxc_sendto, iaxc_recvfrom);

	/* Note that iax_init() only sets up the receive port when the
	 * sendto/recvfrom functions have not been replaced. We need
	 * to call iaxc_init in either case because there is other
	 * initialization beyond the socket setup that needs to be done.
	 */
	if ( (port = iax_init(source_udp_port)) < 0 )
	{
		iaxci_usermsg(IAXC_ERROR,
				"Fatal error: failed to initialize iax with port %d",
				port);
		return -1;
	}

	if ( iaxc_recvfrom == (iaxc_recvfrom_t)recvfrom )
		iaxci_bound_port = port;
	else
		iaxci_bound_port = -1;

	/* tweak the jitterbuffer settings */
	iax_set_jb_target_extra( jb_target_extra );

	max_calls = num_calls;
	/* initialize calls */
	if ( max_calls <= 0 )
		max_calls = 1; /* 0 == Default? */

	/* calloc zeroes for us */
	calls = (struct iaxc_call *)calloc(sizeof(struct iaxc_call), max_calls);
	if ( !calls )
	{
		iaxci_usermsg(IAXC_ERROR, "Fatal error: can't allocate memory");
		return -1;
	}

	selected_call = -1;

	for ( i = 0; i < max_calls; i++ )
	{
		strncpy(calls[i].callerid_name,   DEFAULT_CALLERID_NAME,   IAXC_EVENT_BUFSIZ);
		strncpy(calls[i].callerid_number, DEFAULT_CALLERID_NUMBER, IAXC_EVENT_BUFSIZ);
	}
    printf("ESTOY IAXC\n");

    if ( alsa_initialize(&audio_driver, 8000) )
    {
        iaxci_usermsg(IAXC_ERROR, "failed alsa_initialize");
        return -1;
    }
#ifdef USE_VIDEO
	if ( video_initialize() )
		iaxci_usermsg(IAXC_ERROR,
				"iaxc_initialize: cannot initialize video!\n");
#endif

	/* Default audio format capabilities */
	audio_format_capability =
	    IAXC_FORMAT_ULAW |
	    IAXC_FORMAT_ALAW |
#ifdef CODEC_GSM
	    IAXC_FORMAT_GSM |
#endif
	    IAXC_FORMAT_SPEEX;
	audio_format_preferred = IAXC_FORMAT_SPEEX;

	return 0;
}