Compare commits

...

2 commits

Author SHA1 Message Date
Gwenhael Le Moine
d0630eb490
remove macro CHF_Condition 2024-10-08 15:31:33 +02:00
Gwenhael Le Moine
6982d09b61
remove macro ChfEnd 2024-10-08 15:26:59 +02:00
19 changed files with 154 additions and 166 deletions

View file

@ -257,7 +257,7 @@ static void ExecSHUTDN( void )
cpu_status.shutdn = 1;
/* the CPU module implements SHUTDN signalling the condition CPU_I_SHUTDN */
CHF_Condition( CPU_CHF_MODULE_ID ) CPU_I_SHUTDN, CHF_INFO ChfEnd;
ChfGenerate( CPU_CHF_MODULE_ID, __FILE__, __LINE__, CPU_I_SHUTDN, CHF_INFO );
ChfSignal( CPU_CHF_MODULE_ID );
}
@ -1109,7 +1109,7 @@ static void ExecTest_9( void )
break;
default:
CHF_Condition( CPU_CHF_MODULE_ID ) CPU_F_INTERR, CHF_FATAL, "Bad_Test_Code" ChfEnd;
ChfGenerate( CPU_CHF_MODULE_ID, __FILE__, __LINE__, CPU_F_INTERR, CHF_FATAL, "Bad_Test_Code" );
ChfSignal( CPU_CHF_MODULE_ID );
break;
}
@ -1146,7 +1146,7 @@ static void ExecTest_8A( void )
break;
default:
CHF_Condition( CPU_CHF_MODULE_ID ) CPU_F_INTERR, CHF_FATAL, "Bad_Test_Code" ChfEnd;
ChfGenerate( CPU_CHF_MODULE_ID, __FILE__, __LINE__, CPU_F_INTERR, CHF_FATAL, "Bad_Test_Code" );
ChfSignal( CPU_CHF_MODULE_ID );
break;
}
@ -1183,7 +1183,7 @@ static void ExecTest_8B( void )
break;
default:
CHF_Condition( CPU_CHF_MODULE_ID ) CPU_F_INTERR, CHF_FATAL, "Bad_Test_Code" ChfEnd;
ChfGenerate( CPU_CHF_MODULE_ID, __FILE__, __LINE__, CPU_F_INTERR, CHF_FATAL, "Bad_Test_Code" );
ChfSignal( CPU_CHF_MODULE_ID );
break;
}
@ -1238,7 +1238,7 @@ static void ExecRegOp_A( void )
break;
default:
CHF_Condition( CPU_CHF_MODULE_ID ) CPU_F_INTERR, CHF_FATAL, "Bad_Operation_Code" ChfEnd;
ChfGenerate( CPU_CHF_MODULE_ID, __FILE__, __LINE__, CPU_F_INTERR, CHF_FATAL, "Bad_Operation_Code" );
ChfSignal( CPU_CHF_MODULE_ID );
break;
}
@ -1290,7 +1290,7 @@ static void ExecRegOp_B( void )
break;
default:
CHF_Condition( CPU_CHF_MODULE_ID ) CPU_F_INTERR, CHF_FATAL, "Bad_Operation_Code" ChfEnd;
ChfGenerate( CPU_CHF_MODULE_ID, __FILE__, __LINE__, CPU_F_INTERR, CHF_FATAL, "Bad_Operation_Code" );
ChfSignal( CPU_CHF_MODULE_ID );
break;
}
@ -1324,7 +1324,7 @@ static void ExecRegOp_C( void )
break;
default:
CHF_Condition( CPU_CHF_MODULE_ID ) CPU_F_INTERR, CHF_FATAL, "Bad_Operation_Code" ChfEnd;
ChfGenerate( CPU_CHF_MODULE_ID, __FILE__, __LINE__, CPU_F_INTERR, CHF_FATAL, "Bad_Operation_Code" );
ChfSignal( CPU_CHF_MODULE_ID );
break;
}
@ -1358,7 +1358,7 @@ static void ExecRegOp_D( void )
break;
default:
CHF_Condition( CPU_CHF_MODULE_ID ) CPU_F_INTERR, CHF_FATAL, "Bad_Operation_Code" ChfEnd;
ChfGenerate( CPU_CHF_MODULE_ID, __FILE__, __LINE__, CPU_F_INTERR, CHF_FATAL, "Bad_Operation_Code" );
ChfSignal( CPU_CHF_MODULE_ID );
break;
}
@ -1392,7 +1392,7 @@ static void ExecRegOp_E( void )
break;
default:
CHF_Condition( CPU_CHF_MODULE_ID ) CPU_F_INTERR, CHF_FATAL, "Bad_Operation_Code" ChfEnd;
ChfGenerate( CPU_CHF_MODULE_ID, __FILE__, __LINE__, CPU_F_INTERR, CHF_FATAL, "Bad_Operation_Code" );
ChfSignal( CPU_CHF_MODULE_ID );
break;
}
@ -1426,7 +1426,7 @@ static void ExecRegOp_F( void )
break;
default:
CHF_Condition( CPU_CHF_MODULE_ID ) CPU_F_INTERR, CHF_FATAL, "Bad_Operation_Code" ChfEnd;
ChfGenerate( CPU_CHF_MODULE_ID, __FILE__, __LINE__, CPU_F_INTERR, CHF_FATAL, "Bad_Operation_Code" );
ChfSignal( CPU_CHF_MODULE_ID );
break;
}
@ -1461,7 +1461,7 @@ static void ExecAND_OR( void )
break;
default:
CHF_Condition( CPU_CHF_MODULE_ID ) CPU_F_INTERR, CHF_FATAL, "Bad_Operation_Code" ChfEnd;
ChfGenerate( CPU_CHF_MODULE_ID, __FILE__, __LINE__, CPU_F_INTERR, CHF_FATAL, "Bad_Operation_Code" );
ChfSignal( CPU_CHF_MODULE_ID );
break;
}
@ -1573,7 +1573,7 @@ static void ExecGroup_0( void )
break;
default: /* Unknown opcode */
CHF_Condition( CPU_CHF_MODULE_ID ) CPU_E_BAD_OPCODE, CHF_ERROR, cpu_status.PC, n ChfEnd;
ChfGenerate( CPU_CHF_MODULE_ID, __FILE__, __LINE__, CPU_E_BAD_OPCODE, CHF_ERROR, cpu_status.PC, n );
ChfSignal( CPU_CHF_MODULE_ID );
break;
}
@ -1834,7 +1834,7 @@ static void ExecGroup_1( void )
break;
default:
CHF_Condition( CPU_CHF_MODULE_ID ) CPU_F_INTERR, CHF_FATAL, "Bad_Operation_Code" ChfEnd;
ChfGenerate( CPU_CHF_MODULE_ID, __FILE__, __LINE__, CPU_F_INTERR, CHF_FATAL, "Bad_Operation_Code" );
ChfSignal( CPU_CHF_MODULE_ID );
break;
}
@ -1904,7 +1904,7 @@ static void ExecGroup_1( void )
default:
/* Unknown opcode */
CHF_Condition( CPU_CHF_MODULE_ID ) CPU_E_BAD_OPCODE, CHF_ERROR, cpu_status.PC, n ChfEnd;
ChfGenerate( CPU_CHF_MODULE_ID, __FILE__, __LINE__, CPU_E_BAD_OPCODE, CHF_ERROR, cpu_status.PC, n );
ChfSignal( CPU_CHF_MODULE_ID );
break;
}
@ -1939,7 +1939,7 @@ static void ExecGroup_808( void )
case 3: /* BUSCB */
debug1( DEBUG_C_TRACE, CPU_I_CALLED, "ExecBUSCB" );
CHF_Condition( CPU_CHF_MODULE_ID ) CPU_F_INTERR, CHF_WARNING, "BUSCB" ChfEnd;
ChfGenerate( CPU_CHF_MODULE_ID, __FILE__, __LINE__, CPU_F_INTERR, CHF_WARNING, "BUSCB" );
ChfSignal( CPU_CHF_MODULE_ID );
break;
@ -1986,7 +1986,7 @@ static void ExecGroup_808( void )
case 0xD:
/* BUSCD */
debug1( DEBUG_C_TRACE, CPU_I_CALLED, "ExecBUSCD" );
CHF_Condition( CPU_CHF_MODULE_ID ) CPU_F_INTERR, CHF_WARNING, "BUSCD" ChfEnd;
ChfGenerate( CPU_CHF_MODULE_ID, __FILE__, __LINE__, CPU_F_INTERR, CHF_WARNING, "BUSCD" );
ChfSignal( CPU_CHF_MODULE_ID );
break;
@ -2004,7 +2004,7 @@ static void ExecGroup_808( void )
default:
/* Unknown opcode */
CHF_Condition( CPU_CHF_MODULE_ID ) CPU_E_BAD_OPCODE, CHF_ERROR, cpu_status.PC, n ChfEnd;
ChfGenerate( CPU_CHF_MODULE_ID, __FILE__, __LINE__, CPU_E_BAD_OPCODE, CHF_ERROR, cpu_status.PC, n );
ChfSignal( CPU_CHF_MODULE_ID );
break;
}
@ -2070,13 +2070,13 @@ static void ExecGroup_80( void )
case 0xB: /* BUSCC */
debug1( DEBUG_C_TRACE, CPU_I_CALLED, "ExecBUSCC" );
// FIXME: 49g bugs here on display change
CHF_Condition( CPU_CHF_MODULE_ID ) CPU_F_INTERR, CHF_WARNING, "BUSCC" ChfEnd;
ChfGenerate( CPU_CHF_MODULE_ID, __FILE__, __LINE__, CPU_F_INTERR, CHF_WARNING, "BUSCC" );
ChfSignal( CPU_CHF_MODULE_ID );
break;
case 0xE: /* SREQ? */
debug1( DEBUG_C_TRACE, CPU_I_CALLED, "ExecSREQ" );
CHF_Condition( CPU_CHF_MODULE_ID ) CPU_F_INTERR, CHF_WARNING, "SREQ" ChfEnd;
ChfGenerate( CPU_CHF_MODULE_ID, __FILE__, __LINE__, CPU_F_INTERR, CHF_WARNING, "SREQ" );
ChfSignal( CPU_CHF_MODULE_ID );
break;
@ -2096,7 +2096,7 @@ static void ExecGroup_80( void )
break;
default:
CHF_Condition( CPU_CHF_MODULE_ID ) CPU_E_BAD_OPCODE, CHF_ERROR, cpu_status.PC, n ChfEnd;
ChfGenerate( CPU_CHF_MODULE_ID, __FILE__, __LINE__, CPU_E_BAD_OPCODE, CHF_ERROR, cpu_status.PC, n );
ChfSignal( CPU_CHF_MODULE_ID );
break;
}
@ -2150,7 +2150,7 @@ static void ExecSpecialGroup_81( int rp )
break;
default:
CHF_Condition( CPU_CHF_MODULE_ID ) CPU_E_BAD_OPCODE, CHF_ERROR, cpu_status.PC, n ChfEnd;
ChfGenerate( CPU_CHF_MODULE_ID, __FILE__, __LINE__, CPU_E_BAD_OPCODE, CHF_ERROR, cpu_status.PC, n );
ChfSignal( CPU_CHF_MODULE_ID );
break;
}
@ -2193,14 +2193,14 @@ static void ExecSpecialGroup_81( int rp )
}
default:
CHF_Condition( CPU_CHF_MODULE_ID ) CPU_E_BAD_OPCODE, CHF_ERROR, cpu_status.PC, n ChfEnd;
ChfGenerate( CPU_CHF_MODULE_ID, __FILE__, __LINE__, CPU_E_BAD_OPCODE, CHF_ERROR, cpu_status.PC, n );
ChfSignal( CPU_CHF_MODULE_ID );
break;
}
break;
default:
CHF_Condition( CPU_CHF_MODULE_ID ) CPU_F_INTERR, CHF_FATAL, "Bad_Register_Pair" ChfEnd;
ChfGenerate( CPU_CHF_MODULE_ID, __FILE__, __LINE__, CPU_F_INTERR, CHF_FATAL, "Bad_Register_Pair" );
ChfSignal( CPU_CHF_MODULE_ID );
break;
}
@ -2242,7 +2242,7 @@ static void ExecGroup_8( void )
break;
default:
CHF_Condition( CPU_CHF_MODULE_ID ) CPU_F_INTERR, CHF_FATAL, "Bad_Operation_Code" ChfEnd;
ChfGenerate( CPU_CHF_MODULE_ID, __FILE__, __LINE__, CPU_F_INTERR, CHF_FATAL, "Bad_Operation_Code" );
ChfSignal( CPU_CHF_MODULE_ID );
break;
}
@ -2319,7 +2319,7 @@ static void ExecGroup_8( void )
break;
default:
CHF_Condition( CPU_CHF_MODULE_ID ) CPU_E_BAD_OPCODE, CHF_ERROR, cpu_status.PC, n ChfEnd;
ChfGenerate( CPU_CHF_MODULE_ID, __FILE__, __LINE__, CPU_E_BAD_OPCODE, CHF_ERROR, cpu_status.PC, n );
ChfSignal( CPU_CHF_MODULE_ID );
break;
}
@ -2476,7 +2476,7 @@ void CpuInit( void )
debug1( DEBUG_C_REVISION, CPU_I_REVISION, CPU_RCS_INFO );
if ( ReadStructFromFile( config.cpu_file_name, sizeof( cpu_status ), &cpu_status ) ) {
CHF_Condition( CPU_CHF_MODULE_ID ) CPU_W_RESETTING, CHF_WARNING ChfEnd;
ChfGenerate( CPU_CHF_MODULE_ID, __FILE__, __LINE__, CPU_W_RESETTING, CHF_WARNING );
ChfSignal( CPU_CHF_MODULE_ID );
CpuReset();
@ -2512,7 +2512,7 @@ void CpuSave( void )
debug1( DEBUG_C_TRACE, CPU_I_CALLED, "CpuSave" );
if ( WriteStructToFile( &cpu_status, sizeof( cpu_status ), config.cpu_file_name ) ) {
CHF_Condition( CPU_CHF_MODULE_ID ) CPU_E_SAVE, CHF_ERROR ChfEnd;
ChfGenerate( CPU_CHF_MODULE_ID, __FILE__, __LINE__, CPU_E_SAVE, CHF_ERROR );
ChfSignal( CPU_CHF_MODULE_ID );
}
}
@ -2942,7 +2942,7 @@ void OneStep( void )
break;
default:
CHF_Condition( CPU_CHF_MODULE_ID ) CPU_E_BAD_OPCODE, CHF_ERROR, cpu_status.PC, n ChfEnd;
ChfGenerate( CPU_CHF_MODULE_ID, __FILE__, __LINE__, CPU_E_BAD_OPCODE, CHF_ERROR, cpu_status.PC, n );
ChfSignal( CPU_CHF_MODULE_ID );
break;
}

