Exemplo n.º 1
0
        private bool TryHandleApplicationSpecificCommand(SdCardApplicationSpecificCommand command, uint arg, out BitStream result)
        {
            this.Log(LogLevel.Debug, "Handling as an application specific command: {0}", command);
            switch (command)
            {
            case SdCardApplicationSpecificCommand.SendSDCardStatus_ACMD13:
                readContext.Data = SDStatus;
                result           = CardStatus;
                return(true);

            case SdCardApplicationSpecificCommand.SendOperatingConditionRegister_ACMD41:
                result = OperatingConditions;
                return(true);

            case SdCardApplicationSpecificCommand.SendSDConfigurationRegister_ACMD51:
                readContext.Data = SDConfiguration;
                result           = CardStatus;
                return(true);

            default:
                this.Log(LogLevel.Debug, "Command #{0} seems not to be any application specific command", command);
                result = null;
                return(false);
            }
        }
Exemplo n.º 2
0
        private bool TryHandleApplicationSpecificCommand(SdCardApplicationSpecificCommand command, uint arg, out BitStream result)
        {
            this.Log(LogLevel.Noisy, "Handling as an application specific command: {0}", command);
            switch (command)
            {
            case SdCardApplicationSpecificCommand.SendSDCardStatus_ACMD13:
                readContext.Data = SDStatus;
                result           = spiMode
                        ? GenerateR2Response()
                        : CardStatus;
                return(true);

            case SdCardApplicationSpecificCommand.SendOperatingConditionRegister_ACMD41:
                // activate the card
                state = SDCardState.Ready;

                highCapacityMode = BitHelper.IsBitSet(arg, 30);

                result = spiMode
                        ? GenerateR1Response()
                        : OperatingConditions;
                return(true);

            case SdCardApplicationSpecificCommand.SendSDConfigurationRegister_ACMD51:
                readContext.Data = SDConfiguration;
                result           = spiMode
                        ? GenerateR1Response()
                        : CardStatus;
                return(true);

            default:
                this.Log(LogLevel.Noisy, "Command #{0} seems not to be any application specific command", command);
                result = null;
                return(false);
            }
        }