Ejemplo n.º 1
0
void h8_register_write8(UINT32 address, UINT8 val)
{
	UINT8 reg;

	address &= 0xffffff;

	reg = address & 0xff;

	if(reg >= 0x60 && reg <= 0x9f)
	{
		h8_itu_write8(reg, val);
	}

	switch (reg)
	{
		case 0xb3:
			io_write_byte(H8_SERIAL_A, val);
			break;
		case 0xbb:
			io_write_byte(H8_SERIAL_B, val);
			break;
		case 0xc7:
			io_write_byte_8(H8_PORT4, val);
			break;
		case 0xcb:    		// port 6 data
			io_write_byte_8(H8_PORT6, val);
			break;
		case 0xce:		// port 7 data
			io_write_byte_8(H8_PORT7, val);
			break;
		case 0xcf:		// port 8 data
			io_write_byte_8(H8_PORT8, val);
			break;
		case 0xd2:		// port 9 data
			io_write_byte_8(H8_PORT9, val);
			break;
		case 0xd3:		// port a data
			io_write_byte_8(H8_PORTA, val);
			break;
		case 0xd6:		// port b data
			io_write_byte_8(H8_PORTB, val);
			break;
	}

	h8.per_regs[reg] = val;
}
Ejemplo n.º 2
0
/* These functions are used to communicate with the inferior */
int tgdb_send_inferior_char(struct tgdb *tgdb, char c)
{
    if (io_write_byte(tgdb->inferior_stdout, c) == -1) {
        clog_error(CLOG_CGDB, "io_write_byte failed");
        return -1;
    }

    return 0;
}
Ejemplo n.º 3
0
/**
 * This sends a byte of data to the program being debugged.
 *
 * \param tgdb
 * An instance of the tgdb library to operate on.
 *
 * \param c
 * The character to pass to the program being debugged.
 *
 * @return
 * 0 on success or -1 on error
 */
int Ctgdb::Send_inferior_char(char c)
{
	if (io_write_byte (inferior_stdout, c) == -1)
	{
		Logger_write_pos( __FILE__, __LINE__, "io_write_byte failed");
		return -1;
	}

	return 0;
}
Ejemplo n.º 4
0
int io_write(short size, uint32_t addr, uint32_t value){
	void * state;
	switch(size){
		case 8:
                        io_write_byte (addr, value);
                        break;
                case 16:
                        io_write_halfword(addr, value);
                        break;
                case 32:
                        io_write_word(addr, value);
                        break;
                default:
                        return -1;

	}
	return 0;
}
Ejemplo n.º 5
0
CallBack events_swi_cm920iap_handler (int swi_number, SwiRegs *r) 
{
  switch (swi_number) 
  {

  /**********************************************************************
   * SLOS SWI's 
   **********************************************************************/

  case /* SWI */ SLOS:

    switch (r->r[0]) 
    {

    /* -----------------------------------------------------------------
     * Low level Debug SWI for debugging before the operating system is
     * up and running. The following register hold the debug information.
     *
     *  r8fiq  - fatal error 
     *  r9fiq  - trace entry value
     *  r10fiq - trace exit value
     *
     * -----------------------------------------------------------------
     */
    
    case /* SWI */ BringUp_Trace: 

      switch (r->r[1])
      {
      case 123: /* ENTRY into routine ...................... */
      bringupSetR9fiq (r->r[2]);
      break;

      case 321: /* EXIT into routine ....................... */
      bringupSetR10fiq (r->r[2]);
      break;
      }

    break;

    case /* SWI */ BringUp_FatalError:   
    bringupSetR8fiq (r->r[1]);
     
    fatalerror: goto fatalerror; /* setup infinite loop ... */
     
    break;

    /* -----------------------------------------------------------------
     * Device Driver SWI's for controlling and initializing device
     * drivers
     * -----------------------------------------------------------------
     */

    case /* SWI */ Event_IODeviceInit:
    io_initialize_drivers ();
    break;
 
    default:

    /* ----------------------------------------------------------------
     * switch to SYSTEM mode and switch ON IRQ interrupts. 
     * ----------------------------------------------------------------
     */

    if (STATE!=1) {modifyControlCPSR (SYSTEM|IRQoN);}

      switch (r->r[0]) 
      {
		  
      case /* SWI */ Event_IODeviceOpen:
      r->r[0] = (unsigned int) io_open_driver ((UID *)r->r[1],r->r[2],r->r[3]);
      break;

      case /* SWI */ Event_IODeviceClose:
      r->r[0] = (unsigned int) io_close_driver ((device_treestr *)r->r[1],(UID)r->r[2]);
      break;
	
      case /* SWI */ Event_IODeviceWriteByte:
      io_write_byte ((device_treestr *)r->r[1],(UID)r->r[2],(BYTE)r->r[3]);
      break;
	
      case /* SWI */ Event_IODeviceReadByte:
      r->r[0] = (unsigned int) io_read_byte ((device_treestr *)r->r[1],(UID)r->r[2]);
      break;

      case /* SWI */ Event_IODeviceWriteBit:
      io_write_bit ((device_treestr *)r->r[1],(UID)r->r[2],(UINT)r->r[3]);
      break;

      case /* SWI */ Event_IODeviceReadBit:
      r->r[0] = (unsigned int) io_read_bit ((device_treestr *)r->r[1],(UID)r->r[2]);
      break;

      case /* SWI */ Event_IODeviceWriteBlock:
      io_write_block ((device_treestr *)r->r[1],(UID)r->r[2],(void *)r->r[3]);
      break;

      case /* SWI */ Event_IODeviceReadBlock:
      r->r[0] = (unsigned int) io_read_block ((device_treestr *)r->r[1],(UID)r->r[2]);
      break;
      
      }

    if (STATE!=1) {modifyControlCPSR (SVC|IRQoFF);}
    }  
 }

return ReportOK();
}