bool LinuxFrameBufferDisplay_pv::from_bus_get_direct_memory_ptr(mb_address_type address, tlm::tlm_dmi& dmiData) {
  dmiData.allow_read_write();
  dmiData.set_dmi_ptr((unsigned char*) m_client->get_buffer());
  dmiData.set_start_address(0);
  dmiData.set_end_address(width * height * 4);
  return true;
}
Пример #2
0
    //
    // Cannot use DMI through plug & play devices. This is probably OK for present.
    //
    bool getDMIPointer(int SocketId, transaction_type& trans, tlm::tlm_dmi&  dmi_data)
    {
        Addr address = trans.get_address();
        Addr offset;
        int  portId = getPortId(address, offset);
        Bool result = false;

        if(portId >= 0) {
            initiator_socket_type* decodeSocket = &initiator_socket[portId];

            // send on the transaction with the new address, adjusted for the decoder offset
            trans.set_address(offset);
            result = (*decodeSocket)->get_direct_mem_ptr(trans, dmi_data);

            // put the address back how it was
            trans.set_address(address);

            // Should always succeed
            Addr start = dmi_data.get_start_address();
            Addr end   = dmi_data.get_end_address();

            if (result) {
                // Range must contain address
                assert(start <= offset);
                assert(end   >= offset);
            }

            adjustRange(portId, address, start, end);

            dmi_data.set_start_address(start);
            dmi_data.set_end_address(end);
        }

        return result;
    }
Пример #3
0
  // Tagged TLM-2 forward DMI method
  virtual bool get_direct_mem_ptr(int id,
                                  tlm::tlm_generic_payload& trans,
                                  tlm::tlm_dmi&  dmi_data)
  {
    sc_dt::uint64 masked_address;
    unsigned int target_nr = decode_address( trans.get_address(), masked_address );
    if (target_nr >= init_socket.size())
      return false;

    trans.set_address( masked_address );

    bool status = init_socket[target_nr]->get_direct_mem_ptr( trans, dmi_data );

    // Calculate DMI address of target in system address space
    dmi_data.set_start_address( compose_address( target_nr, dmi_data.get_start_address() ));
    dmi_data.set_end_address  ( compose_address( target_nr, dmi_data.get_end_address() ));

    return status;
  }
Пример #4
0
bool ram::get_direct_mem_ptr(tlm::tlm_generic_payload &trans, tlm::tlm_dmi &dmi_data)
{
    sc_dt::uint64 address = trans.get_address();
    if (address > m_high_address) {
        // should not happen
        cerr << "ram::get_direct_mem_ptr: address overflow";
        return false;
    }

    // if (m_invalidate) m_invalidate_dmi_event.notify(m_invalidate_dmi_time);
    dmi_data.allow_read_write();
    dmi_data.set_start_address(0x0);
    dmi_data.set_end_address(m_high_address);

    unsigned char *ptr = m_target_memory.get_mem_ptr();
    trans.set_dmi_allowed(m_dmi_on);
    dmi_data.set_dmi_ptr(ptr);
    return true;
}
Пример #5
0
  virtual bool get_direct_mem_ptr(tlm::tlm_generic_payload& trans,
                                  tlm::tlm_dmi& dmi_data)
  {
    // Permit read and write access
    dmi_data.allow_read_write();

    // Set other details of DMI region
    dmi_data.set_dmi_ptr( reinterpret_cast<unsigned char*>( &mem[0] ) );
    dmi_data.set_start_address( 0 );
    dmi_data.set_end_address( SIZE*4-1 );
    dmi_data.set_read_latency( LATENCY );
    dmi_data.set_write_latency( LATENCY );

    return true;
  }
Пример #6
0
bool                                            
lt_dmi_target::get_direct_mem_ptr    
( tlm::tlm_generic_payload   &gp              ///< address + extensions
, tlm::tlm_dmi               &dmi_properties  ///< dmi data
)
{
  std::ostringstream  msg;
  msg.str("");
  sc_dt::uint64 address = gp.get_address();
  
  // First check to see if we are "open" to a dmi
  if(!m_dmi_enabled)
  {
    msg << "Target: " << m_ID
        << " DMI not enabled, not expecting call ";
    REPORT_INFO(filename, __FUNCTION__, msg.str());
  }
  else
  {                                  // dmi processing
    if (address < m_end_address+1)   // check that address is in our range              
    {
      // set up dmi properties object ======================================
      dmi_properties.allow_read_write   (                                );
      dmi_properties.set_start_address  ( m_start_address                );
      dmi_properties.set_end_address    ( m_end_address                  );
      dmi_properties.set_dmi_ptr        ( m_target_memory.get_mem_ptr () );
      dmi_properties.set_read_latency   ( m_read_response_delay          );
      dmi_properties.set_write_latency  ( m_write_response_delay         );

      msg << "Target: " << m_ID
          << " passing DMI pointer back to initiator";
      REPORT_INFO(filename, __FUNCTION__, msg.str());
      return true;
    }
    else
    {
      msg << "Target: " << m_ID
          << " DMI pointer request for address= " << address
          << " max address for this target = " << m_end_address+1;
      REPORT_INFO(filename, __FUNCTION__, msg.str());
    } // end else
  } // end else
  
  return false; 
} // end get_direct_mem_ptr
Пример #7
0
//==============================================================================
void
dmi_memory::load_dmi_ptr
(
  tlm::tlm_dmi &dmi_properties
)
{
  report::print(m_ID,dmi_properties,filename);
//  m_dmi_properties = dmi_properties;
  m_dmi_ptr           = dmi_properties.get_dmi_ptr();
  m_dmi_read_latency  = dmi_properties.get_read_latency();
  m_dmi_write_latency = dmi_properties.get_write_latency();
  m_dmi_base_address       = dmi_properties.get_start_address();
  m_dmi_size          = dmi_properties.get_end_address()
                      - m_dmi_base_address;
  m_granted_access    = dmi_properties.get_granted_access();

  return;
}