Beispiel #1
0
        /// <summary>
        /// 指定したアドレスから2byte読み出します
        /// </summary>
        /// <param name="bus">読み出し対象</param>
        /// <param name="addr">読み出し先</param>
        /// <param name="isNondestructive">非破壊読み出しならtrue</param>
        /// <returns></returns>
        public static ushort Read16(this IBusAccessible bus, uint addr, bool isNondestructive = false)
        {
            var dst = new byte[2];

            bus.Read(addr, dst, isNondestructive);
            return((ushort)(dst[0] | (dst[1] << 8)));
        }
Beispiel #2
0
        /// <summary>
        /// 指定したアドレスから4byte読み出します
        /// </summary>
        /// <param name="bus">読み出し対象</param>
        /// <param name="addr">読み出し先</param>
        /// <param name="isNondestructive">非破壊読み出しならtrue</param>
        /// <returns></returns>
        public static uint Read32(this IBusAccessible bus, uint addr, bool isNondestructive = false)
        {
            var dst = new byte[4];

            bus.Read(addr, dst, isNondestructive);
            return((uint)(dst[0] | (dst[1] << 8) | (dst[2] << 16) | (dst[3] << 24)));
        }
Beispiel #3
0
        /// <summary>
        /// 指定したアドレスから1byte読み出します
        /// </summary>
        /// <param name="bus">読み出し対象</param>
        /// <param name="addr">読み出し先</param>
        /// <param name="isNondestructive">非破壊読み出しならtrue</param>
        /// <returns></returns>
        public static byte Read8(this IBusAccessible bus, uint addr, bool isNondestructive = false)
        {
            var dst = new byte[1];

            bus.Read(addr, dst, isNondestructive);
            return(dst[0]);
        }