text:
package org.apache.flex.compiler.config;

/**
 * Constants for the compiler's command line options.
 */
public interface ICompilerSettingsConstants
{
    static final String USE_NETWORK                                          = "--use-network";
    static final String RUNTIME_SHARED_LIBRARIES                             = "--runtime-shared-libraries";
    static final String RAW_METADATA                                         = "--raw-metadata";
    static final String PROJECTOR                                            = "--projector";
    static final String METADATA_PUBLISHER                                   = "--metadata.publisher";
    static final String METADATA_LANGUAGE                                    = "--metadata.language";
    static final String METADATA_LOCALIZED_TITLE                             = "--metadata.localized-title";
    static final String METADATA_LOCALIZED_DESCRIPTION                       = "--metadata.localized-description";
    static final String METADATA_DATE                                        = "--metadata.date";
    static final String METADATA_CREATOR                                     = "--metadata.creator";
    static final String METADATA_CONTRIBUTOR                                 = "--metadata.contributor";
    static final String LINK_REPORT                                          = "--link-report";
    static final String SIZE_REPORT                                          = "--size-report";
    static final String LICENSES_LICENSE                                     = "--licenses.license";
    static final String INCLUDES                                             = "--includes";
    static final String INCLUDE_RESOURCE_BUNDLES                             = "--include-resource-bundles";
    static final String FLEX                                                 = "--flex";
    static final String FRAMES_FRAME                                         = "--frames.frame";
    static final String LOAD_EXTERNS                                         = "--load-externs";
    static final String LOAD_CONFIG                                          = "--load-config";
    static final String EXTERNS                                              = "--externs";
    static final String DEFAULT_SIZE                                         = "--default-size";
    static final String DEFAULT_SCRIPT_LIMITS                                = "--default-script-limits";
    static final String DEFAULT_FRAME_RATE                                   = "--default-frame-rate";
    static final String DEFAULT_BACKGROUND_COLOR                             = "--default-background-color";
    static final String DEBUG_PASSWORD                                       = "--debug-password";
    static final String SWF_VERSION                                          = "--swf-version";
    static final String COMPILER_WARN_XML_CLASS_HAS_CHANGED                  = "--compiler.warn-xml-class-has-changed";
    static final String COMPILER_WARN_UNLIKELY_FUNCTION_VALUE                = "--compiler.warn-unlikely-function-value";
    static final String COMPILER_WARN_SLOW_TEXT_FIELD_ADDITION               = "--compiler.warn-slow-text-field-addition";
    static final String COMPILER_WARN_SCOPING_CHANGE_IN_THIS                 = "--compiler.warn-scoping-change-in-this";
    static final String COMPILER_WARN_NUMBER_FROM_STRING_CHANGES             = "--compiler.warn-number-from-string-changes";
    static final String COMPILER_WARN_NO_TYPE_DECL                           = "--compiler.warn-no-type-decl";
    static final String COMPILER_WARN_NO_EXPLICIT_SUPER_CALL_IN_CONSTRUCTOR  = "--compiler.warn-no-explicit-super-call-in-constructor";
    static final String COMPILER_WARN_NO_CONSTRUCTOR                         = "--compiler.warn-no-constructor";
    static final String COMPILER_WARN_NEGATIVE_UINT_LITERAL                  = "--compiler.warn-negative-uint-literal";
    static final String COMPILER_WARN_MISSING_NAMESPACE_DECL                 = "--compiler.warn-missing-namespace-decl";
    static final String COMPILER_WARN_LEVEL_NOT_SUPPORTED                    = "--compiler.warn-level-not-supported";
    static final String COMPILER_WARN_INTERNAL_ERROR                         = "--compiler.warn-internal-error";
    static final String COMPILER_WARN_INSTANCE_OF_CHANGES                    = "--compiler.warn-instance-of-changes";
    static final String COMPILER_WARN_IMPORT_HIDES_CLASS                     = "--compiler.warn-import-hides-class";
    static final String COMPILER_WARN_FOR_VAR_IN_CHANGES                     = "--compiler.warn-for-var-in-changes";
    static final String COMPILER_WARN_DUPLICATE_VARIABLE_DEF                 = "--compiler.warn-duplicate-variable-def";
    static final String COMPILER_WARN_DUPLICATE_ARGUMENT_NAMES               = "--compiler.warn-duplicate-argument-names";
    static final String COMPILER_WARN_DEPRECATED_PROPERTY_ERROR              = "--compiler.warn-deprecated-property-error";
    static final String COMPILER_WARN_DEPRECATED_FUNCTION_ERROR              = "--compiler.warn-deprecated-function-error";
    static final String COMPILER_WARN_DEPRECATED_EVENT_HANDLER_ERROR         = "--compiler.warn-deprecated-event-handler-error";
    static final String COMPILER_WARN_CONSTRUCTOR_RETURNS_VALUE              = "--compiler.warn-constructor-returns-value";
    static final String COMPILER_WARN_CONST_NOT_INITIALIZED                  = "--compiler.warn-const-not-initialized";
    static final String COMPILER_WARN_CLASS_IS_SEALED                        = "--compiler.warn-class-is-sealed";
    static final String COMPILER_WARN_CHANGES_IN_RESOLVE                     = "--compiler.warn-changes-in-resolve";
    static final String COMPILER_WARN_BOOLEAN_CONSTRUCTOR_WITH_NO_ARGS       = "--compiler.warn-boolean-constructor-with-no-args";
    static final String COMPILER_WARN_BAD_UNDEFINED_COMPARISON               = "--compiler.warn-bad-undefined-comparison";
    static final String COMPILER_WARN_BAD_NULL_COMPARISON                    = "--compiler.warn-bad-null-comparison";
    static final String COMPILER_WARN_BAD_NULL_ASSIGNMENT                    = "--compiler.warn-bad-null-assignment";
    static final String COMPILER_WARN_BAD_NAN_COMPARISON                     = "--compiler.warn-bad-nan-comparison";
    static final String COMPILER_WARN_BAD_ES3_TYPE_PROP                      = "--compiler.warn-bad-es3-type-prop";
    static final String COMPILER_WARN_BAD_ES3_TYPE_METHOD                    = "--compiler.warn-bad-es3-type-method";
    static final String COMPILER_WARN_BAD_DATE_CAST                          = "--compiler.warn-bad-date-cast";
    static final String COMPILER_WARN_BAD_BOOL_ASSIGNMENT                    = "--compiler.warn-bad-bool-assignment";
    static final String COMPILER_WARN_BAD_ARRAY_CAST                         = "--compiler.warn-bad-array-cast";
    static final String COMPILER_WARN_ASSIGNMENT_WITHIN_CONDITIONAL          = "--compiler.warn-assignment-within-conditional";
    static final String COMPILER_WARN_ARRAY_TOSTRING_CHANGES                 = "--compiler.warn-array-tostring-changes";
    static final String COMPILER_VERBOSE_STACKTRACES                         = "--compiler.verbose-stacktraces";
    static final String COMPILER_USE_RESOURCE_BUNDLE_METADATA                = "--compiler.use-resource-bundle-metadata";
    static final String COMPILER_THEME                                       = "--compiler.theme";
    static final String COMPILER_STRICT                                      = "--compiler.strict";
    static final String COMPILER_SOURCE_PATH                                 = "--compiler.source-path";
    static final String COMPILER_SHOW_UNUSED_TYPE_SELECTOR_WARNINGS          = "--compiler.show-unused-type-selector-warnings";
    static final String COMPILER_SHOW_DEPRECATION_WARNINGS                   = "--compiler.show-deprecation-warnings";
    static final String COMPILER_SHOW_BINDING_WARNINGS                       = "--compiler.show-binding-warnings";
    static final String COMPILER_SHOW_ACTIONSCRIPT_WARNINGS                  = "--compiler.show-actionscript-warnings";
    static final String COMPILER_SERVICES                                    = "--compiler.services";
    static final String COMPILER_OPTIMIZE                                    = "--compiler.optimize";
    static final String COMPILER_NAMESPACES_NAMESPACE                        = "--compiler.namespaces.namespace";
    static final String COMPILER_MOBILE                                      = "--compiler.mobile";
    static final String COMPILER_LOCALE                                      = "--compiler.locale";
    static final String COMPILER_LIBRARY_PATH                                = "--compiler.library-path";
    static final String COMPILER_INCLUDE_LIBRARIES                           = "--compiler.include-libraries";
    static final String COMPILER_KEEP_GENERATED_ACTIONSCRIPT                 = "--compiler.keep-generated-actionscript";
    static final String COMPILER_KEEP_AS3_METADATA                           = "--compiler.keep-as3-metadata";
    static final String COMPILER_KEEP_ALL_TYPE_SELECTORS                     = "--compiler.keep-all-type-selectors";
    static final String COMPILER_HEADLESS_SERVER                             = "--compiler.headless-server";
    static final String COMPILER_EXTERNAL_LIBRARY_PATH                       = "--compiler.external-library-path";
    static final String COMPILER_ES                                          = "--compiler.es";
    static final String COMPILER_DEFAULTS_CSS_URL                            = "--compiler.defaults-css-url";
    static final String COMPILER_DEBUG                                       = "--compiler.debug";
    static final String COMPILER_COMPRESS                                    = "--compiler.compress";
    static final String COMPILER_CONTEXT_ROOT                                = "--compiler.context-root";
    static final String COMPILER_AS3                                         = "--compiler.as3";
    static final String COMPILER_ALLOW_SOURCE_PATH_OVERLAP                   = "--compiler.allow-source-path-overlap";
    static final String COMPILER_ACTIONSCRIPT_FILE_ENCODING                  = "--compiler.actionscript-file-encoding";
    static final String COMPILER_ACCESSIBLE                                  = "--compiler.accessible";
    static final String TARGET_PLAYER                                        = "--target-player";
    static final String RUNTIME_SHARED_LIBRARY_PATH                          = "--runtime-shared-library-path";
    static final String VERIFY_DIGESTS                                       = "--verify-digests";
    static final String COMPILER_COMPUTE_DIGEST                              = "--compute-digest";
    static final String COMPILER_DEFINE                                      = "--compiler.define";
    static final String COMPILER_MXML_COMPATIBILITY                          = "--compiler.mxml.compatibility-version";
    static final String COMPILER_EXTENSIONS                                  = "--compiler.extensions.extension";
    static final String REMOVE_UNUSED_RSLS                                   = "--remove-unused-rsls";
    static final String RUNTIME_SHARED_LIBRARY_SETTINGS_FORCE_RSLS           = "--runtime-shared-library-settings.force-rsls";
    static final String RUNTIME_SHARED_LIBRARY_SETTINGS_APPLICATION_DOMAIN   = "--runtime-shared-library-settings.application-domain";
    static final String OUTPUT                                               = "--output";
    static final String STATIC_LINK_RUNTIME_SHARED_LIBRARIES                 = "--static-link-runtime-shared-libraries";
    static final String COMPILER_SHOW_MULTIPLE_DEFINITION_WARNINGS           = "--show-multiple-definition-warnings";

