Ejemplo n.º 1
0
void
MemoryClear( 
	IN void *pMemory, 
	IN uint32 Bytes )
{
	MemoryFill( pMemory, 0, Bytes );
}
Ejemplo n.º 2
0
int8_t  Temp_Exec(int argc, const char* const* argv)
{
  uint8_t OW_Status;
  ExecFlagDef ExecFlag;
  
  CommandToSend_StructInit(&CommandToSend);
  
  OW_Status = OW_ERROR;
  ExecFlag = FindExecFlag(argc--, argv++);
  
  switch(ExecFlag)
  {
    case  DeviceSearch:           OW_Status = Device_Search();
                                  break;
          
    case  SendDataOnlyRead:       CommandToSend.Reset = OW_NO_RESET;    
          
    case  SendDataWithRead:       CommandToSend.NumByteForRead = (uint8_t)atoi(argv[0]);                              
                                  argc--;  argv++;  
                                  CommandToSend.ReadStartByte = argc;
          
    case  SendDataNoRead:         CommandToSend.NumByteToSend = argc;
                                  if(MemoryAllotment() == OW_ERROR)
                                    return OW_ERROR;
                                  MemoryFill( argc, argv );
                                  OW_Status = SendData();
                                  break;

    case  MesureTempSkipAdress:   OW_Status = MeasureTemp( argc, argv );
                                  break;
    
    case  NoSuchFlag:
    default:                 	printf("Invalid flag or number of arguments\r\n");
  }
  MemoryFree();
  return OW_Status;
}
Ejemplo n.º 3
0
int8_t MeasureTemp( int argc, const char* const* argv )
{
  uint8_t OW_Status = OW_ERROR, i;
  int8_t numTermo;
  char *CommandsArray[10];
  uint8_t isNoAdress = 1;
  
  if(argc != 0 && argc != 1)
  {
    printf("Must be no arguments with -m flag\r\n");
    return OW_Status;
  }
  if( argc != 0)
      isNoAdress = 0;
  
  CommandToSend.OutputOption = SILENT;
  if( isNoAdress )
  {
    CommandsArray[0] = "204";
    CommandsArray[1] = "68";
    CommandToSend.NumByteToSend = 2;
  }
  else
  {
    numTermo = atoi(argv[0])-1;
    argv ++;
    if( numTermo >= 0 && numTermo < 5)
    {
      CommandsArray[0] = "85";
      for(i = 0; i < 8; i++)
      {
        CommandsArray[i+1] = TermAdress[numTermo][i];
      }
      CommandsArray[9] = "68";
      CommandToSend.NumByteToSend = 10;
    }
    else
    {
      printf("Number TermoSensor must be > 0 and < 5\r\n");
      return OW_Status;
    }
  }
  if(MemoryAllotment() == OW_ERROR)
    return OW_ERROR;
  MemoryFill( CommandToSend.NumByteToSend, CommandsArray  );
  if(SendData() != OW_OK )
    return OW_ERROR;
  MemoryFree();

  Delay(750);
  
  CommandToSend_StructInit( &CommandToSend );
  CommandToSend.OutputOption = SILENT;

  if( isNoAdress )
  {
    CommandsArray[1] = "190";
    CommandToSend.NumByteToSend = 2;
    CommandToSend.ReadStartByte = 2;
  }
  else
  {
    CommandsArray[9] = "190";
    CommandToSend.NumByteToSend = 10;
    CommandToSend.ReadStartByte = 10;
  }  
  CommandToSend.NumByteForRead = 9;
  if(MemoryAllotment() == OW_ERROR)
    return OW_ERROR;
  MemoryFill( CommandToSend.NumByteToSend, CommandsArray  );
  if(SendData() != OW_OK )
    return OW_ERROR;
  PrintTemperature();  
  MemoryFree();

  return OW_Status;
}
Ejemplo n.º 4
0
inline void Write(u32 addr, const T data) {
    addr -= HW::VADDR_GPU;
    u32 index = addr / 4;

    // Writes other than u32 are untested, so I'd rather have them abort than silently fail
    if (index >= Regs::NumIds() || !std::is_same<T, u32>::value) {
        LOG_ERROR(HW_GPU, "unknown Write%lu 0x%08X @ 0x%08X", sizeof(data) * 8, (u32)data, addr);
        return;
    }

    g_regs[index] = static_cast<u32>(data);

    switch (index) {

    // Memory fills are triggered once the fill value is written.
    case GPU_REG_INDEX_WORKAROUND(memory_fill_config[0].trigger, 0x00004 + 0x3):
    case GPU_REG_INDEX_WORKAROUND(memory_fill_config[1].trigger, 0x00008 + 0x3): {
        const bool is_second_filler = (index != GPU_REG_INDEX(memory_fill_config[0].trigger));
        auto& config = g_regs.memory_fill_config[is_second_filler];

        if (config.trigger) {
            MemoryFill(config);
            LOG_TRACE(HW_GPU, "MemoryFill from 0x%08x to 0x%08x", config.GetStartAddress(),
                      config.GetEndAddress());

            // It seems that it won't signal interrupt if "address_start" is zero.
            // TODO: hwtest this
            if (config.GetStartAddress() != 0) {
                if (!is_second_filler) {
                    GSP_GPU::SignalInterrupt(GSP_GPU::InterruptId::PSC0);
                } else {
                    GSP_GPU::SignalInterrupt(GSP_GPU::InterruptId::PSC1);
                }
            }

            // Reset "trigger" flag and set the "finish" flag
            // NOTE: This was confirmed to happen on hardware even if "address_start" is zero.
            config.trigger.Assign(0);
            config.finished.Assign(1);
        }
        break;
    }

    case GPU_REG_INDEX(display_transfer_config.trigger): {
        MICROPROFILE_SCOPE(GPU_DisplayTransfer);

        const auto& config = g_regs.display_transfer_config;
        if (config.trigger & 1) {

            if (Pica::g_debug_context)
                Pica::g_debug_context->OnEvent(Pica::DebugContext::Event::IncomingDisplayTransfer,
                                               nullptr);

            if (config.is_texture_copy) {
                TextureCopy(config);
                LOG_TRACE(HW_GPU, "TextureCopy: 0x%X bytes from 0x%08X(%u+%u)-> "
                                  "0x%08X(%u+%u), flags 0x%08X",
                          config.texture_copy.size, config.GetPhysicalInputAddress(),
                          config.texture_copy.input_width * 16, config.texture_copy.input_gap * 16,
                          config.GetPhysicalOutputAddress(), config.texture_copy.output_width * 16,
                          config.texture_copy.output_gap * 16, config.flags);
            } else {
                DisplayTransfer(config);
                LOG_TRACE(HW_GPU, "DisplayTransfer: 0x%08x(%ux%u)-> "
                                  "0x%08x(%ux%u), dst format %x, flags 0x%08X",
                          config.GetPhysicalInputAddress(), config.input_width.Value(),
                          config.input_height.Value(), config.GetPhysicalOutputAddress(),
                          config.output_width.Value(), config.output_height.Value(),
                          config.output_format.Value(), config.flags);
            }

            g_regs.display_transfer_config.trigger = 0;
            GSP_GPU::SignalInterrupt(GSP_GPU::InterruptId::PPF);
        }
        break;
    }

    // Seems like writing to this register triggers processing
    case GPU_REG_INDEX(command_processor_config.trigger): {
        const auto& config = g_regs.command_processor_config;
        if (config.trigger & 1) {
            MICROPROFILE_SCOPE(GPU_CmdlistProcessing);

            u32* buffer = (u32*)Memory::GetPhysicalPointer(config.GetPhysicalAddress());

            if (Pica::g_debug_context && Pica::g_debug_context->recorder) {
                Pica::g_debug_context->recorder->MemoryAccessed(
                    (u8*)buffer, config.size * sizeof(u32), config.GetPhysicalAddress());
            }

            Pica::CommandProcessor::ProcessCommandList(buffer, config.size);

            g_regs.command_processor_config.trigger = 0;
        }
        break;
    }

    default:
        break;
    }

    // Notify tracer about the register write
    // This is happening *after* handling the write to make sure we properly catch all memory reads.
    if (Pica::g_debug_context && Pica::g_debug_context->recorder) {
        // addr + GPU VBase - IO VBase + IO PBase
        Pica::g_debug_context->recorder->RegisterWritten<T>(
            addr + 0x1EF00000 - 0x1EC00000 + 0x10100000, data);
    }
}
Ejemplo n.º 5
0
/*
 *  MakeNOP
 *      Creates a bunch of NOP instructions at address @at
 */
inline void MakeNOP(memory_pointer_tr at, size_t count = 1, bool vp = true)
{
    MemoryFill(at, 0x90, count, vp);
}
Ejemplo n.º 6
0
 // Fills memory at @addr with value @value and size @size and virtual protect @vp
 void fill(memory_pointer_tr addr, uint8_t value, size_t size, bool vp)
 {
     this->save(addr, size, vp);
     return MemoryFill(addr, value, size, vp);
 }