Ejemplo n.º 1
0
/** Initialize the debugger */
void db_init (void)
{
#ifdef CONFIG_BPT
	db_paused = 0;
	bpt_mem_addr = 0;
	bpt_debounce_timer = 0x1C00;
#endif

#ifdef CONFIG_DEBUG_INPUT
	/* Signal the debugger that the system has just reset. */
	if (pinio_debug_read_ready ())
	{
		pinio_debug_write (0);
		puts_handler = puts_debug;
	}
	else
	{
		puts_handler = puts_parallel;
	}
#elif defined(CONFIG_SIM)
	puts_handler = puts_sim;
#else
	extern void puts_default (const char *);
	puts_handler = puts_default;
#endif

#ifdef DEBUGGER
	/* Announce myself to the world. */
	dbprintf ("FreeWPC\n");
	dbprintf ("System Version %s.%s\n",
		C_STRING (MACHINE_MAJOR_VERSION), C_STRING (MACHINE_MINOR_VERSION));
	dbprintf ("%s\n\n", MACHINE_NAME);
#endif /* DEBUGGER */
}
Ejemplo n.º 2
0
/** Initialize the debugger */
void db_init (void)
{
#ifdef DEBUGGER
	db_paused = 0;
	bpt_mem_addr = 0;
	bpt_debounce_timer = 0x1C00;

	/* Signal the debugger that the system has just reset. */
	if (wpc_debug_read_ready ())
	{
		wpc_debug_write (0);
		db_puts = db_puts_orkin;
	}
	else
	{
		db_puts = db_puts_parallel;
	}

	/* Announce myself to the world. */
	dbprintf ("FreeWPC\n");
	dbprintf ("System Version %s.%s\n",
		C_STRING (MACHINE_MAJOR_VERSION), C_STRING (MACHINE_MINOR_VERSION));
	dbprintf ("%s\n\n", MACHINE_NAME);
#endif /* DEBUGGER */
}
Ejemplo n.º 3
0
/** Display effect for system reset */
void system_reset_deff (void)
{
	/* On DMD machines display the full copyright screen.  Alphanumerics
	aren't large enough to do this. */
#if (MACHINE_DMD == 1)
	dmd_alloc_low_clean ();
	font_render_string_center (&font_var5, 64, 3, "FREEWPC (C) COPYRIGHT 2011");
	font_render_string_center (&font_var5, 64, 11, "THIS SOFTWARE IS NOT");
	font_render_string_center (&font_var5, 64, 17, "SUPPORTED BY BALLY/WILLIAMS");
	font_render_string_center (&font_var5, 64, 25, "WWW.ODDCHANGE.COM/FREEWPC");
	dmd_show_low ();
#else
	seg_alloc_clean ();
	seg_write_row_center (0, "FREEWPC <C>2010");
	seg_write_row_center (1, "WWW.ODDCHANGE.COM");
	seg_show ();
#endif
	task_sleep_sec (3);

	dmd_alloc_low_clean ();

	font_render_string_left (&font_mono5, 1, 1, MACHINE_NAME);

#ifdef DEBUGGER
	sprintf ("D%s.%s", C_STRING(MACHINE_MAJOR_VERSION), C_STRING(MACHINE_MINOR_VERSION));
#else
	sprintf ("R%s.%s", C_STRING(MACHINE_MAJOR_VERSION), C_STRING(MACHINE_MINOR_VERSION));
#endif
	font_render_string_right (&font_mono5, 127, 1, sprintf_buffer);

	SECTION_VOIDCALL (__common__, render_build_date);
	font_render_string_left (&font_mono5, 1, 9, sprintf_buffer);

#if (MACHINE_PIC == 1)
	pic_render_serial_number ();
	font_render_string_left (&font_mono5, 1, 18, sprintf_buffer);
#endif

	font_render_string_left (&font_mono5, 1, 26, "TESTING...");
	dmd_show_low ();

	/* Keep the reset display for at least 3 seconds (so
	 * it is readable), keep it longer if any of the
	 * asynchronous initializations are still running. */
	task_sleep_sec (3);
	while (sys_init_pending_tasks != 0)
		task_sleep (TIME_66MS);

	/* If there were any diagnostic errors discovered, announce
	this fact. */
	diag_announce_if_errors ();

	dbprintf ("System initialized.\n");
	deff_exit ();
}
Ejemplo n.º 4
0
// Instantiate a File with a filename
iridium_method(File, initialize) {
  object self = local(self);
  object filename = local(filename);
  object mode = local(mode);
  FILE * f = fopen(C_STRING(context, filename), C_STRING(context, mode));
  send(self, "__set__", L_ATOM(filename), filename);
  send(self, "__set__", L_ATOM(mode), mode);
  if (NULL == f) {
    RAISE(send(CLASS(FileNotFoundError), "new", filename));
  }
  internal_set_attribute(self, L_ATOM(FILE), f);
  return NIL;
}
Ejemplo n.º 5
0
extern inline void switch_rowpoll (const U8 col)
{
	/* Load the raw switch value from the hardware. */
	if (col == 0)
	{
		/* Column 0 = Dedicated Switches */
		__asm__ volatile ("ldb\t" C_STRING (WPC_SW_CABINET_INPUT));
	}
Ejemplo n.º 6
0
//! @brief Initializes the logging functions.
///initializes logging in an hidden stream and std::cout/gui messages
wxLogWindow* InitializeLoggingTargets( wxWindow* parent, bool console, const wxString&  logfilepath, bool showgui, int verbosity, wxLogChain* logChain )
{
	wxLogWindow* loggerwin = NULL;
	if ( console ) {
#if wxUSE_STD_IOSTREAM
		///std::cout logging
		logChain = new wxLogChain( new wxLogStream( &std::cout ) );
#else
		///std::cerr logging
		logChain = new wxLogChain( new  wxLogStderr( 0 ) );
#endif
	}

	if (showgui) {
		///gui window logging
		loggerwin = new wxLogWindow(parent, IdentityString( _("%s error console") ), showgui );
		logChain = new wxLogChain( loggerwin );
	}

	if (!console && !showgui) {
		new wxLogNull(); //memleak but disables logging as no log target exists
		//FIXME: there should be a cleaner way (like just not showing message boxes)
	}

	if (!logfilepath.empty()) {
		FILE* logfile = fopen(C_STRING(logfilepath), "w"); // even if it returns null, wxLogStderr will switch to stderr logging, so it's fine
		logChain = new wxLogChain( new  wxLogStderr( logfile ) );
	}

#if wxUSE_DEBUGREPORT && defined(ENABLE_DEBUG_REPORT) && wxUSE_STD_IOSTREAM
	///hidden stream logging for crash reports
	wxLog *loggercrash = new wxLogStream( &CrashReport::instance().crashlog );
	logChain = new wxLogChain( loggercrash );

//	logCrashChain->SetLogLevel( wxLOG_Trace );
//	logCrashChain->SetVerbose( true );
#endif

	if (logChain!=NULL) {
	switch (verbosity) {
		case 0: case 1:
			logChain->SetLogLevel( wxLOG_FatalError ); break;
		case 2:
			logChain->SetLogLevel( wxLOG_Error ); break;
		case 3:
			logChain->SetLogLevel( wxLOG_Warning ); break;
		case 4:
			logChain->SetLogLevel( wxLOG_Message ); break;
		case 5:
			logChain->SetLogLevel( wxLOG_Trace );
			logChain->SetVerbose( true ); break;
		default://meaning loglevel < 0 or > 5 , == 0 is handled seperately
			logChain->SetLogLevel( wxLOG_Warning ); break;
		}
	}

	return loggerwin;
}
Ejemplo n.º 7
0
iridium_method(File, write) {
  // The string to write
  char * str = C_STRING(context, local(str));
  size_t len = strlen(str);
  FILE * f = internal_get_attribute(local(self), L_ATOM(FILE), FILE *);
  size_t written = fwrite(str, sizeof str[0], len, f);
  if (written != len) {
    RAISE(send(CLASS(IOError), "new", IR_STRING("File not in write mode")));
  }
  return NIL;
}
Ejemplo n.º 8
0
int test(struct IridiumContext * context) {

  object integer;
  char * c_integer;

  setup(context);

  integer = FIXNUM(-11);

  c_integer = C_STRING(context, send(integer, "to_s"));

  assertEqual(strcmp(c_integer, "-11"), 0);

  return 0;
}
Ejemplo n.º 9
0
#include <freewpc.h>
#include <amode.h>
#include <diag.h>
#include <replay.h>

/**
 * \file
 * \brief System reset message screen and user acceptance of the software.
 */

#define ACCEPT_1	0x19
#define ACCEPT_2	0x75
#define ACCEPT_3	0xB9


volatile static const char gcc_version[] = C_STRING(GCC_VERSION);

__nvram__ U8 freewpc_accepted[3];

extern __common__ void opto_check (void);


/**
 * Wait for a button to be pressed and released.
 */
extern inline void wait_for_button (const U8 swno)
{
	/* TODO - why is this not done in native mode? */
#ifndef CONFIG_NO_ACCEPT
#ifndef CONFIG_NATIVE
	while (!switch_poll (swno))
Ejemplo n.º 10
0
//! @brief Initializes the logging functions.
///initializes logging in an hidden stream and std::cout/gui messages
wxLogWindow* InitializeLoggingTargets( wxFrame* parent, bool console, const wxString&  logfilepath, bool showgui, bool /*logcrash*/, int verbosity, wxLogChain* logChain )
{
    wxLogWindow* loggerwin = 0;

#if wxUSE_STD_IOSTREAM
    if (  console && verbosity != 0 )
    {
        ///std::cout logging
        logChain = new wxLogChain( new wxLogStream( &std::cout ) );
    }
#else
	if (  console && verbosity != 0 )
	{
		///std::cerr logging
		logChain = new wxLogChain( new  wxLogStderr( 0 ) );
	}
#endif

	if ( logfilepath.size() != 0 && verbosity != 0 )
	{
		FILE* logfile = fopen(C_STRING(logfilepath), "w"); // even if it returns null, wxLogStderr will switch to stderr logging, so it's fine
		logChain = new wxLogChain( new  wxLogStderr( logfile ) );
	}

    if ( showgui && verbosity != 0 )
    {
        ///gui window logging
		loggerwin = new wxLogWindow( (wxWindow*) parent, IdentityString( _("%s error console") ), showgui );
        logChain = new wxLogChain( loggerwin );
    }

    #if wxUSE_DEBUGREPORT && defined(ENABLE_DEBUG_REPORT) && wxUSE_STD_IOSTREAM
        ///hidden stream logging for crash reports
        wxLog *loggercrash = new wxLogStream( &CrashReport::instance().crashlog );
        logChain = new wxLogChain( loggercrash );

//        logCrashChain->SetLogLevel( wxLOG_Trace );
//        logCrashChain->SetVerbose( true );
    #endif




    if ( !(  console || showgui ) || verbosity == 0 ){
        new wxLogNull;
        return loggerwin;
    }

    if ( logChain )
    {
        switch (verbosity)
        {
            case 1:
                logChain->SetLogLevel( wxLOG_FatalError ); break;
            case 2:
                logChain->SetLogLevel( wxLOG_Error ); break;
            case 3:
                logChain->SetLogLevel( wxLOG_Warning ); break;
            case 4:
                logChain->SetLogLevel( wxLOG_Message ); break;
            case 5:
                logChain->SetLogLevel( wxLOG_Trace );
                logChain->SetVerbose( true ); break;
            default://meaning loglevel < 0 or > 5 , == 0 is handled seperately
                logChain->SetLogLevel( wxLOG_Warning ); break;
        }
    }

    return loggerwin;
}