    //
    // Library Settings
    //
    static final String INCLUDE_CLASSES                                      = "--include-classes";
    static final String INCLUDE_FILE                                         = "--include-file";
    static final String INCLUDE_INHERITANCE_DEPENDENCIES_ONLY                = "--include-inheritance-dependencies-only";
    static final String INCLUDE_LOOKUP_ONLY                                  = "--include-lookup-only";
    static final String INCLUDE_NAMESPACES                                   = "--include-namespaces";
    static final String INCLUDE_SOURCES                                      = "--include-sources";
    static final String INCLUDE_STYLESHEET                                   = "--include-stylesheet";
    static final String EXCLUDE_NATIVE_JS_LIBRARIES                          = "--exclude-native-js-libraries";

    // Setting options without the "--" separator.
    // These are used to set and get vars from the ConfigurationBuffer.
    static final String DUMP_CONFIG_VAR                                      = "dump-config";
    static final String FILE_SPECS_VAR                                       = "file-specs";
    static final String INCLUDE_CLASSES_VAR                                 = "include-classes";
    static final String OUTPUT_VAR                                           = "output";
}


text:
import { Component, AfterViewInit, ViewChild } from '@angular/core';

import { PlayGameService } from './playgame.service' ;
import { ControlComponent } from './control/control.component' ;
import { KeyboardComponent } from './keyboard/keyboard.component' ;
import { HangmanComponent } from './hangman/hangman.component' ;

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.scss'],
  providers: []
})

export class AppComponent  implements AfterViewInit {

  @ViewChild(KeyboardComponent) private keyboardComponent : KeyboardComponent ;
  @ViewChild(ControlComponent) private controlComponent : ControlComponent ;
  @ViewChild(HangmanComponent) private hangmanComponent : HangmanComponent ;

  constructor(private playGameService : PlayGameService) {}

  ngAfterViewInit() : void {
    this.controlComponent.consumeNewGame(this.playGameService.newGame) ;
    this.controlComponent.consumeNewGame(this.keyboardComponent.resetKeyboard) ;
    this.keyboardComponent.consumeLetters(this.playGameService.playLetter) ;
    this.playGameService.consumeBodyParts(this.hangmanComponent.drawBody) ;
  }
}

redpajama_set_name: RedPajamaGithub


text:
/**
 *
 */
package me.yumin.sharding.client.impl;

import java.util.Map;
import java.util.TreeMap;
import javax.sql.DataSource;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.springframework.orm.ibatis.SqlMapClientFactoryBean;
import com.ibatis.sqlmap.client.SqlMapClient;
import me.yumin.sharding.client.IShardingStrategy;
import me.yumin.sharding.client.etc.ShardingConfig;
import me.yumin.sharding.client.etc.ShardingUtil;
import me.yumin.sharding.client.exception.ShardingException;

/**
 * @author xuanyin
 *
 */
public final class DefaultShardingStrategy implements IShardingStrategy, InitializingBean {

	/**
	 * sqlMapConfig文件的相对路径.外部注入(必选)
	 */
	private String configLocation;

	/**
	 * Key=数据库名,Value=数据源类.外部注入(必选)
	 */
	private Map<String, DataSource> dataSourceMap;

	/**
	 * Key=连续数值,Value=数据库名\0零至表量.内部生成
	 */
	private static final Map<Integer, String> shardingMap = new TreeMap<Integer, String>();

	/**
	 * Key=数据库名,Value=库操作类.内部生成
	 */
	private static final Map<String, SqlMapClient> sqlMapClientMap = new TreeMap<String, SqlMapClient>();

	/**
	 * 数据源总数.根据dataSourceMap计算得出.内部生成
	 */
	private static int dataSourceSize;

	/**
	 * 单库表数量.防止随意调整,暂不支持配置.内部生成
	 */
	private static int tableSize;

	/**
	 * 日志操作类
	 */
	private static final Log LOG = LogFactory.getLog(DefaultShardingStrategy.class);

	// ====================
	// public methods
	// ====================

	@Override
	public void afterPropertiesSet() throws Exception {

		// 初始类内各属性值
		initProperty();
		// 初始分布式对应表
		initShardingMap();
		// 初始数据源对应表
		initSqlMapClientMap();
	}

	@Override
	public String getDistributedByHash(int hash) {

		String distributed = "";

		try {
			if (0 > hash) {
				throw new ShardingException("hash is error!");
			}
			distributed = shardingMap.get(hash);
			LOG.debug(String.format("distributed=%s", distributed));
		} catch (Exception e) {
			LOG.error(e.getMessage(), e);
		}

		return distributed;
	}

	@Override
	public int getHashByShardingId(Object shardingId) {

		int hash = -1;

		try {
			if (null == shardingId) {
				throw new ShardingException("shardingId is error!");
			}
			hash = ShardingUtil.getHashNode(shardingId, dataSourceSize * tableSize);
			LOG.debug(String.format("hash=%s", hash));
		} catch (Exception e) {
			LOG.error(e.getMessage(), e);
		}

		return hash;
	}

	@Override
	public SqlMapClient getSqlMapClientByDbName(String dbName) {

		SqlMapClient sqlMapClient = null;

		try {
			if (null == dbName) {
				throw new ShardingException("dbName is error!");
			}
			sqlMapClient = sqlMapClientMap.get(dbName);
			LOG.debug(String.format("dbName=%s", dbName));
		} catch (Exception e) {
			LOG.error(e.getMessage(), e);
		}

		return sqlMapClient;
	}

	// ====================
	// private methods
	// ====================

	/**
	 *
	 */
	private void initProperty() {

		try {
			// configLocation是必选注入属性
			if (null == configLocation || 0 == configLocation.length()) {
				throw new ShardingException("property 'configLocation' can not be null!");
			}
			// dataSourceMap是必选注入属性
			if (null == dataSourceMap || 0 == dataSourceMap.size()) {
				throw new ShardingException("property 'dataSourceMap' can not be null!");
			}
			// 数据源总数
			dataSourceSize = dataSourceMap.size();
			// 单库表数量
			tableSize = Integer.parseInt(ShardingConfig.getValue(ShardingConfig.KEY_TABLE_SIZE));
			// 源及表数量
			if (1 > dataSourceSize || 1 > tableSize) {
				throw new ShardingException("property DATASOURCE_SIZE or TABLE_SIZE initialization failed!");
			}
		} catch (Exception e) {
			LOG.error(e.getMessage(), e);
		}
	}

	/**
	 *
	 */
	private void initShardingMap() {

		try {
			if (null == shardingMap || 0 == shardingMap.size()) {
				int j = 0;
				for (Map.Entry<String, DataSource> entry : dataSourceMap.entrySet()) {
					for (int i = 0; i < tableSize; i++) {
						shardingMap.put(j, entry.getKey() + ShardingConfig.SEPARATE + i);
						j++;
					}
				}
			}
			if (null != shardingMap) {
				LOG.info(String.format("shardingMap=%s", shardingMap.toString()));
			}
		} catch (Exception e) {
			LOG.error(e.getMessage(), e);
		}
	}

	/**
	 *
	 */
	private synchronized void initSqlMapClientMap() {

		try {
			if (null == sqlMapClientMap || 0 == sqlMapClientMap.size()) {
				Resource resource = new ClassPathResource(configLocation);
				if (null != resource) {
					for (Map.Entry<String, DataSource> entry : dataSourceMap.entrySet()) {
						String dbName = entry.getKey();
						DataSource dataSource = entry.getValue();
						SqlMapClientFactoryBean factory = new SqlMapClientFactoryBean();
						factory.setConfigLocation(resource);
						factory.setDataSource(dataSource);
						factory.afterPropertiesSet();
						SqlMapClient sqlMapClient = (SqlMapClient) factory.getObject();
						sqlMapClientMap.put(dbName, sqlMapClient);
					}
				}
			}
			if (null != sqlMapClientMap) {
				LOG.info(String.format("sqlMapClientMap=%s", sqlMapClientMap.toString()));
			}
		} catch (Exception e) {
			LOG.error(e.getMessage(), e);
		}
	}

	// ====================
	// getters and setters
	// ====================

	public void setConfigLocation(String configLocation) {
		this.configLocation = configLocation;
	}

	public void setDataSourceMap(Map<String, DataSource> dataSourceMap) {
		this.dataSourceMap = dataSourceMap;
	}
}


text:
package com.orientechnologies.orient.core.tx;

import com.orientechnologies.orient.core.db.record.ORecordOperation;

/**
 * Listener interface to catch events during transactions phases.
 *
 * @author Luca Garulli
 *
 */
public interface OTxListener {
	public enum EVENT {
		BEFORE_COMMIT, AFTER_COMMIT, BEFORE_ROLLBACK, AFTER_ROLLBACK
	}

	public void onEvent(ORecordOperation iTxEntry, EVENT iEvent);
}


text:
//     Copyright (c) Microsoft Corporation.  All rights reserved.

using System;
using System.Diagnostics;
using System.IO;
using Newtonsoft.Json;

namespace Microsoft.Dash.Common.Diagnostics
{
    public static class DashTrace
    {
        static readonly JsonSerializer _serializer = JsonSerializer.Create(new JsonSerializerSettings()
        {
            DateFormatHandling = DateFormatHandling.IsoDateFormat,
            DefaultValueHandling = DefaultValueHandling.Ignore,
            NullValueHandling = NullValueHandling.Ignore,
        });

        public static void TraceInformation(string message)
        {
            TraceInformation(new TraceMessage() { Message = message });
        }

        public static void TraceInformation(string format, params object[] args)
        {
            TraceInformation(new TraceMessage() { Message = String.Format(format, args) });
        }

        public static void TraceInformation(TraceMessage message)
        {
            DoTrace(message, TraceLevel.Info);
        }

        public static void TraceWarning(string message)
        {
            TraceWarning(new TraceMessage() { Message = message });
        }