View file

@ -105,7 +105,7 @@ void SetDebugLevel( int new_level )
#ifdef DEBUG
debug_level |= new_level;
#else
CHF_Condition( DEBUG_CHF_MODULE_ID ) DEBUG_W_NOT_SUPPORTED, CHF_WARNING ChfEnd;
ChfGenerate( DEBUG_CHF_MODULE_ID, __FILE__, __LINE__, DEBUG_W_NOT_SUPPORTED, CHF_WARNING );
ChfSignal( DEBUG_CHF_MODULE_ID );
#endif
}

View file

@ -108,10 +108,10 @@ extern int debug_level;
# define debug_preamble( debug_class, condition_code ) \
{ \
if ( debug_level & ( debug_class ) ) { \
CHF_Condition( CHF_MODULE_ID ) condition_code, CHF_INFO
ChfGenerate( CHF_MODULE_ID, __FILE__, __LINE__, condition_code, CHF_INFO
# define debug_postamble \
ChfEnd; \
); \
ChfSignal( CHF_MODULE_ID ); \
} \
}

View file

@ -407,7 +407,7 @@ static Address DisTest_9( Address pc, char* ob )
break;
default:
CHF_Condition( CPU_CHF_MODULE_ID ) CPU_F_INTERR, CHF_FATAL, "Bad_Test_Code" ChfEnd;
ChfGenerate( CPU_CHF_MODULE_ID, __FILE__, __LINE__, CPU_F_INTERR, CHF_FATAL, "Bad_Test_Code" );
ChfSignal( CPU_CHF_MODULE_ID );
break;
}
@ -540,7 +540,7 @@ static Address DisRegOp_A( Address pc, char* ob )
break;
default:
CHF_Condition( CPU_CHF_MODULE_ID ) CPU_F_INTERR, CHF_FATAL, "Bad_Operation_Code" ChfEnd;
ChfGenerate( CPU_CHF_MODULE_ID, __FILE__, __LINE__, CPU_F_INTERR, CHF_FATAL, "Bad_Operation_Code" );
ChfSignal( CPU_CHF_MODULE_ID );
break;
}
@ -672,7 +672,7 @@ static Address DisRegOp_B( Address pc, char* ob )
break;
default:
CHF_Condition( CPU_CHF_MODULE_ID ) CPU_F_INTERR, CHF_FATAL, "Bad_Operation_Code" ChfEnd;
ChfGenerate( CPU_CHF_MODULE_ID, __FILE__, __LINE__, CPU_F_INTERR, CHF_FATAL, "Bad_Operation_Code" );
ChfSignal( CPU_CHF_MODULE_ID );
break;
}
@ -751,7 +751,7 @@ static Address DisRegOp_C( Address pc, char* ob )
break;
default:
CHF_Condition( CPU_CHF_MODULE_ID ) CPU_F_INTERR, CHF_FATAL, "Bad_Operation_Code" ChfEnd;
ChfGenerate( CPU_CHF_MODULE_ID, __FILE__, __LINE__, CPU_F_INTERR, CHF_FATAL, "Bad_Operation_Code" );
ChfSignal( CPU_CHF_MODULE_ID );
break;
}
@ -830,7 +830,7 @@ static Address DisRegOp_D( Address pc, char* ob )
break;
default:
CHF_Condition( CPU_CHF_MODULE_ID ) CPU_F_INTERR, CHF_FATAL, "Bad_Operation_Code" ChfEnd;
ChfGenerate( CPU_CHF_MODULE_ID, __FILE__, __LINE__, CPU_F_INTERR, CHF_FATAL, "Bad_Operation_Code" );
ChfSignal( CPU_CHF_MODULE_ID );
break;
}
@ -910,7 +910,7 @@ static Address DisRegOp_E( Address pc, char* ob )
break;
default:
CHF_Condition( CPU_CHF_MODULE_ID ) CPU_F_INTERR, CHF_FATAL, "Bad_Operation_Code" ChfEnd;
ChfGenerate( CPU_CHF_MODULE_ID, __FILE__, __LINE__, CPU_F_INTERR, CHF_FATAL, "Bad_Operation_Code" );
ChfSignal( CPU_CHF_MODULE_ID );
break;
}
@ -990,7 +990,7 @@ static Address DisRegOp_F( Address pc, char* ob )
break;
default:
CHF_Condition( CPU_CHF_MODULE_ID ) CPU_F_INTERR, CHF_FATAL, "Bad_Operation_Code" ChfEnd;
ChfGenerate( CPU_CHF_MODULE_ID, __FILE__, __LINE__, CPU_F_INTERR, CHF_FATAL, "Bad_Operation_Code" );
ChfSignal( CPU_CHF_MODULE_ID );
break;
}
@ -1082,7 +1082,7 @@ static Address DisAND_OR( Address pc, char* ob )
break;
default:
CHF_Condition( CPU_CHF_MODULE_ID ) CPU_F_INTERR, CHF_FATAL, "Bad_Operation_Code" ChfEnd;
ChfGenerate( CPU_CHF_MODULE_ID, __FILE__, __LINE__, CPU_F_INTERR, CHF_FATAL, "Bad_Operation_Code" );
ChfSignal( CPU_CHF_MODULE_ID );
break;
}
@ -1143,7 +1143,7 @@ static Address DisGroup_0( Address pc, char* ob )
/* Unknown opcode */
strcpy( ob, "?" );
CHF_Condition( CPU_CHF_MODULE_ID ) CPU_E_BAD_OPCODE, CHF_ERROR, pc, n ChfEnd;
ChfGenerate( CPU_CHF_MODULE_ID, __FILE__, __LINE__, CPU_E_BAD_OPCODE, CHF_ERROR, pc, n );
ChfSignal( CPU_CHF_MODULE_ID );
break;
}
@ -1414,7 +1414,7 @@ static Address DisGroup_1( Address pc, char* ob )
/* Unknown opcode */
strcpy( ob, "?" );
CHF_Condition( CPU_CHF_MODULE_ID ) CPU_E_BAD_OPCODE, CHF_ERROR, pc, n ChfEnd;
ChfGenerate( CPU_CHF_MODULE_ID, __FILE__, __LINE__, CPU_E_BAD_OPCODE, CHF_ERROR, pc, n );
ChfSignal( CPU_CHF_MODULE_ID );
break;
}
@ -1529,7 +1529,7 @@ static Address DisGroup_808( Address pc, char* ob )
/* Unknown opcode */
strcpy( ob, "?" );
CHF_Condition( CPU_CHF_MODULE_ID ) CPU_E_BAD_OPCODE, CHF_ERROR, pc, n ChfEnd;
ChfGenerate( CPU_CHF_MODULE_ID, __FILE__, __LINE__, CPU_E_BAD_OPCODE, CHF_ERROR, pc, n );
ChfSignal( CPU_CHF_MODULE_ID );
break;
}
@ -1598,7 +1598,7 @@ static Address DisGroup_80( Address pc, char* ob )
/* Unknown opcode */
strcpy( ob, "?" );
CHF_Condition( CPU_CHF_MODULE_ID ) CPU_E_BAD_OPCODE, CHF_ERROR, pc, n ChfEnd;
ChfGenerate( CPU_CHF_MODULE_ID, __FILE__, __LINE__, CPU_E_BAD_OPCODE, CHF_ERROR, pc, n );
ChfSignal( CPU_CHF_MODULE_ID );
break;
}
@ -1741,7 +1741,7 @@ static Address DisSpecialGroup_81( Address pc, char* ob, int rp )
break;
default:
CHF_Condition( CPU_CHF_MODULE_ID ) CPU_E_BAD_OPCODE, CHF_ERROR, pc, n ChfEnd;
ChfGenerate( CPU_CHF_MODULE_ID, __FILE__, __LINE__, CPU_E_BAD_OPCODE, CHF_ERROR, pc, n );
ChfSignal( CPU_CHF_MODULE_ID );
break;
}
@ -1755,7 +1755,7 @@ static Address DisSpecialGroup_81( Address pc, char* ob, int rp )
break;
default:
CHF_Condition( CPU_CHF_MODULE_ID ) CPU_F_INTERR, CHF_FATAL, "Bad_Register_Pair" ChfEnd;
ChfGenerate( CPU_CHF_MODULE_ID, __FILE__, __LINE__, CPU_F_INTERR, CHF_FATAL, "Bad_Register_Pair" );
ChfSignal( CPU_CHF_MODULE_ID );
break;
}
@ -1832,7 +1832,7 @@ static Address DisTest_8A( Address pc, char* ob )
break;
default:
CHF_Condition( CPU_CHF_MODULE_ID ) CPU_F_INTERR, CHF_FATAL, "Bad_Test_Code" ChfEnd;
ChfGenerate( CPU_CHF_MODULE_ID, __FILE__, __LINE__, CPU_F_INTERR, CHF_FATAL, "Bad_Test_Code" );
ChfSignal( CPU_CHF_MODULE_ID );
break;
}
@ -1913,7 +1913,7 @@ static Address DisTest_8B( Address pc, char* ob )
break;
default:
CHF_Condition( CPU_CHF_MODULE_ID ) CPU_F_INTERR, CHF_FATAL, "Bad_Test_Code" ChfEnd;
ChfGenerate( CPU_CHF_MODULE_ID, __FILE__, __LINE__, CPU_F_INTERR, CHF_FATAL, "Bad_Test_Code" );
ChfSignal( CPU_CHF_MODULE_ID );
break;
}
@ -2011,7 +2011,7 @@ static Address DisGroup_8( Address pc, char* ob )
break;
default:
CHF_Condition( CPU_CHF_MODULE_ID ) CPU_F_INTERR, CHF_FATAL, "Bad_Operation_Code" ChfEnd;
ChfGenerate( CPU_CHF_MODULE_ID, __FILE__, __LINE__, CPU_F_INTERR, CHF_FATAL, "Bad_Operation_Code" );
ChfSignal( CPU_CHF_MODULE_ID );
break;
}
@ -2180,7 +2180,7 @@ static Address DisGroup_8( Address pc, char* ob )
/* Unknown opcode */
strcpy( ob, "?" );
CHF_Condition( CPU_CHF_MODULE_ID ) CPU_E_BAD_OPCODE, CHF_ERROR, pc, n ChfEnd;
ChfGenerate( CPU_CHF_MODULE_ID, __FILE__, __LINE__, CPU_E_BAD_OPCODE, CHF_ERROR, pc, n );
ChfSignal( CPU_CHF_MODULE_ID );
break;
}
@ -2311,7 +2311,7 @@ Address Disassemble( Address pc, char ob[ DISASSEMBLE_OB_SIZE ] )
/* Unknown opcode */
strcpy( ob, "?" );
CHF_Condition( CPU_CHF_MODULE_ID ) CPU_E_BAD_OPCODE, CHF_ERROR, pc, n ChfEnd;
ChfGenerate( CPU_CHF_MODULE_ID, __FILE__, __LINE__, CPU_E_BAD_OPCODE, CHF_ERROR, pc, n );
ChfSignal( CPU_CHF_MODULE_ID );
break;
}

