Exemplo n.º 1
0
        public void TestMappings()
        {
            PoolMapper      poolMapper    = new PoolMapper(DummyProcessHandle, true);
            MemoryPoolState memoryPoolDsp = MemoryPoolState.Create(MemoryPoolState.LocationType.Dsp);
            MemoryPoolState memoryPoolCpu = MemoryPoolState.Create(MemoryPoolState.LocationType.Cpu);

            const CpuAddress CpuAddress = 0x20000;
            const DspAddress DspAddress = CpuAddress; // TODO: DSP LLE
            const ulong      CpuSize    = 0x1000;

            memoryPoolDsp.SetCpuAddress(CpuAddress, CpuSize);
            memoryPoolCpu.SetCpuAddress(CpuAddress, CpuSize);

            Assert.AreEqual(DspAddress, poolMapper.Map(ref memoryPoolCpu));
            Assert.AreEqual(DspAddress, poolMapper.Map(ref memoryPoolDsp));
            Assert.AreEqual(DspAddress, memoryPoolDsp.DspAddress);
            Assert.IsTrue(poolMapper.Unmap(ref memoryPoolCpu));

            memoryPoolDsp.IsUsed = true;
            Assert.IsFalse(poolMapper.Unmap(ref memoryPoolDsp));
            memoryPoolDsp.IsUsed = false;
            Assert.IsTrue(poolMapper.Unmap(ref memoryPoolDsp));
        }
Exemplo n.º 2
0
        internal static Pool GetPool(short id)
        {
            const string spName = "GetPool";

            using (var conn = new SqlConnection(cs))
            {
                conn.Open();
                using (var r = conn.ExecuteReader(spName, id, commandType: CommandType.StoredProcedure))
                {
                    var mapper = new PoolMapper();
                    var result = mapper.Map(r);
                    return(result.FirstOrDefault());
                }
            }
        }