        public static void TraceWarning(string format, params object[] args)
        {
            TraceWarning(new TraceMessage() { Message = String.Format(format, args) });
        }

        public static void TraceWarning(TraceMessage message)
        {
            DoTrace(message, TraceLevel.Warning);
        }

        public static void TraceError(string message)
        {
            TraceError(new TraceMessage() { Message = message });
        }

        public static void TraceError(string format, params object[] args)
        {
            TraceError(new TraceMessage() { Message = String.Format(format, args) });
        }

        public static void TraceError(TraceMessage message)
        {
            DoTrace(message, TraceLevel.Error);
        }

        public static Guid CorrelationId
        {
            get { return Trace.CorrelationManager.ActivityId; }
            set { Trace.CorrelationManager.ActivityId = value; }
        }

        static void DoTrace(TraceMessage message, TraceLevel level)
        {
            if (!message.CorrelationId.HasValue)
            {
                if (Trace.CorrelationManager.ActivityId != Guid.Empty)
                {
                    message.CorrelationId = Trace.CorrelationManager.ActivityId;
                }
            }
            using (var writer = new StringWriter())
            {
                _serializer.Serialize(writer, message);
                // Can't use delegates here as all the Trace methods are [Conditional]
                switch (level)
                {
                    case TraceLevel.Info:
                    default:
                        Trace.TraceInformation(writer.ToString());
                        break;

                    case TraceLevel.Warning:
                        Trace.TraceWarning(writer.ToString());
                        break;

                    case TraceLevel.Error:
                        Trace.TraceError(writer.ToString());
                        break;
                }
            }
        }
    }
}


text:
{% extends 'style/base_section.html' %}
{% load crispy_forms_tags %}
{% load hq_shared_tags %}
{% load i18n %}

{% block js-inline %} {{ block.super }}
    <script>
        $(function() {
            $('form[name="user_information"]').activateSubmitOnlyOnChange();
            $('#id_language').select2();
            $('#generate-api-key').click(function() {
                var apiDiv = $(this).parent().parent().parent();
                $.post('{% url 'new_api_key' %}', '', function(data) {
                    apiDiv.find('.form-control-static').text(data);
                });
            })
        });
    </script>
{% endblock %}

{% block page_content %}
<p class="lead">
    {% blocktrans %}
    Changing your information here will update your account across all of your projects.
    {% endblocktrans %}
</p>
{% crispy form form.new_helper %}
{% endblock page_content %}


text:
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Dynamic;
using System.Linq;
using System.Net.Http;
using System.Threading.Tasks;

using Microsoft.Deployment.Common.ActionModel;
using Microsoft.Deployment.Common.Actions;
using Microsoft.Deployment.Common.ErrorCode;
using Microsoft.Deployment.Common.Helpers;
using Newtonsoft.Json.Linq;

namespace Microsoft.Deployment.Actions.AzureCustom.Common
{
    [Export(typeof(IAction))]
    public class CheckFunctionStatus : BaseAction
    {
        public override async Task<ActionResponse> ExecuteActionAsync(ActionRequest request)
        {
            var azureToken = request.DataStore.GetJson("AzureToken", "access_token");
            var subscription = request.DataStore.GetJson("SelectedSubscription", "SubscriptionId");
            var resourceGroup = request.DataStore.GetValue("SelectedResourceGroup");
            var location = request.DataStore.GetJson("SelectedLocation", "Name");
            var sitename = request.DataStore.GetValue("FunctionName");

            AzureHttpClient client = new AzureHttpClient(azureToken, subscription, resourceGroup);

            // Force sync
            dynamic obj = new ExpandoObject();
            obj.subscriptionId = subscription;
            obj.SiteId = new ExpandoObject();
            obj.SiteId.Name = sitename;
            obj.SiteId.ResourceGroup = resourceGroup;
            HttpResponseMessage result = await client.ExecuteGenericRequestWithHeaderAsync(HttpMethod.Post, "https://web1.appsvcux.ext.azure.com/websites/api/Websites/KuduSync", JsonUtility.GetJsonStringFromObject(obj));
            var resultBody = await result.Content.ReadAsStringAsync();

            while(true)
            {
                result = await client.ExecuteWithSubscriptionAndResourceGroupAsync(HttpMethod.Get, $"/providers/Microsoft.Web/sites/{sitename}/deployments", "2016-08-01", "");
                resultBody = await result.Content.ReadAsStringAsync();
                if(result.IsSuccessStatusCode)
                {
                    var jobj = JsonUtility.GetJObjectFromJsonString(resultBody);
                    if(jobj["value"] != null && (jobj["value"] as JArray).Count > 0 )
                    {
                        if (bool.Parse(jobj["value"][0]["properties"]["complete"].ToString()) == true)
                        {
                            break;
                        }
                    }

                }

                await Task.Delay(5000);
            }

            return new ActionResponse(ActionStatus.Success);
        }
    }
}