View file

@ -110,14 +110,14 @@ int ReadNibblesFromFile( const char* name, int size, Nibble* dest )
if ( ( f = fopen( name, "rb" ) ) == ( FILE* )NULL ) {
ChfGenerate( CHF_ERRNO_SET, __FILE__, __LINE__, errno, CHF_ERROR );
CHF_Condition( DISK_IO_CHF_MODULE_ID ) st = DISK_IO_E_OPEN, CHF_ERROR, name ChfEnd;
ChfGenerate( DISK_IO_CHF_MODULE_ID, __FILE__, __LINE__, st = DISK_IO_E_OPEN, CHF_ERROR, name );
} else {
for ( i = 0; i < size; ) {
by = getc( f );
if ( by == -1 ) {
ChfGenerate( CHF_ERRNO_SET, __FILE__, __LINE__, errno, CHF_ERROR );
CHF_Condition( DISK_IO_CHF_MODULE_ID ) st = DISK_IO_E_GETC, CHF_ERROR, name ChfEnd;
ChfGenerate( DISK_IO_CHF_MODULE_ID, __FILE__, __LINE__, st = DISK_IO_E_GETC, CHF_ERROR, name );
break;
}
@ -168,7 +168,7 @@ int WriteNibblesToFile( const Nibble* src, int size, const char* name )
if ( ( f = fopen( name, "wb" ) ) == ( FILE* )NULL ) {
ChfGenerate( CHF_ERRNO_SET, __FILE__, __LINE__, errno, CHF_ERROR );
CHF_Condition( DISK_IO_CHF_MODULE_ID ) st = DISK_IO_E_OPEN, CHF_ERROR, name ChfEnd;
ChfGenerate( DISK_IO_CHF_MODULE_ID, __FILE__, __LINE__, st = DISK_IO_E_OPEN, CHF_ERROR, name );
} else {
for ( i = 0; i < size; ) {
by = ( int )src[ i++ ];
@ -176,14 +176,14 @@ int WriteNibblesToFile( const Nibble* src, int size, const char* name )
if ( putc( by, f ) == EOF ) {
ChfGenerate( CHF_ERRNO_SET, __FILE__, __LINE__, errno, CHF_ERROR );
CHF_Condition( DISK_IO_CHF_MODULE_ID ) st = DISK_IO_E_PUTC, CHF_ERROR, name ChfEnd;
ChfGenerate( DISK_IO_CHF_MODULE_ID, __FILE__, __LINE__, st = DISK_IO_E_PUTC, CHF_ERROR, name );
break;
}
}
if ( fclose( f ) == EOF ) {
ChfGenerate( CHF_ERRNO_SET, __FILE__, __LINE__, errno, CHF_ERROR );
CHF_Condition( DISK_IO_CHF_MODULE_ID ) st = DISK_IO_E_CLOSE, CHF_ERROR, name ChfEnd;
ChfGenerate( DISK_IO_CHF_MODULE_ID, __FILE__, __LINE__, st = DISK_IO_E_CLOSE, CHF_ERROR, name );
}
}
@ -223,11 +223,11 @@ int ReadStructFromFile( const char* name, size_t s_size, void* s )
if ( ( f = fopen( name, "rb" ) ) == ( FILE* )NULL ) {
ChfGenerate( CHF_ERRNO_SET, __FILE__, __LINE__, errno, CHF_ERROR );
CHF_Condition( DISK_IO_CHF_MODULE_ID ) st = DISK_IO_E_OPEN, CHF_ERROR, name ChfEnd;
ChfGenerate( DISK_IO_CHF_MODULE_ID, __FILE__, __LINE__, st = DISK_IO_E_OPEN, CHF_ERROR, name );
} else {
if ( fread( s, s_size, ( size_t )1, f ) != 1 ) {
ChfGenerate( CHF_ERRNO_SET, __FILE__, __LINE__, errno, CHF_ERROR );
CHF_Condition( DISK_IO_CHF_MODULE_ID ) st = DISK_IO_E_READ, CHF_ERROR, name ChfEnd;
ChfGenerate( DISK_IO_CHF_MODULE_ID, __FILE__, __LINE__, st = DISK_IO_E_READ, CHF_ERROR, name );
}
( void )fclose( f );
@ -271,16 +271,16 @@ int WriteStructToFile( const void* s, size_t s_size, const char* name )
if ( ( f = fopen( name, "wb" ) ) == ( FILE* )NULL ) {
ChfGenerate( CHF_ERRNO_SET, __FILE__, __LINE__, errno, CHF_ERROR );
CHF_Condition( DISK_IO_CHF_MODULE_ID ) st = DISK_IO_E_OPEN, CHF_ERROR, name ChfEnd;
ChfGenerate( DISK_IO_CHF_MODULE_ID, __FILE__, __LINE__, st = DISK_IO_E_OPEN, CHF_ERROR, name );
} else {
if ( fwrite( s, s_size, ( size_t )1, f ) != 1 ) {
ChfGenerate( CHF_ERRNO_SET, __FILE__, __LINE__, errno, CHF_ERROR );
CHF_Condition( DISK_IO_CHF_MODULE_ID ) st = DISK_IO_E_WRITE, CHF_ERROR, name ChfEnd;
ChfGenerate( DISK_IO_CHF_MODULE_ID, __FILE__, __LINE__, st = DISK_IO_E_WRITE, CHF_ERROR, name );
}
if ( fclose( f ) == EOF ) {
ChfGenerate( CHF_ERRNO_SET, __FILE__, __LINE__, errno, CHF_ERROR );
CHF_Condition( DISK_IO_CHF_MODULE_ID ) st = DISK_IO_E_CLOSE, CHF_ERROR, name ChfEnd;
ChfGenerate( DISK_IO_CHF_MODULE_ID, __FILE__, __LINE__, st = DISK_IO_E_CLOSE, CHF_ERROR, name );
}
}

View file

@ -137,7 +137,7 @@ int ReadObjectFromFile( const char* name, const char* hdr, Address start, Addres
if ( ( f = fopen( name, "rb" ) ) == ( FILE* )NULL ) {
ChfGenerate( CHF_ERRNO_SET, __FILE__, __LINE__, errno, CHF_ERROR );
CHF_Condition( DISK_IO_CHF_MODULE_ID ) st = DISK_IO_E_OPEN, CHF_ERROR, name ChfEnd;
ChfGenerate( DISK_IO_CHF_MODULE_ID, __FILE__, __LINE__, st = DISK_IO_E_OPEN, CHF_ERROR, name );
} else {
/* Check and skip header */
for ( i = 0; i < ( int )hdr_len; i++ ) {
@ -145,10 +145,10 @@ int ReadObjectFromFile( const char* name, const char* hdr, Address start, Addres
if ( by == EOF ) {
ChfGenerate( CHF_ERRNO_SET, __FILE__, __LINE__, errno, CHF_ERROR );
CHF_Condition( DISK_IO_CHF_MODULE_ID ) st = DISK_IO_E_GETC, CHF_ERROR, name ChfEnd;
ChfGenerate( DISK_IO_CHF_MODULE_ID, __FILE__, __LINE__, st = DISK_IO_E_GETC, CHF_ERROR, name );
break;
} else if ( hdr[ i ] != '?' && by != hdr[ i ] ) {
CHF_Condition( DISK_IO_CHF_MODULE_ID ) st = DISK_IO_E_BAD_HDR, CHF_ERROR, name ChfEnd;
ChfGenerate( DISK_IO_CHF_MODULE_ID, __FILE__, __LINE__, st = DISK_IO_E_BAD_HDR, CHF_ERROR, name );
break;
}
}
@ -160,7 +160,7 @@ int ReadObjectFromFile( const char* name, const char* hdr, Address start, Addres
while ( ( by = getc( f ) ) != EOF ) {
/* Next byte available in by; check available space */
if ( cur >= end - 1 ) {
CHF_Condition( DISK_IO_CHF_MODULE_ID ) st = DISK_IO_E_SIZE, CHF_ERROR, name ChfEnd;
ChfGenerate( DISK_IO_CHF_MODULE_ID, __FILE__, __LINE__, st = DISK_IO_E_SIZE, CHF_ERROR, name );
break;
}
@ -172,7 +172,7 @@ int ReadObjectFromFile( const char* name, const char* hdr, Address start, Addres
/* Check why getc() failed */
if ( ferror( f ) && !feof( f ) ) {
ChfGenerate( CHF_ERRNO_SET, __FILE__, __LINE__, errno, CHF_ERROR );
CHF_Condition( DISK_IO_CHF_MODULE_ID ) st = DISK_IO_E_GETC, CHF_ERROR, name ChfEnd;
ChfGenerate( DISK_IO_CHF_MODULE_ID, __FILE__, __LINE__, st = DISK_IO_E_GETC, CHF_ERROR, name );
}
/* Recover from save_area if transfer failed */
@ -234,13 +234,13 @@ int WriteObjectToFile( Address start, Address end, const char* hdr, const char*
if ( ( f = fopen( name, "wb" ) ) == ( FILE* )NULL ) {
ChfGenerate( CHF_ERRNO_SET, __FILE__, __LINE__, errno, CHF_ERROR );
CHF_Condition( DISK_IO_CHF_MODULE_ID ) st = DISK_IO_E_OPEN, CHF_ERROR, name ChfEnd;
ChfGenerate( DISK_IO_CHF_MODULE_ID, __FILE__, __LINE__, st = DISK_IO_E_OPEN, CHF_ERROR, name );
} else {
/* Write header; replace wildcard character '?' with 'S' */
for ( i = 0; i < ( int )hdr_len; i++ ) {
if ( putc( hdr[ i ] == '?' ? 'S' : hdr[ i ], f ) == EOF ) {
ChfGenerate( CHF_ERRNO_SET, __FILE__, __LINE__, errno, CHF_ERROR );
CHF_Condition( DISK_IO_CHF_MODULE_ID ) st = DISK_IO_E_PUTC, CHF_ERROR, name ChfEnd;
ChfGenerate( DISK_IO_CHF_MODULE_ID, __FILE__, __LINE__, st = DISK_IO_E_PUTC, CHF_ERROR, name );
break;
}
}
@ -255,7 +255,7 @@ int WriteObjectToFile( Address start, Address end, const char* hdr, const char*
if ( putc( by, f ) == EOF ) {
ChfGenerate( CHF_ERRNO_SET, __FILE__, __LINE__, errno, CHF_ERROR );
CHF_Condition( DISK_IO_CHF_MODULE_ID ) st = DISK_IO_E_PUTC, CHF_ERROR, name ChfEnd;
ChfGenerate( DISK_IO_CHF_MODULE_ID, __FILE__, __LINE__, st = DISK_IO_E_PUTC, CHF_ERROR, name );
break;
}
}
@ -266,7 +266,7 @@ int WriteObjectToFile( Address start, Address end, const char* hdr, const char*
if ( putc( by, f ) == EOF ) {
ChfGenerate( CHF_ERRNO_SET, __FILE__, __LINE__, errno, CHF_ERROR );
CHF_Condition( DISK_IO_CHF_MODULE_ID ) st = DISK_IO_E_PUTC, CHF_ERROR, name ChfEnd;
ChfGenerate( DISK_IO_CHF_MODULE_ID, __FILE__, __LINE__, st = DISK_IO_E_PUTC, CHF_ERROR, name );
}
}
}
@ -274,7 +274,7 @@ int WriteObjectToFile( Address start, Address end, const char* hdr, const char*
/* Close the output file anyway */
if ( fclose( f ) == EOF ) {
ChfGenerate( CHF_ERRNO_SET, __FILE__, __LINE__, errno, CHF_ERROR );
CHF_Condition( DISK_IO_CHF_MODULE_ID ) st = DISK_IO_E_CLOSE, CHF_ERROR, name ChfEnd;
ChfGenerate( DISK_IO_CHF_MODULE_ID, __FILE__, __LINE__, st = DISK_IO_E_CLOSE, CHF_ERROR, name );
}
}

View file

@ -219,7 +219,7 @@ static void EmulatorLoop( void )
/* Emulator Interrupt Request */
if ( ( t1_count++ & INT_T1_MASK ) == 0 && emulator_int_req ) {
CHF_Condition( CPU_CHF_MODULE_ID ) CPU_I_EMULATOR_INT, CHF_INFO ChfEnd;
ChfGenerate( CPU_CHF_MODULE_ID, __FILE__, __LINE__, CPU_I_EMULATOR_INT, CHF_INFO );
ChfSignal( CPU_CHF_MODULE_ID );
}

View file

@ -132,7 +132,7 @@ static int wb[ WB_SIZE ]; /* Write buffer */
static int BadCommand( enum FlashState* state, enum FlashCycle cycle, XAddress address, int data )
{
/* Unknown command: signal and reset state to FLASH_ST_READ_ARRAY */
CHF_Condition( FLASH_CHF_MODULE_ID ) FLASH_W_BAD_CMD, CHF_WARNING, *state, cycle, address, data ChfEnd;
ChfGenerate( FLASH_CHF_MODULE_ID, __FILE__, __LINE__, FLASH_W_BAD_CMD, CHF_WARNING, *state, cycle, address, data );
ChfSignal( FLASH_CHF_MODULE_ID );
*state = FLASH_ST_READ_ARRAY;
@ -191,7 +191,7 @@ static int ParseCommand( enum FlashState* state, enum FlashCycle cycle, XAddress
default:
/* Unknown command; signal, ignore, keep current state. */
CHF_Condition( FLASH_CHF_MODULE_ID ) FLASH_W_BAD_CMD, CHF_WARNING, *state, cycle, address, data ChfEnd;
ChfGenerate( FLASH_CHF_MODULE_ID, __FILE__, __LINE__, FLASH_W_BAD_CMD, CHF_WARNING, *state, cycle, address, data );
ChfSignal( FLASH_CHF_MODULE_ID );
break;
}
@ -259,7 +259,7 @@ static int StoreData( enum FlashState* state, enum FlashCycle cycle, XAddress ad
case FLASH_ST_WRITE_DATA_N:
index = address - wb_start;
if ( index < 0 || index >= WB_SIZE ) {
CHF_Condition( FLASH_CHF_MODULE_ID ) FLASH_W_BAD_ADDRESS, CHF_WARNING, *state, cycle, address, data ChfEnd;
ChfGenerate( FLASH_CHF_MODULE_ID, __FILE__, __LINE__, FLASH_W_BAD_ADDRESS, CHF_WARNING, *state, cycle, address, data );
ChfSignal( FLASH_CHF_MODULE_ID );
} else
wb[ index ] = data;

View file

@ -146,7 +146,7 @@ void HdwInit( void )
debug1( DEBUG_C_TRACE, MOD_I_CALLED, "HdwInit" );
if ( ReadStructFromFile( config.hdw_file_name, sizeof( mod_status.hdw ), &mod_status.hdw ) ) {
CHF_Condition( MOD_CHF_MODULE_ID ) MOD_W_HDW_INIT, CHF_WARNING ChfEnd;
ChfGenerate( MOD_CHF_MODULE_ID, __FILE__, __LINE__, MOD_W_HDW_INIT, CHF_WARNING );
ChfSignal( MOD_CHF_MODULE_ID );
( void )memset( &mod_status.hdw, 0, sizeof( mod_status.hdw ) );
@ -180,7 +180,7 @@ void HdwSave( void )
debug1( DEBUG_C_TRACE, MOD_I_CALLED, "HdwSave" );
if ( WriteStructToFile( &mod_status.hdw, sizeof( mod_status.hdw ), config.hdw_file_name ) ) {
CHF_Condition( MOD_CHF_MODULE_ID ) MOD_E_HDW_SAVE, CHF_ERROR ChfEnd;
ChfGenerate( MOD_CHF_MODULE_ID, __FILE__, __LINE__, MOD_E_HDW_SAVE, CHF_ERROR );
ChfSignal( MOD_CHF_MODULE_ID );
}
}
@ -324,7 +324,7 @@ Nibble HdwRead( Address rel_address )
return ( Nibble )( ( mod_status.hdw.t2_val >> ( ( rel_address - 0x38 ) * 4 ) ) & 0x0F );
default:
CHF_Condition( MOD_CHF_MODULE_ID ) MOD_W_HDW_READ, CHF_WARNING, rel_address ChfEnd;
ChfGenerate( MOD_CHF_MODULE_ID, __FILE__, __LINE__, MOD_W_HDW_READ, CHF_WARNING, rel_address );
ChfSignal( MOD_CHF_MODULE_ID );
return ( Nibble )0xF;
}
@ -531,7 +531,7 @@ void HdwWrite( Address rel_address, Nibble data )
break;
default:
CHF_Condition( MOD_CHF_MODULE_ID ) MOD_W_HDW_WRITE, CHF_WARNING, rel_address, ( int )data ChfEnd;
ChfGenerate( MOD_CHF_MODULE_ID, __FILE__, __LINE__, MOD_W_HDW_WRITE, CHF_WARNING, rel_address, ( int )data );
ChfSignal( MOD_CHF_MODULE_ID );
}

View file

@ -201,7 +201,7 @@ void ModSelectDescription( int model )
ModRegisterDescription( hw49_description );
break;
default:
/* CHF_Condition( MOD_CHF_MODULE_ID ) MOD_E_NO_MATCH, CHF_ERROR, config.hw ChfEnd; */
/* ChfGenerate( MOD_CHF_MODULE_ID, __FILE__, __LINE__, MOD_E_NO_MATCH, CHF_ERROR, config.hw ); */
/* ChfSignal( MOD_CHF_MODULE_ID ); */
fprintf( stderr, "Error: Unknown model %i\n", model );
exit( EXIT_FAILURE );

View file

@ -213,10 +213,10 @@ void KeybPress( const char* key )
unsigned int in_val, out_bit;
if ( sscanf( key, "%x/%x", &out_bit, &in_val ) != 2 ) {
CHF_Condition( MOD_CHF_MODULE_ID ) MOD_W_BAD_KEY, CHF_WARNING, key ChfEnd;
ChfGenerate( MOD_CHF_MODULE_ID, __FILE__, __LINE__, MOD_W_BAD_KEY, CHF_WARNING, key );
ChfSignal( MOD_CHF_MODULE_ID );
/* } else if ( out_bit < 0 || out_bit >= OUT_BITS ) { */
/* CHF_Condition( MOD_CHF_MODULE_ID ) MOD_W_BAD_OUT_BIT, CHF_WARNING, out_bit ChfEnd; */
/* ChfGenerate( MOD_CHF_MODULE_ID, __FILE__, __LINE__, MOD_W_BAD_OUT_BIT, CHF_WARNING, out_bit ); */
/* ChfSignal( MOD_CHF_MODULE_ID ); */
} else {
/* Update the cur_in array */
@ -263,10 +263,10 @@ void KeybRelease( const char* key )
unsigned int in_val, out_bit;
if ( sscanf( key, "%x/%x", &out_bit, &in_val ) != 2 ) {
CHF_Condition( MOD_CHF_MODULE_ID ) MOD_W_BAD_KEY, CHF_WARNING, key ChfEnd;
ChfGenerate( MOD_CHF_MODULE_ID, __FILE__, __LINE__, MOD_W_BAD_KEY, CHF_WARNING, key );
ChfSignal( MOD_CHF_MODULE_ID );
/* } else if ( out_bit < 0 || out_bit >= OUT_BITS ) { */
/* CHF_Condition( MOD_CHF_MODULE_ID ) MOD_W_BAD_OUT_BIT, CHF_WARNING, out_bit ChfEnd; */
/* ChfGenerate( MOD_CHF_MODULE_ID, __FILE__, __LINE__, MOD_W_BAD_OUT_BIT, CHF_WARNING, out_bit ); */
/* ChfSignal( MOD_CHF_MODULE_ID ); */
} else {
/* Update the cur_in array */

View file

@ -150,18 +150,6 @@ typedef /* Message retrieval 'get_message' function */
typedef /* Message retrieval 'exit' function */
void ( *ChfMrsExit )( void* );
/* -------------------------------------------------------------------------
Condition generation macros
------------------------------------------------------------------------- */
#define CHF_Condition( module_id ) \
ChfGenerate( \
module_id, \
__FILE__, __LINE__,
#define ChfEnd \
)
/* -------------------------------------------------------------------------
Function prototypes
------------------------------------------------------------------------- */

View file

@ -219,7 +219,7 @@ static int repl_c = 0; /* Entry replacement counter */
.- */
static Nibble BadRead( Address addr )
{
CHF_Condition( MOD_CHF_MODULE_ID ) MOD_E_BAD_READ, CHF_ERROR, addr ChfEnd;
ChfGenerate( MOD_CHF_MODULE_ID, __FILE__, __LINE__, MOD_E_BAD_READ, CHF_ERROR, addr );
ChfSignal( MOD_CHF_MODULE_ID );
return ( Nibble )0x0;
@ -251,7 +251,7 @@ static Nibble BadRead( Address addr )
.- */
static void BadWrite( Address addr, Nibble datum )
{
CHF_Condition( MOD_CHF_MODULE_ID ) MOD_E_BAD_WRITE, CHF_ERROR, addr, datum ChfEnd;
ChfGenerate( MOD_CHF_MODULE_ID, __FILE__, __LINE__, MOD_E_BAD_WRITE, CHF_ERROR, addr, datum );
ChfSignal( MOD_CHF_MODULE_ID );
}
@ -424,7 +424,7 @@ static struct ModMap* NewModMap( void )
if ( ( new = ( struct ModMap* )malloc( sizeof( struct ModMap ) ) ) == ( struct ModMap* )NULL ) {
ChfGenerate( CHF_ERRNO_SET, __FILE__, __LINE__, errno, CHF_ERROR );
CHF_Condition( MOD_CHF_MODULE_ID ) MOD_F_MAP_ALLOC, CHF_FATAL ChfEnd;
ChfGenerate( MOD_CHF_MODULE_ID, __FILE__, __LINE__, MOD_F_MAP_ALLOC, CHF_FATAL );
ChfSignal( MOD_CHF_MODULE_ID );
}
@ -577,7 +577,7 @@ static void FlushCache( struct ModMap* save )
#ifdef DEBUG
/* The alloc_c performance counter must be exactly 1 now */
if ( alloc_c != 1 ) {
CHF_Condition( MOD_CHF_MODULE_ID ) MOD_F_BAD_ALLOC_C, CHF_ERROR, alloc_c ChfEnd;
ChfGenerate( MOD_CHF_MODULE_ID, __FILE__, __LINE__, MOD_F_BAD_ALLOC_C, CHF_ERROR, alloc_c );
ChfSignal( MOD_CHF_MODULE_ID );
}
#endif
@ -716,7 +716,7 @@ struct ModCacheTableEntry* SelectConfigVictim( int retry )
if ( victim == ( struct ModCacheTableEntry* )NULL ) {
if ( retry ) {
/* Unable to find a victim; flush the cache and retry */
CHF_Condition( MOD_CHF_MODULE_ID ) MOD_W_NO_VICTIM, CHF_WARNING ChfEnd;
ChfGenerate( MOD_CHF_MODULE_ID, __FILE__, __LINE__, MOD_W_NO_VICTIM, CHF_WARNING );
ChfSignal( MOD_CHF_MODULE_ID );
FlushCache( mod_map_ptr );
@ -724,7 +724,7 @@ struct ModCacheTableEntry* SelectConfigVictim( int retry )
victim = SelectConfigVictim( 0 );
} else {
/* Unable to find a victim; retry is not an option; give up */
CHF_Condition( MOD_CHF_MODULE_ID ) MOD_F_NO_VICTIM, CHF_FATAL ChfEnd;
ChfGenerate( MOD_CHF_MODULE_ID, __FILE__, __LINE__, MOD_F_NO_VICTIM, CHF_FATAL );
ChfSignal( MOD_CHF_MODULE_ID );
}
} else
@ -848,7 +848,7 @@ static void FreeModMap( struct ModMap* p )
/* Should never happen */
if ( n == ( struct ModMap* )NULL ) {
CHF_Condition( MOD_CHF_MODULE_ID ) MOD_F_CHAIN_CORRUPTED, CHF_FATAL ChfEnd;
ChfGenerate( MOD_CHF_MODULE_ID, __FILE__, __LINE__, MOD_F_CHAIN_CORRUPTED, CHF_FATAL );
ChfSignal( MOD_CHF_MODULE_ID );
}
@ -950,7 +950,7 @@ void ModInit( void )
non-NULL argument.
*/
if ( mod_description == NULL ) {
CHF_Condition( MOD_CHF_MODULE_ID ) MOD_F_NO_DESCRIPTION, CHF_FATAL ChfEnd;
ChfGenerate( MOD_CHF_MODULE_ID, __FILE__, __LINE__, MOD_F_NO_DESCRIPTION, CHF_FATAL );
ChfSignal( MOD_CHF_MODULE_ID );
}
@ -969,7 +969,7 @@ void ModInit( void )
fails.
*/
if ( ReadStructFromFile( config.mod_file_name, sizeof( mod_map.map_info ), &mod_map.map_info ) ) {
CHF_Condition( MOD_CHF_MODULE_ID ) MOD_W_RESETTING_ALL, CHF_WARNING ChfEnd;
ChfGenerate( MOD_CHF_MODULE_ID, __FILE__, __LINE__, MOD_W_RESETTING_ALL, CHF_WARNING );
ChfSignal( MOD_CHF_MODULE_ID );
/* Reset all modules */
@ -1024,7 +1024,7 @@ void ModSave( void )
/* Attempt to save the mod_map from file */
if ( WriteStructToFile( &mod_map.map_info, sizeof( mod_map.map_info ), config.mod_file_name ) ) {
CHF_Condition( MOD_CHF_MODULE_ID ) MOD_F_MAP_SAVE, CHF_FATAL ChfEnd;
ChfGenerate( MOD_CHF_MODULE_ID, __FILE__, __LINE__, MOD_F_MAP_SAVE, CHF_FATAL );
ChfSignal( MOD_CHF_MODULE_ID );
}
}
@ -1253,7 +1253,7 @@ void ModConfig( Address config_info )
if ( mod == N_MOD ) {
/* All modules are configured - Signal a warning */
// FIXME: 48gx bugs here when running VERSION
CHF_Condition( MOD_CHF_MODULE_ID ) MOD_W_BAD_CONFIG, CHF_WARNING, config_info ChfEnd;
ChfGenerate( MOD_CHF_MODULE_ID, __FILE__, __LINE__, MOD_W_BAD_CONFIG, CHF_WARNING, config_info );
ChfSignal( MOD_CHF_MODULE_ID );
} else {
if ( mod_map.map_info[ mod ].config == MOD_UNCONFIGURED ) {
@ -1332,7 +1332,7 @@ void ModUnconfig( Address unconfig_info )
/* There isn't any module configured at the given address -
Signal a warning
*/
CHF_Condition( MOD_CHF_MODULE_ID ) MOD_W_BAD_UNCONFIG, CHF_WARNING, unconfig_info ChfEnd;
ChfGenerate( MOD_CHF_MODULE_ID, __FILE__, __LINE__, MOD_W_BAD_UNCONFIG, CHF_WARNING, unconfig_info );
ChfSignal( MOD_CHF_MODULE_ID );
} else if ( mod_description[ mod ].r_config == MOD_CONFIGURED ) {
/* The module is automatically configured after reset; it can never

View file

@ -344,7 +344,7 @@ void Monitor( void )
/* New command empty; try old command */
if ( ( tk = strtok( old_cmd, TOK_DELIMITERS ) ) != ( char* )NULL )
if ( InvokeCommand( tk ) )
CHF_Condition( CPU_CHF_MODULE_ID ) CPU_W_BAD_MONITOR_CMD, CHF_WARNING, tk ChfEnd;
ChfGenerate( CPU_CHF_MODULE_ID, __FILE__, __LINE__, CPU_W_BAD_MONITOR_CMD, CHF_WARNING, tk );
ChfSignal( CPU_CHF_MODULE_ID );
} else {
/* Save command */
@ -352,7 +352,7 @@ void Monitor( void )
/* New command */
if ( InvokeCommand( tk ) ) {
CHF_Condition( CPU_CHF_MODULE_ID ) CPU_W_BAD_MONITOR_CMD, CHF_WARNING, tk ChfEnd;
ChfGenerate( CPU_CHF_MODULE_ID, __FILE__, __LINE__, CPU_W_BAD_MONITOR_CMD, CHF_WARNING, tk );
ChfSignal( CPU_CHF_MODULE_ID );
}
}

View file

@ -165,21 +165,21 @@ int main( int argc, char* argv[] )
/* Now, do some useful work; pack argv[1] into argv[2] */
if ( argc != 3 ) {
CHF_Condition( UTIL_CHF_MODULE_ID ) UTIL_I_PACK_USAGE, CHF_INFO ChfEnd;
CHF_Condition( UTIL_CHF_MODULE_ID ) UTIL_F_PACK_CMD_LINE, CHF_FATAL ChfEnd;
ChfGenerate( UTIL_CHF_MODULE_ID, __FILE__, __LINE__, UTIL_I_PACK_USAGE, CHF_INFO );
ChfGenerate( UTIL_CHF_MODULE_ID, __FILE__, __LINE__, UTIL_F_PACK_CMD_LINE, CHF_FATAL );
ChfSignal( UTIL_CHF_MODULE_ID );
}
/* Get the size of the source file */
if ( stat( argv[ 1 ], &statb ) ) {
ChfGenerate( CHF_ERRNO_SET, __FILE__, __LINE__, errno, CHF_ERROR );
CHF_Condition( UTIL_CHF_MODULE_ID ) UTIL_F_PACK_STAT, CHF_FATAL, argv[ 1 ] ChfEnd;
ChfGenerate( UTIL_CHF_MODULE_ID, __FILE__, __LINE__, UTIL_F_PACK_STAT, CHF_FATAL, argv[ 1 ] );
ChfSignal( UTIL_CHF_MODULE_ID );
}
/* Check that actual size is reasonable */
if ( statb.st_size > MAX_SRC_SIZE ) {
CHF_Condition( UTIL_CHF_MODULE_ID ) UTIL_F_PACK_SRC_SIZE, CHF_FATAL, statb.st_size ChfEnd;
ChfGenerate( UTIL_CHF_MODULE_ID, __FILE__, __LINE__, UTIL_F_PACK_SRC_SIZE, CHF_FATAL, statb.st_size );
ChfSignal( UTIL_CHF_MODULE_ID );
}
@ -187,7 +187,7 @@ int main( int argc, char* argv[] )
if ( ( b = ( char* )malloc( statb.st_size ) ) == ( char* )NULL ||
( nb = ( Nibble* )malloc( sizeof( Nibble ) * statb.st_size ) ) == ( Nibble* )NULL ) {
ChfGenerate( CHF_ERRNO_SET, __FILE__, __LINE__, errno, CHF_ERROR );
CHF_Condition( UTIL_CHF_MODULE_ID ) UTIL_F_PACK_MALLOC, CHF_FATAL, statb.st_size ChfEnd;
ChfGenerate( UTIL_CHF_MODULE_ID, __FILE__, __LINE__, UTIL_F_PACK_MALLOC, CHF_FATAL, statb.st_size );
ChfSignal( UTIL_CHF_MODULE_ID );
return EXIT_FAILURE;
@ -196,7 +196,7 @@ int main( int argc, char* argv[] )
/* open/read/close */
if ( ( d = open( argv[ 1 ], O_RDONLY ) ) == -1 ) {
ChfGenerate( CHF_ERRNO_SET, __FILE__, __LINE__, errno, CHF_ERROR );
CHF_Condition( UTIL_CHF_MODULE_ID ) UTIL_F_PACK_OPEN, CHF_FATAL, argv[ 1 ] ChfEnd;
ChfGenerate( UTIL_CHF_MODULE_ID, __FILE__, __LINE__, UTIL_F_PACK_OPEN, CHF_FATAL, argv[ 1 ] );
ChfSignal( UTIL_CHF_MODULE_ID );
}
@ -205,7 +205,7 @@ int main( int argc, char* argv[] )
( void )close( d );
CHF_Condition( UTIL_CHF_MODULE_ID ) UTIL_F_PACK_READ, CHF_FATAL, argv[ 1 ] ChfEnd;
ChfGenerate( UTIL_CHF_MODULE_ID, __FILE__, __LINE__, UTIL_F_PACK_READ, CHF_FATAL, argv[ 1 ] );
ChfSignal( UTIL_CHF_MODULE_ID );
}
@ -220,7 +220,7 @@ int main( int argc, char* argv[] )
/* Write */
if ( WriteNibblesToFile( nb, statb.st_size, argv[ 2 ] ) ) {
CHF_Condition( UTIL_CHF_MODULE_ID ) UTIL_F_PACK_WRITE_NIBBLES, CHF_FATAL ChfEnd;
ChfGenerate( UTIL_CHF_MODULE_ID, __FILE__, __LINE__, UTIL_F_PACK_WRITE_NIBBLES, CHF_FATAL );
ChfSignal( UTIL_CHF_MODULE_ID );
}

View file

@ -139,16 +139,16 @@ void RomInit( void )
if ( ( mod_status_48 = ( struct ModStatus_48* )malloc( sizeof( struct ModStatus_48 ) ) ) == ( struct ModStatus_48* )NULL ) {
ChfGenerate( CHF_ERRNO_SET, __FILE__, __LINE__, errno, CHF_ERROR );
CHF_Condition( MOD_CHF_MODULE_ID ) MOD_F_MOD_STATUS_ALLOC, CHF_FATAL, sizeof( struct ModStatus_48 ) ChfEnd;
ChfGenerate( MOD_CHF_MODULE_ID, __FILE__, __LINE__, MOD_F_MOD_STATUS_ALLOC, CHF_FATAL, sizeof( struct ModStatus_48 ) );
ChfSignal( MOD_CHF_MODULE_ID );
}
if ( ReadNibblesFromFile( config.rom_file_name, N_ROM_SIZE, mod_status_rom ) ) {
/* CHF_Condition( MOD_CHF_MODULE_ID ) MOD_F_ROM_INIT, CHF_FATAL ChfEnd; */
/* ChfGenerate( MOD_CHF_MODULE_ID, __FILE__, __LINE__, MOD_F_ROM_INIT, CHF_FATAL ); */
/* ChfSignal( MOD_CHF_MODULE_ID ); */
// HACK: To load 48SX ROM, try again with half the size this time.
if ( ReadNibblesFromFile( config.rom_file_name, N_ROM_SIZE / 2, mod_status_rom ) ) {
CHF_Condition( MOD_CHF_MODULE_ID ) MOD_F_ROM_INIT, CHF_FATAL ChfEnd;
ChfGenerate( MOD_CHF_MODULE_ID, __FILE__, __LINE__, MOD_F_ROM_INIT, CHF_FATAL );
ChfSignal( MOD_CHF_MODULE_ID );
}
}
@ -233,7 +233,7 @@ void RomWrite( Address rel_address, Nibble datum )
debug1( DEBUG_C_TRACE, MOD_I_CALLED, "RomWrite" );
// FIXME: 48gx: saturn48gx-Mid <12>d (src/romram.c,235)-E-Write into ROM A[1B632] D[9]
CHF_Condition( MOD_CHF_MODULE_ID ) MOD_E_ROM_WRITE, CHF_ERROR, rel_address, datum ChfEnd;
ChfGenerate( MOD_CHF_MODULE_ID, __FILE__, __LINE__, MOD_E_ROM_WRITE, CHF_ERROR, rel_address, datum );
ChfSignal( MOD_CHF_MODULE_ID );
}
@ -267,7 +267,7 @@ void RamInit( void )
debug1( DEBUG_C_TRACE, MOD_I_CALLED, "RamInit" );
if ( ReadNibblesFromFile( config.ram_file_name, N_RAM_SIZE, mod_status_ram ) ) {
CHF_Condition( MOD_CHF_MODULE_ID ) MOD_W_RAM_INIT, CHF_WARNING ChfEnd;
ChfGenerate( MOD_CHF_MODULE_ID, __FILE__, __LINE__, MOD_W_RAM_INIT, CHF_WARNING );
ChfSignal( MOD_CHF_MODULE_ID );
( void )memset( mod_status_ram, 0, sizeof( mod_status_ram ) );
@ -303,7 +303,7 @@ void RamSave( void )
if ( WriteNibblesToFile( mod_status_ram, N_RAM_SIZE, config.ram_file_name ) ) {
ChfGenerate( CHF_ERRNO_SET, __FILE__, __LINE__, errno, CHF_ERROR );
CHF_Condition( MOD_CHF_MODULE_ID ) MOD_E_RAM_SAVE, CHF_ERROR ChfEnd;
ChfGenerate( MOD_CHF_MODULE_ID, __FILE__, __LINE__, MOD_E_RAM_SAVE, CHF_ERROR );
ChfSignal( MOD_CHF_MODULE_ID );
}
}
@ -504,7 +504,7 @@ void Ce1Write( Address rel_address, Nibble datum )
{
debug1( DEBUG_C_TRACE, MOD_I_CALLED, "Ce1Write" );
CHF_Condition( MOD_CHF_MODULE_ID ) MOD_E_CE1_WRITE, CHF_ERROR, rel_address, datum ChfEnd;
ChfGenerate( MOD_CHF_MODULE_ID, __FILE__, __LINE__, MOD_E_CE1_WRITE, CHF_ERROR, rel_address, datum );
ChfSignal( MOD_CHF_MODULE_ID );
}
@ -542,7 +542,7 @@ void Ce2Init( void )
debug1( DEBUG_C_TRACE, MOD_I_CALLED, "Ce2Init" );
if ( ReadNibblesFromFile( config.port_1_file_name, N_PORT_1_SIZE, mod_status_port_1 ) ) {
CHF_Condition( MOD_CHF_MODULE_ID ) MOD_W_PORT_1_INIT, CHF_WARNING ChfEnd;
ChfGenerate( MOD_CHF_MODULE_ID, __FILE__, __LINE__, MOD_W_PORT_1_INIT, CHF_WARNING );
ChfSignal( MOD_CHF_MODULE_ID );
( void )memset( mod_status_port_1, 0, sizeof( mod_status_port_1 ) );
@ -558,7 +558,7 @@ void Ce2Init( void )
new_status &= ~CE2_CARD_WE;
ChfGenerate( CHF_ERRNO_SET, __FILE__, __LINE__, errno, CHF_ERROR );
CHF_Condition( MOD_CHF_MODULE_ID ) MOD_I_PORT_1_WP, CHF_INFO ChfEnd;
ChfGenerate( MOD_CHF_MODULE_ID, __FILE__, __LINE__, MOD_I_PORT_1_WP, CHF_INFO );
ChfSignal( MOD_CHF_MODULE_ID );
}
}
@ -603,7 +603,7 @@ void Ce2Save( void )
/* Attempt to save only if port is write-enabled */
if ( ( mod_status_hdw.card_status & CE2_CARD_WE ) && WriteNibblesToFile( mod_status_port_1, N_PORT_1_SIZE, config.port_1_file_name ) ) {
ChfGenerate( CHF_ERRNO_SET, __FILE__, __LINE__, errno, CHF_ERROR );
CHF_Condition( MOD_CHF_MODULE_ID ) MOD_E_PORT_1_SAVE, CHF_ERROR ChfEnd;
ChfGenerate( MOD_CHF_MODULE_ID, __FILE__, __LINE__, MOD_E_PORT_1_SAVE, CHF_ERROR );
ChfSignal( MOD_CHF_MODULE_ID );
}
}
@ -701,7 +701,7 @@ void NCe3Init( void )
#ifdef N_PORT_2_BANK
if ( ReadNibblesFromFile( config.port_2_file_name, N_PORT_2_SIZE, mod_status_port_2 ) ) {
CHF_Condition( MOD_CHF_MODULE_ID ) MOD_W_PORT_2_INIT, CHF_WARNING ChfEnd;
ChfGenerate( MOD_CHF_MODULE_ID, __FILE__, __LINE__, MOD_W_PORT_2_INIT, CHF_WARNING );
ChfSignal( MOD_CHF_MODULE_ID );
( void )memset( mod_status_port_2, 0, sizeof( mod_status_port_2 ) );
@ -717,7 +717,7 @@ void NCe3Init( void )
new_status &= ~NCE3_CARD_WE;
ChfGenerate( CHF_ERRNO_SET, __FILE__, __LINE__, errno, CHF_ERROR );
CHF_Condition( MOD_CHF_MODULE_ID ) MOD_I_PORT_2_WP, CHF_INFO ChfEnd;
ChfGenerate( MOD_CHF_MODULE_ID, __FILE__, __LINE__, MOD_I_PORT_2_WP, CHF_INFO );
ChfSignal( MOD_CHF_MODULE_ID );
}
}
@ -769,7 +769,7 @@ void NCe3Save( void )
if ( ( mod_status_hdw.card_status & NCE3_CARD_WE ) &&
WriteNibblesToFile( mod_status_port_2, N_PORT_2_SIZE, config.port_2_file_name ) ) {
ChfGenerate( CHF_ERRNO_SET, __FILE__, __LINE__, errno, CHF_ERROR );
CHF_Condition( MOD_CHF_MODULE_ID ) MOD_E_PORT_2_SAVE, CHF_ERROR ChfEnd;
ChfGenerate( MOD_CHF_MODULE_ID, __FILE__, __LINE__, MOD_E_PORT_2_SAVE, CHF_ERROR );
ChfSignal( MOD_CHF_MODULE_ID );
}
#endif
@ -806,7 +806,7 @@ Nibble NCe3Read( Address rel_address )
return mod_status_port_2[ rel_address | mod_status_hdw.accel.a48.bs_address ];
#else
CHF_Condition( MOD_CHF_MODULE_ID ) MOD_E_NCE3_READ, CHF_ERROR, rel_address ChfEnd;
ChfGenerate( MOD_CHF_MODULE_ID, __FILE__, __LINE__, MOD_E_NCE3_READ, CHF_ERROR, rel_address );
ChfSignal( MOD_CHF_MODULE_ID );
return ( Nibble )0;
@ -846,7 +846,7 @@ void NCe3Write( Address rel_address, Nibble datum )
mod_status_port_2[ rel_address | mod_status_hdw.accel.a48.bs_address ] = datum;
#else
CHF_Condition( MOD_CHF_MODULE_ID ) MOD_E_NCE3_WRITE, CHF_ERROR, rel_address, datum ChfEnd;
ChfGenerate( MOD_CHF_MODULE_ID, __FILE__, __LINE__, MOD_E_NCE3_WRITE, CHF_ERROR, rel_address, datum );
ChfSignal( MOD_CHF_MODULE_ID );
#endif

View file

@ -154,12 +154,12 @@ void RomInit49( void )
if ( ( mod_status_49 = ( struct ModStatus_49* )malloc( sizeof( struct ModStatus_49 ) ) ) == ( struct ModStatus_49* )NULL ) {
ChfGenerate( CHF_ERRNO_SET, __FILE__, __LINE__, errno, CHF_ERROR );
CHF_Condition( MOD_CHF_MODULE_ID ) MOD_F_MOD_STATUS_ALLOC, CHF_FATAL, sizeof( struct ModStatus_49 ) ChfEnd;
ChfGenerate( MOD_CHF_MODULE_ID, __FILE__, __LINE__, MOD_F_MOD_STATUS_ALLOC, CHF_FATAL, sizeof( struct ModStatus_49 ) );
ChfSignal( MOD_CHF_MODULE_ID );
}
if ( ReadNibblesFromFile( config.rom_file_name, N_FLASH_SIZE_49, mod_status_49->flash ) ) {
CHF_Condition( MOD_CHF_MODULE_ID ) MOD_F_ROM_INIT, CHF_FATAL ChfEnd;
ChfGenerate( MOD_CHF_MODULE_ID, __FILE__, __LINE__, MOD_F_ROM_INIT, CHF_FATAL );
ChfSignal( MOD_CHF_MODULE_ID );
}
}
@ -192,7 +192,7 @@ void RomSave49( void )
if ( WriteNibblesToFile( mod_status_49->flash, N_FLASH_SIZE_49, config.rom_file_name ) ) {
ChfGenerate( CHF_ERRNO_SET, __FILE__, __LINE__, errno, CHF_ERROR );
CHF_Condition( MOD_CHF_MODULE_ID ) MOD_E_ROM_SAVE, CHF_ERROR ChfEnd;
ChfGenerate( MOD_CHF_MODULE_ID, __FILE__, __LINE__, MOD_E_ROM_SAVE, CHF_ERROR );
ChfSignal( MOD_CHF_MODULE_ID );
}
}
@ -296,7 +296,7 @@ void RamInit49( void )
debug1( DEBUG_C_TRACE, MOD_I_CALLED, "RamInit49" );
if ( ReadNibblesFromFile( config.ram_file_name, N_RAM_SIZE_49, mod_status_49->ram ) ) {
CHF_Condition( MOD_CHF_MODULE_ID ) MOD_W_RAM_INIT, CHF_WARNING ChfEnd;
ChfGenerate( MOD_CHF_MODULE_ID, __FILE__, __LINE__, MOD_W_RAM_INIT, CHF_WARNING );
ChfSignal( MOD_CHF_MODULE_ID );
( void )memset( mod_status_49->ram, 0, sizeof( mod_status_49->ram ) );
@ -330,7 +330,7 @@ void RamSave49( void )
if ( WriteNibblesToFile( mod_status_49->ram, N_RAM_SIZE_49, config.ram_file_name ) ) {
ChfGenerate( CHF_ERRNO_SET, __FILE__, __LINE__, errno, CHF_ERROR );
CHF_Condition( MOD_CHF_MODULE_ID ) MOD_E_RAM_SAVE, CHF_ERROR ChfEnd;
ChfGenerate( MOD_CHF_MODULE_ID, __FILE__, __LINE__, MOD_E_RAM_SAVE, CHF_ERROR );
ChfSignal( MOD_CHF_MODULE_ID );
}
}

View file

@ -533,7 +533,7 @@ const char* SerialInit( void )
pty_name = ( char* )NULL;
ChfGenerate( CHF_ERRNO_SET, __FILE__, __LINE__, errno, CHF_ERROR );
CHF_Condition( SERIAL_CHF_MODULE_ID ) SERIAL_F_OPENPTY, CHF_FATAL ChfEnd;
ChfGenerate( SERIAL_CHF_MODULE_ID, __FILE__, __LINE__, SERIAL_F_OPENPTY, CHF_FATAL );
ChfSignal( SERIAL_CHF_MODULE_ID );
} else {
int cur_flags;
@ -546,7 +546,7 @@ const char* SerialInit( void )
/* Set O_NONBLOCK on master_pty */
if ( ( cur_flags = fcntl( master_pty, F_GETFL, 0 ) ) < 0 || fcntl( master_pty, F_SETFL, cur_flags | O_NONBLOCK ) < 0 ) {
ChfGenerate( CHF_ERRNO_SET, __FILE__, __LINE__, errno, CHF_ERROR );
CHF_Condition( SERIAL_CHF_MODULE_ID ) SERIAL_F_FCNTL, CHF_FATAL ChfEnd;
ChfGenerate( SERIAL_CHF_MODULE_ID, __FILE__, __LINE__, SERIAL_F_FCNTL, CHF_FATAL );
ChfSignal( SERIAL_CHF_MODULE_ID );
}
}
@ -558,7 +558,7 @@ const char* SerialInit( void )
pty_name = ( char* )NULL;
ChfGenerate( CHF_ERRNO_SET, __FILE__, __LINE__, errno, CHF_ERROR );
CHF_Condition( SERIAL_CHF_MODULE_ID ) SERIAL_F_OPEN_MASTER, CHF_FATAL, PTY_MASTER ChfEnd;
ChfGenerate( SERIAL_CHF_MODULE_ID, __FILE__, __LINE__, SERIAL_F_OPEN_MASTER, CHF_FATAL, PTY_MASTER );
ChfSignal( SERIAL_CHF_MODULE_ID );
} else {
/* Master side opened ok; change permissions and unlock slave side */
@ -569,7 +569,7 @@ const char* SerialInit( void )
( void )close( master_pty );
CHF_Condition( SERIAL_CHF_MODULE_ID ) SERIAL_F_GRANTPT, CHF_FATAL ChfEnd;
ChfGenerate( SERIAL_CHF_MODULE_ID, __FILE__, __LINE__, SERIAL_F_GRANTPT, CHF_FATAL );
ChfSignal( SERIAL_CHF_MODULE_ID );
}
@ -579,7 +579,7 @@ const char* SerialInit( void )
( void )close( master_pty );
CHF_Condition( SERIAL_CHF_MODULE_ID ) SERIAL_F_UNLOCKPT, CHF_FATAL ChfEnd;
ChfGenerate( SERIAL_CHF_MODULE_ID, __FILE__, __LINE__, SERIAL_F_UNLOCKPT, CHF_FATAL );
ChfSignal( SERIAL_CHF_MODULE_ID );
}
@ -593,7 +593,7 @@ const char* SerialInit( void )
( void )close( master_pty );
CHF_Condition( SERIAL_CHF_MODULE_ID ) SERIAL_F_OPEN_SLAVE, CHF_FATAL, pty_name ChfEnd;
ChfGenerate( SERIAL_CHF_MODULE_ID, __FILE__, __LINE__, SERIAL_F_OPEN_SLAVE, CHF_FATAL, pty_name );
ChfSignal( SERIAL_CHF_MODULE_ID );
}
@ -606,13 +606,13 @@ const char* SerialInit( void )
*/
if ( ioctl( slave_pty, I_PUSH, "ptem" ) == -1 ) {
ChfGenerate( CHF_ERRNO_SET, __FILE__, __LINE__, errno, CHF_ERROR );
CHF_Condition( SERIAL_CHF_MODULE_ID ) SERIAL_F_PUSH, CHF_FATAL, "ptem" ChfEnd;
ChfGenerate( SERIAL_CHF_MODULE_ID, __FILE__, __LINE__, SERIAL_F_PUSH, CHF_FATAL, "ptem" );
ChfSignal( SERIAL_CHF_MODULE_ID );
}
if ( ioctl( slave_pty, I_PUSH, "ldterm" ) == -1 ) {
ChfGenerate( CHF_ERRNO_SET, __FILE__, __LINE__, errno, CHF_ERROR );
CHF_Condition( SERIAL_CHF_MODULE_ID ) SERIAL_F_PUSH, CHF_FATAL, "ldterm" ChfEnd;
ChfGenerate( SERIAL_CHF_MODULE_ID, __FILE__, __LINE__, SERIAL_F_PUSH, CHF_FATAL, "ldterm" );
ChfSignal( SERIAL_CHF_MODULE_ID );
}
}
@ -628,7 +628,7 @@ const char* SerialInit( void )
if ( tcgetattr( slave_pty, &tios ) ) {
ChfGenerate( CHF_ERRNO_SET, __FILE__, __LINE__, errno, CHF_ERROR );
CHF_Condition( SERIAL_CHF_MODULE_ID ) SERIAL_F_TCGETATTR, CHF_FATAL ChfEnd;
ChfGenerate( SERIAL_CHF_MODULE_ID, __FILE__, __LINE__, SERIAL_F_TCGETATTR, CHF_FATAL );
ChfSignal( SERIAL_CHF_MODULE_ID );
}
@ -653,7 +653,7 @@ const char* SerialInit( void )
if ( tcsetattr( slave_pty, TCSANOW, &tios ) ) {
ChfGenerate( CHF_ERRNO_SET, __FILE__, __LINE__, errno, CHF_ERROR );
CHF_Condition( SERIAL_CHF_MODULE_ID ) SERIAL_F_TCSETATTR, CHF_FATAL ChfEnd;
ChfGenerate( SERIAL_CHF_MODULE_ID, __FILE__, __LINE__, SERIAL_F_TCSETATTR, CHF_FATAL );
ChfSignal( SERIAL_CHF_MODULE_ID );
}
}
@ -661,7 +661,7 @@ const char* SerialInit( void )
/* Publish pty name */
if ( config.verbose ) {
CHF_Condition( SERIAL_CHF_MODULE_ID ) SERIAL_I_PTY_NAME, CHF_INFO, pty_name ChfEnd;
ChfGenerate( SERIAL_CHF_MODULE_ID, __FILE__, __LINE__, SERIAL_I_PTY_NAME, CHF_INFO, pty_name );
ChfSignal( SERIAL_CHF_MODULE_ID );
}
@ -669,7 +669,7 @@ const char* SerialInit( void )
/* Dummy implementation; do nothing */
pty_name = "";
CHF_Condition( SERIAL_CHF_MODULE_ID ) SERIAL_W_NOPTY, CHF_WARNING ChfEnd;
ChfGenerate( SERIAL_CHF_MODULE_ID, __FILE__, __LINE__, SERIAL_W_NOPTY, CHF_WARNING );
ChfSignal( SERIAL_CHF_MODULE_ID );
#endif
@ -710,7 +710,7 @@ void SerialClose( void )
if ( close( slave_pty ) || close( master_pty ) ) {
ChfGenerate( CHF_ERRNO_SET, __FILE__, __LINE__, errno, CHF_ERROR );
CHF_Condition( SERIAL_CHF_MODULE_ID ) SERIAL_E_PTY_CLOSE, CHF_ERROR ChfEnd;
ChfGenerate( SERIAL_CHF_MODULE_ID, __FILE__, __LINE__, SERIAL_E_PTY_CLOSE, CHF_ERROR );
ChfSignal( SERIAL_CHF_MODULE_ID );
}
}
@ -893,7 +893,7 @@ int8 Serial_RBR_Read( void )
/* 3.2: The HP49 firmware (1.19-4) can read from an empty RRB;
this is not harmful, and this warning can be removed.
*/
CHF_Condition( SERIAL_CHF_MODULE_ID ) SERIAL_W_EMPTY_RRB, CHF_WARNING, rcs ChfEnd;
ChfGenerate( SERIAL_CHF_MODULE_ID, __FILE__, __LINE__, SERIAL_W_EMPTY_RRB, CHF_WARNING, rcs );
ChfSignal( SERIAL_CHF_MODULE_ID );
#endif
@ -1082,7 +1082,7 @@ void Serial_TBR_Write( int8 d )
Push( trb, d );
} else {
/* trb is full; discard character */
CHF_Condition( SERIAL_CHF_MODULE_ID ) SERIAL_W_FULL_TRB, CHF_WARNING, tcs ChfEnd;
ChfGenerate( SERIAL_CHF_MODULE_ID, __FILE__, __LINE__, SERIAL_W_FULL_TRB, CHF_WARNING, tcs );
ChfSignal( SERIAL_CHF_MODULE_ID );
}
@ -1144,7 +1144,7 @@ void HandleSerial( void )
/* Signal a condition upon failure */
if ( result < 0 ) {
ChfGenerate( CHF_ERRNO_SET, __FILE__, __LINE__, errno, CHF_ERROR );
CHF_Condition( SERIAL_CHF_MODULE_ID ) SERIAL_E_TRB_DRAIN, CHF_ERROR ChfEnd;
ChfGenerate( SERIAL_CHF_MODULE_ID, __FILE__, __LINE__, SERIAL_E_TRB_DRAIN, CHF_ERROR );
ChfSignal( SERIAL_CHF_MODULE_ID );
}
@ -1158,7 +1158,7 @@ void HandleSerial( void )
/* Signal a condition upon failure */
if ( result < 0 ) {
ChfGenerate( CHF_ERRNO_SET, __FILE__, __LINE__, errno, CHF_ERROR );
CHF_Condition( SERIAL_CHF_MODULE_ID ) SERIAL_E_RRB_CHARGE, CHF_ERROR ChfEnd;
ChfGenerate( SERIAL_CHF_MODULE_ID, __FILE__, __LINE__, SERIAL_E_RRB_CHARGE, CHF_ERROR );
ChfSignal( SERIAL_CHF_MODULE_ID );
}