text:
"""!
@file
@date 07 Jun 2015

@license
Copyright 2015 Brett Tully

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""
__use_python_solver = True
if __use_python_solver:
    from mpet.four_compartment import FourCompartmentMPET as MPETSolver
else:
    from mpet import FourCompartmentPoro as MPETSolver
from mpet import FourCompartmentPoroOptions
from mpet import FourCompartmentPoroResult

class Setup(object):
    def __init__(self, grid_size, num_steps):
        self.grid_size = grid_size
        self.num_steps = num_steps

    def __str__(self):
        return "grid_size = {}, n_steps = {}".format(self.grid_size,
                                                     self.num_steps)

def run(setup):
    assert isinstance(setup, Setup)
    print "Running:", setup
    grid_size = setup.grid_size
    secs_in_day = 86400.0
    initial_time = 0.0
    num_steps = setup.num_steps
    dt = secs_in_day / num_steps
    write_transient = False
    write_wall = False
    base_name = "grid_study"
    debug_print = False

    opts = FourCompartmentPoroOptions()
    # arteriol constants
    opts.alpha_a = 1.0
    opts.beta_a = 0.99
    opts.kappa_a = 1e-10
    opts.mu_a = 8.9e-4 * 3.  # about 3 times that of water

    # capillary constants
    opts.alpha_c = 0.8
    opts.beta_c = 0.99
    opts.kappa_c = 1e-10
    opts.mu_c = 8.9e-4 * 3.  # about 3 times that of water
    opts.k_ce = 6e-4

    # venous constants
    opts.alpha_v = 1.0
    opts.beta_v = 0.99
    opts.kappa_v = 1e-10
    opts.mu_v = 8.9e-4 * 3.  # about 3 times that of water

    # transfer coefficients
    opts.gamma_ac = 1.5e-19
    opts.gamma_ce = 1.0e-22
    opts.gamma_cv = 1.5e-19
    opts.gamma_ev = 1.0e-13

    # aqueduct diameter
    opts.aqueduct_diameter = 0.25e-3# 4e-3

    s = MPETSolver(grid_size, initial_time, num_steps, dt, write_transient,
                   write_wall, debug_print, base_name, opts)
    result = s.solve()
    assert isinstance(result, FourCompartmentPoroResult)
    return [setup.grid_size,
            setup.num_steps,
            result.displacement,
            result.pressure_art,
            result.pressure_cap,
            result.pressure_csf,
            result.pressure_ven]

if __name__ == "__main__":
    from mpl_toolkits.mplot3d import Axes3D  # needed to register projection
    import matplotlib.pyplot as plt
    import numpy as np
    import multiprocessing as mp
    fname = "grid_study.dat"

    rerun_simulations = False
    if rerun_simulations:
        grid_size_list = range(500, 5000 + 1, 200)
        num_steps_list = range(3, 4)
        setup_list = list()
        for g in grid_size_list:
            for n in num_steps_list:
                setup_list.append(Setup(g, n))

        pool = mp.Pool(processes=2)#mp.cpu_count())
        results = np.array(pool.map(run, setup_list))
        np.savetxt(fname, results, delimiter='\t')
    else:
        results = np.loadtxt(fname, delimiter='\t')

    plots = list()
    plots.append("Displacement")
    plots.append("Pressure: Art")
    plots.append("Pressure: Cap")
    plots.append("Pressure: CSF")
    plots.append("Pressure: Ven")
    num_plots = len(plots)
    fig = plt.figure()
    for plt_idx, plt_title in enumerate(plots):
        # ax = fig.add_subplot(1, num_plots, plt_idx + 1, projection='3d')
        # ax.scatter(results[:, 0], results[:, 1], zs=results[:, plt_idx + 2])
        ax = fig.add_subplot(1, num_plots, plt_idx + 1)
        ax.plot(results[:, 0], results[:, plt_idx + 2], 'o')
        ax.grid()
        ax.set_title(plt_title)
    plt.show()


text:
      angular.module('Movie', [
          'ngRoute',
          'Search',
          'Movie.detail',
          'Movie.list'
      ]).
      constant('AppConfig', {
          listUrl: "https://api.douban.com/v2/movie/",
          detailUrl: "https://api.douban.com/v2/movie/subject/",
          searchAnchor:"#/search/0?q=",
          detail:"#/subject/",
          pageSize: 10
      }).
      config(['$routeProvider', function($routeProvider) {
              $routeProvider.otherwise({ redirectTo: '/in_theaters/0' });
          }])
          .controller('navController', [
              '$scope',
              '$location',
              function($scope, $location) {
              	$scope.$location = $location;
                  $scope.$watch('$location.path()', function(now) {
                      $scope.activeItem = now.slice(now.indexOf('') + 1,
                       now.lastIndexOf('/'));
                  });

              }
          ]);


text:
package com.senla.bolkunets.autoservice.beans;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import com.senla.bolkunets.autoservice.api.beans.IGarage;
import com.senla.bolkunets.autoservice.api.beans.IMaster;
import com.senla.bolkunets.autoservice.api.beans.IOrder;
import com.senla.bolkunets.autoservice.api.enums.OrderStatus;
import com.senla.bolkunets.autoservice.utils.IdGenerator;

public class Order implements IOrder {

	private static final long serialVersionUID = -2850704235114367936L;

	private long id;

	private OrderStatus orderStatus;

	private double price;

	private List<IMaster> masters;
	private IGarage garage;

	private Date consulationDate;
	private Date startDate;
	private Date endDate;

	public Order(long id, double price) {
		this.id = id;
		this.price = price;
		orderStatus = OrderStatus.PLANNDED;
		masters = new ArrayList<>();
	}

	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

	public OrderStatus getOrderStatus() {
		return orderStatus;
	}

	public void setOrderStatus(OrderStatus orderStatus) {
		this.orderStatus = orderStatus;
	}

	public double getPrice() {
		return price;
	}

	public void setPrice(double price) {
		this.price = price;
	}

	public List<IMaster> getMasters() {
		return masters;
	}

	public void setMasters(List<IMaster> mastersList) {
		this.masters = mastersList;
	}

	public IGarage getGarage() {
		return garage;
	}

	public void setGarage(IGarage garage) {
		this.garage = garage;
	}

	public Date getConsulationDate() {
		return consulationDate;
	}

	public void setConsulationDate(Date consulationDate) {
		this.consulationDate = consulationDate;
	}

	public Date getStartDate() {
		return startDate;
	}

	public void setStartDate(Date startDate) {
		this.startDate = startDate;
	}

	public Date getEndDate() {
		return endDate;
	}

	public void setEndDate(Date endDate) {
		this.endDate = endDate;
	}

	@Override
	public IOrder clone() throws CloneNotSupportedException {
		IOrder order = (Order) super.clone();
		IdGenerator generator = IdGenerator.getInstance();
		order.setId(generator.nextIdOrder());

		if (masters != null) {
			List<IMaster> mastersCopy = new ArrayList<>();
			mastersCopy.addAll(0, masters);
			order.setMasters(mastersCopy);
		}

		Date cloneStartDate = startDate == null ? null : (Date) startDate.clone();
		Date cloneConsulDate = consulationDate == null ? null : (Date) consulationDate.clone();
		Date cloneEndDate = endDate == null ? null : (Date) endDate.clone();

		order.setOrderStatus(OrderStatus.PLANNDED);
		order.setConsulationDate(cloneConsulDate);
		order.setEndDate(cloneEndDate);
		order.setStartDate(cloneStartDate);
		return order;
	}

	@Override
	public String toString() {
		return "Order [id=" + id + ", orderStatus=" + orderStatus + ", price=" + price + ", mastersList=" + masters
				+ ", garage=" + garage + ", consulationDate=" + consulationDate + ", startDate=" + startDate
				+ ", endDate=" + endDate + "]";
	}

}


text:
export BulkProvider from './BulkProvider'
export MovieProvider from './MovieProvider'
export ShowProvider from './ShowProvider'
export YtsProvider from './YtsProvider'


text:
package com.streamsets.datacollector.runner.preview;

import com.streamsets.datacollector.runner.SourceOffsetTracker;
import com.streamsets.pipeline.api.Source;

import java.util.HashMap;
import java.util.Map;

public class PreviewSourceOffsetTracker implements SourceOffsetTracker {
  private Map<String, String> offsets;
  private boolean finished;

  public PreviewSourceOffsetTracker(Map<String, String> offset) {
    this.offsets = new HashMap<>(offset);
    finished = false;
  }

  @Override
  public boolean isFinished() {
    return finished;
  }

  @Override
  public void commitOffset(String entity, String newOffset) {
    if(entity == null) {
      return;
    }

    if(Source.POLL_SOURCE_OFFSET_KEY.equals(entity)) {
      finished = (newOffset == null);
    }

    if(newOffset == null) {
      offsets.remove(entity);
    } else {
      offsets.put(entity, newOffset);
    }
  }

  @Override
  public Map<String, String> getOffsets() {
    return offsets;
  }

  @Override
  public long getLastBatchTime() {
    return 0;
  }

}


text:
#ifndef RenderSVGTextPath_h
#define RenderSVGTextPath_h

#include "core/rendering/svg/RenderSVGInline.h"

namespace WebCore {

class RenderSVGTextPath FINAL : public RenderSVGInline {
public:
    RenderSVGTextPath(Element*);

    Path layoutPath() const;
    float startOffset() const;
    bool exactAlignment() const;
    bool stretchMethod() const;

    virtual bool isSVGTextPath() const { return true; }

private:
    virtual const char* renderName() const { return "RenderSVGTextPath"; }

    Path m_layoutPath;
};

inline RenderSVGTextPath* toRenderSVGTextPath(RenderObject* object)
{
    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isSVGTextPath());
    return static_cast<RenderSVGTextPath*>(object);
}

// This will catch anyone doing an unnecessary cast.
void toRenderSVGTextPath(const RenderSVGTextPath*);

}

#endif // RenderSVGTextPath_h


text:
#ifndef XSSYNCROLE_H
#define XSSYNCROLE_H

/*!	\addtogroup enums Global enumerations
	@{
*/
/*! \brief Synchronization roles
*/
enum XsSyncRole {
	XSR_Slave,
	XSR_None,
	XSR_MasterSlave,
	XSR_Master
};
/*! @} */
typedef enum XsSyncRole XsSyncRole;

#endif // file guard


text:
package primes_test

import (
	"math"
	"math/rand"
	"testing"

	"github.com/fxtlabs/primes"
)

// baselineIsPrime returns true if n is prime.
// It uses trial division against all i in [2,sqrt(n)] and will be extremely
// slow for large n.
// Used for testing only.
func baselineIsPrime(n int) bool {
	switch {
	case n < 2:
		return false
	case n == 2:
		return true
	}
	max := int(math.Ceil(math.Sqrt(float64(n))))
	for d := 2; d <= max; d++ {
		if n%d == 0 {
			return false
		}
	}
	return true
}

// baselineSieve returns a list of the prime numbers less than or equal to n.
// If n is less than 2, it returns an empty list.
// The function uses the sieve of Eratosthenes algorithm with the following
// simple optimizations:
//
// * Given a prime p, only multiples of p greater than or equal to p*p need to be marked off since smaller multiples of p have already been marked off by then.
//
// * The above also implies that the algorithm can terminate as soon as it finds  a prime p such that p*p is greater than n.
//
// See https://en.wikipedia.org/wiki/Sieve_of_Eratosthenes for details.
func baselineSieve(n int) []int {
	if n < 2 {
		return []int{}
	}
	// a[i] == false ==> i is a candidate prime
	a := make([]bool, n+1, n+1)
	sqrtn := int(math.Sqrt(float64(n)))
	for i := 2; i <= sqrtn; i++ {
		if !a[i] {
			for j := i * i; j <= n; j += i {
				a[j] = true
			}
		}
	}
	ps := make([]int, 0, 1000)
	for i := 2; i <= n; i++ {
		if !a[i] {
			ps = append(ps, i)
		}
	}
	return ps
}

func TestIsPrimeAgainstBaseline(t *testing.T) {
	for n := -1; n < 1000; n++ {
		p := primes.IsPrime(n)
		q := baselineIsPrime(n)
		if p != q {
			t.Errorf("IsPrimeAgainstBaseline(%d) == %v, want %v", n, p, q)
		}
	}
	for i := 0; i < 10000; i++ {
		n := rand.Intn(math.MaxInt32)
		p := primes.IsPrime(n)
		q := baselineIsPrime(n)
		if p != q {
			t.Errorf("IsPrimeAgainstBaseline(%d) == %v, want %v", n, p, q)
		}
	}
}

func TestSieveAgainstBaseline(t *testing.T) {
	ns := []int{0, 1, 2, 3, 10000000}
	for _, n := range ns {
		ps := primes.Sieve(n)
		qs := baselineSieve(n)
		if len(ps) != len(qs) {
			t.Errorf("SieveAgainstBaseline(%d): len == %d, want %d", n, len(ps), len(qs))
			break
		}
		for i, p := range ps {
			if p != qs[i] {
				t.Errorf("SieveAgainstBaseline(%d): [%d] == %d, want %d", n, i, p, qs[i])
				break
			}
		}
	}
}

// Something to make sure the benchmarks are not optimized down to nothing
var nprimes int

func benchmarkSieve(b *testing.B, sieve func(n int) []int) int {
	ps := sieve(b.N)
	return len(ps)
}

// We expect primes.Sieve to be twice as fast as the baseline since it
// improves upon it by considering only odd numbers
func BenchmarkSieve(b *testing.B) {
	nprimes += benchmarkSieve(b, primes.Sieve)
}

func BenchmarkBaselineSieve(b *testing.B) {
	nprimes -= benchmarkSieve(b, baselineSieve)
}

func benchmarkIsPrime(b *testing.B, isPrime func(n int) bool) int {
	nps := 0
	for n := 0; n < b.N; n++ {
		if isPrime(n) {
			nps++
		}
	}
	return nps
}

func BenchmarkIsPrime(b *testing.B) {
	nprimes += benchmarkIsPrime(b, primes.IsPrime)
}

func BenchmarkBaselineIsPrime(b *testing.B) {
	nprimes -= benchmarkIsPrime(b, baselineIsPrime)
}


text:
MIME-Version: 1.0
Server: CERN/3.0
Date: Monday, 06-Jan-97 21:27:01 GMT
Content-Type: text/html
Content-Length: 953
Last-Modified: Thursday, 05-Dec-96 00:25:13 GMT

<TITLE>Information about Scott</TITLE>

Well, I can't say there's a lot of info to put here, but I promise to put some more later.  I'm a student at the <!WA0><!WA0>The University of Texas at Austin, in the Ph.D. program for <!WA1><!WA1>Computer Science.

Oh what the heck, here's info on how to reach me:

Scott Kaplan
Taylor Hall 2.124
Austin, TX  78712
Home phone: (512) 419-9727
Work phone: (512) 471-9586
Cell phone: (512) 497-1450

If you'd like to find me in person, your best bet is to check in
Taylor Hall 5.144.  But I don't keep much in the way of regular hours,
so it would just be luck.  (Good or bad, I leave that to you...)

Okay, this is almost a useless page, but there will be more at some point.  If you feel like it, <!WA2><!WA2>email me.

<!WA3><!WA3>Go back to Scott's home page.


text:
#include <config.h>
#include <common.h>
#include <command.h>
#include <errno.h>
#include <hwconfig.h>
#include <mmc.h>
#include <part.h>
#include <malloc.h>
#include <fsl_esdhc.h>
#include <fdt_support.h>
#include <asm/io.h>
#include <dm.h>
#include <asm-generic/gpio.h>

DECLARE_GLOBAL_DATA_PTR;

#define SDHCI_IRQ_EN_BITS		(IRQSTATEN_CC | IRQSTATEN_TC | \
				IRQSTATEN_CINT | \
				IRQSTATEN_CTOE | IRQSTATEN_CCE | IRQSTATEN_CEBE | \
				IRQSTATEN_CIE | IRQSTATEN_DTOE | IRQSTATEN_DCE | \
				IRQSTATEN_DEBE | IRQSTATEN_BRR | IRQSTATEN_BWR | \
				IRQSTATEN_DINT)

struct fsl_esdhc {
	uint    dsaddr;		/* SDMA system address register */
	uint    blkattr;	/* Block attributes register */
	uint    cmdarg;		/* Command argument register */
	uint    xfertyp;	/* Transfer type register */
	uint    cmdrsp0;	/* Command response 0 register */
	uint    cmdrsp1;	/* Command response 1 register */
	uint    cmdrsp2;	/* Command response 2 register */
	uint    cmdrsp3;	/* Command response 3 register */
	uint    datport;	/* Buffer data port register */
	uint    prsstat;	/* Present state register */
	uint    proctl;		/* Protocol control register */
	uint    sysctl;		/* System Control Register */
	uint    irqstat;	/* Interrupt status register */
	uint    irqstaten;	/* Interrupt status enable register */
	uint    irqsigen;	/* Interrupt signal enable register */
	uint    autoc12err;	/* Auto CMD error status register */
	uint    hostcapblt;	/* Host controller capabilities register */
	uint    wml;		/* Watermark level register */
	uint    mixctrl;	/* For USDHC */
	char    reserved1[4];	/* reserved */
	uint    fevt;		/* Force event register */
	uint    admaes;		/* ADMA error status register */
	uint    adsaddr;	/* ADMA system address register */
	char    reserved2[4];
	uint    dllctrl;
	uint    dllstat;
	uint    clktunectrlstatus;
	char    reserved3[84];
	uint    vendorspec;
	uint    mmcboot;
	uint    vendorspec2;
	char	reserved4[48];
	uint    hostver;	/* Host controller version register */
	char    reserved5[4];	/* reserved */
	uint    dmaerraddr;	/* DMA error address register */
	char    reserved6[4];	/* reserved */
	uint    dmaerrattr;	/* DMA error attribute register */
	char    reserved7[4];	/* reserved */
	uint    hostcapblt2;	/* Host controller capabilities register 2 */
	char    reserved8[8];	/* reserved */
	uint    tcr;		/* Tuning control register */
	char    reserved9[28];	/* reserved */
	uint    sddirctl;	/* SD direction control register */
	char    reserved10[712];/* reserved */
	uint    scr;		/* eSDHC control register */
};

/**
 * struct fsl_esdhc_priv
 *
 * @esdhc_regs: registers of the sdhc controller
 * @sdhc_clk: Current clk of the sdhc controller
 * @bus_width: bus width, 1bit, 4bit or 8bit
 * @cfg: mmc config
 * @mmc: mmc
 * Following is used when Driver Model is enabled for MMC
 * @dev: pointer for the device
 * @non_removable: 0: removable; 1: non-removable
 * @wp_enable: 1: enable checking wp; 0: no check
 * @cd_gpio: gpio for card detection
 * @wp_gpio: gpio for write protection
 */
struct fsl_esdhc_priv {
	struct fsl_esdhc *esdhc_regs;
	unsigned int sdhc_clk;
	unsigned int bus_width;
	struct mmc_config cfg;
	struct mmc *mmc;
	struct udevice *dev;
	int non_removable;
	int wp_enable;
	struct gpio_desc cd_gpio;
	struct gpio_desc wp_gpio;
};

/* Return the XFERTYP flags for a given command and data packet */
static uint esdhc_xfertyp(struct mmc_cmd *cmd, struct mmc_data *data)
{
	uint xfertyp = 0;

	if (data) {
		xfertyp |= XFERTYP_DPSEL;
#ifndef CONFIG_SYS_FSL_ESDHC_USE_PIO
		xfertyp |= XFERTYP_DMAEN;
#endif
		if (data->blocks > 1) {
			xfertyp |= XFERTYP_MSBSEL;
			xfertyp |= XFERTYP_BCEN;
#ifdef CONFIG_SYS_FSL_ERRATUM_ESDHC111
			xfertyp |= XFERTYP_AC12EN;
#endif
		}

		if (data->flags & MMC_DATA_READ)
			xfertyp |= XFERTYP_DTDSEL;
	}

	if (cmd->resp_type & MMC_RSP_CRC)
		xfertyp |= XFERTYP_CCCEN;
	if (cmd->resp_type & MMC_RSP_OPCODE)
		xfertyp |= XFERTYP_CICEN;
	if (cmd->resp_type & MMC_RSP_136)
		xfertyp |= XFERTYP_RSPTYP_136;
	else if (cmd->resp_type & MMC_RSP_BUSY)
		xfertyp |= XFERTYP_RSPTYP_48_BUSY;
	else if (cmd->resp_type & MMC_RSP_PRESENT)
		xfertyp |= XFERTYP_RSPTYP_48;

	if (cmd->cmdidx == MMC_CMD_STOP_TRANSMISSION)
		xfertyp |= XFERTYP_CMDTYP_ABORT;

	return XFERTYP_CMD(cmd->cmdidx) | xfertyp;
}

#ifdef CONFIG_SYS_FSL_ESDHC_USE_PIO
/*
 * PIO Read/Write Mode reduce the performace as DMA is not used in this mode.
 */
static void
esdhc_pio_read_write(struct mmc *mmc, struct mmc_data *data)
{
	struct fsl_esdhc_priv *priv = mmc->priv;
	struct fsl_esdhc *regs = priv->esdhc_regs;
	uint blocks;
	char *buffer;
	uint databuf;
	uint size;
	uint irqstat;
	uint timeout;

	if (data->flags & MMC_DATA_READ) {
		blocks = data->blocks;
		buffer = data->dest;
		while (blocks) {
			timeout = PIO_TIMEOUT;
			size = data->blocksize;
			irqstat = esdhc_read32(&regs->irqstat);
			while (!(esdhc_read32(&regs->prsstat) & PRSSTAT_BREN)
				&& --timeout);
			if (timeout <= 0) {
				printf("\nData Read Failed in PIO Mode.");
				return;
			}
			while (size && (!(irqstat & IRQSTAT_TC))) {
				udelay(100); /* Wait before last byte transfer complete */
				irqstat = esdhc_read32(&regs->irqstat);
				databuf = in_le32(&regs->datport);
				*((uint *)buffer) = databuf;
				buffer += 4;
				size -= 4;
			}
			blocks--;
		}
	} else {
		blocks = data->blocks;
		buffer = (char *)data->src;
		while (blocks) {
			timeout = PIO_TIMEOUT;
			size = data->blocksize;
			irqstat = esdhc_read32(&regs->irqstat);
			while (!(esdhc_read32(&regs->prsstat) & PRSSTAT_BWEN)
				&& --timeout);
			if (timeout <= 0) {
				printf("\nData Write Failed in PIO Mode.");
				return;
			}
			while (size && (!(irqstat & IRQSTAT_TC))) {
				udelay(100); /* Wait before last byte transfer complete */
				databuf = *((uint *)buffer);
				buffer += 4;
				size -= 4;
				irqstat = esdhc_read32(&regs->irqstat);
				out_le32(&regs->datport, databuf);
			}
			blocks--;
		}
	}
}
#endif

static int esdhc_setup_data(struct mmc *mmc, struct mmc_data *data)
{
	int timeout;
	struct fsl_esdhc_priv *priv = mmc->priv;
	struct fsl_esdhc *regs = priv->esdhc_regs;
#if defined(CONFIG_FSL_LAYERSCAPE) || defined(CONFIG_S32V234)
	dma_addr_t addr;
#endif
	uint wml_value;

	wml_value = data->blocksize/4;

	if (data->flags & MMC_DATA_READ) {
		if (wml_value > WML_RD_WML_MAX)
			wml_value = WML_RD_WML_MAX_VAL;

		esdhc_clrsetbits32(&regs->wml, WML_RD_WML_MASK, wml_value);
#ifndef CONFIG_SYS_FSL_ESDHC_USE_PIO
#if defined(CONFIG_FSL_LAYERSCAPE) || defined(CONFIG_S32V234)
		addr = virt_to_phys((void *)(data->dest));
		if (upper_32_bits(addr))
			printf("Error found for upper 32 bits\n");
		else
			esdhc_write32(&regs->dsaddr, lower_32_bits(addr));
#else
		esdhc_write32(&regs->dsaddr, (u32)data->dest);
#endif
#endif
	} else {
#ifndef CONFIG_SYS_FSL_ESDHC_USE_PIO
		flush_dcache_range((ulong)data->src,
				   (ulong)data->src+data->blocks
					 *data->blocksize);
#endif
		if (wml_value > WML_WR_WML_MAX)
			wml_value = WML_WR_WML_MAX_VAL;
		if (priv->wp_enable) {
			if ((esdhc_read32(&regs->prsstat) &
			    PRSSTAT_WPSPL) == 0) {
				printf("\nThe SD card is locked. Can not write to a locked card.\n\n");
				return -ETIMEDOUT;
			}
		}

		esdhc_clrsetbits32(&regs->wml, WML_WR_WML_MASK,
					wml_value << 16);
#ifndef CONFIG_SYS_FSL_ESDHC_USE_PIO
#if defined(CONFIG_FSL_LAYERSCAPE) || defined(CONFIG_S32V234)
		addr = virt_to_phys((void *)(data->src));
		if (upper_32_bits(addr))
			printf("Error found for upper 32 bits\n");
		else
			esdhc_write32(&regs->dsaddr, lower_32_bits(addr));
#else
		esdhc_write32(&regs->dsaddr, (u32)data->src);
#endif
#endif
	}

	esdhc_write32(&regs->blkattr, data->blocks << 16 | data->blocksize);

	/* Calculate the timeout period for data transactions */
	/*
	 * 1)Timeout period = (2^(timeout+13)) SD Clock cycles
	 * 2)Timeout period should be minimum 0.250sec as per SD Card spec
	 *  So, Number of SD Clock cycles for 0.25sec should be minimum
	 *		(SD Clock/sec * 0.25 sec) SD Clock cycles
	 *		= (mmc->clock * 1/4) SD Clock cycles
	 * As 1) >=  2)
	 * => (2^(timeout+13)) >= mmc->clock * 1/4
	 * Taking log2 both the sides
	 * => timeout + 13 >= log2(mmc->clock/4)
	 * Rounding up to next power of 2
	 * => timeout + 13 = log2(mmc->clock/4) + 1
	 * => timeout + 13 = fls(mmc->clock/4)
	 *
	 * However, the MMC spec "It is strongly recommended for hosts to
	 * implement more than 500ms timeout value even if the card
	 * indicates the 250ms maximum busy length."  Even the previous
	 * value of 300ms is known to be insufficient for some cards.
	 * So, we use
	 * => timeout + 13 = fls(mmc->clock/2)
	 */
	timeout = fls(mmc->clock/2);
	timeout -= 13;

	if (timeout > 14)
		timeout = 14;

	if (timeout < 0)
		timeout = 0;

#ifdef CONFIG_SYS_FSL_ERRATUM_ESDHC_A001
	if ((timeout == 4) || (timeout == 8) || (timeout == 12))
		timeout++;
#endif

#ifdef ESDHCI_QUIRK_BROKEN_TIMEOUT_VALUE
	timeout = 0xE;
#endif
	esdhc_clrsetbits32(&regs->sysctl, SYSCTL_TIMEOUT_MASK, timeout << 16);

	return 0;
}

static void check_and_invalidate_dcache_range
	(struct mmc_cmd *cmd,
	 struct mmc_data *data) {
	unsigned start = 0;
	unsigned end = 0;
	unsigned size = roundup(ARCH_DMA_MINALIGN,
				data->blocks*data->blocksize);
#if defined(CONFIG_FSL_LAYERSCAPE) || defined(CONFIG_S32V234)
	dma_addr_t addr;

	addr = virt_to_phys((void *)(data->dest));
	if (upper_32_bits(addr))
		printf("Error found for upper 32 bits\n");
	else
		start = lower_32_bits(addr);
#else
	start = (unsigned)data->dest;
#endif
	end = start + size;
	invalidate_dcache_range(start, end);
}

/*
 * Sends a command out on the bus.  Takes the mmc pointer,
 * a command pointer, and an optional data pointer.
 */
static int
esdhc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, struct mmc_data *data)
{
	int	err = 0;
	uint	xfertyp;
	uint	irqstat;
	struct fsl_esdhc_priv *priv = mmc->priv;
	struct fsl_esdhc *regs = priv->esdhc_regs;

#ifdef CONFIG_SYS_FSL_ERRATUM_ESDHC111
	if (cmd->cmdidx == MMC_CMD_STOP_TRANSMISSION)
		return 0;
#endif

	esdhc_write32(&regs->irqstat, -1);

	sync();

	/* Wait for the bus to be idle */
	while ((esdhc_read32(&regs->prsstat) & PRSSTAT_CICHB) ||
			(esdhc_read32(&regs->prsstat) & PRSSTAT_CIDHB))
		;

	while (esdhc_read32(&regs->prsstat) & PRSSTAT_DLA)
		;

	/* Wait at least 8 SD clock cycles before the next command */
	/*
	 * Note: This is way more than 8 cycles, but 1ms seems to
	 * resolve timing issues with some cards
	 */
	udelay(1000);

	/* Set up for a data transfer if we have one */
	if (data) {
		err = esdhc_setup_data(mmc, data);
		if(err)
			return err;

		if (data->flags & MMC_DATA_READ)
			check_and_invalidate_dcache_range(cmd, data);
	}

	/* Figure out the transfer arguments */
	xfertyp = esdhc_xfertyp(cmd, data);

	/* Mask all irqs */
	esdhc_write32(&regs->irqsigen, 0);

	/* Send the command */
	esdhc_write32(&regs->cmdarg, cmd->cmdarg);
#if defined(CONFIG_FSL_USDHC)
	esdhc_write32(&regs->mixctrl,
	(esdhc_read32(&regs->mixctrl) & 0xFFFFFF80) | (xfertyp & 0x7F)
			| (mmc->ddr_mode ? XFERTYP_DDREN : 0));
	esdhc_write32(&regs->xfertyp, xfertyp & 0xFFFF0000);
#else
	esdhc_write32(&regs->xfertyp, xfertyp);
#endif

	/* Wait for the command to complete */
	while (!(esdhc_read32(&regs->irqstat) & (IRQSTAT_CC | IRQSTAT_CTOE)))
		;

	irqstat = esdhc_read32(&regs->irqstat);

	if (irqstat & CMD_ERR) {
		err = -ECOMM;
		goto out;
	}

	if (irqstat & IRQSTAT_CTOE) {
		err = -ETIMEDOUT;
		goto out;
	}

	/* Switch voltage to 1.8V if CMD11 succeeded */
	if (cmd->cmdidx == SD_CMD_SWITCH_UHS18V) {
		esdhc_setbits32(&regs->vendorspec, ESDHC_VENDORSPEC_VSELECT);

		printf("Run CMD11 1.8V switch\n");
		/* Sleep for 5 ms - max time for card to switch to 1.8V */
		udelay(5000);
	}

	/* Workaround for ESDHC errata ENGcm03648 */
	if (!data && (cmd->resp_type & MMC_RSP_BUSY)) {
		int timeout = 6000;

		/* Poll on DATA0 line for cmd with busy signal for 600 ms */
		while (timeout > 0 && !(esdhc_read32(&regs->prsstat) &
					PRSSTAT_DAT0)) {
			udelay(100);
			timeout--;
		}

		if (timeout <= 0) {
			printf("Timeout waiting for DAT0 to go high!\n");
			err = -ETIMEDOUT;
			goto out;
		}
	}

	/* Copy the response to the response buffer */
	if (cmd->resp_type & MMC_RSP_136) {
		u32 cmdrsp3, cmdrsp2, cmdrsp1, cmdrsp0;

		cmdrsp3 = esdhc_read32(&regs->cmdrsp3);
		cmdrsp2 = esdhc_read32(&regs->cmdrsp2);
		cmdrsp1 = esdhc_read32(&regs->cmdrsp1);
		cmdrsp0 = esdhc_read32(&regs->cmdrsp0);
		cmd->response[0] = (cmdrsp3 << 8) | (cmdrsp2 >> 24);
		cmd->response[1] = (cmdrsp2 << 8) | (cmdrsp1 >> 24);
		cmd->response[2] = (cmdrsp1 << 8) | (cmdrsp0 >> 24);
		cmd->response[3] = (cmdrsp0 << 8);
	} else
		cmd->response[0] = esdhc_read32(&regs->cmdrsp0);

	/* Wait until all of the blocks are transferred */
	if (data) {
#ifdef CONFIG_SYS_FSL_ESDHC_USE_PIO
		esdhc_pio_read_write(mmc, data);
#else
		do {
			irqstat = esdhc_read32(&regs->irqstat);

			if (irqstat & IRQSTAT_DTOE) {
				err = -ETIMEDOUT;
				goto out;
			}

			if (irqstat & DATA_ERR) {
				err = -ECOMM;
				goto out;
			}
		} while ((irqstat & DATA_COMPLETE) != DATA_COMPLETE);

		/*
		 * Need invalidate the dcache here again to avoid any
		 * cache-fill during the DMA operations such as the
		 * speculative pre-fetching etc.
		 */
		if (data->flags & MMC_DATA_READ)
			check_and_invalidate_dcache_range(cmd, data);
#endif
	}

out:
	/* Reset CMD and DATA portions on error */
	if (err) {
		esdhc_write32(&regs->sysctl, esdhc_read32(&regs->sysctl) |
			      SYSCTL_RSTC);
		while (esdhc_read32(&regs->sysctl) & SYSCTL_RSTC)
			;

		if (data) {
			esdhc_write32(&regs->sysctl,
				      esdhc_read32(&regs->sysctl) |
				      SYSCTL_RSTD);
			while ((esdhc_read32(&regs->sysctl) & SYSCTL_RSTD))
				;
		}

		/* If this was CMD11, then notify that power cycle is needed */
		if (cmd->cmdidx == SD_CMD_SWITCH_UHS18V)
			printf("CMD11 to switch to 1.8V mode failed, card requires power cycle.\n");
	}

	esdhc_write32(&regs->irqstat, -1);

	return err;
}

static void set_sysctl(struct mmc *mmc, uint clock)
{
	int div, pre_div;
	struct fsl_esdhc_priv *priv = mmc->priv;
	struct fsl_esdhc *regs = priv->esdhc_regs;
	int sdhc_clk = priv->sdhc_clk;
	uint clk;

	if (clock < mmc->cfg->f_min)
		clock = mmc->cfg->f_min;

	if (sdhc_clk / 16 > clock) {
		for (pre_div = 2; pre_div < 256; pre_div *= 2)
			if ((sdhc_clk / pre_div) <= (clock * 16))
				break;
	} else
		pre_div = 2;

	for (div = 1; div <= 16; div++)
		if ((sdhc_clk / (div * pre_div)) <= clock)
			break;

	pre_div >>= mmc->ddr_mode ? 2 : 1;
	div -= 1;

	clk = (pre_div << 8) | (div << 4);

#ifdef CONFIG_FSL_USDHC
	esdhc_clrbits32(&regs->vendorspec, VENDORSPEC_CKEN);
#else
	esdhc_clrbits32(&regs->sysctl, SYSCTL_CKEN);
#endif

	esdhc_clrsetbits32(&regs->sysctl, SYSCTL_CLOCK_MASK, clk);

	udelay(10000);

#ifdef CONFIG_FSL_USDHC
	esdhc_setbits32(&regs->vendorspec, VENDORSPEC_PEREN | VENDORSPEC_CKEN);
#else
	esdhc_setbits32(&regs->sysctl, SYSCTL_PEREN | SYSCTL_CKEN);
#endif

}

#ifdef CONFIG_FSL_ESDHC_USE_PERIPHERAL_CLK
static void esdhc_clock_control(struct mmc *mmc, bool enable)
{
	struct fsl_esdhc_priv *priv = mmc->priv;
	struct fsl_esdhc *regs = priv->esdhc_regs;
	u32 value;
	u32 time_out;

	value = esdhc_read32(&regs->sysctl);

	if (enable)
		value |= SYSCTL_CKEN;
	else
		value &= ~SYSCTL_CKEN;

	esdhc_write32(&regs->sysctl, value);

	time_out = 20;
	value = PRSSTAT_SDSTB;
	while (!(esdhc_read32(&regs->prsstat) & value)) {
		if (time_out == 0) {
			printf("fsl_esdhc: Internal clock never stabilised.\n");
			break;
		}
		time_out--;
		mdelay(1);
	}
}
#endif

static void esdhc_set_ios(struct mmc *mmc)
{
	struct fsl_esdhc_priv *priv = mmc->priv;
	struct fsl_esdhc *regs = priv->esdhc_regs;

#ifdef CONFIG_FSL_ESDHC_USE_PERIPHERAL_CLK
	/* Select to use peripheral clock */
	esdhc_clock_control(mmc, false);
	esdhc_setbits32(&regs->scr, ESDHCCTL_PCS);
	esdhc_clock_control(mmc, true);
#endif
	/* Set the clock speed */
	set_sysctl(mmc, mmc->clock);

	/* Set the bus width */
	esdhc_clrbits32(&regs->proctl, PROCTL_DTW_4 | PROCTL_DTW_8);

	if (mmc->bus_width == 4)
		esdhc_setbits32(&regs->proctl, PROCTL_DTW_4);
	else if (mmc->bus_width == 8)
		esdhc_setbits32(&regs->proctl, PROCTL_DTW_8);

}

static int esdhc_init(struct mmc *mmc)
{
	struct fsl_esdhc_priv *priv = mmc->priv;
	struct fsl_esdhc *regs = priv->esdhc_regs;
	int timeout = 1000;

	/* Reset the entire host controller */
	esdhc_setbits32(&regs->sysctl, SYSCTL_RSTA);

	/* Wait until the controller is available */
	while ((esdhc_read32(&regs->sysctl) & SYSCTL_RSTA) && --timeout)
		udelay(1000);

#if defined(CONFIG_FSL_USDHC)
	/* RSTA doesn't reset MMC_BOOT register, so manually reset it */
	esdhc_write32(&regs->mmcboot, 0x0);
	/* Reset MIX_CTRL and CLK_TUNE_CTRL_STATUS regs to 0 */
	esdhc_write32(&regs->mixctrl, 0x0);
	esdhc_write32(&regs->clktunectrlstatus, 0x0);

	/* Put VEND_SPEC to default value */
	esdhc_write32(&regs->vendorspec, VENDORSPEC_INIT);

	/* Disable DLL_CTRL delay line */
	esdhc_write32(&regs->dllctrl, 0x0);
#endif

#ifndef ARCH_MXC
	/* Enable cache snooping */
	esdhc_write32(&regs->scr, 0x00000040);
#endif

#ifndef CONFIG_FSL_USDHC
	esdhc_setbits32(&regs->sysctl, SYSCTL_HCKEN | SYSCTL_IPGEN);
#else
	esdhc_setbits32(&regs->vendorspec, VENDORSPEC_HCKEN | VENDORSPEC_IPGEN);
#endif

	/* Set the initial clock speed */
	mmc_set_clock(mmc, 400000);

	/* Disable the BRR and BWR bits in IRQSTAT */
	esdhc_clrbits32(&regs->irqstaten, IRQSTATEN_BRR | IRQSTATEN_BWR);

	/* Put the PROCTL reg back to the default */
	esdhc_write32(&regs->proctl, PROCTL_INIT);

	/* Set timout to the maximum value */
	esdhc_clrsetbits32(&regs->sysctl, SYSCTL_TIMEOUT_MASK, 14 << 16);

#ifdef CONFIG_SYS_FSL_ESDHC_FORCE_VSELECT
	esdhc_setbits32(&regs->vendorspec, ESDHC_VENDORSPEC_VSELECT);
#endif

	return 0;
}

static int esdhc_getcd(struct mmc *mmc)
{
	struct fsl_esdhc_priv *priv = mmc->priv;
	struct fsl_esdhc *regs = priv->esdhc_regs;
	int timeout = 1000;

#ifdef CONFIG_ESDHC_DETECT_QUIRK
	if (CONFIG_ESDHC_DETECT_QUIRK)
		return 1;
#endif

#ifdef CONFIG_DM_MMC
	if (priv->non_removable)
		return 1;

	if (dm_gpio_is_valid(&priv->cd_gpio))
		return dm_gpio_get_value(&priv->cd_gpio);
#endif

	while (!(esdhc_read32(&regs->prsstat) & PRSSTAT_CINS) && --timeout)
		udelay(1000);

	return timeout > 0;
}

static void esdhc_reset(struct fsl_esdhc *regs)
{
	unsigned long timeout = 100; /* wait max 100 ms */

	/* reset the controller */
	esdhc_setbits32(&regs->sysctl, SYSCTL_RSTA);

	/* hardware clears the bit when it is done */
	while ((esdhc_read32(&regs->sysctl) & SYSCTL_RSTA) && --timeout)
		udelay(1000);
	if (!timeout)
		printf("MMC/SD: Reset never completed.\n");
}

static const struct mmc_ops esdhc_ops = {
	.send_cmd	= esdhc_send_cmd,
	.set_ios	= esdhc_set_ios,
	.init		= esdhc_init,
	.getcd		= esdhc_getcd,
};

static int fsl_esdhc_cfg_to_priv(struct fsl_esdhc_cfg *cfg,
				 struct fsl_esdhc_priv *priv)
{
	if (!cfg || !priv)
		return -EINVAL;

	priv->esdhc_regs = (struct fsl_esdhc *)(unsigned long)(cfg->esdhc_base);
	priv->bus_width = cfg->max_bus_width;
	priv->sdhc_clk = cfg->sdhc_clk;
	priv->wp_enable  = cfg->wp_enable;

	return 0;
};

static int fsl_esdhc_init(struct fsl_esdhc_priv *priv)
{
	struct fsl_esdhc *regs;
	struct mmc *mmc;
	u32 caps, voltage_caps;

	if (!priv)
		return -EINVAL;

	regs = priv->esdhc_regs;

	/* First reset the eSDHC controller */
	esdhc_reset(regs);

#ifndef CONFIG_FSL_USDHC
	esdhc_setbits32(&regs->sysctl, SYSCTL_PEREN | SYSCTL_HCKEN
				| SYSCTL_IPGEN | SYSCTL_CKEN);
#else
	esdhc_setbits32(&regs->vendorspec, VENDORSPEC_PEREN |
			VENDORSPEC_HCKEN | VENDORSPEC_IPGEN | VENDORSPEC_CKEN);
#endif

	writel(SDHCI_IRQ_EN_BITS, &regs->irqstaten);
	memset(&priv->cfg, 0, sizeof(priv->cfg));

	voltage_caps = 0;
	caps = esdhc_read32(&regs->hostcapblt);

#ifdef CONFIG_SYS_FSL_ERRATUM_ESDHC135
	caps = caps & ~(ESDHC_HOSTCAPBLT_SRS |
			ESDHC_HOSTCAPBLT_VS18 | ESDHC_HOSTCAPBLT_VS30);
#endif

/* T4240 host controller capabilities register should have VS33 bit */
#ifdef CONFIG_SYS_FSL_MMC_HAS_CAPBLT_VS33
	caps = caps | ESDHC_HOSTCAPBLT_VS33;
#endif

	if (caps & ESDHC_HOSTCAPBLT_VS18)
		voltage_caps |= MMC_VDD_165_195;
	if (caps & ESDHC_HOSTCAPBLT_VS30)
		voltage_caps |= MMC_VDD_29_30 | MMC_VDD_30_31;
	if (caps & ESDHC_HOSTCAPBLT_VS33)
		voltage_caps |= MMC_VDD_32_33 | MMC_VDD_33_34;

	priv->cfg.name = "FSL_SDHC";
	priv->cfg.ops = &esdhc_ops;
#ifdef CONFIG_SYS_SD_VOLTAGE
	priv->cfg.voltages = CONFIG_SYS_SD_VOLTAGE;
#else
	priv->cfg.voltages = MMC_VDD_32_33 | MMC_VDD_33_34;
#endif
	if ((priv->cfg.voltages & voltage_caps) == 0) {
		printf("voltage not supported by controller\n");
		return -1;
	}

	if (priv->bus_width == 8)
		priv->cfg.host_caps = MMC_MODE_4BIT | MMC_MODE_8BIT;
	else if (priv->bus_width == 4)
		priv->cfg.host_caps = MMC_MODE_4BIT;

	priv->cfg.host_caps = MMC_MODE_4BIT | MMC_MODE_8BIT;
#ifdef CONFIG_SYS_FSL_ESDHC_HAS_DDR_MODE
	priv->cfg.host_caps |= MMC_MODE_DDR_52MHz;
#endif

	if (priv->bus_width > 0) {
		if (priv->bus_width < 8)
			priv->cfg.host_caps &= ~MMC_MODE_8BIT;
		if (priv->bus_width < 4)
			priv->cfg.host_caps &= ~MMC_MODE_4BIT;
	}

	if (caps & ESDHC_HOSTCAPBLT_HSS)
		priv->cfg.host_caps |= MMC_MODE_HS_52MHz | MMC_MODE_HS;

#ifdef CONFIG_ESDHC_DETECT_8_BIT_QUIRK
	if (CONFIG_ESDHC_DETECT_8_BIT_QUIRK)
		priv->cfg.host_caps &= ~MMC_MODE_8BIT;
#endif

	priv->cfg.f_min = 400000;
	priv->cfg.f_max = min(priv->sdhc_clk, (u32)52000000);

	priv->cfg.b_max = CONFIG_SYS_MMC_MAX_BLK_COUNT;

	mmc = mmc_create(&priv->cfg, priv);
	if (mmc == NULL)
		return -1;

	priv->mmc = mmc;

	return 0;
}

int fsl_esdhc_initialize(bd_t *bis, struct fsl_esdhc_cfg *cfg)
{
	struct fsl_esdhc_priv *priv;
	int ret;

	if (!cfg)
		return -EINVAL;

	priv = calloc(sizeof(struct fsl_esdhc_priv), 1);
	if (!priv)
		return -ENOMEM;

	ret = fsl_esdhc_cfg_to_priv(cfg, priv);
	if (ret) {
		debug("%s xlate failure\n", __func__);
		free(priv);
		return ret;
	}

	ret = fsl_esdhc_init(priv);
	if (ret) {
		debug("%s init failure\n", __func__);
		free(priv);
		return ret;
	}

	return 0;
}

int fsl_esdhc_mmc_init(bd_t *bis)
{
	struct fsl_esdhc_cfg *cfg;

	cfg = calloc(sizeof(struct fsl_esdhc_cfg), 1);
	cfg->esdhc_base = CONFIG_SYS_FSL_ESDHC_ADDR;
	cfg->sdhc_clk = gd->arch.sdhc_clk;
	return fsl_esdhc_initialize(bis, cfg);
}

#ifdef CONFIG_FSL_ESDHC_ADAPTER_IDENT
void mmc_adapter_card_type_ident(void)
{
	u8 card_id;
	u8 value;

	card_id = QIXIS_READ(present) & QIXIS_SDID_MASK;
	gd->arch.sdhc_adapter = card_id;

	switch (card_id) {
	case QIXIS_ESDHC_ADAPTER_TYPE_EMMC45:
		value = QIXIS_READ(brdcfg[5]);
		value |= (QIXIS_DAT4 | QIXIS_DAT5_6_7);
		QIXIS_WRITE(brdcfg[5], value);
		break;
	case QIXIS_ESDHC_ADAPTER_TYPE_SDMMC_LEGACY:
		value = QIXIS_READ(pwr_ctl[1]);
		value |= QIXIS_EVDD_BY_SDHC_VS;
		QIXIS_WRITE(pwr_ctl[1], value);
		break;
	case QIXIS_ESDHC_ADAPTER_TYPE_EMMC44:
		value = QIXIS_READ(brdcfg[5]);
		value |= (QIXIS_SDCLKIN | QIXIS_SDCLKOUT);
		QIXIS_WRITE(brdcfg[5], value);
		break;
	case QIXIS_ESDHC_ADAPTER_TYPE_RSV:
		break;
	case QIXIS_ESDHC_ADAPTER_TYPE_MMC:
		break;
	case QIXIS_ESDHC_ADAPTER_TYPE_SD:
		break;
	case QIXIS_ESDHC_NO_ADAPTER:
		break;
	default:
		break;
	}
}
#endif

#ifdef CONFIG_OF_LIBFDT
void fdt_fixup_esdhc(void *blob, bd_t *bd)
{
	const char *compat = "fsl,esdhc";

#ifdef CONFIG_FSL_ESDHC_PIN_MUX
	if (!hwconfig("esdhc")) {
		do_fixup_by_compat(blob, compat, "status", "disabled",
				8 + 1, 1);
		return;
	}
#endif

#ifdef CONFIG_FSL_ESDHC_USE_PERIPHERAL_CLK
	do_fixup_by_compat_u32(blob, compat, "peripheral-frequency",
			       gd->arch.sdhc_clk, 1);
#else
	do_fixup_by_compat_u32(blob, compat, "clock-frequency",
			       gd->arch.sdhc_clk, 1);
#endif
#ifdef CONFIG_FSL_ESDHC_ADAPTER_IDENT
	do_fixup_by_compat_u32(blob, compat, "adapter-type",
			       (u32)(gd->arch.sdhc_adapter), 1);
#endif
	do_fixup_by_compat(blob, compat, "status", "okay",
			   4 + 1, 1);
}
#endif

#ifdef CONFIG_DM_MMC
#include <asm/arch/clock.h>
static int fsl_esdhc_probe(struct udevice *dev)
{
	struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev);
	struct fsl_esdhc_priv *priv = dev_get_priv(dev);
	const void *fdt = gd->fdt_blob;
	int node = dev->of_offset;
	fdt_addr_t addr;
	unsigned int val;
	int ret;

	addr = dev_get_addr(dev);
	if (addr == FDT_ADDR_T_NONE)
		return -EINVAL;

	priv->esdhc_regs = (struct fsl_esdhc *)addr;
	priv->dev = dev;

	val = fdtdec_get_int(fdt, node, "bus-width", -1);
	if (val == 8)
		priv->bus_width = 8;
	else if (val == 4)
		priv->bus_width = 4;
	else
		priv->bus_width = 1;

	if (fdt_get_property(fdt, node, "non-removable", NULL)) {
		priv->non_removable = 1;
	 } else {
		priv->non_removable = 0;
		gpio_request_by_name_nodev(fdt, node, "cd-gpios", 0,
					   &priv->cd_gpio, GPIOD_IS_IN);
	}

	priv->wp_enable = 1;

	ret = gpio_request_by_name_nodev(fdt, node, "wp-gpios", 0,
					 &priv->wp_gpio, GPIOD_IS_IN);
	if (ret)
		priv->wp_enable = 0;

	/*
	 * TODO:
	 * Because lack of clk driver, if SDHC clk is not enabled,
	 * need to enable it first before this driver is invoked.
	 *
	 * we use MXC_ESDHC_CLK to get clk freq.
	 * If one would like to make this function work,
	 * the aliases should be provided in dts as this:
	 *
	 *  aliases {
	 *	mmc0 = &usdhc1;
	 *	mmc1 = &usdhc2;
	 *	mmc2 = &usdhc3;
	 *	mmc3 = &usdhc4;
	 *	};
	 * Then if your board only supports mmc2 and mmc3, but we can
	 * correctly get the seq as 2 and 3, then let mxc_get_clock
	 * work as expected.
	 */
	priv->sdhc_clk = mxc_get_clock(MXC_ESDHC_CLK + dev->seq);
	if (priv->sdhc_clk <= 0) {
		dev_err(dev, "Unable to get clk for %s\n", dev->name);
		return -EINVAL;
	}

	ret = fsl_esdhc_init(priv);
	if (ret) {
		dev_err(dev, "fsl_esdhc_init failure\n");
		return ret;
	}

	upriv->mmc = priv->mmc;

	return 0;
}

static const struct udevice_id fsl_esdhc_ids[] = {
	{ .compatible = "fsl,imx6ul-usdhc", },
	{ .compatible = "fsl,imx6sx-usdhc", },
	{ .compatible = "fsl,imx6sl-usdhc", },
	{ .compatible = "fsl,imx6q-usdhc", },
	{ .compatible = "fsl,imx7d-usdhc", },
	{ /* sentinel */ }
};

U_BOOT_DRIVER(fsl_esdhc) = {
	.name	= "fsl-esdhc-mmc",
	.id	= UCLASS_MMC,
	.of_match = fsl_esdhc_ids,
	.probe	= fsl_esdhc_probe,
	.priv_auto_alloc_size = sizeof(struct fsl_esdhc_priv),
};
#endif


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<title>SortStateViewProviders</title>
<meta name="date" content="2015-07-25">
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Overview

Package

Class

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

de.codecrafters.tableview.toolkit

Class SortStateViewProviders

java.lang.Object

de.codecrafters.tableview.toolkit.SortStateViewProviders

public class SortStateViewProviders
extends java.lang.Object

A factory providing different implementations of the SortStateViewProvider.

Author:

ISchwarz

Constructor Summary

Constructors

Constructor and Description

SortStateViewProviders()

Method Summary

Methods

Modifier and Type
Method and Description

static SortStateViewProvider
brightArrows()

Gives a SortStateViewProvider that will provide bright (transparent white) arrows.

static SortStateViewProvider
darkArrows()

Gives a SortStateViewProvider that will provide dark (transparent black) arrows.

Methods inherited from class java.lang.Object

equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail

SortStateViewProviders

public SortStateViewProviders()

Method Detail

darkArrows

public static SortStateViewProvider darkArrows()

Gives a SortStateViewProvider that will provide dark (transparent black) arrows.

Returns:

The described SortStateViewProvider.

brightArrows

public static SortStateViewProvider brightArrows()

Gives a SortStateViewProvider that will provide bright (transparent white) arrows.

Returns:

The described SortStateViewProvider.

Overview

Package

Class

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method


text:
package alluxio.worker.block;

import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.when;
import static org.mockito.Mockito.mock;

import alluxio.StorageTierAssoc;
import alluxio.WorkerStorageTierAssoc;
import alluxio.metrics.MetricInfo;
import alluxio.metrics.MetricKey;
import alluxio.metrics.MetricsSystem;
import alluxio.worker.block.DefaultBlockWorker.Metrics;

import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Lists;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;

/**
 * Unit tests for {@link DefaultBlockWorker.Metrics}.
 */
public final class BlockWorkerMetricsTest {
  private static final String MEM = "MEM";
  private static final String HDD = "HDD";

  private BlockWorker mBlockWorker;
  private BlockStoreMeta mBlockStoreMeta;

  @Before
  public void before() throws Exception {
    MetricsSystem.clearAllMetrics();
    mBlockWorker = mock(BlockWorker.class);
    mBlockStoreMeta = mock(BlockStoreMeta.class);
    when(mBlockWorker.getStoreMeta()).thenReturn(mBlockStoreMeta);
    StorageTierAssoc assoc = new WorkerStorageTierAssoc(Lists.newArrayList(MEM, HDD));
    when(mBlockStoreMeta.getStorageTierAssoc()).thenReturn(assoc);
    Metrics.registerGauges(mBlockWorker);
  }

  @Test
  public void testMetricsCapacity() {
    when(mBlockStoreMeta.getCapacityBytes()).thenReturn(1000L);
    Assert.assertEquals(1000L, getGauge(MetricKey.WORKER_CAPACITY_TOTAL.getName()));
    when(mBlockStoreMeta.getUsedBytes()).thenReturn(200L);
    Assert.assertEquals(200L, getGauge(MetricKey.WORKER_CAPACITY_USED.getName()));
    Assert.assertEquals(800L, getGauge(MetricKey.WORKER_CAPACITY_FREE.getName()));
  }

  @Test
  public void testMetricsTierCapacity() {
    when(mBlockStoreMeta.getCapacityBytesOnTiers())
        .thenReturn(ImmutableMap.of(MEM, 1000L, HDD, 2000L));
    when(mBlockStoreMeta.getUsedBytesOnTiers()).thenReturn(ImmutableMap.of(MEM, 100L, HDD, 200L));
    assertEquals(1000L,
        getGauge(MetricKey.WORKER_CAPACITY_TOTAL.getName() + MetricInfo.TIER + MEM));
    assertEquals(2000L,
        getGauge(MetricKey.WORKER_CAPACITY_TOTAL.getName() + MetricInfo.TIER + HDD));
    assertEquals(100L, getGauge(MetricKey.WORKER_CAPACITY_USED.getName() + MetricInfo.TIER + MEM));
    assertEquals(200L, getGauge(MetricKey.WORKER_CAPACITY_USED.getName() + MetricInfo.TIER + HDD));
    assertEquals(900L, getGauge(MetricKey.WORKER_CAPACITY_FREE.getName() + MetricInfo.TIER + MEM));
    assertEquals(1800L, getGauge(MetricKey.WORKER_CAPACITY_FREE.getName() + MetricInfo.TIER + HDD));
  }

  public void testMetricBocksCached() {
    when(mBlockStoreMeta.getNumberOfBlocks()).thenReturn(200);
    Assert.assertEquals(200, getGauge(MetricKey.WORKER_BLOCKS_CACHED.getName()));
  }

  private Object getGauge(String name) {
    return MetricsSystem.METRIC_REGISTRY.getGauges()
        .get(MetricsSystem.getMetricName(name)).getValue();
  }
}