View file

@ -150,7 +150,7 @@ static void SetSpeed( Nibble function_code )
debug1( DEBUG_C_TRACE, X_FUNC_I_CALLED, "SetSpeed" );
#ifndef REAL_CPU_SPEED
CHF_Condition( X_FUNC_CHF_MODULE_ID ) X_FUNC_E_NO_SPEED, CHF_ERROR ChfEnd;
ChfGenerate( X_FUNC_CHF_MODULE_ID, __FILE__, __LINE__, X_FUNC_E_NO_SPEED, CHF_ERROR );
ChfSignal( X_FUNC_CHF_MODULE_ID );
#else
@ -169,9 +169,9 @@ static void SetSpeed( Nibble function_code )
/* Notify the user about the speed change */
if ( cpu_status.inner_loop_max )
CHF_Condition( X_FUNC_CHF_MODULE_ID ) X_FUNC_I_SET_SPEED, CHF_INFO, new_speed ChfEnd;
ChfGenerate( X_FUNC_CHF_MODULE_ID, __FILE__, __LINE__, X_FUNC_I_SET_SPEED, CHF_INFO, new_speed );
else
CHF_Condition( X_FUNC_CHF_MODULE_ID ) X_FUNC_I_MAX_SPEED, CHF_INFO ChfEnd;
ChfGenerate( X_FUNC_CHF_MODULE_ID, __FILE__, __LINE__, X_FUNC_I_MAX_SPEED, CHF_INFO );
ChfSignal( X_FUNC_CHF_MODULE_ID );
}
@ -201,7 +201,7 @@ static const char* BinaryHeader( void )
return "HPHP49-?";
break;
default:
CHF_Condition( X_FUNC_CHF_MODULE_ID ) X_FUNC_E_NO_BIN_HDR, CHF_ERROR, "hw unknown" ChfEnd;
ChfGenerate( X_FUNC_CHF_MODULE_ID, __FILE__, __LINE__, X_FUNC_E_NO_BIN_HDR, CHF_ERROR, "hw unknown" );
fprintf( stderr, "Error: Unknown model %i\n", config.model );
return ( char* )NULL;
}
@ -214,7 +214,7 @@ static void KgetContinuation( int proceed, char* file_name )
{
/* Check whether continuation should proceed */
if ( !proceed ) {
CHF_Condition( X_FUNC_CHF_MODULE_ID ) X_FUNC_W_ABORTED, CHF_WARNING ChfEnd;
ChfGenerate( X_FUNC_CHF_MODULE_ID, __FILE__, __LINE__, X_FUNC_W_ABORTED, CHF_WARNING );
ChfSignal( X_FUNC_CHF_MODULE_ID );
} else {
/* Ok to proceed; read:
@ -230,7 +230,7 @@ static void KgetContinuation( int proceed, char* file_name )
debug3( DEBUG_C_X_FUNC, X_FUNC_I_KGET, start_addr, end_addr, bin_hdr );
if ( bin_hdr == ( const char* )NULL || ReadObjectFromFile( file_name, bin_hdr, ( Address )start_addr, ( Address )end_addr ) ) {
CHF_Condition( X_FUNC_CHF_MODULE_ID ) X_FUNC_W_FAILED, CHF_WARNING ChfEnd;
ChfGenerate( X_FUNC_CHF_MODULE_ID, __FILE__, __LINE__, X_FUNC_W_FAILED, CHF_WARNING );
ChfSignal( X_FUNC_CHF_MODULE_ID );
}
}
@ -244,7 +244,7 @@ static void KgetContinuation( int proceed, char* file_name )
static void SendContinuation( int proceed, char* file_name )
{
if ( !proceed ) {
CHF_Condition( X_FUNC_CHF_MODULE_ID ) X_FUNC_W_ABORTED, CHF_WARNING ChfEnd;
ChfGenerate( X_FUNC_CHF_MODULE_ID, __FILE__, __LINE__, X_FUNC_W_ABORTED, CHF_WARNING );
ChfSignal( X_FUNC_CHF_MODULE_ID );
} else {
/* Ok to proceed; read:
@ -260,7 +260,7 @@ static void SendContinuation( int proceed, char* file_name )
debug3( DEBUG_C_X_FUNC, X_FUNC_I_SEND, start_addr, end_addr, bin_hdr );
if ( bin_hdr == ( const char* )NULL || WriteObjectToFile( ( Address )start_addr, ( Address )end_addr, bin_hdr, file_name ) ) {
CHF_Condition( X_FUNC_CHF_MODULE_ID ) X_FUNC_W_FAILED, CHF_WARNING ChfEnd;
ChfGenerate( X_FUNC_CHF_MODULE_ID, __FILE__, __LINE__, X_FUNC_W_FAILED, CHF_WARNING );
ChfSignal( X_FUNC_CHF_MODULE_ID );
}
}
@ -298,7 +298,7 @@ static void SetupXfer( int msg, const char* def_msg, FsbContinuation cont )
/* ( void )CpuHaltRequest(); */
} else {
CHF_Condition( X_FUNC_CHF_MODULE_ID ) X_FUNC_E_NO_HALT, CHF_ERROR ChfEnd;
ChfGenerate( X_FUNC_CHF_MODULE_ID, __FILE__, __LINE__, X_FUNC_E_NO_HALT, CHF_ERROR );
ChfSignal( X_FUNC_CHF_MODULE_ID );
}
}
@ -329,7 +329,7 @@ static void Kget( Nibble function_code )
debug3( DEBUG_C_X_FUNC, X_FUNC_I_KGET, start_addr, end_addr, bin_hdr );
if ( bin_hdr == ( const char* )NULL || ReadObjectFromFile( file_name, bin_hdr, ( Address )start_addr, ( Address )end_addr ) ) {
CHF_Condition( X_FUNC_CHF_MODULE_ID ) X_FUNC_W_FAILED, CHF_WARNING ChfEnd;
ChfGenerate( X_FUNC_CHF_MODULE_ID, __FILE__, __LINE__, X_FUNC_W_FAILED, CHF_WARNING );
ChfSignal( X_FUNC_CHF_MODULE_ID );
}
}
@ -361,7 +361,7 @@ static void Send( Nibble function_code )
debug3( DEBUG_C_X_FUNC, X_FUNC_I_SEND, start_addr, end_addr, bin_hdr );
if ( bin_hdr == ( const char* )NULL || WriteObjectToFile( ( Address )start_addr, ( Address )end_addr, bin_hdr, file_name ) ) {
CHF_Condition( X_FUNC_CHF_MODULE_ID ) X_FUNC_W_FAILED, CHF_WARNING ChfEnd;
ChfGenerate( X_FUNC_CHF_MODULE_ID, __FILE__, __LINE__, X_FUNC_W_FAILED, CHF_WARNING );
ChfSignal( X_FUNC_CHF_MODULE_ID );
}
}
@ -420,7 +420,7 @@ void ExtendedFunction( Nibble function_code )
/* Some sanity checks, first */
if ( function_code < 0 || function_code >= N_X_FUNC || function[ ( int )function_code ] == ( XFunc )NULL ) {
CHF_Condition( X_FUNC_CHF_MODULE_ID ) X_FUNC_W_BAD_CODE, CHF_WARNING, function_code ChfEnd;
ChfGenerate( X_FUNC_CHF_MODULE_ID, __FILE__, __LINE__, X_FUNC_W_BAD_CODE, CHF_WARNING, function_code );
ChfSignal( X_FUNC_CHF_MODULE_ID );
}
/* Dispatch */