code stringlengths 4 1.01M |
|---|
/*
* Copyright 2002-2013 the original author or authors.
*
* 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.
*/
package org.springframework.security.samples.config;
import org.springframework.security.web.context.AbstractSecurityWebApplicationInitializer;
/**
* No customizations of {@link AbstractSecurityWebApplicationInitializer} are necessary.
*
* @author Rob Winch
*/
public class MessageSecurityWebApplicationInitializer extends
AbstractSecurityWebApplicationInitializer {
}
|
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2009 Dan Broyles
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Dan Broyles <dbroyl01@ku.edu>
*/
#include "box.h"
#include "ns3/vector.h"
#include "ns3/assert.h"
#include "ns3/fatal-error.h"
#include <cmath>
#include <algorithm>
#include <sstream>
namespace ns3 {
Box::Box (double _xMin, double _xMax,
double _yMin, double _yMax,
double _zMin, double _zMax)
: xMin (_xMin),
xMax (_xMax),
yMin (_yMin),
yMax (_yMax),
zMin (_zMin),
zMax (_zMax)
{
}
Box::Box ()
: xMin (0.0),
xMax (0.0),
yMin (0.0),
yMax (0.0),
zMin (0.0),
zMax (0.0)
{
}
bool
Box::IsInside (const Vector &position) const
{
return
position.x <= this->xMax && position.x >= this->xMin &&
position.y <= this->yMax && position.y >= this->yMin &&
position.z <= this->zMax && position.z >= this->zMin;
}
Box::Side
Box::GetClosestSide (const Vector &position) const
{
double xMinDist = std::abs (position.x - this->xMin);
double xMaxDist = std::abs (this->xMax - position.x);
double yMinDist = std::abs (position.y - this->yMin);
double yMaxDist = std::abs (this->yMax - position.y);
double zMinDist = std::abs (position.z - this->zMin);
double zMaxDist = std::abs (this->zMax - position.z);
double minX = std::min (xMinDist, xMaxDist);
double minY = std::min (yMinDist, yMaxDist);
double minZ = std::min (zMinDist, zMaxDist);
if (minX < minY && minX < minZ)
{
if (xMinDist < xMaxDist)
{
return LEFT;
}
else
{
return RIGHT;
}
}
else if (minY < minZ)
{
if (yMinDist < yMaxDist)
{
return BOTTOM;
}
else
{
return TOP;
}
}
else
{
if (zMinDist < zMaxDist)
{
return DOWN;
}
else
{
return UP;
}
}
}
Vector
Box::CalculateIntersection (const Vector ¤t, const Vector &speed) const
{
NS_ASSERT (IsInside (current));
double xMaxY = current.y + (this->xMax - current.x) / speed.x * speed.y;
double xMinY = current.y + (this->xMin - current.x) / speed.x * speed.y;
double yMaxX = current.x + (this->yMax - current.y) / speed.y * speed.x;
double yMinX = current.x + (this->yMin - current.y) / speed.y * speed.x;
bool xMaxYOk = (xMaxY <= this->yMax && xMaxY >= this->yMin);
bool xMinYOk = (xMinY <= this->yMax && xMinY >= this->yMin);
bool yMaxXOk = (yMaxX <= this->xMax && yMaxX >= this->xMin);
bool yMinXOk = (yMinX <= this->xMax && yMinX >= this->xMin);
if (xMaxYOk && speed.x >= 0)
{
return Vector (this->xMax, xMaxY, 0.0);
}
else if (xMinYOk && speed.x <= 0)
{
return Vector (this->xMin, xMinY, 0.0);
}
else if (yMaxXOk && speed.y >= 0)
{
return Vector (yMaxX, this->yMax, 0.0);
}
else if (yMinXOk && speed.y <= 0)
{
return Vector (yMinX, this->yMin, 0.0);
}
else
{
NS_ASSERT (false);
// quiet compiler
return Vector (0.0, 0.0, 0.0);
}
}
ATTRIBUTE_HELPER_CPP (Box);
std::ostream &
operator << (std::ostream &os, const Box &box)
{
os << box.xMin << "|" << box.xMax << "|" << box.yMin << "|" << box.yMax << "|" << box.zMin << "|" << box.zMax;
return os;
}
std::istream &
operator >> (std::istream &is, Box &box)
{
char c1, c2, c3, c4, c5;
is >> box.xMin >> c1 >> box.xMax >> c2 >> box.yMin >> c3 >> box.yMax >> c4 >> box.zMin >> c5 >> box.zMax;
if (c1 != '|' ||
c2 != '|' ||
c3 != '|' ||
c4 != '|' ||
c5 != '|')
{
is.setstate (std::ios_base::failbit);
}
return is;
}
} // namespace ns3
|
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
<title>Canvas test: 2d.fillStyle.parse.css-color-4-rgb-5</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/canvas-tests.js"></script>
<link rel="stylesheet" href="/common/canvas-tests.css">
<body class="show_output">
<h1>2d.fillStyle.parse.css-color-4-rgb-5</h1>
<p class="desc"></p>
<p class="notes">
<p class="output">Actual output:</p>
<canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
<p class="output expectedtext">Expected output:<p><img src="2d.fillStyle.parse.css-color-4-rgb-5.png" class="output expected" id="expected" alt="">
<ul id="d"></ul>
<script>
var t = async_test("");
_addTest(function(canvas, ctx) {
ctx.fillStyle = '#f00';
ctx.fillStyle = 'rgb(0 255 0 / 0.2)';
ctx.fillRect(0, 0, 100, 50);
_assertPixel(canvas, 50,25, 0,255,0,51, "50,25", "0,255,0,51");
});
</script>
|
// checking whether other types are subtypes of type parameters with constraints
function f1<T extends U, U>(x: T, y: U) {
var r = true ? x : y;
var r = true ? y : x;
}
// V > U > T
function f2<T extends U, U extends V, V>(x: T, y: U, z: V) {
var r = true ? x : y;
var r = true ? y : x;
// ok
var r2 = true ? z : y;
var r2 = true ? y : z;
// ok
var r2a = true ? z : x;
var r2b = true ? x : z;
}
// Date > U > T
function f3<T extends U, U extends Date>(x: T, y: U) {
var r = true ? x : y;
var r = true ? y : x;
// ok
var r2 = true ? x : new Date();
var r2 = true ? new Date() : x;
// ok
var r3 = true ? y : new Date();
var r3 = true ? new Date() : y;
}
interface I1 { foo: number; }
class C1 { foo: number; }
class C2<T> { foo: T; }
enum E { A }
function f() { }
module f {
export var bar = 1;
}
class c { baz: string }
module c {
export var bar = 1;
}
function f4<T extends Number>(x: T) {
var r0 = true ? x : null; // ok
var r0 = true ? null : x; // ok
var u: typeof undefined;
var r0b = true ? u : x; // ok
var r0b = true ? x : u; // ok
}
function f5<T extends Number>(x: T) {
var r1 = true ? 1 : x; // ok
var r1 = true ? x : 1; // ok
}
function f6<T extends String>(x: T) {
var r2 = true ? '' : x; // ok
var r2 = true ? x : ''; // ok
}
function f7<T extends Boolean>(x: T) {
var r3 = true ? true : x; // ok
var r3 = true ? x : true; // ok
}
function f8<T extends Date>(x: T) {
var r4 = true ? new Date() : x; // ok
var r4 = true ? x : new Date(); // ok
}
function f9<T extends RegExp>(x: T) {
var r5 = true ? /1/ : x; // ok
var r5 = true ? x : /1/; // ok
}
function f10<T extends { foo: number }>(x: T) {
var r6 = true ? { foo: 1 } : x; // ok
var r6 = true ? x : { foo: 1 }; // ok
}
function f11<T extends () => void>(x: T) {
var r7 = true ? () => { } : x; // ok
var r7 = true ? x : () => { }; // ok
}
function f12<T extends <U>(x: U) => U>(x: T) {
var r8 = true ? <T>(x: T) => { return x } : x; // ok
var r8b = true ? x : <T>(x: T) => { return x }; // ok, type parameters not identical across declarations
}
function f13<T extends I1>(x: T) {
var i1: I1;
var r9 = true ? i1 : x; // ok
var r9 = true ? x : i1; // ok
}
function f14<T extends C1>(x: T) {
var c1: C1;
var r10 = true ? c1 : x; // ok
var r10 = true ? x : c1; // ok
}
function f15<T extends C2<number>>(x: T) {
var c2: C2<number>;
var r12 = true ? c2 : x; // ok
var r12 = true ? x : c2; // ok
}
function f16<T extends E>(x: T) {
var r13 = true ? E : x; // ok
var r13 = true ? x : E; // ok
var r14 = true ? E.A : x; // ok
var r14 = true ? x : E.A; // ok
}
function f17<T extends typeof f>(x: T) {
var af: typeof f;
var r15 = true ? af : x; // ok
var r15 = true ? x : af; // ok
}
function f18<T extends typeof c>(x: T) {
var ac: typeof c;
var r16 = true ? ac : x; // ok
var r16 = true ? x : ac; // ok
}
function f19<T>(x: T) {
function f17<U extends T>(a: U) {
var r17 = true ? x : a; // ok
var r17 = true ? a : x; // ok
}
function f18<V extends U, U extends T>(a: V) {
var r18 = true ? x : a; // ok
var r18 = true ? a : x; // ok
}
}
function f20<T extends Number>(x: T) {
var r19 = true ? new Object() : x; // ok
var r19 = true ? x : new Object(); // ok
}
function f21<T extends Number>(x: T) {
var r20 = true ? {} : x; // ok
var r20 = true ? x : {}; // ok
} |
/*******************************************************************************
PTP 1588 clock using the STMMAC.
Copyright (C) 2013 Vayavya Labs Pvt Ltd
This program is free software; you can redistribute it and/or modify it
under the terms and conditions of the GNU General Public License,
version 2, as published by the Free Software Foundation.
This program is distributed in the hope it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
more details.
The full GNU General Public License is included in this distribution in
the file called "COPYING".
Author: Rayagond Kokatanur <rayagond@vayavyalabs.com>
*******************************************************************************/
#include "stmmac.h"
#include "stmmac_ptp.h"
/**
* stmmac_adjust_freq
*
* @ptp: pointer to ptp_clock_info structure
* @ppb: desired period change in parts ber billion
*
* Description: this function will adjust the frequency of hardware clock.
*/
static int stmmac_adjust_freq(struct ptp_clock_info *ptp, s32 ppb)
{
struct stmmac_priv *priv =
container_of(ptp, struct stmmac_priv, ptp_clock_ops);
unsigned long flags;
u32 diff, addend;
int neg_adj = 0;
u64 adj;
if (ppb < 0) {
neg_adj = 1;
ppb = -ppb;
}
addend = priv->default_addend;
adj = addend;
adj *= ppb;
diff = div_u64(adj, 1000000000ULL);
addend = neg_adj ? (addend - diff) : (addend + diff);
spin_lock_irqsave(&priv->ptp_lock, flags);
priv->hw->ptp->config_addend(priv->ptpaddr, addend);
spin_unlock_irqrestore(&priv->ptp_lock, flags);
return 0;
}
/**
* stmmac_adjust_time
*
* @ptp: pointer to ptp_clock_info structure
* @delta: desired change in nanoseconds
*
* Description: this function will shift/adjust the hardware clock time.
*/
static int stmmac_adjust_time(struct ptp_clock_info *ptp, s64 delta)
{
struct stmmac_priv *priv =
container_of(ptp, struct stmmac_priv, ptp_clock_ops);
unsigned long flags;
u32 sec, nsec;
u32 quotient, reminder;
int neg_adj = 0;
if (delta < 0) {
neg_adj = 1;
delta = -delta;
}
quotient = div_u64_rem(delta, 1000000000ULL, &reminder);
sec = quotient;
nsec = reminder;
spin_lock_irqsave(&priv->ptp_lock, flags);
priv->hw->ptp->adjust_systime(priv->ptpaddr, sec, nsec, neg_adj,
priv->plat->has_gmac4);
spin_unlock_irqrestore(&priv->ptp_lock, flags);
return 0;
}
/**
* stmmac_get_time
*
* @ptp: pointer to ptp_clock_info structure
* @ts: pointer to hold time/result
*
* Description: this function will read the current time from the
* hardware clock and store it in @ts.
*/
static int stmmac_get_time(struct ptp_clock_info *ptp, struct timespec64 *ts)
{
struct stmmac_priv *priv =
container_of(ptp, struct stmmac_priv, ptp_clock_ops);
unsigned long flags;
u64 ns;
spin_lock_irqsave(&priv->ptp_lock, flags);
ns = priv->hw->ptp->get_systime(priv->ptpaddr);
spin_unlock_irqrestore(&priv->ptp_lock, flags);
*ts = ns_to_timespec64(ns);
return 0;
}
/**
* stmmac_set_time
*
* @ptp: pointer to ptp_clock_info structure
* @ts: time value to set
*
* Description: this function will set the current time on the
* hardware clock.
*/
static int stmmac_set_time(struct ptp_clock_info *ptp,
const struct timespec64 *ts)
{
struct stmmac_priv *priv =
container_of(ptp, struct stmmac_priv, ptp_clock_ops);
unsigned long flags;
spin_lock_irqsave(&priv->ptp_lock, flags);
priv->hw->ptp->init_systime(priv->ptpaddr, ts->tv_sec, ts->tv_nsec);
spin_unlock_irqrestore(&priv->ptp_lock, flags);
return 0;
}
static int stmmac_enable(struct ptp_clock_info *ptp,
struct ptp_clock_request *rq, int on)
{
return -EOPNOTSUPP;
}
/* structure describing a PTP hardware clock */
static const struct ptp_clock_info stmmac_ptp_clock_ops = {
.owner = THIS_MODULE,
.name = "stmmac_ptp_clock",
.max_adj = 62500000,
.n_alarm = 0,
.n_ext_ts = 0,
.n_per_out = 0,
.n_pins = 0,
.pps = 0,
.adjfreq = stmmac_adjust_freq,
.adjtime = stmmac_adjust_time,
.gettime64 = stmmac_get_time,
.settime64 = stmmac_set_time,
.enable = stmmac_enable,
};
/**
* stmmac_ptp_register
* @priv: driver private structure
* Description: this function will register the ptp clock driver
* to kernel. It also does some house keeping work.
*/
void stmmac_ptp_register(struct stmmac_priv *priv)
{
spin_lock_init(&priv->ptp_lock);
priv->ptp_clock_ops = stmmac_ptp_clock_ops;
priv->ptp_clock = ptp_clock_register(&priv->ptp_clock_ops,
priv->device);
if (IS_ERR(priv->ptp_clock)) {
netdev_err(priv->dev, "ptp_clock_register failed\n");
priv->ptp_clock = NULL;
} else if (priv->ptp_clock)
netdev_info(priv->dev, "registered PTP clock\n");
}
/**
* stmmac_ptp_unregister
* @priv: driver private structure
* Description: this function will remove/unregister the ptp clock driver
* from the kernel.
*/
void stmmac_ptp_unregister(struct stmmac_priv *priv)
{
if (priv->ptp_clock) {
ptp_clock_unregister(priv->ptp_clock);
priv->ptp_clock = NULL;
pr_debug("Removed PTP HW clock successfully on %s\n",
priv->dev->name);
}
}
|
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Example - example-example3-jquery</title>
<script src="../../components/jquery-2.1.1/jquery.js"></script>
<script src="../../../angular.js"></script>
<script src="../../../angular-aria.js"></script>
</head>
<body ng-app="ngAria_ngClickExample">
<div ng-click="someFunction" show-attrs>
<div> with ng-click and bindRoleForClick, tabindex set to false
</div>
<script>
angular.module('ngAria_ngClickExample', ['ngAria'], function config($ariaProvider) {
$ariaProvider.config({
bindRoleForClick: false,
tabindex: false
});
})
.directive('showAttrs', function() {
return function(scope, el, attrs) {
var pre = document.createElement('pre');
el.after(pre);
scope.$watch(function() {
var attrs = {};
Array.prototype.slice.call(el[0].attributes, 0).forEach(function(item) {
if (item.name !== 'show-attrs') {
attrs[item.name] = item.value;
}
});
return attrs;
}, function(newAttrs, oldAttrs) {
pre.textContent = JSON.stringify(newAttrs, null, 2);
}, true);
}
});
</script>
</body>
</html> |
<?php
/**
* @package Joomla.Installation
*
* @copyright Copyright (C) 2005 - 2015 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* HTML utility class for the installation application
*
* @package Joomla.Installation
* @since 1.6
*/
class JHtmlInstallation
{
/**
* Method to generate the side bar.
*
* @return string Markup for the side bar.
*
* @since 1.6
*/
public static function stepbar()
{
// Determine if the configuration file path is writable.
$path = JPATH_CONFIGURATION . '/configuration.php';
$useftp = (file_exists($path)) ? !is_writable($path) : !is_writable(JPATH_CONFIGURATION . '/');
$tabs = array();
$tabs[] = 'site';
$tabs[] = 'database';
if ($useftp)
{
$tabs[] = 'ftp';
}
$tabs[] = 'summary';
$html = array();
$html[] = '<ul class="nav nav-tabs">';
foreach ($tabs as $tab)
{
$html[] = static::getTab($tab, $tabs);
}
$html[] = '</ul>';
return implode('', $html);
}
/**
* Method to generate the side bar.
*
* @return string Markup for the side bar.
*
* @since 3.1
*/
public static function stepbarlanguages()
{
$tabs = array();
$tabs[] = 'languages';
$tabs[] = 'defaultlanguage';
$tabs[] = 'complete';
$html = array();
$html[] = '<ul class="nav nav-tabs">';
foreach ($tabs as $tab)
{
$html[] = static::getTab($tab, $tabs);
}
$html[] = '</ul>';
return implode('', $html);
}
/**
* Method to generate the navigation tab.
*
* @param string $id The container ID.
* @param array $tabs The navigation tabs.
*
* @return string Markup for the tab.
*
* @since 3.1
*/
private static function getTab($id, $tabs)
{
$input = JFactory::getApplication()->input;
$num = static::getTabNumber($id, $tabs);
$view = static::getTabNumber($input->getWord('view'), $tabs);
$tab = '<span class="badge">' . $num . '</span> ' . JText::_('INSTL_STEP_' . strtoupper($id) . '_LABEL');
if ($view + 1 == $num)
{
$tab = '<a href="#" onclick="Install.submitform();">' . $tab . '</a>';
}
elseif ($view < $num)
{
$tab = '<span>' . $tab . '</span>';
}
else
{
$tab = '<a href="#" onclick="return Install.goToPage(\'' . $id . '\')">' . $tab . '</a>';
}
return '<li class="step' . ($num == $view ? ' active' : '') . '" id="' . $id . '">' . $tab . '</li>';
}
/**
* Method to determine the tab (step) number.
*
* @param string $id The container ID.
* @param array $tabs The navigation tabs.
*
* @return integer Tab number in navigation sequence.
*
* @since 3.1
*/
private static function getTabNumber($id, $tabs)
{
$num = (int) array_search($id, $tabs);
$num++;
return $num;
}
}
|
# Change Log
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
<a name="3.3.2"></a>
## [3.3.2](https://github.com/kelektiv/node-uuid/compare/v3.3.1...v3.3.2) (2018-06-28)
### Bug Fixes
* typo ([305d877](https://github.com/kelektiv/node-uuid/commit/305d877))
<a name="3.3.1"></a>
## [3.3.1](https://github.com/kelektiv/node-uuid/compare/v3.3.0...v3.3.1) (2018-06-28)
### Bug Fixes
* fix [#284](https://github.com/kelektiv/node-uuid/issues/284) by setting function name in try-catch ([f2a60f2](https://github.com/kelektiv/node-uuid/commit/f2a60f2))
<a name="3.3.0"></a>
# [3.3.0](https://github.com/kelektiv/node-uuid/compare/v3.2.1...v3.3.0) (2018-06-22)
### Bug Fixes
* assignment to readonly property to allow running in strict mode ([#270](https://github.com/kelektiv/node-uuid/issues/270)) ([d062fdc](https://github.com/kelektiv/node-uuid/commit/d062fdc))
* fix [#229](https://github.com/kelektiv/node-uuid/issues/229) ([c9684d4](https://github.com/kelektiv/node-uuid/commit/c9684d4))
* Get correct version of IE11 crypto ([#274](https://github.com/kelektiv/node-uuid/issues/274)) ([153d331](https://github.com/kelektiv/node-uuid/commit/153d331))
* mem issue when generating uuid ([#267](https://github.com/kelektiv/node-uuid/issues/267)) ([c47702c](https://github.com/kelektiv/node-uuid/commit/c47702c))
### Features
* enforce Conventional Commit style commit messages ([#282](https://github.com/kelektiv/node-uuid/issues/282)) ([cc9a182](https://github.com/kelektiv/node-uuid/commit/cc9a182))
<a name="3.2.1"></a>
## [3.2.1](https://github.com/kelektiv/node-uuid/compare/v3.2.0...v3.2.1) (2018-01-16)
### Bug Fixes
* use msCrypto if available. Fixes [#241](https://github.com/kelektiv/node-uuid/issues/241) ([#247](https://github.com/kelektiv/node-uuid/issues/247)) ([1fef18b](https://github.com/kelektiv/node-uuid/commit/1fef18b))
<a name="3.2.0"></a>
# [3.2.0](https://github.com/kelektiv/node-uuid/compare/v3.1.0...v3.2.0) (2018-01-16)
### Bug Fixes
* remove mistakenly added typescript dependency, rollback version (standard-version will auto-increment) ([09fa824](https://github.com/kelektiv/node-uuid/commit/09fa824))
* use msCrypto if available. Fixes [#241](https://github.com/kelektiv/node-uuid/issues/241) ([#247](https://github.com/kelektiv/node-uuid/issues/247)) ([1fef18b](https://github.com/kelektiv/node-uuid/commit/1fef18b))
### Features
* Add v3 Support ([#217](https://github.com/kelektiv/node-uuid/issues/217)) ([d94f726](https://github.com/kelektiv/node-uuid/commit/d94f726))
# [3.1.0](https://github.com/kelektiv/node-uuid/compare/v3.1.0...v3.0.1) (2017-06-17)
### Bug Fixes
* (fix) Add .npmignore file to exclude test/ and other non-essential files from packing. (#183)
* Fix typo (#178)
* Simple typo fix (#165)
### Features
* v5 support in CLI (#197)
* V5 support (#188)
# 3.0.1 (2016-11-28)
* split uuid versions into separate files
# 3.0.0 (2016-11-17)
* remove .parse and .unparse
# 2.0.0
* Removed uuid.BufferClass
# 1.4.0
* Improved module context detection
* Removed public RNG functions
# 1.3.2
* Improve tests and handling of v1() options (Issue #24)
* Expose RNG option to allow for perf testing with different generators
# 1.3.0
* Support for version 1 ids, thanks to [@ctavan](https://github.com/ctavan)!
* Support for node.js crypto API
* De-emphasizing performance in favor of a) cryptographic quality PRNGs where available and b) more manageable code
|
/*
This file is part of Ext JS 4.2
Copyright (c) 2011-2013 Sencha Inc
Contact: http://www.sencha.com/contact
GNU General Public License Usage
This file may be used under the terms of the GNU General Public License version 3.0 as
published by the Free Software Foundation and appearing in the file LICENSE included in the
packaging of this file.
Please review the following information to ensure the GNU General Public License version 3.0
requirements will be met: http://www.gnu.org/copyleft/gpl.html.
If you are unsure which license is appropriate for your use, please contact the sales department
at http://www.sencha.com/contact.
Build date: 2013-05-16 14:36:50 (f9be68accb407158ba2b1be2c226a6ce1f649314)
*/
// @tag dom,core
// @require AbstractQuery.js
/**
* Abstract base class for {@link Ext.dom.Helper}.
* @private
*/
Ext.define('Ext.dom.AbstractHelper', {
emptyTags : /^(?:br|frame|hr|img|input|link|meta|range|spacer|wbr|area|param|col)$/i,
confRe : /^(?:tag|children|cn|html|tpl|tplData)$/i,
endRe : /end/i,
styleSepRe: /\s*(?::|;)\s*/,
// Since cls & for are reserved words, we need to transform them
attributeTransform: { cls : 'class', htmlFor : 'for' },
closeTags: {},
decamelizeName : (function () {
var camelCaseRe = /([a-z])([A-Z])/g,
cache = {};
function decamel (match, p1, p2) {
return p1 + '-' + p2.toLowerCase();
}
return function (s) {
return cache[s] || (cache[s] = s.replace(camelCaseRe, decamel));
};
}()),
generateMarkup: function(spec, buffer) {
var me = this,
specType = typeof spec,
attr, val, tag, i, closeTags;
if (specType == "string" || specType == "number") {
buffer.push(spec);
} else if (Ext.isArray(spec)) {
for (i = 0; i < spec.length; i++) {
if (spec[i]) {
me.generateMarkup(spec[i], buffer);
}
}
} else {
tag = spec.tag || 'div';
buffer.push('<', tag);
for (attr in spec) {
if (spec.hasOwnProperty(attr)) {
val = spec[attr];
if (!me.confRe.test(attr)) {
if (typeof val == "object") {
buffer.push(' ', attr, '="');
me.generateStyles(val, buffer).push('"');
} else {
buffer.push(' ', me.attributeTransform[attr] || attr, '="', val, '"');
}
}
}
}
// Now either just close the tag or try to add children and close the tag.
if (me.emptyTags.test(tag)) {
buffer.push('/>');
} else {
buffer.push('>');
// Apply the tpl html, and cn specifications
if ((val = spec.tpl)) {
val.applyOut(spec.tplData, buffer);
}
if ((val = spec.html)) {
buffer.push(val);
}
if ((val = spec.cn || spec.children)) {
me.generateMarkup(val, buffer);
}
// we generate a lot of close tags, so cache them rather than push 3 parts
closeTags = me.closeTags;
buffer.push(closeTags[tag] || (closeTags[tag] = '</' + tag + '>'));
}
}
return buffer;
},
/**
* Converts the styles from the given object to text. The styles are CSS style names
* with their associated value.
*
* The basic form of this method returns a string:
*
* var s = Ext.DomHelper.generateStyles({
* backgroundColor: 'red'
* });
*
* // s = 'background-color:red;'
*
* Alternatively, this method can append to an output array.
*
* var buf = [];
*
* ...
*
* Ext.DomHelper.generateStyles({
* backgroundColor: 'red'
* }, buf);
*
* In this case, the style text is pushed on to the array and the array is returned.
*
* @param {Object} styles The object describing the styles.
* @param {String[]} [buffer] The output buffer.
* @return {String/String[]} If buffer is passed, it is returned. Otherwise the style
* string is returned.
*/
generateStyles: function (styles, buffer) {
var a = buffer || [],
name;
for (name in styles) {
if (styles.hasOwnProperty(name)) {
a.push(this.decamelizeName(name), ':', styles[name], ';');
}
}
return buffer || a.join('');
},
/**
* Returns the markup for the passed Element(s) config.
* @param {Object} spec The DOM object spec (and children)
* @return {String}
*/
markup: function(spec) {
if (typeof spec == "string") {
return spec;
}
var buf = this.generateMarkup(spec, []);
return buf.join('');
},
/**
* Applies a style specification to an element.
* @param {String/HTMLElement} el The element to apply styles to
* @param {String/Object/Function} styles A style specification string e.g. 'width:100px', or object in the form {width:'100px'}, or
* a function which returns such a specification.
*/
applyStyles: function(el, styles) {
if (styles) {
var i = 0,
len;
el = Ext.fly(el, '_applyStyles');
if (typeof styles == 'function') {
styles = styles.call();
}
if (typeof styles == 'string') {
styles = Ext.util.Format.trim(styles).split(this.styleSepRe);
for (len = styles.length; i < len;) {
el.setStyle(styles[i++], styles[i++]);
}
} else if (Ext.isObject(styles)) {
el.setStyle(styles);
}
}
},
/**
* Inserts an HTML fragment into the DOM.
* @param {String} where Where to insert the html in relation to el - beforeBegin, afterBegin, beforeEnd, afterEnd.
*
* For example take the following HTML: `<div>Contents</div>`
*
* Using different `where` values inserts element to the following places:
*
* - beforeBegin: `<HERE><div>Contents</div>`
* - afterBegin: `<div><HERE>Contents</div>`
* - beforeEnd: `<div>Contents<HERE></div>`
* - afterEnd: `<div>Contents</div><HERE>`
*
* @param {HTMLElement/TextNode} el The context element
* @param {String} html The HTML fragment
* @return {HTMLElement} The new node
*/
insertHtml: function(where, el, html) {
var hash = {},
setStart,
range,
frag,
rangeEl;
where = where.toLowerCase();
// add these here because they are used in both branches of the condition.
hash['beforebegin'] = ['BeforeBegin', 'previousSibling'];
hash['afterend'] = ['AfterEnd', 'nextSibling'];
range = el.ownerDocument.createRange();
setStart = 'setStart' + (this.endRe.test(where) ? 'After' : 'Before');
if (hash[where]) {
range[setStart](el);
frag = range.createContextualFragment(html);
el.parentNode.insertBefore(frag, where == 'beforebegin' ? el : el.nextSibling);
return el[(where == 'beforebegin' ? 'previous' : 'next') + 'Sibling'];
}
else {
rangeEl = (where == 'afterbegin' ? 'first' : 'last') + 'Child';
if (el.firstChild) {
range[setStart](el[rangeEl]);
frag = range.createContextualFragment(html);
if (where == 'afterbegin') {
el.insertBefore(frag, el.firstChild);
}
else {
el.appendChild(frag);
}
}
else {
el.innerHTML = html;
}
return el[rangeEl];
}
throw 'Illegal insertion point -> "' + where + '"';
},
/**
* Creates new DOM element(s) and inserts them before el.
* @param {String/HTMLElement/Ext.Element} el The context element
* @param {Object/String} o The DOM object spec (and children) or raw HTML blob
* @param {Boolean} [returnElement] true to return a Ext.Element
* @return {HTMLElement/Ext.Element} The new node
*/
insertBefore: function(el, o, returnElement) {
return this.doInsert(el, o, returnElement, 'beforebegin');
},
/**
* Creates new DOM element(s) and inserts them after el.
* @param {String/HTMLElement/Ext.Element} el The context element
* @param {Object} o The DOM object spec (and children)
* @param {Boolean} [returnElement] true to return a Ext.Element
* @return {HTMLElement/Ext.Element} The new node
*/
insertAfter: function(el, o, returnElement) {
return this.doInsert(el, o, returnElement, 'afterend', 'nextSibling');
},
/**
* Creates new DOM element(s) and inserts them as the first child of el.
* @param {String/HTMLElement/Ext.Element} el The context element
* @param {Object/String} o The DOM object spec (and children) or raw HTML blob
* @param {Boolean} [returnElement] true to return a Ext.Element
* @return {HTMLElement/Ext.Element} The new node
*/
insertFirst: function(el, o, returnElement) {
return this.doInsert(el, o, returnElement, 'afterbegin', 'firstChild');
},
/**
* Creates new DOM element(s) and appends them to el.
* @param {String/HTMLElement/Ext.Element} el The context element
* @param {Object/String} o The DOM object spec (and children) or raw HTML blob
* @param {Boolean} [returnElement] true to return a Ext.Element
* @return {HTMLElement/Ext.Element} The new node
*/
append: function(el, o, returnElement) {
return this.doInsert(el, o, returnElement, 'beforeend', '', true);
},
/**
* Creates new DOM element(s) and overwrites the contents of el with them.
* @param {String/HTMLElement/Ext.Element} el The context element
* @param {Object/String} o The DOM object spec (and children) or raw HTML blob
* @param {Boolean} [returnElement] true to return a Ext.Element
* @return {HTMLElement/Ext.Element} The new node
*/
overwrite: function(el, o, returnElement) {
el = Ext.getDom(el);
el.innerHTML = this.markup(o);
return returnElement ? Ext.get(el.firstChild) : el.firstChild;
},
doInsert: function(el, o, returnElement, pos, sibling, append) {
var newNode = this.insertHtml(pos, Ext.getDom(el), this.markup(o));
return returnElement ? Ext.get(newNode, true) : newNode;
}
});
|
/*
* Copyright (c) 2000-2005 Silicon Graphics, Inc.
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it would be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "xfs.h"
#include "xfs_fs.h"
#include "xfs_format.h"
#include "xfs_log_format.h"
#include "xfs_trans_resv.h"
#include "xfs_bit.h"
#include "xfs_sb.h"
#include "xfs_mount.h"
#include "xfs_trans.h"
#include "xfs_buf_item.h"
#include "xfs_trans_priv.h"
#include "xfs_error.h"
#include "xfs_trace.h"
#include "xfs_log.h"
kmem_zone_t *xfs_buf_item_zone;
static inline struct xfs_buf_log_item *BUF_ITEM(struct xfs_log_item *lip)
{
return container_of(lip, struct xfs_buf_log_item, bli_item);
}
STATIC void xfs_buf_do_callbacks(struct xfs_buf *bp);
static inline int
xfs_buf_log_format_size(
struct xfs_buf_log_format *blfp)
{
return offsetof(struct xfs_buf_log_format, blf_data_map) +
(blfp->blf_map_size * sizeof(blfp->blf_data_map[0]));
}
/*
* This returns the number of log iovecs needed to log the
* given buf log item.
*
* It calculates this as 1 iovec for the buf log format structure
* and 1 for each stretch of non-contiguous chunks to be logged.
* Contiguous chunks are logged in a single iovec.
*
* If the XFS_BLI_STALE flag has been set, then log nothing.
*/
STATIC void
xfs_buf_item_size_segment(
struct xfs_buf_log_item *bip,
struct xfs_buf_log_format *blfp,
int *nvecs,
int *nbytes)
{
struct xfs_buf *bp = bip->bli_buf;
int next_bit;
int last_bit;
last_bit = xfs_next_bit(blfp->blf_data_map, blfp->blf_map_size, 0);
if (last_bit == -1)
return;
/*
* initial count for a dirty buffer is 2 vectors - the format structure
* and the first dirty region.
*/
*nvecs += 2;
*nbytes += xfs_buf_log_format_size(blfp) + XFS_BLF_CHUNK;
while (last_bit != -1) {
/*
* This takes the bit number to start looking from and
* returns the next set bit from there. It returns -1
* if there are no more bits set or the start bit is
* beyond the end of the bitmap.
*/
next_bit = xfs_next_bit(blfp->blf_data_map, blfp->blf_map_size,
last_bit + 1);
/*
* If we run out of bits, leave the loop,
* else if we find a new set of bits bump the number of vecs,
* else keep scanning the current set of bits.
*/
if (next_bit == -1) {
break;
} else if (next_bit != last_bit + 1) {
last_bit = next_bit;
(*nvecs)++;
} else if (xfs_buf_offset(bp, next_bit * XFS_BLF_CHUNK) !=
(xfs_buf_offset(bp, last_bit * XFS_BLF_CHUNK) +
XFS_BLF_CHUNK)) {
last_bit = next_bit;
(*nvecs)++;
} else {
last_bit++;
}
*nbytes += XFS_BLF_CHUNK;
}
}
/*
* This returns the number of log iovecs needed to log the given buf log item.
*
* It calculates this as 1 iovec for the buf log format structure and 1 for each
* stretch of non-contiguous chunks to be logged. Contiguous chunks are logged
* in a single iovec.
*
* Discontiguous buffers need a format structure per region that that is being
* logged. This makes the changes in the buffer appear to log recovery as though
* they came from separate buffers, just like would occur if multiple buffers
* were used instead of a single discontiguous buffer. This enables
* discontiguous buffers to be in-memory constructs, completely transparent to
* what ends up on disk.
*
* If the XFS_BLI_STALE flag has been set, then log nothing but the buf log
* format structures.
*/
STATIC void
xfs_buf_item_size(
struct xfs_log_item *lip,
int *nvecs,
int *nbytes)
{
struct xfs_buf_log_item *bip = BUF_ITEM(lip);
int i;
ASSERT(atomic_read(&bip->bli_refcount) > 0);
if (bip->bli_flags & XFS_BLI_STALE) {
/*
* The buffer is stale, so all we need to log
* is the buf log format structure with the
* cancel flag in it.
*/
trace_xfs_buf_item_size_stale(bip);
ASSERT(bip->__bli_format.blf_flags & XFS_BLF_CANCEL);
*nvecs += bip->bli_format_count;
for (i = 0; i < bip->bli_format_count; i++) {
*nbytes += xfs_buf_log_format_size(&bip->bli_formats[i]);
}
return;
}
ASSERT(bip->bli_flags & XFS_BLI_LOGGED);
if (bip->bli_flags & XFS_BLI_ORDERED) {
/*
* The buffer has been logged just to order it.
* It is not being included in the transaction
* commit, so no vectors are used at all.
*/
trace_xfs_buf_item_size_ordered(bip);
*nvecs = XFS_LOG_VEC_ORDERED;
return;
}
/*
* the vector count is based on the number of buffer vectors we have
* dirty bits in. This will only be greater than one when we have a
* compound buffer with more than one segment dirty. Hence for compound
* buffers we need to track which segment the dirty bits correspond to,
* and when we move from one segment to the next increment the vector
* count for the extra buf log format structure that will need to be
* written.
*/
for (i = 0; i < bip->bli_format_count; i++) {
xfs_buf_item_size_segment(bip, &bip->bli_formats[i],
nvecs, nbytes);
}
trace_xfs_buf_item_size(bip);
}
static inline void
xfs_buf_item_copy_iovec(
struct xfs_log_vec *lv,
struct xfs_log_iovec **vecp,
struct xfs_buf *bp,
uint offset,
int first_bit,
uint nbits)
{
offset += first_bit * XFS_BLF_CHUNK;
xlog_copy_iovec(lv, vecp, XLOG_REG_TYPE_BCHUNK,
xfs_buf_offset(bp, offset),
nbits * XFS_BLF_CHUNK);
}
static inline bool
xfs_buf_item_straddle(
struct xfs_buf *bp,
uint offset,
int next_bit,
int last_bit)
{
return xfs_buf_offset(bp, offset + (next_bit << XFS_BLF_SHIFT)) !=
(xfs_buf_offset(bp, offset + (last_bit << XFS_BLF_SHIFT)) +
XFS_BLF_CHUNK);
}
static void
xfs_buf_item_format_segment(
struct xfs_buf_log_item *bip,
struct xfs_log_vec *lv,
struct xfs_log_iovec **vecp,
uint offset,
struct xfs_buf_log_format *blfp)
{
struct xfs_buf *bp = bip->bli_buf;
uint base_size;
int first_bit;
int last_bit;
int next_bit;
uint nbits;
/* copy the flags across from the base format item */
blfp->blf_flags = bip->__bli_format.blf_flags;
/*
* Base size is the actual size of the ondisk structure - it reflects
* the actual size of the dirty bitmap rather than the size of the in
* memory structure.
*/
base_size = xfs_buf_log_format_size(blfp);
first_bit = xfs_next_bit(blfp->blf_data_map, blfp->blf_map_size, 0);
if (!(bip->bli_flags & XFS_BLI_STALE) && first_bit == -1) {
/*
* If the map is not be dirty in the transaction, mark
* the size as zero and do not advance the vector pointer.
*/
return;
}
blfp = xlog_copy_iovec(lv, vecp, XLOG_REG_TYPE_BFORMAT, blfp, base_size);
blfp->blf_size = 1;
if (bip->bli_flags & XFS_BLI_STALE) {
/*
* The buffer is stale, so all we need to log
* is the buf log format structure with the
* cancel flag in it.
*/
trace_xfs_buf_item_format_stale(bip);
ASSERT(blfp->blf_flags & XFS_BLF_CANCEL);
return;
}
/*
* Fill in an iovec for each set of contiguous chunks.
*/
last_bit = first_bit;
nbits = 1;
for (;;) {
/*
* This takes the bit number to start looking from and
* returns the next set bit from there. It returns -1
* if there are no more bits set or the start bit is
* beyond the end of the bitmap.
*/
next_bit = xfs_next_bit(blfp->blf_data_map, blfp->blf_map_size,
(uint)last_bit + 1);
/*
* If we run out of bits fill in the last iovec and get out of
* the loop. Else if we start a new set of bits then fill in
* the iovec for the series we were looking at and start
* counting the bits in the new one. Else we're still in the
* same set of bits so just keep counting and scanning.
*/
if (next_bit == -1) {
xfs_buf_item_copy_iovec(lv, vecp, bp, offset,
first_bit, nbits);
blfp->blf_size++;
break;
} else if (next_bit != last_bit + 1 ||
xfs_buf_item_straddle(bp, offset, next_bit, last_bit)) {
xfs_buf_item_copy_iovec(lv, vecp, bp, offset,
first_bit, nbits);
blfp->blf_size++;
first_bit = next_bit;
last_bit = next_bit;
nbits = 1;
} else {
last_bit++;
nbits++;
}
}
}
/*
* This is called to fill in the vector of log iovecs for the
* given log buf item. It fills the first entry with a buf log
* format structure, and the rest point to contiguous chunks
* within the buffer.
*/
STATIC void
xfs_buf_item_format(
struct xfs_log_item *lip,
struct xfs_log_vec *lv)
{
struct xfs_buf_log_item *bip = BUF_ITEM(lip);
struct xfs_buf *bp = bip->bli_buf;
struct xfs_log_iovec *vecp = NULL;
uint offset = 0;
int i;
ASSERT(atomic_read(&bip->bli_refcount) > 0);
ASSERT((bip->bli_flags & XFS_BLI_LOGGED) ||
(bip->bli_flags & XFS_BLI_STALE));
ASSERT((bip->bli_flags & XFS_BLI_STALE) ||
(xfs_blft_from_flags(&bip->__bli_format) > XFS_BLFT_UNKNOWN_BUF
&& xfs_blft_from_flags(&bip->__bli_format) < XFS_BLFT_MAX_BUF));
/*
* If it is an inode buffer, transfer the in-memory state to the
* format flags and clear the in-memory state.
*
* For buffer based inode allocation, we do not transfer
* this state if the inode buffer allocation has not yet been committed
* to the log as setting the XFS_BLI_INODE_BUF flag will prevent
* correct replay of the inode allocation.
*
* For icreate item based inode allocation, the buffers aren't written
* to the journal during allocation, and hence we should always tag the
* buffer as an inode buffer so that the correct unlinked list replay
* occurs during recovery.
*/
if (bip->bli_flags & XFS_BLI_INODE_BUF) {
if (xfs_sb_version_hascrc(&lip->li_mountp->m_sb) ||
!((bip->bli_flags & XFS_BLI_INODE_ALLOC_BUF) &&
xfs_log_item_in_current_chkpt(lip)))
bip->__bli_format.blf_flags |= XFS_BLF_INODE_BUF;
bip->bli_flags &= ~XFS_BLI_INODE_BUF;
}
if ((bip->bli_flags & (XFS_BLI_ORDERED|XFS_BLI_STALE)) ==
XFS_BLI_ORDERED) {
/*
* The buffer has been logged just to order it. It is not being
* included in the transaction commit, so don't format it.
*/
trace_xfs_buf_item_format_ordered(bip);
return;
}
for (i = 0; i < bip->bli_format_count; i++) {
xfs_buf_item_format_segment(bip, lv, &vecp, offset,
&bip->bli_formats[i]);
offset += BBTOB(bp->b_maps[i].bm_len);
}
/*
* Check to make sure everything is consistent.
*/
trace_xfs_buf_item_format(bip);
}
/*
* This is called to pin the buffer associated with the buf log item in memory
* so it cannot be written out.
*
* We also always take a reference to the buffer log item here so that the bli
* is held while the item is pinned in memory. This means that we can
* unconditionally drop the reference count a transaction holds when the
* transaction is completed.
*/
STATIC void
xfs_buf_item_pin(
struct xfs_log_item *lip)
{
struct xfs_buf_log_item *bip = BUF_ITEM(lip);
ASSERT(atomic_read(&bip->bli_refcount) > 0);
ASSERT((bip->bli_flags & XFS_BLI_LOGGED) ||
(bip->bli_flags & XFS_BLI_ORDERED) ||
(bip->bli_flags & XFS_BLI_STALE));
trace_xfs_buf_item_pin(bip);
atomic_inc(&bip->bli_refcount);
atomic_inc(&bip->bli_buf->b_pin_count);
}
/*
* This is called to unpin the buffer associated with the buf log
* item which was previously pinned with a call to xfs_buf_item_pin().
*
* Also drop the reference to the buf item for the current transaction.
* If the XFS_BLI_STALE flag is set and we are the last reference,
* then free up the buf log item and unlock the buffer.
*
* If the remove flag is set we are called from uncommit in the
* forced-shutdown path. If that is true and the reference count on
* the log item is going to drop to zero we need to free the item's
* descriptor in the transaction.
*/
STATIC void
xfs_buf_item_unpin(
struct xfs_log_item *lip,
int remove)
{
struct xfs_buf_log_item *bip = BUF_ITEM(lip);
xfs_buf_t *bp = bip->bli_buf;
struct xfs_ail *ailp = lip->li_ailp;
int stale = bip->bli_flags & XFS_BLI_STALE;
int freed;
ASSERT(bp->b_fspriv == bip);
ASSERT(atomic_read(&bip->bli_refcount) > 0);
trace_xfs_buf_item_unpin(bip);
freed = atomic_dec_and_test(&bip->bli_refcount);
if (atomic_dec_and_test(&bp->b_pin_count))
wake_up_all(&bp->b_waiters);
if (freed && stale) {
ASSERT(bip->bli_flags & XFS_BLI_STALE);
ASSERT(xfs_buf_islocked(bp));
ASSERT(bp->b_flags & XBF_STALE);
ASSERT(bip->__bli_format.blf_flags & XFS_BLF_CANCEL);
trace_xfs_buf_item_unpin_stale(bip);
if (remove) {
/*
* If we are in a transaction context, we have to
* remove the log item from the transaction as we are
* about to release our reference to the buffer. If we
* don't, the unlock that occurs later in
* xfs_trans_uncommit() will try to reference the
* buffer which we no longer have a hold on.
*/
if (lip->li_desc)
xfs_trans_del_item(lip);
/*
* Since the transaction no longer refers to the buffer,
* the buffer should no longer refer to the transaction.
*/
bp->b_transp = NULL;
}
/*
* If we get called here because of an IO error, we may
* or may not have the item on the AIL. xfs_trans_ail_delete()
* will take care of that situation.
* xfs_trans_ail_delete() drops the AIL lock.
*/
if (bip->bli_flags & XFS_BLI_STALE_INODE) {
xfs_buf_do_callbacks(bp);
bp->b_fspriv = NULL;
bp->b_iodone = NULL;
} else {
spin_lock(&ailp->xa_lock);
xfs_trans_ail_delete(ailp, lip, SHUTDOWN_LOG_IO_ERROR);
xfs_buf_item_relse(bp);
ASSERT(bp->b_fspriv == NULL);
}
xfs_buf_relse(bp);
} else if (freed && remove) {
/*
* There are currently two references to the buffer - the active
* LRU reference and the buf log item. What we are about to do
* here - simulate a failed IO completion - requires 3
* references.
*
* The LRU reference is removed by the xfs_buf_stale() call. The
* buf item reference is removed by the xfs_buf_iodone()
* callback that is run by xfs_buf_do_callbacks() during ioend
* processing (via the bp->b_iodone callback), and then finally
* the ioend processing will drop the IO reference if the buffer
* is marked XBF_ASYNC.
*
* Hence we need to take an additional reference here so that IO
* completion processing doesn't free the buffer prematurely.
*/
xfs_buf_lock(bp);
xfs_buf_hold(bp);
bp->b_flags |= XBF_ASYNC;
xfs_buf_ioerror(bp, -EIO);
bp->b_flags &= ~XBF_DONE;
xfs_buf_stale(bp);
xfs_buf_ioend(bp);
}
}
/*
* Buffer IO error rate limiting. Limit it to no more than 10 messages per 30
* seconds so as to not spam logs too much on repeated detection of the same
* buffer being bad..
*/
static DEFINE_RATELIMIT_STATE(xfs_buf_write_fail_rl_state, 30 * HZ, 10);
STATIC uint
xfs_buf_item_push(
struct xfs_log_item *lip,
struct list_head *buffer_list)
{
struct xfs_buf_log_item *bip = BUF_ITEM(lip);
struct xfs_buf *bp = bip->bli_buf;
uint rval = XFS_ITEM_SUCCESS;
if (xfs_buf_ispinned(bp))
return XFS_ITEM_PINNED;
if (!xfs_buf_trylock(bp)) {
/*
* If we have just raced with a buffer being pinned and it has
* been marked stale, we could end up stalling until someone else
* issues a log force to unpin the stale buffer. Check for the
* race condition here so xfsaild recognizes the buffer is pinned
* and queues a log force to move it along.
*/
if (xfs_buf_ispinned(bp))
return XFS_ITEM_PINNED;
return XFS_ITEM_LOCKED;
}
ASSERT(!(bip->bli_flags & XFS_BLI_STALE));
trace_xfs_buf_item_push(bip);
/* has a previous flush failed due to IO errors? */
if ((bp->b_flags & XBF_WRITE_FAIL) &&
___ratelimit(&xfs_buf_write_fail_rl_state, "XFS: Failing async write")) {
xfs_warn(bp->b_target->bt_mount,
"Failing async write on buffer block 0x%llx. Retrying async write.",
(long long)bp->b_bn);
}
if (!xfs_buf_delwri_queue(bp, buffer_list))
rval = XFS_ITEM_FLUSHING;
xfs_buf_unlock(bp);
return rval;
}
/*
* Release the buffer associated with the buf log item. If there is no dirty
* logged data associated with the buffer recorded in the buf log item, then
* free the buf log item and remove the reference to it in the buffer.
*
* This call ignores the recursion count. It is only called when the buffer
* should REALLY be unlocked, regardless of the recursion count.
*
* We unconditionally drop the transaction's reference to the log item. If the
* item was logged, then another reference was taken when it was pinned, so we
* can safely drop the transaction reference now. This also allows us to avoid
* potential races with the unpin code freeing the bli by not referencing the
* bli after we've dropped the reference count.
*
* If the XFS_BLI_HOLD flag is set in the buf log item, then free the log item
* if necessary but do not unlock the buffer. This is for support of
* xfs_trans_bhold(). Make sure the XFS_BLI_HOLD field is cleared if we don't
* free the item.
*/
STATIC void
xfs_buf_item_unlock(
struct xfs_log_item *lip)
{
struct xfs_buf_log_item *bip = BUF_ITEM(lip);
struct xfs_buf *bp = bip->bli_buf;
bool clean;
bool aborted;
int flags;
/* Clear the buffer's association with this transaction. */
bp->b_transp = NULL;
/*
* If this is a transaction abort, don't return early. Instead, allow
* the brelse to happen. Normally it would be done for stale
* (cancelled) buffers at unpin time, but we'll never go through the
* pin/unpin cycle if we abort inside commit.
*/
aborted = (lip->li_flags & XFS_LI_ABORTED) ? true : false;
/*
* Before possibly freeing the buf item, copy the per-transaction state
* so we can reference it safely later after clearing it from the
* buffer log item.
*/
flags = bip->bli_flags;
bip->bli_flags &= ~(XFS_BLI_LOGGED | XFS_BLI_HOLD | XFS_BLI_ORDERED);
/*
* If the buf item is marked stale, then don't do anything. We'll
* unlock the buffer and free the buf item when the buffer is unpinned
* for the last time.
*/
if (flags & XFS_BLI_STALE) {
trace_xfs_buf_item_unlock_stale(bip);
ASSERT(bip->__bli_format.blf_flags & XFS_BLF_CANCEL);
if (!aborted) {
atomic_dec(&bip->bli_refcount);
return;
}
}
trace_xfs_buf_item_unlock(bip);
/*
* If the buf item isn't tracking any data, free it, otherwise drop the
* reference we hold to it. If we are aborting the transaction, this may
* be the only reference to the buf item, so we free it anyway
* regardless of whether it is dirty or not. A dirty abort implies a
* shutdown, anyway.
*
* Ordered buffers are dirty but may have no recorded changes, so ensure
* we only release clean items here.
*/
clean = (flags & XFS_BLI_DIRTY) ? false : true;
if (clean) {
int i;
for (i = 0; i < bip->bli_format_count; i++) {
if (!xfs_bitmap_empty(bip->bli_formats[i].blf_data_map,
bip->bli_formats[i].blf_map_size)) {
clean = false;
break;
}
}
}
/*
* Clean buffers, by definition, cannot be in the AIL. However, aborted
* buffers may be dirty and hence in the AIL. Therefore if we are
* aborting a buffer and we've just taken the last refernce away, we
* have to check if it is in the AIL before freeing it. We need to free
* it in this case, because an aborted transaction has already shut the
* filesystem down and this is the last chance we will have to do so.
*/
if (atomic_dec_and_test(&bip->bli_refcount)) {
if (clean)
xfs_buf_item_relse(bp);
else if (aborted) {
ASSERT(XFS_FORCED_SHUTDOWN(lip->li_mountp));
xfs_trans_ail_remove(lip, SHUTDOWN_LOG_IO_ERROR);
xfs_buf_item_relse(bp);
}
}
if (!(flags & XFS_BLI_HOLD))
xfs_buf_relse(bp);
}
/*
* This is called to find out where the oldest active copy of the
* buf log item in the on disk log resides now that the last log
* write of it completed at the given lsn.
* We always re-log all the dirty data in a buffer, so usually the
* latest copy in the on disk log is the only one that matters. For
* those cases we simply return the given lsn.
*
* The one exception to this is for buffers full of newly allocated
* inodes. These buffers are only relogged with the XFS_BLI_INODE_BUF
* flag set, indicating that only the di_next_unlinked fields from the
* inodes in the buffers will be replayed during recovery. If the
* original newly allocated inode images have not yet been flushed
* when the buffer is so relogged, then we need to make sure that we
* keep the old images in the 'active' portion of the log. We do this
* by returning the original lsn of that transaction here rather than
* the current one.
*/
STATIC xfs_lsn_t
xfs_buf_item_committed(
struct xfs_log_item *lip,
xfs_lsn_t lsn)
{
struct xfs_buf_log_item *bip = BUF_ITEM(lip);
trace_xfs_buf_item_committed(bip);
if ((bip->bli_flags & XFS_BLI_INODE_ALLOC_BUF) && lip->li_lsn != 0)
return lip->li_lsn;
return lsn;
}
STATIC void
xfs_buf_item_committing(
struct xfs_log_item *lip,
xfs_lsn_t commit_lsn)
{
}
/*
* This is the ops vector shared by all buf log items.
*/
static const struct xfs_item_ops xfs_buf_item_ops = {
.iop_size = xfs_buf_item_size,
.iop_format = xfs_buf_item_format,
.iop_pin = xfs_buf_item_pin,
.iop_unpin = xfs_buf_item_unpin,
.iop_unlock = xfs_buf_item_unlock,
.iop_committed = xfs_buf_item_committed,
.iop_push = xfs_buf_item_push,
.iop_committing = xfs_buf_item_committing
};
STATIC int
xfs_buf_item_get_format(
struct xfs_buf_log_item *bip,
int count)
{
ASSERT(bip->bli_formats == NULL);
bip->bli_format_count = count;
if (count == 1) {
bip->bli_formats = &bip->__bli_format;
return 0;
}
bip->bli_formats = kmem_zalloc(count * sizeof(struct xfs_buf_log_format),
KM_SLEEP);
if (!bip->bli_formats)
return -ENOMEM;
return 0;
}
STATIC void
xfs_buf_item_free_format(
struct xfs_buf_log_item *bip)
{
if (bip->bli_formats != &bip->__bli_format) {
kmem_free(bip->bli_formats);
bip->bli_formats = NULL;
}
}
/*
* Allocate a new buf log item to go with the given buffer.
* Set the buffer's b_fsprivate field to point to the new
* buf log item. If there are other item's attached to the
* buffer (see xfs_buf_attach_iodone() below), then put the
* buf log item at the front.
*/
int
xfs_buf_item_init(
struct xfs_buf *bp,
struct xfs_mount *mp)
{
struct xfs_log_item *lip = bp->b_fspriv;
struct xfs_buf_log_item *bip;
int chunks;
int map_size;
int error;
int i;
/*
* Check to see if there is already a buf log item for
* this buffer. If there is, it is guaranteed to be
* the first. If we do already have one, there is
* nothing to do here so return.
*/
ASSERT(bp->b_target->bt_mount == mp);
if (lip != NULL && lip->li_type == XFS_LI_BUF)
return 0;
bip = kmem_zone_zalloc(xfs_buf_item_zone, KM_SLEEP);
xfs_log_item_init(mp, &bip->bli_item, XFS_LI_BUF, &xfs_buf_item_ops);
bip->bli_buf = bp;
/*
* chunks is the number of XFS_BLF_CHUNK size pieces the buffer
* can be divided into. Make sure not to truncate any pieces.
* map_size is the size of the bitmap needed to describe the
* chunks of the buffer.
*
* Discontiguous buffer support follows the layout of the underlying
* buffer. This makes the implementation as simple as possible.
*/
error = xfs_buf_item_get_format(bip, bp->b_map_count);
ASSERT(error == 0);
if (error) { /* to stop gcc throwing set-but-unused warnings */
kmem_zone_free(xfs_buf_item_zone, bip);
return error;
}
for (i = 0; i < bip->bli_format_count; i++) {
chunks = DIV_ROUND_UP(BBTOB(bp->b_maps[i].bm_len),
XFS_BLF_CHUNK);
map_size = DIV_ROUND_UP(chunks, NBWORD);
bip->bli_formats[i].blf_type = XFS_LI_BUF;
bip->bli_formats[i].blf_blkno = bp->b_maps[i].bm_bn;
bip->bli_formats[i].blf_len = bp->b_maps[i].bm_len;
bip->bli_formats[i].blf_map_size = map_size;
}
/*
* Put the buf item into the list of items attached to the
* buffer at the front.
*/
if (bp->b_fspriv)
bip->bli_item.li_bio_list = bp->b_fspriv;
bp->b_fspriv = bip;
xfs_buf_hold(bp);
return 0;
}
/*
* Mark bytes first through last inclusive as dirty in the buf
* item's bitmap.
*/
static void
xfs_buf_item_log_segment(
uint first,
uint last,
uint *map)
{
uint first_bit;
uint last_bit;
uint bits_to_set;
uint bits_set;
uint word_num;
uint *wordp;
uint bit;
uint end_bit;
uint mask;
/*
* Convert byte offsets to bit numbers.
*/
first_bit = first >> XFS_BLF_SHIFT;
last_bit = last >> XFS_BLF_SHIFT;
/*
* Calculate the total number of bits to be set.
*/
bits_to_set = last_bit - first_bit + 1;
/*
* Get a pointer to the first word in the bitmap
* to set a bit in.
*/
word_num = first_bit >> BIT_TO_WORD_SHIFT;
wordp = &map[word_num];
/*
* Calculate the starting bit in the first word.
*/
bit = first_bit & (uint)(NBWORD - 1);
/*
* First set any bits in the first word of our range.
* If it starts at bit 0 of the word, it will be
* set below rather than here. That is what the variable
* bit tells us. The variable bits_set tracks the number
* of bits that have been set so far. End_bit is the number
* of the last bit to be set in this word plus one.
*/
if (bit) {
end_bit = MIN(bit + bits_to_set, (uint)NBWORD);
mask = ((1U << (end_bit - bit)) - 1) << bit;
*wordp |= mask;
wordp++;
bits_set = end_bit - bit;
} else {
bits_set = 0;
}
/*
* Now set bits a whole word at a time that are between
* first_bit and last_bit.
*/
while ((bits_to_set - bits_set) >= NBWORD) {
*wordp |= 0xffffffff;
bits_set += NBWORD;
wordp++;
}
/*
* Finally, set any bits left to be set in one last partial word.
*/
end_bit = bits_to_set - bits_set;
if (end_bit) {
mask = (1U << end_bit) - 1;
*wordp |= mask;
}
}
/*
* Mark bytes first through last inclusive as dirty in the buf
* item's bitmap.
*/
void
xfs_buf_item_log(
xfs_buf_log_item_t *bip,
uint first,
uint last)
{
int i;
uint start;
uint end;
struct xfs_buf *bp = bip->bli_buf;
/*
* walk each buffer segment and mark them dirty appropriately.
*/
start = 0;
for (i = 0; i < bip->bli_format_count; i++) {
if (start > last)
break;
end = start + BBTOB(bp->b_maps[i].bm_len) - 1;
/* skip to the map that includes the first byte to log */
if (first > end) {
start += BBTOB(bp->b_maps[i].bm_len);
continue;
}
/*
* Trim the range to this segment and mark it in the bitmap.
* Note that we must convert buffer offsets to segment relative
* offsets (e.g., the first byte of each segment is byte 0 of
* that segment).
*/
if (first < start)
first = start;
if (end > last)
end = last;
xfs_buf_item_log_segment(first - start, end - start,
&bip->bli_formats[i].blf_data_map[0]);
start += BBTOB(bp->b_maps[i].bm_len);
}
}
/*
* Return 1 if the buffer has been logged or ordered in a transaction (at any
* point, not just the current transaction) and 0 if not.
*/
uint
xfs_buf_item_dirty(
xfs_buf_log_item_t *bip)
{
return (bip->bli_flags & XFS_BLI_DIRTY);
}
STATIC void
xfs_buf_item_free(
xfs_buf_log_item_t *bip)
{
xfs_buf_item_free_format(bip);
kmem_free(bip->bli_item.li_lv_shadow);
kmem_zone_free(xfs_buf_item_zone, bip);
}
/*
* This is called when the buf log item is no longer needed. It should
* free the buf log item associated with the given buffer and clear
* the buffer's pointer to the buf log item. If there are no more
* items in the list, clear the b_iodone field of the buffer (see
* xfs_buf_attach_iodone() below).
*/
void
xfs_buf_item_relse(
xfs_buf_t *bp)
{
xfs_buf_log_item_t *bip = bp->b_fspriv;
trace_xfs_buf_item_relse(bp, _RET_IP_);
ASSERT(!(bip->bli_item.li_flags & XFS_LI_IN_AIL));
bp->b_fspriv = bip->bli_item.li_bio_list;
if (bp->b_fspriv == NULL)
bp->b_iodone = NULL;
xfs_buf_rele(bp);
xfs_buf_item_free(bip);
}
/*
* Add the given log item with its callback to the list of callbacks
* to be called when the buffer's I/O completes. If it is not set
* already, set the buffer's b_iodone() routine to be
* xfs_buf_iodone_callbacks() and link the log item into the list of
* items rooted at b_fsprivate. Items are always added as the second
* entry in the list if there is a first, because the buf item code
* assumes that the buf log item is first.
*/
void
xfs_buf_attach_iodone(
xfs_buf_t *bp,
void (*cb)(xfs_buf_t *, xfs_log_item_t *),
xfs_log_item_t *lip)
{
xfs_log_item_t *head_lip;
ASSERT(xfs_buf_islocked(bp));
lip->li_cb = cb;
head_lip = bp->b_fspriv;
if (head_lip) {
lip->li_bio_list = head_lip->li_bio_list;
head_lip->li_bio_list = lip;
} else {
bp->b_fspriv = lip;
}
ASSERT(bp->b_iodone == NULL ||
bp->b_iodone == xfs_buf_iodone_callbacks);
bp->b_iodone = xfs_buf_iodone_callbacks;
}
/*
* We can have many callbacks on a buffer. Running the callbacks individually
* can cause a lot of contention on the AIL lock, so we allow for a single
* callback to be able to scan the remaining lip->li_bio_list for other items
* of the same type and callback to be processed in the first call.
*
* As a result, the loop walking the callback list below will also modify the
* list. it removes the first item from the list and then runs the callback.
* The loop then restarts from the new head of the list. This allows the
* callback to scan and modify the list attached to the buffer and we don't
* have to care about maintaining a next item pointer.
*/
STATIC void
xfs_buf_do_callbacks(
struct xfs_buf *bp)
{
struct xfs_log_item *lip;
while ((lip = bp->b_fspriv) != NULL) {
bp->b_fspriv = lip->li_bio_list;
ASSERT(lip->li_cb != NULL);
/*
* Clear the next pointer so we don't have any
* confusion if the item is added to another buf.
* Don't touch the log item after calling its
* callback, because it could have freed itself.
*/
lip->li_bio_list = NULL;
lip->li_cb(bp, lip);
}
}
static bool
xfs_buf_iodone_callback_error(
struct xfs_buf *bp)
{
struct xfs_log_item *lip = bp->b_fspriv;
struct xfs_mount *mp = lip->li_mountp;
static ulong lasttime;
static xfs_buftarg_t *lasttarg;
struct xfs_error_cfg *cfg;
/*
* If we've already decided to shutdown the filesystem because of
* I/O errors, there's no point in giving this a retry.
*/
if (XFS_FORCED_SHUTDOWN(mp))
goto out_stale;
if (bp->b_target != lasttarg ||
time_after(jiffies, (lasttime + 5*HZ))) {
lasttime = jiffies;
xfs_buf_ioerror_alert(bp, __func__);
}
lasttarg = bp->b_target;
/* synchronous writes will have callers process the error */
if (!(bp->b_flags & XBF_ASYNC))
goto out_stale;
trace_xfs_buf_item_iodone_async(bp, _RET_IP_);
ASSERT(bp->b_iodone != NULL);
cfg = xfs_error_get_cfg(mp, XFS_ERR_METADATA, bp->b_error);
/*
* If the write was asynchronous then no one will be looking for the
* error. If this is the first failure of this type, clear the error
* state and write the buffer out again. This means we always retry an
* async write failure at least once, but we also need to set the buffer
* up to behave correctly now for repeated failures.
*/
if (!(bp->b_flags & (XBF_STALE | XBF_WRITE_FAIL)) ||
bp->b_last_error != bp->b_error) {
bp->b_flags |= (XBF_WRITE | XBF_DONE | XBF_WRITE_FAIL);
bp->b_last_error = bp->b_error;
if (cfg->retry_timeout != XFS_ERR_RETRY_FOREVER &&
!bp->b_first_retry_time)
bp->b_first_retry_time = jiffies;
xfs_buf_ioerror(bp, 0);
xfs_buf_submit(bp);
return true;
}
/*
* Repeated failure on an async write. Take action according to the
* error configuration we have been set up to use.
*/
if (cfg->max_retries != XFS_ERR_RETRY_FOREVER &&
++bp->b_retries > cfg->max_retries)
goto permanent_error;
if (cfg->retry_timeout != XFS_ERR_RETRY_FOREVER &&
time_after(jiffies, cfg->retry_timeout + bp->b_first_retry_time))
goto permanent_error;
/* At unmount we may treat errors differently */
if ((mp->m_flags & XFS_MOUNT_UNMOUNTING) && mp->m_fail_unmount)
goto permanent_error;
/* still a transient error, higher layers will retry */
xfs_buf_ioerror(bp, 0);
xfs_buf_relse(bp);
return true;
/*
* Permanent error - we need to trigger a shutdown if we haven't already
* to indicate that inconsistency will result from this action.
*/
permanent_error:
xfs_force_shutdown(mp, SHUTDOWN_META_IO_ERROR);
out_stale:
xfs_buf_stale(bp);
bp->b_flags |= XBF_DONE;
trace_xfs_buf_error_relse(bp, _RET_IP_);
return false;
}
/*
* This is the iodone() function for buffers which have had callbacks attached
* to them by xfs_buf_attach_iodone(). We need to iterate the items on the
* callback list, mark the buffer as having no more callbacks and then push the
* buffer through IO completion processing.
*/
void
xfs_buf_iodone_callbacks(
struct xfs_buf *bp)
{
/*
* If there is an error, process it. Some errors require us
* to run callbacks after failure processing is done so we
* detect that and take appropriate action.
*/
if (bp->b_error && xfs_buf_iodone_callback_error(bp))
return;
/*
* Successful IO or permanent error. Either way, we can clear the
* retry state here in preparation for the next error that may occur.
*/
bp->b_last_error = 0;
bp->b_retries = 0;
xfs_buf_do_callbacks(bp);
bp->b_fspriv = NULL;
bp->b_iodone = NULL;
xfs_buf_ioend(bp);
}
/*
* This is the iodone() function for buffers which have been
* logged. It is called when they are eventually flushed out.
* It should remove the buf item from the AIL, and free the buf item.
* It is called by xfs_buf_iodone_callbacks() above which will take
* care of cleaning up the buffer itself.
*/
void
xfs_buf_iodone(
struct xfs_buf *bp,
struct xfs_log_item *lip)
{
struct xfs_ail *ailp = lip->li_ailp;
ASSERT(BUF_ITEM(lip)->bli_buf == bp);
xfs_buf_rele(bp);
/*
* If we are forcibly shutting down, this may well be
* off the AIL already. That's because we simulate the
* log-committed callbacks to unpin these buffers. Or we may never
* have put this item on AIL because of the transaction was
* aborted forcibly. xfs_trans_ail_delete() takes care of these.
*
* Either way, AIL is useless if we're forcing a shutdown.
*/
spin_lock(&ailp->xa_lock);
xfs_trans_ail_delete(ailp, lip, SHUTDOWN_CORRUPT_INCORE);
xfs_buf_item_free(BUF_ITEM(lip));
}
|
package testing
import (
"testing"
"github.com/gophercloud/gophercloud/openstack/compute/v2/extensions/networks"
"github.com/gophercloud/gophercloud/pagination"
th "github.com/gophercloud/gophercloud/testhelper"
"github.com/gophercloud/gophercloud/testhelper/client"
)
func TestList(t *testing.T) {
th.SetupHTTP()
defer th.TeardownHTTP()
HandleListSuccessfully(t)
count := 0
err := networks.List(client.ServiceClient()).EachPage(func(page pagination.Page) (bool, error) {
count++
actual, err := networks.ExtractNetworks(page)
th.AssertNoErr(t, err)
th.CheckDeepEquals(t, ExpectedNetworkSlice, actual)
return true, nil
})
th.AssertNoErr(t, err)
th.CheckEquals(t, 1, count)
}
func TestGet(t *testing.T) {
th.SetupHTTP()
defer th.TeardownHTTP()
HandleGetSuccessfully(t)
actual, err := networks.Get(client.ServiceClient(), "20c8acc0-f747-4d71-a389-46d078ebf000").Extract()
th.AssertNoErr(t, err)
th.CheckDeepEquals(t, &SecondNetwork, actual)
}
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.10"/>
<title>0.9.7: GLM_GTX_quaternion</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectlogo"><img alt="Logo" src="logo.png"/></td>
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">0.9.7
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.10 -->
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="modules.html"><span>Modules</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#func-members">Functions</a> </div>
<div class="headertitle">
<div class="title">GLM_GTX_quaternion<div class="ingroups"><a class="el" href="a00161.html">GTX Extensions (Experimental)</a></div></div> </div>
</div><!--header-->
<div class="contents">
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:ga33ecf8ba903eee5fc09f0fbfc0d5ca6b"><td class="memTemplParams" colspan="2">template<typename T , precision P> </td></tr>
<tr class="memitem:ga33ecf8ba903eee5fc09f0fbfc0d5ca6b"><td class="memTemplItemLeft" align="right" valign="top">GLM_FUNC_DECL tvec3< T, P > </td><td class="memTemplItemRight" valign="bottom"><a class="el" href="a00224.html#ga33ecf8ba903eee5fc09f0fbfc0d5ca6b">cross</a> (tquat< T, P > const &q, tvec3< T, P > const &v)</td></tr>
<tr class="separator:ga33ecf8ba903eee5fc09f0fbfc0d5ca6b"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga4bfe3c7770fc43d14b8ef0058c4a86b5"><td class="memTemplParams" colspan="2">template<typename T , precision P> </td></tr>
<tr class="memitem:ga4bfe3c7770fc43d14b8ef0058c4a86b5"><td class="memTemplItemLeft" align="right" valign="top">GLM_FUNC_DECL tvec3< T, P > </td><td class="memTemplItemRight" valign="bottom"><a class="el" href="a00224.html#ga4bfe3c7770fc43d14b8ef0058c4a86b5">cross</a> (tvec3< T, P > const &v, tquat< T, P > const &q)</td></tr>
<tr class="separator:ga4bfe3c7770fc43d14b8ef0058c4a86b5"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga17295173d4c2b5ae49b84e9993b63a62"><td class="memTemplParams" colspan="2">template<typename T , precision P> </td></tr>
<tr class="memitem:ga17295173d4c2b5ae49b84e9993b63a62"><td class="memTemplItemLeft" align="right" valign="top">GLM_FUNC_DECL tquat< T, P > </td><td class="memTemplItemRight" valign="bottom"><a class="el" href="a00224.html#ga17295173d4c2b5ae49b84e9993b63a62">exp</a> (tquat< T, P > const &q)</td></tr>
<tr class="separator:ga17295173d4c2b5ae49b84e9993b63a62"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga90de879d97487ec804522dd418e5d8a0"><td class="memTemplParams" colspan="2">template<typename T , precision P> </td></tr>
<tr class="memitem:ga90de879d97487ec804522dd418e5d8a0"><td class="memTemplItemLeft" align="right" valign="top">GLM_FUNC_DECL T </td><td class="memTemplItemRight" valign="bottom"><a class="el" href="a00224.html#ga90de879d97487ec804522dd418e5d8a0">extractRealComponent</a> (tquat< T, P > const &q)</td></tr>
<tr class="separator:ga90de879d97487ec804522dd418e5d8a0"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:gac11bf550f17d1da14423595a27575084"><td class="memTemplParams" colspan="2">template<typename T , precision P> </td></tr>
<tr class="memitem:gac11bf550f17d1da14423595a27575084"><td class="memTemplItemLeft" align="right" valign="top">GLM_FUNC_DECL tquat< T, P > </td><td class="memTemplItemRight" valign="bottom"><a class="el" href="a00224.html#gac11bf550f17d1da14423595a27575084">fastMix</a> (tquat< T, P > const &x, tquat< T, P > const &y, T const &a)</td></tr>
<tr class="separator:gac11bf550f17d1da14423595a27575084"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga56abae85b3669c866e91f3c57b298b9c"><td class="memTemplParams" colspan="2">template<typename T , precision P> </td></tr>
<tr class="memitem:ga56abae85b3669c866e91f3c57b298b9c"><td class="memTemplItemLeft" align="right" valign="top">GLM_FUNC_DECL tquat< T, P > </td><td class="memTemplItemRight" valign="bottom"><a class="el" href="a00224.html#ga56abae85b3669c866e91f3c57b298b9c">intermediate</a> (tquat< T, P > const &prev, tquat< T, P > const &curr, tquat< T, P > const &next)</td></tr>
<tr class="separator:ga56abae85b3669c866e91f3c57b298b9c"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga02b45352c7ac345cabc9e877314acda6"><td class="memTemplParams" colspan="2">template<typename T , precision P> </td></tr>
<tr class="memitem:ga02b45352c7ac345cabc9e877314acda6"><td class="memTemplItemLeft" align="right" valign="top">GLM_FUNC_DECL T </td><td class="memTemplItemRight" valign="bottom"><a class="el" href="a00224.html#ga02b45352c7ac345cabc9e877314acda6">length2</a> (tquat< T, P > const &q)</td></tr>
<tr class="separator:ga02b45352c7ac345cabc9e877314acda6"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga791f42e134bfe97fc9c96f4668dd7489"><td class="memTemplParams" colspan="2">template<typename T , precision P> </td></tr>
<tr class="memitem:ga791f42e134bfe97fc9c96f4668dd7489"><td class="memTemplItemLeft" align="right" valign="top">GLM_FUNC_DECL tquat< T, P > </td><td class="memTemplItemRight" valign="bottom"><a class="el" href="a00224.html#ga791f42e134bfe97fc9c96f4668dd7489">log</a> (tquat< T, P > const &q)</td></tr>
<tr class="separator:ga791f42e134bfe97fc9c96f4668dd7489"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga42a0cf206c59eaeff4c67dd62e09a580"><td class="memTemplParams" colspan="2">template<typename T , precision P> </td></tr>
<tr class="memitem:ga42a0cf206c59eaeff4c67dd62e09a580"><td class="memTemplItemLeft" align="right" valign="top">GLM_FUNC_DECL tquat< T, P > </td><td class="memTemplItemRight" valign="bottom"><a class="el" href="a00224.html#ga42a0cf206c59eaeff4c67dd62e09a580">pow</a> (tquat< T, P > const &x, T const &y)</td></tr>
<tr class="separator:ga42a0cf206c59eaeff4c67dd62e09a580"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga9f39f0d3ecd66839a4af44560aa10fb2"><td class="memTemplParams" colspan="2">template<typename T , precision P> </td></tr>
<tr class="memitem:ga9f39f0d3ecd66839a4af44560aa10fb2"><td class="memTemplItemLeft" align="right" valign="top">GLM_FUNC_DECL tvec3< T, P > </td><td class="memTemplItemRight" valign="bottom"><a class="el" href="a00224.html#ga9f39f0d3ecd66839a4af44560aa10fb2">rotate</a> (tquat< T, P > const &q, tvec3< T, P > const &v)</td></tr>
<tr class="separator:ga9f39f0d3ecd66839a4af44560aa10fb2"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga96575f8868b3f2aa3e13cab9b94ccbd3"><td class="memTemplParams" colspan="2">template<typename T , precision P> </td></tr>
<tr class="memitem:ga96575f8868b3f2aa3e13cab9b94ccbd3"><td class="memTemplItemLeft" align="right" valign="top">GLM_FUNC_DECL tvec4< T, P > </td><td class="memTemplItemRight" valign="bottom"><a class="el" href="a00224.html#ga96575f8868b3f2aa3e13cab9b94ccbd3">rotate</a> (tquat< T, P > const &q, tvec4< T, P > const &v)</td></tr>
<tr class="separator:ga96575f8868b3f2aa3e13cab9b94ccbd3"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:gac4856d356c5c97cec74e9b672ea89240"><td class="memTemplParams" colspan="2">template<typename T , precision P> </td></tr>
<tr class="memitem:gac4856d356c5c97cec74e9b672ea89240"><td class="memTemplItemLeft" align="right" valign="top">GLM_FUNC_DECL tquat< T, P > </td><td class="memTemplItemRight" valign="bottom"><a class="el" href="a00224.html#gac4856d356c5c97cec74e9b672ea89240">rotation</a> (tvec3< T, P > const &orig, tvec3< T, P > const &dest)</td></tr>
<tr class="separator:gac4856d356c5c97cec74e9b672ea89240"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga3534443de2a1a806f386976546cddc81"><td class="memTemplParams" colspan="2">template<typename T , precision P> </td></tr>
<tr class="memitem:ga3534443de2a1a806f386976546cddc81"><td class="memTemplItemLeft" align="right" valign="top">GLM_FUNC_DECL tquat< T, P > </td><td class="memTemplItemRight" valign="bottom"><a class="el" href="a00224.html#ga3534443de2a1a806f386976546cddc81">shortMix</a> (tquat< T, P > const &x, tquat< T, P > const &y, T const &a)</td></tr>
<tr class="separator:ga3534443de2a1a806f386976546cddc81"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:gae75f537becdf2b1381b4482ec96e6c82"><td class="memTemplParams" colspan="2">template<typename T , precision P> </td></tr>
<tr class="memitem:gae75f537becdf2b1381b4482ec96e6c82"><td class="memTemplItemLeft" align="right" valign="top">GLM_FUNC_DECL tquat< T, P > </td><td class="memTemplItemRight" valign="bottom"><a class="el" href="a00224.html#gae75f537becdf2b1381b4482ec96e6c82">squad</a> (tquat< T, P > const &q1, tquat< T, P > const &q2, tquat< T, P > const &s1, tquat< T, P > const &s2, T const &h)</td></tr>
<tr class="separator:gae75f537becdf2b1381b4482ec96e6c82"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga01935b66ba245c2fd7dee5427d86ce9b"><td class="memTemplParams" colspan="2">template<typename T , precision P> </td></tr>
<tr class="memitem:ga01935b66ba245c2fd7dee5427d86ce9b"><td class="memTemplItemLeft" align="right" valign="top">GLM_FUNC_DECL tmat3x3< T, P > </td><td class="memTemplItemRight" valign="bottom"><a class="el" href="a00224.html#ga01935b66ba245c2fd7dee5427d86ce9b">toMat3</a> (tquat< T, P > const &x)</td></tr>
<tr class="separator:ga01935b66ba245c2fd7dee5427d86ce9b"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:gaedc9fba6485eade37cc26c16df9d7aad"><td class="memTemplParams" colspan="2">template<typename T , precision P> </td></tr>
<tr class="memitem:gaedc9fba6485eade37cc26c16df9d7aad"><td class="memTemplItemLeft" align="right" valign="top">GLM_FUNC_DECL tmat4x4< T, P > </td><td class="memTemplItemRight" valign="bottom"><a class="el" href="a00224.html#gaedc9fba6485eade37cc26c16df9d7aad">toMat4</a> (tquat< T, P > const &x)</td></tr>
<tr class="separator:gaedc9fba6485eade37cc26c16df9d7aad"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:gac9e3109ca60b644ce508d6b71a1697bc"><td class="memTemplParams" colspan="2">template<typename T , precision P> </td></tr>
<tr class="memitem:gac9e3109ca60b644ce508d6b71a1697bc"><td class="memTemplItemLeft" align="right" valign="top">GLM_FUNC_DECL tquat< T, P > </td><td class="memTemplItemRight" valign="bottom"><a class="el" href="a00224.html#gac9e3109ca60b644ce508d6b71a1697bc">toQuat</a> (tmat3x3< T, P > const &x)</td></tr>
<tr class="separator:gac9e3109ca60b644ce508d6b71a1697bc"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga808dd0f83ee8150db7e652313bde8eb2"><td class="memTemplParams" colspan="2">template<typename T , precision P> </td></tr>
<tr class="memitem:ga808dd0f83ee8150db7e652313bde8eb2"><td class="memTemplItemLeft" align="right" valign="top">GLM_FUNC_DECL tquat< T, P > </td><td class="memTemplItemRight" valign="bottom"><a class="el" href="a00224.html#ga808dd0f83ee8150db7e652313bde8eb2">toQuat</a> (tmat4x4< T, P > const &x)</td></tr>
<tr class="separator:ga808dd0f83ee8150db7e652313bde8eb2"><td class="memSeparator" colspan="2"> </td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<p>Extented quaternion types and functions. </p>
<p><<a class="el" href="a00095.html" title="OpenGL Mathematics (glm.g-truc.net) ">glm/gtx/quaternion.hpp</a>> need to be included to use these functionalities. </p>
<h2 class="groupheader">Function Documentation</h2>
<a class="anchor" id="ga33ecf8ba903eee5fc09f0fbfc0d5ca6b"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">GLM_FUNC_DECL tvec3<T, P> glm::cross </td>
<td>(</td>
<td class="paramtype">tquat< T, P > const & </td>
<td class="paramname"><em>q</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">tvec3< T, P > const & </td>
<td class="paramname"><em>v</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Compute a cross product between a quaternion and a vector. </p>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="a00224.html" title="Extented quaternion types and functions. ">GLM_GTX_quaternion</a> </dd></dl>
</div>
</div>
<a class="anchor" id="ga4bfe3c7770fc43d14b8ef0058c4a86b5"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">GLM_FUNC_DECL tvec3<T, P> glm::cross </td>
<td>(</td>
<td class="paramtype">tvec3< T, P > const & </td>
<td class="paramname"><em>v</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">tquat< T, P > const & </td>
<td class="paramname"><em>q</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Compute a cross product between a vector and a quaternion. </p>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="a00224.html" title="Extented quaternion types and functions. ">GLM_GTX_quaternion</a> </dd></dl>
</div>
</div>
<a class="anchor" id="ga17295173d4c2b5ae49b84e9993b63a62"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">GLM_FUNC_DECL tquat<T, P> glm::exp </td>
<td>(</td>
<td class="paramtype">tquat< T, P > const & </td>
<td class="paramname"><em>q</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Returns a exp of a quaternion. </p>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="a00224.html" title="Extented quaternion types and functions. ">GLM_GTX_quaternion</a> </dd></dl>
</div>
</div>
<a class="anchor" id="ga90de879d97487ec804522dd418e5d8a0"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">GLM_FUNC_DECL T glm::extractRealComponent </td>
<td>(</td>
<td class="paramtype">tquat< T, P > const & </td>
<td class="paramname"><em>q</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Extract the real component of a quaternion. </p>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="a00224.html" title="Extented quaternion types and functions. ">GLM_GTX_quaternion</a> </dd></dl>
</div>
</div>
<a class="anchor" id="gac11bf550f17d1da14423595a27575084"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">GLM_FUNC_DECL tquat<T, P> glm::fastMix </td>
<td>(</td>
<td class="paramtype">tquat< T, P > const & </td>
<td class="paramname"><em>x</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">tquat< T, P > const & </td>
<td class="paramname"><em>y</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">T const & </td>
<td class="paramname"><em>a</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Quaternion normalized linear interpolation. </p>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="a00224.html" title="Extented quaternion types and functions. ">GLM_GTX_quaternion</a> </dd></dl>
</div>
</div>
<a class="anchor" id="ga56abae85b3669c866e91f3c57b298b9c"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">GLM_FUNC_DECL tquat<T, P> glm::intermediate </td>
<td>(</td>
<td class="paramtype">tquat< T, P > const & </td>
<td class="paramname"><em>prev</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">tquat< T, P > const & </td>
<td class="paramname"><em>curr</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">tquat< T, P > const & </td>
<td class="paramname"><em>next</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Returns an intermediate control point for squad interpolation. </p>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="a00224.html" title="Extented quaternion types and functions. ">GLM_GTX_quaternion</a> </dd></dl>
</div>
</div>
<a class="anchor" id="ga02b45352c7ac345cabc9e877314acda6"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">GLM_FUNC_DECL T glm::length2 </td>
<td>(</td>
<td class="paramtype">tquat< T, P > const & </td>
<td class="paramname"><em>q</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Returns the squared length of x. </p>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="a00224.html" title="Extented quaternion types and functions. ">GLM_GTX_quaternion</a> </dd></dl>
</div>
</div>
<a class="anchor" id="ga791f42e134bfe97fc9c96f4668dd7489"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">GLM_FUNC_DECL tquat<T, P> glm::log </td>
<td>(</td>
<td class="paramtype">tquat< T, P > const & </td>
<td class="paramname"><em>q</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Returns a log of a quaternion. </p>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="a00224.html" title="Extented quaternion types and functions. ">GLM_GTX_quaternion</a> </dd></dl>
</div>
</div>
<a class="anchor" id="ga42a0cf206c59eaeff4c67dd62e09a580"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">GLM_FUNC_DECL tquat<T, P> glm::pow </td>
<td>(</td>
<td class="paramtype">tquat< T, P > const & </td>
<td class="paramname"><em>x</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">T const & </td>
<td class="paramname"><em>y</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Returns x raised to the y power. </p>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="a00224.html" title="Extented quaternion types and functions. ">GLM_GTX_quaternion</a> </dd></dl>
</div>
</div>
<a class="anchor" id="ga9f39f0d3ecd66839a4af44560aa10fb2"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">GLM_FUNC_DECL tvec3<T, P> glm::rotate </td>
<td>(</td>
<td class="paramtype">tquat< T, P > const & </td>
<td class="paramname"><em>q</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">tvec3< T, P > const & </td>
<td class="paramname"><em>v</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Returns quarternion square root. </p>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="a00224.html" title="Extented quaternion types and functions. ">GLM_GTX_quaternion</a> Rotates a 3 components vector by a quaternion.</dd>
<dd>
<a class="el" href="a00224.html" title="Extented quaternion types and functions. ">GLM_GTX_quaternion</a> </dd></dl>
</div>
</div>
<a class="anchor" id="ga96575f8868b3f2aa3e13cab9b94ccbd3"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">GLM_FUNC_DECL tvec4<T, P> glm::rotate </td>
<td>(</td>
<td class="paramtype">tquat< T, P > const & </td>
<td class="paramname"><em>q</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">tvec4< T, P > const & </td>
<td class="paramname"><em>v</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Rotates a 4 components vector by a quaternion. </p>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="a00224.html" title="Extented quaternion types and functions. ">GLM_GTX_quaternion</a> </dd></dl>
</div>
</div>
<a class="anchor" id="gac4856d356c5c97cec74e9b672ea89240"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">GLM_FUNC_DECL tquat<T, P> glm::rotation </td>
<td>(</td>
<td class="paramtype">tvec3< T, P > const & </td>
<td class="paramname"><em>orig</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">tvec3< T, P > const & </td>
<td class="paramname"><em>dest</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Compute the rotation between two vectors. </p>
<p>param orig vector, needs to be normalized param dest vector, needs to be normalized</p>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="a00224.html" title="Extented quaternion types and functions. ">GLM_GTX_quaternion</a> </dd></dl>
</div>
</div>
<a class="anchor" id="ga3534443de2a1a806f386976546cddc81"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">GLM_FUNC_DECL tquat<T, P> glm::shortMix </td>
<td>(</td>
<td class="paramtype">tquat< T, P > const & </td>
<td class="paramname"><em>x</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">tquat< T, P > const & </td>
<td class="paramname"><em>y</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">T const & </td>
<td class="paramname"><em>a</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Quaternion interpolation using the rotation short path. </p>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="a00224.html" title="Extented quaternion types and functions. ">GLM_GTX_quaternion</a> </dd></dl>
</div>
</div>
<a class="anchor" id="gae75f537becdf2b1381b4482ec96e6c82"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">GLM_FUNC_DECL tquat<T, P> glm::squad </td>
<td>(</td>
<td class="paramtype">tquat< T, P > const & </td>
<td class="paramname"><em>q1</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">tquat< T, P > const & </td>
<td class="paramname"><em>q2</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">tquat< T, P > const & </td>
<td class="paramname"><em>s1</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">tquat< T, P > const & </td>
<td class="paramname"><em>s2</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">T const & </td>
<td class="paramname"><em>h</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Compute a point on a path according squad equation. </p>
<p>q1 and q2 are control points; s1 and s2 are intermediate control points.</p>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="a00224.html" title="Extented quaternion types and functions. ">GLM_GTX_quaternion</a> </dd></dl>
</div>
</div>
<a class="anchor" id="ga01935b66ba245c2fd7dee5427d86ce9b"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">GLM_FUNC_DECL tmat3x3<T, P> glm::toMat3 </td>
<td>(</td>
<td class="paramtype">tquat< T, P > const & </td>
<td class="paramname"><em>x</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Converts a quaternion to a 3 * 3 matrix. </p>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="a00224.html" title="Extented quaternion types and functions. ">GLM_GTX_quaternion</a> </dd></dl>
<p>Definition at line <a class="el" href="a00095_source.html#l00153">153</a> of file <a class="el" href="a00095_source.html">gtx/quaternion.hpp</a>.</p>
<p>References <a class="el" href="a00177.html#gae04c39422eb4e450ec8c4f45a1057b40">glm::mat3_cast()</a>.</p>
</div>
</div>
<a class="anchor" id="gaedc9fba6485eade37cc26c16df9d7aad"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">GLM_FUNC_DECL tmat4x4<T, P> glm::toMat4 </td>
<td>(</td>
<td class="paramtype">tquat< T, P > const & </td>
<td class="paramname"><em>x</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Converts a quaternion to a 4 * 4 matrix. </p>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="a00224.html" title="Extented quaternion types and functions. ">GLM_GTX_quaternion</a> </dd></dl>
<p>Definition at line <a class="el" href="a00095_source.html#l00160">160</a> of file <a class="el" href="a00095_source.html">gtx/quaternion.hpp</a>.</p>
<p>References <a class="el" href="a00177.html#ga14bb2ddf028c91542763eb6f2bba47ef">glm::mat4_cast()</a>.</p>
</div>
</div>
<a class="anchor" id="gac9e3109ca60b644ce508d6b71a1697bc"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">GLM_FUNC_DECL tquat<T, P> glm::toQuat </td>
<td>(</td>
<td class="paramtype">tmat3x3< T, P > const & </td>
<td class="paramname"><em>x</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Converts a 3 * 3 matrix to a quaternion. </p>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="a00224.html" title="Extented quaternion types and functions. ">GLM_GTX_quaternion</a> </dd></dl>
<p>Definition at line <a class="el" href="a00095_source.html#l00167">167</a> of file <a class="el" href="a00095_source.html">gtx/quaternion.hpp</a>.</p>
<p>References <a class="el" href="a00177.html#ga950f8acff3e33bbda77895a3dcb7e5ce">glm::quat_cast()</a>.</p>
</div>
</div>
<a class="anchor" id="ga808dd0f83ee8150db7e652313bde8eb2"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">GLM_FUNC_DECL tquat<T, P> glm::toQuat </td>
<td>(</td>
<td class="paramtype">tmat4x4< T, P > const & </td>
<td class="paramname"><em>x</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Converts a 4 * 4 matrix to a quaternion. </p>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="a00224.html" title="Extented quaternion types and functions. ">GLM_GTX_quaternion</a> </dd></dl>
<p>Definition at line <a class="el" href="a00095_source.html#l00174">174</a> of file <a class="el" href="a00095_source.html">gtx/quaternion.hpp</a>.</p>
<p>References <a class="el" href="a00177.html#ga950f8acff3e33bbda77895a3dcb7e5ce">glm::quat_cast()</a>.</p>
</div>
</div>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.10
</small></address>
</body>
</html>
|
/*
* Disk Array driver for HP Smart Array SAS controllers
* Copyright 2000, 2009 Hewlett-Packard Development Company, L.P.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
* NON INFRINGEMENT. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* Questions/Comments/Bugfixes to iss_storagedev@hp.com
*
*/
#include <linux/module.h>
#include <linux/interrupt.h>
#include <linux/types.h>
#include <linux/pci.h>
#include <linux/pci-aspm.h>
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/delay.h>
#include <linux/fs.h>
#include <linux/timer.h>
#include <linux/seq_file.h>
#include <linux/init.h>
#include <linux/spinlock.h>
#include <linux/compat.h>
#include <linux/blktrace_api.h>
#include <linux/uaccess.h>
#include <linux/io.h>
#include <linux/dma-mapping.h>
#include <linux/completion.h>
#include <linux/moduleparam.h>
#include <scsi/scsi.h>
#include <scsi/scsi_cmnd.h>
#include <scsi/scsi_device.h>
#include <scsi/scsi_host.h>
#include <scsi/scsi_tcq.h>
#include <linux/cciss_ioctl.h>
#include <linux/string.h>
#include <linux/bitmap.h>
#include <linux/atomic.h>
#include <linux/kthread.h>
#include <linux/jiffies.h>
#include "hpsa_cmd.h"
#include "hpsa.h"
/* HPSA_DRIVER_VERSION must be 3 byte values (0-255) separated by '.' */
#define HPSA_DRIVER_VERSION "2.0.2-1"
#define DRIVER_NAME "HP HPSA Driver (v " HPSA_DRIVER_VERSION ")"
/* How long to wait (in milliseconds) for board to go into simple mode */
#define MAX_CONFIG_WAIT 30000
#define MAX_IOCTL_CONFIG_WAIT 1000
/*define how many times we will try a command because of bus resets */
#define MAX_CMD_RETRIES 3
/* Embedded module documentation macros - see modules.h */
MODULE_AUTHOR("Hewlett-Packard Company");
MODULE_DESCRIPTION("Driver for HP Smart Array Controller version " \
HPSA_DRIVER_VERSION);
MODULE_SUPPORTED_DEVICE("HP Smart Array Controllers");
MODULE_VERSION(HPSA_DRIVER_VERSION);
MODULE_LICENSE("GPL");
static int hpsa_allow_any;
module_param(hpsa_allow_any, int, S_IRUGO|S_IWUSR);
MODULE_PARM_DESC(hpsa_allow_any,
"Allow hpsa driver to access unknown HP Smart Array hardware");
static int hpsa_simple_mode;
module_param(hpsa_simple_mode, int, S_IRUGO|S_IWUSR);
MODULE_PARM_DESC(hpsa_simple_mode,
"Use 'simple mode' rather than 'performant mode'");
/* define the PCI info for the cards we can control */
static const struct pci_device_id hpsa_pci_device_id[] = {
{PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSE, 0x103C, 0x3241},
{PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSE, 0x103C, 0x3243},
{PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSE, 0x103C, 0x3245},
{PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSE, 0x103C, 0x3247},
{PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSE, 0x103C, 0x3249},
{PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSE, 0x103C, 0x324a},
{PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSE, 0x103C, 0x324b},
{PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSE, 0x103C, 0x3233},
{PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSF, 0x103C, 0x3350},
{PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSF, 0x103C, 0x3351},
{PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSF, 0x103C, 0x3352},
{PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSF, 0x103C, 0x3353},
{PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSF, 0x103C, 0x3354},
{PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSF, 0x103C, 0x3355},
{PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSF, 0x103C, 0x3356},
{PCI_VENDOR_ID_HP, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
PCI_CLASS_STORAGE_RAID << 8, 0xffff << 8, 0},
{0,}
};
MODULE_DEVICE_TABLE(pci, hpsa_pci_device_id);
/* board_id = Subsystem Device ID & Vendor ID
* product = Marketing Name for the board
* access = Address of the struct of function pointers
*/
static struct board_type products[] = {
{0x3241103C, "Smart Array P212", &SA5_access},
{0x3243103C, "Smart Array P410", &SA5_access},
{0x3245103C, "Smart Array P410i", &SA5_access},
{0x3247103C, "Smart Array P411", &SA5_access},
{0x3249103C, "Smart Array P812", &SA5_access},
{0x324a103C, "Smart Array P712m", &SA5_access},
{0x324b103C, "Smart Array P711m", &SA5_access},
{0x3350103C, "Smart Array", &SA5_access},
{0x3351103C, "Smart Array", &SA5_access},
{0x3352103C, "Smart Array", &SA5_access},
{0x3353103C, "Smart Array", &SA5_access},
{0x3354103C, "Smart Array", &SA5_access},
{0x3355103C, "Smart Array", &SA5_access},
{0x3356103C, "Smart Array", &SA5_access},
{0xFFFF103C, "Unknown Smart Array", &SA5_access},
};
static int number_of_controllers;
static struct list_head hpsa_ctlr_list = LIST_HEAD_INIT(hpsa_ctlr_list);
static spinlock_t lockup_detector_lock;
static struct task_struct *hpsa_lockup_detector;
static irqreturn_t do_hpsa_intr_intx(int irq, void *dev_id);
static irqreturn_t do_hpsa_intr_msi(int irq, void *dev_id);
static int hpsa_ioctl(struct scsi_device *dev, int cmd, void *arg);
static void start_io(struct ctlr_info *h);
#ifdef CONFIG_COMPAT
static int hpsa_compat_ioctl(struct scsi_device *dev, int cmd, void *arg);
#endif
static void cmd_free(struct ctlr_info *h, struct CommandList *c);
static void cmd_special_free(struct ctlr_info *h, struct CommandList *c);
static struct CommandList *cmd_alloc(struct ctlr_info *h);
static struct CommandList *cmd_special_alloc(struct ctlr_info *h);
static void fill_cmd(struct CommandList *c, u8 cmd, struct ctlr_info *h,
void *buff, size_t size, u8 page_code, unsigned char *scsi3addr,
int cmd_type);
static int hpsa_scsi_queue_command(struct Scsi_Host *h, struct scsi_cmnd *cmd);
static void hpsa_scan_start(struct Scsi_Host *);
static int hpsa_scan_finished(struct Scsi_Host *sh,
unsigned long elapsed_time);
static int hpsa_change_queue_depth(struct scsi_device *sdev,
int qdepth, int reason);
static int hpsa_eh_device_reset_handler(struct scsi_cmnd *scsicmd);
static int hpsa_slave_alloc(struct scsi_device *sdev);
static void hpsa_slave_destroy(struct scsi_device *sdev);
static void hpsa_update_scsi_devices(struct ctlr_info *h, int hostno);
static int check_for_unit_attention(struct ctlr_info *h,
struct CommandList *c);
static void check_ioctl_unit_attention(struct ctlr_info *h,
struct CommandList *c);
/* performant mode helper functions */
static void calc_bucket_map(int *bucket, int num_buckets,
int nsgs, int *bucket_map);
static __devinit void hpsa_put_ctlr_into_performant_mode(struct ctlr_info *h);
static inline u32 next_command(struct ctlr_info *h);
static int __devinit hpsa_find_cfg_addrs(struct pci_dev *pdev,
void __iomem *vaddr, u32 *cfg_base_addr, u64 *cfg_base_addr_index,
u64 *cfg_offset);
static int __devinit hpsa_pci_find_memory_BAR(struct pci_dev *pdev,
unsigned long *memory_bar);
static int __devinit hpsa_lookup_board_id(struct pci_dev *pdev, u32 *board_id);
static int __devinit hpsa_wait_for_board_state(struct pci_dev *pdev,
void __iomem *vaddr, int wait_for_ready);
#define BOARD_NOT_READY 0
#define BOARD_READY 1
static inline struct ctlr_info *sdev_to_hba(struct scsi_device *sdev)
{
unsigned long *priv = shost_priv(sdev->host);
return (struct ctlr_info *) *priv;
}
static inline struct ctlr_info *shost_to_hba(struct Scsi_Host *sh)
{
unsigned long *priv = shost_priv(sh);
return (struct ctlr_info *) *priv;
}
static int check_for_unit_attention(struct ctlr_info *h,
struct CommandList *c)
{
if (c->err_info->SenseInfo[2] != UNIT_ATTENTION)
return 0;
switch (c->err_info->SenseInfo[12]) {
case STATE_CHANGED:
dev_warn(&h->pdev->dev, "hpsa%d: a state change "
"detected, command retried\n", h->ctlr);
break;
case LUN_FAILED:
dev_warn(&h->pdev->dev, "hpsa%d: LUN failure "
"detected, action required\n", h->ctlr);
break;
case REPORT_LUNS_CHANGED:
dev_warn(&h->pdev->dev, "hpsa%d: report LUN data "
"changed, action required\n", h->ctlr);
/*
* Note: this REPORT_LUNS_CHANGED condition only occurs on the MSA2012.
*/
break;
case POWER_OR_RESET:
dev_warn(&h->pdev->dev, "hpsa%d: a power on "
"or device reset detected\n", h->ctlr);
break;
case UNIT_ATTENTION_CLEARED:
dev_warn(&h->pdev->dev, "hpsa%d: unit attention "
"cleared by another initiator\n", h->ctlr);
break;
default:
dev_warn(&h->pdev->dev, "hpsa%d: unknown "
"unit attention detected\n", h->ctlr);
break;
}
return 1;
}
static ssize_t host_store_rescan(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{
struct ctlr_info *h;
struct Scsi_Host *shost = class_to_shost(dev);
h = shost_to_hba(shost);
hpsa_scan_start(h->scsi_host);
return count;
}
static ssize_t host_show_firmware_revision(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct ctlr_info *h;
struct Scsi_Host *shost = class_to_shost(dev);
unsigned char *fwrev;
h = shost_to_hba(shost);
if (!h->hba_inquiry_data)
return 0;
fwrev = &h->hba_inquiry_data[32];
return snprintf(buf, 20, "%c%c%c%c\n",
fwrev[0], fwrev[1], fwrev[2], fwrev[3]);
}
static ssize_t host_show_commands_outstanding(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct Scsi_Host *shost = class_to_shost(dev);
struct ctlr_info *h = shost_to_hba(shost);
return snprintf(buf, 20, "%d\n", h->commands_outstanding);
}
static ssize_t host_show_transport_mode(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct ctlr_info *h;
struct Scsi_Host *shost = class_to_shost(dev);
h = shost_to_hba(shost);
return snprintf(buf, 20, "%s\n",
h->transMethod & CFGTBL_Trans_Performant ?
"performant" : "simple");
}
/* List of controllers which cannot be hard reset on kexec with reset_devices */
static u32 unresettable_controller[] = {
0x324a103C, /* Smart Array P712m */
0x324b103C, /* SmartArray P711m */
0x3223103C, /* Smart Array P800 */
0x3234103C, /* Smart Array P400 */
0x3235103C, /* Smart Array P400i */
0x3211103C, /* Smart Array E200i */
0x3212103C, /* Smart Array E200 */
0x3213103C, /* Smart Array E200i */
0x3214103C, /* Smart Array E200i */
0x3215103C, /* Smart Array E200i */
0x3237103C, /* Smart Array E500 */
0x323D103C, /* Smart Array P700m */
0x409C0E11, /* Smart Array 6400 */
0x409D0E11, /* Smart Array 6400 EM */
};
/* List of controllers which cannot even be soft reset */
static u32 soft_unresettable_controller[] = {
/* Exclude 640x boards. These are two pci devices in one slot
* which share a battery backed cache module. One controls the
* cache, the other accesses the cache through the one that controls
* it. If we reset the one controlling the cache, the other will
* likely not be happy. Just forbid resetting this conjoined mess.
* The 640x isn't really supported by hpsa anyway.
*/
0x409C0E11, /* Smart Array 6400 */
0x409D0E11, /* Smart Array 6400 EM */
};
static int ctlr_is_hard_resettable(u32 board_id)
{
int i;
for (i = 0; i < ARRAY_SIZE(unresettable_controller); i++)
if (unresettable_controller[i] == board_id)
return 0;
return 1;
}
static int ctlr_is_soft_resettable(u32 board_id)
{
int i;
for (i = 0; i < ARRAY_SIZE(soft_unresettable_controller); i++)
if (soft_unresettable_controller[i] == board_id)
return 0;
return 1;
}
static int ctlr_is_resettable(u32 board_id)
{
return ctlr_is_hard_resettable(board_id) ||
ctlr_is_soft_resettable(board_id);
}
static ssize_t host_show_resettable(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct ctlr_info *h;
struct Scsi_Host *shost = class_to_shost(dev);
h = shost_to_hba(shost);
return snprintf(buf, 20, "%d\n", ctlr_is_resettable(h->board_id));
}
static inline int is_logical_dev_addr_mode(unsigned char scsi3addr[])
{
return (scsi3addr[3] & 0xC0) == 0x40;
}
static const char *raid_label[] = { "0", "4", "1(1+0)", "5", "5+1", "ADG",
"UNKNOWN"
};
#define RAID_UNKNOWN (ARRAY_SIZE(raid_label) - 1)
static ssize_t raid_level_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
ssize_t l = 0;
unsigned char rlevel;
struct ctlr_info *h;
struct scsi_device *sdev;
struct hpsa_scsi_dev_t *hdev;
unsigned long flags;
sdev = to_scsi_device(dev);
h = sdev_to_hba(sdev);
spin_lock_irqsave(&h->lock, flags);
hdev = sdev->hostdata;
if (!hdev) {
spin_unlock_irqrestore(&h->lock, flags);
return -ENODEV;
}
/* Is this even a logical drive? */
if (!is_logical_dev_addr_mode(hdev->scsi3addr)) {
spin_unlock_irqrestore(&h->lock, flags);
l = snprintf(buf, PAGE_SIZE, "N/A\n");
return l;
}
rlevel = hdev->raid_level;
spin_unlock_irqrestore(&h->lock, flags);
if (rlevel > RAID_UNKNOWN)
rlevel = RAID_UNKNOWN;
l = snprintf(buf, PAGE_SIZE, "RAID %s\n", raid_label[rlevel]);
return l;
}
static ssize_t lunid_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct ctlr_info *h;
struct scsi_device *sdev;
struct hpsa_scsi_dev_t *hdev;
unsigned long flags;
unsigned char lunid[8];
sdev = to_scsi_device(dev);
h = sdev_to_hba(sdev);
spin_lock_irqsave(&h->lock, flags);
hdev = sdev->hostdata;
if (!hdev) {
spin_unlock_irqrestore(&h->lock, flags);
return -ENODEV;
}
memcpy(lunid, hdev->scsi3addr, sizeof(lunid));
spin_unlock_irqrestore(&h->lock, flags);
return snprintf(buf, 20, "0x%02x%02x%02x%02x%02x%02x%02x%02x\n",
lunid[0], lunid[1], lunid[2], lunid[3],
lunid[4], lunid[5], lunid[6], lunid[7]);
}
static ssize_t unique_id_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct ctlr_info *h;
struct scsi_device *sdev;
struct hpsa_scsi_dev_t *hdev;
unsigned long flags;
unsigned char sn[16];
sdev = to_scsi_device(dev);
h = sdev_to_hba(sdev);
spin_lock_irqsave(&h->lock, flags);
hdev = sdev->hostdata;
if (!hdev) {
spin_unlock_irqrestore(&h->lock, flags);
return -ENODEV;
}
memcpy(sn, hdev->device_id, sizeof(sn));
spin_unlock_irqrestore(&h->lock, flags);
return snprintf(buf, 16 * 2 + 2,
"%02X%02X%02X%02X%02X%02X%02X%02X"
"%02X%02X%02X%02X%02X%02X%02X%02X\n",
sn[0], sn[1], sn[2], sn[3],
sn[4], sn[5], sn[6], sn[7],
sn[8], sn[9], sn[10], sn[11],
sn[12], sn[13], sn[14], sn[15]);
}
static DEVICE_ATTR(raid_level, S_IRUGO, raid_level_show, NULL);
static DEVICE_ATTR(lunid, S_IRUGO, lunid_show, NULL);
static DEVICE_ATTR(unique_id, S_IRUGO, unique_id_show, NULL);
static DEVICE_ATTR(rescan, S_IWUSR, NULL, host_store_rescan);
static DEVICE_ATTR(firmware_revision, S_IRUGO,
host_show_firmware_revision, NULL);
static DEVICE_ATTR(commands_outstanding, S_IRUGO,
host_show_commands_outstanding, NULL);
static DEVICE_ATTR(transport_mode, S_IRUGO,
host_show_transport_mode, NULL);
static DEVICE_ATTR(resettable, S_IRUGO,
host_show_resettable, NULL);
static struct device_attribute *hpsa_sdev_attrs[] = {
&dev_attr_raid_level,
&dev_attr_lunid,
&dev_attr_unique_id,
NULL,
};
static struct device_attribute *hpsa_shost_attrs[] = {
&dev_attr_rescan,
&dev_attr_firmware_revision,
&dev_attr_commands_outstanding,
&dev_attr_transport_mode,
&dev_attr_resettable,
NULL,
};
static struct scsi_host_template hpsa_driver_template = {
.module = THIS_MODULE,
.name = "hpsa",
.proc_name = "hpsa",
.queuecommand = hpsa_scsi_queue_command,
.scan_start = hpsa_scan_start,
.scan_finished = hpsa_scan_finished,
.change_queue_depth = hpsa_change_queue_depth,
.this_id = -1,
.use_clustering = ENABLE_CLUSTERING,
.eh_device_reset_handler = hpsa_eh_device_reset_handler,
.ioctl = hpsa_ioctl,
.slave_alloc = hpsa_slave_alloc,
.slave_destroy = hpsa_slave_destroy,
#ifdef CONFIG_COMPAT
.compat_ioctl = hpsa_compat_ioctl,
#endif
.sdev_attrs = hpsa_sdev_attrs,
.shost_attrs = hpsa_shost_attrs,
.max_sectors = 8192,
};
/* Enqueuing and dequeuing functions for cmdlists. */
static inline void addQ(struct list_head *list, struct CommandList *c)
{
list_add_tail(&c->list, list);
}
static inline u32 next_command(struct ctlr_info *h)
{
u32 a;
if (unlikely(!(h->transMethod & CFGTBL_Trans_Performant)))
return h->access.command_completed(h);
if ((*(h->reply_pool_head) & 1) == (h->reply_pool_wraparound)) {
a = *(h->reply_pool_head); /* Next cmd in ring buffer */
(h->reply_pool_head)++;
h->commands_outstanding--;
} else {
a = FIFO_EMPTY;
}
/* Check for wraparound */
if (h->reply_pool_head == (h->reply_pool + h->max_commands)) {
h->reply_pool_head = h->reply_pool;
h->reply_pool_wraparound ^= 1;
}
return a;
}
/* set_performant_mode: Modify the tag for cciss performant
* set bit 0 for pull model, bits 3-1 for block fetch
* register number
*/
static void set_performant_mode(struct ctlr_info *h, struct CommandList *c)
{
if (likely(h->transMethod & CFGTBL_Trans_Performant))
c->busaddr |= 1 | (h->blockFetchTable[c->Header.SGList] << 1);
}
static void enqueue_cmd_and_start_io(struct ctlr_info *h,
struct CommandList *c)
{
unsigned long flags;
set_performant_mode(h, c);
spin_lock_irqsave(&h->lock, flags);
addQ(&h->reqQ, c);
h->Qdepth++;
start_io(h);
spin_unlock_irqrestore(&h->lock, flags);
}
static inline void removeQ(struct CommandList *c)
{
if (WARN_ON(list_empty(&c->list)))
return;
list_del_init(&c->list);
}
static inline int is_hba_lunid(unsigned char scsi3addr[])
{
return memcmp(scsi3addr, RAID_CTLR_LUNID, 8) == 0;
}
static inline int is_scsi_rev_5(struct ctlr_info *h)
{
if (!h->hba_inquiry_data)
return 0;
if ((h->hba_inquiry_data[2] & 0x07) == 5)
return 1;
return 0;
}
static int hpsa_find_target_lun(struct ctlr_info *h,
unsigned char scsi3addr[], int bus, int *target, int *lun)
{
/* finds an unused bus, target, lun for a new physical device
* assumes h->devlock is held
*/
int i, found = 0;
DECLARE_BITMAP(lun_taken, HPSA_MAX_DEVICES);
memset(&lun_taken[0], 0, HPSA_MAX_DEVICES >> 3);
for (i = 0; i < h->ndevices; i++) {
if (h->dev[i]->bus == bus && h->dev[i]->target != -1)
set_bit(h->dev[i]->target, lun_taken);
}
for (i = 0; i < HPSA_MAX_DEVICES; i++) {
if (!test_bit(i, lun_taken)) {
/* *bus = 1; */
*target = i;
*lun = 0;
found = 1;
break;
}
}
return !found;
}
/* Add an entry into h->dev[] array. */
static int hpsa_scsi_add_entry(struct ctlr_info *h, int hostno,
struct hpsa_scsi_dev_t *device,
struct hpsa_scsi_dev_t *added[], int *nadded)
{
/* assumes h->devlock is held */
int n = h->ndevices;
int i;
unsigned char addr1[8], addr2[8];
struct hpsa_scsi_dev_t *sd;
if (n >= HPSA_MAX_DEVICES) {
dev_err(&h->pdev->dev, "too many devices, some will be "
"inaccessible.\n");
return -1;
}
/* physical devices do not have lun or target assigned until now. */
if (device->lun != -1)
/* Logical device, lun is already assigned. */
goto lun_assigned;
/* If this device a non-zero lun of a multi-lun device
* byte 4 of the 8-byte LUN addr will contain the logical
* unit no, zero otherise.
*/
if (device->scsi3addr[4] == 0) {
/* This is not a non-zero lun of a multi-lun device */
if (hpsa_find_target_lun(h, device->scsi3addr,
device->bus, &device->target, &device->lun) != 0)
return -1;
goto lun_assigned;
}
/* This is a non-zero lun of a multi-lun device.
* Search through our list and find the device which
* has the same 8 byte LUN address, excepting byte 4.
* Assign the same bus and target for this new LUN.
* Use the logical unit number from the firmware.
*/
memcpy(addr1, device->scsi3addr, 8);
addr1[4] = 0;
for (i = 0; i < n; i++) {
sd = h->dev[i];
memcpy(addr2, sd->scsi3addr, 8);
addr2[4] = 0;
/* differ only in byte 4? */
if (memcmp(addr1, addr2, 8) == 0) {
device->bus = sd->bus;
device->target = sd->target;
device->lun = device->scsi3addr[4];
break;
}
}
if (device->lun == -1) {
dev_warn(&h->pdev->dev, "physical device with no LUN=0,"
" suspect firmware bug or unsupported hardware "
"configuration.\n");
return -1;
}
lun_assigned:
h->dev[n] = device;
h->ndevices++;
added[*nadded] = device;
(*nadded)++;
/* initially, (before registering with scsi layer) we don't
* know our hostno and we don't want to print anything first
* time anyway (the scsi layer's inquiries will show that info)
*/
/* if (hostno != -1) */
dev_info(&h->pdev->dev, "%s device c%db%dt%dl%d added.\n",
scsi_device_type(device->devtype), hostno,
device->bus, device->target, device->lun);
return 0;
}
/* Replace an entry from h->dev[] array. */
static void hpsa_scsi_replace_entry(struct ctlr_info *h, int hostno,
int entry, struct hpsa_scsi_dev_t *new_entry,
struct hpsa_scsi_dev_t *added[], int *nadded,
struct hpsa_scsi_dev_t *removed[], int *nremoved)
{
/* assumes h->devlock is held */
BUG_ON(entry < 0 || entry >= HPSA_MAX_DEVICES);
removed[*nremoved] = h->dev[entry];
(*nremoved)++;
/*
* New physical devices won't have target/lun assigned yet
* so we need to preserve the values in the slot we are replacing.
*/
if (new_entry->target == -1) {
new_entry->target = h->dev[entry]->target;
new_entry->lun = h->dev[entry]->lun;
}
h->dev[entry] = new_entry;
added[*nadded] = new_entry;
(*nadded)++;
dev_info(&h->pdev->dev, "%s device c%db%dt%dl%d changed.\n",
scsi_device_type(new_entry->devtype), hostno, new_entry->bus,
new_entry->target, new_entry->lun);
}
/* Remove an entry from h->dev[] array. */
static void hpsa_scsi_remove_entry(struct ctlr_info *h, int hostno, int entry,
struct hpsa_scsi_dev_t *removed[], int *nremoved)
{
/* assumes h->devlock is held */
int i;
struct hpsa_scsi_dev_t *sd;
BUG_ON(entry < 0 || entry >= HPSA_MAX_DEVICES);
sd = h->dev[entry];
removed[*nremoved] = h->dev[entry];
(*nremoved)++;
for (i = entry; i < h->ndevices-1; i++)
h->dev[i] = h->dev[i+1];
h->ndevices--;
dev_info(&h->pdev->dev, "%s device c%db%dt%dl%d removed.\n",
scsi_device_type(sd->devtype), hostno, sd->bus, sd->target,
sd->lun);
}
#define SCSI3ADDR_EQ(a, b) ( \
(a)[7] == (b)[7] && \
(a)[6] == (b)[6] && \
(a)[5] == (b)[5] && \
(a)[4] == (b)[4] && \
(a)[3] == (b)[3] && \
(a)[2] == (b)[2] && \
(a)[1] == (b)[1] && \
(a)[0] == (b)[0])
static void fixup_botched_add(struct ctlr_info *h,
struct hpsa_scsi_dev_t *added)
{
/* called when scsi_add_device fails in order to re-adjust
* h->dev[] to match the mid layer's view.
*/
unsigned long flags;
int i, j;
spin_lock_irqsave(&h->lock, flags);
for (i = 0; i < h->ndevices; i++) {
if (h->dev[i] == added) {
for (j = i; j < h->ndevices-1; j++)
h->dev[j] = h->dev[j+1];
h->ndevices--;
break;
}
}
spin_unlock_irqrestore(&h->lock, flags);
kfree(added);
}
static inline int device_is_the_same(struct hpsa_scsi_dev_t *dev1,
struct hpsa_scsi_dev_t *dev2)
{
/* we compare everything except lun and target as these
* are not yet assigned. Compare parts likely
* to differ first
*/
if (memcmp(dev1->scsi3addr, dev2->scsi3addr,
sizeof(dev1->scsi3addr)) != 0)
return 0;
if (memcmp(dev1->device_id, dev2->device_id,
sizeof(dev1->device_id)) != 0)
return 0;
if (memcmp(dev1->model, dev2->model, sizeof(dev1->model)) != 0)
return 0;
if (memcmp(dev1->vendor, dev2->vendor, sizeof(dev1->vendor)) != 0)
return 0;
if (dev1->devtype != dev2->devtype)
return 0;
if (dev1->bus != dev2->bus)
return 0;
return 1;
}
/* Find needle in haystack. If exact match found, return DEVICE_SAME,
* and return needle location in *index. If scsi3addr matches, but not
* vendor, model, serial num, etc. return DEVICE_CHANGED, and return needle
* location in *index. If needle not found, return DEVICE_NOT_FOUND.
*/
static int hpsa_scsi_find_entry(struct hpsa_scsi_dev_t *needle,
struct hpsa_scsi_dev_t *haystack[], int haystack_size,
int *index)
{
int i;
#define DEVICE_NOT_FOUND 0
#define DEVICE_CHANGED 1
#define DEVICE_SAME 2
for (i = 0; i < haystack_size; i++) {
if (haystack[i] == NULL) /* previously removed. */
continue;
if (SCSI3ADDR_EQ(needle->scsi3addr, haystack[i]->scsi3addr)) {
*index = i;
if (device_is_the_same(needle, haystack[i]))
return DEVICE_SAME;
else
return DEVICE_CHANGED;
}
}
*index = -1;
return DEVICE_NOT_FOUND;
}
static void adjust_hpsa_scsi_table(struct ctlr_info *h, int hostno,
struct hpsa_scsi_dev_t *sd[], int nsds)
{
/* sd contains scsi3 addresses and devtypes, and inquiry
* data. This function takes what's in sd to be the current
* reality and updates h->dev[] to reflect that reality.
*/
int i, entry, device_change, changes = 0;
struct hpsa_scsi_dev_t *csd;
unsigned long flags;
struct hpsa_scsi_dev_t **added, **removed;
int nadded, nremoved;
struct Scsi_Host *sh = NULL;
added = kzalloc(sizeof(*added) * HPSA_MAX_DEVICES, GFP_KERNEL);
removed = kzalloc(sizeof(*removed) * HPSA_MAX_DEVICES, GFP_KERNEL);
if (!added || !removed) {
dev_warn(&h->pdev->dev, "out of memory in "
"adjust_hpsa_scsi_table\n");
goto free_and_out;
}
spin_lock_irqsave(&h->devlock, flags);
/* find any devices in h->dev[] that are not in
* sd[] and remove them from h->dev[], and for any
* devices which have changed, remove the old device
* info and add the new device info.
*/
i = 0;
nremoved = 0;
nadded = 0;
while (i < h->ndevices) {
csd = h->dev[i];
device_change = hpsa_scsi_find_entry(csd, sd, nsds, &entry);
if (device_change == DEVICE_NOT_FOUND) {
changes++;
hpsa_scsi_remove_entry(h, hostno, i,
removed, &nremoved);
continue; /* remove ^^^, hence i not incremented */
} else if (device_change == DEVICE_CHANGED) {
changes++;
hpsa_scsi_replace_entry(h, hostno, i, sd[entry],
added, &nadded, removed, &nremoved);
/* Set it to NULL to prevent it from being freed
* at the bottom of hpsa_update_scsi_devices()
*/
sd[entry] = NULL;
}
i++;
}
/* Now, make sure every device listed in sd[] is also
* listed in h->dev[], adding them if they aren't found
*/
for (i = 0; i < nsds; i++) {
if (!sd[i]) /* if already added above. */
continue;
device_change = hpsa_scsi_find_entry(sd[i], h->dev,
h->ndevices, &entry);
if (device_change == DEVICE_NOT_FOUND) {
changes++;
if (hpsa_scsi_add_entry(h, hostno, sd[i],
added, &nadded) != 0)
break;
sd[i] = NULL; /* prevent from being freed later. */
} else if (device_change == DEVICE_CHANGED) {
/* should never happen... */
changes++;
dev_warn(&h->pdev->dev,
"device unexpectedly changed.\n");
/* but if it does happen, we just ignore that device */
}
}
spin_unlock_irqrestore(&h->devlock, flags);
/* Don't notify scsi mid layer of any changes the first time through
* (or if there are no changes) scsi_scan_host will do it later the
* first time through.
*/
if (hostno == -1 || !changes)
goto free_and_out;
sh = h->scsi_host;
/* Notify scsi mid layer of any removed devices */
for (i = 0; i < nremoved; i++) {
struct scsi_device *sdev =
scsi_device_lookup(sh, removed[i]->bus,
removed[i]->target, removed[i]->lun);
if (sdev != NULL) {
scsi_remove_device(sdev);
scsi_device_put(sdev);
} else {
/* We don't expect to get here.
* future cmds to this device will get selection
* timeout as if the device was gone.
*/
dev_warn(&h->pdev->dev, "didn't find c%db%dt%dl%d "
" for removal.", hostno, removed[i]->bus,
removed[i]->target, removed[i]->lun);
}
kfree(removed[i]);
removed[i] = NULL;
}
/* Notify scsi mid layer of any added devices */
for (i = 0; i < nadded; i++) {
if (scsi_add_device(sh, added[i]->bus,
added[i]->target, added[i]->lun) == 0)
continue;
dev_warn(&h->pdev->dev, "scsi_add_device c%db%dt%dl%d failed, "
"device not added.\n", hostno, added[i]->bus,
added[i]->target, added[i]->lun);
/* now we have to remove it from h->dev,
* since it didn't get added to scsi mid layer
*/
fixup_botched_add(h, added[i]);
}
free_and_out:
kfree(added);
kfree(removed);
}
/*
* Lookup bus/target/lun and retrun corresponding struct hpsa_scsi_dev_t *
* Assume's h->devlock is held.
*/
static struct hpsa_scsi_dev_t *lookup_hpsa_scsi_dev(struct ctlr_info *h,
int bus, int target, int lun)
{
int i;
struct hpsa_scsi_dev_t *sd;
for (i = 0; i < h->ndevices; i++) {
sd = h->dev[i];
if (sd->bus == bus && sd->target == target && sd->lun == lun)
return sd;
}
return NULL;
}
/* link sdev->hostdata to our per-device structure. */
static int hpsa_slave_alloc(struct scsi_device *sdev)
{
struct hpsa_scsi_dev_t *sd;
unsigned long flags;
struct ctlr_info *h;
h = sdev_to_hba(sdev);
spin_lock_irqsave(&h->devlock, flags);
sd = lookup_hpsa_scsi_dev(h, sdev_channel(sdev),
sdev_id(sdev), sdev->lun);
if (sd != NULL)
sdev->hostdata = sd;
spin_unlock_irqrestore(&h->devlock, flags);
return 0;
}
static void hpsa_slave_destroy(struct scsi_device *sdev)
{
/* nothing to do. */
}
static void hpsa_free_sg_chain_blocks(struct ctlr_info *h)
{
int i;
if (!h->cmd_sg_list)
return;
for (i = 0; i < h->nr_cmds; i++) {
kfree(h->cmd_sg_list[i]);
h->cmd_sg_list[i] = NULL;
}
kfree(h->cmd_sg_list);
h->cmd_sg_list = NULL;
}
static int hpsa_allocate_sg_chain_blocks(struct ctlr_info *h)
{
int i;
if (h->chainsize <= 0)
return 0;
h->cmd_sg_list = kzalloc(sizeof(*h->cmd_sg_list) * h->nr_cmds,
GFP_KERNEL);
if (!h->cmd_sg_list)
return -ENOMEM;
for (i = 0; i < h->nr_cmds; i++) {
h->cmd_sg_list[i] = kmalloc(sizeof(*h->cmd_sg_list[i]) *
h->chainsize, GFP_KERNEL);
if (!h->cmd_sg_list[i])
goto clean;
}
return 0;
clean:
hpsa_free_sg_chain_blocks(h);
return -ENOMEM;
}
static void hpsa_map_sg_chain_block(struct ctlr_info *h,
struct CommandList *c)
{
struct SGDescriptor *chain_sg, *chain_block;
u64 temp64;
chain_sg = &c->SG[h->max_cmd_sg_entries - 1];
chain_block = h->cmd_sg_list[c->cmdindex];
chain_sg->Ext = HPSA_SG_CHAIN;
chain_sg->Len = sizeof(*chain_sg) *
(c->Header.SGTotal - h->max_cmd_sg_entries);
temp64 = pci_map_single(h->pdev, chain_block, chain_sg->Len,
PCI_DMA_TODEVICE);
chain_sg->Addr.lower = (u32) (temp64 & 0x0FFFFFFFFULL);
chain_sg->Addr.upper = (u32) ((temp64 >> 32) & 0x0FFFFFFFFULL);
}
static void hpsa_unmap_sg_chain_block(struct ctlr_info *h,
struct CommandList *c)
{
struct SGDescriptor *chain_sg;
union u64bit temp64;
if (c->Header.SGTotal <= h->max_cmd_sg_entries)
return;
chain_sg = &c->SG[h->max_cmd_sg_entries - 1];
temp64.val32.lower = chain_sg->Addr.lower;
temp64.val32.upper = chain_sg->Addr.upper;
pci_unmap_single(h->pdev, temp64.val, chain_sg->Len, PCI_DMA_TODEVICE);
}
static void complete_scsi_command(struct CommandList *cp)
{
struct scsi_cmnd *cmd;
struct ctlr_info *h;
struct ErrorInfo *ei;
unsigned char sense_key;
unsigned char asc; /* additional sense code */
unsigned char ascq; /* additional sense code qualifier */
unsigned long sense_data_size;
ei = cp->err_info;
cmd = (struct scsi_cmnd *) cp->scsi_cmd;
h = cp->h;
scsi_dma_unmap(cmd); /* undo the DMA mappings */
if (cp->Header.SGTotal > h->max_cmd_sg_entries)
hpsa_unmap_sg_chain_block(h, cp);
cmd->result = (DID_OK << 16); /* host byte */
cmd->result |= (COMMAND_COMPLETE << 8); /* msg byte */
cmd->result |= ei->ScsiStatus;
/* copy the sense data whether we need to or not. */
if (SCSI_SENSE_BUFFERSIZE < sizeof(ei->SenseInfo))
sense_data_size = SCSI_SENSE_BUFFERSIZE;
else
sense_data_size = sizeof(ei->SenseInfo);
if (ei->SenseLen < sense_data_size)
sense_data_size = ei->SenseLen;
memcpy(cmd->sense_buffer, ei->SenseInfo, sense_data_size);
scsi_set_resid(cmd, ei->ResidualCnt);
if (ei->CommandStatus == 0) {
cmd->scsi_done(cmd);
cmd_free(h, cp);
return;
}
/* an error has occurred */
switch (ei->CommandStatus) {
case CMD_TARGET_STATUS:
if (ei->ScsiStatus) {
/* Get sense key */
sense_key = 0xf & ei->SenseInfo[2];
/* Get additional sense code */
asc = ei->SenseInfo[12];
/* Get addition sense code qualifier */
ascq = ei->SenseInfo[13];
}
if (ei->ScsiStatus == SAM_STAT_CHECK_CONDITION) {
if (check_for_unit_attention(h, cp)) {
cmd->result = DID_SOFT_ERROR << 16;
break;
}
if (sense_key == ILLEGAL_REQUEST) {
/*
* SCSI REPORT_LUNS is commonly unsupported on
* Smart Array. Suppress noisy complaint.
*/
if (cp->Request.CDB[0] == REPORT_LUNS)
break;
/* If ASC/ASCQ indicate Logical Unit
* Not Supported condition,
*/
if ((asc == 0x25) && (ascq == 0x0)) {
dev_warn(&h->pdev->dev, "cp %p "
"has check condition\n", cp);
break;
}
}
if (sense_key == NOT_READY) {
/* If Sense is Not Ready, Logical Unit
* Not ready, Manual Intervention
* required
*/
if ((asc == 0x04) && (ascq == 0x03)) {
dev_warn(&h->pdev->dev, "cp %p "
"has check condition: unit "
"not ready, manual "
"intervention required\n", cp);
break;
}
}
if (sense_key == ABORTED_COMMAND) {
/* Aborted command is retryable */
dev_warn(&h->pdev->dev, "cp %p "
"has check condition: aborted command: "
"ASC: 0x%x, ASCQ: 0x%x\n",
cp, asc, ascq);
cmd->result = DID_SOFT_ERROR << 16;
break;
}
/* Must be some other type of check condition */
dev_warn(&h->pdev->dev, "cp %p has check condition: "
"unknown type: "
"Sense: 0x%x, ASC: 0x%x, ASCQ: 0x%x, "
"Returning result: 0x%x, "
"cmd=[%02x %02x %02x %02x %02x "
"%02x %02x %02x %02x %02x %02x "
"%02x %02x %02x %02x %02x]\n",
cp, sense_key, asc, ascq,
cmd->result,
cmd->cmnd[0], cmd->cmnd[1],
cmd->cmnd[2], cmd->cmnd[3],
cmd->cmnd[4], cmd->cmnd[5],
cmd->cmnd[6], cmd->cmnd[7],
cmd->cmnd[8], cmd->cmnd[9],
cmd->cmnd[10], cmd->cmnd[11],
cmd->cmnd[12], cmd->cmnd[13],
cmd->cmnd[14], cmd->cmnd[15]);
break;
}
/* Problem was not a check condition
* Pass it up to the upper layers...
*/
if (ei->ScsiStatus) {
dev_warn(&h->pdev->dev, "cp %p has status 0x%x "
"Sense: 0x%x, ASC: 0x%x, ASCQ: 0x%x, "
"Returning result: 0x%x\n",
cp, ei->ScsiStatus,
sense_key, asc, ascq,
cmd->result);
} else { /* scsi status is zero??? How??? */
dev_warn(&h->pdev->dev, "cp %p SCSI status was 0. "
"Returning no connection.\n", cp),
/* Ordinarily, this case should never happen,
* but there is a bug in some released firmware
* revisions that allows it to happen if, for
* example, a 4100 backplane loses power and
* the tape drive is in it. We assume that
* it's a fatal error of some kind because we
* can't show that it wasn't. We will make it
* look like selection timeout since that is
* the most common reason for this to occur,
* and it's severe enough.
*/
cmd->result = DID_NO_CONNECT << 16;
}
break;
case CMD_DATA_UNDERRUN: /* let mid layer handle it. */
break;
case CMD_DATA_OVERRUN:
dev_warn(&h->pdev->dev, "cp %p has"
" completed with data overrun "
"reported\n", cp);
break;
case CMD_INVALID: {
/* print_bytes(cp, sizeof(*cp), 1, 0);
print_cmd(cp); */
/* We get CMD_INVALID if you address a non-existent device
* instead of a selection timeout (no response). You will
* see this if you yank out a drive, then try to access it.
* This is kind of a shame because it means that any other
* CMD_INVALID (e.g. driver bug) will get interpreted as a
* missing target. */
cmd->result = DID_NO_CONNECT << 16;
}
break;
case CMD_PROTOCOL_ERR:
dev_warn(&h->pdev->dev, "cp %p has "
"protocol error \n", cp);
break;
case CMD_HARDWARE_ERR:
cmd->result = DID_ERROR << 16;
dev_warn(&h->pdev->dev, "cp %p had hardware error\n", cp);
break;
case CMD_CONNECTION_LOST:
cmd->result = DID_ERROR << 16;
dev_warn(&h->pdev->dev, "cp %p had connection lost\n", cp);
break;
case CMD_ABORTED:
cmd->result = DID_ABORT << 16;
dev_warn(&h->pdev->dev, "cp %p was aborted with status 0x%x\n",
cp, ei->ScsiStatus);
break;
case CMD_ABORT_FAILED:
cmd->result = DID_ERROR << 16;
dev_warn(&h->pdev->dev, "cp %p reports abort failed\n", cp);
break;
case CMD_UNSOLICITED_ABORT:
cmd->result = DID_SOFT_ERROR << 16; /* retry the command */
dev_warn(&h->pdev->dev, "cp %p aborted due to an unsolicited "
"abort\n", cp);
break;
case CMD_TIMEOUT:
cmd->result = DID_TIME_OUT << 16;
dev_warn(&h->pdev->dev, "cp %p timedout\n", cp);
break;
case CMD_UNABORTABLE:
cmd->result = DID_ERROR << 16;
dev_warn(&h->pdev->dev, "Command unabortable\n");
break;
default:
cmd->result = DID_ERROR << 16;
dev_warn(&h->pdev->dev, "cp %p returned unknown status %x\n",
cp, ei->CommandStatus);
}
cmd->scsi_done(cmd);
cmd_free(h, cp);
}
static int hpsa_scsi_detect(struct ctlr_info *h)
{
struct Scsi_Host *sh;
int error;
sh = scsi_host_alloc(&hpsa_driver_template, sizeof(h));
if (sh == NULL)
goto fail;
sh->io_port = 0;
sh->n_io_port = 0;
sh->this_id = -1;
sh->max_channel = 3;
sh->max_cmd_len = MAX_COMMAND_SIZE;
sh->max_lun = HPSA_MAX_LUN;
sh->max_id = HPSA_MAX_LUN;
sh->can_queue = h->nr_cmds;
sh->cmd_per_lun = h->nr_cmds;
sh->sg_tablesize = h->maxsgentries;
h->scsi_host = sh;
sh->hostdata[0] = (unsigned long) h;
sh->irq = h->intr[h->intr_mode];
sh->unique_id = sh->irq;
error = scsi_add_host(sh, &h->pdev->dev);
if (error)
goto fail_host_put;
scsi_scan_host(sh);
return 0;
fail_host_put:
dev_err(&h->pdev->dev, "hpsa_scsi_detect: scsi_add_host"
" failed for controller %d\n", h->ctlr);
scsi_host_put(sh);
return error;
fail:
dev_err(&h->pdev->dev, "hpsa_scsi_detect: scsi_host_alloc"
" failed for controller %d\n", h->ctlr);
return -ENOMEM;
}
static void hpsa_pci_unmap(struct pci_dev *pdev,
struct CommandList *c, int sg_used, int data_direction)
{
int i;
union u64bit addr64;
for (i = 0; i < sg_used; i++) {
addr64.val32.lower = c->SG[i].Addr.lower;
addr64.val32.upper = c->SG[i].Addr.upper;
pci_unmap_single(pdev, (dma_addr_t) addr64.val, c->SG[i].Len,
data_direction);
}
}
static void hpsa_map_one(struct pci_dev *pdev,
struct CommandList *cp,
unsigned char *buf,
size_t buflen,
int data_direction)
{
u64 addr64;
if (buflen == 0 || data_direction == PCI_DMA_NONE) {
cp->Header.SGList = 0;
cp->Header.SGTotal = 0;
return;
}
addr64 = (u64) pci_map_single(pdev, buf, buflen, data_direction);
cp->SG[0].Addr.lower =
(u32) (addr64 & (u64) 0x00000000FFFFFFFF);
cp->SG[0].Addr.upper =
(u32) ((addr64 >> 32) & (u64) 0x00000000FFFFFFFF);
cp->SG[0].Len = buflen;
cp->Header.SGList = (u8) 1; /* no. SGs contig in this cmd */
cp->Header.SGTotal = (u16) 1; /* total sgs in this cmd list */
}
static inline void hpsa_scsi_do_simple_cmd_core(struct ctlr_info *h,
struct CommandList *c)
{
DECLARE_COMPLETION_ONSTACK(wait);
c->waiting = &wait;
enqueue_cmd_and_start_io(h, c);
wait_for_completion(&wait);
}
static void hpsa_scsi_do_simple_cmd_core_if_no_lockup(struct ctlr_info *h,
struct CommandList *c)
{
unsigned long flags;
/* If controller lockup detected, fake a hardware error. */
spin_lock_irqsave(&h->lock, flags);
if (unlikely(h->lockup_detected)) {
spin_unlock_irqrestore(&h->lock, flags);
c->err_info->CommandStatus = CMD_HARDWARE_ERR;
} else {
spin_unlock_irqrestore(&h->lock, flags);
hpsa_scsi_do_simple_cmd_core(h, c);
}
}
static void hpsa_scsi_do_simple_cmd_with_retry(struct ctlr_info *h,
struct CommandList *c, int data_direction)
{
int retry_count = 0;
do {
memset(c->err_info, 0, sizeof(*c->err_info));
hpsa_scsi_do_simple_cmd_core(h, c);
retry_count++;
} while (check_for_unit_attention(h, c) && retry_count <= 3);
hpsa_pci_unmap(h->pdev, c, 1, data_direction);
}
static void hpsa_scsi_interpret_error(struct CommandList *cp)
{
struct ErrorInfo *ei;
struct device *d = &cp->h->pdev->dev;
ei = cp->err_info;
switch (ei->CommandStatus) {
case CMD_TARGET_STATUS:
dev_warn(d, "cmd %p has completed with errors\n", cp);
dev_warn(d, "cmd %p has SCSI Status = %x\n", cp,
ei->ScsiStatus);
if (ei->ScsiStatus == 0)
dev_warn(d, "SCSI status is abnormally zero. "
"(probably indicates selection timeout "
"reported incorrectly due to a known "
"firmware bug, circa July, 2001.)\n");
break;
case CMD_DATA_UNDERRUN: /* let mid layer handle it. */
dev_info(d, "UNDERRUN\n");
break;
case CMD_DATA_OVERRUN:
dev_warn(d, "cp %p has completed with data overrun\n", cp);
break;
case CMD_INVALID: {
/* controller unfortunately reports SCSI passthru's
* to non-existent targets as invalid commands.
*/
dev_warn(d, "cp %p is reported invalid (probably means "
"target device no longer present)\n", cp);
/* print_bytes((unsigned char *) cp, sizeof(*cp), 1, 0);
print_cmd(cp); */
}
break;
case CMD_PROTOCOL_ERR:
dev_warn(d, "cp %p has protocol error \n", cp);
break;
case CMD_HARDWARE_ERR:
/* cmd->result = DID_ERROR << 16; */
dev_warn(d, "cp %p had hardware error\n", cp);
break;
case CMD_CONNECTION_LOST:
dev_warn(d, "cp %p had connection lost\n", cp);
break;
case CMD_ABORTED:
dev_warn(d, "cp %p was aborted\n", cp);
break;
case CMD_ABORT_FAILED:
dev_warn(d, "cp %p reports abort failed\n", cp);
break;
case CMD_UNSOLICITED_ABORT:
dev_warn(d, "cp %p aborted due to an unsolicited abort\n", cp);
break;
case CMD_TIMEOUT:
dev_warn(d, "cp %p timed out\n", cp);
break;
case CMD_UNABORTABLE:
dev_warn(d, "Command unabortable\n");
break;
default:
dev_warn(d, "cp %p returned unknown status %x\n", cp,
ei->CommandStatus);
}
}
static int hpsa_scsi_do_inquiry(struct ctlr_info *h, unsigned char *scsi3addr,
unsigned char page, unsigned char *buf,
unsigned char bufsize)
{
int rc = IO_OK;
struct CommandList *c;
struct ErrorInfo *ei;
c = cmd_special_alloc(h);
if (c == NULL) { /* trouble... */
dev_warn(&h->pdev->dev, "cmd_special_alloc returned NULL!\n");
return -ENOMEM;
}
fill_cmd(c, HPSA_INQUIRY, h, buf, bufsize, page, scsi3addr, TYPE_CMD);
hpsa_scsi_do_simple_cmd_with_retry(h, c, PCI_DMA_FROMDEVICE);
ei = c->err_info;
if (ei->CommandStatus != 0 && ei->CommandStatus != CMD_DATA_UNDERRUN) {
hpsa_scsi_interpret_error(c);
rc = -1;
}
cmd_special_free(h, c);
return rc;
}
static int hpsa_send_reset(struct ctlr_info *h, unsigned char *scsi3addr)
{
int rc = IO_OK;
struct CommandList *c;
struct ErrorInfo *ei;
c = cmd_special_alloc(h);
if (c == NULL) { /* trouble... */
dev_warn(&h->pdev->dev, "cmd_special_alloc returned NULL!\n");
return -ENOMEM;
}
fill_cmd(c, HPSA_DEVICE_RESET_MSG, h, NULL, 0, 0, scsi3addr, TYPE_MSG);
hpsa_scsi_do_simple_cmd_core(h, c);
/* no unmap needed here because no data xfer. */
ei = c->err_info;
if (ei->CommandStatus != 0) {
hpsa_scsi_interpret_error(c);
rc = -1;
}
cmd_special_free(h, c);
return rc;
}
static void hpsa_get_raid_level(struct ctlr_info *h,
unsigned char *scsi3addr, unsigned char *raid_level)
{
int rc;
unsigned char *buf;
*raid_level = RAID_UNKNOWN;
buf = kzalloc(64, GFP_KERNEL);
if (!buf)
return;
rc = hpsa_scsi_do_inquiry(h, scsi3addr, 0xC1, buf, 64);
if (rc == 0)
*raid_level = buf[8];
if (*raid_level > RAID_UNKNOWN)
*raid_level = RAID_UNKNOWN;
kfree(buf);
return;
}
/* Get the device id from inquiry page 0x83 */
static int hpsa_get_device_id(struct ctlr_info *h, unsigned char *scsi3addr,
unsigned char *device_id, int buflen)
{
int rc;
unsigned char *buf;
if (buflen > 16)
buflen = 16;
buf = kzalloc(64, GFP_KERNEL);
if (!buf)
return -1;
rc = hpsa_scsi_do_inquiry(h, scsi3addr, 0x83, buf, 64);
if (rc == 0)
memcpy(device_id, &buf[8], buflen);
kfree(buf);
return rc != 0;
}
static int hpsa_scsi_do_report_luns(struct ctlr_info *h, int logical,
struct ReportLUNdata *buf, int bufsize,
int extended_response)
{
int rc = IO_OK;
struct CommandList *c;
unsigned char scsi3addr[8];
struct ErrorInfo *ei;
c = cmd_special_alloc(h);
if (c == NULL) { /* trouble... */
dev_err(&h->pdev->dev, "cmd_special_alloc returned NULL!\n");
return -1;
}
/* address the controller */
memset(scsi3addr, 0, sizeof(scsi3addr));
fill_cmd(c, logical ? HPSA_REPORT_LOG : HPSA_REPORT_PHYS, h,
buf, bufsize, 0, scsi3addr, TYPE_CMD);
if (extended_response)
c->Request.CDB[1] = extended_response;
hpsa_scsi_do_simple_cmd_with_retry(h, c, PCI_DMA_FROMDEVICE);
ei = c->err_info;
if (ei->CommandStatus != 0 &&
ei->CommandStatus != CMD_DATA_UNDERRUN) {
hpsa_scsi_interpret_error(c);
rc = -1;
}
cmd_special_free(h, c);
return rc;
}
static inline int hpsa_scsi_do_report_phys_luns(struct ctlr_info *h,
struct ReportLUNdata *buf,
int bufsize, int extended_response)
{
return hpsa_scsi_do_report_luns(h, 0, buf, bufsize, extended_response);
}
static inline int hpsa_scsi_do_report_log_luns(struct ctlr_info *h,
struct ReportLUNdata *buf, int bufsize)
{
return hpsa_scsi_do_report_luns(h, 1, buf, bufsize, 0);
}
static inline void hpsa_set_bus_target_lun(struct hpsa_scsi_dev_t *device,
int bus, int target, int lun)
{
device->bus = bus;
device->target = target;
device->lun = lun;
}
static int hpsa_update_device_info(struct ctlr_info *h,
unsigned char scsi3addr[], struct hpsa_scsi_dev_t *this_device,
unsigned char *is_OBDR_device)
{
#define OBDR_SIG_OFFSET 43
#define OBDR_TAPE_SIG "$DR-10"
#define OBDR_SIG_LEN (sizeof(OBDR_TAPE_SIG) - 1)
#define OBDR_TAPE_INQ_SIZE (OBDR_SIG_OFFSET + OBDR_SIG_LEN)
unsigned char *inq_buff;
unsigned char *obdr_sig;
inq_buff = kzalloc(OBDR_TAPE_INQ_SIZE, GFP_KERNEL);
if (!inq_buff)
goto bail_out;
/* Do an inquiry to the device to see what it is. */
if (hpsa_scsi_do_inquiry(h, scsi3addr, 0, inq_buff,
(unsigned char) OBDR_TAPE_INQ_SIZE) != 0) {
/* Inquiry failed (msg printed already) */
dev_err(&h->pdev->dev,
"hpsa_update_device_info: inquiry failed\n");
goto bail_out;
}
this_device->devtype = (inq_buff[0] & 0x1f);
memcpy(this_device->scsi3addr, scsi3addr, 8);
memcpy(this_device->vendor, &inq_buff[8],
sizeof(this_device->vendor));
memcpy(this_device->model, &inq_buff[16],
sizeof(this_device->model));
memset(this_device->device_id, 0,
sizeof(this_device->device_id));
hpsa_get_device_id(h, scsi3addr, this_device->device_id,
sizeof(this_device->device_id));
if (this_device->devtype == TYPE_DISK &&
is_logical_dev_addr_mode(scsi3addr))
hpsa_get_raid_level(h, scsi3addr, &this_device->raid_level);
else
this_device->raid_level = RAID_UNKNOWN;
if (is_OBDR_device) {
/* See if this is a One-Button-Disaster-Recovery device
* by looking for "$DR-10" at offset 43 in inquiry data.
*/
obdr_sig = &inq_buff[OBDR_SIG_OFFSET];
*is_OBDR_device = (this_device->devtype == TYPE_ROM &&
strncmp(obdr_sig, OBDR_TAPE_SIG,
OBDR_SIG_LEN) == 0);
}
kfree(inq_buff);
return 0;
bail_out:
kfree(inq_buff);
return 1;
}
static unsigned char *msa2xxx_model[] = {
"MSA2012",
"MSA2024",
"MSA2312",
"MSA2324",
"P2000 G3 SAS",
NULL,
};
static int is_msa2xxx(struct ctlr_info *h, struct hpsa_scsi_dev_t *device)
{
int i;
for (i = 0; msa2xxx_model[i]; i++)
if (strncmp(device->model, msa2xxx_model[i],
strlen(msa2xxx_model[i])) == 0)
return 1;
return 0;
}
/* Helper function to assign bus, target, lun mapping of devices.
* Puts non-msa2xxx logical volumes on bus 0, msa2xxx logical
* volumes on bus 1, physical devices on bus 2. and the hba on bus 3.
* Logical drive target and lun are assigned at this time, but
* physical device lun and target assignment are deferred (assigned
* in hpsa_find_target_lun, called by hpsa_scsi_add_entry.)
*/
static void figure_bus_target_lun(struct ctlr_info *h,
u8 *lunaddrbytes, int *bus, int *target, int *lun,
struct hpsa_scsi_dev_t *device)
{
u32 lunid;
if (is_logical_dev_addr_mode(lunaddrbytes)) {
/* logical device */
if (unlikely(is_scsi_rev_5(h))) {
/* p1210m, logical drives lun assignments
* match SCSI REPORT LUNS data.
*/
lunid = le32_to_cpu(*((__le32 *) lunaddrbytes));
*bus = 0;
*target = 0;
*lun = (lunid & 0x3fff) + 1;
} else {
/* not p1210m... */
lunid = le32_to_cpu(*((__le32 *) lunaddrbytes));
if (is_msa2xxx(h, device)) {
/* msa2xxx way, put logicals on bus 1
* and match target/lun numbers box
* reports.
*/
*bus = 1;
*target = (lunid >> 16) & 0x3fff;
*lun = lunid & 0x00ff;
} else {
/* Traditional smart array way. */
*bus = 0;
*lun = 0;
*target = lunid & 0x3fff;
}
}
} else {
/* physical device */
if (is_hba_lunid(lunaddrbytes))
if (unlikely(is_scsi_rev_5(h))) {
*bus = 0; /* put p1210m ctlr at 0,0,0 */
*target = 0;
*lun = 0;
return;
} else
*bus = 3; /* traditional smartarray */
else
*bus = 2; /* physical disk */
*target = -1;
*lun = -1; /* we will fill these in later. */
}
}
/*
* If there is no lun 0 on a target, linux won't find any devices.
* For the MSA2xxx boxes, we have to manually detect the enclosure
* which is at lun zero, as CCISS_REPORT_PHYSICAL_LUNS doesn't report
* it for some reason. *tmpdevice is the target we're adding,
* this_device is a pointer into the current element of currentsd[]
* that we're building up in update_scsi_devices(), below.
* lunzerobits is a bitmap that tracks which targets already have a
* lun 0 assigned.
* Returns 1 if an enclosure was added, 0 if not.
*/
static int add_msa2xxx_enclosure_device(struct ctlr_info *h,
struct hpsa_scsi_dev_t *tmpdevice,
struct hpsa_scsi_dev_t *this_device, u8 *lunaddrbytes,
int bus, int target, int lun, unsigned long lunzerobits[],
int *nmsa2xxx_enclosures)
{
unsigned char scsi3addr[8];
if (test_bit(target, lunzerobits))
return 0; /* There is already a lun 0 on this target. */
if (!is_logical_dev_addr_mode(lunaddrbytes))
return 0; /* It's the logical targets that may lack lun 0. */
if (!is_msa2xxx(h, tmpdevice))
return 0; /* It's only the MSA2xxx that have this problem. */
if (lun == 0) /* if lun is 0, then obviously we have a lun 0. */
return 0;
memset(scsi3addr, 0, 8);
scsi3addr[3] = target;
if (is_hba_lunid(scsi3addr))
return 0; /* Don't add the RAID controller here. */
if (is_scsi_rev_5(h))
return 0; /* p1210m doesn't need to do this. */
if (*nmsa2xxx_enclosures >= MAX_MSA2XXX_ENCLOSURES) {
dev_warn(&h->pdev->dev, "Maximum number of MSA2XXX "
"enclosures exceeded. Check your hardware "
"configuration.");
return 0;
}
if (hpsa_update_device_info(h, scsi3addr, this_device, NULL))
return 0;
(*nmsa2xxx_enclosures)++;
hpsa_set_bus_target_lun(this_device, bus, target, 0);
set_bit(target, lunzerobits);
return 1;
}
/*
* Do CISS_REPORT_PHYS and CISS_REPORT_LOG. Data is returned in physdev,
* logdev. The number of luns in physdev and logdev are returned in
* *nphysicals and *nlogicals, respectively.
* Returns 0 on success, -1 otherwise.
*/
static int hpsa_gather_lun_info(struct ctlr_info *h,
int reportlunsize,
struct ReportLUNdata *physdev, u32 *nphysicals,
struct ReportLUNdata *logdev, u32 *nlogicals)
{
if (hpsa_scsi_do_report_phys_luns(h, physdev, reportlunsize, 0)) {
dev_err(&h->pdev->dev, "report physical LUNs failed.\n");
return -1;
}
*nphysicals = be32_to_cpu(*((__be32 *)physdev->LUNListLength)) / 8;
if (*nphysicals > HPSA_MAX_PHYS_LUN) {
dev_warn(&h->pdev->dev, "maximum physical LUNs (%d) exceeded."
" %d LUNs ignored.\n", HPSA_MAX_PHYS_LUN,
*nphysicals - HPSA_MAX_PHYS_LUN);
*nphysicals = HPSA_MAX_PHYS_LUN;
}
if (hpsa_scsi_do_report_log_luns(h, logdev, reportlunsize)) {
dev_err(&h->pdev->dev, "report logical LUNs failed.\n");
return -1;
}
*nlogicals = be32_to_cpu(*((__be32 *) logdev->LUNListLength)) / 8;
/* Reject Logicals in excess of our max capability. */
if (*nlogicals > HPSA_MAX_LUN) {
dev_warn(&h->pdev->dev,
"maximum logical LUNs (%d) exceeded. "
"%d LUNs ignored.\n", HPSA_MAX_LUN,
*nlogicals - HPSA_MAX_LUN);
*nlogicals = HPSA_MAX_LUN;
}
if (*nlogicals + *nphysicals > HPSA_MAX_PHYS_LUN) {
dev_warn(&h->pdev->dev,
"maximum logical + physical LUNs (%d) exceeded. "
"%d LUNs ignored.\n", HPSA_MAX_PHYS_LUN,
*nphysicals + *nlogicals - HPSA_MAX_PHYS_LUN);
*nlogicals = HPSA_MAX_PHYS_LUN - *nphysicals;
}
return 0;
}
u8 *figure_lunaddrbytes(struct ctlr_info *h, int raid_ctlr_position, int i,
int nphysicals, int nlogicals, struct ReportLUNdata *physdev_list,
struct ReportLUNdata *logdev_list)
{
/* Helper function, figure out where the LUN ID info is coming from
* given index i, lists of physical and logical devices, where in
* the list the raid controller is supposed to appear (first or last)
*/
int logicals_start = nphysicals + (raid_ctlr_position == 0);
int last_device = nphysicals + nlogicals + (raid_ctlr_position == 0);
if (i == raid_ctlr_position)
return RAID_CTLR_LUNID;
if (i < logicals_start)
return &physdev_list->LUN[i - (raid_ctlr_position == 0)][0];
if (i < last_device)
return &logdev_list->LUN[i - nphysicals -
(raid_ctlr_position == 0)][0];
BUG();
return NULL;
}
static void hpsa_update_scsi_devices(struct ctlr_info *h, int hostno)
{
/* the idea here is we could get notified
* that some devices have changed, so we do a report
* physical luns and report logical luns cmd, and adjust
* our list of devices accordingly.
*
* The scsi3addr's of devices won't change so long as the
* adapter is not reset. That means we can rescan and
* tell which devices we already know about, vs. new
* devices, vs. disappearing devices.
*/
struct ReportLUNdata *physdev_list = NULL;
struct ReportLUNdata *logdev_list = NULL;
u32 nphysicals = 0;
u32 nlogicals = 0;
u32 ndev_allocated = 0;
struct hpsa_scsi_dev_t **currentsd, *this_device, *tmpdevice;
int ncurrent = 0;
int reportlunsize = sizeof(*physdev_list) + HPSA_MAX_PHYS_LUN * 8;
int i, nmsa2xxx_enclosures, ndevs_to_allocate;
int bus, target, lun;
int raid_ctlr_position;
DECLARE_BITMAP(lunzerobits, HPSA_MAX_TARGETS_PER_CTLR);
currentsd = kzalloc(sizeof(*currentsd) * HPSA_MAX_DEVICES, GFP_KERNEL);
physdev_list = kzalloc(reportlunsize, GFP_KERNEL);
logdev_list = kzalloc(reportlunsize, GFP_KERNEL);
tmpdevice = kzalloc(sizeof(*tmpdevice), GFP_KERNEL);
if (!currentsd || !physdev_list || !logdev_list || !tmpdevice) {
dev_err(&h->pdev->dev, "out of memory\n");
goto out;
}
memset(lunzerobits, 0, sizeof(lunzerobits));
if (hpsa_gather_lun_info(h, reportlunsize, physdev_list, &nphysicals,
logdev_list, &nlogicals))
goto out;
/* We might see up to 32 MSA2xxx enclosures, actually 8 of them
* but each of them 4 times through different paths. The plus 1
* is for the RAID controller.
*/
ndevs_to_allocate = nphysicals + nlogicals + MAX_MSA2XXX_ENCLOSURES + 1;
/* Allocate the per device structures */
for (i = 0; i < ndevs_to_allocate; i++) {
if (i >= HPSA_MAX_DEVICES) {
dev_warn(&h->pdev->dev, "maximum devices (%d) exceeded."
" %d devices ignored.\n", HPSA_MAX_DEVICES,
ndevs_to_allocate - HPSA_MAX_DEVICES);
break;
}
currentsd[i] = kzalloc(sizeof(*currentsd[i]), GFP_KERNEL);
if (!currentsd[i]) {
dev_warn(&h->pdev->dev, "out of memory at %s:%d\n",
__FILE__, __LINE__);
goto out;
}
ndev_allocated++;
}
if (unlikely(is_scsi_rev_5(h)))
raid_ctlr_position = 0;
else
raid_ctlr_position = nphysicals + nlogicals;
/* adjust our table of devices */
nmsa2xxx_enclosures = 0;
for (i = 0; i < nphysicals + nlogicals + 1; i++) {
u8 *lunaddrbytes, is_OBDR = 0;
/* Figure out where the LUN ID info is coming from */
lunaddrbytes = figure_lunaddrbytes(h, raid_ctlr_position,
i, nphysicals, nlogicals, physdev_list, logdev_list);
/* skip masked physical devices. */
if (lunaddrbytes[3] & 0xC0 &&
i < nphysicals + (raid_ctlr_position == 0))
continue;
/* Get device type, vendor, model, device id */
if (hpsa_update_device_info(h, lunaddrbytes, tmpdevice,
&is_OBDR))
continue; /* skip it if we can't talk to it. */
figure_bus_target_lun(h, lunaddrbytes, &bus, &target, &lun,
tmpdevice);
this_device = currentsd[ncurrent];
/*
* For the msa2xxx boxes, we have to insert a LUN 0 which
* doesn't show up in CCISS_REPORT_PHYSICAL data, but there
* is nonetheless an enclosure device there. We have to
* present that otherwise linux won't find anything if
* there is no lun 0.
*/
if (add_msa2xxx_enclosure_device(h, tmpdevice, this_device,
lunaddrbytes, bus, target, lun, lunzerobits,
&nmsa2xxx_enclosures)) {
ncurrent++;
this_device = currentsd[ncurrent];
}
*this_device = *tmpdevice;
hpsa_set_bus_target_lun(this_device, bus, target, lun);
switch (this_device->devtype) {
case TYPE_ROM:
/* We don't *really* support actual CD-ROM devices,
* just "One Button Disaster Recovery" tape drive
* which temporarily pretends to be a CD-ROM drive.
* So we check that the device is really an OBDR tape
* device by checking for "$DR-10" in bytes 43-48 of
* the inquiry data.
*/
if (is_OBDR)
ncurrent++;
break;
case TYPE_DISK:
if (i < nphysicals)
break;
ncurrent++;
break;
case TYPE_TAPE:
case TYPE_MEDIUM_CHANGER:
ncurrent++;
break;
case TYPE_RAID:
/* Only present the Smartarray HBA as a RAID controller.
* If it's a RAID controller other than the HBA itself
* (an external RAID controller, MSA500 or similar)
* don't present it.
*/
if (!is_hba_lunid(lunaddrbytes))
break;
ncurrent++;
break;
default:
break;
}
if (ncurrent >= HPSA_MAX_DEVICES)
break;
}
adjust_hpsa_scsi_table(h, hostno, currentsd, ncurrent);
out:
kfree(tmpdevice);
for (i = 0; i < ndev_allocated; i++)
kfree(currentsd[i]);
kfree(currentsd);
kfree(physdev_list);
kfree(logdev_list);
}
/* hpsa_scatter_gather takes a struct scsi_cmnd, (cmd), and does the pci
* dma mapping and fills in the scatter gather entries of the
* hpsa command, cp.
*/
static int hpsa_scatter_gather(struct ctlr_info *h,
struct CommandList *cp,
struct scsi_cmnd *cmd)
{
unsigned int len;
struct scatterlist *sg;
u64 addr64;
int use_sg, i, sg_index, chained;
struct SGDescriptor *curr_sg;
BUG_ON(scsi_sg_count(cmd) > h->maxsgentries);
use_sg = scsi_dma_map(cmd);
if (use_sg < 0)
return use_sg;
if (!use_sg)
goto sglist_finished;
curr_sg = cp->SG;
chained = 0;
sg_index = 0;
scsi_for_each_sg(cmd, sg, use_sg, i) {
if (i == h->max_cmd_sg_entries - 1 &&
use_sg > h->max_cmd_sg_entries) {
chained = 1;
curr_sg = h->cmd_sg_list[cp->cmdindex];
sg_index = 0;
}
addr64 = (u64) sg_dma_address(sg);
len = sg_dma_len(sg);
curr_sg->Addr.lower = (u32) (addr64 & 0x0FFFFFFFFULL);
curr_sg->Addr.upper = (u32) ((addr64 >> 32) & 0x0FFFFFFFFULL);
curr_sg->Len = len;
curr_sg->Ext = 0; /* we are not chaining */
curr_sg++;
}
if (use_sg + chained > h->maxSG)
h->maxSG = use_sg + chained;
if (chained) {
cp->Header.SGList = h->max_cmd_sg_entries;
cp->Header.SGTotal = (u16) (use_sg + 1);
hpsa_map_sg_chain_block(h, cp);
return 0;
}
sglist_finished:
cp->Header.SGList = (u8) use_sg; /* no. SGs contig in this cmd */
cp->Header.SGTotal = (u16) use_sg; /* total sgs in this cmd list */
return 0;
}
static int hpsa_scsi_queue_command_lck(struct scsi_cmnd *cmd,
void (*done)(struct scsi_cmnd *))
{
struct ctlr_info *h;
struct hpsa_scsi_dev_t *dev;
unsigned char scsi3addr[8];
struct CommandList *c;
unsigned long flags;
/* Get the ptr to our adapter structure out of cmd->host. */
h = sdev_to_hba(cmd->device);
dev = cmd->device->hostdata;
if (!dev) {
cmd->result = DID_NO_CONNECT << 16;
done(cmd);
return 0;
}
memcpy(scsi3addr, dev->scsi3addr, sizeof(scsi3addr));
spin_lock_irqsave(&h->lock, flags);
if (unlikely(h->lockup_detected)) {
spin_unlock_irqrestore(&h->lock, flags);
cmd->result = DID_ERROR << 16;
done(cmd);
return 0;
}
/* Need a lock as this is being allocated from the pool */
c = cmd_alloc(h);
spin_unlock_irqrestore(&h->lock, flags);
if (c == NULL) { /* trouble... */
dev_err(&h->pdev->dev, "cmd_alloc returned NULL!\n");
return SCSI_MLQUEUE_HOST_BUSY;
}
/* Fill in the command list header */
cmd->scsi_done = done; /* save this for use by completion code */
/* save c in case we have to abort it */
cmd->host_scribble = (unsigned char *) c;
c->cmd_type = CMD_SCSI;
c->scsi_cmd = cmd;
c->Header.ReplyQueue = 0; /* unused in simple mode */
memcpy(&c->Header.LUN.LunAddrBytes[0], &scsi3addr[0], 8);
c->Header.Tag.lower = (c->cmdindex << DIRECT_LOOKUP_SHIFT);
c->Header.Tag.lower |= DIRECT_LOOKUP_BIT;
/* Fill in the request block... */
c->Request.Timeout = 0;
memset(c->Request.CDB, 0, sizeof(c->Request.CDB));
BUG_ON(cmd->cmd_len > sizeof(c->Request.CDB));
c->Request.CDBLen = cmd->cmd_len;
memcpy(c->Request.CDB, cmd->cmnd, cmd->cmd_len);
c->Request.Type.Type = TYPE_CMD;
c->Request.Type.Attribute = ATTR_SIMPLE;
switch (cmd->sc_data_direction) {
case DMA_TO_DEVICE:
c->Request.Type.Direction = XFER_WRITE;
break;
case DMA_FROM_DEVICE:
c->Request.Type.Direction = XFER_READ;
break;
case DMA_NONE:
c->Request.Type.Direction = XFER_NONE;
break;
case DMA_BIDIRECTIONAL:
/* This can happen if a buggy application does a scsi passthru
* and sets both inlen and outlen to non-zero. ( see
* ../scsi/scsi_ioctl.c:scsi_ioctl_send_command() )
*/
c->Request.Type.Direction = XFER_RSVD;
/* This is technically wrong, and hpsa controllers should
* reject it with CMD_INVALID, which is the most correct
* response, but non-fibre backends appear to let it
* slide by, and give the same results as if this field
* were set correctly. Either way is acceptable for
* our purposes here.
*/
break;
default:
dev_err(&h->pdev->dev, "unknown data direction: %d\n",
cmd->sc_data_direction);
BUG();
break;
}
if (hpsa_scatter_gather(h, c, cmd) < 0) { /* Fill SG list */
cmd_free(h, c);
return SCSI_MLQUEUE_HOST_BUSY;
}
enqueue_cmd_and_start_io(h, c);
/* the cmd'll come back via intr handler in complete_scsi_command() */
return 0;
}
static DEF_SCSI_QCMD(hpsa_scsi_queue_command)
static void hpsa_scan_start(struct Scsi_Host *sh)
{
struct ctlr_info *h = shost_to_hba(sh);
unsigned long flags;
/* wait until any scan already in progress is finished. */
while (1) {
spin_lock_irqsave(&h->scan_lock, flags);
if (h->scan_finished)
break;
spin_unlock_irqrestore(&h->scan_lock, flags);
wait_event(h->scan_wait_queue, h->scan_finished);
/* Note: We don't need to worry about a race between this
* thread and driver unload because the midlayer will
* have incremented the reference count, so unload won't
* happen if we're in here.
*/
}
h->scan_finished = 0; /* mark scan as in progress */
spin_unlock_irqrestore(&h->scan_lock, flags);
hpsa_update_scsi_devices(h, h->scsi_host->host_no);
spin_lock_irqsave(&h->scan_lock, flags);
h->scan_finished = 1; /* mark scan as finished. */
wake_up_all(&h->scan_wait_queue);
spin_unlock_irqrestore(&h->scan_lock, flags);
}
static int hpsa_scan_finished(struct Scsi_Host *sh,
unsigned long elapsed_time)
{
struct ctlr_info *h = shost_to_hba(sh);
unsigned long flags;
int finished;
spin_lock_irqsave(&h->scan_lock, flags);
finished = h->scan_finished;
spin_unlock_irqrestore(&h->scan_lock, flags);
return finished;
}
static int hpsa_change_queue_depth(struct scsi_device *sdev,
int qdepth, int reason)
{
struct ctlr_info *h = sdev_to_hba(sdev);
if (reason != SCSI_QDEPTH_DEFAULT)
return -ENOTSUPP;
if (qdepth < 1)
qdepth = 1;
else
if (qdepth > h->nr_cmds)
qdepth = h->nr_cmds;
scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev), qdepth);
return sdev->queue_depth;
}
static void hpsa_unregister_scsi(struct ctlr_info *h)
{
/* we are being forcibly unloaded, and may not refuse. */
scsi_remove_host(h->scsi_host);
scsi_host_put(h->scsi_host);
h->scsi_host = NULL;
}
static int hpsa_register_scsi(struct ctlr_info *h)
{
int rc;
rc = hpsa_scsi_detect(h);
if (rc != 0)
dev_err(&h->pdev->dev, "hpsa_register_scsi: failed"
" hpsa_scsi_detect(), rc is %d\n", rc);
return rc;
}
static int wait_for_device_to_become_ready(struct ctlr_info *h,
unsigned char lunaddr[])
{
int rc = 0;
int count = 0;
int waittime = 1; /* seconds */
struct CommandList *c;
c = cmd_special_alloc(h);
if (!c) {
dev_warn(&h->pdev->dev, "out of memory in "
"wait_for_device_to_become_ready.\n");
return IO_ERROR;
}
/* Send test unit ready until device ready, or give up. */
while (count < HPSA_TUR_RETRY_LIMIT) {
/* Wait for a bit. do this first, because if we send
* the TUR right away, the reset will just abort it.
*/
msleep(1000 * waittime);
count++;
/* Increase wait time with each try, up to a point. */
if (waittime < HPSA_MAX_WAIT_INTERVAL_SECS)
waittime = waittime * 2;
/* Send the Test Unit Ready */
fill_cmd(c, TEST_UNIT_READY, h, NULL, 0, 0, lunaddr, TYPE_CMD);
hpsa_scsi_do_simple_cmd_core(h, c);
/* no unmap needed here because no data xfer. */
if (c->err_info->CommandStatus == CMD_SUCCESS)
break;
if (c->err_info->CommandStatus == CMD_TARGET_STATUS &&
c->err_info->ScsiStatus == SAM_STAT_CHECK_CONDITION &&
(c->err_info->SenseInfo[2] == NO_SENSE ||
c->err_info->SenseInfo[2] == UNIT_ATTENTION))
break;
dev_warn(&h->pdev->dev, "waiting %d secs "
"for device to become ready.\n", waittime);
rc = 1; /* device not ready. */
}
if (rc)
dev_warn(&h->pdev->dev, "giving up on device.\n");
else
dev_warn(&h->pdev->dev, "device is ready.\n");
cmd_special_free(h, c);
return rc;
}
/* Need at least one of these error handlers to keep ../scsi/hosts.c from
* complaining. Doing a host- or bus-reset can't do anything good here.
*/
static int hpsa_eh_device_reset_handler(struct scsi_cmnd *scsicmd)
{
int rc;
struct ctlr_info *h;
struct hpsa_scsi_dev_t *dev;
/* find the controller to which the command to be aborted was sent */
h = sdev_to_hba(scsicmd->device);
if (h == NULL) /* paranoia */
return FAILED;
dev = scsicmd->device->hostdata;
if (!dev) {
dev_err(&h->pdev->dev, "hpsa_eh_device_reset_handler: "
"device lookup failed.\n");
return FAILED;
}
dev_warn(&h->pdev->dev, "resetting device %d:%d:%d:%d\n",
h->scsi_host->host_no, dev->bus, dev->target, dev->lun);
/* send a reset to the SCSI LUN which the command was sent to */
rc = hpsa_send_reset(h, dev->scsi3addr);
if (rc == 0 && wait_for_device_to_become_ready(h, dev->scsi3addr) == 0)
return SUCCESS;
dev_warn(&h->pdev->dev, "resetting device failed.\n");
return FAILED;
}
/*
* For operations that cannot sleep, a command block is allocated at init,
* and managed by cmd_alloc() and cmd_free() using a simple bitmap to track
* which ones are free or in use. Lock must be held when calling this.
* cmd_free() is the complement.
*/
static struct CommandList *cmd_alloc(struct ctlr_info *h)
{
struct CommandList *c;
int i;
union u64bit temp64;
dma_addr_t cmd_dma_handle, err_dma_handle;
do {
i = find_first_zero_bit(h->cmd_pool_bits, h->nr_cmds);
if (i == h->nr_cmds)
return NULL;
} while (test_and_set_bit
(i & (BITS_PER_LONG - 1),
h->cmd_pool_bits + (i / BITS_PER_LONG)) != 0);
c = h->cmd_pool + i;
memset(c, 0, sizeof(*c));
cmd_dma_handle = h->cmd_pool_dhandle
+ i * sizeof(*c);
c->err_info = h->errinfo_pool + i;
memset(c->err_info, 0, sizeof(*c->err_info));
err_dma_handle = h->errinfo_pool_dhandle
+ i * sizeof(*c->err_info);
h->nr_allocs++;
c->cmdindex = i;
INIT_LIST_HEAD(&c->list);
c->busaddr = (u32) cmd_dma_handle;
temp64.val = (u64) err_dma_handle;
c->ErrDesc.Addr.lower = temp64.val32.lower;
c->ErrDesc.Addr.upper = temp64.val32.upper;
c->ErrDesc.Len = sizeof(*c->err_info);
c->h = h;
return c;
}
/* For operations that can wait for kmalloc to possibly sleep,
* this routine can be called. Lock need not be held to call
* cmd_special_alloc. cmd_special_free() is the complement.
*/
static struct CommandList *cmd_special_alloc(struct ctlr_info *h)
{
struct CommandList *c;
union u64bit temp64;
dma_addr_t cmd_dma_handle, err_dma_handle;
c = pci_alloc_consistent(h->pdev, sizeof(*c), &cmd_dma_handle);
if (c == NULL)
return NULL;
memset(c, 0, sizeof(*c));
c->cmdindex = -1;
c->err_info = pci_alloc_consistent(h->pdev, sizeof(*c->err_info),
&err_dma_handle);
if (c->err_info == NULL) {
pci_free_consistent(h->pdev,
sizeof(*c), c, cmd_dma_handle);
return NULL;
}
memset(c->err_info, 0, sizeof(*c->err_info));
INIT_LIST_HEAD(&c->list);
c->busaddr = (u32) cmd_dma_handle;
temp64.val = (u64) err_dma_handle;
c->ErrDesc.Addr.lower = temp64.val32.lower;
c->ErrDesc.Addr.upper = temp64.val32.upper;
c->ErrDesc.Len = sizeof(*c->err_info);
c->h = h;
return c;
}
static void cmd_free(struct ctlr_info *h, struct CommandList *c)
{
int i;
i = c - h->cmd_pool;
clear_bit(i & (BITS_PER_LONG - 1),
h->cmd_pool_bits + (i / BITS_PER_LONG));
h->nr_frees++;
}
static void cmd_special_free(struct ctlr_info *h, struct CommandList *c)
{
union u64bit temp64;
temp64.val32.lower = c->ErrDesc.Addr.lower;
temp64.val32.upper = c->ErrDesc.Addr.upper;
pci_free_consistent(h->pdev, sizeof(*c->err_info),
c->err_info, (dma_addr_t) temp64.val);
pci_free_consistent(h->pdev, sizeof(*c),
c, (dma_addr_t) (c->busaddr & DIRECT_LOOKUP_MASK));
}
#ifdef CONFIG_COMPAT
static int hpsa_ioctl32_passthru(struct scsi_device *dev, int cmd, void *arg)
{
IOCTL32_Command_struct __user *arg32 =
(IOCTL32_Command_struct __user *) arg;
IOCTL_Command_struct arg64;
IOCTL_Command_struct __user *p = compat_alloc_user_space(sizeof(arg64));
int err;
u32 cp;
memset(&arg64, 0, sizeof(arg64));
err = 0;
err |= copy_from_user(&arg64.LUN_info, &arg32->LUN_info,
sizeof(arg64.LUN_info));
err |= copy_from_user(&arg64.Request, &arg32->Request,
sizeof(arg64.Request));
err |= copy_from_user(&arg64.error_info, &arg32->error_info,
sizeof(arg64.error_info));
err |= get_user(arg64.buf_size, &arg32->buf_size);
err |= get_user(cp, &arg32->buf);
arg64.buf = compat_ptr(cp);
err |= copy_to_user(p, &arg64, sizeof(arg64));
if (err)
return -EFAULT;
err = hpsa_ioctl(dev, CCISS_PASSTHRU, (void *)p);
if (err)
return err;
err |= copy_in_user(&arg32->error_info, &p->error_info,
sizeof(arg32->error_info));
if (err)
return -EFAULT;
return err;
}
static int hpsa_ioctl32_big_passthru(struct scsi_device *dev,
int cmd, void *arg)
{
BIG_IOCTL32_Command_struct __user *arg32 =
(BIG_IOCTL32_Command_struct __user *) arg;
BIG_IOCTL_Command_struct arg64;
BIG_IOCTL_Command_struct __user *p =
compat_alloc_user_space(sizeof(arg64));
int err;
u32 cp;
memset(&arg64, 0, sizeof(arg64));
err = 0;
err |= copy_from_user(&arg64.LUN_info, &arg32->LUN_info,
sizeof(arg64.LUN_info));
err |= copy_from_user(&arg64.Request, &arg32->Request,
sizeof(arg64.Request));
err |= copy_from_user(&arg64.error_info, &arg32->error_info,
sizeof(arg64.error_info));
err |= get_user(arg64.buf_size, &arg32->buf_size);
err |= get_user(arg64.malloc_size, &arg32->malloc_size);
err |= get_user(cp, &arg32->buf);
arg64.buf = compat_ptr(cp);
err |= copy_to_user(p, &arg64, sizeof(arg64));
if (err)
return -EFAULT;
err = hpsa_ioctl(dev, CCISS_BIG_PASSTHRU, (void *)p);
if (err)
return err;
err |= copy_in_user(&arg32->error_info, &p->error_info,
sizeof(arg32->error_info));
if (err)
return -EFAULT;
return err;
}
static int hpsa_compat_ioctl(struct scsi_device *dev, int cmd, void *arg)
{
switch (cmd) {
case CCISS_GETPCIINFO:
case CCISS_GETINTINFO:
case CCISS_SETINTINFO:
case CCISS_GETNODENAME:
case CCISS_SETNODENAME:
case CCISS_GETHEARTBEAT:
case CCISS_GETBUSTYPES:
case CCISS_GETFIRMVER:
case CCISS_GETDRIVVER:
case CCISS_REVALIDVOLS:
case CCISS_DEREGDISK:
case CCISS_REGNEWDISK:
case CCISS_REGNEWD:
case CCISS_RESCANDISK:
case CCISS_GETLUNINFO:
return hpsa_ioctl(dev, cmd, arg);
case CCISS_PASSTHRU32:
return hpsa_ioctl32_passthru(dev, cmd, arg);
case CCISS_BIG_PASSTHRU32:
return hpsa_ioctl32_big_passthru(dev, cmd, arg);
default:
return -ENOIOCTLCMD;
}
}
#endif
static int hpsa_getpciinfo_ioctl(struct ctlr_info *h, void __user *argp)
{
struct hpsa_pci_info pciinfo;
if (!argp)
return -EINVAL;
pciinfo.domain = pci_domain_nr(h->pdev->bus);
pciinfo.bus = h->pdev->bus->number;
pciinfo.dev_fn = h->pdev->devfn;
pciinfo.board_id = h->board_id;
if (copy_to_user(argp, &pciinfo, sizeof(pciinfo)))
return -EFAULT;
return 0;
}
static int hpsa_getdrivver_ioctl(struct ctlr_info *h, void __user *argp)
{
DriverVer_type DriverVer;
unsigned char vmaj, vmin, vsubmin;
int rc;
rc = sscanf(HPSA_DRIVER_VERSION, "%hhu.%hhu.%hhu",
&vmaj, &vmin, &vsubmin);
if (rc != 3) {
dev_info(&h->pdev->dev, "driver version string '%s' "
"unrecognized.", HPSA_DRIVER_VERSION);
vmaj = 0;
vmin = 0;
vsubmin = 0;
}
DriverVer = (vmaj << 16) | (vmin << 8) | vsubmin;
if (!argp)
return -EINVAL;
if (copy_to_user(argp, &DriverVer, sizeof(DriverVer_type)))
return -EFAULT;
return 0;
}
static int hpsa_passthru_ioctl(struct ctlr_info *h, void __user *argp)
{
IOCTL_Command_struct iocommand;
struct CommandList *c;
char *buff = NULL;
union u64bit temp64;
if (!argp)
return -EINVAL;
if (!capable(CAP_SYS_RAWIO))
return -EPERM;
if (copy_from_user(&iocommand, argp, sizeof(iocommand)))
return -EFAULT;
if ((iocommand.buf_size < 1) &&
(iocommand.Request.Type.Direction != XFER_NONE)) {
return -EINVAL;
}
if (iocommand.buf_size > 0) {
buff = kmalloc(iocommand.buf_size, GFP_KERNEL);
if (buff == NULL)
return -EFAULT;
if (iocommand.Request.Type.Direction == XFER_WRITE) {
/* Copy the data into the buffer we created */
if (copy_from_user(buff, iocommand.buf,
iocommand.buf_size)) {
kfree(buff);
return -EFAULT;
}
} else {
memset(buff, 0, iocommand.buf_size);
}
}
c = cmd_special_alloc(h);
if (c == NULL) {
kfree(buff);
return -ENOMEM;
}
/* Fill in the command type */
c->cmd_type = CMD_IOCTL_PEND;
/* Fill in Command Header */
c->Header.ReplyQueue = 0; /* unused in simple mode */
if (iocommand.buf_size > 0) { /* buffer to fill */
c->Header.SGList = 1;
c->Header.SGTotal = 1;
} else { /* no buffers to fill */
c->Header.SGList = 0;
c->Header.SGTotal = 0;
}
memcpy(&c->Header.LUN, &iocommand.LUN_info, sizeof(c->Header.LUN));
/* use the kernel address the cmd block for tag */
c->Header.Tag.lower = c->busaddr;
/* Fill in Request block */
memcpy(&c->Request, &iocommand.Request,
sizeof(c->Request));
/* Fill in the scatter gather information */
if (iocommand.buf_size > 0) {
temp64.val = pci_map_single(h->pdev, buff,
iocommand.buf_size, PCI_DMA_BIDIRECTIONAL);
c->SG[0].Addr.lower = temp64.val32.lower;
c->SG[0].Addr.upper = temp64.val32.upper;
c->SG[0].Len = iocommand.buf_size;
c->SG[0].Ext = 0; /* we are not chaining*/
}
hpsa_scsi_do_simple_cmd_core_if_no_lockup(h, c);
if (iocommand.buf_size > 0)
hpsa_pci_unmap(h->pdev, c, 1, PCI_DMA_BIDIRECTIONAL);
check_ioctl_unit_attention(h, c);
/* Copy the error information out */
memcpy(&iocommand.error_info, c->err_info,
sizeof(iocommand.error_info));
if (copy_to_user(argp, &iocommand, sizeof(iocommand))) {
kfree(buff);
cmd_special_free(h, c);
return -EFAULT;
}
if (iocommand.Request.Type.Direction == XFER_READ &&
iocommand.buf_size > 0) {
/* Copy the data out of the buffer we created */
if (copy_to_user(iocommand.buf, buff, iocommand.buf_size)) {
kfree(buff);
cmd_special_free(h, c);
return -EFAULT;
}
}
kfree(buff);
cmd_special_free(h, c);
return 0;
}
static int hpsa_big_passthru_ioctl(struct ctlr_info *h, void __user *argp)
{
BIG_IOCTL_Command_struct *ioc;
struct CommandList *c;
unsigned char **buff = NULL;
int *buff_size = NULL;
union u64bit temp64;
BYTE sg_used = 0;
int status = 0;
int i;
u32 left;
u32 sz;
BYTE __user *data_ptr;
if (!argp)
return -EINVAL;
if (!capable(CAP_SYS_RAWIO))
return -EPERM;
ioc = (BIG_IOCTL_Command_struct *)
kmalloc(sizeof(*ioc), GFP_KERNEL);
if (!ioc) {
status = -ENOMEM;
goto cleanup1;
}
if (copy_from_user(ioc, argp, sizeof(*ioc))) {
status = -EFAULT;
goto cleanup1;
}
if ((ioc->buf_size < 1) &&
(ioc->Request.Type.Direction != XFER_NONE)) {
status = -EINVAL;
goto cleanup1;
}
/* Check kmalloc limits using all SGs */
if (ioc->malloc_size > MAX_KMALLOC_SIZE) {
status = -EINVAL;
goto cleanup1;
}
if (ioc->buf_size > ioc->malloc_size * MAXSGENTRIES) {
status = -EINVAL;
goto cleanup1;
}
buff = kzalloc(MAXSGENTRIES * sizeof(char *), GFP_KERNEL);
if (!buff) {
status = -ENOMEM;
goto cleanup1;
}
buff_size = kmalloc(MAXSGENTRIES * sizeof(int), GFP_KERNEL);
if (!buff_size) {
status = -ENOMEM;
goto cleanup1;
}
left = ioc->buf_size;
data_ptr = ioc->buf;
while (left) {
sz = (left > ioc->malloc_size) ? ioc->malloc_size : left;
buff_size[sg_used] = sz;
buff[sg_used] = kmalloc(sz, GFP_KERNEL);
if (buff[sg_used] == NULL) {
status = -ENOMEM;
goto cleanup1;
}
if (ioc->Request.Type.Direction == XFER_WRITE) {
if (copy_from_user(buff[sg_used], data_ptr, sz)) {
status = -ENOMEM;
goto cleanup1;
}
} else
memset(buff[sg_used], 0, sz);
left -= sz;
data_ptr += sz;
sg_used++;
}
c = cmd_special_alloc(h);
if (c == NULL) {
status = -ENOMEM;
goto cleanup1;
}
c->cmd_type = CMD_IOCTL_PEND;
c->Header.ReplyQueue = 0;
c->Header.SGList = c->Header.SGTotal = sg_used;
memcpy(&c->Header.LUN, &ioc->LUN_info, sizeof(c->Header.LUN));
c->Header.Tag.lower = c->busaddr;
memcpy(&c->Request, &ioc->Request, sizeof(c->Request));
if (ioc->buf_size > 0) {
int i;
for (i = 0; i < sg_used; i++) {
temp64.val = pci_map_single(h->pdev, buff[i],
buff_size[i], PCI_DMA_BIDIRECTIONAL);
c->SG[i].Addr.lower = temp64.val32.lower;
c->SG[i].Addr.upper = temp64.val32.upper;
c->SG[i].Len = buff_size[i];
/* we are not chaining */
c->SG[i].Ext = 0;
}
}
hpsa_scsi_do_simple_cmd_core_if_no_lockup(h, c);
if (sg_used)
hpsa_pci_unmap(h->pdev, c, sg_used, PCI_DMA_BIDIRECTIONAL);
check_ioctl_unit_attention(h, c);
/* Copy the error information out */
memcpy(&ioc->error_info, c->err_info, sizeof(ioc->error_info));
if (copy_to_user(argp, ioc, sizeof(*ioc))) {
cmd_special_free(h, c);
status = -EFAULT;
goto cleanup1;
}
if (ioc->Request.Type.Direction == XFER_READ && ioc->buf_size > 0) {
/* Copy the data out of the buffer we created */
BYTE __user *ptr = ioc->buf;
for (i = 0; i < sg_used; i++) {
if (copy_to_user(ptr, buff[i], buff_size[i])) {
cmd_special_free(h, c);
status = -EFAULT;
goto cleanup1;
}
ptr += buff_size[i];
}
}
cmd_special_free(h, c);
status = 0;
cleanup1:
if (buff) {
for (i = 0; i < sg_used; i++)
kfree(buff[i]);
kfree(buff);
}
kfree(buff_size);
kfree(ioc);
return status;
}
static void check_ioctl_unit_attention(struct ctlr_info *h,
struct CommandList *c)
{
if (c->err_info->CommandStatus == CMD_TARGET_STATUS &&
c->err_info->ScsiStatus != SAM_STAT_CHECK_CONDITION)
(void) check_for_unit_attention(h, c);
}
/*
* ioctl
*/
static int hpsa_ioctl(struct scsi_device *dev, int cmd, void *arg)
{
struct ctlr_info *h;
void __user *argp = (void __user *)arg;
h = sdev_to_hba(dev);
switch (cmd) {
case CCISS_DEREGDISK:
case CCISS_REGNEWDISK:
case CCISS_REGNEWD:
hpsa_scan_start(h->scsi_host);
return 0;
case CCISS_GETPCIINFO:
return hpsa_getpciinfo_ioctl(h, argp);
case CCISS_GETDRIVVER:
return hpsa_getdrivver_ioctl(h, argp);
case CCISS_PASSTHRU:
return hpsa_passthru_ioctl(h, argp);
case CCISS_BIG_PASSTHRU:
return hpsa_big_passthru_ioctl(h, argp);
default:
return -ENOTTY;
}
}
static int __devinit hpsa_send_host_reset(struct ctlr_info *h,
unsigned char *scsi3addr, u8 reset_type)
{
struct CommandList *c;
c = cmd_alloc(h);
if (!c)
return -ENOMEM;
fill_cmd(c, HPSA_DEVICE_RESET_MSG, h, NULL, 0, 0,
RAID_CTLR_LUNID, TYPE_MSG);
c->Request.CDB[1] = reset_type; /* fill_cmd defaults to target reset */
c->waiting = NULL;
enqueue_cmd_and_start_io(h, c);
/* Don't wait for completion, the reset won't complete. Don't free
* the command either. This is the last command we will send before
* re-initializing everything, so it doesn't matter and won't leak.
*/
return 0;
}
static void fill_cmd(struct CommandList *c, u8 cmd, struct ctlr_info *h,
void *buff, size_t size, u8 page_code, unsigned char *scsi3addr,
int cmd_type)
{
int pci_dir = XFER_NONE;
c->cmd_type = CMD_IOCTL_PEND;
c->Header.ReplyQueue = 0;
if (buff != NULL && size > 0) {
c->Header.SGList = 1;
c->Header.SGTotal = 1;
} else {
c->Header.SGList = 0;
c->Header.SGTotal = 0;
}
c->Header.Tag.lower = c->busaddr;
memcpy(c->Header.LUN.LunAddrBytes, scsi3addr, 8);
c->Request.Type.Type = cmd_type;
if (cmd_type == TYPE_CMD) {
switch (cmd) {
case HPSA_INQUIRY:
/* are we trying to read a vital product page */
if (page_code != 0) {
c->Request.CDB[1] = 0x01;
c->Request.CDB[2] = page_code;
}
c->Request.CDBLen = 6;
c->Request.Type.Attribute = ATTR_SIMPLE;
c->Request.Type.Direction = XFER_READ;
c->Request.Timeout = 0;
c->Request.CDB[0] = HPSA_INQUIRY;
c->Request.CDB[4] = size & 0xFF;
break;
case HPSA_REPORT_LOG:
case HPSA_REPORT_PHYS:
/* Talking to controller so It's a physical command
mode = 00 target = 0. Nothing to write.
*/
c->Request.CDBLen = 12;
c->Request.Type.Attribute = ATTR_SIMPLE;
c->Request.Type.Direction = XFER_READ;
c->Request.Timeout = 0;
c->Request.CDB[0] = cmd;
c->Request.CDB[6] = (size >> 24) & 0xFF; /* MSB */
c->Request.CDB[7] = (size >> 16) & 0xFF;
c->Request.CDB[8] = (size >> 8) & 0xFF;
c->Request.CDB[9] = size & 0xFF;
break;
case HPSA_CACHE_FLUSH:
c->Request.CDBLen = 12;
c->Request.Type.Attribute = ATTR_SIMPLE;
c->Request.Type.Direction = XFER_WRITE;
c->Request.Timeout = 0;
c->Request.CDB[0] = BMIC_WRITE;
c->Request.CDB[6] = BMIC_CACHE_FLUSH;
c->Request.CDB[7] = (size >> 8) & 0xFF;
c->Request.CDB[8] = size & 0xFF;
break;
case TEST_UNIT_READY:
c->Request.CDBLen = 6;
c->Request.Type.Attribute = ATTR_SIMPLE;
c->Request.Type.Direction = XFER_NONE;
c->Request.Timeout = 0;
break;
default:
dev_warn(&h->pdev->dev, "unknown command 0x%c\n", cmd);
BUG();
return;
}
} else if (cmd_type == TYPE_MSG) {
switch (cmd) {
case HPSA_DEVICE_RESET_MSG:
c->Request.CDBLen = 16;
c->Request.Type.Type = 1; /* It is a MSG not a CMD */
c->Request.Type.Attribute = ATTR_SIMPLE;
c->Request.Type.Direction = XFER_NONE;
c->Request.Timeout = 0; /* Don't time out */
memset(&c->Request.CDB[0], 0, sizeof(c->Request.CDB));
c->Request.CDB[0] = cmd;
c->Request.CDB[1] = 0x03; /* Reset target above */
/* If bytes 4-7 are zero, it means reset the */
/* LunID device */
c->Request.CDB[4] = 0x00;
c->Request.CDB[5] = 0x00;
c->Request.CDB[6] = 0x00;
c->Request.CDB[7] = 0x00;
break;
default:
dev_warn(&h->pdev->dev, "unknown message type %d\n",
cmd);
BUG();
}
} else {
dev_warn(&h->pdev->dev, "unknown command type %d\n", cmd_type);
BUG();
}
switch (c->Request.Type.Direction) {
case XFER_READ:
pci_dir = PCI_DMA_FROMDEVICE;
break;
case XFER_WRITE:
pci_dir = PCI_DMA_TODEVICE;
break;
case XFER_NONE:
pci_dir = PCI_DMA_NONE;
break;
default:
pci_dir = PCI_DMA_BIDIRECTIONAL;
}
hpsa_map_one(h->pdev, c, buff, size, pci_dir);
return;
}
/*
* Map (physical) PCI mem into (virtual) kernel space
*/
static void __iomem *remap_pci_mem(ulong base, ulong size)
{
ulong page_base = ((ulong) base) & PAGE_MASK;
ulong page_offs = ((ulong) base) - page_base;
void __iomem *page_remapped = ioremap(page_base, page_offs + size);
return page_remapped ? (page_remapped + page_offs) : NULL;
}
/* Takes cmds off the submission queue and sends them to the hardware,
* then puts them on the queue of cmds waiting for completion.
*/
static void start_io(struct ctlr_info *h)
{
struct CommandList *c;
while (!list_empty(&h->reqQ)) {
c = list_entry(h->reqQ.next, struct CommandList, list);
/* can't do anything if fifo is full */
if ((h->access.fifo_full(h))) {
dev_warn(&h->pdev->dev, "fifo full\n");
break;
}
/* Get the first entry from the Request Q */
removeQ(c);
h->Qdepth--;
/* Tell the controller execute command */
h->access.submit_command(h, c);
/* Put job onto the completed Q */
addQ(&h->cmpQ, c);
}
}
static inline unsigned long get_next_completion(struct ctlr_info *h)
{
return h->access.command_completed(h);
}
static inline bool interrupt_pending(struct ctlr_info *h)
{
return h->access.intr_pending(h);
}
static inline long interrupt_not_for_us(struct ctlr_info *h)
{
return (h->access.intr_pending(h) == 0) ||
(h->interrupts_enabled == 0);
}
static inline int bad_tag(struct ctlr_info *h, u32 tag_index,
u32 raw_tag)
{
if (unlikely(tag_index >= h->nr_cmds)) {
dev_warn(&h->pdev->dev, "bad tag 0x%08x ignored.\n", raw_tag);
return 1;
}
return 0;
}
static inline void finish_cmd(struct CommandList *c, u32 raw_tag)
{
removeQ(c);
if (likely(c->cmd_type == CMD_SCSI))
complete_scsi_command(c);
else if (c->cmd_type == CMD_IOCTL_PEND)
complete(c->waiting);
}
static inline u32 hpsa_tag_contains_index(u32 tag)
{
return tag & DIRECT_LOOKUP_BIT;
}
static inline u32 hpsa_tag_to_index(u32 tag)
{
return tag >> DIRECT_LOOKUP_SHIFT;
}
static inline u32 hpsa_tag_discard_error_bits(struct ctlr_info *h, u32 tag)
{
#define HPSA_PERF_ERROR_BITS ((1 << DIRECT_LOOKUP_SHIFT) - 1)
#define HPSA_SIMPLE_ERROR_BITS 0x03
if (unlikely(!(h->transMethod & CFGTBL_Trans_Performant)))
return tag & ~HPSA_SIMPLE_ERROR_BITS;
return tag & ~HPSA_PERF_ERROR_BITS;
}
/* process completion of an indexed ("direct lookup") command */
static inline u32 process_indexed_cmd(struct ctlr_info *h,
u32 raw_tag)
{
u32 tag_index;
struct CommandList *c;
tag_index = hpsa_tag_to_index(raw_tag);
if (bad_tag(h, tag_index, raw_tag))
return next_command(h);
c = h->cmd_pool + tag_index;
finish_cmd(c, raw_tag);
return next_command(h);
}
/* process completion of a non-indexed command */
static inline u32 process_nonindexed_cmd(struct ctlr_info *h,
u32 raw_tag)
{
u32 tag;
struct CommandList *c = NULL;
tag = hpsa_tag_discard_error_bits(h, raw_tag);
list_for_each_entry(c, &h->cmpQ, list) {
if ((c->busaddr & 0xFFFFFFE0) == (tag & 0xFFFFFFE0)) {
finish_cmd(c, raw_tag);
return next_command(h);
}
}
bad_tag(h, h->nr_cmds + 1, raw_tag);
return next_command(h);
}
/* Some controllers, like p400, will give us one interrupt
* after a soft reset, even if we turned interrupts off.
* Only need to check for this in the hpsa_xxx_discard_completions
* functions.
*/
static int ignore_bogus_interrupt(struct ctlr_info *h)
{
if (likely(!reset_devices))
return 0;
if (likely(h->interrupts_enabled))
return 0;
dev_info(&h->pdev->dev, "Received interrupt while interrupts disabled "
"(known firmware bug.) Ignoring.\n");
return 1;
}
static irqreturn_t hpsa_intx_discard_completions(int irq, void *dev_id)
{
struct ctlr_info *h = dev_id;
unsigned long flags;
u32 raw_tag;
if (ignore_bogus_interrupt(h))
return IRQ_NONE;
if (interrupt_not_for_us(h))
return IRQ_NONE;
spin_lock_irqsave(&h->lock, flags);
h->last_intr_timestamp = get_jiffies_64();
while (interrupt_pending(h)) {
raw_tag = get_next_completion(h);
while (raw_tag != FIFO_EMPTY)
raw_tag = next_command(h);
}
spin_unlock_irqrestore(&h->lock, flags);
return IRQ_HANDLED;
}
static irqreturn_t hpsa_msix_discard_completions(int irq, void *dev_id)
{
struct ctlr_info *h = dev_id;
unsigned long flags;
u32 raw_tag;
if (ignore_bogus_interrupt(h))
return IRQ_NONE;
spin_lock_irqsave(&h->lock, flags);
h->last_intr_timestamp = get_jiffies_64();
raw_tag = get_next_completion(h);
while (raw_tag != FIFO_EMPTY)
raw_tag = next_command(h);
spin_unlock_irqrestore(&h->lock, flags);
return IRQ_HANDLED;
}
static irqreturn_t do_hpsa_intr_intx(int irq, void *dev_id)
{
struct ctlr_info *h = dev_id;
unsigned long flags;
u32 raw_tag;
if (interrupt_not_for_us(h))
return IRQ_NONE;
spin_lock_irqsave(&h->lock, flags);
h->last_intr_timestamp = get_jiffies_64();
while (interrupt_pending(h)) {
raw_tag = get_next_completion(h);
while (raw_tag != FIFO_EMPTY) {
if (hpsa_tag_contains_index(raw_tag))
raw_tag = process_indexed_cmd(h, raw_tag);
else
raw_tag = process_nonindexed_cmd(h, raw_tag);
}
}
spin_unlock_irqrestore(&h->lock, flags);
return IRQ_HANDLED;
}
static irqreturn_t do_hpsa_intr_msi(int irq, void *dev_id)
{
struct ctlr_info *h = dev_id;
unsigned long flags;
u32 raw_tag;
spin_lock_irqsave(&h->lock, flags);
h->last_intr_timestamp = get_jiffies_64();
raw_tag = get_next_completion(h);
while (raw_tag != FIFO_EMPTY) {
if (hpsa_tag_contains_index(raw_tag))
raw_tag = process_indexed_cmd(h, raw_tag);
else
raw_tag = process_nonindexed_cmd(h, raw_tag);
}
spin_unlock_irqrestore(&h->lock, flags);
return IRQ_HANDLED;
}
/* Send a message CDB to the firmware. Careful, this only works
* in simple mode, not performant mode due to the tag lookup.
* We only ever use this immediately after a controller reset.
*/
static __devinit int hpsa_message(struct pci_dev *pdev, unsigned char opcode,
unsigned char type)
{
struct Command {
struct CommandListHeader CommandHeader;
struct RequestBlock Request;
struct ErrDescriptor ErrorDescriptor;
};
struct Command *cmd;
static const size_t cmd_sz = sizeof(*cmd) +
sizeof(cmd->ErrorDescriptor);
dma_addr_t paddr64;
uint32_t paddr32, tag;
void __iomem *vaddr;
int i, err;
vaddr = pci_ioremap_bar(pdev, 0);
if (vaddr == NULL)
return -ENOMEM;
/* The Inbound Post Queue only accepts 32-bit physical addresses for the
* CCISS commands, so they must be allocated from the lower 4GiB of
* memory.
*/
err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32));
if (err) {
iounmap(vaddr);
return -ENOMEM;
}
cmd = pci_alloc_consistent(pdev, cmd_sz, &paddr64);
if (cmd == NULL) {
iounmap(vaddr);
return -ENOMEM;
}
/* This must fit, because of the 32-bit consistent DMA mask. Also,
* although there's no guarantee, we assume that the address is at
* least 4-byte aligned (most likely, it's page-aligned).
*/
paddr32 = paddr64;
cmd->CommandHeader.ReplyQueue = 0;
cmd->CommandHeader.SGList = 0;
cmd->CommandHeader.SGTotal = 0;
cmd->CommandHeader.Tag.lower = paddr32;
cmd->CommandHeader.Tag.upper = 0;
memset(&cmd->CommandHeader.LUN.LunAddrBytes, 0, 8);
cmd->Request.CDBLen = 16;
cmd->Request.Type.Type = TYPE_MSG;
cmd->Request.Type.Attribute = ATTR_HEADOFQUEUE;
cmd->Request.Type.Direction = XFER_NONE;
cmd->Request.Timeout = 0; /* Don't time out */
cmd->Request.CDB[0] = opcode;
cmd->Request.CDB[1] = type;
memset(&cmd->Request.CDB[2], 0, 14); /* rest of the CDB is reserved */
cmd->ErrorDescriptor.Addr.lower = paddr32 + sizeof(*cmd);
cmd->ErrorDescriptor.Addr.upper = 0;
cmd->ErrorDescriptor.Len = sizeof(struct ErrorInfo);
writel(paddr32, vaddr + SA5_REQUEST_PORT_OFFSET);
for (i = 0; i < HPSA_MSG_SEND_RETRY_LIMIT; i++) {
tag = readl(vaddr + SA5_REPLY_PORT_OFFSET);
if ((tag & ~HPSA_SIMPLE_ERROR_BITS) == paddr32)
break;
msleep(HPSA_MSG_SEND_RETRY_INTERVAL_MSECS);
}
iounmap(vaddr);
/* we leak the DMA buffer here ... no choice since the controller could
* still complete the command.
*/
if (i == HPSA_MSG_SEND_RETRY_LIMIT) {
dev_err(&pdev->dev, "controller message %02x:%02x timed out\n",
opcode, type);
return -ETIMEDOUT;
}
pci_free_consistent(pdev, cmd_sz, cmd, paddr64);
if (tag & HPSA_ERROR_BIT) {
dev_err(&pdev->dev, "controller message %02x:%02x failed\n",
opcode, type);
return -EIO;
}
dev_info(&pdev->dev, "controller message %02x:%02x succeeded\n",
opcode, type);
return 0;
}
#define hpsa_noop(p) hpsa_message(p, 3, 0)
static int hpsa_controller_hard_reset(struct pci_dev *pdev,
void * __iomem vaddr, u32 use_doorbell)
{
u16 pmcsr;
int pos;
if (use_doorbell) {
/* For everything after the P600, the PCI power state method
* of resetting the controller doesn't work, so we have this
* other way using the doorbell register.
*/
dev_info(&pdev->dev, "using doorbell to reset controller\n");
writel(use_doorbell, vaddr + SA5_DOORBELL);
} else { /* Try to do it the PCI power state way */
/* Quoting from the Open CISS Specification: "The Power
* Management Control/Status Register (CSR) controls the power
* state of the device. The normal operating state is D0,
* CSR=00h. The software off state is D3, CSR=03h. To reset
* the controller, place the interface device in D3 then to D0,
* this causes a secondary PCI reset which will reset the
* controller." */
pos = pci_find_capability(pdev, PCI_CAP_ID_PM);
if (pos == 0) {
dev_err(&pdev->dev,
"hpsa_reset_controller: "
"PCI PM not supported\n");
return -ENODEV;
}
dev_info(&pdev->dev, "using PCI PM to reset controller\n");
/* enter the D3hot power management state */
pci_read_config_word(pdev, pos + PCI_PM_CTRL, &pmcsr);
pmcsr &= ~PCI_PM_CTRL_STATE_MASK;
pmcsr |= PCI_D3hot;
pci_write_config_word(pdev, pos + PCI_PM_CTRL, pmcsr);
msleep(500);
/* enter the D0 power management state */
pmcsr &= ~PCI_PM_CTRL_STATE_MASK;
pmcsr |= PCI_D0;
pci_write_config_word(pdev, pos + PCI_PM_CTRL, pmcsr);
/*
* The P600 requires a small delay when changing states.
* Otherwise we may think the board did not reset and we bail.
* This for kdump only and is particular to the P600.
*/
msleep(500);
}
return 0;
}
static __devinit void init_driver_version(char *driver_version, int len)
{
memset(driver_version, 0, len);
strncpy(driver_version, "hpsa " HPSA_DRIVER_VERSION, len - 1);
}
static __devinit int write_driver_ver_to_cfgtable(
struct CfgTable __iomem *cfgtable)
{
char *driver_version;
int i, size = sizeof(cfgtable->driver_version);
driver_version = kmalloc(size, GFP_KERNEL);
if (!driver_version)
return -ENOMEM;
init_driver_version(driver_version, size);
for (i = 0; i < size; i++)
writeb(driver_version[i], &cfgtable->driver_version[i]);
kfree(driver_version);
return 0;
}
static __devinit void read_driver_ver_from_cfgtable(
struct CfgTable __iomem *cfgtable, unsigned char *driver_ver)
{
int i;
for (i = 0; i < sizeof(cfgtable->driver_version); i++)
driver_ver[i] = readb(&cfgtable->driver_version[i]);
}
static __devinit int controller_reset_failed(
struct CfgTable __iomem *cfgtable)
{
char *driver_ver, *old_driver_ver;
int rc, size = sizeof(cfgtable->driver_version);
old_driver_ver = kmalloc(2 * size, GFP_KERNEL);
if (!old_driver_ver)
return -ENOMEM;
driver_ver = old_driver_ver + size;
/* After a reset, the 32 bytes of "driver version" in the cfgtable
* should have been changed, otherwise we know the reset failed.
*/
init_driver_version(old_driver_ver, size);
read_driver_ver_from_cfgtable(cfgtable, driver_ver);
rc = !memcmp(driver_ver, old_driver_ver, size);
kfree(old_driver_ver);
return rc;
}
/* This does a hard reset of the controller using PCI power management
* states or the using the doorbell register.
*/
static __devinit int hpsa_kdump_hard_reset_controller(struct pci_dev *pdev)
{
u64 cfg_offset;
u32 cfg_base_addr;
u64 cfg_base_addr_index;
void __iomem *vaddr;
unsigned long paddr;
u32 misc_fw_support;
int rc;
struct CfgTable __iomem *cfgtable;
u32 use_doorbell;
u32 board_id;
u16 command_register;
/* For controllers as old as the P600, this is very nearly
* the same thing as
*
* pci_save_state(pci_dev);
* pci_set_power_state(pci_dev, PCI_D3hot);
* pci_set_power_state(pci_dev, PCI_D0);
* pci_restore_state(pci_dev);
*
* For controllers newer than the P600, the pci power state
* method of resetting doesn't work so we have another way
* using the doorbell register.
*/
rc = hpsa_lookup_board_id(pdev, &board_id);
if (rc < 0 || !ctlr_is_resettable(board_id)) {
dev_warn(&pdev->dev, "Not resetting device.\n");
return -ENODEV;
}
/* if controller is soft- but not hard resettable... */
if (!ctlr_is_hard_resettable(board_id))
return -ENOTSUPP; /* try soft reset later. */
/* Save the PCI command register */
pci_read_config_word(pdev, 4, &command_register);
/* Turn the board off. This is so that later pci_restore_state()
* won't turn the board on before the rest of config space is ready.
*/
pci_disable_device(pdev);
pci_save_state(pdev);
/* find the first memory BAR, so we can find the cfg table */
rc = hpsa_pci_find_memory_BAR(pdev, &paddr);
if (rc)
return rc;
vaddr = remap_pci_mem(paddr, 0x250);
if (!vaddr)
return -ENOMEM;
/* find cfgtable in order to check if reset via doorbell is supported */
rc = hpsa_find_cfg_addrs(pdev, vaddr, &cfg_base_addr,
&cfg_base_addr_index, &cfg_offset);
if (rc)
goto unmap_vaddr;
cfgtable = remap_pci_mem(pci_resource_start(pdev,
cfg_base_addr_index) + cfg_offset, sizeof(*cfgtable));
if (!cfgtable) {
rc = -ENOMEM;
goto unmap_vaddr;
}
rc = write_driver_ver_to_cfgtable(cfgtable);
if (rc)
goto unmap_vaddr;
/* If reset via doorbell register is supported, use that.
* There are two such methods. Favor the newest method.
*/
misc_fw_support = readl(&cfgtable->misc_fw_support);
use_doorbell = misc_fw_support & MISC_FW_DOORBELL_RESET2;
if (use_doorbell) {
use_doorbell = DOORBELL_CTLR_RESET2;
} else {
use_doorbell = misc_fw_support & MISC_FW_DOORBELL_RESET;
if (use_doorbell) {
dev_warn(&pdev->dev, "Soft reset not supported. "
"Firmware update is required.\n");
rc = -ENOTSUPP; /* try soft reset */
goto unmap_cfgtable;
}
}
rc = hpsa_controller_hard_reset(pdev, vaddr, use_doorbell);
if (rc)
goto unmap_cfgtable;
pci_restore_state(pdev);
rc = pci_enable_device(pdev);
if (rc) {
dev_warn(&pdev->dev, "failed to enable device.\n");
goto unmap_cfgtable;
}
pci_write_config_word(pdev, 4, command_register);
/* Some devices (notably the HP Smart Array 5i Controller)
need a little pause here */
msleep(HPSA_POST_RESET_PAUSE_MSECS);
/* Wait for board to become not ready, then ready. */
dev_info(&pdev->dev, "Waiting for board to reset.\n");
rc = hpsa_wait_for_board_state(pdev, vaddr, BOARD_NOT_READY);
if (rc) {
dev_warn(&pdev->dev,
"failed waiting for board to reset."
" Will try soft reset.\n");
rc = -ENOTSUPP; /* Not expected, but try soft reset later */
goto unmap_cfgtable;
}
rc = hpsa_wait_for_board_state(pdev, vaddr, BOARD_READY);
if (rc) {
dev_warn(&pdev->dev,
"failed waiting for board to become ready "
"after hard reset\n");
goto unmap_cfgtable;
}
rc = controller_reset_failed(vaddr);
if (rc < 0)
goto unmap_cfgtable;
if (rc) {
dev_warn(&pdev->dev, "Unable to successfully reset "
"controller. Will try soft reset.\n");
rc = -ENOTSUPP;
} else {
dev_info(&pdev->dev, "board ready after hard reset.\n");
}
unmap_cfgtable:
iounmap(cfgtable);
unmap_vaddr:
iounmap(vaddr);
return rc;
}
/*
* We cannot read the structure directly, for portability we must use
* the io functions.
* This is for debug only.
*/
static void print_cfg_table(struct device *dev, struct CfgTable *tb)
{
#ifdef HPSA_DEBUG
int i;
char temp_name[17];
dev_info(dev, "Controller Configuration information\n");
dev_info(dev, "------------------------------------\n");
for (i = 0; i < 4; i++)
temp_name[i] = readb(&(tb->Signature[i]));
temp_name[4] = '\0';
dev_info(dev, " Signature = %s\n", temp_name);
dev_info(dev, " Spec Number = %d\n", readl(&(tb->SpecValence)));
dev_info(dev, " Transport methods supported = 0x%x\n",
readl(&(tb->TransportSupport)));
dev_info(dev, " Transport methods active = 0x%x\n",
readl(&(tb->TransportActive)));
dev_info(dev, " Requested transport Method = 0x%x\n",
readl(&(tb->HostWrite.TransportRequest)));
dev_info(dev, " Coalesce Interrupt Delay = 0x%x\n",
readl(&(tb->HostWrite.CoalIntDelay)));
dev_info(dev, " Coalesce Interrupt Count = 0x%x\n",
readl(&(tb->HostWrite.CoalIntCount)));
dev_info(dev, " Max outstanding commands = 0x%d\n",
readl(&(tb->CmdsOutMax)));
dev_info(dev, " Bus Types = 0x%x\n", readl(&(tb->BusTypes)));
for (i = 0; i < 16; i++)
temp_name[i] = readb(&(tb->ServerName[i]));
temp_name[16] = '\0';
dev_info(dev, " Server Name = %s\n", temp_name);
dev_info(dev, " Heartbeat Counter = 0x%x\n\n\n",
readl(&(tb->HeartBeat)));
#endif /* HPSA_DEBUG */
}
static int find_PCI_BAR_index(struct pci_dev *pdev, unsigned long pci_bar_addr)
{
int i, offset, mem_type, bar_type;
if (pci_bar_addr == PCI_BASE_ADDRESS_0) /* looking for BAR zero? */
return 0;
offset = 0;
for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) {
bar_type = pci_resource_flags(pdev, i) & PCI_BASE_ADDRESS_SPACE;
if (bar_type == PCI_BASE_ADDRESS_SPACE_IO)
offset += 4;
else {
mem_type = pci_resource_flags(pdev, i) &
PCI_BASE_ADDRESS_MEM_TYPE_MASK;
switch (mem_type) {
case PCI_BASE_ADDRESS_MEM_TYPE_32:
case PCI_BASE_ADDRESS_MEM_TYPE_1M:
offset += 4; /* 32 bit */
break;
case PCI_BASE_ADDRESS_MEM_TYPE_64:
offset += 8;
break;
default: /* reserved in PCI 2.2 */
dev_warn(&pdev->dev,
"base address is invalid\n");
return -1;
break;
}
}
if (offset == pci_bar_addr - PCI_BASE_ADDRESS_0)
return i + 1;
}
return -1;
}
/* If MSI/MSI-X is supported by the kernel we will try to enable it on
* controllers that are capable. If not, we use IO-APIC mode.
*/
static void __devinit hpsa_interrupt_mode(struct ctlr_info *h)
{
#ifdef CONFIG_PCI_MSI
int err;
struct msix_entry hpsa_msix_entries[4] = { {0, 0}, {0, 1},
{0, 2}, {0, 3}
};
/* Some boards advertise MSI but don't really support it */
if ((h->board_id == 0x40700E11) || (h->board_id == 0x40800E11) ||
(h->board_id == 0x40820E11) || (h->board_id == 0x40830E11))
goto default_int_mode;
if (pci_find_capability(h->pdev, PCI_CAP_ID_MSIX)) {
dev_info(&h->pdev->dev, "MSIX\n");
err = pci_enable_msix(h->pdev, hpsa_msix_entries, 4);
if (!err) {
h->intr[0] = hpsa_msix_entries[0].vector;
h->intr[1] = hpsa_msix_entries[1].vector;
h->intr[2] = hpsa_msix_entries[2].vector;
h->intr[3] = hpsa_msix_entries[3].vector;
h->msix_vector = 1;
return;
}
if (err > 0) {
dev_warn(&h->pdev->dev, "only %d MSI-X vectors "
"available\n", err);
goto default_int_mode;
} else {
dev_warn(&h->pdev->dev, "MSI-X init failed %d\n",
err);
goto default_int_mode;
}
}
if (pci_find_capability(h->pdev, PCI_CAP_ID_MSI)) {
dev_info(&h->pdev->dev, "MSI\n");
if (!pci_enable_msi(h->pdev))
h->msi_vector = 1;
else
dev_warn(&h->pdev->dev, "MSI init failed\n");
}
default_int_mode:
#endif /* CONFIG_PCI_MSI */
/* if we get here we're going to use the default interrupt mode */
h->intr[h->intr_mode] = h->pdev->irq;
}
static int __devinit hpsa_lookup_board_id(struct pci_dev *pdev, u32 *board_id)
{
int i;
u32 subsystem_vendor_id, subsystem_device_id;
subsystem_vendor_id = pdev->subsystem_vendor;
subsystem_device_id = pdev->subsystem_device;
*board_id = ((subsystem_device_id << 16) & 0xffff0000) |
subsystem_vendor_id;
for (i = 0; i < ARRAY_SIZE(products); i++)
if (*board_id == products[i].board_id)
return i;
if ((subsystem_vendor_id != PCI_VENDOR_ID_HP &&
subsystem_vendor_id != PCI_VENDOR_ID_COMPAQ) ||
!hpsa_allow_any) {
dev_warn(&pdev->dev, "unrecognized board ID: "
"0x%08x, ignoring.\n", *board_id);
return -ENODEV;
}
return ARRAY_SIZE(products) - 1; /* generic unknown smart array */
}
static inline bool hpsa_board_disabled(struct pci_dev *pdev)
{
u16 command;
(void) pci_read_config_word(pdev, PCI_COMMAND, &command);
return ((command & PCI_COMMAND_MEMORY) == 0);
}
static int __devinit hpsa_pci_find_memory_BAR(struct pci_dev *pdev,
unsigned long *memory_bar)
{
int i;
for (i = 0; i < DEVICE_COUNT_RESOURCE; i++)
if (pci_resource_flags(pdev, i) & IORESOURCE_MEM) {
/* addressing mode bits already removed */
*memory_bar = pci_resource_start(pdev, i);
dev_dbg(&pdev->dev, "memory BAR = %lx\n",
*memory_bar);
return 0;
}
dev_warn(&pdev->dev, "no memory BAR found\n");
return -ENODEV;
}
static int __devinit hpsa_wait_for_board_state(struct pci_dev *pdev,
void __iomem *vaddr, int wait_for_ready)
{
int i, iterations;
u32 scratchpad;
if (wait_for_ready)
iterations = HPSA_BOARD_READY_ITERATIONS;
else
iterations = HPSA_BOARD_NOT_READY_ITERATIONS;
for (i = 0; i < iterations; i++) {
scratchpad = readl(vaddr + SA5_SCRATCHPAD_OFFSET);
if (wait_for_ready) {
if (scratchpad == HPSA_FIRMWARE_READY)
return 0;
} else {
if (scratchpad != HPSA_FIRMWARE_READY)
return 0;
}
msleep(HPSA_BOARD_READY_POLL_INTERVAL_MSECS);
}
dev_warn(&pdev->dev, "board not ready, timed out.\n");
return -ENODEV;
}
static int __devinit hpsa_find_cfg_addrs(struct pci_dev *pdev,
void __iomem *vaddr, u32 *cfg_base_addr, u64 *cfg_base_addr_index,
u64 *cfg_offset)
{
*cfg_base_addr = readl(vaddr + SA5_CTCFG_OFFSET);
*cfg_offset = readl(vaddr + SA5_CTMEM_OFFSET);
*cfg_base_addr &= (u32) 0x0000ffff;
*cfg_base_addr_index = find_PCI_BAR_index(pdev, *cfg_base_addr);
if (*cfg_base_addr_index == -1) {
dev_warn(&pdev->dev, "cannot find cfg_base_addr_index\n");
return -ENODEV;
}
return 0;
}
static int __devinit hpsa_find_cfgtables(struct ctlr_info *h)
{
u64 cfg_offset;
u32 cfg_base_addr;
u64 cfg_base_addr_index;
u32 trans_offset;
int rc;
rc = hpsa_find_cfg_addrs(h->pdev, h->vaddr, &cfg_base_addr,
&cfg_base_addr_index, &cfg_offset);
if (rc)
return rc;
h->cfgtable = remap_pci_mem(pci_resource_start(h->pdev,
cfg_base_addr_index) + cfg_offset, sizeof(*h->cfgtable));
if (!h->cfgtable)
return -ENOMEM;
rc = write_driver_ver_to_cfgtable(h->cfgtable);
if (rc)
return rc;
/* Find performant mode table. */
trans_offset = readl(&h->cfgtable->TransMethodOffset);
h->transtable = remap_pci_mem(pci_resource_start(h->pdev,
cfg_base_addr_index)+cfg_offset+trans_offset,
sizeof(*h->transtable));
if (!h->transtable)
return -ENOMEM;
return 0;
}
static void __devinit hpsa_get_max_perf_mode_cmds(struct ctlr_info *h)
{
h->max_commands = readl(&(h->cfgtable->MaxPerformantModeCommands));
/* Limit commands in memory limited kdump scenario. */
if (reset_devices && h->max_commands > 32)
h->max_commands = 32;
if (h->max_commands < 16) {
dev_warn(&h->pdev->dev, "Controller reports "
"max supported commands of %d, an obvious lie. "
"Using 16. Ensure that firmware is up to date.\n",
h->max_commands);
h->max_commands = 16;
}
}
/* Interrogate the hardware for some limits:
* max commands, max SG elements without chaining, and with chaining,
* SG chain block size, etc.
*/
static void __devinit hpsa_find_board_params(struct ctlr_info *h)
{
hpsa_get_max_perf_mode_cmds(h);
h->nr_cmds = h->max_commands - 4; /* Allow room for some ioctls */
h->maxsgentries = readl(&(h->cfgtable->MaxScatterGatherElements));
/*
* Limit in-command s/g elements to 32 save dma'able memory.
* Howvever spec says if 0, use 31
*/
h->max_cmd_sg_entries = 31;
if (h->maxsgentries > 512) {
h->max_cmd_sg_entries = 32;
h->chainsize = h->maxsgentries - h->max_cmd_sg_entries + 1;
h->maxsgentries--; /* save one for chain pointer */
} else {
h->maxsgentries = 31; /* default to traditional values */
h->chainsize = 0;
}
}
static inline bool hpsa_CISS_signature_present(struct ctlr_info *h)
{
if ((readb(&h->cfgtable->Signature[0]) != 'C') ||
(readb(&h->cfgtable->Signature[1]) != 'I') ||
(readb(&h->cfgtable->Signature[2]) != 'S') ||
(readb(&h->cfgtable->Signature[3]) != 'S')) {
dev_warn(&h->pdev->dev, "not a valid CISS config table\n");
return false;
}
return true;
}
/* Need to enable prefetch in the SCSI core for 6400 in x86 */
static inline void hpsa_enable_scsi_prefetch(struct ctlr_info *h)
{
#ifdef CONFIG_X86
u32 prefetch;
prefetch = readl(&(h->cfgtable->SCSI_Prefetch));
prefetch |= 0x100;
writel(prefetch, &(h->cfgtable->SCSI_Prefetch));
#endif
}
/* Disable DMA prefetch for the P600. Otherwise an ASIC bug may result
* in a prefetch beyond physical memory.
*/
static inline void hpsa_p600_dma_prefetch_quirk(struct ctlr_info *h)
{
u32 dma_prefetch;
if (h->board_id != 0x3225103C)
return;
dma_prefetch = readl(h->vaddr + I2O_DMA1_CFG);
dma_prefetch |= 0x8000;
writel(dma_prefetch, h->vaddr + I2O_DMA1_CFG);
}
static void __devinit hpsa_wait_for_mode_change_ack(struct ctlr_info *h)
{
int i;
u32 doorbell_value;
unsigned long flags;
/* under certain very rare conditions, this can take awhile.
* (e.g.: hot replace a failed 144GB drive in a RAID 5 set right
* as we enter this code.)
*/
for (i = 0; i < MAX_CONFIG_WAIT; i++) {
spin_lock_irqsave(&h->lock, flags);
doorbell_value = readl(h->vaddr + SA5_DOORBELL);
spin_unlock_irqrestore(&h->lock, flags);
if (!(doorbell_value & CFGTBL_ChangeReq))
break;
/* delay and try again */
usleep_range(10000, 20000);
}
}
static int __devinit hpsa_enter_simple_mode(struct ctlr_info *h)
{
u32 trans_support;
trans_support = readl(&(h->cfgtable->TransportSupport));
if (!(trans_support & SIMPLE_MODE))
return -ENOTSUPP;
h->max_commands = readl(&(h->cfgtable->CmdsOutMax));
/* Update the field, and then ring the doorbell */
writel(CFGTBL_Trans_Simple, &(h->cfgtable->HostWrite.TransportRequest));
writel(CFGTBL_ChangeReq, h->vaddr + SA5_DOORBELL);
hpsa_wait_for_mode_change_ack(h);
print_cfg_table(&h->pdev->dev, h->cfgtable);
if (!(readl(&(h->cfgtable->TransportActive)) & CFGTBL_Trans_Simple)) {
dev_warn(&h->pdev->dev,
"unable to get board into simple mode\n");
return -ENODEV;
}
h->transMethod = CFGTBL_Trans_Simple;
return 0;
}
static int __devinit hpsa_pci_init(struct ctlr_info *h)
{
int prod_index, err;
prod_index = hpsa_lookup_board_id(h->pdev, &h->board_id);
if (prod_index < 0)
return -ENODEV;
h->product_name = products[prod_index].product_name;
h->access = *(products[prod_index].access);
if (hpsa_board_disabled(h->pdev)) {
dev_warn(&h->pdev->dev, "controller appears to be disabled\n");
return -ENODEV;
}
pci_disable_link_state(h->pdev, PCIE_LINK_STATE_L0S |
PCIE_LINK_STATE_L1 | PCIE_LINK_STATE_CLKPM);
err = pci_enable_device(h->pdev);
if (err) {
dev_warn(&h->pdev->dev, "unable to enable PCI device\n");
return err;
}
err = pci_request_regions(h->pdev, "hpsa");
if (err) {
dev_err(&h->pdev->dev,
"cannot obtain PCI resources, aborting\n");
return err;
}
hpsa_interrupt_mode(h);
err = hpsa_pci_find_memory_BAR(h->pdev, &h->paddr);
if (err)
goto err_out_free_res;
h->vaddr = remap_pci_mem(h->paddr, 0x250);
if (!h->vaddr) {
err = -ENOMEM;
goto err_out_free_res;
}
err = hpsa_wait_for_board_state(h->pdev, h->vaddr, BOARD_READY);
if (err)
goto err_out_free_res;
err = hpsa_find_cfgtables(h);
if (err)
goto err_out_free_res;
hpsa_find_board_params(h);
if (!hpsa_CISS_signature_present(h)) {
err = -ENODEV;
goto err_out_free_res;
}
hpsa_enable_scsi_prefetch(h);
hpsa_p600_dma_prefetch_quirk(h);
err = hpsa_enter_simple_mode(h);
if (err)
goto err_out_free_res;
return 0;
err_out_free_res:
if (h->transtable)
iounmap(h->transtable);
if (h->cfgtable)
iounmap(h->cfgtable);
if (h->vaddr)
iounmap(h->vaddr);
/*
* Deliberately omit pci_disable_device(): it does something nasty to
* Smart Array controllers that pci_enable_device does not undo
*/
pci_release_regions(h->pdev);
return err;
}
static void __devinit hpsa_hba_inquiry(struct ctlr_info *h)
{
int rc;
#define HBA_INQUIRY_BYTE_COUNT 64
h->hba_inquiry_data = kmalloc(HBA_INQUIRY_BYTE_COUNT, GFP_KERNEL);
if (!h->hba_inquiry_data)
return;
rc = hpsa_scsi_do_inquiry(h, RAID_CTLR_LUNID, 0,
h->hba_inquiry_data, HBA_INQUIRY_BYTE_COUNT);
if (rc != 0) {
kfree(h->hba_inquiry_data);
h->hba_inquiry_data = NULL;
}
}
static __devinit int hpsa_init_reset_devices(struct pci_dev *pdev)
{
int rc, i;
if (!reset_devices)
return 0;
/* Reset the controller with a PCI power-cycle or via doorbell */
rc = hpsa_kdump_hard_reset_controller(pdev);
/* -ENOTSUPP here means we cannot reset the controller
* but it's already (and still) up and running in
* "performant mode". Or, it might be 640x, which can't reset
* due to concerns about shared bbwc between 6402/6404 pair.
*/
if (rc == -ENOTSUPP)
return rc; /* just try to do the kdump anyhow. */
if (rc)
return -ENODEV;
/* Now try to get the controller to respond to a no-op */
dev_warn(&pdev->dev, "Waiting for controller to respond to no-op\n");
for (i = 0; i < HPSA_POST_RESET_NOOP_RETRIES; i++) {
if (hpsa_noop(pdev) == 0)
break;
else
dev_warn(&pdev->dev, "no-op failed%s\n",
(i < 11 ? "; re-trying" : ""));
}
return 0;
}
static __devinit int hpsa_allocate_cmd_pool(struct ctlr_info *h)
{
h->cmd_pool_bits = kzalloc(
DIV_ROUND_UP(h->nr_cmds, BITS_PER_LONG) *
sizeof(unsigned long), GFP_KERNEL);
h->cmd_pool = pci_alloc_consistent(h->pdev,
h->nr_cmds * sizeof(*h->cmd_pool),
&(h->cmd_pool_dhandle));
h->errinfo_pool = pci_alloc_consistent(h->pdev,
h->nr_cmds * sizeof(*h->errinfo_pool),
&(h->errinfo_pool_dhandle));
if ((h->cmd_pool_bits == NULL)
|| (h->cmd_pool == NULL)
|| (h->errinfo_pool == NULL)) {
dev_err(&h->pdev->dev, "out of memory in %s", __func__);
return -ENOMEM;
}
return 0;
}
static void hpsa_free_cmd_pool(struct ctlr_info *h)
{
kfree(h->cmd_pool_bits);
if (h->cmd_pool)
pci_free_consistent(h->pdev,
h->nr_cmds * sizeof(struct CommandList),
h->cmd_pool, h->cmd_pool_dhandle);
if (h->errinfo_pool)
pci_free_consistent(h->pdev,
h->nr_cmds * sizeof(struct ErrorInfo),
h->errinfo_pool,
h->errinfo_pool_dhandle);
}
static int hpsa_request_irq(struct ctlr_info *h,
irqreturn_t (*msixhandler)(int, void *),
irqreturn_t (*intxhandler)(int, void *))
{
int rc;
if (h->msix_vector || h->msi_vector)
rc = request_irq(h->intr[h->intr_mode], msixhandler,
IRQF_DISABLED, h->devname, h);
else
rc = request_irq(h->intr[h->intr_mode], intxhandler,
IRQF_DISABLED, h->devname, h);
if (rc) {
dev_err(&h->pdev->dev, "unable to get irq %d for %s\n",
h->intr[h->intr_mode], h->devname);
return -ENODEV;
}
return 0;
}
static int __devinit hpsa_kdump_soft_reset(struct ctlr_info *h)
{
if (hpsa_send_host_reset(h, RAID_CTLR_LUNID,
HPSA_RESET_TYPE_CONTROLLER)) {
dev_warn(&h->pdev->dev, "Resetting array controller failed.\n");
return -EIO;
}
dev_info(&h->pdev->dev, "Waiting for board to soft reset.\n");
if (hpsa_wait_for_board_state(h->pdev, h->vaddr, BOARD_NOT_READY)) {
dev_warn(&h->pdev->dev, "Soft reset had no effect.\n");
return -1;
}
dev_info(&h->pdev->dev, "Board reset, awaiting READY status.\n");
if (hpsa_wait_for_board_state(h->pdev, h->vaddr, BOARD_READY)) {
dev_warn(&h->pdev->dev, "Board failed to become ready "
"after soft reset.\n");
return -1;
}
return 0;
}
static void hpsa_undo_allocations_after_kdump_soft_reset(struct ctlr_info *h)
{
free_irq(h->intr[h->intr_mode], h);
#ifdef CONFIG_PCI_MSI
if (h->msix_vector)
pci_disable_msix(h->pdev);
else if (h->msi_vector)
pci_disable_msi(h->pdev);
#endif /* CONFIG_PCI_MSI */
hpsa_free_sg_chain_blocks(h);
hpsa_free_cmd_pool(h);
kfree(h->blockFetchTable);
pci_free_consistent(h->pdev, h->reply_pool_size,
h->reply_pool, h->reply_pool_dhandle);
if (h->vaddr)
iounmap(h->vaddr);
if (h->transtable)
iounmap(h->transtable);
if (h->cfgtable)
iounmap(h->cfgtable);
pci_release_regions(h->pdev);
kfree(h);
}
static void remove_ctlr_from_lockup_detector_list(struct ctlr_info *h)
{
assert_spin_locked(&lockup_detector_lock);
if (!hpsa_lockup_detector)
return;
if (h->lockup_detected)
return; /* already stopped the lockup detector */
list_del(&h->lockup_list);
}
/* Called when controller lockup detected. */
static void fail_all_cmds_on_list(struct ctlr_info *h, struct list_head *list)
{
struct CommandList *c = NULL;
assert_spin_locked(&h->lock);
/* Mark all outstanding commands as failed and complete them. */
while (!list_empty(list)) {
c = list_entry(list->next, struct CommandList, list);
c->err_info->CommandStatus = CMD_HARDWARE_ERR;
finish_cmd(c, c->Header.Tag.lower);
}
}
static void controller_lockup_detected(struct ctlr_info *h)
{
unsigned long flags;
assert_spin_locked(&lockup_detector_lock);
remove_ctlr_from_lockup_detector_list(h);
h->access.set_intr_mask(h, HPSA_INTR_OFF);
spin_lock_irqsave(&h->lock, flags);
h->lockup_detected = readl(h->vaddr + SA5_SCRATCHPAD_OFFSET);
spin_unlock_irqrestore(&h->lock, flags);
dev_warn(&h->pdev->dev, "Controller lockup detected: 0x%08x\n",
h->lockup_detected);
pci_disable_device(h->pdev);
spin_lock_irqsave(&h->lock, flags);
fail_all_cmds_on_list(h, &h->cmpQ);
fail_all_cmds_on_list(h, &h->reqQ);
spin_unlock_irqrestore(&h->lock, flags);
}
#define HEARTBEAT_SAMPLE_INTERVAL (10 * HZ)
#define HEARTBEAT_CHECK_MINIMUM_INTERVAL (HEARTBEAT_SAMPLE_INTERVAL / 2)
static void detect_controller_lockup(struct ctlr_info *h)
{
u64 now;
u32 heartbeat;
unsigned long flags;
assert_spin_locked(&lockup_detector_lock);
now = get_jiffies_64();
/* If we've received an interrupt recently, we're ok. */
if (time_after64(h->last_intr_timestamp +
(HEARTBEAT_CHECK_MINIMUM_INTERVAL), now))
return;
/*
* If we've already checked the heartbeat recently, we're ok.
* This could happen if someone sends us a signal. We
* otherwise don't care about signals in this thread.
*/
if (time_after64(h->last_heartbeat_timestamp +
(HEARTBEAT_CHECK_MINIMUM_INTERVAL), now))
return;
/* If heartbeat has not changed since we last looked, we're not ok. */
spin_lock_irqsave(&h->lock, flags);
heartbeat = readl(&h->cfgtable->HeartBeat);
spin_unlock_irqrestore(&h->lock, flags);
if (h->last_heartbeat == heartbeat) {
controller_lockup_detected(h);
return;
}
/* We're ok. */
h->last_heartbeat = heartbeat;
h->last_heartbeat_timestamp = now;
}
static int detect_controller_lockup_thread(void *notused)
{
struct ctlr_info *h;
unsigned long flags;
while (1) {
struct list_head *this, *tmp;
schedule_timeout_interruptible(HEARTBEAT_SAMPLE_INTERVAL);
if (kthread_should_stop())
break;
spin_lock_irqsave(&lockup_detector_lock, flags);
list_for_each_safe(this, tmp, &hpsa_ctlr_list) {
h = list_entry(this, struct ctlr_info, lockup_list);
detect_controller_lockup(h);
}
spin_unlock_irqrestore(&lockup_detector_lock, flags);
}
return 0;
}
static void add_ctlr_to_lockup_detector_list(struct ctlr_info *h)
{
unsigned long flags;
spin_lock_irqsave(&lockup_detector_lock, flags);
list_add_tail(&h->lockup_list, &hpsa_ctlr_list);
spin_unlock_irqrestore(&lockup_detector_lock, flags);
}
static void start_controller_lockup_detector(struct ctlr_info *h)
{
/* Start the lockup detector thread if not already started */
if (!hpsa_lockup_detector) {
spin_lock_init(&lockup_detector_lock);
hpsa_lockup_detector =
kthread_run(detect_controller_lockup_thread,
NULL, "hpsa");
}
if (!hpsa_lockup_detector) {
dev_warn(&h->pdev->dev,
"Could not start lockup detector thread\n");
return;
}
add_ctlr_to_lockup_detector_list(h);
}
static void stop_controller_lockup_detector(struct ctlr_info *h)
{
unsigned long flags;
spin_lock_irqsave(&lockup_detector_lock, flags);
remove_ctlr_from_lockup_detector_list(h);
/* If the list of ctlr's to monitor is empty, stop the thread */
if (list_empty(&hpsa_ctlr_list)) {
kthread_stop(hpsa_lockup_detector);
hpsa_lockup_detector = NULL;
}
spin_unlock_irqrestore(&lockup_detector_lock, flags);
}
static int __devinit hpsa_init_one(struct pci_dev *pdev,
const struct pci_device_id *ent)
{
int dac, rc;
struct ctlr_info *h;
int try_soft_reset = 0;
unsigned long flags;
if (number_of_controllers == 0)
printk(KERN_INFO DRIVER_NAME "\n");
rc = hpsa_init_reset_devices(pdev);
if (rc) {
if (rc != -ENOTSUPP)
return rc;
/* If the reset fails in a particular way (it has no way to do
* a proper hard reset, so returns -ENOTSUPP) we can try to do
* a soft reset once we get the controller configured up to the
* point that it can accept a command.
*/
try_soft_reset = 1;
rc = 0;
}
reinit_after_soft_reset:
/* Command structures must be aligned on a 32-byte boundary because
* the 5 lower bits of the address are used by the hardware. and by
* the driver. See comments in hpsa.h for more info.
*/
#define COMMANDLIST_ALIGNMENT 32
BUILD_BUG_ON(sizeof(struct CommandList) % COMMANDLIST_ALIGNMENT);
h = kzalloc(sizeof(*h), GFP_KERNEL);
if (!h)
return -ENOMEM;
h->pdev = pdev;
h->intr_mode = hpsa_simple_mode ? SIMPLE_MODE_INT : PERF_MODE_INT;
INIT_LIST_HEAD(&h->cmpQ);
INIT_LIST_HEAD(&h->reqQ);
spin_lock_init(&h->lock);
spin_lock_init(&h->scan_lock);
rc = hpsa_pci_init(h);
if (rc != 0)
goto clean1;
sprintf(h->devname, "hpsa%d", number_of_controllers);
h->ctlr = number_of_controllers;
number_of_controllers++;
/* configure PCI DMA stuff */
rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(64));
if (rc == 0) {
dac = 1;
} else {
rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));
if (rc == 0) {
dac = 0;
} else {
dev_err(&pdev->dev, "no suitable DMA available\n");
goto clean1;
}
}
/* make sure the board interrupts are off */
h->access.set_intr_mask(h, HPSA_INTR_OFF);
if (hpsa_request_irq(h, do_hpsa_intr_msi, do_hpsa_intr_intx))
goto clean2;
dev_info(&pdev->dev, "%s: <0x%x> at IRQ %d%s using DAC\n",
h->devname, pdev->device,
h->intr[h->intr_mode], dac ? "" : " not");
if (hpsa_allocate_cmd_pool(h))
goto clean4;
if (hpsa_allocate_sg_chain_blocks(h))
goto clean4;
init_waitqueue_head(&h->scan_wait_queue);
h->scan_finished = 1; /* no scan currently in progress */
pci_set_drvdata(pdev, h);
h->ndevices = 0;
h->scsi_host = NULL;
spin_lock_init(&h->devlock);
hpsa_put_ctlr_into_performant_mode(h);
/* At this point, the controller is ready to take commands.
* Now, if reset_devices and the hard reset didn't work, try
* the soft reset and see if that works.
*/
if (try_soft_reset) {
/* This is kind of gross. We may or may not get a completion
* from the soft reset command, and if we do, then the value
* from the fifo may or may not be valid. So, we wait 10 secs
* after the reset throwing away any completions we get during
* that time. Unregister the interrupt handler and register
* fake ones to scoop up any residual completions.
*/
spin_lock_irqsave(&h->lock, flags);
h->access.set_intr_mask(h, HPSA_INTR_OFF);
spin_unlock_irqrestore(&h->lock, flags);
free_irq(h->intr[h->intr_mode], h);
rc = hpsa_request_irq(h, hpsa_msix_discard_completions,
hpsa_intx_discard_completions);
if (rc) {
dev_warn(&h->pdev->dev, "Failed to request_irq after "
"soft reset.\n");
goto clean4;
}
rc = hpsa_kdump_soft_reset(h);
if (rc)
/* Neither hard nor soft reset worked, we're hosed. */
goto clean4;
dev_info(&h->pdev->dev, "Board READY.\n");
dev_info(&h->pdev->dev,
"Waiting for stale completions to drain.\n");
h->access.set_intr_mask(h, HPSA_INTR_ON);
msleep(10000);
h->access.set_intr_mask(h, HPSA_INTR_OFF);
rc = controller_reset_failed(h->cfgtable);
if (rc)
dev_info(&h->pdev->dev,
"Soft reset appears to have failed.\n");
/* since the controller's reset, we have to go back and re-init
* everything. Easiest to just forget what we've done and do it
* all over again.
*/
hpsa_undo_allocations_after_kdump_soft_reset(h);
try_soft_reset = 0;
if (rc)
/* don't go to clean4, we already unallocated */
return -ENODEV;
goto reinit_after_soft_reset;
}
/* Turn the interrupts on so we can service requests */
h->access.set_intr_mask(h, HPSA_INTR_ON);
hpsa_hba_inquiry(h);
hpsa_register_scsi(h); /* hook ourselves into SCSI subsystem */
start_controller_lockup_detector(h);
return 1;
clean4:
hpsa_free_sg_chain_blocks(h);
hpsa_free_cmd_pool(h);
free_irq(h->intr[h->intr_mode], h);
clean2:
clean1:
kfree(h);
return rc;
}
static void hpsa_flush_cache(struct ctlr_info *h)
{
char *flush_buf;
struct CommandList *c;
flush_buf = kzalloc(4, GFP_KERNEL);
if (!flush_buf)
return;
c = cmd_special_alloc(h);
if (!c) {
dev_warn(&h->pdev->dev, "cmd_special_alloc returned NULL!\n");
goto out_of_memory;
}
fill_cmd(c, HPSA_CACHE_FLUSH, h, flush_buf, 4, 0,
RAID_CTLR_LUNID, TYPE_CMD);
hpsa_scsi_do_simple_cmd_with_retry(h, c, PCI_DMA_TODEVICE);
if (c->err_info->CommandStatus != 0)
dev_warn(&h->pdev->dev,
"error flushing cache on controller\n");
cmd_special_free(h, c);
out_of_memory:
kfree(flush_buf);
}
static void hpsa_shutdown(struct pci_dev *pdev)
{
struct ctlr_info *h;
h = pci_get_drvdata(pdev);
/* Turn board interrupts off and send the flush cache command
* sendcmd will turn off interrupt, and send the flush...
* To write all data in the battery backed cache to disks
*/
hpsa_flush_cache(h);
h->access.set_intr_mask(h, HPSA_INTR_OFF);
free_irq(h->intr[h->intr_mode], h);
#ifdef CONFIG_PCI_MSI
if (h->msix_vector)
pci_disable_msix(h->pdev);
else if (h->msi_vector)
pci_disable_msi(h->pdev);
#endif /* CONFIG_PCI_MSI */
}
static void __devexit hpsa_remove_one(struct pci_dev *pdev)
{
struct ctlr_info *h;
if (pci_get_drvdata(pdev) == NULL) {
dev_err(&pdev->dev, "unable to remove device\n");
return;
}
h = pci_get_drvdata(pdev);
stop_controller_lockup_detector(h);
hpsa_unregister_scsi(h); /* unhook from SCSI subsystem */
hpsa_shutdown(pdev);
iounmap(h->vaddr);
iounmap(h->transtable);
iounmap(h->cfgtable);
hpsa_free_sg_chain_blocks(h);
pci_free_consistent(h->pdev,
h->nr_cmds * sizeof(struct CommandList),
h->cmd_pool, h->cmd_pool_dhandle);
pci_free_consistent(h->pdev,
h->nr_cmds * sizeof(struct ErrorInfo),
h->errinfo_pool, h->errinfo_pool_dhandle);
pci_free_consistent(h->pdev, h->reply_pool_size,
h->reply_pool, h->reply_pool_dhandle);
kfree(h->cmd_pool_bits);
kfree(h->blockFetchTable);
kfree(h->hba_inquiry_data);
/*
* Deliberately omit pci_disable_device(): it does something nasty to
* Smart Array controllers that pci_enable_device does not undo
*/
pci_release_regions(pdev);
pci_set_drvdata(pdev, NULL);
kfree(h);
}
static int hpsa_suspend(__attribute__((unused)) struct pci_dev *pdev,
__attribute__((unused)) pm_message_t state)
{
return -ENOSYS;
}
static int hpsa_resume(__attribute__((unused)) struct pci_dev *pdev)
{
return -ENOSYS;
}
static struct pci_driver hpsa_pci_driver = {
.name = "hpsa",
.probe = hpsa_init_one,
.remove = __devexit_p(hpsa_remove_one),
.id_table = hpsa_pci_device_id, /* id_table */
.shutdown = hpsa_shutdown,
.suspend = hpsa_suspend,
.resume = hpsa_resume,
};
/* Fill in bucket_map[], given nsgs (the max number of
* scatter gather elements supported) and bucket[],
* which is an array of 8 integers. The bucket[] array
* contains 8 different DMA transfer sizes (in 16
* byte increments) which the controller uses to fetch
* commands. This function fills in bucket_map[], which
* maps a given number of scatter gather elements to one of
* the 8 DMA transfer sizes. The point of it is to allow the
* controller to only do as much DMA as needed to fetch the
* command, with the DMA transfer size encoded in the lower
* bits of the command address.
*/
static void calc_bucket_map(int bucket[], int num_buckets,
int nsgs, int *bucket_map)
{
int i, j, b, size;
/* even a command with 0 SGs requires 4 blocks */
#define MINIMUM_TRANSFER_BLOCKS 4
#define NUM_BUCKETS 8
/* Note, bucket_map must have nsgs+1 entries. */
for (i = 0; i <= nsgs; i++) {
/* Compute size of a command with i SG entries */
size = i + MINIMUM_TRANSFER_BLOCKS;
b = num_buckets; /* Assume the biggest bucket */
/* Find the bucket that is just big enough */
for (j = 0; j < 8; j++) {
if (bucket[j] >= size) {
b = j;
break;
}
}
/* for a command with i SG entries, use bucket b. */
bucket_map[i] = b;
}
}
static __devinit void hpsa_enter_performant_mode(struct ctlr_info *h,
u32 use_short_tags)
{
int i;
unsigned long register_value;
/* This is a bit complicated. There are 8 registers on
* the controller which we write to to tell it 8 different
* sizes of commands which there may be. It's a way of
* reducing the DMA done to fetch each command. Encoded into
* each command's tag are 3 bits which communicate to the controller
* which of the eight sizes that command fits within. The size of
* each command depends on how many scatter gather entries there are.
* Each SG entry requires 16 bytes. The eight registers are programmed
* with the number of 16-byte blocks a command of that size requires.
* The smallest command possible requires 5 such 16 byte blocks.
* the largest command possible requires MAXSGENTRIES + 4 16-byte
* blocks. Note, this only extends to the SG entries contained
* within the command block, and does not extend to chained blocks
* of SG elements. bft[] contains the eight values we write to
* the registers. They are not evenly distributed, but have more
* sizes for small commands, and fewer sizes for larger commands.
*/
int bft[8] = {5, 6, 8, 10, 12, 20, 28, MAXSGENTRIES + 4};
BUILD_BUG_ON(28 > MAXSGENTRIES + 4);
/* 5 = 1 s/g entry or 4k
* 6 = 2 s/g entry or 8k
* 8 = 4 s/g entry or 16k
* 10 = 6 s/g entry or 24k
*/
h->reply_pool_wraparound = 1; /* spec: init to 1 */
/* Controller spec: zero out this buffer. */
memset(h->reply_pool, 0, h->reply_pool_size);
h->reply_pool_head = h->reply_pool;
bft[7] = h->max_sg_entries + 4;
calc_bucket_map(bft, ARRAY_SIZE(bft), 32, h->blockFetchTable);
for (i = 0; i < 8; i++)
writel(bft[i], &h->transtable->BlockFetch[i]);
/* size of controller ring buffer */
writel(h->max_commands, &h->transtable->RepQSize);
writel(1, &h->transtable->RepQCount);
writel(0, &h->transtable->RepQCtrAddrLow32);
writel(0, &h->transtable->RepQCtrAddrHigh32);
writel(h->reply_pool_dhandle, &h->transtable->RepQAddr0Low32);
writel(0, &h->transtable->RepQAddr0High32);
writel(CFGTBL_Trans_Performant | use_short_tags,
&(h->cfgtable->HostWrite.TransportRequest));
writel(CFGTBL_ChangeReq, h->vaddr + SA5_DOORBELL);
hpsa_wait_for_mode_change_ack(h);
register_value = readl(&(h->cfgtable->TransportActive));
if (!(register_value & CFGTBL_Trans_Performant)) {
dev_warn(&h->pdev->dev, "unable to get board into"
" performant mode\n");
return;
}
/* Change the access methods to the performant access methods */
h->access = SA5_performant_access;
h->transMethod = CFGTBL_Trans_Performant;
}
static __devinit void hpsa_put_ctlr_into_performant_mode(struct ctlr_info *h)
{
u32 trans_support;
if (hpsa_simple_mode)
return;
trans_support = readl(&(h->cfgtable->TransportSupport));
if (!(trans_support & PERFORMANT_MODE))
return;
hpsa_get_max_perf_mode_cmds(h);
h->max_sg_entries = 32;
/* Performant mode ring buffer and supporting data structures */
h->reply_pool_size = h->max_commands * sizeof(u64);
h->reply_pool = pci_alloc_consistent(h->pdev, h->reply_pool_size,
&(h->reply_pool_dhandle));
/* Need a block fetch table for performant mode */
h->blockFetchTable = kmalloc(((h->max_sg_entries+1) *
sizeof(u32)), GFP_KERNEL);
if ((h->reply_pool == NULL)
|| (h->blockFetchTable == NULL))
goto clean_up;
hpsa_enter_performant_mode(h,
trans_support & CFGTBL_Trans_use_short_tags);
return;
clean_up:
if (h->reply_pool)
pci_free_consistent(h->pdev, h->reply_pool_size,
h->reply_pool, h->reply_pool_dhandle);
kfree(h->blockFetchTable);
}
/*
* This is it. Register the PCI driver information for the cards we control
* the OS will call our registered routines when it finds one of our cards.
*/
static int __init hpsa_init(void)
{
return pci_register_driver(&hpsa_pci_driver);
}
static void __exit hpsa_cleanup(void)
{
pci_unregister_driver(&hpsa_pci_driver);
}
module_init(hpsa_init);
module_exit(hpsa_cleanup);
|
define(
"dojo/cldr/nls/hu/hebrew", //begin v1.x content
{
"months-format-abbr": [
"Tisri",
"Hesván",
"Kiszlév",
"Tévész",
"Svát",
"Ádár I",
"Ádár",
"Niszán",
"Ijár",
"Sziván",
"Tamuz",
"Áv",
"Elul"
],
"months-format-abbr-leap": "Ádár II",
"months-format-wide": [
"Tisri",
"Hesván",
"Kiszlév",
"Tévész",
"Svát",
"Ádár risón",
"Ádár",
"Niszán",
"Ijár",
"Sziván",
"Tamuz",
"Áv",
"Elul"
],
"months-format-wide-leap": "Ádár séni",
"months-standAlone-abbr": [
"Tisri",
"Hesván",
"Kiszlév",
"Tévész",
"Svát",
"Ádár risón",
"Ádár",
"Niszán",
"Ijár",
"Sziván",
"Tamuz",
"Áv",
"Elul"
],
"months-standAlone-abbr-leap": "Ádár II",
"months-standAlone-wide": [
"Tisri",
"Hesván",
"Kiszlév",
"Tévész",
"Svát",
"Ádár risón",
"Ádár",
"Niszán",
"Ijár",
"Sziván",
"Tamuz",
"Áv",
"Elul"
],
"months-standAlone-wide-leap": "Ádár II",
"eraAbbr": [
"TÉ"
],
"eraNames": [
"TÉ"
],
"eraNarrow": [
"TÉ"
],
"days-format-abbr": [
"V",
"H",
"K",
"Sze",
"Cs",
"P",
"Szo"
],
"days-format-narrow": [
"V",
"H",
"K",
"Sz",
"Cs",
"P",
"Sz"
],
"days-format-wide": [
"vasárnap",
"hétfő",
"kedd",
"szerda",
"csütörtök",
"péntek",
"szombat"
],
"days-standAlone-abbr": [
"V",
"H",
"K",
"Sze",
"Cs",
"P",
"Szo"
],
"days-standAlone-narrow": [
"V",
"H",
"K",
"Sz",
"Cs",
"P",
"Sz"
],
"days-standAlone-wide": [
"vasárnap",
"hétfő",
"kedd",
"szerda",
"csütörtök",
"péntek",
"szombat"
],
"quarters-format-abbr": [
"N1",
"N2",
"N3",
"N4"
],
"quarters-format-wide": [
"I. negyedév",
"II. negyedév",
"III. negyedév",
"IV. negyedév"
],
"quarters-standAlone-abbr": [
"N1",
"N2",
"N3",
"N4"
],
"quarters-standAlone-wide": [
"1. negyedév",
"2. negyedév",
"3. negyedév",
"4. negyedév"
],
"dayPeriods-format-narrow-am": "de.",
"dayPeriods-format-narrow-pm": "du.",
"dayPeriods-format-wide-am": "de.",
"dayPeriods-format-wide-pm": "du.",
"dateFormat-full": "y. MMMM d., EEEE",
"dateFormat-long": "y. MMMM d.",
"dateFormat-medium": "yyyy.MM.dd.",
"dateFormat-short": "yyyy.MM.dd.",
"dateFormatItem-Ed": "d., E",
"dateFormatItem-h": "a h",
"dateFormatItem-H": "H",
"dateFormatItem-hm": "a h:mm",
"dateFormatItem-Hm": "H:mm",
"dateFormatItem-hms": "a h:mm:ss",
"dateFormatItem-Hms": "H:mm:ss",
"dateFormatItem-Md": "M. d.",
"dateFormatItem-MEd": "M. d., E",
"dateFormatItem-MMMd": "MMM d.",
"dateFormatItem-MMMEd": "MMM d., E",
"dateFormatItem-yM": "y.M.",
"dateFormatItem-yMd": "yyyy.MM.dd.",
"dateFormatItem-yMEd": "yyyy.MM.dd., E",
"dateFormatItem-yMMM": "y. MMM",
"dateFormatItem-yMMMd": "y. MMM d.",
"dateFormatItem-yMMMEd": "y. MMM d., E",
"dateFormatItem-yQQQ": "y. QQQ",
"timeFormat-full": "H:mm:ss zzzz",
"timeFormat-long": "H:mm:ss z",
"timeFormat-medium": "H:mm:ss",
"timeFormat-short": "H:mm"
}
//end v1.x content
); |
{% if post.layout != post %}
{% assign words = post.content | strip_html | number_of_words %}
{% if words < 180 %}
less than 1 minute read
{% elsif words < 360 %}
1 minute read
{% else %}
{{ words | divided_by:180 }} minute read
{% endif %}
{% endif %}
{% if post.layout == post %}
{% assign words = content | number_of_words %}
{% if words < 180 %}
less than 1 minute read
{% elsif words < 360 %}
1 minute read
{% else %}
{{ words | divided_by:180 }} minute read
{% endif %}
{% endif %}
|
/**
* @license AngularJS v1.5.9
* (c) 2010-2016 Google, Inc. http://angularjs.org
* License: MIT
*/
(function(window, angular) {'use strict';
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Any commits to this file should be reviewed with security in mind. *
* Changes to this file can potentially create security vulnerabilities. *
* An approval from 2 Core members with history of modifying *
* this file is required. *
* *
* Does the change somehow allow for arbitrary javascript to be executed? *
* Or allows for someone to change the prototype of built-in objects? *
* Or gives undesired access to variables likes document or window? *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
var $sanitizeMinErr = angular.$$minErr('$sanitize');
var bind;
var extend;
var forEach;
var isDefined;
var lowercase;
var noop;
var htmlParser;
var htmlSanitizeWriter;
/**
* @ngdoc module
* @name ngSanitize
* @description
*
* # ngSanitize
*
* The `ngSanitize` module provides functionality to sanitize HTML.
*
*
* <div doc-module-components="ngSanitize"></div>
*
* See {@link ngSanitize.$sanitize `$sanitize`} for usage.
*/
/**
* @ngdoc service
* @name $sanitize
* @kind function
*
* @description
* Sanitizes an html string by stripping all potentially dangerous tokens.
*
* The input is sanitized by parsing the HTML into tokens. All safe tokens (from a whitelist) are
* then serialized back to properly escaped html string. This means that no unsafe input can make
* it into the returned string.
*
* The whitelist for URL sanitization of attribute values is configured using the functions
* `aHrefSanitizationWhitelist` and `imgSrcSanitizationWhitelist` of {@link ng.$compileProvider
* `$compileProvider`}.
*
* The input may also contain SVG markup if this is enabled via {@link $sanitizeProvider}.
*
* @param {string} html HTML input.
* @returns {string} Sanitized HTML.
*
* @example
<example module="sanitizeExample" deps="angular-sanitize.js" name="sanitize-service">
<file name="index.html">
<script>
angular.module('sanitizeExample', ['ngSanitize'])
.controller('ExampleController', ['$scope', '$sce', function($scope, $sce) {
$scope.snippet =
'<p style="color:blue">an html\n' +
'<em onmouseover="this.textContent=\'PWN3D!\'">click here</em>\n' +
'snippet</p>';
$scope.deliberatelyTrustDangerousSnippet = function() {
return $sce.trustAsHtml($scope.snippet);
};
}]);
</script>
<div ng-controller="ExampleController">
Snippet: <textarea ng-model="snippet" cols="60" rows="3"></textarea>
<table>
<tr>
<td>Directive</td>
<td>How</td>
<td>Source</td>
<td>Rendered</td>
</tr>
<tr id="bind-html-with-sanitize">
<td>ng-bind-html</td>
<td>Automatically uses $sanitize</td>
<td><pre><div ng-bind-html="snippet"><br/></div></pre></td>
<td><div ng-bind-html="snippet"></div></td>
</tr>
<tr id="bind-html-with-trust">
<td>ng-bind-html</td>
<td>Bypass $sanitize by explicitly trusting the dangerous value</td>
<td>
<pre><div ng-bind-html="deliberatelyTrustDangerousSnippet()">
</div></pre>
</td>
<td><div ng-bind-html="deliberatelyTrustDangerousSnippet()"></div></td>
</tr>
<tr id="bind-default">
<td>ng-bind</td>
<td>Automatically escapes</td>
<td><pre><div ng-bind="snippet"><br/></div></pre></td>
<td><div ng-bind="snippet"></div></td>
</tr>
</table>
</div>
</file>
<file name="protractor.js" type="protractor">
it('should sanitize the html snippet by default', function() {
expect(element(by.css('#bind-html-with-sanitize div')).getAttribute('innerHTML')).
toBe('<p>an html\n<em>click here</em>\nsnippet</p>');
});
it('should inline raw snippet if bound to a trusted value', function() {
expect(element(by.css('#bind-html-with-trust div')).getAttribute('innerHTML')).
toBe("<p style=\"color:blue\">an html\n" +
"<em onmouseover=\"this.textContent='PWN3D!'\">click here</em>\n" +
"snippet</p>");
});
it('should escape snippet without any filter', function() {
expect(element(by.css('#bind-default div')).getAttribute('innerHTML')).
toBe("<p style=\"color:blue\">an html\n" +
"<em onmouseover=\"this.textContent='PWN3D!'\">click here</em>\n" +
"snippet</p>");
});
it('should update', function() {
element(by.model('snippet')).clear();
element(by.model('snippet')).sendKeys('new <b onclick="alert(1)">text</b>');
expect(element(by.css('#bind-html-with-sanitize div')).getAttribute('innerHTML')).
toBe('new <b>text</b>');
expect(element(by.css('#bind-html-with-trust div')).getAttribute('innerHTML')).toBe(
'new <b onclick="alert(1)">text</b>');
expect(element(by.css('#bind-default div')).getAttribute('innerHTML')).toBe(
"new <b onclick=\"alert(1)\">text</b>");
});
</file>
</example>
*/
/**
* @ngdoc provider
* @name $sanitizeProvider
* @this
*
* @description
* Creates and configures {@link $sanitize} instance.
*/
function $SanitizeProvider() {
var svgEnabled = false;
this.$get = ['$$sanitizeUri', function($$sanitizeUri) {
if (svgEnabled) {
extend(validElements, svgElements);
}
return function(html) {
var buf = [];
htmlParser(html, htmlSanitizeWriter(buf, function(uri, isImage) {
return !/^unsafe:/.test($$sanitizeUri(uri, isImage));
}));
return buf.join('');
};
}];
/**
* @ngdoc method
* @name $sanitizeProvider#enableSvg
* @kind function
*
* @description
* Enables a subset of svg to be supported by the sanitizer.
*
* <div class="alert alert-warning">
* <p>By enabling this setting without taking other precautions, you might expose your
* application to click-hijacking attacks. In these attacks, sanitized svg elements could be positioned
* outside of the containing element and be rendered over other elements on the page (e.g. a login
* link). Such behavior can then result in phishing incidents.</p>
*
* <p>To protect against these, explicitly setup `overflow: hidden` css rule for all potential svg
* tags within the sanitized content:</p>
*
* <br>
*
* <pre><code>
* .rootOfTheIncludedContent svg {
* overflow: hidden !important;
* }
* </code></pre>
* </div>
*
* @param {boolean=} flag Enable or disable SVG support in the sanitizer.
* @returns {boolean|ng.$sanitizeProvider} Returns the currently configured value if called
* without an argument or self for chaining otherwise.
*/
this.enableSvg = function(enableSvg) {
if (isDefined(enableSvg)) {
svgEnabled = enableSvg;
return this;
} else {
return svgEnabled;
}
};
//////////////////////////////////////////////////////////////////////////////////////////////////
// Private stuff
//////////////////////////////////////////////////////////////////////////////////////////////////
bind = angular.bind;
extend = angular.extend;
forEach = angular.forEach;
isDefined = angular.isDefined;
lowercase = angular.lowercase;
noop = angular.noop;
htmlParser = htmlParserImpl;
htmlSanitizeWriter = htmlSanitizeWriterImpl;
// Regular Expressions for parsing tags and attributes
var SURROGATE_PAIR_REGEXP = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g,
// Match everything outside of normal chars and " (quote character)
NON_ALPHANUMERIC_REGEXP = /([^#-~ |!])/g;
// Good source of info about elements and attributes
// http://dev.w3.org/html5/spec/Overview.html#semantics
// http://simon.html5.org/html-elements
// Safe Void Elements - HTML5
// http://dev.w3.org/html5/spec/Overview.html#void-elements
var voidElements = toMap('area,br,col,hr,img,wbr');
// Elements that you can, intentionally, leave open (and which close themselves)
// http://dev.w3.org/html5/spec/Overview.html#optional-tags
var optionalEndTagBlockElements = toMap('colgroup,dd,dt,li,p,tbody,td,tfoot,th,thead,tr'),
optionalEndTagInlineElements = toMap('rp,rt'),
optionalEndTagElements = extend({},
optionalEndTagInlineElements,
optionalEndTagBlockElements);
// Safe Block Elements - HTML5
var blockElements = extend({}, optionalEndTagBlockElements, toMap('address,article,' +
'aside,blockquote,caption,center,del,dir,div,dl,figure,figcaption,footer,h1,h2,h3,h4,h5,' +
'h6,header,hgroup,hr,ins,map,menu,nav,ol,pre,section,table,ul'));
// Inline Elements - HTML5
var inlineElements = extend({}, optionalEndTagInlineElements, toMap('a,abbr,acronym,b,' +
'bdi,bdo,big,br,cite,code,del,dfn,em,font,i,img,ins,kbd,label,map,mark,q,ruby,rp,rt,s,' +
'samp,small,span,strike,strong,sub,sup,time,tt,u,var'));
// SVG Elements
// https://wiki.whatwg.org/wiki/Sanitization_rules#svg_Elements
// Note: the elements animate,animateColor,animateMotion,animateTransform,set are intentionally omitted.
// They can potentially allow for arbitrary javascript to be executed. See #11290
var svgElements = toMap('circle,defs,desc,ellipse,font-face,font-face-name,font-face-src,g,glyph,' +
'hkern,image,linearGradient,line,marker,metadata,missing-glyph,mpath,path,polygon,polyline,' +
'radialGradient,rect,stop,svg,switch,text,title,tspan');
// Blocked Elements (will be stripped)
var blockedElements = toMap('script,style');
var validElements = extend({},
voidElements,
blockElements,
inlineElements,
optionalEndTagElements);
//Attributes that have href and hence need to be sanitized
var uriAttrs = toMap('background,cite,href,longdesc,src,xlink:href');
var htmlAttrs = toMap('abbr,align,alt,axis,bgcolor,border,cellpadding,cellspacing,class,clear,' +
'color,cols,colspan,compact,coords,dir,face,headers,height,hreflang,hspace,' +
'ismap,lang,language,nohref,nowrap,rel,rev,rows,rowspan,rules,' +
'scope,scrolling,shape,size,span,start,summary,tabindex,target,title,type,' +
'valign,value,vspace,width');
// SVG attributes (without "id" and "name" attributes)
// https://wiki.whatwg.org/wiki/Sanitization_rules#svg_Attributes
var svgAttrs = toMap('accent-height,accumulate,additive,alphabetic,arabic-form,ascent,' +
'baseProfile,bbox,begin,by,calcMode,cap-height,class,color,color-rendering,content,' +
'cx,cy,d,dx,dy,descent,display,dur,end,fill,fill-rule,font-family,font-size,font-stretch,' +
'font-style,font-variant,font-weight,from,fx,fy,g1,g2,glyph-name,gradientUnits,hanging,' +
'height,horiz-adv-x,horiz-origin-x,ideographic,k,keyPoints,keySplines,keyTimes,lang,' +
'marker-end,marker-mid,marker-start,markerHeight,markerUnits,markerWidth,mathematical,' +
'max,min,offset,opacity,orient,origin,overline-position,overline-thickness,panose-1,' +
'path,pathLength,points,preserveAspectRatio,r,refX,refY,repeatCount,repeatDur,' +
'requiredExtensions,requiredFeatures,restart,rotate,rx,ry,slope,stemh,stemv,stop-color,' +
'stop-opacity,strikethrough-position,strikethrough-thickness,stroke,stroke-dasharray,' +
'stroke-dashoffset,stroke-linecap,stroke-linejoin,stroke-miterlimit,stroke-opacity,' +
'stroke-width,systemLanguage,target,text-anchor,to,transform,type,u1,u2,underline-position,' +
'underline-thickness,unicode,unicode-range,units-per-em,values,version,viewBox,visibility,' +
'width,widths,x,x-height,x1,x2,xlink:actuate,xlink:arcrole,xlink:role,xlink:show,xlink:title,' +
'xlink:type,xml:base,xml:lang,xml:space,xmlns,xmlns:xlink,y,y1,y2,zoomAndPan', true);
var validAttrs = extend({},
uriAttrs,
svgAttrs,
htmlAttrs);
function toMap(str, lowercaseKeys) {
var obj = {}, items = str.split(','), i;
for (i = 0; i < items.length; i++) {
obj[lowercaseKeys ? lowercase(items[i]) : items[i]] = true;
}
return obj;
}
var inertBodyElement;
(function(window) {
var doc;
if (window.document && window.document.implementation) {
doc = window.document.implementation.createHTMLDocument('inert');
} else {
throw $sanitizeMinErr('noinert', 'Can\'t create an inert html document');
}
var docElement = doc.documentElement || doc.getDocumentElement();
var bodyElements = docElement.getElementsByTagName('body');
// usually there should be only one body element in the document, but IE doesn't have any, so we need to create one
if (bodyElements.length === 1) {
inertBodyElement = bodyElements[0];
} else {
var html = doc.createElement('html');
inertBodyElement = doc.createElement('body');
html.appendChild(inertBodyElement);
doc.appendChild(html);
}
})(window);
/**
* @example
* htmlParser(htmlString, {
* start: function(tag, attrs) {},
* end: function(tag) {},
* chars: function(text) {},
* comment: function(text) {}
* });
*
* @param {string} html string
* @param {object} handler
*/
function htmlParserImpl(html, handler) {
if (html === null || html === undefined) {
html = '';
} else if (typeof html !== 'string') {
html = '' + html;
}
inertBodyElement.innerHTML = html;
//mXSS protection
var mXSSAttempts = 5;
do {
if (mXSSAttempts === 0) {
throw $sanitizeMinErr('uinput', 'Failed to sanitize html because the input is unstable');
}
mXSSAttempts--;
// strip custom-namespaced attributes on IE<=11
if (window.document.documentMode) {
stripCustomNsAttrs(inertBodyElement);
}
html = inertBodyElement.innerHTML; //trigger mXSS
inertBodyElement.innerHTML = html;
} while (html !== inertBodyElement.innerHTML);
var node = inertBodyElement.firstChild;
while (node) {
switch (node.nodeType) {
case 1: // ELEMENT_NODE
handler.start(node.nodeName.toLowerCase(), attrToMap(node.attributes));
break;
case 3: // TEXT NODE
handler.chars(node.textContent);
break;
}
var nextNode;
if (!(nextNode = node.firstChild)) {
if (node.nodeType === 1) {
handler.end(node.nodeName.toLowerCase());
}
nextNode = node.nextSibling;
if (!nextNode) {
while (nextNode == null) {
node = node.parentNode;
if (node === inertBodyElement) break;
nextNode = node.nextSibling;
if (node.nodeType === 1) {
handler.end(node.nodeName.toLowerCase());
}
}
}
}
node = nextNode;
}
while ((node = inertBodyElement.firstChild)) {
inertBodyElement.removeChild(node);
}
}
function attrToMap(attrs) {
var map = {};
for (var i = 0, ii = attrs.length; i < ii; i++) {
var attr = attrs[i];
map[attr.name] = attr.value;
}
return map;
}
/**
* Escapes all potentially dangerous characters, so that the
* resulting string can be safely inserted into attribute or
* element text.
* @param value
* @returns {string} escaped text
*/
function encodeEntities(value) {
return value.
replace(/&/g, '&').
replace(SURROGATE_PAIR_REGEXP, function(value) {
var hi = value.charCodeAt(0);
var low = value.charCodeAt(1);
return '&#' + (((hi - 0xD800) * 0x400) + (low - 0xDC00) + 0x10000) + ';';
}).
replace(NON_ALPHANUMERIC_REGEXP, function(value) {
return '&#' + value.charCodeAt(0) + ';';
}).
replace(/</g, '<').
replace(/>/g, '>');
}
/**
* create an HTML/XML writer which writes to buffer
* @param {Array} buf use buf.join('') to get out sanitized html string
* @returns {object} in the form of {
* start: function(tag, attrs) {},
* end: function(tag) {},
* chars: function(text) {},
* comment: function(text) {}
* }
*/
function htmlSanitizeWriterImpl(buf, uriValidator) {
var ignoreCurrentElement = false;
var out = bind(buf, buf.push);
return {
start: function(tag, attrs) {
tag = lowercase(tag);
if (!ignoreCurrentElement && blockedElements[tag]) {
ignoreCurrentElement = tag;
}
if (!ignoreCurrentElement && validElements[tag] === true) {
out('<');
out(tag);
forEach(attrs, function(value, key) {
var lkey = lowercase(key);
var isImage = (tag === 'img' && lkey === 'src') || (lkey === 'background');
if (validAttrs[lkey] === true &&
(uriAttrs[lkey] !== true || uriValidator(value, isImage))) {
out(' ');
out(key);
out('="');
out(encodeEntities(value));
out('"');
}
});
out('>');
}
},
end: function(tag) {
tag = lowercase(tag);
if (!ignoreCurrentElement && validElements[tag] === true && voidElements[tag] !== true) {
out('</');
out(tag);
out('>');
}
// eslint-disable-next-line eqeqeq
if (tag == ignoreCurrentElement) {
ignoreCurrentElement = false;
}
},
chars: function(chars) {
if (!ignoreCurrentElement) {
out(encodeEntities(chars));
}
}
};
}
/**
* When IE9-11 comes across an unknown namespaced attribute e.g. 'xlink:foo' it adds 'xmlns:ns1' attribute to declare
* ns1 namespace and prefixes the attribute with 'ns1' (e.g. 'ns1:xlink:foo'). This is undesirable since we don't want
* to allow any of these custom attributes. This method strips them all.
*
* @param node Root element to process
*/
function stripCustomNsAttrs(node) {
if (node.nodeType === window.Node.ELEMENT_NODE) {
var attrs = node.attributes;
for (var i = 0, l = attrs.length; i < l; i++) {
var attrNode = attrs[i];
var attrName = attrNode.name.toLowerCase();
if (attrName === 'xmlns:ns1' || attrName.lastIndexOf('ns1:', 0) === 0) {
node.removeAttributeNode(attrNode);
i--;
l--;
}
}
}
var nextNode = node.firstChild;
if (nextNode) {
stripCustomNsAttrs(nextNode);
}
nextNode = node.nextSibling;
if (nextNode) {
stripCustomNsAttrs(nextNode);
}
}
}
function sanitizeText(chars) {
var buf = [];
var writer = htmlSanitizeWriter(buf, noop);
writer.chars(chars);
return buf.join('');
}
// define ngSanitize module and register $sanitize service
angular.module('ngSanitize', []).provider('$sanitize', $SanitizeProvider);
/**
* @ngdoc filter
* @name linky
* @kind function
*
* @description
* Finds links in text input and turns them into html links. Supports `http/https/ftp/mailto` and
* plain email address links.
*
* Requires the {@link ngSanitize `ngSanitize`} module to be installed.
*
* @param {string} text Input text.
* @param {string} target Window (`_blank|_self|_parent|_top`) or named frame to open links in.
* @param {object|function(url)} [attributes] Add custom attributes to the link element.
*
* Can be one of:
*
* - `object`: A map of attributes
* - `function`: Takes the url as a parameter and returns a map of attributes
*
* If the map of attributes contains a value for `target`, it overrides the value of
* the target parameter.
*
*
* @returns {string} Html-linkified and {@link $sanitize sanitized} text.
*
* @usage
<span ng-bind-html="linky_expression | linky"></span>
*
* @example
<example module="linkyExample" deps="angular-sanitize.js" name="linky-filter">
<file name="index.html">
<div ng-controller="ExampleController">
Snippet: <textarea ng-model="snippet" cols="60" rows="3"></textarea>
<table>
<tr>
<th>Filter</th>
<th>Source</th>
<th>Rendered</th>
</tr>
<tr id="linky-filter">
<td>linky filter</td>
<td>
<pre><div ng-bind-html="snippet | linky"><br></div></pre>
</td>
<td>
<div ng-bind-html="snippet | linky"></div>
</td>
</tr>
<tr id="linky-target">
<td>linky target</td>
<td>
<pre><div ng-bind-html="snippetWithSingleURL | linky:'_blank'"><br></div></pre>
</td>
<td>
<div ng-bind-html="snippetWithSingleURL | linky:'_blank'"></div>
</td>
</tr>
<tr id="linky-custom-attributes">
<td>linky custom attributes</td>
<td>
<pre><div ng-bind-html="snippetWithSingleURL | linky:'_self':{rel: 'nofollow'}"><br></div></pre>
</td>
<td>
<div ng-bind-html="snippetWithSingleURL | linky:'_self':{rel: 'nofollow'}"></div>
</td>
</tr>
<tr id="escaped-html">
<td>no filter</td>
<td><pre><div ng-bind="snippet"><br></div></pre></td>
<td><div ng-bind="snippet"></div></td>
</tr>
</table>
</file>
<file name="script.js">
angular.module('linkyExample', ['ngSanitize'])
.controller('ExampleController', ['$scope', function($scope) {
$scope.snippet =
'Pretty text with some links:\n' +
'http://angularjs.org/,\n' +
'mailto:us@somewhere.org,\n' +
'another@somewhere.org,\n' +
'and one more: ftp://127.0.0.1/.';
$scope.snippetWithSingleURL = 'http://angularjs.org/';
}]);
</file>
<file name="protractor.js" type="protractor">
it('should linkify the snippet with urls', function() {
expect(element(by.id('linky-filter')).element(by.binding('snippet | linky')).getText()).
toBe('Pretty text with some links: http://angularjs.org/, us@somewhere.org, ' +
'another@somewhere.org, and one more: ftp://127.0.0.1/.');
expect(element.all(by.css('#linky-filter a')).count()).toEqual(4);
});
it('should not linkify snippet without the linky filter', function() {
expect(element(by.id('escaped-html')).element(by.binding('snippet')).getText()).
toBe('Pretty text with some links: http://angularjs.org/, mailto:us@somewhere.org, ' +
'another@somewhere.org, and one more: ftp://127.0.0.1/.');
expect(element.all(by.css('#escaped-html a')).count()).toEqual(0);
});
it('should update', function() {
element(by.model('snippet')).clear();
element(by.model('snippet')).sendKeys('new http://link.');
expect(element(by.id('linky-filter')).element(by.binding('snippet | linky')).getText()).
toBe('new http://link.');
expect(element.all(by.css('#linky-filter a')).count()).toEqual(1);
expect(element(by.id('escaped-html')).element(by.binding('snippet')).getText())
.toBe('new http://link.');
});
it('should work with the target property', function() {
expect(element(by.id('linky-target')).
element(by.binding("snippetWithSingleURL | linky:'_blank'")).getText()).
toBe('http://angularjs.org/');
expect(element(by.css('#linky-target a')).getAttribute('target')).toEqual('_blank');
});
it('should optionally add custom attributes', function() {
expect(element(by.id('linky-custom-attributes')).
element(by.binding("snippetWithSingleURL | linky:'_self':{rel: 'nofollow'}")).getText()).
toBe('http://angularjs.org/');
expect(element(by.css('#linky-custom-attributes a')).getAttribute('rel')).toEqual('nofollow');
});
</file>
</example>
*/
angular.module('ngSanitize').filter('linky', ['$sanitize', function($sanitize) {
var LINKY_URL_REGEXP =
/((ftp|https?):\/\/|(www\.)|(mailto:)?[A-Za-z0-9._%+-]+@)\S*[^\s.;,(){}<>"\u201d\u2019]/i,
MAILTO_REGEXP = /^mailto:/i;
var linkyMinErr = angular.$$minErr('linky');
var isDefined = angular.isDefined;
var isFunction = angular.isFunction;
var isObject = angular.isObject;
var isString = angular.isString;
return function(text, target, attributes) {
if (text == null || text === '') return text;
if (!isString(text)) throw linkyMinErr('notstring', 'Expected string but received: {0}', text);
var attributesFn =
isFunction(attributes) ? attributes :
isObject(attributes) ? function getAttributesObject() {return attributes;} :
function getEmptyAttributesObject() {return {};};
var match;
var raw = text;
var html = [];
var url;
var i;
while ((match = raw.match(LINKY_URL_REGEXP))) {
// We can not end in these as they are sometimes found at the end of the sentence
url = match[0];
// if we did not match ftp/http/www/mailto then assume mailto
if (!match[2] && !match[4]) {
url = (match[3] ? 'http://' : 'mailto:') + url;
}
i = match.index;
addText(raw.substr(0, i));
addLink(url, match[0].replace(MAILTO_REGEXP, ''));
raw = raw.substring(i + match[0].length);
}
addText(raw);
return $sanitize(html.join(''));
function addText(text) {
if (!text) {
return;
}
html.push(sanitizeText(text));
}
function addLink(url, text) {
var key, linkAttributes = attributesFn(url);
html.push('<a ');
for (key in linkAttributes) {
html.push(key + '="' + linkAttributes[key] + '" ');
}
if (isDefined(target) && !('target' in linkAttributes)) {
html.push('target="',
target,
'" ');
}
html.push('href="',
url.replace(/"/g, '"'),
'">');
addText(text);
html.push('</a>');
}
};
}]);
})(window, window.angular);
|
module.exports = function (grunt) {
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.initConfig({
jshint: {
options: { jshintrc: true },
all: ['*.js', 'lib/*.js', 'test/*.js']
}
});
grunt.registerTask('default', ['jshint']);
};
|
package org.json;
import java.io.IOException;
import java.io.Writer;
/*
Copyright (c) 2006 JSON.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
The Software shall be used for Good, not Evil.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
/**
* JSONWriter provides a quick and convenient way of producing JSON text.
* The texts produced strictly conform to JSON syntax rules. No whitespace is
* added, so the results are ready for transmission or storage. Each instance of
* JSONWriter can produce one JSON text.
* <p>
* A JSONWriter instance provides a <code>value</code> method for appending
* values to the
* text, and a <code>key</code>
* method for adding keys before values in objects. There are <code>array</code>
* and <code>endArray</code> methods that make and bound array values, and
* <code>object</code> and <code>endObject</code> methods which make and bound
* object values. All of these methods return the JSONWriter instance,
* permitting a cascade style. For example, <pre>
* new JSONWriter(myWriter)
* .object()
* .key("JSON")
* .value("Hello, World!")
* .endObject();</pre> which writes <pre>
* {"JSON":"Hello, World!"}</pre>
* <p>
* The first method called must be <code>array</code> or <code>object</code>.
* There are no methods for adding commas or colons. JSONWriter adds them for
* you. Objects and arrays can be nested up to 20 levels deep.
* <p>
* This can sometimes be easier than using a JSONObject to build a string.
* @author JSON.org
* @version 2011-11-24
*/
public class JSONWriter {
private static final int maxdepth = 200;
/**
* The comma flag determines if a comma should be output before the next
* value.
*/
private boolean comma;
/**
* The current mode. Values:
* 'a' (array),
* 'd' (done),
* 'i' (initial),
* 'k' (key),
* 'o' (object).
*/
protected char mode;
/**
* The object/array stack.
*/
private final JSONObject stack[];
/**
* The stack top index. A value of 0 indicates that the stack is empty.
*/
private int top;
/**
* The writer that will receive the output.
*/
protected Writer writer;
/**
* Make a fresh JSONWriter. It can be used to build one JSON text.
*/
public JSONWriter(Writer w) {
this.comma = false;
this.mode = 'i';
this.stack = new JSONObject[maxdepth];
this.top = 0;
this.writer = w;
}
/**
* Append a value.
* @param string A string value.
* @return this
* @throws JSONException If the value is out of sequence.
*/
private JSONWriter append(String string) throws JSONException {
if (string == null) {
throw new JSONException("Null pointer");
}
if (this.mode == 'o' || this.mode == 'a') {
try {
if (this.comma && this.mode == 'a') {
this.writer.write(',');
}
this.writer.write(string);
} catch (IOException e) {
throw new JSONException(e);
}
if (this.mode == 'o') {
this.mode = 'k';
}
this.comma = true;
return this;
}
throw new JSONException("Value out of sequence.");
}
/**
* Begin appending a new array. All values until the balancing
* <code>endArray</code> will be appended to this array. The
* <code>endArray</code> method must be called to mark the array's end.
* @return this
* @throws JSONException If the nesting is too deep, or if the object is
* started in the wrong place (for example as a key or after the end of the
* outermost array or object).
*/
public JSONWriter array() throws JSONException {
if (this.mode == 'i' || this.mode == 'o' || this.mode == 'a') {
this.push(null);
this.append("[");
this.comma = false;
return this;
}
throw new JSONException("Misplaced array.");
}
/**
* End something.
* @param mode Mode
* @param c Closing character
* @return this
* @throws JSONException If unbalanced.
*/
private JSONWriter end(char mode, char c) throws JSONException {
if (this.mode != mode) {
throw new JSONException(mode == 'a'
? "Misplaced endArray."
: "Misplaced endObject.");
}
this.pop(mode);
try {
this.writer.write(c);
} catch (IOException e) {
throw new JSONException(e);
}
this.comma = true;
return this;
}
/**
* End an array. This method most be called to balance calls to
* <code>array</code>.
* @return this
* @throws JSONException If incorrectly nested.
*/
public JSONWriter endArray() throws JSONException {
return this.end('a', ']');
}
/**
* End an object. This method most be called to balance calls to
* <code>object</code>.
* @return this
* @throws JSONException If incorrectly nested.
*/
public JSONWriter endObject() throws JSONException {
return this.end('k', '}');
}
/**
* Append a key. The key will be associated with the next value. In an
* object, every value must be preceded by a key.
* @param string A key string.
* @return this
* @throws JSONException If the key is out of place. For example, keys
* do not belong in arrays or if the key is null.
*/
public JSONWriter key(String string) throws JSONException {
if (string == null) {
throw new JSONException("Null key.");
}
if (this.mode == 'k') {
try {
this.stack[this.top - 1].putOnce(string, Boolean.TRUE);
if (this.comma) {
this.writer.write(',');
}
this.writer.write(JSONObject.quote(string));
this.writer.write(':');
this.comma = false;
this.mode = 'o';
return this;
} catch (IOException e) {
throw new JSONException(e);
}
}
throw new JSONException("Misplaced key.");
}
/**
* Begin appending a new object. All keys and values until the balancing
* <code>endObject</code> will be appended to this object. The
* <code>endObject</code> method must be called to mark the object's end.
* @return this
* @throws JSONException If the nesting is too deep, or if the object is
* started in the wrong place (for example as a key or after the end of the
* outermost array or object).
*/
public JSONWriter object() throws JSONException {
if (this.mode == 'i') {
this.mode = 'o';
}
if (this.mode == 'o' || this.mode == 'a') {
this.append("{");
this.push(new JSONObject());
this.comma = false;
return this;
}
throw new JSONException("Misplaced object.");
}
/**
* Pop an array or object scope.
* @param c The scope to close.
* @throws JSONException If nesting is wrong.
*/
private void pop(char c) throws JSONException {
if (this.top <= 0) {
throw new JSONException("Nesting error.");
}
char m = this.stack[this.top - 1] == null ? 'a' : 'k';
if (m != c) {
throw new JSONException("Nesting error.");
}
this.top -= 1;
this.mode = this.top == 0
? 'd'
: this.stack[this.top - 1] == null
? 'a'
: 'k';
}
/**
* Push an array or object scope.
* @param c The scope to open.
* @throws JSONException If nesting is too deep.
*/
private void push(JSONObject jo) throws JSONException {
if (this.top >= maxdepth) {
throw new JSONException("Nesting too deep.");
}
this.stack[this.top] = jo;
this.mode = jo == null ? 'a' : 'k';
this.top += 1;
}
/**
* Append either the value <code>true</code> or the value
* <code>false</code>.
* @param b A boolean.
* @return this
* @throws JSONException
*/
public JSONWriter value(boolean b) throws JSONException {
return this.append(b ? "true" : "false");
}
/**
* Append a double value.
* @param d A double.
* @return this
* @throws JSONException If the number is not finite.
*/
public JSONWriter value(double d) throws JSONException {
return this.value(new Double(d));
}
/**
* Append a long value.
* @param l A long.
* @return this
* @throws JSONException
*/
public JSONWriter value(long l) throws JSONException {
return this.append(Long.toString(l));
}
/**
* Append an object value.
* @param object The object to append. It can be null, or a Boolean, Number,
* String, JSONObject, or JSONArray, or an object that implements JSONString.
* @return this
* @throws JSONException If the value is out of sequence.
*/
public JSONWriter value(Object object) throws JSONException {
return this.append(JSONObject.valueToString(object));
}
}
|
/*
Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang("widget","no",{move:"Klikk og dra for å flytte",label:"%1 widget"}); |
# labeled-stream-splicer
[stream splicer](https://npmjs.org/package/stream-splicer) with labels
[](https://ci.testling.com/substack/labeled-stream-splicer)
[](http://travis-ci.org/substack/labeled-stream-splicer)
# example
Here's an example that exposes a label for `deps` and `pack`:
``` js
var splicer = require('labeled-stream-splicer');
var through = require('through2');
var deps = require('module-deps');
var pack = require('browser-pack');
var lstream = require('lstream');
var pipeline = splicer.obj([
'deps', [ deps() ],
'pack', [ pack({ raw: true }) ]
]);
pipeline.get('deps').unshift(lstream());
pipeline.get('deps').push(through.obj(function (row, enc, next) {
row.source = row.source.toUpperCase();
this.push(row);
next();
}));
process.stdin.pipe(pipeline).pipe(process.stdout);
```
Here the `deps` sub-pipeline is augmented with a post-transformation that
uppercases its source input.
# methods
``` js
var splicer = require('labeled-stream-splicer')
```
The API is the same as
[stream-splicer](https://npmjs.org/package/stream-splicer),
except that `pipeline.get()`, `pipeline.splice()`, and `pipeline.indexOf()` can
accept string labels in addition to numeric indexes.
## var pipeline = splicer(streams, opts)
Create a `pipeline` duplex stream given an array of `streams`. Each `stream`
will be piped to the next. Writes to `pipeline` get written to the first stream
and data for reads from `pipeline` come from the last stream.
To signify a label, a stream may have a `.label` property or a string may be
placed in the `streams` array.
For example, for streams `[ a, 'foo', b, c, 'bar', d ]`, this pipeline is
constructed internally:
```
a.pipe(b).pipe(c).pipe(d)
```
with a label `'foo`' that points to `b` and a label `'bar'` that points to `d`.
If `a` or `c` has a `.label` property, that label would be used for addressing.
Input will get written into `a`. Output will be read from `d`.
If any of the elements in `streams` are arrays, they will be converted into
nested labeled pipelines. This is useful if you want to expose a hookable
pipeline with grouped insertion points.
## var pipeline = splicer.obj(streams, opts)
Create a `pipeline` with `opts.objectMode` set to true for convenience.
## var removed = pipeline.splice(index, howMany, stream, ...)
Splice the pipeline starting at `index`, removing `howMany` streams and
replacing them with each additional `stream` argument provided.
The streams that were removed from the splice and returned.
`index` can be an integer index or a label.
## pipeline.push(stream, ...)
Push one or more streams to the end of the pipeline.
The stream arguments may have a `label` property that will be used for string
lookups.
## var stream = pipeline.pop()
Pop a stream from the end of the pipeline.
## pipeline.unshift(stream, ...)
Unshift one or more streams to the begining of the pipeline.
The stream arguments may have a `label` property that will be used for string
lookups.
## var stream = pipeline.shift()
Shift a stream from the begining of the pipeline.
## var stream = pipeline.get(index)
Return the stream at index `index`.
`index` can be an integer or a string label.
# install
With [npm](https://npmjs.org) do:
```
npm install labeled-stream-splicer
```
# license
MIT
|
/**
* jqPlot
* Pure JavaScript plotting plugin using jQuery
*
* Version: 1.0.4
* Revision: 1120
*
* Copyright (c) 2009-2012 Chris Leonello
* jqPlot is currently available for use in all personal or commercial projects
* under both the MIT (http://www.opensource.org/licenses/mit-license.php) and GPL
* version 2.0 (http://www.gnu.org/licenses/gpl-2.0.html) licenses. This means that you can
* choose the license that best suits your project and use it accordingly.
*
* Although not required, the author would appreciate an email letting him
* know of any substantial use of jqPlot. You can reach the author at:
* chris at jqplot dot com or see http://www.jqplot.com/info.php .
*
* If you are feeling kind and generous, consider supporting the project by
* making a donation at: http://www.jqplot.com/donate.php .
*
* sprintf functions contained in jqplot.sprintf.js by Ash Searle:
*
* version 2007.04.27
* author Ash Searle
* http://hexmen.com/blog/2007/03/printf-sprintf/
* http://hexmen.com/js/sprintf.js
* The author (Ash Searle) has placed this code in the public domain:
* "This code is unrestricted: you are free to use it however you like."
*
*/
(function($) {
/**
* Class: $.jqplot.Cursor
* Plugin class representing the cursor as displayed on the plot.
*/
$.jqplot.Cursor = function(options) {
// Group: Properties
//
// prop: style
// CSS spec for cursor style
this.style = 'crosshair';
this.previousCursor = 'auto';
// prop: show
// wether to show the cursor or not.
this.show = $.jqplot.config.enablePlugins;
// prop: showTooltip
// show a cursor position tooltip. Location of the tooltip
// will be controlled by followMouse and tooltipLocation.
this.showTooltip = true;
// prop: followMouse
// Tooltip follows the mouse, it is not at a fixed location.
// Tooltip will show on the grid at the location given by
// tooltipLocation, offset from the grid edge by tooltipOffset.
this.followMouse = false;
// prop: tooltipLocation
// Where to position tooltip. If followMouse is true, this is
// relative to the cursor, otherwise, it is relative to the grid.
// One of 'n', 'ne', 'e', 'se', 's', 'sw', 'w', 'nw'
this.tooltipLocation = 'se';
// prop: tooltipOffset
// Pixel offset of tooltip from the grid boudaries or cursor center.
this.tooltipOffset = 6;
// prop: showTooltipGridPosition
// show the grid pixel coordinates of the mouse.
this.showTooltipGridPosition = false;
// prop: showTooltipUnitPosition
// show the unit (data) coordinates of the mouse.
this.showTooltipUnitPosition = true;
// prop: showTooltipDataPosition
// Used with showVerticalLine to show intersecting data points in the tooltip.
this.showTooltipDataPosition = false;
// prop: tooltipFormatString
// sprintf format string for the tooltip.
// Uses Ash Searle's javascript sprintf implementation
// found here: http://hexmen.com/blog/2007/03/printf-sprintf/
// See http://perldoc.perl.org/functions/sprintf.html for reference
// Note, if showTooltipDataPosition is true, the default tooltipFormatString
// will be set to the cursorLegendFormatString, not the default given here.
this.tooltipFormatString = '%.4P, %.4P';
// prop: useAxesFormatters
// Use the x and y axes formatters to format the text in the tooltip.
this.useAxesFormatters = true;
// prop: tooltipAxisGroups
// Show position for the specified axes.
// This is an array like [['xaxis', 'yaxis'], ['xaxis', 'y2axis']]
// Default is to compute automatically for all visible axes.
this.tooltipAxisGroups = [];
// prop: zoom
// Enable plot zooming.
this.zoom = false;
// zoomProxy and zoomTarget properties are not directly set by user.
// They Will be set through call to zoomProxy method.
this.zoomProxy = false;
this.zoomTarget = false;
// prop: looseZoom
// Will expand zoom range to provide more rounded tick values.
// Works only with linear, log and date axes.
this.looseZoom = true;
// prop: clickReset
// Will reset plot zoom if single click on plot without drag.
this.clickReset = false;
// prop: dblClickReset
// Will reset plot zoom if double click on plot without drag.
this.dblClickReset = true;
// prop: showVerticalLine
// draw a vertical line across the plot which follows the cursor.
// When the line is near a data point, a special legend and/or tooltip can
// be updated with the data values.
this.showVerticalLine = false;
// prop: showHorizontalLine
// draw a horizontal line across the plot which follows the cursor.
this.showHorizontalLine = false;
// prop: constrainZoomTo
// 'none', 'x' or 'y'
this.constrainZoomTo = 'none';
// // prop: autoscaleConstraint
// // when a constrained axis is specified, true will
// // auatoscale the adjacent axis.
// this.autoscaleConstraint = true;
this.shapeRenderer = new $.jqplot.ShapeRenderer();
this._zoom = {start:[], end:[], started: false, zooming:false, isZoomed:false, axes:{start:{}, end:{}}, gridpos:{}, datapos:{}};
this._tooltipElem;
this.zoomCanvas;
this.cursorCanvas;
// prop: intersectionThreshold
// pixel distance from data point or marker to consider cursor lines intersecting with point.
// If data point markers are not shown, this should be >= 1 or will often miss point intersections.
this.intersectionThreshold = 2;
// prop: showCursorLegend
// Replace the plot legend with an enhanced legend displaying intersection information.
this.showCursorLegend = false;
// prop: cursorLegendFormatString
// Format string used in the cursor legend. If showTooltipDataPosition is true,
// this will also be the default format string used by tooltipFormatString.
this.cursorLegendFormatString = $.jqplot.Cursor.cursorLegendFormatString;
// whether the cursor is over the grid or not.
this._oldHandlers = {onselectstart: null, ondrag: null, onmousedown: null};
// prop: constrainOutsideZoom
// True to limit actual zoom area to edges of grid, even when zooming
// outside of plot area. That is, can't zoom out by mousing outside plot.
this.constrainOutsideZoom = true;
// prop: showTooltipOutsideZoom
// True will keep updating the tooltip when zooming of the grid.
this.showTooltipOutsideZoom = false;
// true if mouse is over grid, false if not.
this.onGrid = false;
$.extend(true, this, options);
};
$.jqplot.Cursor.cursorLegendFormatString = '%s x:%s, y:%s';
// called with scope of plot
$.jqplot.Cursor.init = function (target, data, opts){
// add a cursor attribute to the plot
var options = opts || {};
this.plugins.cursor = new $.jqplot.Cursor(options.cursor);
var c = this.plugins.cursor;
if (c.show) {
$.jqplot.eventListenerHooks.push(['jqplotMouseEnter', handleMouseEnter]);
$.jqplot.eventListenerHooks.push(['jqplotMouseLeave', handleMouseLeave]);
$.jqplot.eventListenerHooks.push(['jqplotMouseMove', handleMouseMove]);
if (c.showCursorLegend) {
opts.legend = opts.legend || {};
opts.legend.renderer = $.jqplot.CursorLegendRenderer;
opts.legend.formatString = this.plugins.cursor.cursorLegendFormatString;
opts.legend.show = true;
}
if (c.zoom) {
$.jqplot.eventListenerHooks.push(['jqplotMouseDown', handleMouseDown]);
if (c.clickReset) {
$.jqplot.eventListenerHooks.push(['jqplotClick', handleClick]);
}
if (c.dblClickReset) {
$.jqplot.eventListenerHooks.push(['jqplotDblClick', handleDblClick]);
}
}
this.resetZoom = function() {
var axes = this.axes;
if (!c.zoomProxy) {
for (var ax in axes) {
axes[ax].reset();
axes[ax]._ticks = [];
// fake out tick creation algorithm to make sure original auto
// computed format string is used if _overrideFormatString is true
if (c._zoom.axes[ax] !== undefined) {
axes[ax]._autoFormatString = c._zoom.axes[ax].tickFormatString;
}
}
this.redraw();
}
else {
var ctx = this.plugins.cursor.zoomCanvas._ctx;
ctx.clearRect(0,0,ctx.canvas.width, ctx.canvas.height);
ctx = null;
}
this.plugins.cursor._zoom.isZoomed = false;
this.target.trigger('jqplotResetZoom', [this, this.plugins.cursor]);
};
if (c.showTooltipDataPosition) {
c.showTooltipUnitPosition = false;
c.showTooltipGridPosition = false;
if (options.cursor.tooltipFormatString == undefined) {
c.tooltipFormatString = $.jqplot.Cursor.cursorLegendFormatString;
}
}
}
};
// called with context of plot
$.jqplot.Cursor.postDraw = function() {
var c = this.plugins.cursor;
// Memory Leaks patch
if (c.zoomCanvas) {
c.zoomCanvas.resetCanvas();
c.zoomCanvas = null;
}
if (c.cursorCanvas) {
c.cursorCanvas.resetCanvas();
c.cursorCanvas = null;
}
if (c._tooltipElem) {
c._tooltipElem.emptyForce();
c._tooltipElem = null;
}
if (c.zoom) {
c.zoomCanvas = new $.jqplot.GenericCanvas();
this.eventCanvas._elem.before(c.zoomCanvas.createElement(this._gridPadding, 'jqplot-zoom-canvas', this._plotDimensions, this));
c.zoomCanvas.setContext();
}
var elem = document.createElement('div');
c._tooltipElem = $(elem);
elem = null;
c._tooltipElem.addClass('jqplot-cursor-tooltip');
c._tooltipElem.css({position:'absolute', display:'none'});
if (c.zoomCanvas) {
c.zoomCanvas._elem.before(c._tooltipElem);
}
else {
this.eventCanvas._elem.before(c._tooltipElem);
}
if (c.showVerticalLine || c.showHorizontalLine) {
c.cursorCanvas = new $.jqplot.GenericCanvas();
this.eventCanvas._elem.before(c.cursorCanvas.createElement(this._gridPadding, 'jqplot-cursor-canvas', this._plotDimensions, this));
c.cursorCanvas.setContext();
}
// if we are showing the positions in unit coordinates, and no axes groups
// were specified, create a default set.
if (c.showTooltipUnitPosition){
if (c.tooltipAxisGroups.length === 0) {
var series = this.series;
var s;
var temp = [];
for (var i=0; i<series.length; i++) {
s = series[i];
var ax = s.xaxis+','+s.yaxis;
if ($.inArray(ax, temp) == -1) {
temp.push(ax);
}
}
for (var i=0; i<temp.length; i++) {
c.tooltipAxisGroups.push(temp[i].split(','));
}
}
}
};
// Group: methods
//
// method: $.jqplot.Cursor.zoomProxy
// links targetPlot to controllerPlot so that plot zooming of
// targetPlot will be controlled by zooming on the controllerPlot.
// controllerPlot will not actually zoom, but acts as an
// overview plot. Note, the zoom options must be set to true for
// zoomProxy to work.
$.jqplot.Cursor.zoomProxy = function(targetPlot, controllerPlot) {
var tc = targetPlot.plugins.cursor;
var cc = controllerPlot.plugins.cursor;
tc.zoomTarget = true;
tc.zoom = true;
tc.style = 'auto';
tc.dblClickReset = false;
cc.zoom = true;
cc.zoomProxy = true;
controllerPlot.target.bind('jqplotZoom', plotZoom);
controllerPlot.target.bind('jqplotResetZoom', plotReset);
function plotZoom(ev, gridpos, datapos, plot, cursor) {
tc.doZoom(gridpos, datapos, targetPlot, cursor);
}
function plotReset(ev, plot, cursor) {
targetPlot.resetZoom();
}
};
$.jqplot.Cursor.prototype.resetZoom = function(plot, cursor) {
var axes = plot.axes;
var cax = cursor._zoom.axes;
if (!plot.plugins.cursor.zoomProxy && cursor._zoom.isZoomed) {
for (var ax in axes) {
// axes[ax]._ticks = [];
// axes[ax].min = cax[ax].min;
// axes[ax].max = cax[ax].max;
// axes[ax].numberTicks = cax[ax].numberTicks;
// axes[ax].tickInterval = cax[ax].tickInterval;
// // for date axes
// axes[ax].daTickInterval = cax[ax].daTickInterval;
axes[ax].reset();
axes[ax]._ticks = [];
// fake out tick creation algorithm to make sure original auto
// computed format string is used if _overrideFormatString is true
axes[ax]._autoFormatString = cax[ax].tickFormatString;
}
plot.redraw();
cursor._zoom.isZoomed = false;
}
else {
var ctx = cursor.zoomCanvas._ctx;
ctx.clearRect(0,0,ctx.canvas.width, ctx.canvas.height);
ctx = null;
}
plot.target.trigger('jqplotResetZoom', [plot, cursor]);
};
$.jqplot.Cursor.resetZoom = function(plot) {
plot.resetZoom();
};
$.jqplot.Cursor.prototype.doZoom = function (gridpos, datapos, plot, cursor) {
var c = cursor;
var axes = plot.axes;
var zaxes = c._zoom.axes;
var start = zaxes.start;
var end = zaxes.end;
var min, max, dp, span,
newmin, newmax, curax, _numberTicks, ret;
var ctx = plot.plugins.cursor.zoomCanvas._ctx;
// don't zoom if zoom area is too small (in pixels)
if ((c.constrainZoomTo == 'none' && Math.abs(gridpos.x - c._zoom.start[0]) > 6 && Math.abs(gridpos.y - c._zoom.start[1]) > 6) || (c.constrainZoomTo == 'x' && Math.abs(gridpos.x - c._zoom.start[0]) > 6) || (c.constrainZoomTo == 'y' && Math.abs(gridpos.y - c._zoom.start[1]) > 6)) {
if (!plot.plugins.cursor.zoomProxy) {
for (var ax in datapos) {
// make a copy of the original axes to revert back.
if (c._zoom.axes[ax] == undefined) {
c._zoom.axes[ax] = {};
c._zoom.axes[ax].numberTicks = axes[ax].numberTicks;
c._zoom.axes[ax].tickInterval = axes[ax].tickInterval;
// for date axes...
c._zoom.axes[ax].daTickInterval = axes[ax].daTickInterval;
c._zoom.axes[ax].min = axes[ax].min;
c._zoom.axes[ax].max = axes[ax].max;
c._zoom.axes[ax].tickFormatString = (axes[ax].tickOptions != null) ? axes[ax].tickOptions.formatString : '';
}
if ((c.constrainZoomTo == 'none') || (c.constrainZoomTo == 'x' && ax.charAt(0) == 'x') || (c.constrainZoomTo == 'y' && ax.charAt(0) == 'y')) {
dp = datapos[ax];
if (dp != null) {
if (dp > start[ax]) {
newmin = start[ax];
newmax = dp;
}
else {
span = start[ax] - dp;
newmin = dp;
newmax = start[ax];
}
curax = axes[ax];
_numberTicks = null;
// if aligning this axis, use number of ticks from previous axis.
// Do I need to reset somehow if alignTicks is changed and then graph is replotted??
if (curax.alignTicks) {
if (curax.name === 'x2axis' && plot.axes.xaxis.show) {
_numberTicks = plot.axes.xaxis.numberTicks;
}
else if (curax.name.charAt(0) === 'y' && curax.name !== 'yaxis' && curax.name !== 'yMidAxis' && plot.axes.yaxis.show) {
_numberTicks = plot.axes.yaxis.numberTicks;
}
}
if (this.looseZoom && (axes[ax].renderer.constructor === $.jqplot.LinearAxisRenderer || axes[ax].renderer.constructor === $.jqplot.LogAxisRenderer )) { //} || axes[ax].renderer.constructor === $.jqplot.DateAxisRenderer)) {
ret = $.jqplot.LinearTickGenerator(newmin, newmax, curax._scalefact, _numberTicks);
// if new minimum is less than "true" minimum of axis display, adjust it
if (axes[ax].tickInset && ret[0] < axes[ax].min + axes[ax].tickInset * axes[ax].tickInterval) {
ret[0] += ret[4];
ret[2] -= 1;
}
// if new maximum is greater than "true" max of axis display, adjust it
if (axes[ax].tickInset && ret[1] > axes[ax].max - axes[ax].tickInset * axes[ax].tickInterval) {
ret[1] -= ret[4];
ret[2] -= 1;
}
// for log axes, don't fall below current minimum, this will look bad and can't have 0 in range anyway.
if (axes[ax].renderer.constructor === $.jqplot.LogAxisRenderer && ret[0] < axes[ax].min) {
// remove a tick and shift min up
ret[0] += ret[4];
ret[2] -= 1;
}
axes[ax].min = ret[0];
axes[ax].max = ret[1];
axes[ax]._autoFormatString = ret[3];
axes[ax].numberTicks = ret[2];
axes[ax].tickInterval = ret[4];
// for date axes...
axes[ax].daTickInterval = [ret[4]/1000, 'seconds'];
}
else {
axes[ax].min = newmin;
axes[ax].max = newmax;
axes[ax].tickInterval = null;
axes[ax].numberTicks = null;
// for date axes...
axes[ax].daTickInterval = null;
}
axes[ax]._ticks = [];
}
}
// if ((c.constrainZoomTo == 'x' && ax.charAt(0) == 'y' && c.autoscaleConstraint) || (c.constrainZoomTo == 'y' && ax.charAt(0) == 'x' && c.autoscaleConstraint)) {
// dp = datapos[ax];
// if (dp != null) {
// axes[ax].max == null;
// axes[ax].min = null;
// }
// }
}
ctx.clearRect(0,0,ctx.canvas.width, ctx.canvas.height);
plot.redraw();
c._zoom.isZoomed = true;
ctx = null;
}
plot.target.trigger('jqplotZoom', [gridpos, datapos, plot, cursor]);
}
};
$.jqplot.preInitHooks.push($.jqplot.Cursor.init);
$.jqplot.postDrawHooks.push($.jqplot.Cursor.postDraw);
function updateTooltip(gridpos, datapos, plot) {
var c = plot.plugins.cursor;
var s = '';
var addbr = false;
if (c.showTooltipGridPosition) {
s = gridpos.x+', '+gridpos.y;
addbr = true;
}
if (c.showTooltipUnitPosition) {
var g;
for (var i=0; i<c.tooltipAxisGroups.length; i++) {
g = c.tooltipAxisGroups[i];
if (addbr) {
s += '<br />';
}
if (c.useAxesFormatters) {
for (var j=0; j<g.length; j++) {
if (j) {
s += ', ';
}
var af = plot.axes[g[j]]._ticks[0].formatter;
var afstr = plot.axes[g[j]]._ticks[0].formatString;
s += af(afstr, datapos[g[j]]);
}
}
else {
s += $.jqplot.sprintf(c.tooltipFormatString, datapos[g[0]], datapos[g[1]]);
}
addbr = true;
}
}
if (c.showTooltipDataPosition) {
var series = plot.series;
var ret = getIntersectingPoints(plot, gridpos.x, gridpos.y);
var addbr = false;
for (var i = 0; i< series.length; i++) {
if (series[i].show) {
var idx = series[i].index;
var label = series[i].label.toString();
var cellid = $.inArray(idx, ret.indices);
var sx = undefined;
var sy = undefined;
if (cellid != -1) {
var data = ret.data[cellid].data;
if (c.useAxesFormatters) {
var xf = series[i]._xaxis._ticks[0].formatter;
var yf = series[i]._yaxis._ticks[0].formatter;
var xfstr = series[i]._xaxis._ticks[0].formatString;
var yfstr = series[i]._yaxis._ticks[0].formatString;
sx = xf(xfstr, data[0]);
sy = yf(yfstr, data[1]);
}
else {
sx = data[0];
sy = data[1];
}
if (addbr) {
s += '<br />';
}
s += $.jqplot.sprintf(c.tooltipFormatString, label, sx, sy);
addbr = true;
}
}
}
}
c._tooltipElem.html(s);
}
function moveLine(gridpos, plot) {
var c = plot.plugins.cursor;
var ctx = c.cursorCanvas._ctx;
ctx.clearRect(0,0,ctx.canvas.width, ctx.canvas.height);
if (c.showVerticalLine) {
c.shapeRenderer.draw(ctx, [[gridpos.x, 0], [gridpos.x, ctx.canvas.height]]);
}
if (c.showHorizontalLine) {
c.shapeRenderer.draw(ctx, [[0, gridpos.y], [ctx.canvas.width, gridpos.y]]);
}
var ret = getIntersectingPoints(plot, gridpos.x, gridpos.y);
if (c.showCursorLegend) {
var cells = $(plot.targetId + ' td.jqplot-cursor-legend-label');
for (var i=0; i<cells.length; i++) {
var idx = $(cells[i]).data('seriesIndex');
var series = plot.series[idx];
var label = series.label.toString();
var cellid = $.inArray(idx, ret.indices);
var sx = undefined;
var sy = undefined;
if (cellid != -1) {
var data = ret.data[cellid].data;
if (c.useAxesFormatters) {
var xf = series._xaxis._ticks[0].formatter;
var yf = series._yaxis._ticks[0].formatter;
var xfstr = series._xaxis._ticks[0].formatString;
var yfstr = series._yaxis._ticks[0].formatString;
sx = xf(xfstr, data[0]);
sy = yf(yfstr, data[1]);
}
else {
sx = data[0];
sy = data[1];
}
}
if (plot.legend.escapeHtml) {
$(cells[i]).text($.jqplot.sprintf(c.cursorLegendFormatString, label, sx, sy));
}
else {
$(cells[i]).html($.jqplot.sprintf(c.cursorLegendFormatString, label, sx, sy));
}
}
}
ctx = null;
}
function getIntersectingPoints(plot, x, y) {
var ret = {indices:[], data:[]};
var s, i, d0, d, j, r, p;
var threshold;
var c = plot.plugins.cursor;
for (var i=0; i<plot.series.length; i++) {
s = plot.series[i];
r = s.renderer;
if (s.show) {
threshold = c.intersectionThreshold;
if (s.showMarker) {
threshold += s.markerRenderer.size/2;
}
for (var j=0; j<s.gridData.length; j++) {
p = s.gridData[j];
// check vertical line
if (c.showVerticalLine) {
if (Math.abs(x-p[0]) <= threshold) {
ret.indices.push(i);
ret.data.push({seriesIndex: i, pointIndex:j, gridData:p, data:s.data[j]});
}
}
}
}
}
return ret;
}
function moveTooltip(gridpos, plot) {
var c = plot.plugins.cursor;
var elem = c._tooltipElem;
switch (c.tooltipLocation) {
case 'nw':
var x = gridpos.x + plot._gridPadding.left - elem.outerWidth(true) - c.tooltipOffset;
var y = gridpos.y + plot._gridPadding.top - c.tooltipOffset - elem.outerHeight(true);
break;
case 'n':
var x = gridpos.x + plot._gridPadding.left - elem.outerWidth(true)/2;
var y = gridpos.y + plot._gridPadding.top - c.tooltipOffset - elem.outerHeight(true);
break;
case 'ne':
var x = gridpos.x + plot._gridPadding.left + c.tooltipOffset;
var y = gridpos.y + plot._gridPadding.top - c.tooltipOffset - elem.outerHeight(true);
break;
case 'e':
var x = gridpos.x + plot._gridPadding.left + c.tooltipOffset;
var y = gridpos.y + plot._gridPadding.top - elem.outerHeight(true)/2;
break;
case 'se':
var x = gridpos.x + plot._gridPadding.left + c.tooltipOffset;
var y = gridpos.y + plot._gridPadding.top + c.tooltipOffset;
break;
case 's':
var x = gridpos.x + plot._gridPadding.left - elem.outerWidth(true)/2;
var y = gridpos.y + plot._gridPadding.top + c.tooltipOffset;
break;
case 'sw':
var x = gridpos.x + plot._gridPadding.left - elem.outerWidth(true) - c.tooltipOffset;
var y = gridpos.y + plot._gridPadding.top + c.tooltipOffset;
break;
case 'w':
var x = gridpos.x + plot._gridPadding.left - elem.outerWidth(true) - c.tooltipOffset;
var y = gridpos.y + plot._gridPadding.top - elem.outerHeight(true)/2;
break;
default:
var x = gridpos.x + plot._gridPadding.left + c.tooltipOffset;
var y = gridpos.y + plot._gridPadding.top + c.tooltipOffset;
break;
}
elem.css('left', x);
elem.css('top', y);
elem = null;
}
function positionTooltip(plot) {
// fake a grid for positioning
var grid = plot._gridPadding;
var c = plot.plugins.cursor;
var elem = c._tooltipElem;
switch (c.tooltipLocation) {
case 'nw':
var a = grid.left + c.tooltipOffset;
var b = grid.top + c.tooltipOffset;
elem.css('left', a);
elem.css('top', b);
break;
case 'n':
var a = (grid.left + (plot._plotDimensions.width - grid.right))/2 - elem.outerWidth(true)/2;
var b = grid.top + c.tooltipOffset;
elem.css('left', a);
elem.css('top', b);
break;
case 'ne':
var a = grid.right + c.tooltipOffset;
var b = grid.top + c.tooltipOffset;
elem.css({right:a, top:b});
break;
case 'e':
var a = grid.right + c.tooltipOffset;
var b = (grid.top + (plot._plotDimensions.height - grid.bottom))/2 - elem.outerHeight(true)/2;
elem.css({right:a, top:b});
break;
case 'se':
var a = grid.right + c.tooltipOffset;
var b = grid.bottom + c.tooltipOffset;
elem.css({right:a, bottom:b});
break;
case 's':
var a = (grid.left + (plot._plotDimensions.width - grid.right))/2 - elem.outerWidth(true)/2;
var b = grid.bottom + c.tooltipOffset;
elem.css({left:a, bottom:b});
break;
case 'sw':
var a = grid.left + c.tooltipOffset;
var b = grid.bottom + c.tooltipOffset;
elem.css({left:a, bottom:b});
break;
case 'w':
var a = grid.left + c.tooltipOffset;
var b = (grid.top + (plot._plotDimensions.height - grid.bottom))/2 - elem.outerHeight(true)/2;
elem.css({left:a, top:b});
break;
default: // same as 'se'
var a = grid.right - c.tooltipOffset;
var b = grid.bottom + c.tooltipOffset;
elem.css({right:a, bottom:b});
break;
}
elem = null;
}
function handleClick (ev, gridpos, datapos, neighbor, plot) {
ev.preventDefault();
ev.stopImmediatePropagation();
var c = plot.plugins.cursor;
if (c.clickReset) {
c.resetZoom(plot, c);
}
var sel = window.getSelection;
if (document.selection && document.selection.empty)
{
document.selection.empty();
}
else if (sel && !sel().isCollapsed) {
sel().collapse();
}
return false;
}
function handleDblClick (ev, gridpos, datapos, neighbor, plot) {
ev.preventDefault();
ev.stopImmediatePropagation();
var c = plot.plugins.cursor;
if (c.dblClickReset) {
c.resetZoom(plot, c);
}
var sel = window.getSelection;
if (document.selection && document.selection.empty)
{
document.selection.empty();
}
else if (sel && !sel().isCollapsed) {
sel().collapse();
}
return false;
}
function handleMouseLeave(ev, gridpos, datapos, neighbor, plot) {
var c = plot.plugins.cursor;
c.onGrid = false;
if (c.show) {
$(ev.target).css('cursor', c.previousCursor);
if (c.showTooltip && !(c._zoom.zooming && c.showTooltipOutsideZoom && !c.constrainOutsideZoom)) {
c._tooltipElem.empty();
c._tooltipElem.hide();
}
if (c.zoom) {
c._zoom.gridpos = gridpos;
c._zoom.datapos = datapos;
}
if (c.showVerticalLine || c.showHorizontalLine) {
var ctx = c.cursorCanvas._ctx;
ctx.clearRect(0,0,ctx.canvas.width, ctx.canvas.height);
ctx = null;
}
if (c.showCursorLegend) {
var cells = $(plot.targetId + ' td.jqplot-cursor-legend-label');
for (var i=0; i<cells.length; i++) {
var idx = $(cells[i]).data('seriesIndex');
var series = plot.series[idx];
var label = series.label.toString();
if (plot.legend.escapeHtml) {
$(cells[i]).text($.jqplot.sprintf(c.cursorLegendFormatString, label, undefined, undefined));
}
else {
$(cells[i]).html($.jqplot.sprintf(c.cursorLegendFormatString, label, undefined, undefined));
}
}
}
}
}
function handleMouseEnter(ev, gridpos, datapos, neighbor, plot) {
var c = plot.plugins.cursor;
c.onGrid = true;
if (c.show) {
c.previousCursor = ev.target.style.cursor;
ev.target.style.cursor = c.style;
if (c.showTooltip) {
updateTooltip(gridpos, datapos, plot);
if (c.followMouse) {
moveTooltip(gridpos, plot);
}
else {
positionTooltip(plot);
}
c._tooltipElem.show();
}
if (c.showVerticalLine || c.showHorizontalLine) {
moveLine(gridpos, plot);
}
}
}
function handleMouseMove(ev, gridpos, datapos, neighbor, plot) {
var c = plot.plugins.cursor;
if (c.show) {
if (c.showTooltip) {
updateTooltip(gridpos, datapos, plot);
if (c.followMouse) {
moveTooltip(gridpos, plot);
}
}
if (c.showVerticalLine || c.showHorizontalLine) {
moveLine(gridpos, plot);
}
}
}
function getEventPosition(ev) {
var plot = ev.data.plot;
var go = plot.eventCanvas._elem.offset();
var gridPos = {x:ev.pageX - go.left, y:ev.pageY - go.top};
//////
// TO DO: handle yMidAxis
//////
var dataPos = {xaxis:null, yaxis:null, x2axis:null, y2axis:null, y3axis:null, y4axis:null, y5axis:null, y6axis:null, y7axis:null, y8axis:null, y9axis:null, yMidAxis:null};
var an = ['xaxis', 'yaxis', 'x2axis', 'y2axis', 'y3axis', 'y4axis', 'y5axis', 'y6axis', 'y7axis', 'y8axis', 'y9axis', 'yMidAxis'];
var ax = plot.axes;
var n, axis;
for (n=11; n>0; n--) {
axis = an[n-1];
if (ax[axis].show) {
dataPos[axis] = ax[axis].series_p2u(gridPos[axis.charAt(0)]);
}
}
return {offsets:go, gridPos:gridPos, dataPos:dataPos};
}
function handleZoomMove(ev) {
var plot = ev.data.plot;
var c = plot.plugins.cursor;
// don't do anything if not on grid.
if (c.show && c.zoom && c._zoom.started && !c.zoomTarget) {
ev.preventDefault();
var ctx = c.zoomCanvas._ctx;
var positions = getEventPosition(ev);
var gridpos = positions.gridPos;
var datapos = positions.dataPos;
c._zoom.gridpos = gridpos;
c._zoom.datapos = datapos;
c._zoom.zooming = true;
var xpos = gridpos.x;
var ypos = gridpos.y;
var height = ctx.canvas.height;
var width = ctx.canvas.width;
if (c.showTooltip && !c.onGrid && c.showTooltipOutsideZoom) {
updateTooltip(gridpos, datapos, plot);
if (c.followMouse) {
moveTooltip(gridpos, plot);
}
}
if (c.constrainZoomTo == 'x') {
c._zoom.end = [xpos, height];
}
else if (c.constrainZoomTo == 'y') {
c._zoom.end = [width, ypos];
}
else {
c._zoom.end = [xpos, ypos];
}
var sel = window.getSelection;
if (document.selection && document.selection.empty)
{
document.selection.empty();
}
else if (sel && !sel().isCollapsed) {
sel().collapse();
}
drawZoomBox.call(c);
ctx = null;
}
}
function handleMouseDown(ev, gridpos, datapos, neighbor, plot) {
var c = plot.plugins.cursor;
if(plot.plugins.mobile){
$(document).one('vmouseup.jqplot_cursor', {plot:plot}, handleMouseUp);
} else {
$(document).one('mouseup.jqplot_cursor', {plot:plot}, handleMouseUp);
}
var axes = plot.axes;
if (document.onselectstart != undefined) {
c._oldHandlers.onselectstart = document.onselectstart;
document.onselectstart = function () { return false; };
}
if (document.ondrag != undefined) {
c._oldHandlers.ondrag = document.ondrag;
document.ondrag = function () { return false; };
}
if (document.onmousedown != undefined) {
c._oldHandlers.onmousedown = document.onmousedown;
document.onmousedown = function () { return false; };
}
if (c.zoom) {
if (!c.zoomProxy) {
var ctx = c.zoomCanvas._ctx;
ctx.clearRect(0,0,ctx.canvas.width, ctx.canvas.height);
ctx = null;
}
if (c.constrainZoomTo == 'x') {
c._zoom.start = [gridpos.x, 0];
}
else if (c.constrainZoomTo == 'y') {
c._zoom.start = [0, gridpos.y];
}
else {
c._zoom.start = [gridpos.x, gridpos.y];
}
c._zoom.started = true;
for (var ax in datapos) {
// get zoom starting position.
c._zoom.axes.start[ax] = datapos[ax];
}
if(plot.plugins.mobile){
$(document).bind('vmousemove.jqplotCursor', {plot:plot}, handleZoomMove);
} else {
$(document).bind('mousemove.jqplotCursor', {plot:plot}, handleZoomMove);
}
}
}
function handleMouseUp(ev) {
var plot = ev.data.plot;
var c = plot.plugins.cursor;
if (c.zoom && c._zoom.zooming && !c.zoomTarget) {
var xpos = c._zoom.gridpos.x;
var ypos = c._zoom.gridpos.y;
var datapos = c._zoom.datapos;
var height = c.zoomCanvas._ctx.canvas.height;
var width = c.zoomCanvas._ctx.canvas.width;
var axes = plot.axes;
if (c.constrainOutsideZoom && !c.onGrid) {
if (xpos < 0) { xpos = 0; }
else if (xpos > width) { xpos = width; }
if (ypos < 0) { ypos = 0; }
else if (ypos > height) { ypos = height; }
for (var axis in datapos) {
if (datapos[axis]) {
if (axis.charAt(0) == 'x') {
datapos[axis] = axes[axis].series_p2u(xpos);
}
else {
datapos[axis] = axes[axis].series_p2u(ypos);
}
}
}
}
if (c.constrainZoomTo == 'x') {
ypos = height;
}
else if (c.constrainZoomTo == 'y') {
xpos = width;
}
c._zoom.end = [xpos, ypos];
c._zoom.gridpos = {x:xpos, y:ypos};
c.doZoom(c._zoom.gridpos, datapos, plot, c);
}
c._zoom.started = false;
c._zoom.zooming = false;
$(document).unbind('mousemove.jqplotCursor', handleZoomMove);
if (document.onselectstart != undefined && c._oldHandlers.onselectstart != null){
document.onselectstart = c._oldHandlers.onselectstart;
c._oldHandlers.onselectstart = null;
}
if (document.ondrag != undefined && c._oldHandlers.ondrag != null){
document.ondrag = c._oldHandlers.ondrag;
c._oldHandlers.ondrag = null;
}
if (document.onmousedown != undefined && c._oldHandlers.onmousedown != null){
document.onmousedown = c._oldHandlers.onmousedown;
c._oldHandlers.onmousedown = null;
}
}
function drawZoomBox() {
var start = this._zoom.start;
var end = this._zoom.end;
var ctx = this.zoomCanvas._ctx;
var l, t, h, w;
if (end[0] > start[0]) {
l = start[0];
w = end[0] - start[0];
}
else {
l = end[0];
w = start[0] - end[0];
}
if (end[1] > start[1]) {
t = start[1];
h = end[1] - start[1];
}
else {
t = end[1];
h = start[1] - end[1];
}
ctx.fillStyle = 'rgba(0,0,0,0.2)';
ctx.strokeStyle = '#999999';
ctx.lineWidth = 1.0;
ctx.clearRect(0,0,ctx.canvas.width, ctx.canvas.height);
ctx.fillRect(0,0,ctx.canvas.width, ctx.canvas.height);
ctx.clearRect(l, t, w, h);
// IE won't show transparent fill rect, so stroke a rect also.
ctx.strokeRect(l,t,w,h);
ctx = null;
}
$.jqplot.CursorLegendRenderer = function(options) {
$.jqplot.TableLegendRenderer.call(this, options);
this.formatString = '%s';
};
$.jqplot.CursorLegendRenderer.prototype = new $.jqplot.TableLegendRenderer();
$.jqplot.CursorLegendRenderer.prototype.constructor = $.jqplot.CursorLegendRenderer;
// called in context of a Legend
$.jqplot.CursorLegendRenderer.prototype.draw = function() {
if (this._elem) {
this._elem.emptyForce();
this._elem = null;
}
if (this.show) {
var series = this._series, s;
// make a table. one line label per row.
var elem = document.createElement('div');
this._elem = $(elem);
elem = null;
this._elem.addClass('jqplot-legend jqplot-cursor-legend');
this._elem.css('position', 'absolute');
var pad = false;
for (var i = 0; i< series.length; i++) {
s = series[i];
if (s.show && s.showLabel) {
var lt = $.jqplot.sprintf(this.formatString, s.label.toString());
if (lt) {
var color = s.color;
if (s._stack && !s.fill) {
color = '';
}
addrow.call(this, lt, color, pad, i);
pad = true;
}
// let plugins add more rows to legend. Used by trend line plugin.
for (var j=0; j<$.jqplot.addLegendRowHooks.length; j++) {
var item = $.jqplot.addLegendRowHooks[j].call(this, s);
if (item) {
addrow.call(this, item.label, item.color, pad);
pad = true;
}
}
}
}
series = s = null;
delete series;
delete s;
}
function addrow(label, color, pad, idx) {
var rs = (pad) ? this.rowSpacing : '0';
var tr = $('<tr class="jqplot-legend jqplot-cursor-legend"></tr>').appendTo(this._elem);
tr.data('seriesIndex', idx);
$('<td class="jqplot-legend jqplot-cursor-legend-swatch" style="padding-top:'+rs+';">'+
'<div style="border:1px solid #cccccc;padding:0.2em;">'+
'<div class="jqplot-cursor-legend-swatch" style="background-color:'+color+';"></div>'+
'</div></td>').appendTo(tr);
var td = $('<td class="jqplot-legend jqplot-cursor-legend-label" style="vertical-align:middle;padding-top:'+rs+';"></td>');
td.appendTo(tr);
td.data('seriesIndex', idx);
if (this.escapeHtml) {
td.text(label);
}
else {
td.html(label);
}
tr = null;
td = null;
}
return this._elem;
};
})(jQuery);
|
// SpryDOMUtils.js - version 0.13 - Spry Pre-Release 1.7
//
// Copyright (c) 2007. Adobe Systems Incorporated.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
// * Neither the name of Adobe Systems Incorporated nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
(function() { // BeginSpryComponent
if (typeof Spry == "undefined") window.Spry = {}; if (!Spry.Utils) Spry.Utils = {};
//////////////////////////////////////////////////////////////////////
//
// Define Prototype's $() convenience function, but make sure it is
// namespaced under Spry so that we avoid collisions with other
// toolkits.
//
//////////////////////////////////////////////////////////////////////
Spry.$ = function(element)
{
if (arguments.length > 1)
{
for (var i = 0, elements = [], length = arguments.length; i < length; i++)
elements.push(Spry.$(arguments[i]));
return elements;
}
if (typeof element == 'string')
element = document.getElementById(element);
return element;
};
//////////////////////////////////////////////////////////////////////
//
// DOM Utils
//
//////////////////////////////////////////////////////////////////////
Spry.Utils.getAttribute = function(ele, name)
{
ele = Spry.$(ele);
if (!ele || !name)
return null;
// We need to wrap getAttribute with a try/catch because IE will throw
// an exception if you call it with a namespace prefixed attribute name
// that doesn't exist.
try { var value = ele.getAttribute(name); }
catch (e) { value == undefined; }
// XXX: Workaround for Safari 2.x and earlier:
//
// If value is undefined, the attribute didn't exist. Check to see if this is
// a namespace prefixed attribute name. If it is, remove the ':' from the name
// and try again. This allows us to support spry attributes of the form
// "spry:region" and "spryregion".
if (value == undefined && name.search(/:/) != -1)
{
try { var value = ele.getAttribute(name.replace(/:/, "")); }
catch (e) { value == undefined; }
}
return value;
};
Spry.Utils.setAttribute = function(ele, name, value)
{
ele = Spry.$(ele);
if (!ele || !name)
return;
// IE doesn't allow you to set the "class" attribute. You
// have to set the className property instead.
if (name == "class")
ele.className = value;
else
{
// I'm probably being a bit paranoid, but given the fact that
// getAttribute() throws exceptions when dealing with namespace
// prefixed attributes, I'm going to wrap this setAttribute()
// call with try/catch just in case ...
try { ele.setAttribute(name, value); } catch(e) {}
// XXX: Workaround for Safari 2.x and earlier:
//
// If this is a namespace prefixed attribute, check to make
// sure an attribute was created. This is necessary because some
// older versions of Safari (2.x and earlier) drop the namespace
// prefixes. If the attribute was munged, try removing the ':'
// character from the attribute name and setting the attribute
// using the resulting name. The idea here is that even if we
// remove the ':' character, Spry.Utils.getAttribute() will still
// find the attribute.
if (name.search(/:/) != -1 && ele.getAttribute(name) == undefined)
ele.setAttribute(name.replace(/:/, ""), value);
}
};
Spry.Utils.removeAttribute = function(ele, name)
{
ele = Spry.$(ele);
if (!ele || !name)
return;
try { ele.removeAttribute(name); } catch(e) {}
// XXX: Workaround for Safari 2.x and earlier:
//
// If this is a namespace prefixed attribute, make sure we
// also remove any attributes with the same name, but without
// the ':' character.
if (name.search(/:/) != -1)
ele.removeAttribute(name.replace(/:/, ""));
// XXX: Workaround for IE
//
// IE doesn't allow you to remove the "class" attribute.
// It requires you to remove "className" instead, so go
// ahead and try to remove that too.
if (name == "class")
ele.removeAttribute("className");
};
Spry.Utils.addClassName = function(ele, className)
{
ele = Spry.$(ele);
if (!ele || !className || (ele.className && ele.className.search(new RegExp("\\b" + className + "\\b")) != -1))
return;
ele.className += (ele.className ? " " : "") + className;
};
Spry.Utils.removeClassName = function(ele, className)
{
ele = Spry.$(ele);
if (Spry.Utils.hasClassName(ele, className))
ele.className = ele.className.replace(new RegExp("\\s*\\b" + className + "\\b", "g"), "");
};
Spry.Utils.toggleClassName = function(ele, className)
{
if (Spry.Utils.hasClassName(ele, className))
Spry.Utils.removeClassName(ele, className);
else
Spry.Utils.addClassName(ele, className);
};
Spry.Utils.hasClassName = function(ele, className)
{
ele = Spry.$(ele);
if (!ele || !className || !ele.className || ele.className.search(new RegExp("\\b" + className + "\\b")) == -1)
return false;
return true;
};
Spry.Utils.camelizeString = function(str)
{
var cStr = "";
var a = str.split("-");
for (var i = 0; i < a.length; i++)
{
var s = a[i];
if (s)
cStr = cStr ? (cStr + s.charAt(0).toUpperCase() + s.substring(1)) : s;
}
return cStr;
};
Spry.Utils.styleStringToObject = function(styleStr)
{
var o = {};
if (styleStr)
{
var pvA = styleStr.split(";");
for (var i = 0; i < pvA.length; i++)
{
var pv = pvA[i];
if (pv && pv.indexOf(":") != -1)
{
var nvA = pv.split(":");
var n = nvA[0].replace(/^\s*|\s*$/g, "");
var v = nvA[1].replace(/^\s*|\s*$/g, "");
if (n && v)
o[Spry.Utils.camelizeString(n)] = v;
}
}
}
return o;
};
Spry.Utils.addEventListener = function(element, eventType, handler, capture)
{
try
{
if (!Spry.Utils.eventListenerIsBoundToElement(element, eventType, handler, capture))
{
element = Spry.$(element);
handler = Spry.Utils.bindEventListenerToElement(element, eventType, handler, capture);
if (element.addEventListener)
element.addEventListener(eventType, handler, capture);
else if (element.attachEvent)
element.attachEvent("on" + eventType, handler);
}
}
catch (e) {}
};
Spry.Utils.removeEventListener = function(element, eventType, handler, capture)
{
try
{
element = Spry.$(element);
handler = Spry.Utils.unbindEventListenerFromElement(element, eventType, handler, capture);
if (element.removeEventListener)
element.removeEventListener(eventType, handler, capture);
else if (element.detachEvent)
element.detachEvent("on" + eventType, handler);
}
catch (e) {}
};
Spry.Utils.eventListenerHash = {};
Spry.Utils.nextEventListenerID = 1;
Spry.Utils.getHashForElementAndHandler = function(element, eventType, handler, capture)
{
var hash = null;
element = Spry.$(element);
if (element)
{
if (typeof element.spryEventListenerID == "undefined")
element.spryEventListenerID = "e" + (Spry.Utils.nextEventListenerID++);
if (typeof handler.spryEventHandlerID == "undefined")
handler.spryEventHandlerID = "h" + (Spry.Utils.nextEventListenerID++);
hash = element.spryEventListenerID + "-" + handler.spryEventHandlerID + "-" + eventType + (capture?"-capture":"");
}
return hash;
};
Spry.Utils.eventListenerIsBoundToElement = function(element, eventType, handler, capture)
{
element = Spry.$(element);
var hash = Spry.Utils.getHashForElementAndHandler(element, eventType, handler, capture);
return Spry.Utils.eventListenerHash[hash] != undefined;
};
Spry.Utils.bindEventListenerToElement = function(element, eventType, handler, capture)
{
element = Spry.$(element);
var hash = Spry.Utils.getHashForElementAndHandler(element, eventType, handler, capture);
if (Spry.Utils.eventListenerHash[hash])
return Spry.Utils.eventListenerHash[hash];
return Spry.Utils.eventListenerHash[hash] = function(e)
{
e = e || window.event;
if (!e.preventDefault) e.preventDefault = function() { this.returnValue = false; };
if (!e.stopPropagation) e.stopPropagation = function() { this.cancelBubble = true; };
var result = handler.call(element, e);
if (result == false)
{
e.preventDefault();
e.stopPropagation();
}
return result;
};
};
Spry.Utils.unbindEventListenerFromElement = function(element, eventType, handler, capture)
{
element = Spry.$(element);
var hash = Spry.Utils.getHashForElementAndHandler(element, eventType, handler, capture);
if (Spry.Utils.eventListenerHash[hash])
{
handler = Spry.Utils.eventListenerHash[hash];
Spry.Utils.eventListenerHash[hash] = undefined;
}
return handler;
};
Spry.Utils.cancelEvent = function(e)
{
if (e.preventDefault) e.preventDefault();
else e.returnValue = false;
if (e.stopPropagation) e.stopPropagation();
else e.cancelBubble = true;
return false;
};
Spry.Utils.addLoadListener = function(handler)
{
if (typeof window.addEventListener != 'undefined')
window.addEventListener('load', handler, false);
else if (typeof document.addEventListener != 'undefined')
document.addEventListener('load', handler, false);
else if (typeof window.attachEvent != 'undefined')
window.attachEvent('onload', handler);
};
Spry.Utils.isDescendant = function(parent, child)
{
if (parent && child)
{
child = child.parentNode;
while (child)
{
if (parent == child)
return true;
child = child.parentNode;
}
}
return false;
};
Spry.Utils.getAncestor = function(ele, selector)
{
ele = Spry.$(ele);
if (ele)
{
var s = Spry.$$.tokenizeSequence(selector ? selector : "*")[0];
var t = s ? s[0] : null;
if (t)
{
var p = ele.parentNode;
while (p)
{
if (t.match(p))
return p;
p = p.parentNode;
}
}
}
return null;
};
//////////////////////////////////////////////////////////////////////
//
// CSS Selector Matching
//
//////////////////////////////////////////////////////////////////////
Spry.$$ = function(selectorSequence, rootNode)
{
var matches = [];
Spry.$$.addExtensions(matches);
// If the first argument to $$() is an object, it
// is assumed that all args are either a DOM element
// or an array of DOM elements, in which case we
// simply append all DOM elements to our special
// matches array and return immediately.
if (typeof arguments[0] == "object")
{
for (var i = 0; i < arguments.length; i++)
{
if (arguments[i].constructor == Array)
matches.push.apply(matches, arguments[i]);
else
matches.push(arguments[i]);
}
return matches;
}
if (!rootNode)
rootNode = document;
else
rootNode = Spry.$(rootNode);
var sequences = Spry.$$.tokenizeSequence(selectorSequence);
++Spry.$$.queryID;
var nid = 0;
var ns = sequences.length;
for (var i = 0; i < ns; i++)
{
var m = Spry.$$.processTokens(sequences[i], rootNode);
var nm = m.length;
for (var j = 0; j < nm; j++)
{
var n = m[j];
if (!n.spry$$ID)
{
n.spry$$ID = ++nid;
matches.push(n);
}
}
}
var nm = matches.length;
for (i = 0; i < nm; i++)
matches[i].spry$$ID = undefined;
return matches;
};
Spry.$$.cache = {};
Spry.$$.queryID = 0;
Spry.$$.Token = function()
{
this.type = Spry.$$.Token.SELECTOR;
this.name = "*";
this.id = "";
this.classes = [];
this.attrs = [];
this.pseudos = [];
};
Spry.$$.Token.Attr = function(n, v)
{
this.name = n;
this.value = v ? new RegExp(v) : undefined;
};
Spry.$$.Token.PseudoClass = function(pstr)
{
this.name = pstr.replace(/\(.*/, "");
this.arg = pstr.replace(/^[^\(\)]*\(?\s*|\)\s*$/g, "");
this.func = Spry.$$.pseudoFuncs[this.name];
};
Spry.$$.Token.SELECTOR = 0;
Spry.$$.Token.COMBINATOR = 1;
Spry.$$.Token.prototype.match = function(ele, nameAlreadyMatches)
{
if (this.type == Spry.$$.Token.COMBINATOR)
return false;
if (!nameAlreadyMatches && this.name != '*' && this.name != ele.nodeName.toLowerCase())
return false;
if (this.id && this.id != ele.id)
return false;
var classes = this.classes;
var len = classes.length;
for (var i = 0; i < len; i++)
{
if (!ele.className || !classes[i].value.test(ele.className))
return false;
}
var attrs = this.attrs;
len = attrs.length;
for (var i = 0; i < len; i++)
{
var a = attrs[i];
var an = ele.attributes.getNamedItem(a.name);
if (!an || (!a.value && an.nodeValue == undefined) || (a.value && !a.value.test(an.nodeValue)))
return false;
}
var ps = this.pseudos;
var len = ps.length;
for (var i = 0; i < len; i++)
{
var p = ps[i];
if (p && p.func && !p.func(p.arg, ele, this))
return false;
}
return true;
};
Spry.$$.Token.prototype.getNodeNameIfTypeMatches = function(ele)
{
var nodeName = ele.nodeName.toLowerCase();
if (this.name != '*')
{
if (this.name != nodeName)
return null;
return this.name;
}
return nodeName;
};
Spry.$$.escapeRegExpCharsRE = /\/|\.|\*|\+|\(|\)|\[|\]|\{|\}|\\|\|/g;
Spry.$$.tokenizeSequence = function(s)
{
var cc = Spry.$$.cache[s];
if (cc) return cc;
// Attribute Selector: /(\[[^\"'~\^\$\*\|\]=]+([~\^\$\*\|]?=\s*('[^']*'|"[^"]*"|[^"'\]]+))?\s*\])/g
// Simple Selector: /((:[^\.#:\s,>~\+\[\]]+\(([^\(\)]+|\([^\(\)]*\))*\))|[\.#:]?[^\.#:\s,>~\+\[\]]+)/g
// Combinator: /(\s*[\s,>~\+]\s*)/g
var tokenExpr = /(\[[^\"'~\^\$\*\|\]=]+([~\^\$\*\|]?=\s*('[^']*'|"[^"]*"|[^"'\]]+))?\s*\])|((:[^\.#:\s,>~\+\[\]]+\(([^\(\)]+|\([^\(\)]*\))*\))|[\.#:]?[^\.#:\s,>~\+\[\]]+)|(\s*[\s,>~\+]\s*)/g;
var tkn = new Spry.$$.Token;
var sequence = [];
sequence.push(tkn);
var tokenSequences = [];
tokenSequences.push(sequence);
s = s.replace(/^\s*|\s*$/, "");
var expMatch = tokenExpr.exec(s);
while (expMatch)
{
var tstr = expMatch[0];
var c = tstr.charAt(0);
switch (c)
{
case '.':
tkn.classes.push(new Spry.$$.Token.Attr("class", "\\b" + tstr.substr(1) + "\\b"));
break;
case '#':
tkn.id = tstr.substr(1);
break;
case ':':
tkn.pseudos.push(new Spry.$$.Token.PseudoClass(tstr));
break;
case '[':
var attrComps = tstr.match(/\[([^\"'~\^\$\*\|\]=]+)(([~\^\$\*\|]?=)\s*('[^']*'|"[^"]*"|[^"'\]]+))?\s*\]/);
var name = attrComps[1];
var matchType = attrComps[3];
var val = attrComps[4];
if (val)
{
val = val.replace(/^['"]|['"]$/g, "");
val = val.replace(Spry.$$.escapeRegExpCharsRE, '\\$&');
}
var matchStr = undefined;
switch(matchType)
{
case "=":
matchStr = "^" + val + "$";
break;
case "^=":
matchStr = "^" + val;
break;
case "$=":
matchStr = val + "$";
break;
case "~=":
case "|=":
matchStr = "\\b" + val + "\\b";
break;
case "*=":
matchStr = val;
break;
}
tkn.attrs.push(new Spry.$$.Token.Attr(name, matchStr));
break;
default:
var combiMatch = tstr.match(/^\s*([\s,~>\+])\s*$/);
if (combiMatch)
{
if (combiMatch[1] == ',')
{
sequence = new Array;
tokenSequences.push(sequence);
tkn = new Spry.$$.Token;
sequence.push(tkn);
}
else
{
tkn = new Spry.$$.Token;
tkn.type = Spry.$$.Token.COMBINATOR;
tkn.name = combiMatch[1];
sequence.push(tkn);
tkn = new Spry.$$.Token();
sequence.push(tkn);
}
}
else
tkn.name = tstr.toLowerCase();
break;
}
expMatch = tokenExpr.exec(s);
}
Spry.$$.cache[s] = tokenSequences;
return tokenSequences;
};
Spry.$$.combinatorFuncs = {
// Element Descendant
" ": function(nodes, token)
{
var uid = ++Spry.$$.uniqueID;
var results = [];
var nn = nodes.length;
for (var i = 0; i < nn; i++)
{
var n = nodes[i];
if (uid != n.spry$$uid)
{
// n.spry$$uid = uid;
var ea = nodes[i].getElementsByTagName(token.name);
var ne = ea.length;
for (var j = 0; j < ne; j++)
{
var e = ea[j];
// If the token matches, add it to our results. We have
// to make sure e is an element because IE6 returns the DOCTYPE
// tag as a comment when '*' is used in the call to getElementsByTagName().
if (e.nodeType == 1 /* Node.ELEMENT_NODE */ && token.match(e, true))
results.push(e);
e.spry$$uid = uid;
}
}
}
return results;
},
// Element Child
">": function(nodes, token)
{
var results = [];
var nn = nodes.length;
for (var i = 0; i < nn; i++)
{
var n = nodes[i].firstChild;
while (n)
{
if (n.nodeType == 1 /* Node.ELEMENT_NODE */ && token.match(n))
results.push(n);
n = n.nextSibling;
}
}
return results;
},
// Element Immediately Preceded By
"+": function(nodes, token)
{
var results = [];
var nn = nodes.length;
for (var i = 0; i < nn; i++)
{
var n = nodes[i].nextSibling;
while (n && n.nodeType != 1 /* Node.ELEMENT_NODE */)
n = n.nextSibling;
if (n && token.match(n))
results.push(n);
}
return results;
},
// Element Preceded By
"~": function(nodes, token)
{
var uid = ++Spry.$$.uniqueID;
var results = [];
var nn = nodes.length;
for (var i = 0; i < nn; i++)
{
var n = nodes[i].nextSibling;
while (n)
{
if (n.nodeType == 1 /* Node.ELEMENT_NODE */)
{
if (uid == n.spry$$uid)
break;
if (token.match(n))
{
results.push(n);
n.spry$$uid = uid;
}
}
n = n.nextSibling;
}
}
return results;
}
};
Spry.$$.uniqueID = 0;
Spry.$$.pseudoFuncs = {
":first-child": function(arg, node, token)
{
var n = node.previousSibling;
while (n)
{
if (n.nodeType == 1) return false; // Node.ELEMENT_NODE
n = n.previousSibling;
}
return true;
},
":last-child": function(arg, node, token)
{
var n = node.nextSibling;
while (n)
{
if (n.nodeType == 1) // Node.ELEMENT_NODE
return false;
n = n.nextSibling;
}
return true;
},
":empty": function(arg, node, token)
{
var n = node.firstChild;
while (n)
{
switch(n.nodeType)
{
case 1: // Node.ELEMENT_NODE
case 3: // Node.TEXT_NODE
case 4: // Node.CDATA_NODE
case 5: // Node.ENTITY_REFERENCE_NODE
return false;
}
n = n.nextSibling;
}
return true;
},
":nth-child": function(arg, node, token)
{
return Spry.$$.nthChild(arg, node, token);
},
":nth-last-child": function(arg, node, token)
{
return Spry.$$.nthChild(arg, node, token, true);
},
":nth-of-type": function(arg, node, token)
{
return Spry.$$.nthChild(arg, node, token, false, true);
},
":nth-last-of-type": function(arg, node, token)
{
return Spry.$$.nthChild(arg, node, token, true, true);
},
":first-of-type": function(arg, node, token)
{
var nodeName = token.getNodeNameIfTypeMatches(node);
if (!nodeName) return false;
var n = node.previousSibling;
while (n)
{
if (n.nodeType == 1 && nodeName == n.nodeName.toLowerCase()) return false; // Node.ELEMENT_NODE
n = n.previousSibling;
}
return true;
},
":last-of-type": function(arg, node, token)
{
var nodeName = token.getNodeNameIfTypeMatches(node);
if (!nodeName) return false;
var n = node.nextSibling;
while (n)
{
if (n.nodeType == 1 && nodeName == n.nodeName.toLowerCase()) // Node.ELEMENT_NODE
return false;
n = n.nextSibling;
}
return true;
},
":only-child": function(arg, node, token)
{
var f = Spry.$$.pseudoFuncs;
return f[":first-child"](arg, node, token) && f[":last-child"](arg, node, token);
},
":only-of-type": function(arg, node, token)
{
var f = Spry.$$.pseudoFuncs;
return f[":first-of-type"](arg, node, token) && f[":last-of-type"](arg, node, token);
},
":not": function(arg, node, token)
{
var s = Spry.$$.tokenizeSequence(arg)[0];
var t = s ? s[0] : null;
return !t || !t.match(node);
},
":enabled": function(arg, node, token)
{
return !node.disabled;
},
":disabled": function(arg, node, token)
{
return node.disabled;
},
":checked": function(arg, node, token)
{
return node.checked;
},
":root": function(arg, node, token)
{
return node.parentNode && node.ownerDocument && node.parentNode == node.ownerDocument;
}
};
Spry.$$.nthRegExp = /((-|[0-9]+)?n)?([+-]?[0-9]*)/;
Spry.$$.nthCache = {
"even": { a: 2, b: 0, mode: 1, invalid: false }
, "odd": { a: 2, b: 1, mode: 1, invalid: false }
, "2n": { a: 2, b: 0, mode: 1, invalid: false }
, "2n+1": { a: 2, b: 1, mode: 1, invalid: false }
};
Spry.$$.parseNthChildString = function(str)
{
var o = Spry.$$.nthCache[str];
if (!o)
{
var m = str.match(Spry.$$.nthRegExp);
var n = m[1];
var a = m[2];
var b = m[3];
if (!a)
{
// An 'a' value was not specified. Was there an 'n' present?
// If so, we treat it as an increment of 1, otherwise we're
// in no-repeat mode.
a = n ? 1 : 0;
}
else if (a == "-")
{
// The string is using the "-n" short-hand which is
// short for -1.
a = -1;
}
else
{
// An integer repeat value for 'a' was specified. Convert
// it into number.
a = parseInt(a, 10);
}
// If a 'b' value was specified, turn it into a number.
// If no 'b' value was specified, default to zero.
b = b ? parseInt(b, 10) : 0;
// Figure out the mode:
//
// -1 - repeat backwards
// 0 - no repeat
// 1 - repeat forwards
var mode = (a == 0) ? 0 : ((a > 0) ? 1 : -1);
var invalid = false;
// Fix up 'a' and 'b' for proper repeating.
if (a > 0 && b < 0)
{
b = b % a;
b = ((b=(b%a)) < 0) ? a + b : b;
}
else if (a < 0)
{
if (b < 0)
invalid = true;
else
a = Math.abs(a);
}
o = new Object;
o.a = a;
o.b = b;
o.mode = mode;
o.invalid = invalid;
Spry.$$.nthCache[str] = o;
}
return o;
};
Spry.$$.nthChild = function(arg, node, token, fromLastSib, matchNodeName)
{
if (matchNodeName)
{
var nodeName = token.getNodeNameIfTypeMatches(node);
if (!nodeName) return false;
}
var o = Spry.$$.parseNthChildString(arg);
if (o.invalid)
return false;
var qidProp = "spry$$ncQueryID";
var posProp = "spry$$ncPos";
var countProp = "spry$$ncCount";
if (matchNodeName)
{
qidProp += nodeName;
posProp += nodeName;
countProp += nodeName;
}
var parent = node.parentNode;
if (parent[qidProp] != Spry.$$.queryID)
{
var pos = 0;
parent[qidProp] = Spry.$$.queryID;
var c = parent.firstChild;
while (c)
{
if (c.nodeType == 1 && (!matchNodeName || nodeName == c.nodeName.toLowerCase()))
c[posProp] = ++pos;
c = c.nextSibling;
}
parent[countProp] = pos;
}
pos = node[posProp];
if (fromLastSib)
pos = parent[countProp] - pos + 1;
/*
var sib = fromLastSib ? "nextSibling" : "previousSibling";
var pos = 1;
var n = node[sib];
while (n)
{
if (n.nodeType == 1 && (!matchNodeName || nodeName == n.nodeName.toLowerCase()))
{
if (n == node) break;
++pos;
}
n = n[sib];
}
*/
if (o.mode == 0) // Exact match
return pos == o.b;
if (o.mode > 0) // Forward Repeat
return (pos < o.b) ? false : (!((pos - o.b) % o.a));
return (pos > o.b) ? false : (!((o.b - pos) % o.a)); // Backward Repeat
};
Spry.$$.processTokens = function(tokens, root)
{
var numTokens = tokens.length;
var nodeSet = [ root ];
var combiFunc = null;
for (var i = 0; i < numTokens && nodeSet.length > 0; i++)
{
var t = tokens[i];
if (t.type == Spry.$$.Token.SELECTOR)
{
if (combiFunc)
{
nodeSet = combiFunc(nodeSet, t);
combiFunc = null;
}
else
nodeSet = Spry.$$.getMatchingElements(nodeSet, t);
}
else // Spry.$$.Token.COMBINATOR
combiFunc = Spry.$$.combinatorFuncs[t.name];
}
return nodeSet;
};
Spry.$$.getMatchingElements = function(nodes, token)
{
var results = [];
if (token.id)
{
n = nodes[0];
if (n && n.ownerDocument)
{
var e = n.ownerDocument.getElementById(token.id);
if (e)
{
// XXX: We need to make sure that the element
// we found is actually underneath the root
// we were given!
if (token.match(e))
results.push(e);
}
return results;
}
}
var nn = nodes.length;
for (var i = 0; i < nn; i++)
{
var n = nodes[i];
// if (token.match(n)) results.push(n);
var ea = n.getElementsByTagName(token.name);
var ne = ea.length;
for (var j = 0; j < ne; j++)
{
var e = ea[j];
// If the token matches, add it to our results. We have
// to make sure e is an element because IE6 returns the DOCTYPE
// tag as a comment when '*' is used in the call to getElementsByTagName().
if (e.nodeType == 1 /* Node.ELEMENT_NODE */ && token.match(e, true))
results.push(e);
}
}
return results;
};
/*
Spry.$$.dumpSequences = function(sequences)
{
Spry.Debug.trace("<hr />Number of Sequences: " + sequences.length);
for (var i = 0; i < sequences.length; i++)
{
var str = "";
var s = sequences[i];
Spry.Debug.trace("<hr />Sequence " + i + " -- Tokens: " + s.length);
for (var j = 0; j < s.length; j++)
{
var t = s[j];
if (t.type == Spry.$$.Token.SELECTOR)
{
str += " SELECTOR:\n Name: " + t.name + "\n ID: " + t.id + "\n Attrs:\n";
for (var k = 0; k < t.classes.length; k++)
str += " " + t.classes[k].name + ": " + t.classes[k].value + "\n";
for (var k = 0; k < t.attrs.length; k++)
str += " " + t.attrs[k].name + ": " + t.attrs[k].value + "\n";
str += " Pseudos:\n";
for (var k = 0; k < t.pseudos.length; k++)
str += " " + t.pseudos[k].name + (t.pseudos[k].arg ? "(" + t.pseudos[k].arg + ")" : "") + "\n";
}
else
{
str += " COMBINATOR:\n Name: '" + t.name + "'\n";
}
}
Spry.Debug.trace("<pre>" + Spry.Utils.encodeEntities(str) + "</pre>");
}
};
*/
Spry.$$.addExtensions = function(a)
{
for (var f in Spry.$$.Results)
a[f] = Spry.$$.Results[f];
};
Spry.$$.Results = {};
Spry.$$.Results.forEach = function(func)
{
var n = this.length;
for (var i = 0; i < n; i++)
func(this[i]);
return this;
};
Spry.$$.Results.setAttribute = function(name, value)
{
return this.forEach(function(n) { Spry.Utils.setAttribute(n, name, value); });
};
Spry.$$.Results.removeAttribute = function(name)
{
return this.forEach(function(n) { Spry.Utils.removeAttribute(n, name); });
};
Spry.$$.Results.addClassName = function(className)
{
return this.forEach(function(n) { Spry.Utils.addClassName(n, className); });
};
Spry.$$.Results.removeClassName = function(className)
{
return this.forEach(function(n) { Spry.Utils.removeClassName(n, className); });
};
Spry.$$.Results.toggleClassName = function(className)
{
return this.forEach(function(n) { Spry.Utils.toggleClassName(n, className); });
};
Spry.$$.Results.addEventListener = function(eventType, handler, capture, bindHandler)
{
return this.forEach(function(n) { Spry.Utils.addEventListener(n, eventType, handler, capture, bindHandler); });
};
Spry.$$.Results.removeEventListener = function(eventType, handler, capture)
{
return this.forEach(function(n) { Spry.Utils.removeEventListener(n, eventType, handler, capture); });
};
Spry.$$.Results.setStyle = function(style)
{
if (style)
{
style = Spry.Utils.styleStringToObject(style);
this.forEach(function(n)
{
for (var p in style)
try { n.style[p] = style[p]; } catch (e) {}
});
}
return this;
};
Spry.$$.Results.setProperty = function(prop, value)
{
if (prop)
{
if (typeof prop == "string")
{
var p = {};
p[prop] = value;
prop = p;
}
this.forEach(function(n)
{
for (var p in prop)
try { n[p] = prop[p]; } catch (e) {}
});
}
return this;
};
})(); // EndSpryComponent |
/*
Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'pastefromword', 'pt-br', {
confirmCleanup: 'O texto que você deseja colar parece ter sido copiado do Word. Você gostaria de remover a formatação antes de colar?',
error: 'Não foi possível limpar os dados colados devido a um erro interno',
title: 'Colar do Word',
toolbar: 'Colar do Word'
});
|
module.exports={title:"Bulma",slug:"bulma",svg:'<svg role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><title>Bulma icon</title><path d="M11.25 0l-6 6 -1.5 10.5 7.5 7.5 9 -6 -6 -6 4.5 -4.5 -7.5 -7.5Z"/></svg>',get path(){return this.svg.match(/<path\s+d="([^"]*)/)[1]},source:"https://github.com/jgthms/bulma/",hex:"00D1B2"}; |
/* this ALWAYS GENERATED file contains the proxy stub code */
/* File created by MIDL compiler version 7.00.0555 */
/* at Thu Mar 08 14:53:56 2012
*/
/* Compiler settings for Accessible2.idl:
Oicf, W1, Zp8, env=Win64 (32b run), target_arch=AMD64 7.00.0555
protocol : dce , ms_ext, c_ext, robust
error checks: allocation ref bounds_check enum stub_data
VC __declspec() decoration level:
__declspec(uuid()), __declspec(selectany), __declspec(novtable)
DECLSPEC_UUID(), MIDL_INTERFACE()
*/
/* @@MIDL_FILE_HEADING( ) */
#if defined(_M_AMD64)
#pragma warning( disable: 4049 ) /* more than 64k source lines */
#if _MSC_VER >= 1200
#pragma warning(push)
#endif
#pragma warning( disable: 4211 ) /* redefine extern to static */
#pragma warning( disable: 4232 ) /* dllimport identity*/
#pragma warning( disable: 4024 ) /* array to pointer mapping*/
#pragma warning( disable: 4152 ) /* function/data pointer conversion in expression */
#define USE_STUBLESS_PROXY
/* verify that the <rpcproxy.h> version is high enough to compile this file*/
#ifndef __REDQ_RPCPROXY_H_VERSION__
#define __REQUIRED_RPCPROXY_H_VERSION__ 475
#endif
#include "rpcproxy.h"
#ifndef __RPCPROXY_H_VERSION__
#error this stub requires an updated version of <rpcproxy.h>
#endif /* __RPCPROXY_H_VERSION__ */
#include "Accessible2.h"
#define TYPE_FORMAT_STRING_SIZE 189
#define PROC_FORMAT_STRING_SIZE 751
#define EXPR_FORMAT_STRING_SIZE 1
#define TRANSMIT_AS_TABLE_SIZE 0
#define WIRE_MARSHAL_TABLE_SIZE 2
typedef struct _Accessible2_MIDL_TYPE_FORMAT_STRING
{
short Pad;
unsigned char Format[ TYPE_FORMAT_STRING_SIZE ];
} Accessible2_MIDL_TYPE_FORMAT_STRING;
typedef struct _Accessible2_MIDL_PROC_FORMAT_STRING
{
short Pad;
unsigned char Format[ PROC_FORMAT_STRING_SIZE ];
} Accessible2_MIDL_PROC_FORMAT_STRING;
typedef struct _Accessible2_MIDL_EXPR_FORMAT_STRING
{
long Pad;
unsigned char Format[ EXPR_FORMAT_STRING_SIZE ];
} Accessible2_MIDL_EXPR_FORMAT_STRING;
static const RPC_SYNTAX_IDENTIFIER _RpcTransferSyntax =
{{0x8A885D04,0x1CEB,0x11C9,{0x9F,0xE8,0x08,0x00,0x2B,0x10,0x48,0x60}},{2,0}};
extern const Accessible2_MIDL_TYPE_FORMAT_STRING Accessible2__MIDL_TypeFormatString;
extern const Accessible2_MIDL_PROC_FORMAT_STRING Accessible2__MIDL_ProcFormatString;
extern const Accessible2_MIDL_EXPR_FORMAT_STRING Accessible2__MIDL_ExprFormatString;
extern const MIDL_STUB_DESC Object_StubDesc;
extern const MIDL_SERVER_INFO IAccessible2_ServerInfo;
extern const MIDL_STUBLESS_PROXY_INFO IAccessible2_ProxyInfo;
extern const USER_MARSHAL_ROUTINE_QUADRUPLE UserMarshalRoutines[ WIRE_MARSHAL_TABLE_SIZE ];
#if !defined(__RPC_WIN64__)
#error Invalid build platform for this stub.
#endif
static const Accessible2_MIDL_PROC_FORMAT_STRING Accessible2__MIDL_ProcFormatString =
{
0,
{
/* Procedure get_nRelations */
0x33, /* FC_AUTO_HANDLE */
0x6c, /* Old Flags: object, Oi2 */
/* 2 */ NdrFcLong( 0x0 ), /* 0 */
/* 6 */ NdrFcShort( 0x1c ), /* 28 */
/* 8 */ NdrFcShort( 0x18 ), /* X64 Stack size/offset = 24 */
/* 10 */ NdrFcShort( 0x0 ), /* 0 */
/* 12 */ NdrFcShort( 0x24 ), /* 36 */
/* 14 */ 0x44, /* Oi2 Flags: has return, has ext, */
0x2, /* 2 */
/* 16 */ 0xa, /* 10 */
0x1, /* Ext Flags: new corr desc, */
/* 18 */ NdrFcShort( 0x0 ), /* 0 */
/* 20 */ NdrFcShort( 0x0 ), /* 0 */
/* 22 */ NdrFcShort( 0x0 ), /* 0 */
/* 24 */ NdrFcShort( 0x0 ), /* 0 */
/* Parameter nRelations */
/* 26 */ NdrFcShort( 0x2150 ), /* Flags: out, base type, simple ref, srv alloc size=8 */
/* 28 */ NdrFcShort( 0x8 ), /* X64 Stack size/offset = 8 */
/* 30 */ 0x8, /* FC_LONG */
0x0, /* 0 */
/* Return value */
/* 32 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */
/* 34 */ NdrFcShort( 0x10 ), /* X64 Stack size/offset = 16 */
/* 36 */ 0x8, /* FC_LONG */
0x0, /* 0 */
/* Procedure get_relation */
/* 38 */ 0x33, /* FC_AUTO_HANDLE */
0x6c, /* Old Flags: object, Oi2 */
/* 40 */ NdrFcLong( 0x0 ), /* 0 */
/* 44 */ NdrFcShort( 0x1d ), /* 29 */
/* 46 */ NdrFcShort( 0x20 ), /* X64 Stack size/offset = 32 */
/* 48 */ NdrFcShort( 0x8 ), /* 8 */
/* 50 */ NdrFcShort( 0x8 ), /* 8 */
/* 52 */ 0x45, /* Oi2 Flags: srv must size, has return, has ext, */
0x3, /* 3 */
/* 54 */ 0xa, /* 10 */
0x1, /* Ext Flags: new corr desc, */
/* 56 */ NdrFcShort( 0x0 ), /* 0 */
/* 58 */ NdrFcShort( 0x0 ), /* 0 */
/* 60 */ NdrFcShort( 0x0 ), /* 0 */
/* 62 */ NdrFcShort( 0x0 ), /* 0 */
/* Parameter relationIndex */
/* 64 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */
/* 66 */ NdrFcShort( 0x8 ), /* X64 Stack size/offset = 8 */
/* 68 */ 0x8, /* FC_LONG */
0x0, /* 0 */
/* Parameter relation */
/* 70 */ NdrFcShort( 0x13 ), /* Flags: must size, must free, out, */
/* 72 */ NdrFcShort( 0x10 ), /* X64 Stack size/offset = 16 */
/* 74 */ NdrFcShort( 0x6 ), /* Type Offset=6 */
/* Return value */
/* 76 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */
/* 78 */ NdrFcShort( 0x18 ), /* X64 Stack size/offset = 24 */
/* 80 */ 0x8, /* FC_LONG */
0x0, /* 0 */
/* Procedure get_relations */
/* 82 */ 0x33, /* FC_AUTO_HANDLE */
0x6c, /* Old Flags: object, Oi2 */
/* 84 */ NdrFcLong( 0x0 ), /* 0 */
/* 88 */ NdrFcShort( 0x1e ), /* 30 */
/* 90 */ NdrFcShort( 0x28 ), /* X64 Stack size/offset = 40 */
/* 92 */ NdrFcShort( 0x8 ), /* 8 */
/* 94 */ NdrFcShort( 0x24 ), /* 36 */
/* 96 */ 0x45, /* Oi2 Flags: srv must size, has return, has ext, */
0x4, /* 4 */
/* 98 */ 0xa, /* 10 */
0x3, /* Ext Flags: new corr desc, clt corr check, */
/* 100 */ NdrFcShort( 0x1 ), /* 1 */
/* 102 */ NdrFcShort( 0x0 ), /* 0 */
/* 104 */ NdrFcShort( 0x0 ), /* 0 */
/* 106 */ NdrFcShort( 0x0 ), /* 0 */
/* Parameter maxRelations */
/* 108 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */
/* 110 */ NdrFcShort( 0x8 ), /* X64 Stack size/offset = 8 */
/* 112 */ 0x8, /* FC_LONG */
0x0, /* 0 */
/* Parameter relations */
/* 114 */ NdrFcShort( 0x113 ), /* Flags: must size, must free, out, simple ref, */
/* 116 */ NdrFcShort( 0x10 ), /* X64 Stack size/offset = 16 */
/* 118 */ NdrFcShort( 0x20 ), /* Type Offset=32 */
/* Parameter nRelations */
/* 120 */ NdrFcShort( 0x2150 ), /* Flags: out, base type, simple ref, srv alloc size=8 */
/* 122 */ NdrFcShort( 0x18 ), /* X64 Stack size/offset = 24 */
/* 124 */ 0x8, /* FC_LONG */
0x0, /* 0 */
/* Return value */
/* 126 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */
/* 128 */ NdrFcShort( 0x20 ), /* X64 Stack size/offset = 32 */
/* 130 */ 0x8, /* FC_LONG */
0x0, /* 0 */
/* Procedure role */
/* 132 */ 0x33, /* FC_AUTO_HANDLE */
0x6c, /* Old Flags: object, Oi2 */
/* 134 */ NdrFcLong( 0x0 ), /* 0 */
/* 138 */ NdrFcShort( 0x1f ), /* 31 */
/* 140 */ NdrFcShort( 0x18 ), /* X64 Stack size/offset = 24 */
/* 142 */ NdrFcShort( 0x0 ), /* 0 */
/* 144 */ NdrFcShort( 0x24 ), /* 36 */
/* 146 */ 0x44, /* Oi2 Flags: has return, has ext, */
0x2, /* 2 */
/* 148 */ 0xa, /* 10 */
0x1, /* Ext Flags: new corr desc, */
/* 150 */ NdrFcShort( 0x0 ), /* 0 */
/* 152 */ NdrFcShort( 0x0 ), /* 0 */
/* 154 */ NdrFcShort( 0x0 ), /* 0 */
/* 156 */ NdrFcShort( 0x0 ), /* 0 */
/* Parameter role */
/* 158 */ NdrFcShort( 0x2150 ), /* Flags: out, base type, simple ref, srv alloc size=8 */
/* 160 */ NdrFcShort( 0x8 ), /* X64 Stack size/offset = 8 */
/* 162 */ 0x8, /* FC_LONG */
0x0, /* 0 */
/* Return value */
/* 164 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */
/* 166 */ NdrFcShort( 0x10 ), /* X64 Stack size/offset = 16 */
/* 168 */ 0x8, /* FC_LONG */
0x0, /* 0 */
/* Procedure scrollTo */
/* 170 */ 0x33, /* FC_AUTO_HANDLE */
0x6c, /* Old Flags: object, Oi2 */
/* 172 */ NdrFcLong( 0x0 ), /* 0 */
/* 176 */ NdrFcShort( 0x20 ), /* 32 */
/* 178 */ NdrFcShort( 0x18 ), /* X64 Stack size/offset = 24 */
/* 180 */ NdrFcShort( 0x6 ), /* 6 */
/* 182 */ NdrFcShort( 0x8 ), /* 8 */
/* 184 */ 0x44, /* Oi2 Flags: has return, has ext, */
0x2, /* 2 */
/* 186 */ 0xa, /* 10 */
0x1, /* Ext Flags: new corr desc, */
/* 188 */ NdrFcShort( 0x0 ), /* 0 */
/* 190 */ NdrFcShort( 0x0 ), /* 0 */
/* 192 */ NdrFcShort( 0x0 ), /* 0 */
/* 194 */ NdrFcShort( 0x0 ), /* 0 */
/* Parameter scrollType */
/* 196 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */
/* 198 */ NdrFcShort( 0x8 ), /* X64 Stack size/offset = 8 */
/* 200 */ 0xd, /* FC_ENUM16 */
0x0, /* 0 */
/* Return value */
/* 202 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */
/* 204 */ NdrFcShort( 0x10 ), /* X64 Stack size/offset = 16 */
/* 206 */ 0x8, /* FC_LONG */
0x0, /* 0 */
/* Procedure scrollToPoint */
/* 208 */ 0x33, /* FC_AUTO_HANDLE */
0x6c, /* Old Flags: object, Oi2 */
/* 210 */ NdrFcLong( 0x0 ), /* 0 */
/* 214 */ NdrFcShort( 0x21 ), /* 33 */
/* 216 */ NdrFcShort( 0x28 ), /* X64 Stack size/offset = 40 */
/* 218 */ NdrFcShort( 0x16 ), /* 22 */
/* 220 */ NdrFcShort( 0x8 ), /* 8 */
/* 222 */ 0x44, /* Oi2 Flags: has return, has ext, */
0x4, /* 4 */
/* 224 */ 0xa, /* 10 */
0x1, /* Ext Flags: new corr desc, */
/* 226 */ NdrFcShort( 0x0 ), /* 0 */
/* 228 */ NdrFcShort( 0x0 ), /* 0 */
/* 230 */ NdrFcShort( 0x0 ), /* 0 */
/* 232 */ NdrFcShort( 0x0 ), /* 0 */
/* Parameter coordinateType */
/* 234 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */
/* 236 */ NdrFcShort( 0x8 ), /* X64 Stack size/offset = 8 */
/* 238 */ 0xd, /* FC_ENUM16 */
0x0, /* 0 */
/* Parameter x */
/* 240 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */
/* 242 */ NdrFcShort( 0x10 ), /* X64 Stack size/offset = 16 */
/* 244 */ 0x8, /* FC_LONG */
0x0, /* 0 */
/* Parameter y */
/* 246 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */
/* 248 */ NdrFcShort( 0x18 ), /* X64 Stack size/offset = 24 */
/* 250 */ 0x8, /* FC_LONG */
0x0, /* 0 */
/* Return value */
/* 252 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */
/* 254 */ NdrFcShort( 0x20 ), /* X64 Stack size/offset = 32 */
/* 256 */ 0x8, /* FC_LONG */
0x0, /* 0 */
/* Procedure get_groupPosition */
/* 258 */ 0x33, /* FC_AUTO_HANDLE */
0x6c, /* Old Flags: object, Oi2 */
/* 260 */ NdrFcLong( 0x0 ), /* 0 */
/* 264 */ NdrFcShort( 0x22 ), /* 34 */
/* 266 */ NdrFcShort( 0x28 ), /* X64 Stack size/offset = 40 */
/* 268 */ NdrFcShort( 0x0 ), /* 0 */
/* 270 */ NdrFcShort( 0x5c ), /* 92 */
/* 272 */ 0x44, /* Oi2 Flags: has return, has ext, */
0x4, /* 4 */
/* 274 */ 0xa, /* 10 */
0x1, /* Ext Flags: new corr desc, */
/* 276 */ NdrFcShort( 0x0 ), /* 0 */
/* 278 */ NdrFcShort( 0x0 ), /* 0 */
/* 280 */ NdrFcShort( 0x0 ), /* 0 */
/* 282 */ NdrFcShort( 0x0 ), /* 0 */
/* Parameter groupLevel */
/* 284 */ NdrFcShort( 0x2150 ), /* Flags: out, base type, simple ref, srv alloc size=8 */
/* 286 */ NdrFcShort( 0x8 ), /* X64 Stack size/offset = 8 */
/* 288 */ 0x8, /* FC_LONG */
0x0, /* 0 */
/* Parameter similarItemsInGroup */
/* 290 */ NdrFcShort( 0x2150 ), /* Flags: out, base type, simple ref, srv alloc size=8 */
/* 292 */ NdrFcShort( 0x10 ), /* X64 Stack size/offset = 16 */
/* 294 */ 0x8, /* FC_LONG */
0x0, /* 0 */
/* Parameter positionInGroup */
/* 296 */ NdrFcShort( 0x2150 ), /* Flags: out, base type, simple ref, srv alloc size=8 */
/* 298 */ NdrFcShort( 0x18 ), /* X64 Stack size/offset = 24 */
/* 300 */ 0x8, /* FC_LONG */
0x0, /* 0 */
/* Return value */
/* 302 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */
/* 304 */ NdrFcShort( 0x20 ), /* X64 Stack size/offset = 32 */
/* 306 */ 0x8, /* FC_LONG */
0x0, /* 0 */
/* Procedure get_states */
/* 308 */ 0x33, /* FC_AUTO_HANDLE */
0x6c, /* Old Flags: object, Oi2 */
/* 310 */ NdrFcLong( 0x0 ), /* 0 */
/* 314 */ NdrFcShort( 0x23 ), /* 35 */
/* 316 */ NdrFcShort( 0x18 ), /* X64 Stack size/offset = 24 */
/* 318 */ NdrFcShort( 0x0 ), /* 0 */
/* 320 */ NdrFcShort( 0x24 ), /* 36 */
/* 322 */ 0x44, /* Oi2 Flags: has return, has ext, */
0x2, /* 2 */
/* 324 */ 0xa, /* 10 */
0x1, /* Ext Flags: new corr desc, */
/* 326 */ NdrFcShort( 0x0 ), /* 0 */
/* 328 */ NdrFcShort( 0x0 ), /* 0 */
/* 330 */ NdrFcShort( 0x0 ), /* 0 */
/* 332 */ NdrFcShort( 0x0 ), /* 0 */
/* Parameter states */
/* 334 */ NdrFcShort( 0x2150 ), /* Flags: out, base type, simple ref, srv alloc size=8 */
/* 336 */ NdrFcShort( 0x8 ), /* X64 Stack size/offset = 8 */
/* 338 */ 0x8, /* FC_LONG */
0x0, /* 0 */
/* Return value */
/* 340 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */
/* 342 */ NdrFcShort( 0x10 ), /* X64 Stack size/offset = 16 */
/* 344 */ 0x8, /* FC_LONG */
0x0, /* 0 */
/* Procedure get_extendedRole */
/* 346 */ 0x33, /* FC_AUTO_HANDLE */
0x6c, /* Old Flags: object, Oi2 */
/* 348 */ NdrFcLong( 0x0 ), /* 0 */
/* 352 */ NdrFcShort( 0x24 ), /* 36 */
/* 354 */ NdrFcShort( 0x18 ), /* X64 Stack size/offset = 24 */
/* 356 */ NdrFcShort( 0x0 ), /* 0 */
/* 358 */ NdrFcShort( 0x8 ), /* 8 */
/* 360 */ 0x45, /* Oi2 Flags: srv must size, has return, has ext, */
0x2, /* 2 */
/* 362 */ 0xa, /* 10 */
0x3, /* Ext Flags: new corr desc, clt corr check, */
/* 364 */ NdrFcShort( 0x1 ), /* 1 */
/* 366 */ NdrFcShort( 0x0 ), /* 0 */
/* 368 */ NdrFcShort( 0x0 ), /* 0 */
/* 370 */ NdrFcShort( 0x0 ), /* 0 */
/* Parameter extendedRole */
/* 372 */ NdrFcShort( 0x2113 ), /* Flags: must size, must free, out, simple ref, srv alloc size=8 */
/* 374 */ NdrFcShort( 0x8 ), /* X64 Stack size/offset = 8 */
/* 376 */ NdrFcShort( 0x54 ), /* Type Offset=84 */
/* Return value */
/* 378 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */
/* 380 */ NdrFcShort( 0x10 ), /* X64 Stack size/offset = 16 */
/* 382 */ 0x8, /* FC_LONG */
0x0, /* 0 */
/* Procedure get_localizedExtendedRole */
/* 384 */ 0x33, /* FC_AUTO_HANDLE */
0x6c, /* Old Flags: object, Oi2 */
/* 386 */ NdrFcLong( 0x0 ), /* 0 */
/* 390 */ NdrFcShort( 0x25 ), /* 37 */
/* 392 */ NdrFcShort( 0x18 ), /* X64 Stack size/offset = 24 */
/* 394 */ NdrFcShort( 0x0 ), /* 0 */
/* 396 */ NdrFcShort( 0x8 ), /* 8 */
/* 398 */ 0x45, /* Oi2 Flags: srv must size, has return, has ext, */
0x2, /* 2 */
/* 400 */ 0xa, /* 10 */
0x3, /* Ext Flags: new corr desc, clt corr check, */
/* 402 */ NdrFcShort( 0x1 ), /* 1 */
/* 404 */ NdrFcShort( 0x0 ), /* 0 */
/* 406 */ NdrFcShort( 0x0 ), /* 0 */
/* 408 */ NdrFcShort( 0x0 ), /* 0 */
/* Parameter localizedExtendedRole */
/* 410 */ NdrFcShort( 0x2113 ), /* Flags: must size, must free, out, simple ref, srv alloc size=8 */
/* 412 */ NdrFcShort( 0x8 ), /* X64 Stack size/offset = 8 */
/* 414 */ NdrFcShort( 0x54 ), /* Type Offset=84 */
/* Return value */
/* 416 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */
/* 418 */ NdrFcShort( 0x10 ), /* X64 Stack size/offset = 16 */
/* 420 */ 0x8, /* FC_LONG */
0x0, /* 0 */
/* Procedure get_nExtendedStates */
/* 422 */ 0x33, /* FC_AUTO_HANDLE */
0x6c, /* Old Flags: object, Oi2 */
/* 424 */ NdrFcLong( 0x0 ), /* 0 */
/* 428 */ NdrFcShort( 0x26 ), /* 38 */
/* 430 */ NdrFcShort( 0x18 ), /* X64 Stack size/offset = 24 */
/* 432 */ NdrFcShort( 0x0 ), /* 0 */
/* 434 */ NdrFcShort( 0x24 ), /* 36 */
/* 436 */ 0x44, /* Oi2 Flags: has return, has ext, */
0x2, /* 2 */
/* 438 */ 0xa, /* 10 */
0x1, /* Ext Flags: new corr desc, */
/* 440 */ NdrFcShort( 0x0 ), /* 0 */
/* 442 */ NdrFcShort( 0x0 ), /* 0 */
/* 444 */ NdrFcShort( 0x0 ), /* 0 */
/* 446 */ NdrFcShort( 0x0 ), /* 0 */
/* Parameter nExtendedStates */
/* 448 */ NdrFcShort( 0x2150 ), /* Flags: out, base type, simple ref, srv alloc size=8 */
/* 450 */ NdrFcShort( 0x8 ), /* X64 Stack size/offset = 8 */
/* 452 */ 0x8, /* FC_LONG */
0x0, /* 0 */
/* Return value */
/* 454 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */
/* 456 */ NdrFcShort( 0x10 ), /* X64 Stack size/offset = 16 */
/* 458 */ 0x8, /* FC_LONG */
0x0, /* 0 */
/* Procedure get_extendedStates */
/* 460 */ 0x33, /* FC_AUTO_HANDLE */
0x6c, /* Old Flags: object, Oi2 */
/* 462 */ NdrFcLong( 0x0 ), /* 0 */
/* 466 */ NdrFcShort( 0x27 ), /* 39 */
/* 468 */ NdrFcShort( 0x28 ), /* X64 Stack size/offset = 40 */
/* 470 */ NdrFcShort( 0x8 ), /* 8 */
/* 472 */ NdrFcShort( 0x24 ), /* 36 */
/* 474 */ 0x45, /* Oi2 Flags: srv must size, has return, has ext, */
0x4, /* 4 */
/* 476 */ 0xa, /* 10 */
0x3, /* Ext Flags: new corr desc, clt corr check, */
/* 478 */ NdrFcShort( 0x1 ), /* 1 */
/* 480 */ NdrFcShort( 0x0 ), /* 0 */
/* 482 */ NdrFcShort( 0x0 ), /* 0 */
/* 484 */ NdrFcShort( 0x0 ), /* 0 */
/* Parameter maxExtendedStates */
/* 486 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */
/* 488 */ NdrFcShort( 0x8 ), /* X64 Stack size/offset = 8 */
/* 490 */ 0x8, /* FC_LONG */
0x0, /* 0 */
/* Parameter extendedStates */
/* 492 */ NdrFcShort( 0x2013 ), /* Flags: must size, must free, out, srv alloc size=8 */
/* 494 */ NdrFcShort( 0x10 ), /* X64 Stack size/offset = 16 */
/* 496 */ NdrFcShort( 0x5e ), /* Type Offset=94 */
/* Parameter nExtendedStates */
/* 498 */ NdrFcShort( 0x2150 ), /* Flags: out, base type, simple ref, srv alloc size=8 */
/* 500 */ NdrFcShort( 0x18 ), /* X64 Stack size/offset = 24 */
/* 502 */ 0x8, /* FC_LONG */
0x0, /* 0 */
/* Return value */
/* 504 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */
/* 506 */ NdrFcShort( 0x20 ), /* X64 Stack size/offset = 32 */
/* 508 */ 0x8, /* FC_LONG */
0x0, /* 0 */
/* Procedure get_localizedExtendedStates */
/* 510 */ 0x33, /* FC_AUTO_HANDLE */
0x6c, /* Old Flags: object, Oi2 */
/* 512 */ NdrFcLong( 0x0 ), /* 0 */
/* 516 */ NdrFcShort( 0x28 ), /* 40 */
/* 518 */ NdrFcShort( 0x28 ), /* X64 Stack size/offset = 40 */
/* 520 */ NdrFcShort( 0x8 ), /* 8 */
/* 522 */ NdrFcShort( 0x24 ), /* 36 */
/* 524 */ 0x45, /* Oi2 Flags: srv must size, has return, has ext, */
0x4, /* 4 */
/* 526 */ 0xa, /* 10 */
0x3, /* Ext Flags: new corr desc, clt corr check, */
/* 528 */ NdrFcShort( 0x1 ), /* 1 */
/* 530 */ NdrFcShort( 0x0 ), /* 0 */
/* 532 */ NdrFcShort( 0x0 ), /* 0 */
/* 534 */ NdrFcShort( 0x0 ), /* 0 */
/* Parameter maxLocalizedExtendedStates */
/* 536 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */
/* 538 */ NdrFcShort( 0x8 ), /* X64 Stack size/offset = 8 */
/* 540 */ 0x8, /* FC_LONG */
0x0, /* 0 */
/* Parameter localizedExtendedStates */
/* 542 */ NdrFcShort( 0x2013 ), /* Flags: must size, must free, out, srv alloc size=8 */
/* 544 */ NdrFcShort( 0x10 ), /* X64 Stack size/offset = 16 */
/* 546 */ NdrFcShort( 0x5e ), /* Type Offset=94 */
/* Parameter nLocalizedExtendedStates */
/* 548 */ NdrFcShort( 0x2150 ), /* Flags: out, base type, simple ref, srv alloc size=8 */
/* 550 */ NdrFcShort( 0x18 ), /* X64 Stack size/offset = 24 */
/* 552 */ 0x8, /* FC_LONG */
0x0, /* 0 */
/* Return value */
/* 554 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */
/* 556 */ NdrFcShort( 0x20 ), /* X64 Stack size/offset = 32 */
/* 558 */ 0x8, /* FC_LONG */
0x0, /* 0 */
/* Procedure get_uniqueID */
/* 560 */ 0x33, /* FC_AUTO_HANDLE */
0x6c, /* Old Flags: object, Oi2 */
/* 562 */ NdrFcLong( 0x0 ), /* 0 */
/* 566 */ NdrFcShort( 0x29 ), /* 41 */
/* 568 */ NdrFcShort( 0x18 ), /* X64 Stack size/offset = 24 */
/* 570 */ NdrFcShort( 0x0 ), /* 0 */
/* 572 */ NdrFcShort( 0x24 ), /* 36 */
/* 574 */ 0x44, /* Oi2 Flags: has return, has ext, */
0x2, /* 2 */
/* 576 */ 0xa, /* 10 */
0x1, /* Ext Flags: new corr desc, */
/* 578 */ NdrFcShort( 0x0 ), /* 0 */
/* 580 */ NdrFcShort( 0x0 ), /* 0 */
/* 582 */ NdrFcShort( 0x0 ), /* 0 */
/* 584 */ NdrFcShort( 0x0 ), /* 0 */
/* Parameter uniqueID */
/* 586 */ NdrFcShort( 0x2150 ), /* Flags: out, base type, simple ref, srv alloc size=8 */
/* 588 */ NdrFcShort( 0x8 ), /* X64 Stack size/offset = 8 */
/* 590 */ 0x8, /* FC_LONG */
0x0, /* 0 */
/* Return value */
/* 592 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */
/* 594 */ NdrFcShort( 0x10 ), /* X64 Stack size/offset = 16 */
/* 596 */ 0x8, /* FC_LONG */
0x0, /* 0 */
/* Procedure get_windowHandle */
/* 598 */ 0x33, /* FC_AUTO_HANDLE */
0x6c, /* Old Flags: object, Oi2 */
/* 600 */ NdrFcLong( 0x0 ), /* 0 */
/* 604 */ NdrFcShort( 0x2a ), /* 42 */
/* 606 */ NdrFcShort( 0x18 ), /* X64 Stack size/offset = 24 */
/* 608 */ NdrFcShort( 0x0 ), /* 0 */
/* 610 */ NdrFcShort( 0x8 ), /* 8 */
/* 612 */ 0x45, /* Oi2 Flags: srv must size, has return, has ext, */
0x2, /* 2 */
/* 614 */ 0xa, /* 10 */
0x3, /* Ext Flags: new corr desc, clt corr check, */
/* 616 */ NdrFcShort( 0x1 ), /* 1 */
/* 618 */ NdrFcShort( 0x0 ), /* 0 */
/* 620 */ NdrFcShort( 0x0 ), /* 0 */
/* 622 */ NdrFcShort( 0x0 ), /* 0 */
/* Parameter windowHandle */
/* 624 */ NdrFcShort( 0x2113 ), /* Flags: must size, must free, out, simple ref, srv alloc size=8 */
/* 626 */ NdrFcShort( 0x8 ), /* X64 Stack size/offset = 8 */
/* 628 */ NdrFcShort( 0x98 ), /* Type Offset=152 */
/* Return value */
/* 630 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */
/* 632 */ NdrFcShort( 0x10 ), /* X64 Stack size/offset = 16 */
/* 634 */ 0x8, /* FC_LONG */
0x0, /* 0 */
/* Procedure get_indexInParent */
/* 636 */ 0x33, /* FC_AUTO_HANDLE */
0x6c, /* Old Flags: object, Oi2 */
/* 638 */ NdrFcLong( 0x0 ), /* 0 */
/* 642 */ NdrFcShort( 0x2b ), /* 43 */
/* 644 */ NdrFcShort( 0x18 ), /* X64 Stack size/offset = 24 */
/* 646 */ NdrFcShort( 0x0 ), /* 0 */
/* 648 */ NdrFcShort( 0x24 ), /* 36 */
/* 650 */ 0x44, /* Oi2 Flags: has return, has ext, */
0x2, /* 2 */
/* 652 */ 0xa, /* 10 */
0x1, /* Ext Flags: new corr desc, */
/* 654 */ NdrFcShort( 0x0 ), /* 0 */
/* 656 */ NdrFcShort( 0x0 ), /* 0 */
/* 658 */ NdrFcShort( 0x0 ), /* 0 */
/* 660 */ NdrFcShort( 0x0 ), /* 0 */
/* Parameter indexInParent */
/* 662 */ NdrFcShort( 0x2150 ), /* Flags: out, base type, simple ref, srv alloc size=8 */
/* 664 */ NdrFcShort( 0x8 ), /* X64 Stack size/offset = 8 */
/* 666 */ 0x8, /* FC_LONG */
0x0, /* 0 */
/* Return value */
/* 668 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */
/* 670 */ NdrFcShort( 0x10 ), /* X64 Stack size/offset = 16 */
/* 672 */ 0x8, /* FC_LONG */
0x0, /* 0 */
/* Procedure get_locale */
/* 674 */ 0x33, /* FC_AUTO_HANDLE */
0x6c, /* Old Flags: object, Oi2 */
/* 676 */ NdrFcLong( 0x0 ), /* 0 */
/* 680 */ NdrFcShort( 0x2c ), /* 44 */
/* 682 */ NdrFcShort( 0x18 ), /* X64 Stack size/offset = 24 */
/* 684 */ NdrFcShort( 0x0 ), /* 0 */
/* 686 */ NdrFcShort( 0x8 ), /* 8 */
/* 688 */ 0x45, /* Oi2 Flags: srv must size, has return, has ext, */
0x2, /* 2 */
/* 690 */ 0xa, /* 10 */
0x3, /* Ext Flags: new corr desc, clt corr check, */
/* 692 */ NdrFcShort( 0x1 ), /* 1 */
/* 694 */ NdrFcShort( 0x0 ), /* 0 */
/* 696 */ NdrFcShort( 0x0 ), /* 0 */
/* 698 */ NdrFcShort( 0x0 ), /* 0 */
/* Parameter locale */
/* 700 */ NdrFcShort( 0x6113 ), /* Flags: must size, must free, out, simple ref, srv alloc size=24 */
/* 702 */ NdrFcShort( 0x8 ), /* X64 Stack size/offset = 8 */
/* 704 */ NdrFcShort( 0xa6 ), /* Type Offset=166 */
/* Return value */
/* 706 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */
/* 708 */ NdrFcShort( 0x10 ), /* X64 Stack size/offset = 16 */
/* 710 */ 0x8, /* FC_LONG */
0x0, /* 0 */
/* Procedure get_attributes */
/* 712 */ 0x33, /* FC_AUTO_HANDLE */
0x6c, /* Old Flags: object, Oi2 */
/* 714 */ NdrFcLong( 0x0 ), /* 0 */
/* 718 */ NdrFcShort( 0x2d ), /* 45 */
/* 720 */ NdrFcShort( 0x18 ), /* X64 Stack size/offset = 24 */
/* 722 */ NdrFcShort( 0x0 ), /* 0 */
/* 724 */ NdrFcShort( 0x8 ), /* 8 */
/* 726 */ 0x45, /* Oi2 Flags: srv must size, has return, has ext, */
0x2, /* 2 */
/* 728 */ 0xa, /* 10 */
0x3, /* Ext Flags: new corr desc, clt corr check, */
/* 730 */ NdrFcShort( 0x1 ), /* 1 */
/* 732 */ NdrFcShort( 0x0 ), /* 0 */
/* 734 */ NdrFcShort( 0x0 ), /* 0 */
/* 736 */ NdrFcShort( 0x0 ), /* 0 */
/* Parameter attributes */
/* 738 */ NdrFcShort( 0x2113 ), /* Flags: must size, must free, out, simple ref, srv alloc size=8 */
/* 740 */ NdrFcShort( 0x8 ), /* X64 Stack size/offset = 8 */
/* 742 */ NdrFcShort( 0x54 ), /* Type Offset=84 */
/* Return value */
/* 744 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */
/* 746 */ NdrFcShort( 0x10 ), /* X64 Stack size/offset = 16 */
/* 748 */ 0x8, /* FC_LONG */
0x0, /* 0 */
0x0
}
};
static const Accessible2_MIDL_TYPE_FORMAT_STRING Accessible2__MIDL_TypeFormatString =
{
0,
{
NdrFcShort( 0x0 ), /* 0 */
/* 2 */
0x11, 0xc, /* FC_RP [alloced_on_stack] [simple_pointer] */
/* 4 */ 0x8, /* FC_LONG */
0x5c, /* FC_PAD */
/* 6 */
0x11, 0x10, /* FC_RP [pointer_deref] */
/* 8 */ NdrFcShort( 0x2 ), /* Offset= 2 (10) */
/* 10 */
0x2f, /* FC_IP */
0x5a, /* FC_CONSTANT_IID */
/* 12 */ NdrFcLong( 0x7cdf86ee ), /* 2095023854 */
/* 16 */ NdrFcShort( 0xc3da ), /* -15398 */
/* 18 */ NdrFcShort( 0x496a ), /* 18794 */
/* 20 */ 0xbd, /* 189 */
0xa4, /* 164 */
/* 22 */ 0x28, /* 40 */
0x1b, /* 27 */
/* 24 */ 0x33, /* 51 */
0x6e, /* 110 */
/* 26 */ 0x1f, /* 31 */
0xdc, /* 220 */
/* 28 */
0x11, 0x0, /* FC_RP */
/* 30 */ NdrFcShort( 0x2 ), /* Offset= 2 (32) */
/* 32 */
0x21, /* FC_BOGUS_ARRAY */
0x3, /* 3 */
/* 34 */ NdrFcShort( 0x0 ), /* 0 */
/* 36 */ 0x28, /* Corr desc: parameter, FC_LONG */
0x0, /* */
/* 38 */ NdrFcShort( 0x8 ), /* X64 Stack size/offset = 8 */
/* 40 */ NdrFcShort( 0x1 ), /* Corr flags: early, */
/* 42 */ 0x28, /* Corr desc: parameter, FC_LONG */
0x54, /* FC_DEREFERENCE */
/* 44 */ NdrFcShort( 0x18 ), /* X64 Stack size/offset = 24 */
/* 46 */ NdrFcShort( 0x0 ), /* Corr flags: */
/* 48 */ 0x4c, /* FC_EMBEDDED_COMPLEX */
0x0, /* 0 */
/* 50 */ NdrFcShort( 0xffd8 ), /* Offset= -40 (10) */
/* 52 */ 0x5c, /* FC_PAD */
0x5b, /* FC_END */
/* 54 */
0x11, 0x4, /* FC_RP [alloced_on_stack] */
/* 56 */ NdrFcShort( 0x1c ), /* Offset= 28 (84) */
/* 58 */
0x13, 0x0, /* FC_OP */
/* 60 */ NdrFcShort( 0xe ), /* Offset= 14 (74) */
/* 62 */
0x1b, /* FC_CARRAY */
0x1, /* 1 */
/* 64 */ NdrFcShort( 0x2 ), /* 2 */
/* 66 */ 0x9, /* Corr desc: FC_ULONG */
0x0, /* */
/* 68 */ NdrFcShort( 0xfffc ), /* -4 */
/* 70 */ NdrFcShort( 0x1 ), /* Corr flags: early, */
/* 72 */ 0x6, /* FC_SHORT */
0x5b, /* FC_END */
/* 74 */
0x17, /* FC_CSTRUCT */
0x3, /* 3 */
/* 76 */ NdrFcShort( 0x8 ), /* 8 */
/* 78 */ NdrFcShort( 0xfff0 ), /* Offset= -16 (62) */
/* 80 */ 0x8, /* FC_LONG */
0x8, /* FC_LONG */
/* 82 */ 0x5c, /* FC_PAD */
0x5b, /* FC_END */
/* 84 */ 0xb4, /* FC_USER_MARSHAL */
0x83, /* 131 */
/* 86 */ NdrFcShort( 0x0 ), /* 0 */
/* 88 */ NdrFcShort( 0x8 ), /* 8 */
/* 90 */ NdrFcShort( 0x0 ), /* 0 */
/* 92 */ NdrFcShort( 0xffde ), /* Offset= -34 (58) */
/* 94 */
0x11, 0x14, /* FC_RP [alloced_on_stack] [pointer_deref] */
/* 96 */ NdrFcShort( 0x2 ), /* Offset= 2 (98) */
/* 98 */
0x13, 0x0, /* FC_OP */
/* 100 */ NdrFcShort( 0x2 ), /* Offset= 2 (102) */
/* 102 */
0x21, /* FC_BOGUS_ARRAY */
0x3, /* 3 */
/* 104 */ NdrFcShort( 0x0 ), /* 0 */
/* 106 */ 0x28, /* Corr desc: parameter, FC_LONG */
0x0, /* */
/* 108 */ NdrFcShort( 0x8 ), /* X64 Stack size/offset = 8 */
/* 110 */ NdrFcShort( 0x1 ), /* Corr flags: early, */
/* 112 */ 0x28, /* Corr desc: parameter, FC_LONG */
0x54, /* FC_DEREFERENCE */
/* 114 */ NdrFcShort( 0x18 ), /* X64 Stack size/offset = 24 */
/* 116 */ NdrFcShort( 0x0 ), /* Corr flags: */
/* 118 */ 0x4c, /* FC_EMBEDDED_COMPLEX */
0x0, /* 0 */
/* 120 */ NdrFcShort( 0xffdc ), /* Offset= -36 (84) */
/* 122 */ 0x5c, /* FC_PAD */
0x5b, /* FC_END */
/* 124 */
0x11, 0x4, /* FC_RP [alloced_on_stack] */
/* 126 */ NdrFcShort( 0x1a ), /* Offset= 26 (152) */
/* 128 */
0x13, 0x0, /* FC_OP */
/* 130 */ NdrFcShort( 0x2 ), /* Offset= 2 (132) */
/* 132 */
0x2a, /* FC_ENCAPSULATED_UNION */
0x48, /* 72 */
/* 134 */ NdrFcShort( 0x4 ), /* 4 */
/* 136 */ NdrFcShort( 0x2 ), /* 2 */
/* 138 */ NdrFcLong( 0x48746457 ), /* 1215587415 */
/* 142 */ NdrFcShort( 0x8008 ), /* Simple arm type: FC_LONG */
/* 144 */ NdrFcLong( 0x52746457 ), /* 1383359575 */
/* 148 */ NdrFcShort( 0x8008 ), /* Simple arm type: FC_LONG */
/* 150 */ NdrFcShort( 0xffff ), /* Offset= -1 (149) */
/* 152 */ 0xb4, /* FC_USER_MARSHAL */
0x83, /* 131 */
/* 154 */ NdrFcShort( 0x1 ), /* 1 */
/* 156 */ NdrFcShort( 0x8 ), /* 8 */
/* 158 */ NdrFcShort( 0x0 ), /* 0 */
/* 160 */ NdrFcShort( 0xffe0 ), /* Offset= -32 (128) */
/* 162 */
0x11, 0x4, /* FC_RP [alloced_on_stack] */
/* 164 */ NdrFcShort( 0x2 ), /* Offset= 2 (166) */
/* 166 */
0x1a, /* FC_BOGUS_STRUCT */
0x3, /* 3 */
/* 168 */ NdrFcShort( 0x18 ), /* 24 */
/* 170 */ NdrFcShort( 0x0 ), /* 0 */
/* 172 */ NdrFcShort( 0x0 ), /* Offset= 0 (172) */
/* 174 */ 0x4c, /* FC_EMBEDDED_COMPLEX */
0x0, /* 0 */
/* 176 */ NdrFcShort( 0xffa4 ), /* Offset= -92 (84) */
/* 178 */ 0x4c, /* FC_EMBEDDED_COMPLEX */
0x0, /* 0 */
/* 180 */ NdrFcShort( 0xffa0 ), /* Offset= -96 (84) */
/* 182 */ 0x4c, /* FC_EMBEDDED_COMPLEX */
0x0, /* 0 */
/* 184 */ NdrFcShort( 0xff9c ), /* Offset= -100 (84) */
/* 186 */ 0x5c, /* FC_PAD */
0x5b, /* FC_END */
0x0
}
};
static const USER_MARSHAL_ROUTINE_QUADRUPLE UserMarshalRoutines[ WIRE_MARSHAL_TABLE_SIZE ] =
{
{
BSTR_UserSize
,BSTR_UserMarshal
,BSTR_UserUnmarshal
,BSTR_UserFree
},
{
HWND_UserSize
,HWND_UserMarshal
,HWND_UserUnmarshal
,HWND_UserFree
}
};
/* Standard interface: __MIDL_itf_Accessible2_0000_0000, ver. 0.0,
GUID={0x00000000,0x0000,0x0000,{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}} */
/* Object interface: IUnknown, ver. 0.0,
GUID={0x00000000,0x0000,0x0000,{0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46}} */
/* Object interface: IDispatch, ver. 0.0,
GUID={0x00020400,0x0000,0x0000,{0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46}} */
/* Object interface: IAccessible, ver. 0.0,
GUID={0x618736e0,0x3c3d,0x11cf,{0x81,0x0c,0x00,0xaa,0x00,0x38,0x9b,0x71}} */
/* Object interface: IAccessible2, ver. 0.0,
GUID={0xE89F726E,0xC4F4,0x4c19,{0xBB,0x19,0xB6,0x47,0xD7,0xFA,0x84,0x78}} */
#pragma code_seg(".orpc")
static const unsigned short IAccessible2_FormatStringOffsetTable[] =
{
(unsigned short) -1,
(unsigned short) -1,
(unsigned short) -1,
(unsigned short) -1,
(unsigned short) -1,
(unsigned short) -1,
(unsigned short) -1,
(unsigned short) -1,
(unsigned short) -1,
(unsigned short) -1,
(unsigned short) -1,
(unsigned short) -1,
(unsigned short) -1,
(unsigned short) -1,
(unsigned short) -1,
(unsigned short) -1,
(unsigned short) -1,
(unsigned short) -1,
(unsigned short) -1,
(unsigned short) -1,
(unsigned short) -1,
(unsigned short) -1,
(unsigned short) -1,
(unsigned short) -1,
(unsigned short) -1,
0,
38,
82,
132,
170,
208,
258,
308,
346,
384,
422,
460,
510,
560,
598,
636,
674,
712
};
static const MIDL_STUBLESS_PROXY_INFO IAccessible2_ProxyInfo =
{
&Object_StubDesc,
Accessible2__MIDL_ProcFormatString.Format,
&IAccessible2_FormatStringOffsetTable[-3],
0,
0,
0
};
static const MIDL_SERVER_INFO IAccessible2_ServerInfo =
{
&Object_StubDesc,
0,
Accessible2__MIDL_ProcFormatString.Format,
&IAccessible2_FormatStringOffsetTable[-3],
0,
0,
0,
0};
CINTERFACE_PROXY_VTABLE(46) _IAccessible2ProxyVtbl =
{
&IAccessible2_ProxyInfo,
&IID_IAccessible2,
IUnknown_QueryInterface_Proxy,
IUnknown_AddRef_Proxy,
IUnknown_Release_Proxy ,
0 /* IDispatch::GetTypeInfoCount */ ,
0 /* IDispatch::GetTypeInfo */ ,
0 /* IDispatch::GetIDsOfNames */ ,
0 /* IDispatch_Invoke_Proxy */ ,
0 /* IAccessible::get_accParent */ ,
0 /* IAccessible::get_accChildCount */ ,
0 /* IAccessible::get_accChild */ ,
0 /* IAccessible::get_accName */ ,
0 /* IAccessible::get_accValue */ ,
0 /* IAccessible::get_accDescription */ ,
0 /* IAccessible::get_accRole */ ,
0 /* IAccessible::get_accState */ ,
0 /* IAccessible::get_accHelp */ ,
0 /* IAccessible::get_accHelpTopic */ ,
0 /* IAccessible::get_accKeyboardShortcut */ ,
0 /* IAccessible::get_accFocus */ ,
0 /* IAccessible::get_accSelection */ ,
0 /* IAccessible::get_accDefaultAction */ ,
0 /* IAccessible::accSelect */ ,
0 /* IAccessible::accLocation */ ,
0 /* IAccessible::accNavigate */ ,
0 /* IAccessible::accHitTest */ ,
0 /* IAccessible::accDoDefaultAction */ ,
0 /* IAccessible::put_accName */ ,
0 /* IAccessible::put_accValue */ ,
(void *) (INT_PTR) -1 /* IAccessible2::get_nRelations */ ,
(void *) (INT_PTR) -1 /* IAccessible2::get_relation */ ,
(void *) (INT_PTR) -1 /* IAccessible2::get_relations */ ,
(void *) (INT_PTR) -1 /* IAccessible2::role */ ,
(void *) (INT_PTR) -1 /* IAccessible2::scrollTo */ ,
(void *) (INT_PTR) -1 /* IAccessible2::scrollToPoint */ ,
(void *) (INT_PTR) -1 /* IAccessible2::get_groupPosition */ ,
(void *) (INT_PTR) -1 /* IAccessible2::get_states */ ,
(void *) (INT_PTR) -1 /* IAccessible2::get_extendedRole */ ,
(void *) (INT_PTR) -1 /* IAccessible2::get_localizedExtendedRole */ ,
(void *) (INT_PTR) -1 /* IAccessible2::get_nExtendedStates */ ,
(void *) (INT_PTR) -1 /* IAccessible2::get_extendedStates */ ,
(void *) (INT_PTR) -1 /* IAccessible2::get_localizedExtendedStates */ ,
(void *) (INT_PTR) -1 /* IAccessible2::get_uniqueID */ ,
(void *) (INT_PTR) -1 /* IAccessible2::get_windowHandle */ ,
(void *) (INT_PTR) -1 /* IAccessible2::get_indexInParent */ ,
(void *) (INT_PTR) -1 /* IAccessible2::get_locale */ ,
(void *) (INT_PTR) -1 /* IAccessible2::get_attributes */
};
static const PRPC_STUB_FUNCTION IAccessible2_table[] =
{
STUB_FORWARDING_FUNCTION,
STUB_FORWARDING_FUNCTION,
STUB_FORWARDING_FUNCTION,
STUB_FORWARDING_FUNCTION,
STUB_FORWARDING_FUNCTION,
STUB_FORWARDING_FUNCTION,
STUB_FORWARDING_FUNCTION,
STUB_FORWARDING_FUNCTION,
STUB_FORWARDING_FUNCTION,
STUB_FORWARDING_FUNCTION,
STUB_FORWARDING_FUNCTION,
STUB_FORWARDING_FUNCTION,
STUB_FORWARDING_FUNCTION,
STUB_FORWARDING_FUNCTION,
STUB_FORWARDING_FUNCTION,
STUB_FORWARDING_FUNCTION,
STUB_FORWARDING_FUNCTION,
STUB_FORWARDING_FUNCTION,
STUB_FORWARDING_FUNCTION,
STUB_FORWARDING_FUNCTION,
STUB_FORWARDING_FUNCTION,
STUB_FORWARDING_FUNCTION,
STUB_FORWARDING_FUNCTION,
STUB_FORWARDING_FUNCTION,
STUB_FORWARDING_FUNCTION,
NdrStubCall2,
NdrStubCall2,
NdrStubCall2,
NdrStubCall2,
NdrStubCall2,
NdrStubCall2,
NdrStubCall2,
NdrStubCall2,
NdrStubCall2,
NdrStubCall2,
NdrStubCall2,
NdrStubCall2,
NdrStubCall2,
NdrStubCall2,
NdrStubCall2,
NdrStubCall2,
NdrStubCall2,
NdrStubCall2
};
CInterfaceStubVtbl _IAccessible2StubVtbl =
{
&IID_IAccessible2,
&IAccessible2_ServerInfo,
46,
&IAccessible2_table[-3],
CStdStubBuffer_DELEGATING_METHODS
};
static const MIDL_STUB_DESC Object_StubDesc =
{
0,
NdrOleAllocate,
NdrOleFree,
0,
0,
0,
0,
0,
Accessible2__MIDL_TypeFormatString.Format,
1, /* -error bounds_check flag */
0x50002, /* Ndr library version */
0,
0x700022b, /* MIDL Version 7.0.555 */
0,
UserMarshalRoutines,
0, /* notify & notify_flag routine table */
0x1, /* MIDL flag */
0, /* cs routines */
0, /* proxy/server info */
0
};
const CInterfaceProxyVtbl * const _Accessible2_ProxyVtblList[] =
{
( CInterfaceProxyVtbl *) &_IAccessible2ProxyVtbl,
0
};
const CInterfaceStubVtbl * const _Accessible2_StubVtblList[] =
{
( CInterfaceStubVtbl *) &_IAccessible2StubVtbl,
0
};
PCInterfaceName const _Accessible2_InterfaceNamesList[] =
{
"IAccessible2",
0
};
const IID * const _Accessible2_BaseIIDList[] =
{
&IID_IAccessible,
0
};
#define _Accessible2_CHECK_IID(n) IID_GENERIC_CHECK_IID( _Accessible2, pIID, n)
int __stdcall _Accessible2_IID_Lookup( const IID * pIID, int * pIndex )
{
if(!_Accessible2_CHECK_IID(0))
{
*pIndex = 0;
return 1;
}
return 0;
}
const ExtendedProxyFileInfo Accessible2_ProxyFileInfo =
{
(PCInterfaceProxyVtblList *) & _Accessible2_ProxyVtblList,
(PCInterfaceStubVtblList *) & _Accessible2_StubVtblList,
(const PCInterfaceName * ) & _Accessible2_InterfaceNamesList,
(const IID ** ) & _Accessible2_BaseIIDList,
& _Accessible2_IID_Lookup,
1,
2,
0, /* table of [async_uuid] interfaces */
0, /* Filler1 */
0, /* Filler2 */
0 /* Filler3 */
};
#if _MSC_VER >= 1200
#pragma warning(pop)
#endif
#endif /* defined(_M_AMD64)*/
|
/*
TimelineJS - ver. 2.26.5 - 2013-12-04
Copyright (c) 2012-2013 Northwestern University
a project of the Northwestern University Knight Lab, originally created by Zach Wise
https://github.com/NUKnightLab/TimelineJS
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
.vco-storyjs{font-family:'Lekton',sans-serif;}.vco-storyjs .twitter,.vco-storyjs .vcard,.vco-storyjs .messege,.vco-storyjs .credit,.vco-storyjs .caption,.vco-storyjs .zoom-in,.vco-storyjs .zoom-out,.vco-storyjs .back-home,.vco-storyjs .time-interval div,.vco-storyjs .time-interval-major div,.vco-storyjs .nav-container{font-family:'Lekton',sans-serif !important}
.vco-storyjs .vco-feature h1.date,.vco-storyjs .vco-feature h2.date,.vco-storyjs .vco-feature h3.date,.vco-storyjs .vco-feature h4.date,.vco-storyjs .vco-feature h5.date,.vco-storyjs .vco-feature h6.date{font-family:'Lekton',sans-serif !important}
.vco-storyjs .timenav h1,.vco-storyjs .flag-content h1,.vco-storyjs .era h1,.vco-storyjs .timenav h2,.vco-storyjs .flag-content h2,.vco-storyjs .era h2,.vco-storyjs .timenav h3,.vco-storyjs .flag-content h3,.vco-storyjs .era h3,.vco-storyjs .timenav h4,.vco-storyjs .flag-content h4,.vco-storyjs .era h4,.vco-storyjs .timenav h5,.vco-storyjs .flag-content h5,.vco-storyjs .era h5,.vco-storyjs .timenav h6,.vco-storyjs .flag-content h6,.vco-storyjs .era h6{font-family:'Lekton',sans-serif !important}
.vco-storyjs p,.vco-storyjs blockquote,.vco-storyjs blockquote p,.vco-storyjs .twitter blockquote p{font-family:'Lekton',sans-serif !important}
.vco-storyjs .vco-feature h1,.vco-storyjs .vco-feature h2,.vco-storyjs .vco-feature h3,.vco-storyjs .vco-feature h4,.vco-storyjs .vco-feature h5,.vco-storyjs .vco-feature h6{font-family:'Molengo',sans-serif}
.timeline-tooltip{font-family:'Lekton',sans-serif}
|
// Copyright 2014 The Prometheus Authors
// 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.
// Package prometheus is the core instrumentation package. It provides metrics
// primitives to instrument code for monitoring. It also offers a registry for
// metrics. Sub-packages allow to expose the registered metrics via HTTP
// (package promhttp) or push them to a Pushgateway (package push). There is
// also a sub-package promauto, which provides metrics constructors with
// automatic registration.
//
// All exported functions and methods are safe to be used concurrently unless
// specified otherwise.
//
// A Basic Example
//
// As a starting point, a very basic usage example:
//
// package main
//
// import (
// "log"
// "net/http"
//
// "github.com/prometheus/client_golang/prometheus"
// "github.com/prometheus/client_golang/prometheus/promhttp"
// )
//
// var (
// cpuTemp = prometheus.NewGauge(prometheus.GaugeOpts{
// Name: "cpu_temperature_celsius",
// Help: "Current temperature of the CPU.",
// })
// hdFailures = prometheus.NewCounterVec(
// prometheus.CounterOpts{
// Name: "hd_errors_total",
// Help: "Number of hard-disk errors.",
// },
// []string{"device"},
// )
// )
//
// func init() {
// // Metrics have to be registered to be exposed:
// prometheus.MustRegister(cpuTemp)
// prometheus.MustRegister(hdFailures)
// }
//
// func main() {
// cpuTemp.Set(65.3)
// hdFailures.With(prometheus.Labels{"device":"/dev/sda"}).Inc()
//
// // The Handler function provides a default handler to expose metrics
// // via an HTTP server. "/metrics" is the usual endpoint for that.
// http.Handle("/metrics", promhttp.Handler())
// log.Fatal(http.ListenAndServe(":8080", nil))
// }
//
//
// This is a complete program that exports two metrics, a Gauge and a Counter,
// the latter with a label attached to turn it into a (one-dimensional) vector.
//
// Metrics
//
// The number of exported identifiers in this package might appear a bit
// overwhelming. However, in addition to the basic plumbing shown in the example
// above, you only need to understand the different metric types and their
// vector versions for basic usage. Furthermore, if you are not concerned with
// fine-grained control of when and how to register metrics with the registry,
// have a look at the promauto package, which will effectively allow you to
// ignore registration altogether in simple cases.
//
// Above, you have already touched the Counter and the Gauge. There are two more
// advanced metric types: the Summary and Histogram. A more thorough description
// of those four metric types can be found in the Prometheus docs:
// https://prometheus.io/docs/concepts/metric_types/
//
// A fifth "type" of metric is Untyped. It behaves like a Gauge, but signals the
// Prometheus server not to assume anything about its type.
//
// In addition to the fundamental metric types Gauge, Counter, Summary,
// Histogram, and Untyped, a very important part of the Prometheus data model is
// the partitioning of samples along dimensions called labels, which results in
// metric vectors. The fundamental types are GaugeVec, CounterVec, SummaryVec,
// HistogramVec, and UntypedVec.
//
// While only the fundamental metric types implement the Metric interface, both
// the metrics and their vector versions implement the Collector interface. A
// Collector manages the collection of a number of Metrics, but for convenience,
// a Metric can also “collect itself”. Note that Gauge, Counter, Summary,
// Histogram, and Untyped are interfaces themselves while GaugeVec, CounterVec,
// SummaryVec, HistogramVec, and UntypedVec are not.
//
// To create instances of Metrics and their vector versions, you need a suitable
// …Opts struct, i.e. GaugeOpts, CounterOpts, SummaryOpts, HistogramOpts, or
// UntypedOpts.
//
// Custom Collectors and constant Metrics
//
// While you could create your own implementations of Metric, most likely you
// will only ever implement the Collector interface on your own. At a first
// glance, a custom Collector seems handy to bundle Metrics for common
// registration (with the prime example of the different metric vectors above,
// which bundle all the metrics of the same name but with different labels).
//
// There is a more involved use case, too: If you already have metrics
// available, created outside of the Prometheus context, you don't need the
// interface of the various Metric types. You essentially want to mirror the
// existing numbers into Prometheus Metrics during collection. An own
// implementation of the Collector interface is perfect for that. You can create
// Metric instances “on the fly” using NewConstMetric, NewConstHistogram, and
// NewConstSummary (and their respective Must… versions). That will happen in
// the Collect method. The Describe method has to return separate Desc
// instances, representative of the “throw-away” metrics to be created later.
// NewDesc comes in handy to create those Desc instances. Alternatively, you
// could return no Desc at all, which will marke the Collector “unchecked”. No
// checks are porformed at registration time, but metric consistency will still
// be ensured at scrape time, i.e. any inconsistencies will lead to scrape
// errors. Thus, with unchecked Collectors, the responsibility to not collect
// metrics that lead to inconsistencies in the total scrape result lies with the
// implementer of the Collector. While this is not a desirable state, it is
// sometimes necessary. The typical use case is a situatios where the exact
// metrics to be returned by a Collector cannot be predicted at registration
// time, but the implementer has sufficient knowledge of the whole system to
// guarantee metric consistency.
//
// The Collector example illustrates the use case. You can also look at the
// source code of the processCollector (mirroring process metrics), the
// goCollector (mirroring Go metrics), or the expvarCollector (mirroring expvar
// metrics) as examples that are used in this package itself.
//
// If you just need to call a function to get a single float value to collect as
// a metric, GaugeFunc, CounterFunc, or UntypedFunc might be interesting
// shortcuts.
//
// Advanced Uses of the Registry
//
// While MustRegister is the by far most common way of registering a Collector,
// sometimes you might want to handle the errors the registration might cause.
// As suggested by the name, MustRegister panics if an error occurs. With the
// Register function, the error is returned and can be handled.
//
// An error is returned if the registered Collector is incompatible or
// inconsistent with already registered metrics. The registry aims for
// consistency of the collected metrics according to the Prometheus data model.
// Inconsistencies are ideally detected at registration time, not at collect
// time. The former will usually be detected at start-up time of a program,
// while the latter will only happen at scrape time, possibly not even on the
// first scrape if the inconsistency only becomes relevant later. That is the
// main reason why a Collector and a Metric have to describe themselves to the
// registry.
//
// So far, everything we did operated on the so-called default registry, as it
// can be found in the global DefaultRegisterer variable. With NewRegistry, you
// can create a custom registry, or you can even implement the Registerer or
// Gatherer interfaces yourself. The methods Register and Unregister work in the
// same way on a custom registry as the global functions Register and Unregister
// on the default registry.
//
// There are a number of uses for custom registries: You can use registries with
// special properties, see NewPedanticRegistry. You can avoid global state, as
// it is imposed by the DefaultRegisterer. You can use multiple registries at
// the same time to expose different metrics in different ways. You can use
// separate registries for testing purposes.
//
// Also note that the DefaultRegisterer comes registered with a Collector for Go
// runtime metrics (via NewGoCollector) and a Collector for process metrics (via
// NewProcessCollector). With a custom registry, you are in control and decide
// yourself about the Collectors to register.
//
// HTTP Exposition
//
// The Registry implements the Gatherer interface. The caller of the Gather
// method can then expose the gathered metrics in some way. Usually, the metrics
// are served via HTTP on the /metrics endpoint. That's happening in the example
// above. The tools to expose metrics via HTTP are in the promhttp sub-package.
// (The top-level functions in the prometheus package are deprecated.)
//
// Pushing to the Pushgateway
//
// Function for pushing to the Pushgateway can be found in the push sub-package.
//
// Graphite Bridge
//
// Functions and examples to push metrics from a Gatherer to Graphite can be
// found in the graphite sub-package.
//
// Other Means of Exposition
//
// More ways of exposing metrics can easily be added by following the approaches
// of the existing implementations.
package prometheus
|
/*
* Renesas - AP-325RXA
* (Compatible with Algo System ., LTD. - AP-320A)
*
* Copyright (C) 2008 Renesas Solutions Corp.
* Author : Yusuke Goda <goda.yuske@renesas.com>
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
* for more details.
*/
#include <linux/init.h>
#include <linux/device.h>
#include <linux/interrupt.h>
#include <linux/platform_device.h>
#include <linux/mfd/sh_mobile_sdhi.h>
#include <linux/mmc/host.h>
#include <linux/mtd/physmap.h>
#include <linux/mtd/sh_flctl.h>
#include <linux/delay.h>
#include <linux/i2c.h>
#include <linux/smsc911x.h>
#include <linux/gpio.h>
#include <media/ov772x.h>
#include <media/soc_camera.h>
#include <media/soc_camera_platform.h>
#include <media/sh_mobile_ceu.h>
#include <video/sh_mobile_lcdc.h>
#include <asm/io.h>
#include <asm/clock.h>
#include <asm/suspend.h>
#include <cpu/sh7723.h>
static struct smsc911x_platform_config smsc911x_config = {
.phy_interface = PHY_INTERFACE_MODE_MII,
.irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
.irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN,
.flags = SMSC911X_USE_32BIT,
};
static struct resource smsc9118_resources[] = {
[0] = {
.start = 0xb6080000,
.end = 0xb60fffff,
.flags = IORESOURCE_MEM,
},
[1] = {
.start = 35,
.end = 35,
.flags = IORESOURCE_IRQ,
}
};
static struct platform_device smsc9118_device = {
.name = "smsc911x",
.id = -1,
.num_resources = ARRAY_SIZE(smsc9118_resources),
.resource = smsc9118_resources,
.dev = {
.platform_data = &smsc911x_config,
},
};
/*
* AP320 and AP325RXA has CPLD data in NOR Flash(0xA80000-0xABFFFF).
* If this area erased, this board can not boot.
*/
static struct mtd_partition ap325rxa_nor_flash_partitions[] = {
{
.name = "uboot",
.offset = 0,
.size = (1 * 1024 * 1024),
.mask_flags = MTD_WRITEABLE, /* Read-only */
}, {
.name = "kernel",
.offset = MTDPART_OFS_APPEND,
.size = (2 * 1024 * 1024),
}, {
.name = "free-area0",
.offset = MTDPART_OFS_APPEND,
.size = ((7 * 1024 * 1024) + (512 * 1024)),
}, {
.name = "CPLD-Data",
.offset = MTDPART_OFS_APPEND,
.mask_flags = MTD_WRITEABLE, /* Read-only */
.size = (1024 * 128 * 2),
}, {
.name = "free-area1",
.offset = MTDPART_OFS_APPEND,
.size = MTDPART_SIZ_FULL,
},
};
static struct physmap_flash_data ap325rxa_nor_flash_data = {
.width = 2,
.parts = ap325rxa_nor_flash_partitions,
.nr_parts = ARRAY_SIZE(ap325rxa_nor_flash_partitions),
};
static struct resource ap325rxa_nor_flash_resources[] = {
[0] = {
.name = "NOR Flash",
.start = 0x00000000,
.end = 0x00ffffff,
.flags = IORESOURCE_MEM,
}
};
static struct platform_device ap325rxa_nor_flash_device = {
.name = "physmap-flash",
.resource = ap325rxa_nor_flash_resources,
.num_resources = ARRAY_SIZE(ap325rxa_nor_flash_resources),
.dev = {
.platform_data = &ap325rxa_nor_flash_data,
},
};
static struct mtd_partition nand_partition_info[] = {
{
.name = "nand_data",
.offset = 0,
.size = MTDPART_SIZ_FULL,
},
};
static struct resource nand_flash_resources[] = {
[0] = {
.start = 0xa4530000,
.end = 0xa45300ff,
.flags = IORESOURCE_MEM,
}
};
static struct sh_flctl_platform_data nand_flash_data = {
.parts = nand_partition_info,
.nr_parts = ARRAY_SIZE(nand_partition_info),
.flcmncr_val = FCKSEL_E | TYPESEL_SET | NANWF_E,
.has_hwecc = 1,
};
static struct platform_device nand_flash_device = {
.name = "sh_flctl",
.resource = nand_flash_resources,
.num_resources = ARRAY_SIZE(nand_flash_resources),
.dev = {
.platform_data = &nand_flash_data,
},
};
#define FPGA_LCDREG 0xB4100180
#define FPGA_BKLREG 0xB4100212
#define FPGA_LCDREG_VAL 0x0018
#define PORT_MSELCRB 0xA4050182
#define PORT_HIZCRC 0xA405015C
#define PORT_DRVCRA 0xA405018A
#define PORT_DRVCRB 0xA405018C
static void ap320_wvga_power_on(void *board_data, struct fb_info *info)
{
msleep(100);
/* ASD AP-320/325 LCD ON */
__raw_writew(FPGA_LCDREG_VAL, FPGA_LCDREG);
/* backlight */
gpio_set_value(GPIO_PTS3, 0);
__raw_writew(0x100, FPGA_BKLREG);
}
static void ap320_wvga_power_off(void *board_data)
{
/* backlight */
__raw_writew(0, FPGA_BKLREG);
gpio_set_value(GPIO_PTS3, 1);
/* ASD AP-320/325 LCD OFF */
__raw_writew(0, FPGA_LCDREG);
}
const static struct fb_videomode ap325rxa_lcdc_modes[] = {
{
.name = "LB070WV1",
.xres = 800,
.yres = 480,
.left_margin = 32,
.right_margin = 160,
.hsync_len = 8,
.upper_margin = 63,
.lower_margin = 80,
.vsync_len = 1,
.sync = 0, /* hsync and vsync are active low */
},
};
static struct sh_mobile_lcdc_info lcdc_info = {
.clock_source = LCDC_CLK_EXTERNAL,
.ch[0] = {
.chan = LCDC_CHAN_MAINLCD,
.bpp = 16,
.interface_type = RGB18,
.clock_divider = 1,
.lcd_cfg = ap325rxa_lcdc_modes,
.num_cfg = ARRAY_SIZE(ap325rxa_lcdc_modes),
.lcd_size_cfg = { /* 7.0 inch */
.width = 152,
.height = 91,
},
.board_cfg = {
.display_on = ap320_wvga_power_on,
.display_off = ap320_wvga_power_off,
},
}
};
static struct resource lcdc_resources[] = {
[0] = {
.name = "LCDC",
.start = 0xfe940000, /* P4-only space */
.end = 0xfe942fff,
.flags = IORESOURCE_MEM,
},
[1] = {
.start = 28,
.flags = IORESOURCE_IRQ,
},
};
static struct platform_device lcdc_device = {
.name = "sh_mobile_lcdc_fb",
.num_resources = ARRAY_SIZE(lcdc_resources),
.resource = lcdc_resources,
.dev = {
.platform_data = &lcdc_info,
},
.archdata = {
.hwblk_id = HWBLK_LCDC,
},
};
static void camera_power(int val)
{
gpio_set_value(GPIO_PTZ5, val); /* RST_CAM/RSTB */
mdelay(10);
}
#ifdef CONFIG_I2C
/* support for the old ncm03j camera */
static unsigned char camera_ncm03j_magic[] =
{
0x87, 0x00, 0x88, 0x08, 0x89, 0x01, 0x8A, 0xE8,
0x1D, 0x00, 0x1E, 0x8A, 0x21, 0x00, 0x33, 0x36,
0x36, 0x60, 0x37, 0x08, 0x3B, 0x31, 0x44, 0x0F,
0x46, 0xF0, 0x4B, 0x28, 0x4C, 0x21, 0x4D, 0x55,
0x4E, 0x1B, 0x4F, 0xC7, 0x50, 0xFC, 0x51, 0x12,
0x58, 0x02, 0x66, 0xC0, 0x67, 0x46, 0x6B, 0xA0,
0x6C, 0x34, 0x7E, 0x25, 0x7F, 0x25, 0x8D, 0x0F,
0x92, 0x40, 0x93, 0x04, 0x94, 0x26, 0x95, 0x0A,
0x99, 0x03, 0x9A, 0xF0, 0x9B, 0x14, 0x9D, 0x7A,
0xC5, 0x02, 0xD6, 0x07, 0x59, 0x00, 0x5A, 0x1A,
0x5B, 0x2A, 0x5C, 0x37, 0x5D, 0x42, 0x5E, 0x56,
0xC8, 0x00, 0xC9, 0x1A, 0xCA, 0x2A, 0xCB, 0x37,
0xCC, 0x42, 0xCD, 0x56, 0xCE, 0x00, 0xCF, 0x1A,
0xD0, 0x2A, 0xD1, 0x37, 0xD2, 0x42, 0xD3, 0x56,
0x5F, 0x68, 0x60, 0x87, 0x61, 0xA3, 0x62, 0xBC,
0x63, 0xD4, 0x64, 0xEA, 0xD6, 0x0F,
};
static int camera_probe(void)
{
struct i2c_adapter *a = i2c_get_adapter(0);
struct i2c_msg msg;
int ret;
if (!a)
return -ENODEV;
camera_power(1);
msg.addr = 0x6e;
msg.buf = camera_ncm03j_magic;
msg.len = 2;
msg.flags = 0;
ret = i2c_transfer(a, &msg, 1);
camera_power(0);
return ret;
}
static int camera_set_capture(struct soc_camera_platform_info *info,
int enable)
{
struct i2c_adapter *a = i2c_get_adapter(0);
struct i2c_msg msg;
int ret = 0;
int i;
camera_power(0);
if (!enable)
return 0; /* no disable for now */
camera_power(1);
for (i = 0; i < ARRAY_SIZE(camera_ncm03j_magic); i += 2) {
u_int8_t buf[8];
msg.addr = 0x6e;
msg.buf = buf;
msg.len = 2;
msg.flags = 0;
buf[0] = camera_ncm03j_magic[i];
buf[1] = camera_ncm03j_magic[i + 1];
ret = (ret < 0) ? ret : i2c_transfer(a, &msg, 1);
}
return ret;
}
static int ap325rxa_camera_add(struct soc_camera_link *icl, struct device *dev);
static void ap325rxa_camera_del(struct soc_camera_link *icl);
static struct soc_camera_platform_info camera_info = {
.format_name = "UYVY",
.format_depth = 16,
.format = {
.code = V4L2_MBUS_FMT_UYVY8_2X8,
.colorspace = V4L2_COLORSPACE_SMPTE170M,
.field = V4L2_FIELD_NONE,
.width = 640,
.height = 480,
},
.bus_param = SOCAM_PCLK_SAMPLE_RISING | SOCAM_HSYNC_ACTIVE_HIGH |
SOCAM_VSYNC_ACTIVE_HIGH | SOCAM_MASTER | SOCAM_DATAWIDTH_8 |
SOCAM_DATA_ACTIVE_HIGH,
.set_capture = camera_set_capture,
};
static struct soc_camera_link camera_link = {
.bus_id = 0,
.add_device = ap325rxa_camera_add,
.del_device = ap325rxa_camera_del,
.module_name = "soc_camera_platform",
.priv = &camera_info,
};
static void dummy_release(struct device *dev)
{
}
static struct platform_device camera_device = {
.name = "soc_camera_platform",
.dev = {
.platform_data = &camera_info,
.release = dummy_release,
},
};
static int ap325rxa_camera_add(struct soc_camera_link *icl,
struct device *dev)
{
if (icl != &camera_link || camera_probe() <= 0)
return -ENODEV;
camera_info.dev = dev;
return platform_device_register(&camera_device);
}
static void ap325rxa_camera_del(struct soc_camera_link *icl)
{
if (icl != &camera_link)
return;
platform_device_unregister(&camera_device);
memset(&camera_device.dev.kobj, 0,
sizeof(camera_device.dev.kobj));
}
#endif /* CONFIG_I2C */
static int ov7725_power(struct device *dev, int mode)
{
camera_power(0);
if (mode)
camera_power(1);
return 0;
}
static struct sh_mobile_ceu_info sh_mobile_ceu_info = {
.flags = SH_CEU_FLAG_USE_8BIT_BUS,
};
static struct resource ceu_resources[] = {
[0] = {
.name = "CEU",
.start = 0xfe910000,
.end = 0xfe91009f,
.flags = IORESOURCE_MEM,
},
[1] = {
.start = 52,
.flags = IORESOURCE_IRQ,
},
[2] = {
/* place holder for contiguous memory */
},
};
static struct platform_device ceu_device = {
.name = "sh_mobile_ceu",
.id = 0, /* "ceu0" clock */
.num_resources = ARRAY_SIZE(ceu_resources),
.resource = ceu_resources,
.dev = {
.platform_data = &sh_mobile_ceu_info,
},
.archdata = {
.hwblk_id = HWBLK_CEU,
},
};
static struct resource sdhi0_cn3_resources[] = {
[0] = {
.name = "SDHI0",
.start = 0x04ce0000,
.end = 0x04ce01ff,
.flags = IORESOURCE_MEM,
},
[1] = {
.start = 100,
.flags = IORESOURCE_IRQ,
},
};
static struct sh_mobile_sdhi_info sdhi0_cn3_data = {
.tmio_caps = MMC_CAP_SDIO_IRQ,
};
static struct platform_device sdhi0_cn3_device = {
.name = "sh_mobile_sdhi",
.id = 0, /* "sdhi0" clock */
.num_resources = ARRAY_SIZE(sdhi0_cn3_resources),
.resource = sdhi0_cn3_resources,
.dev = {
.platform_data = &sdhi0_cn3_data,
},
.archdata = {
.hwblk_id = HWBLK_SDHI0,
},
};
static struct resource sdhi1_cn7_resources[] = {
[0] = {
.name = "SDHI1",
.start = 0x04cf0000,
.end = 0x04cf01ff,
.flags = IORESOURCE_MEM,
},
[1] = {
.start = 23,
.flags = IORESOURCE_IRQ,
},
};
static struct sh_mobile_sdhi_info sdhi1_cn7_data = {
.tmio_caps = MMC_CAP_SDIO_IRQ,
};
static struct platform_device sdhi1_cn7_device = {
.name = "sh_mobile_sdhi",
.id = 1, /* "sdhi1" clock */
.num_resources = ARRAY_SIZE(sdhi1_cn7_resources),
.resource = sdhi1_cn7_resources,
.dev = {
.platform_data = &sdhi1_cn7_data,
},
.archdata = {
.hwblk_id = HWBLK_SDHI1,
},
};
static struct i2c_board_info __initdata ap325rxa_i2c_devices[] = {
{
I2C_BOARD_INFO("pcf8563", 0x51),
},
};
static struct i2c_board_info ap325rxa_i2c_camera[] = {
{
I2C_BOARD_INFO("ov772x", 0x21),
},
};
static struct ov772x_camera_info ov7725_info = {
.flags = OV772X_FLAG_VFLIP | OV772X_FLAG_HFLIP | \
OV772X_FLAG_8BIT,
.edgectrl = OV772X_AUTO_EDGECTRL(0xf, 0),
};
static struct soc_camera_link ov7725_link = {
.bus_id = 0,
.power = ov7725_power,
.board_info = &ap325rxa_i2c_camera[0],
.i2c_adapter_id = 0,
.priv = &ov7725_info,
};
static struct platform_device ap325rxa_camera[] = {
{
.name = "soc-camera-pdrv",
.id = 0,
.dev = {
.platform_data = &ov7725_link,
},
}, {
.name = "soc-camera-pdrv",
.id = 1,
.dev = {
.platform_data = &camera_link,
},
},
};
static struct platform_device *ap325rxa_devices[] __initdata = {
&smsc9118_device,
&ap325rxa_nor_flash_device,
&lcdc_device,
&ceu_device,
&nand_flash_device,
&sdhi0_cn3_device,
&sdhi1_cn7_device,
&ap325rxa_camera[0],
&ap325rxa_camera[1],
};
extern char ap325rxa_sdram_enter_start;
extern char ap325rxa_sdram_enter_end;
extern char ap325rxa_sdram_leave_start;
extern char ap325rxa_sdram_leave_end;
static int __init ap325rxa_devices_setup(void)
{
/* register board specific self-refresh code */
sh_mobile_register_self_refresh(SUSP_SH_STANDBY | SUSP_SH_SF,
&ap325rxa_sdram_enter_start,
&ap325rxa_sdram_enter_end,
&ap325rxa_sdram_leave_start,
&ap325rxa_sdram_leave_end);
/* LD3 and LD4 LEDs */
gpio_request(GPIO_PTX5, NULL); /* RUN */
gpio_direction_output(GPIO_PTX5, 1);
gpio_export(GPIO_PTX5, 0);
gpio_request(GPIO_PTX4, NULL); /* INDICATOR */
gpio_direction_output(GPIO_PTX4, 0);
gpio_export(GPIO_PTX4, 0);
/* SW1 input */
gpio_request(GPIO_PTF7, NULL); /* MODE */
gpio_direction_input(GPIO_PTF7);
gpio_export(GPIO_PTF7, 0);
/* LCDC */
gpio_request(GPIO_FN_LCDD15, NULL);
gpio_request(GPIO_FN_LCDD14, NULL);
gpio_request(GPIO_FN_LCDD13, NULL);
gpio_request(GPIO_FN_LCDD12, NULL);
gpio_request(GPIO_FN_LCDD11, NULL);
gpio_request(GPIO_FN_LCDD10, NULL);
gpio_request(GPIO_FN_LCDD9, NULL);
gpio_request(GPIO_FN_LCDD8, NULL);
gpio_request(GPIO_FN_LCDD7, NULL);
gpio_request(GPIO_FN_LCDD6, NULL);
gpio_request(GPIO_FN_LCDD5, NULL);
gpio_request(GPIO_FN_LCDD4, NULL);
gpio_request(GPIO_FN_LCDD3, NULL);
gpio_request(GPIO_FN_LCDD2, NULL);
gpio_request(GPIO_FN_LCDD1, NULL);
gpio_request(GPIO_FN_LCDD0, NULL);
gpio_request(GPIO_FN_LCDLCLK_PTR, NULL);
gpio_request(GPIO_FN_LCDDCK, NULL);
gpio_request(GPIO_FN_LCDVEPWC, NULL);
gpio_request(GPIO_FN_LCDVCPWC, NULL);
gpio_request(GPIO_FN_LCDVSYN, NULL);
gpio_request(GPIO_FN_LCDHSYN, NULL);
gpio_request(GPIO_FN_LCDDISP, NULL);
gpio_request(GPIO_FN_LCDDON, NULL);
/* LCD backlight */
gpio_request(GPIO_PTS3, NULL);
gpio_direction_output(GPIO_PTS3, 1);
/* CEU */
gpio_request(GPIO_FN_VIO_CLK2, NULL);
gpio_request(GPIO_FN_VIO_VD2, NULL);
gpio_request(GPIO_FN_VIO_HD2, NULL);
gpio_request(GPIO_FN_VIO_FLD, NULL);
gpio_request(GPIO_FN_VIO_CKO, NULL);
gpio_request(GPIO_FN_VIO_D15, NULL);
gpio_request(GPIO_FN_VIO_D14, NULL);
gpio_request(GPIO_FN_VIO_D13, NULL);
gpio_request(GPIO_FN_VIO_D12, NULL);
gpio_request(GPIO_FN_VIO_D11, NULL);
gpio_request(GPIO_FN_VIO_D10, NULL);
gpio_request(GPIO_FN_VIO_D9, NULL);
gpio_request(GPIO_FN_VIO_D8, NULL);
gpio_request(GPIO_PTZ7, NULL);
gpio_direction_output(GPIO_PTZ7, 0); /* OE_CAM */
gpio_request(GPIO_PTZ6, NULL);
gpio_direction_output(GPIO_PTZ6, 0); /* STBY_CAM */
gpio_request(GPIO_PTZ5, NULL);
gpio_direction_output(GPIO_PTZ5, 0); /* RST_CAM */
gpio_request(GPIO_PTZ4, NULL);
gpio_direction_output(GPIO_PTZ4, 0); /* SADDR */
__raw_writew(__raw_readw(PORT_MSELCRB) & ~0x0001, PORT_MSELCRB);
/* FLCTL */
gpio_request(GPIO_FN_FCE, NULL);
gpio_request(GPIO_FN_NAF7, NULL);
gpio_request(GPIO_FN_NAF6, NULL);
gpio_request(GPIO_FN_NAF5, NULL);
gpio_request(GPIO_FN_NAF4, NULL);
gpio_request(GPIO_FN_NAF3, NULL);
gpio_request(GPIO_FN_NAF2, NULL);
gpio_request(GPIO_FN_NAF1, NULL);
gpio_request(GPIO_FN_NAF0, NULL);
gpio_request(GPIO_FN_FCDE, NULL);
gpio_request(GPIO_FN_FOE, NULL);
gpio_request(GPIO_FN_FSC, NULL);
gpio_request(GPIO_FN_FWE, NULL);
gpio_request(GPIO_FN_FRB, NULL);
__raw_writew(0, PORT_HIZCRC);
__raw_writew(0xFFFF, PORT_DRVCRA);
__raw_writew(0xFFFF, PORT_DRVCRB);
platform_resource_setup_memory(&ceu_device, "ceu", 4 << 20);
/* SDHI0 - CN3 - SD CARD */
gpio_request(GPIO_FN_SDHI0CD_PTD, NULL);
gpio_request(GPIO_FN_SDHI0WP_PTD, NULL);
gpio_request(GPIO_FN_SDHI0D3_PTD, NULL);
gpio_request(GPIO_FN_SDHI0D2_PTD, NULL);
gpio_request(GPIO_FN_SDHI0D1_PTD, NULL);
gpio_request(GPIO_FN_SDHI0D0_PTD, NULL);
gpio_request(GPIO_FN_SDHI0CMD_PTD, NULL);
gpio_request(GPIO_FN_SDHI0CLK_PTD, NULL);
/* SDHI1 - CN7 - MICRO SD CARD */
gpio_request(GPIO_FN_SDHI1CD, NULL);
gpio_request(GPIO_FN_SDHI1D3, NULL);
gpio_request(GPIO_FN_SDHI1D2, NULL);
gpio_request(GPIO_FN_SDHI1D1, NULL);
gpio_request(GPIO_FN_SDHI1D0, NULL);
gpio_request(GPIO_FN_SDHI1CMD, NULL);
gpio_request(GPIO_FN_SDHI1CLK, NULL);
i2c_register_board_info(0, ap325rxa_i2c_devices,
ARRAY_SIZE(ap325rxa_i2c_devices));
return platform_add_devices(ap325rxa_devices,
ARRAY_SIZE(ap325rxa_devices));
}
arch_initcall(ap325rxa_devices_setup);
/* Return the board specific boot mode pin configuration */
static int ap325rxa_mode_pins(void)
{
/* MD0=0, MD1=0, MD2=0: Clock Mode 0
* MD3=0: 16-bit Area0 Bus Width
* MD5=1: Little Endian
* TSTMD=1, MD8=1: Test Mode Disabled
*/
return MODE_PIN5 | MODE_PIN8;
}
static struct sh_machine_vector mv_ap325rxa __initmv = {
.mv_name = "AP-325RXA",
.mv_mode_pins = ap325rxa_mode_pins,
};
|
/*
* Based on arch/arm/include/asm/memory.h
*
* Copyright (C) 2000-2002 Russell King
* Copyright (C) 2012 ARM Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Note: this file should not be included by non-asm/.h files
*/
#ifndef __ASM_MEMORY_H
#define __ASM_MEMORY_H
#include <linux/compiler.h>
#include <linux/const.h>
#include <linux/types.h>
#include <asm/sizes.h>
/*
* Allow for constants defined here to be used from assembly code
* by prepending the UL suffix only with actual C code compilation.
*/
#define UL(x) _AC(x, UL)
/*
* PAGE_OFFSET - the virtual address of the start of the kernel image (top
* (VA_BITS - 1))
* VA_BITS - the maximum number of bits for virtual addresses.
* TASK_SIZE - the maximum size of a user space task.
* TASK_UNMAPPED_BASE - the lower boundary of the mmap VM area.
* The module space lives between the addresses given by TASK_SIZE
* and PAGE_OFFSET - it must be within 128MB of the kernel text.
*/
#ifdef CONFIG_ARM64_64K_PAGES
#define VA_BITS (42)
#else
#define VA_BITS (39)
#endif
#define PAGE_OFFSET (UL(0xffffffffffffffff) << (VA_BITS - 1))
#define MODULES_END (PAGE_OFFSET)
#define MODULES_VADDR (MODULES_END - SZ_64M)
#define EARLYCON_IOBASE (MODULES_VADDR - SZ_4M)
#define TASK_SIZE_64 (UL(1) << VA_BITS)
#ifdef CONFIG_COMPAT
#define TASK_SIZE_32 UL(0x100000000)
#define TASK_SIZE (test_thread_flag(TIF_32BIT) ? \
TASK_SIZE_32 : TASK_SIZE_64)
#else
#define TASK_SIZE TASK_SIZE_64
#endif /* CONFIG_COMPAT */
#define TASK_UNMAPPED_BASE (PAGE_ALIGN(TASK_SIZE / 4))
#if TASK_SIZE_64 > MODULES_VADDR
#error Top of 64-bit user space clashes with start of module space
#endif
/*
* Physical vs virtual RAM address space conversion. These are
* private definitions which should NOT be used outside memory.h
* files. Use virt_to_phys/phys_to_virt/__pa/__va instead.
*/
#define __virt_to_phys(x) (((phys_addr_t)(x) - PAGE_OFFSET + PHYS_OFFSET))
#define __phys_to_virt(x) ((unsigned long)((x) - PHYS_OFFSET + PAGE_OFFSET))
/*
* Convert a physical address to a Page Frame Number and back
*/
#define __phys_to_pfn(paddr) ((unsigned long)((paddr) >> PAGE_SHIFT))
#define __pfn_to_phys(pfn) ((phys_addr_t)(pfn) << PAGE_SHIFT)
/*
* Convert a page to/from a physical address
*/
#define page_to_phys(page) (__pfn_to_phys(page_to_pfn(page)))
#define phys_to_page(phys) (pfn_to_page(__phys_to_pfn(phys)))
/*
* Memory types available.
*/
#define MT_DEVICE_nGnRnE 0
#define MT_DEVICE_nGnRE 1
#define MT_DEVICE_GRE 2
#define MT_NORMAL_NC 3
#define MT_NORMAL 4
/*
* Memory types for Stage-2 translation
*/
#define MT_S2_NORMAL 0xf
#define MT_S2_DEVICE_nGnRE 0x1
#ifndef __ASSEMBLY__
extern phys_addr_t memstart_addr;
/* PHYS_OFFSET - the physical address of the start of memory. */
#define PHYS_OFFSET ({ memstart_addr; })
/*
* PFNs are used to describe any physical page; this means
* PFN 0 == physical address 0.
*
* This is the PFN of the first RAM page in the kernel
* direct-mapped view. We assume this is the first page
* of RAM in the mem_map as well.
*/
#define PHYS_PFN_OFFSET (PHYS_OFFSET >> PAGE_SHIFT)
/*
* Note: Drivers should NOT use these. They are the wrong
* translation for translating DMA addresses. Use the driver
* DMA support - see dma-mapping.h.
*/
static inline phys_addr_t virt_to_phys(const volatile void *x)
{
return __virt_to_phys((unsigned long)(x));
}
static inline void *phys_to_virt(phys_addr_t x)
{
return (void *)(__phys_to_virt(x));
}
/*
* Drivers should NOT use these either.
*/
#define __pa(x) __virt_to_phys((unsigned long)(x))
#define __va(x) ((void *)__phys_to_virt((phys_addr_t)(x)))
#define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT)
/*
* virt_to_page(k) convert a _valid_ virtual address to struct page *
* virt_addr_valid(k) indicates whether a virtual address is valid
*/
#define ARCH_PFN_OFFSET PHYS_PFN_OFFSET
#define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
#define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
#endif
#include <asm-generic/memory_model.h>
#endif
|
//
// This file is auto-generated. Please don't modify it!
//
package org.opencv.ml;
// C++: class CvGBTreesParams
/**
* <p>GBT training parameters.</p>
*
* <p>The structure contains parameters for each single decision tree in the
* ensemble, as well as the whole model characteristics. The structure is
* derived from "CvDTreeParams" but not all of the decision tree parameters are
* supported: cross-validation, pruning, and class priorities are not used.</p>
*
* @see <a href="http://docs.opencv.org/modules/ml/doc/gradient_boosted_trees.html#cvgbtreesparams">org.opencv.ml.CvGBTreesParams : public CvDTreeParams</a>
*/
public class CvGBTreesParams extends CvDTreeParams {
protected CvGBTreesParams(long addr) { super(addr); }
//
// C++: CvGBTreesParams::CvGBTreesParams()
//
/**
* <p>By default the following constructor is used: CvGBTreesParams(CvGBTrees.SQUARED_LOSS,
* 200, 0.8f, 0.01f, 3, false) <code></p>
*
* <p>// C++ code:</p>
*
* <p>: CvDTreeParams(3, 10, 0, false, 10, 0, false, false, 0)</p>
*
* @see <a href="http://docs.opencv.org/modules/ml/doc/gradient_boosted_trees.html#cvgbtreesparams-cvgbtreesparams">org.opencv.ml.CvGBTreesParams.CvGBTreesParams</a>
*/
public CvGBTreesParams()
{
super( CvGBTreesParams_0() );
return;
}
//
// C++: int CvGBTreesParams::weak_count
//
public int get_weak_count()
{
int retVal = get_weak_count_0(nativeObj);
return retVal;
}
//
// C++: void CvGBTreesParams::weak_count
//
public void set_weak_count(int weak_count)
{
set_weak_count_0(nativeObj, weak_count);
return;
}
//
// C++: int CvGBTreesParams::loss_function_type
//
public int get_loss_function_type()
{
int retVal = get_loss_function_type_0(nativeObj);
return retVal;
}
//
// C++: void CvGBTreesParams::loss_function_type
//
public void set_loss_function_type(int loss_function_type)
{
set_loss_function_type_0(nativeObj, loss_function_type);
return;
}
//
// C++: float CvGBTreesParams::subsample_portion
//
public float get_subsample_portion()
{
float retVal = get_subsample_portion_0(nativeObj);
return retVal;
}
//
// C++: void CvGBTreesParams::subsample_portion
//
public void set_subsample_portion(float subsample_portion)
{
set_subsample_portion_0(nativeObj, subsample_portion);
return;
}
//
// C++: float CvGBTreesParams::shrinkage
//
public float get_shrinkage()
{
float retVal = get_shrinkage_0(nativeObj);
return retVal;
}
//
// C++: void CvGBTreesParams::shrinkage
//
public void set_shrinkage(float shrinkage)
{
set_shrinkage_0(nativeObj, shrinkage);
return;
}
@Override
protected void finalize() throws Throwable {
delete(nativeObj);
}
// C++: CvGBTreesParams::CvGBTreesParams()
private static native long CvGBTreesParams_0();
// C++: int CvGBTreesParams::weak_count
private static native int get_weak_count_0(long nativeObj);
// C++: void CvGBTreesParams::weak_count
private static native void set_weak_count_0(long nativeObj, int weak_count);
// C++: int CvGBTreesParams::loss_function_type
private static native int get_loss_function_type_0(long nativeObj);
// C++: void CvGBTreesParams::loss_function_type
private static native void set_loss_function_type_0(long nativeObj, int loss_function_type);
// C++: float CvGBTreesParams::subsample_portion
private static native float get_subsample_portion_0(long nativeObj);
// C++: void CvGBTreesParams::subsample_portion
private static native void set_subsample_portion_0(long nativeObj, float subsample_portion);
// C++: float CvGBTreesParams::shrinkage
private static native float get_shrinkage_0(long nativeObj);
// C++: void CvGBTreesParams::shrinkage
private static native void set_shrinkage_0(long nativeObj, float shrinkage);
// native support for java finalize()
private static native void delete(long nativeObj);
}
|
Contribute
==========
So you've got an awesome idea to throw into Jekyll. Great! Please keep the
following in mind:
* **Use https://talk.jekyllrb.com for non-technical or indirect Jekyll questions that are not bugs.**
* **Contributions will not be accepted without tests or necessary documentation updates.**
* If you're creating a small fix or patch to an existing feature, just a simple
test will do. Please stay in the confines of the current test suite and use
[Shoulda](https://github.com/thoughtbot/shoulda/tree/master) and
[RSpec-Mocks](https://github.com/rspec/rspec-mocks).
* If it's a brand new feature, make sure to create a new
[Cucumber](https://github.com/cucumber/cucumber/) feature and reuse steps
where appropriate. Also, whipping up some documentation in your fork's `site`
would be appreciated, and once merged it will be transferred over to the main
`site`, jekyllrb.com.
* If your contribution changes any Jekyll behavior, make sure to update the
documentation. It lives in `site/_docs`. If the docs are missing information,
please feel free to add it in. Great docs make a great project!
* Please follow the [GitHub Ruby Styleguide](https://github.com/styleguide/ruby)
when modifying Ruby code.
* Please do your best to submit **small pull requests**. The easier the proposed
change is to review, the more likely it will be merged.
* When submitting a pull request, please make judicious use of the pull request
body. A description of what changes were made, the motivations behind the
changes and [any tasks completed or left to complete](http://git.io/gfm-tasks)
will also speed up review time.
Test Dependencies
-----------------
To run the test suite and build the gem you'll need to install Jekyll's
dependencies. Simply run this command to get all setup:
$ script/bootstrap
Before you start, run the tests and make sure that they pass (to confirm your
environment is configured properly):
$ script/cibuild
If you are only updating a file in `test/`, you can use the command:
$ script/test test/blah_test.rb
If you are only updating a `.feature` file, you can use the command:
$ script/cucumber features/blah.feature
Both `script/test` and `script/cucumber` can be run without arguments to
run its entire respective suite.
Workflow
--------
Here's the most direct way to get your work merged into the project:
* Fork the project.
* Clone down your fork ( `git clone git@github.com:[username]/jekyll.git` ).
* Create a topic branch to contain your change ( `git checkout -b my_awesome_feature` ).
* Hack away, add tests. Not necessarily in that order.
* Make sure everything still passes by running `script/cibuild`.
* If necessary, rebase your commits into logical chunks, without errors.
* Push the branch up ( `git push origin my_awesome_feature` ).
* Create a pull request against jekyll/jekyll and describe what your change
does and the why you think it should be merged.
Updating Documentation
----------------------
We want the Jekyll documentation to be the best it can be. We've
open-sourced our docs and we welcome any pull requests if you find it
lacking.
You can find the documentation for jekyllrb.com in the
[site](https://github.com/jekyll/jekyll/tree/master/site) directory of
Jekyll's repo on GitHub.com.
All documentation pull requests should be directed at `master`. Pull
requests directed at another branch will not be accepted.
The [Jekyll wiki](https://github.com/jekyll/jekyll/wiki) on GitHub
can be freely updated without a pull request as all GitHub users have access.
If you want to add your plugin to the
[list of plugins](http://jekyllrb.com/docs/plugins/#available-plugins),
please submit a pull request modifying the
[plugins page source file](site/_docs/plugins.md) by adding a
link to your plugin under the proper subheading depending upon its type.
Gotchas
-------
* Please do not bump the gem version in your pull requests.
* Try to keep your patch(es) based from the latest commit on jekyll/jekyll.
The easier it is to apply your work, the less work the maintainers have to do,
which is always a good thing.
* Please don't tag your GitHub issue with [fix], [feature], etc. The maintainers
actively read the issues and will label it once they come across it.
Finally...
----------
Thanks! Hacking on Jekyll should be fun. If you find any of this hard to figure
out, let us know so we can improve our process or documentation!
|
/******************************************************************************
Copyright (c) 2007
Infineon Technologies AG
St. Martin Strasse 53; 81669 Munich, Germany
Any use of this Software is subject to the conclusion of a respective
License Agreement. Without such a License Agreement no rights to the
Software are granted.
******************************************************************************/
#ifndef __PORT_REG_H
#define __PORT_REG_H
#define port_r32(reg) __raw_readl(®)
#define port_w32(val, reg) __raw_writel(val, ®)
/** PORT register structure */
struct svip_reg_port {
volatile u32 out; /* 0x0000 */
volatile u32 in; /* 0x0004 */
volatile u32 dir; /* 0x0008 */
volatile u32 altsel0; /* 0x000C */
volatile u32 altsel1; /* 0x0010 */
volatile u32 puen; /* 0x0014 */
volatile u32 exintcr0; /* 0x0018 */
volatile u32 exintcr1; /* 0x001C */
volatile u32 irncr; /* 0x0020 */
volatile u32 irnicr; /* 0x0024 */
volatile u32 irnen; /* 0x0028 */
volatile u32 irncfg; /* 0x002C */
volatile u32 irnenset; /* 0x0030 */
volatile u32 irnenclr; /* 0x0034 */
};
/*******************************************************************************
* Port 0 Data Output Register
******************************************************************************/
/* Port 0 Pin # Output Value (19) */
#define PORT_P0_OUT_P19 (0x1 << 19)
#define PORT_P0_OUT_P19_VAL(val) (((val) & 0x1) << 19)
#define PORT_P0_OUT_P19_GET(val) ((((val) & PORT_P0_OUT_P19) >> 19) & 0x1)
#define PORT_P0_OUT_P19_SET(reg,val) (reg) = ((reg & ~PORT_P0_OUT_P19) | (((val) & 0x1) << 19))
/* Port 0 Pin # Output Value (18) */
#define PORT_P0_OUT_P18 (0x1 << 18)
#define PORT_P0_OUT_P18_VAL(val) (((val) & 0x1) << 18)
#define PORT_P0_OUT_P18_GET(val) ((((val) & PORT_P0_OUT_P18) >> 18) & 0x1)
#define PORT_P0_OUT_P18_SET(reg,val) (reg) = ((reg & ~PORT_P0_OUT_P18) | (((val) & 0x1) << 18))
/* Port 0 Pin # Output Value (17) */
#define PORT_P0_OUT_P17 (0x1 << 17)
#define PORT_P0_OUT_P17_VAL(val) (((val) & 0x1) << 17)
#define PORT_P0_OUT_P17_GET(val) ((((val) & PORT_P0_OUT_P17) >> 17) & 0x1)
#define PORT_P0_OUT_P17_SET(reg,val) (reg) = ((reg & ~PORT_P0_OUT_P17) | (((val) & 0x1) << 17))
/* Port 0 Pin # Output Value (16) */
#define PORT_P0_OUT_P16 (0x1 << 16)
#define PORT_P0_OUT_P16_VAL(val) (((val) & 0x1) << 16)
#define PORT_P0_OUT_P16_GET(val) ((((val) & PORT_P0_OUT_P16) >> 16) & 0x1)
#define PORT_P0_OUT_P16_SET(reg,val) (reg) = ((reg & ~PORT_P0_OUT_P16) | (((val) & 0x1) << 16))
/* Port 0 Pin # Output Value (15) */
#define PORT_P0_OUT_P15 (0x1 << 15)
#define PORT_P0_OUT_P15_VAL(val) (((val) & 0x1) << 15)
#define PORT_P0_OUT_P15_GET(val) ((((val) & PORT_P0_OUT_P15) >> 15) & 0x1)
#define PORT_P0_OUT_P15_SET(reg,val) (reg) = ((reg & ~PORT_P0_OUT_P15) | (((val) & 0x1) << 15))
/* Port 0 Pin # Output Value (14) */
#define PORT_P0_OUT_P14 (0x1 << 14)
#define PORT_P0_OUT_P14_VAL(val) (((val) & 0x1) << 14)
#define PORT_P0_OUT_P14_GET(val) ((((val) & PORT_P0_OUT_P14) >> 14) & 0x1)
#define PORT_P0_OUT_P14_SET(reg,val) (reg) = ((reg & ~PORT_P0_OUT_P14) | (((val) & 0x1) << 14))
/* Port 0 Pin # Output Value (13) */
#define PORT_P0_OUT_P13 (0x1 << 13)
#define PORT_P0_OUT_P13_VAL(val) (((val) & 0x1) << 13)
#define PORT_P0_OUT_P13_GET(val) ((((val) & PORT_P0_OUT_P13) >> 13) & 0x1)
#define PORT_P0_OUT_P13_SET(reg,val) (reg) = ((reg & ~PORT_P0_OUT_P13) | (((val) & 0x1) << 13))
/* Port 0 Pin # Output Value (12) */
#define PORT_P0_OUT_P12 (0x1 << 12)
#define PORT_P0_OUT_P12_VAL(val) (((val) & 0x1) << 12)
#define PORT_P0_OUT_P12_GET(val) ((((val) & PORT_P0_OUT_P12) >> 12) & 0x1)
#define PORT_P0_OUT_P12_SET(reg,val) (reg) = ((reg & ~PORT_P0_OUT_P12) | (((val) & 0x1) << 12))
/* Port 0 Pin # Output Value (11) */
#define PORT_P0_OUT_P11 (0x1 << 11)
#define PORT_P0_OUT_P11_VAL(val) (((val) & 0x1) << 11)
#define PORT_P0_OUT_P11_GET(val) ((((val) & PORT_P0_OUT_P11) >> 11) & 0x1)
#define PORT_P0_OUT_P11_SET(reg,val) (reg) = ((reg & ~PORT_P0_OUT_P11) | (((val) & 0x1) << 11))
/* Port 0 Pin # Output Value (10) */
#define PORT_P0_OUT_P10 (0x1 << 10)
#define PORT_P0_OUT_P10_VAL(val) (((val) & 0x1) << 10)
#define PORT_P0_OUT_P10_GET(val) ((((val) & PORT_P0_OUT_P10) >> 10) & 0x1)
#define PORT_P0_OUT_P10_SET(reg,val) (reg) = ((reg & ~PORT_P0_OUT_P10) | (((val) & 0x1) << 10))
/* Port 0 Pin # Output Value (9) */
#define PORT_P0_OUT_P9 (0x1 << 9)
#define PORT_P0_OUT_P9_VAL(val) (((val) & 0x1) << 9)
#define PORT_P0_OUT_P9_GET(val) ((((val) & PORT_P0_OUT_P9) >> 9) & 0x1)
#define PORT_P0_OUT_P9_SET(reg,val) (reg) = ((reg & ~PORT_P0_OUT_P9) | (((val) & 0x1) << 9))
/* Port 0 Pin # Output Value (8) */
#define PORT_P0_OUT_P8 (0x1 << 8)
#define PORT_P0_OUT_P8_VAL(val) (((val) & 0x1) << 8)
#define PORT_P0_OUT_P8_GET(val) ((((val) & PORT_P0_OUT_P8) >> 8) & 0x1)
#define PORT_P0_OUT_P8_SET(reg,val) (reg) = ((reg & ~PORT_P0_OUT_P8) | (((val) & 0x1) << 8))
/* Port 0 Pin # Output Value (7) */
#define PORT_P0_OUT_P7 (0x1 << 7)
#define PORT_P0_OUT_P7_VAL(val) (((val) & 0x1) << 7)
#define PORT_P0_OUT_P7_GET(val) ((((val) & PORT_P0_OUT_P7) >> 7) & 0x1)
#define PORT_P0_OUT_P7_SET(reg,val) (reg) = ((reg & ~PORT_P0_OUT_P7) | (((val) & 0x1) << 7))
/* Port 0 Pin # Output Value (6) */
#define PORT_P0_OUT_P6 (0x1 << 6)
#define PORT_P0_OUT_P6_VAL(val) (((val) & 0x1) << 6)
#define PORT_P0_OUT_P6_GET(val) ((((val) & PORT_P0_OUT_P6) >> 6) & 0x1)
#define PORT_P0_OUT_P6_SET(reg,val) (reg) = ((reg & ~PORT_P0_OUT_P6) | (((val) & 0x1) << 6))
/* Port 0 Pin # Output Value (5) */
#define PORT_P0_OUT_P5 (0x1 << 5)
#define PORT_P0_OUT_P5_VAL(val) (((val) & 0x1) << 5)
#define PORT_P0_OUT_P5_GET(val) ((((val) & PORT_P0_OUT_P5) >> 5) & 0x1)
#define PORT_P0_OUT_P5_SET(reg,val) (reg) = ((reg & ~PORT_P0_OUT_P5) | (((val) & 0x1) << 5))
/* Port 0 Pin # Output Value (4) */
#define PORT_P0_OUT_P4 (0x1 << 4)
#define PORT_P0_OUT_P4_VAL(val) (((val) & 0x1) << 4)
#define PORT_P0_OUT_P4_GET(val) ((((val) & PORT_P0_OUT_P4) >> 4) & 0x1)
#define PORT_P0_OUT_P4_SET(reg,val) (reg) = ((reg & ~PORT_P0_OUT_P4) | (((val) & 0x1) << 4))
/* Port 0 Pin # Output Value (3) */
#define PORT_P0_OUT_P3 (0x1 << 3)
#define PORT_P0_OUT_P3_VAL(val) (((val) & 0x1) << 3)
#define PORT_P0_OUT_P3_GET(val) ((((val) & PORT_P0_OUT_P3) >> 3) & 0x1)
#define PORT_P0_OUT_P3_SET(reg,val) (reg) = ((reg & ~PORT_P0_OUT_P3) | (((val) & 0x1) << 3))
/* Port 0 Pin # Output Value (2) */
#define PORT_P0_OUT_P2 (0x1 << 2)
#define PORT_P0_OUT_P2_VAL(val) (((val) & 0x1) << 2)
#define PORT_P0_OUT_P2_GET(val) ((((val) & PORT_P0_OUT_P2) >> 2) & 0x1)
#define PORT_P0_OUT_P2_SET(reg,val) (reg) = ((reg & ~PORT_P0_OUT_P2) | (((val) & 0x1) << 2))
/* Port 0 Pin # Output Value (1) */
#define PORT_P0_OUT_P1 (0x1 << 1)
#define PORT_P0_OUT_P1_VAL(val) (((val) & 0x1) << 1)
#define PORT_P0_OUT_P1_GET(val) ((((val) & PORT_P0_OUT_P1) >> 1) & 0x1)
#define PORT_P0_OUT_P1_SET(reg,val) (reg) = ((reg & ~PORT_P0_OUT_P1) | (((val) & 0x1) << 1))
/* Port 0 Pin # Output Value (0) */
#define PORT_P0_OUT_P0 (0x1)
#define PORT_P0_OUT_P0_VAL(val) (((val) & 0x1) << 0)
#define PORT_P0_OUT_P0_GET(val) ((((val) & PORT_P0_OUT_P0) >> 0) & 0x1)
#define PORT_P0_OUT_P0_SET(reg,val) (reg) = ((reg & ~PORT_P0_OUT_P0) | (((val) & 0x1) << 0))
/*******************************************************************************
* Port 0 Data Input Register
******************************************************************************/
/* Port 0 Pin # Latched Input Value (19) */
#define PORT_P0_IN_P19 (0x1 << 19)
#define PORT_P0_IN_P19_GET(val) ((((val) & PORT_P0_IN_P19) >> 19) & 0x1)
/* Port 0 Pin # Latched Input Value (18) */
#define PORT_P0_IN_P18 (0x1 << 18)
#define PORT_P0_IN_P18_GET(val) ((((val) & PORT_P0_IN_P18) >> 18) & 0x1)
/* Port 0 Pin # Latched Input Value (17) */
#define PORT_P0_IN_P17 (0x1 << 17)
#define PORT_P0_IN_P17_GET(val) ((((val) & PORT_P0_IN_P17) >> 17) & 0x1)
/* Port 0 Pin # Latched Input Value (16) */
#define PORT_P0_IN_P16 (0x1 << 16)
#define PORT_P0_IN_P16_GET(val) ((((val) & PORT_P0_IN_P16) >> 16) & 0x1)
/* Port 0 Pin # Latched Input Value (15) */
#define PORT_P0_IN_P15 (0x1 << 15)
#define PORT_P0_IN_P15_GET(val) ((((val) & PORT_P0_IN_P15) >> 15) & 0x1)
/* Port 0 Pin # Latched Input Value (14) */
#define PORT_P0_IN_P14 (0x1 << 14)
#define PORT_P0_IN_P14_GET(val) ((((val) & PORT_P0_IN_P14) >> 14) & 0x1)
/* Port 0 Pin # Latched Input Value (13) */
#define PORT_P0_IN_P13 (0x1 << 13)
#define PORT_P0_IN_P13_GET(val) ((((val) & PORT_P0_IN_P13) >> 13) & 0x1)
/* Port 0 Pin # Latched Input Value (12) */
#define PORT_P0_IN_P12 (0x1 << 12)
#define PORT_P0_IN_P12_GET(val) ((((val) & PORT_P0_IN_P12) >> 12) & 0x1)
/* Port 0 Pin # Latched Input Value (11) */
#define PORT_P0_IN_P11 (0x1 << 11)
#define PORT_P0_IN_P11_GET(val) ((((val) & PORT_P0_IN_P11) >> 11) & 0x1)
/* Port 0 Pin # Latched Input Value (10) */
#define PORT_P0_IN_P10 (0x1 << 10)
#define PORT_P0_IN_P10_GET(val) ((((val) & PORT_P0_IN_P10) >> 10) & 0x1)
/* Port 0 Pin # Latched Input Value (9) */
#define PORT_P0_IN_P9 (0x1 << 9)
#define PORT_P0_IN_P9_GET(val) ((((val) & PORT_P0_IN_P9) >> 9) & 0x1)
/* Port 0 Pin # Latched Input Value (8) */
#define PORT_P0_IN_P8 (0x1 << 8)
#define PORT_P0_IN_P8_GET(val) ((((val) & PORT_P0_IN_P8) >> 8) & 0x1)
/* Port 0 Pin # Latched Input Value (7) */
#define PORT_P0_IN_P7 (0x1 << 7)
#define PORT_P0_IN_P7_GET(val) ((((val) & PORT_P0_IN_P7) >> 7) & 0x1)
/* Port 0 Pin # Latched Input Value (6) */
#define PORT_P0_IN_P6 (0x1 << 6)
#define PORT_P0_IN_P6_GET(val) ((((val) & PORT_P0_IN_P6) >> 6) & 0x1)
/* Port 0 Pin # Latched Input Value (5) */
#define PORT_P0_IN_P5 (0x1 << 5)
#define PORT_P0_IN_P5_GET(val) ((((val) & PORT_P0_IN_P5) >> 5) & 0x1)
/* Port 0 Pin # Latched Input Value (4) */
#define PORT_P0_IN_P4 (0x1 << 4)
#define PORT_P0_IN_P4_GET(val) ((((val) & PORT_P0_IN_P4) >> 4) & 0x1)
/* Port 0 Pin # Latched Input Value (3) */
#define PORT_P0_IN_P3 (0x1 << 3)
#define PORT_P0_IN_P3_GET(val) ((((val) & PORT_P0_IN_P3) >> 3) & 0x1)
/* Port 0 Pin # Latched Input Value (2) */
#define PORT_P0_IN_P2 (0x1 << 2)
#define PORT_P0_IN_P2_GET(val) ((((val) & PORT_P0_IN_P2) >> 2) & 0x1)
/* Port 0 Pin # Latched Input Value (1) */
#define PORT_P0_IN_P1 (0x1 << 1)
#define PORT_P0_IN_P1_GET(val) ((((val) & PORT_P0_IN_P1) >> 1) & 0x1)
/* Port 0 Pin # Latched Input Value (0) */
#define PORT_P0_IN_P0 (0x1)
#define PORT_P0_IN_P0_GET(val) ((((val) & PORT_P0_IN_P0) >> 0) & 0x1)
/*******************************************************************************
* Port 0 Direction Register
******************************************************************************/
/* Port 0 Pin #Direction Control (19) */
#define PORT_P0_DIR_P19 (0x1 << 19)
#define PORT_P0_DIR_P19_VAL(val) (((val) & 0x1) << 19)
#define PORT_P0_DIR_P19_GET(val) ((((val) & PORT_P0_DIR_P19) >> 19) & 0x1)
#define PORT_P0_DIR_P19_SET(reg,val) (reg) = ((reg & ~PORT_P0_DIR_P19) | (((val) & 0x1) << 19))
/* Port 0 Pin #Direction Control (18) */
#define PORT_P0_DIR_P18 (0x1 << 18)
#define PORT_P0_DIR_P18_VAL(val) (((val) & 0x1) << 18)
#define PORT_P0_DIR_P18_GET(val) ((((val) & PORT_P0_DIR_P18) >> 18) & 0x1)
#define PORT_P0_DIR_P18_SET(reg,val) (reg) = ((reg & ~PORT_P0_DIR_P18) | (((val) & 0x1) << 18))
/* Port 0 Pin #Direction Control (17) */
#define PORT_P0_DIR_P17 (0x1 << 17)
#define PORT_P0_DIR_P17_VAL(val) (((val) & 0x1) << 17)
#define PORT_P0_DIR_P17_GET(val) ((((val) & PORT_P0_DIR_P17) >> 17) & 0x1)
#define PORT_P0_DIR_P17_SET(reg,val) (reg) = ((reg & ~PORT_P0_DIR_P17) | (((val) & 0x1) << 17))
/* Port 0 Pin #Direction Control (16) */
#define PORT_P0_DIR_P16 (0x1 << 16)
#define PORT_P0_DIR_P16_VAL(val) (((val) & 0x1) << 16)
#define PORT_P0_DIR_P16_GET(val) ((((val) & PORT_P0_DIR_P16) >> 16) & 0x1)
#define PORT_P0_DIR_P16_SET(reg,val) (reg) = ((reg & ~PORT_P0_DIR_P16) | (((val) & 0x1) << 16))
/* Port 0 Pin #Direction Control (15) */
#define PORT_P0_DIR_P15 (0x1 << 15)
#define PORT_P0_DIR_P15_VAL(val) (((val) & 0x1) << 15)
#define PORT_P0_DIR_P15_GET(val) ((((val) & PORT_P0_DIR_P15) >> 15) & 0x1)
#define PORT_P0_DIR_P15_SET(reg,val) (reg) = ((reg & ~PORT_P0_DIR_P15) | (((val) & 0x1) << 15))
/* Port 0 Pin #Direction Control (14) */
#define PORT_P0_DIR_P14 (0x1 << 14)
#define PORT_P0_DIR_P14_VAL(val) (((val) & 0x1) << 14)
#define PORT_P0_DIR_P14_GET(val) ((((val) & PORT_P0_DIR_P14) >> 14) & 0x1)
#define PORT_P0_DIR_P14_SET(reg,val) (reg) = ((reg & ~PORT_P0_DIR_P14) | (((val) & 0x1) << 14))
/* Port 0 Pin #Direction Control (13) */
#define PORT_P0_DIR_P13 (0x1 << 13)
#define PORT_P0_DIR_P13_VAL(val) (((val) & 0x1) << 13)
#define PORT_P0_DIR_P13_GET(val) ((((val) & PORT_P0_DIR_P13) >> 13) & 0x1)
#define PORT_P0_DIR_P13_SET(reg,val) (reg) = ((reg & ~PORT_P0_DIR_P13) | (((val) & 0x1) << 13))
/* Port 0 Pin #Direction Control (12) */
#define PORT_P0_DIR_P12 (0x1 << 12)
#define PORT_P0_DIR_P12_VAL(val) (((val) & 0x1) << 12)
#define PORT_P0_DIR_P12_GET(val) ((((val) & PORT_P0_DIR_P12) >> 12) & 0x1)
#define PORT_P0_DIR_P12_SET(reg,val) (reg) = ((reg & ~PORT_P0_DIR_P12) | (((val) & 0x1) << 12))
/* Port 0 Pin #Direction Control (11) */
#define PORT_P0_DIR_P11 (0x1 << 11)
#define PORT_P0_DIR_P11_VAL(val) (((val) & 0x1) << 11)
#define PORT_P0_DIR_P11_GET(val) ((((val) & PORT_P0_DIR_P11) >> 11) & 0x1)
#define PORT_P0_DIR_P11_SET(reg,val) (reg) = ((reg & ~PORT_P0_DIR_P11) | (((val) & 0x1) << 11))
/* Port 0 Pin #Direction Control (10) */
#define PORT_P0_DIR_P10 (0x1 << 10)
#define PORT_P0_DIR_P10_VAL(val) (((val) & 0x1) << 10)
#define PORT_P0_DIR_P10_GET(val) ((((val) & PORT_P0_DIR_P10) >> 10) & 0x1)
#define PORT_P0_DIR_P10_SET(reg,val) (reg) = ((reg & ~PORT_P0_DIR_P10) | (((val) & 0x1) << 10))
/* Port 0 Pin #Direction Control (9) */
#define PORT_P0_DIR_P9 (0x1 << 9)
#define PORT_P0_DIR_P9_VAL(val) (((val) & 0x1) << 9)
#define PORT_P0_DIR_P9_GET(val) ((((val) & PORT_P0_DIR_P9) >> 9) & 0x1)
#define PORT_P0_DIR_P9_SET(reg,val) (reg) = ((reg & ~PORT_P0_DIR_P9) | (((val) & 0x1) << 9))
/* Port 0 Pin #Direction Control (8) */
#define PORT_P0_DIR_P8 (0x1 << 8)
#define PORT_P0_DIR_P8_VAL(val) (((val) & 0x1) << 8)
#define PORT_P0_DIR_P8_GET(val) ((((val) & PORT_P0_DIR_P8) >> 8) & 0x1)
#define PORT_P0_DIR_P8_SET(reg,val) (reg) = ((reg & ~PORT_P0_DIR_P8) | (((val) & 0x1) << 8))
/* Port 0 Pin #Direction Control (7) */
#define PORT_P0_DIR_P7 (0x1 << 7)
#define PORT_P0_DIR_P7_VAL(val) (((val) & 0x1) << 7)
#define PORT_P0_DIR_P7_GET(val) ((((val) & PORT_P0_DIR_P7) >> 7) & 0x1)
#define PORT_P0_DIR_P7_SET(reg,val) (reg) = ((reg & ~PORT_P0_DIR_P7) | (((val) & 0x1) << 7))
/* Port 0 Pin #Direction Control (6) */
#define PORT_P0_DIR_P6 (0x1 << 6)
#define PORT_P0_DIR_P6_VAL(val) (((val) & 0x1) << 6)
#define PORT_P0_DIR_P6_GET(val) ((((val) & PORT_P0_DIR_P6) >> 6) & 0x1)
#define PORT_P0_DIR_P6_SET(reg,val) (reg) = ((reg & ~PORT_P0_DIR_P6) | (((val) & 0x1) << 6))
/* Port 0 Pin #Direction Control (5) */
#define PORT_P0_DIR_P5 (0x1 << 5)
#define PORT_P0_DIR_P5_VAL(val) (((val) & 0x1) << 5)
#define PORT_P0_DIR_P5_GET(val) ((((val) & PORT_P0_DIR_P5) >> 5) & 0x1)
#define PORT_P0_DIR_P5_SET(reg,val) (reg) = ((reg & ~PORT_P0_DIR_P5) | (((val) & 0x1) << 5))
/* Port 0 Pin #Direction Control (4) */
#define PORT_P0_DIR_P4 (0x1 << 4)
#define PORT_P0_DIR_P4_VAL(val) (((val) & 0x1) << 4)
#define PORT_P0_DIR_P4_GET(val) ((((val) & PORT_P0_DIR_P4) >> 4) & 0x1)
#define PORT_P0_DIR_P4_SET(reg,val) (reg) = ((reg & ~PORT_P0_DIR_P4) | (((val) & 0x1) << 4))
/* Port 0 Pin #Direction Control (3) */
#define PORT_P0_DIR_P3 (0x1 << 3)
#define PORT_P0_DIR_P3_VAL(val) (((val) & 0x1) << 3)
#define PORT_P0_DIR_P3_GET(val) ((((val) & PORT_P0_DIR_P3) >> 3) & 0x1)
#define PORT_P0_DIR_P3_SET(reg,val) (reg) = ((reg & ~PORT_P0_DIR_P3) | (((val) & 0x1) << 3))
/* Port 0 Pin #Direction Control (2) */
#define PORT_P0_DIR_P2 (0x1 << 2)
#define PORT_P0_DIR_P2_VAL(val) (((val) & 0x1) << 2)
#define PORT_P0_DIR_P2_GET(val) ((((val) & PORT_P0_DIR_P2) >> 2) & 0x1)
#define PORT_P0_DIR_P2_SET(reg,val) (reg) = ((reg & ~PORT_P0_DIR_P2) | (((val) & 0x1) << 2))
/* Port 0 Pin #Direction Control (1) */
#define PORT_P0_DIR_P1 (0x1 << 1)
#define PORT_P0_DIR_P1_VAL(val) (((val) & 0x1) << 1)
#define PORT_P0_DIR_P1_GET(val) ((((val) & PORT_P0_DIR_P1) >> 1) & 0x1)
#define PORT_P0_DIR_P1_SET(reg,val) (reg) = ((reg & ~PORT_P0_DIR_P1) | (((val) & 0x1) << 1))
/* Port 0 Pin #Direction Control (0) */
#define PORT_P0_DIR_P0 (0x1)
#define PORT_P0_DIR_P0_VAL(val) (((val) & 0x1) << 0)
#define PORT_P0_DIR_P0_GET(val) ((((val) & PORT_P0_DIR_P0) >> 0) & 0x1)
#define PORT_P0_DIR_P0_SET(reg,val) (reg) = ((reg & ~PORT_P0_DIR_P0) | (((val) & 0x1) << 0))
/*******************************************************************************
* Port 0 Alternate Function Select Register 0
******************************************************************************/
/* Alternate Function at Port 0 Bit # (19) */
#define PORT_P0_ALTSEL0_P19 (0x1 << 19)
#define PORT_P0_ALTSEL0_P19_VAL(val) (((val) & 0x1) << 19)
#define PORT_P0_ALTSEL0_P19_GET(val) ((((val) & PORT_P0_ALTSEL0_P19) >> 19) & 0x1)
#define PORT_P0_ALTSEL0_P19_SET(reg,val) (reg) = ((reg & ~PORT_P0_ALTSEL0_P19) | (((val) & 0x1) << 19))
/* Alternate Function at Port 0 Bit # (18) */
#define PORT_P0_ALTSEL0_P18 (0x1 << 18)
#define PORT_P0_ALTSEL0_P18_VAL(val) (((val) & 0x1) << 18)
#define PORT_P0_ALTSEL0_P18_GET(val) ((((val) & PORT_P0_ALTSEL0_P18) >> 18) & 0x1)
#define PORT_P0_ALTSEL0_P18_SET(reg,val) (reg) = ((reg & ~PORT_P0_ALTSEL0_P18) | (((val) & 0x1) << 18))
/* Alternate Function at Port 0 Bit # (17) */
#define PORT_P0_ALTSEL0_P17 (0x1 << 17)
#define PORT_P0_ALTSEL0_P17_VAL(val) (((val) & 0x1) << 17)
#define PORT_P0_ALTSEL0_P17_GET(val) ((((val) & PORT_P0_ALTSEL0_P17) >> 17) & 0x1)
#define PORT_P0_ALTSEL0_P17_SET(reg,val) (reg) = ((reg & ~PORT_P0_ALTSEL0_P17) | (((val) & 0x1) << 17))
/* Alternate Function at Port 0 Bit # (16) */
#define PORT_P0_ALTSEL0_P16 (0x1 << 16)
#define PORT_P0_ALTSEL0_P16_VAL(val) (((val) & 0x1) << 16)
#define PORT_P0_ALTSEL0_P16_GET(val) ((((val) & PORT_P0_ALTSEL0_P16) >> 16) & 0x1)
#define PORT_P0_ALTSEL0_P16_SET(reg,val) (reg) = ((reg & ~PORT_P0_ALTSEL0_P16) | (((val) & 0x1) << 16))
/* Alternate Function at Port 0 Bit # (15) */
#define PORT_P0_ALTSEL0_P15 (0x1 << 15)
#define PORT_P0_ALTSEL0_P15_VAL(val) (((val) & 0x1) << 15)
#define PORT_P0_ALTSEL0_P15_GET(val) ((((val) & PORT_P0_ALTSEL0_P15) >> 15) & 0x1)
#define PORT_P0_ALTSEL0_P15_SET(reg,val) (reg) = ((reg & ~PORT_P0_ALTSEL0_P15) | (((val) & 0x1) << 15))
/* Alternate Function at Port 0 Bit # (14) */
#define PORT_P0_ALTSEL0_P14 (0x1 << 14)
#define PORT_P0_ALTSEL0_P14_VAL(val) (((val) & 0x1) << 14)
#define PORT_P0_ALTSEL0_P14_GET(val) ((((val) & PORT_P0_ALTSEL0_P14) >> 14) & 0x1)
#define PORT_P0_ALTSEL0_P14_SET(reg,val) (reg) = ((reg & ~PORT_P0_ALTSEL0_P14) | (((val) & 0x1) << 14))
/* Alternate Function at Port 0 Bit # (13) */
#define PORT_P0_ALTSEL0_P13 (0x1 << 13)
#define PORT_P0_ALTSEL0_P13_VAL(val) (((val) & 0x1) << 13)
#define PORT_P0_ALTSEL0_P13_GET(val) ((((val) & PORT_P0_ALTSEL0_P13) >> 13) & 0x1)
#define PORT_P0_ALTSEL0_P13_SET(reg,val) (reg) = ((reg & ~PORT_P0_ALTSEL0_P13) | (((val) & 0x1) << 13))
/* Alternate Function at Port 0 Bit # (12) */
#define PORT_P0_ALTSEL0_P12 (0x1 << 12)
#define PORT_P0_ALTSEL0_P12_VAL(val) (((val) & 0x1) << 12)
#define PORT_P0_ALTSEL0_P12_GET(val) ((((val) & PORT_P0_ALTSEL0_P12) >> 12) & 0x1)
#define PORT_P0_ALTSEL0_P12_SET(reg,val) (reg) = ((reg & ~PORT_P0_ALTSEL0_P12) | (((val) & 0x1) << 12))
/* Alternate Function at Port 0 Bit # (11) */
#define PORT_P0_ALTSEL0_P11 (0x1 << 11)
#define PORT_P0_ALTSEL0_P11_VAL(val) (((val) & 0x1) << 11)
#define PORT_P0_ALTSEL0_P11_GET(val) ((((val) & PORT_P0_ALTSEL0_P11) >> 11) & 0x1)
#define PORT_P0_ALTSEL0_P11_SET(reg,val) (reg) = ((reg & ~PORT_P0_ALTSEL0_P11) | (((val) & 0x1) << 11))
/* Alternate Function at Port 0 Bit # (10) */
#define PORT_P0_ALTSEL0_P10 (0x1 << 10)
#define PORT_P0_ALTSEL0_P10_VAL(val) (((val) & 0x1) << 10)
#define PORT_P0_ALTSEL0_P10_GET(val) ((((val) & PORT_P0_ALTSEL0_P10) >> 10) & 0x1)
#define PORT_P0_ALTSEL0_P10_SET(reg,val) (reg) = ((reg & ~PORT_P0_ALTSEL0_P10) | (((val) & 0x1) << 10))
/* Alternate Function at Port 0 Bit # (9) */
#define PORT_P0_ALTSEL0_P9 (0x1 << 9)
#define PORT_P0_ALTSEL0_P9_VAL(val) (((val) & 0x1) << 9)
#define PORT_P0_ALTSEL0_P9_GET(val) ((((val) & PORT_P0_ALTSEL0_P9) >> 9) & 0x1)
#define PORT_P0_ALTSEL0_P9_SET(reg,val) (reg) = ((reg & ~PORT_P0_ALTSEL0_P9) | (((val) & 0x1) << 9))
/* Alternate Function at Port 0 Bit # (8) */
#define PORT_P0_ALTSEL0_P8 (0x1 << 8)
#define PORT_P0_ALTSEL0_P8_VAL(val) (((val) & 0x1) << 8)
#define PORT_P0_ALTSEL0_P8_GET(val) ((((val) & PORT_P0_ALTSEL0_P8) >> 8) & 0x1)
#define PORT_P0_ALTSEL0_P8_SET(reg,val) (reg) = ((reg & ~PORT_P0_ALTSEL0_P8) | (((val) & 0x1) << 8))
/* Alternate Function at Port 0 Bit # (7) */
#define PORT_P0_ALTSEL0_P7 (0x1 << 7)
#define PORT_P0_ALTSEL0_P7_VAL(val) (((val) & 0x1) << 7)
#define PORT_P0_ALTSEL0_P7_GET(val) ((((val) & PORT_P0_ALTSEL0_P7) >> 7) & 0x1)
#define PORT_P0_ALTSEL0_P7_SET(reg,val) (reg) = ((reg & ~PORT_P0_ALTSEL0_P7) | (((val) & 0x1) << 7))
/* Alternate Function at Port 0 Bit # (6) */
#define PORT_P0_ALTSEL0_P6 (0x1 << 6)
#define PORT_P0_ALTSEL0_P6_VAL(val) (((val) & 0x1) << 6)
#define PORT_P0_ALTSEL0_P6_GET(val) ((((val) & PORT_P0_ALTSEL0_P6) >> 6) & 0x1)
#define PORT_P0_ALTSEL0_P6_SET(reg,val) (reg) = ((reg & ~PORT_P0_ALTSEL0_P6) | (((val) & 0x1) << 6))
/* Alternate Function at Port 0 Bit # (5) */
#define PORT_P0_ALTSEL0_P5 (0x1 << 5)
#define PORT_P0_ALTSEL0_P5_VAL(val) (((val) & 0x1) << 5)
#define PORT_P0_ALTSEL0_P5_GET(val) ((((val) & PORT_P0_ALTSEL0_P5) >> 5) & 0x1)
#define PORT_P0_ALTSEL0_P5_SET(reg,val) (reg) = ((reg & ~PORT_P0_ALTSEL0_P5) | (((val) & 0x1) << 5))
/* Alternate Function at Port 0 Bit # (4) */
#define PORT_P0_ALTSEL0_P4 (0x1 << 4)
#define PORT_P0_ALTSEL0_P4_VAL(val) (((val) & 0x1) << 4)
#define PORT_P0_ALTSEL0_P4_GET(val) ((((val) & PORT_P0_ALTSEL0_P4) >> 4) & 0x1)
#define PORT_P0_ALTSEL0_P4_SET(reg,val) (reg) = ((reg & ~PORT_P0_ALTSEL0_P4) | (((val) & 0x1) << 4))
/* Alternate Function at Port 0 Bit # (3) */
#define PORT_P0_ALTSEL0_P3 (0x1 << 3)
#define PORT_P0_ALTSEL0_P3_VAL(val) (((val) & 0x1) << 3)
#define PORT_P0_ALTSEL0_P3_GET(val) ((((val) & PORT_P0_ALTSEL0_P3) >> 3) & 0x1)
#define PORT_P0_ALTSEL0_P3_SET(reg,val) (reg) = ((reg & ~PORT_P0_ALTSEL0_P3) | (((val) & 0x1) << 3))
/* Alternate Function at Port 0 Bit # (2) */
#define PORT_P0_ALTSEL0_P2 (0x1 << 2)
#define PORT_P0_ALTSEL0_P2_VAL(val) (((val) & 0x1) << 2)
#define PORT_P0_ALTSEL0_P2_GET(val) ((((val) & PORT_P0_ALTSEL0_P2) >> 2) & 0x1)
#define PORT_P0_ALTSEL0_P2_SET(reg,val) (reg) = ((reg & ~PORT_P0_ALTSEL0_P2) | (((val) & 0x1) << 2))
/* Alternate Function at Port 0 Bit # (1) */
#define PORT_P0_ALTSEL0_P1 (0x1 << 1)
#define PORT_P0_ALTSEL0_P1_VAL(val) (((val) & 0x1) << 1)
#define PORT_P0_ALTSEL0_P1_GET(val) ((((val) & PORT_P0_ALTSEL0_P1) >> 1) & 0x1)
#define PORT_P0_ALTSEL0_P1_SET(reg,val) (reg) = ((reg & ~PORT_P0_ALTSEL0_P1) | (((val) & 0x1) << 1))
/* Alternate Function at Port 0 Bit # (0) */
#define PORT_P0_ALTSEL0_P0 (0x1)
#define PORT_P0_ALTSEL0_P0_VAL(val) (((val) & 0x1) << 0)
#define PORT_P0_ALTSEL0_P0_GET(val) ((((val) & PORT_P0_ALTSEL0_P0) >> 0) & 0x1)
#define PORT_P0_ALTSEL0_P0_SET(reg,val) (reg) = ((reg & ~PORT_P0_ALTSEL0_P0) | (((val) & 0x1) << 0))
/*******************************************************************************
* Port 0 Alternate Function Select Register 1
******************************************************************************/
/* Alternate Function at Port 0 Bit # (13) */
#define PORT_P0_ALTSEL1_P13 (0x1 << 13)
#define PORT_P0_ALTSEL1_P13_VAL(val) (((val) & 0x1) << 13)
#define PORT_P0_ALTSEL1_P13_GET(val) ((((val) & PORT_P0_ALTSEL1_P13) >> 13) & 0x1)
#define PORT_P0_ALTSEL1_P13_SET(reg,val) (reg) = ((reg & ~PORT_P0_ALTSEL1_P13) | (((val) & 0x1) << 13))
/* Alternate Function at Port 0 Bit # (12) */
#define PORT_P0_ALTSEL1_P12 (0x1 << 12)
#define PORT_P0_ALTSEL1_P12_VAL(val) (((val) & 0x1) << 12)
#define PORT_P0_ALTSEL1_P12_GET(val) ((((val) & PORT_P0_ALTSEL1_P12) >> 12) & 0x1)
#define PORT_P0_ALTSEL1_P12_SET(reg,val) (reg) = ((reg & ~PORT_P0_ALTSEL1_P12) | (((val) & 0x1) << 12))
/* Alternate Function at Port 0 Bit # (11) */
#define PORT_P0_ALTSEL1_P11 (0x1 << 11)
#define PORT_P0_ALTSEL1_P11_VAL(val) (((val) & 0x1) << 11)
#define PORT_P0_ALTSEL1_P11_GET(val) ((((val) & PORT_P0_ALTSEL1_P11) >> 11) & 0x1)
#define PORT_P0_ALTSEL1_P11_SET(reg,val) (reg) = ((reg & ~PORT_P0_ALTSEL1_P11) | (((val) & 0x1) << 11))
/* Alternate Function at Port 0 Bit # (10) */
#define PORT_P0_ALTSEL1_P10 (0x1 << 10)
#define PORT_P0_ALTSEL1_P10_VAL(val) (((val) & 0x1) << 10)
#define PORT_P0_ALTSEL1_P10_GET(val) ((((val) & PORT_P0_ALTSEL1_P10) >> 10) & 0x1)
#define PORT_P0_ALTSEL1_P10_SET(reg,val) (reg) = ((reg & ~PORT_P0_ALTSEL1_P10) | (((val) & 0x1) << 10))
/* Alternate Function at Port 0 Bit # (9) */
#define PORT_P0_ALTSEL1_P9 (0x1 << 9)
#define PORT_P0_ALTSEL1_P9_VAL(val) (((val) & 0x1) << 9)
#define PORT_P0_ALTSEL1_P9_GET(val) ((((val) & PORT_P0_ALTSEL1_P9) >> 9) & 0x1)
#define PORT_P0_ALTSEL1_P9_SET(reg,val) (reg) = ((reg & ~PORT_P0_ALTSEL1_P9) | (((val) & 0x1) << 9))
/* Alternate Function at Port 0 Bit # (8) */
#define PORT_P0_ALTSEL1_P8 (0x1 << 8)
#define PORT_P0_ALTSEL1_P8_VAL(val) (((val) & 0x1) << 8)
#define PORT_P0_ALTSEL1_P8_GET(val) ((((val) & PORT_P0_ALTSEL1_P8) >> 8) & 0x1)
#define PORT_P0_ALTSEL1_P8_SET(reg,val) (reg) = ((reg & ~PORT_P0_ALTSEL1_P8) | (((val) & 0x1) << 8))
/* Alternate Function at Port 0 Bit # (7) */
#define PORT_P0_ALTSEL1_P7 (0x1 << 7)
#define PORT_P0_ALTSEL1_P7_VAL(val) (((val) & 0x1) << 7)
#define PORT_P0_ALTSEL1_P7_GET(val) ((((val) & PORT_P0_ALTSEL1_P7) >> 7) & 0x1)
#define PORT_P0_ALTSEL1_P7_SET(reg,val) (reg) = ((reg & ~PORT_P0_ALTSEL1_P7) | (((val) & 0x1) << 7))
/* Alternate Function at Port 0 Bit # (6) */
#define PORT_P0_ALTSEL1_P6 (0x1 << 6)
#define PORT_P0_ALTSEL1_P6_VAL(val) (((val) & 0x1) << 6)
#define PORT_P0_ALTSEL1_P6_GET(val) ((((val) & PORT_P0_ALTSEL1_P6) >> 6) & 0x1)
#define PORT_P0_ALTSEL1_P6_SET(reg,val) (reg) = ((reg & ~PORT_P0_ALTSEL1_P6) | (((val) & 0x1) << 6))
/* Alternate Function at Port 0 Bit # (3) */
#define PORT_P0_ALTSEL1_P3 (0x1 << 3)
#define PORT_P0_ALTSEL1_P3_VAL(val) (((val) & 0x1) << 3)
#define PORT_P0_ALTSEL1_P3_GET(val) ((((val) & PORT_P0_ALTSEL1_P3) >> 3) & 0x1)
#define PORT_P0_ALTSEL1_P3_SET(reg,val) (reg) = ((reg & ~PORT_P0_ALTSEL1_P3) | (((val) & 0x1) << 3))
/*******************************************************************************
* Port 0 Pull Up Enable Register
******************************************************************************/
/* Pull Up Device Enable at Port 0 Bit # (19) */
#define PORT_P0_PUEN_P19 (0x1 << 19)
#define PORT_P0_PUEN_P19_VAL(val) (((val) & 0x1) << 19)
#define PORT_P0_PUEN_P19_GET(val) ((((val) & PORT_P0_PUEN_P19) >> 19) & 0x1)
#define PORT_P0_PUEN_P19_SET(reg,val) (reg) = ((reg & ~PORT_P0_PUEN_P19) | (((val) & 0x1) << 19))
/* Pull Up Device Enable at Port 0 Bit # (18) */
#define PORT_P0_PUEN_P18 (0x1 << 18)
#define PORT_P0_PUEN_P18_VAL(val) (((val) & 0x1) << 18)
#define PORT_P0_PUEN_P18_GET(val) ((((val) & PORT_P0_PUEN_P18) >> 18) & 0x1)
#define PORT_P0_PUEN_P18_SET(reg,val) (reg) = ((reg & ~PORT_P0_PUEN_P18) | (((val) & 0x1) << 18))
/* Pull Up Device Enable at Port 0 Bit # (17) */
#define PORT_P0_PUEN_P17 (0x1 << 17)
#define PORT_P0_PUEN_P17_VAL(val) (((val) & 0x1) << 17)
#define PORT_P0_PUEN_P17_GET(val) ((((val) & PORT_P0_PUEN_P17) >> 17) & 0x1)
#define PORT_P0_PUEN_P17_SET(reg,val) (reg) = ((reg & ~PORT_P0_PUEN_P17) | (((val) & 0x1) << 17))
/* Pull Up Device Enable at Port 0 Bit # (16) */
#define PORT_P0_PUEN_P16 (0x1 << 16)
#define PORT_P0_PUEN_P16_VAL(val) (((val) & 0x1) << 16)
#define PORT_P0_PUEN_P16_GET(val) ((((val) & PORT_P0_PUEN_P16) >> 16) & 0x1)
#define PORT_P0_PUEN_P16_SET(reg,val) (reg) = ((reg & ~PORT_P0_PUEN_P16) | (((val) & 0x1) << 16))
/* Pull Up Device Enable at Port 0 Bit # (15) */
#define PORT_P0_PUEN_P15 (0x1 << 15)
#define PORT_P0_PUEN_P15_VAL(val) (((val) & 0x1) << 15)
#define PORT_P0_PUEN_P15_GET(val) ((((val) & PORT_P0_PUEN_P15) >> 15) & 0x1)
#define PORT_P0_PUEN_P15_SET(reg,val) (reg) = ((reg & ~PORT_P0_PUEN_P15) | (((val) & 0x1) << 15))
/* Pull Up Device Enable at Port 0 Bit # (14) */
#define PORT_P0_PUEN_P14 (0x1 << 14)
#define PORT_P0_PUEN_P14_VAL(val) (((val) & 0x1) << 14)
#define PORT_P0_PUEN_P14_GET(val) ((((val) & PORT_P0_PUEN_P14) >> 14) & 0x1)
#define PORT_P0_PUEN_P14_SET(reg,val) (reg) = ((reg & ~PORT_P0_PUEN_P14) | (((val) & 0x1) << 14))
/* Pull Up Device Enable at Port 0 Bit # (13) */
#define PORT_P0_PUEN_P13 (0x1 << 13)
#define PORT_P0_PUEN_P13_VAL(val) (((val) & 0x1) << 13)
#define PORT_P0_PUEN_P13_GET(val) ((((val) & PORT_P0_PUEN_P13) >> 13) & 0x1)
#define PORT_P0_PUEN_P13_SET(reg,val) (reg) = ((reg & ~PORT_P0_PUEN_P13) | (((val) & 0x1) << 13))
/* Pull Up Device Enable at Port 0 Bit # (12) */
#define PORT_P0_PUEN_P12 (0x1 << 12)
#define PORT_P0_PUEN_P12_VAL(val) (((val) & 0x1) << 12)
#define PORT_P0_PUEN_P12_GET(val) ((((val) & PORT_P0_PUEN_P12) >> 12) & 0x1)
#define PORT_P0_PUEN_P12_SET(reg,val) (reg) = ((reg & ~PORT_P0_PUEN_P12) | (((val) & 0x1) << 12))
/* Pull Up Device Enable at Port 0 Bit # (11) */
#define PORT_P0_PUEN_P11 (0x1 << 11)
#define PORT_P0_PUEN_P11_VAL(val) (((val) & 0x1) << 11)
#define PORT_P0_PUEN_P11_GET(val) ((((val) & PORT_P0_PUEN_P11) >> 11) & 0x1)
#define PORT_P0_PUEN_P11_SET(reg,val) (reg) = ((reg & ~PORT_P0_PUEN_P11) | (((val) & 0x1) << 11))
/* Pull Up Device Enable at Port 0 Bit # (10) */
#define PORT_P0_PUEN_P10 (0x1 << 10)
#define PORT_P0_PUEN_P10_VAL(val) (((val) & 0x1) << 10)
#define PORT_P0_PUEN_P10_GET(val) ((((val) & PORT_P0_PUEN_P10) >> 10) & 0x1)
#define PORT_P0_PUEN_P10_SET(reg,val) (reg) = ((reg & ~PORT_P0_PUEN_P10) | (((val) & 0x1) << 10))
/* Pull Up Device Enable at Port 0 Bit # (9) */
#define PORT_P0_PUEN_P9 (0x1 << 9)
#define PORT_P0_PUEN_P9_VAL(val) (((val) & 0x1) << 9)
#define PORT_P0_PUEN_P9_GET(val) ((((val) & PORT_P0_PUEN_P9) >> 9) & 0x1)
#define PORT_P0_PUEN_P9_SET(reg,val) (reg) = ((reg & ~PORT_P0_PUEN_P9) | (((val) & 0x1) << 9))
/* Pull Up Device Enable at Port 0 Bit # (8) */
#define PORT_P0_PUEN_P8 (0x1 << 8)
#define PORT_P0_PUEN_P8_VAL(val) (((val) & 0x1) << 8)
#define PORT_P0_PUEN_P8_GET(val) ((((val) & PORT_P0_PUEN_P8) >> 8) & 0x1)
#define PORT_P0_PUEN_P8_SET(reg,val) (reg) = ((reg & ~PORT_P0_PUEN_P8) | (((val) & 0x1) << 8))
/* Pull Up Device Enable at Port 0 Bit # (7) */
#define PORT_P0_PUEN_P7 (0x1 << 7)
#define PORT_P0_PUEN_P7_VAL(val) (((val) & 0x1) << 7)
#define PORT_P0_PUEN_P7_GET(val) ((((val) & PORT_P0_PUEN_P7) >> 7) & 0x1)
#define PORT_P0_PUEN_P7_SET(reg,val) (reg) = ((reg & ~PORT_P0_PUEN_P7) | (((val) & 0x1) << 7))
/* Pull Up Device Enable at Port 0 Bit # (6) */
#define PORT_P0_PUEN_P6 (0x1 << 6)
#define PORT_P0_PUEN_P6_VAL(val) (((val) & 0x1) << 6)
#define PORT_P0_PUEN_P6_GET(val) ((((val) & PORT_P0_PUEN_P6) >> 6) & 0x1)
#define PORT_P0_PUEN_P6_SET(reg,val) (reg) = ((reg & ~PORT_P0_PUEN_P6) | (((val) & 0x1) << 6))
/* Pull Up Device Enable at Port 0 Bit # (5) */
#define PORT_P0_PUEN_P5 (0x1 << 5)
#define PORT_P0_PUEN_P5_VAL(val) (((val) & 0x1) << 5)
#define PORT_P0_PUEN_P5_GET(val) ((((val) & PORT_P0_PUEN_P5) >> 5) & 0x1)
#define PORT_P0_PUEN_P5_SET(reg,val) (reg) = ((reg & ~PORT_P0_PUEN_P5) | (((val) & 0x1) << 5))
/* Pull Up Device Enable at Port 0 Bit # (4) */
#define PORT_P0_PUEN_P4 (0x1 << 4)
#define PORT_P0_PUEN_P4_VAL(val) (((val) & 0x1) << 4)
#define PORT_P0_PUEN_P4_GET(val) ((((val) & PORT_P0_PUEN_P4) >> 4) & 0x1)
#define PORT_P0_PUEN_P4_SET(reg,val) (reg) = ((reg & ~PORT_P0_PUEN_P4) | (((val) & 0x1) << 4))
/* Pull Up Device Enable at Port 0 Bit # (3) */
#define PORT_P0_PUEN_P3 (0x1 << 3)
#define PORT_P0_PUEN_P3_VAL(val) (((val) & 0x1) << 3)
#define PORT_P0_PUEN_P3_GET(val) ((((val) & PORT_P0_PUEN_P3) >> 3) & 0x1)
#define PORT_P0_PUEN_P3_SET(reg,val) (reg) = ((reg & ~PORT_P0_PUEN_P3) | (((val) & 0x1) << 3))
/* Pull Up Device Enable at Port 0 Bit # (2) */
#define PORT_P0_PUEN_P2 (0x1 << 2)
#define PORT_P0_PUEN_P2_VAL(val) (((val) & 0x1) << 2)
#define PORT_P0_PUEN_P2_GET(val) ((((val) & PORT_P0_PUEN_P2) >> 2) & 0x1)
#define PORT_P0_PUEN_P2_SET(reg,val) (reg) = ((reg & ~PORT_P0_PUEN_P2) | (((val) & 0x1) << 2))
/* Pull Up Device Enable at Port 0 Bit # (1) */
#define PORT_P0_PUEN_P1 (0x1 << 1)
#define PORT_P0_PUEN_P1_VAL(val) (((val) & 0x1) << 1)
#define PORT_P0_PUEN_P1_GET(val) ((((val) & PORT_P0_PUEN_P1) >> 1) & 0x1)
#define PORT_P0_PUEN_P1_SET(reg,val) (reg) = ((reg & ~PORT_P0_PUEN_P1) | (((val) & 0x1) << 1))
/* Pull Up Device Enable at Port 0 Bit # (0) */
#define PORT_P0_PUEN_P0 (0x1)
#define PORT_P0_PUEN_P0_VAL(val) (((val) & 0x1) << 0)
#define PORT_P0_PUEN_P0_GET(val) ((((val) & PORT_P0_PUEN_P0) >> 0) & 0x1)
#define PORT_P0_PUEN_P0_SET(reg,val) (reg) = ((reg & ~PORT_P0_PUEN_P0) | (((val) & 0x1) << 0))
/*******************************************************************************
* External Interrupt Control Register 0
******************************************************************************/
/* Type of Level or Edge Detection of EXINT16 (19) */
#define PORT_P0_EXINTCR0_EXINT16 (0x1 << 19)
#define PORT_P0_EXINTCR0_EXINT16_VAL(val) (((val) & 0x1) << 19)
#define PORT_P0_EXINTCR0_EXINT16_GET(val) ((((val) & PORT_P0_EXINTCR0_EXINT16) >> 19) & 0x1)
#define PORT_P0_EXINTCR0_EXINT16_SET(reg,val) (reg) = ((reg & ~PORT_P0_EXINTCR0_EXINT16) | (((val) & 0x1) << 19))
/* Type of Level or Edge Detection of EXINT10 (17) */
#define PORT_P0_EXINTCR0_EXINT10 (0x1 << 17)
#define PORT_P0_EXINTCR0_EXINT10_VAL(val) (((val) & 0x1) << 17)
#define PORT_P0_EXINTCR0_EXINT10_GET(val) ((((val) & PORT_P0_EXINTCR0_EXINT10) >> 17) & 0x1)
#define PORT_P0_EXINTCR0_EXINT10_SET(reg,val) (reg) = ((reg & ~PORT_P0_EXINTCR0_EXINT10) | (((val) & 0x1) << 17))
/* Type of Level or Edge Detection of EXINT9 (16) */
#define PORT_P0_EXINTCR0_EXINT9 (0x1 << 16)
#define PORT_P0_EXINTCR0_EXINT9_VAL(val) (((val) & 0x1) << 16)
#define PORT_P0_EXINTCR0_EXINT9_GET(val) ((((val) & PORT_P0_EXINTCR0_EXINT9) >> 16) & 0x1)
#define PORT_P0_EXINTCR0_EXINT9_SET(reg,val) (reg) = ((reg & ~PORT_P0_EXINTCR0_EXINT9) | (((val) & 0x1) << 16))
/* Type of Level or Edge Detection of EXINT8 (15) */
#define PORT_P0_EXINTCR0_EXINT8 (0x1 << 15)
#define PORT_P0_EXINTCR0_EXINT8_VAL(val) (((val) & 0x1) << 15)
#define PORT_P0_EXINTCR0_EXINT8_GET(val) ((((val) & PORT_P0_EXINTCR0_EXINT8) >> 15) & 0x1)
#define PORT_P0_EXINTCR0_EXINT8_SET(reg,val) (reg) = ((reg & ~PORT_P0_EXINTCR0_EXINT8) | (((val) & 0x1) << 15))
/* Type of Level or Edge Detection of EXINT7 (14) */
#define PORT_P0_EXINTCR0_EXINT7 (0x1 << 14)
#define PORT_P0_EXINTCR0_EXINT7_VAL(val) (((val) & 0x1) << 14)
#define PORT_P0_EXINTCR0_EXINT7_GET(val) ((((val) & PORT_P0_EXINTCR0_EXINT7) >> 14) & 0x1)
#define PORT_P0_EXINTCR0_EXINT7_SET(reg,val) (reg) = ((reg & ~PORT_P0_EXINTCR0_EXINT7) | (((val) & 0x1) << 14))
/* Type of Level or Edge Detection of EXINT6 (13) */
#define PORT_P0_EXINTCR0_EXINT6 (0x1 << 13)
#define PORT_P0_EXINTCR0_EXINT6_VAL(val) (((val) & 0x1) << 13)
#define PORT_P0_EXINTCR0_EXINT6_GET(val) ((((val) & PORT_P0_EXINTCR0_EXINT6) >> 13) & 0x1)
#define PORT_P0_EXINTCR0_EXINT6_SET(reg,val) (reg) = ((reg & ~PORT_P0_EXINTCR0_EXINT6) | (((val) & 0x1) << 13))
/* Type of Level or Edge Detection of EXINT5 (12) */
#define PORT_P0_EXINTCR0_EXINT5 (0x1 << 12)
#define PORT_P0_EXINTCR0_EXINT5_VAL(val) (((val) & 0x1) << 12)
#define PORT_P0_EXINTCR0_EXINT5_GET(val) ((((val) & PORT_P0_EXINTCR0_EXINT5) >> 12) & 0x1)
#define PORT_P0_EXINTCR0_EXINT5_SET(reg,val) (reg) = ((reg & ~PORT_P0_EXINTCR0_EXINT5) | (((val) & 0x1) << 12))
/* Type of Level or Edge Detection of EXINT4 (11) */
#define PORT_P0_EXINTCR0_EXINT4 (0x1 << 11)
#define PORT_P0_EXINTCR0_EXINT4_VAL(val) (((val) & 0x1) << 11)
#define PORT_P0_EXINTCR0_EXINT4_GET(val) ((((val) & PORT_P0_EXINTCR0_EXINT4) >> 11) & 0x1)
#define PORT_P0_EXINTCR0_EXINT4_SET(reg,val) (reg) = ((reg & ~PORT_P0_EXINTCR0_EXINT4) | (((val) & 0x1) << 11))
/* Type of Level or Edge Detection of EXINT3 (10) */
#define PORT_P0_EXINTCR0_EXINT3 (0x1 << 10)
#define PORT_P0_EXINTCR0_EXINT3_VAL(val) (((val) & 0x1) << 10)
#define PORT_P0_EXINTCR0_EXINT3_GET(val) ((((val) & PORT_P0_EXINTCR0_EXINT3) >> 10) & 0x1)
#define PORT_P0_EXINTCR0_EXINT3_SET(reg,val) (reg) = ((reg & ~PORT_P0_EXINTCR0_EXINT3) | (((val) & 0x1) << 10))
/* Type of Level or Edge Detection of EXINT2 (9) */
#define PORT_P0_EXINTCR0_EXINT2 (0x1 << 9)
#define PORT_P0_EXINTCR0_EXINT2_VAL(val) (((val) & 0x1) << 9)
#define PORT_P0_EXINTCR0_EXINT2_GET(val) ((((val) & PORT_P0_EXINTCR0_EXINT2) >> 9) & 0x1)
#define PORT_P0_EXINTCR0_EXINT2_SET(reg,val) (reg) = ((reg & ~PORT_P0_EXINTCR0_EXINT2) | (((val) & 0x1) << 9))
/* Type of Level or Edge Detection of EXINT1 (8) */
#define PORT_P0_EXINTCR0_EXINT1 (0x1 << 8)
#define PORT_P0_EXINTCR0_EXINT1_VAL(val) (((val) & 0x1) << 8)
#define PORT_P0_EXINTCR0_EXINT1_GET(val) ((((val) & PORT_P0_EXINTCR0_EXINT1) >> 8) & 0x1)
#define PORT_P0_EXINTCR0_EXINT1_SET(reg,val) (reg) = ((reg & ~PORT_P0_EXINTCR0_EXINT1) | (((val) & 0x1) << 8))
/* Type of Level or Edge Detection of EXINT0 (7) */
#define PORT_P0_EXINTCR0_EXINT0 (0x1 << 7)
#define PORT_P0_EXINTCR0_EXINT0_VAL(val) (((val) & 0x1) << 7)
#define PORT_P0_EXINTCR0_EXINT0_GET(val) ((((val) & PORT_P0_EXINTCR0_EXINT0) >> 7) & 0x1)
#define PORT_P0_EXINTCR0_EXINT0_SET(reg,val) (reg) = ((reg & ~PORT_P0_EXINTCR0_EXINT0) | (((val) & 0x1) << 7))
/*******************************************************************************
* External Interrupt Control Register 1
******************************************************************************/
/* Type of Level or Edge Detection of EXINT16 (19) */
#define PORT_P0_EXINTCR1_EXINT16 (0x1 << 19)
#define PORT_P0_EXINTCR1_EXINT16_VAL(val) (((val) & 0x1) << 19)
#define PORT_P0_EXINTCR1_EXINT16_GET(val) ((((val) & PORT_P0_EXINTCR1_EXINT16) >> 19) & 0x1)
#define PORT_P0_EXINTCR1_EXINT16_SET(reg,val) (reg) = ((reg & ~PORT_P0_EXINTCR1_EXINT16) | (((val) & 0x1) << 19))
/* Type of Level or Edge Detection of EXINT10 (17) */
#define PORT_P0_EXINTCR1_EXINT10 (0x1 << 17)
#define PORT_P0_EXINTCR1_EXINT10_VAL(val) (((val) & 0x1) << 17)
#define PORT_P0_EXINTCR1_EXINT10_GET(val) ((((val) & PORT_P0_EXINTCR1_EXINT10) >> 17) & 0x1)
#define PORT_P0_EXINTCR1_EXINT10_SET(reg,val) (reg) = ((reg & ~PORT_P0_EXINTCR1_EXINT10) | (((val) & 0x1) << 17))
/* Type of Level or Edge Detection of EXINT9 (16) */
#define PORT_P0_EXINTCR1_EXINT9 (0x1 << 16)
#define PORT_P0_EXINTCR1_EXINT9_VAL(val) (((val) & 0x1) << 16)
#define PORT_P0_EXINTCR1_EXINT9_GET(val) ((((val) & PORT_P0_EXINTCR1_EXINT9) >> 16) & 0x1)
#define PORT_P0_EXINTCR1_EXINT9_SET(reg,val) (reg) = ((reg & ~PORT_P0_EXINTCR1_EXINT9) | (((val) & 0x1) << 16))
/* Type of Level or Edge Detection of EXINT8 (15) */
#define PORT_P0_EXINTCR1_EXINT8 (0x1 << 15)
#define PORT_P0_EXINTCR1_EXINT8_VAL(val) (((val) & 0x1) << 15)
#define PORT_P0_EXINTCR1_EXINT8_GET(val) ((((val) & PORT_P0_EXINTCR1_EXINT8) >> 15) & 0x1)
#define PORT_P0_EXINTCR1_EXINT8_SET(reg,val) (reg) = ((reg & ~PORT_P0_EXINTCR1_EXINT8) | (((val) & 0x1) << 15))
/* Type of Level or Edge Detection of EXINT7 (14) */
#define PORT_P0_EXINTCR1_EXINT7 (0x1 << 14)
#define PORT_P0_EXINTCR1_EXINT7_VAL(val) (((val) & 0x1) << 14)
#define PORT_P0_EXINTCR1_EXINT7_GET(val) ((((val) & PORT_P0_EXINTCR1_EXINT7) >> 14) & 0x1)
#define PORT_P0_EXINTCR1_EXINT7_SET(reg,val) (reg) = ((reg & ~PORT_P0_EXINTCR1_EXINT7) | (((val) & 0x1) << 14))
/* Type of Level or Edge Detection of EXINT6 (13) */
#define PORT_P0_EXINTCR1_EXINT6 (0x1 << 13)
#define PORT_P0_EXINTCR1_EXINT6_VAL(val) (((val) & 0x1) << 13)
#define PORT_P0_EXINTCR1_EXINT6_GET(val) ((((val) & PORT_P0_EXINTCR1_EXINT6) >> 13) & 0x1)
#define PORT_P0_EXINTCR1_EXINT6_SET(reg,val) (reg) = ((reg & ~PORT_P0_EXINTCR1_EXINT6) | (((val) & 0x1) << 13))
/* Type of Level or Edge Detection of EXINT5 (12) */
#define PORT_P0_EXINTCR1_EXINT5 (0x1 << 12)
#define PORT_P0_EXINTCR1_EXINT5_VAL(val) (((val) & 0x1) << 12)
#define PORT_P0_EXINTCR1_EXINT5_GET(val) ((((val) & PORT_P0_EXINTCR1_EXINT5) >> 12) & 0x1)
#define PORT_P0_EXINTCR1_EXINT5_SET(reg,val) (reg) = ((reg & ~PORT_P0_EXINTCR1_EXINT5) | (((val) & 0x1) << 12))
/* Type of Level or Edge Detection of EXINT4 (11) */
#define PORT_P0_EXINTCR1_EXINT4 (0x1 << 11)
#define PORT_P0_EXINTCR1_EXINT4_VAL(val) (((val) & 0x1) << 11)
#define PORT_P0_EXINTCR1_EXINT4_GET(val) ((((val) & PORT_P0_EXINTCR1_EXINT4) >> 11) & 0x1)
#define PORT_P0_EXINTCR1_EXINT4_SET(reg,val) (reg) = ((reg & ~PORT_P0_EXINTCR1_EXINT4) | (((val) & 0x1) << 11))
/* Type of Level or Edge Detection of EXINT3 (10) */
#define PORT_P0_EXINTCR1_EXINT3 (0x1 << 10)
#define PORT_P0_EXINTCR1_EXINT3_VAL(val) (((val) & 0x1) << 10)
#define PORT_P0_EXINTCR1_EXINT3_GET(val) ((((val) & PORT_P0_EXINTCR1_EXINT3) >> 10) & 0x1)
#define PORT_P0_EXINTCR1_EXINT3_SET(reg,val) (reg) = ((reg & ~PORT_P0_EXINTCR1_EXINT3) | (((val) & 0x1) << 10))
/* Type of Level or Edge Detection of EXINT2 (9) */
#define PORT_P0_EXINTCR1_EXINT2 (0x1 << 9)
#define PORT_P0_EXINTCR1_EXINT2_VAL(val) (((val) & 0x1) << 9)
#define PORT_P0_EXINTCR1_EXINT2_GET(val) ((((val) & PORT_P0_EXINTCR1_EXINT2) >> 9) & 0x1)
#define PORT_P0_EXINTCR1_EXINT2_SET(reg,val) (reg) = ((reg & ~PORT_P0_EXINTCR1_EXINT2) | (((val) & 0x1) << 9))
/* Type of Level or Edge Detection of EXINT1 (8) */
#define PORT_P0_EXINTCR1_EXINT1 (0x1 << 8)
#define PORT_P0_EXINTCR1_EXINT1_VAL(val) (((val) & 0x1) << 8)
#define PORT_P0_EXINTCR1_EXINT1_GET(val) ((((val) & PORT_P0_EXINTCR1_EXINT1) >> 8) & 0x1)
#define PORT_P0_EXINTCR1_EXINT1_SET(reg,val) (reg) = ((reg & ~PORT_P0_EXINTCR1_EXINT1) | (((val) & 0x1) << 8))
/* Type of Level or Edge Detection of EXINT0 (7) */
#define PORT_P0_EXINTCR1_EXINT0 (0x1 << 7)
#define PORT_P0_EXINTCR1_EXINT0_VAL(val) (((val) & 0x1) << 7)
#define PORT_P0_EXINTCR1_EXINT0_GET(val) ((((val) & PORT_P0_EXINTCR1_EXINT0) >> 7) & 0x1)
#define PORT_P0_EXINTCR1_EXINT0_SET(reg,val) (reg) = ((reg & ~PORT_P0_EXINTCR1_EXINT0) | (((val) & 0x1) << 7))
/*******************************************************************************
* P0_IRNEN Register
******************************************************************************/
/* EXINT16 Interrupt Request Enable (19) */
#define PORT_P0_IRNEN_EXINT16 (0x1 << 19)
#define PORT_P0_IRNEN_EXINT16_VAL(val) (((val) & 0x1) << 19)
#define PORT_P0_IRNEN_EXINT16_GET(val) ((((val) & PORT_P0_IRNEN_EXINT16) >> 19) & 0x1)
#define PORT_P0_IRNEN_EXINT16_SET(reg,val) (reg) = ((reg & ~PORT_P0_IRNEN_EXINT16) | (((val) & 0x1) << 19))
/* EXINT10 Interrupt Request Enable (17) */
#define PORT_P0_IRNEN_EXINT10 (0x1 << 17)
#define PORT_P0_IRNEN_EXINT10_VAL(val) (((val) & 0x1) << 17)
#define PORT_P0_IRNEN_EXINT10_GET(val) ((((val) & PORT_P0_IRNEN_EXINT10) >> 17) & 0x1)
#define PORT_P0_IRNEN_EXINT10_SET(reg,val) (reg) = ((reg & ~PORT_P0_IRNEN_EXINT10) | (((val) & 0x1) << 17))
/* EXINT9 Interrupt Request Enable (16) */
#define PORT_P0_IRNEN_EXINT9 (0x1 << 16)
#define PORT_P0_IRNEN_EXINT9_VAL(val) (((val) & 0x1) << 16)
#define PORT_P0_IRNEN_EXINT9_GET(val) ((((val) & PORT_P0_IRNEN_EXINT9) >> 16) & 0x1)
#define PORT_P0_IRNEN_EXINT9_SET(reg,val) (reg) = ((reg & ~PORT_P0_IRNEN_EXINT9) | (((val) & 0x1) << 16))
/* EXINT8 Interrupt Request Enable (15) */
#define PORT_P0_IRNEN_EXINT8 (0x1 << 15)
#define PORT_P0_IRNEN_EXINT8_VAL(val) (((val) & 0x1) << 15)
#define PORT_P0_IRNEN_EXINT8_GET(val) ((((val) & PORT_P0_IRNEN_EXINT8) >> 15) & 0x1)
#define PORT_P0_IRNEN_EXINT8_SET(reg,val) (reg) = ((reg & ~PORT_P0_IRNEN_EXINT8) | (((val) & 0x1) << 15))
/* EXINT7 Interrupt Request Enable (14) */
#define PORT_P0_IRNEN_EXINT7 (0x1 << 14)
#define PORT_P0_IRNEN_EXINT7_VAL(val) (((val) & 0x1) << 14)
#define PORT_P0_IRNEN_EXINT7_GET(val) ((((val) & PORT_P0_IRNEN_EXINT7) >> 14) & 0x1)
#define PORT_P0_IRNEN_EXINT7_SET(reg,val) (reg) = ((reg & ~PORT_P0_IRNEN_EXINT7) | (((val) & 0x1) << 14))
/* EXINT6 Interrupt Request Enable (13) */
#define PORT_P0_IRNEN_EXINT6 (0x1 << 13)
#define PORT_P0_IRNEN_EXINT6_VAL(val) (((val) & 0x1) << 13)
#define PORT_P0_IRNEN_EXINT6_GET(val) ((((val) & PORT_P0_IRNEN_EXINT6) >> 13) & 0x1)
#define PORT_P0_IRNEN_EXINT6_SET(reg,val) (reg) = ((reg & ~PORT_P0_IRNEN_EXINT6) | (((val) & 0x1) << 13))
/* EXINT5 Interrupt Request Enable (12) */
#define PORT_P0_IRNEN_EXINT5 (0x1 << 12)
#define PORT_P0_IRNEN_EXINT5_VAL(val) (((val) & 0x1) << 12)
#define PORT_P0_IRNEN_EXINT5_GET(val) ((((val) & PORT_P0_IRNEN_EXINT5) >> 12) & 0x1)
#define PORT_P0_IRNEN_EXINT5_SET(reg,val) (reg) = ((reg & ~PORT_P0_IRNEN_EXINT5) | (((val) & 0x1) << 12))
/* EXINT4 Interrupt Request Enable (11) */
#define PORT_P0_IRNEN_EXINT4 (0x1 << 11)
#define PORT_P0_IRNEN_EXINT4_VAL(val) (((val) & 0x1) << 11)
#define PORT_P0_IRNEN_EXINT4_GET(val) ((((val) & PORT_P0_IRNEN_EXINT4) >> 11) & 0x1)
#define PORT_P0_IRNEN_EXINT4_SET(reg,val) (reg) = ((reg & ~PORT_P0_IRNEN_EXINT4) | (((val) & 0x1) << 11))
/* EXINT3 Interrupt Request Enable (10) */
#define PORT_P0_IRNEN_EXINT3 (0x1 << 10)
#define PORT_P0_IRNEN_EXINT3_VAL(val) (((val) & 0x1) << 10)
#define PORT_P0_IRNEN_EXINT3_GET(val) ((((val) & PORT_P0_IRNEN_EXINT3) >> 10) & 0x1)
#define PORT_P0_IRNEN_EXINT3_SET(reg,val) (reg) = ((reg & ~PORT_P0_IRNEN_EXINT3) | (((val) & 0x1) << 10))
/* EXINT2 Interrupt Request Enable (9) */
#define PORT_P0_IRNEN_EXINT2 (0x1 << 9)
#define PORT_P0_IRNEN_EXINT2_VAL(val) (((val) & 0x1) << 9)
#define PORT_P0_IRNEN_EXINT2_GET(val) ((((val) & PORT_P0_IRNEN_EXINT2) >> 9) & 0x1)
#define PORT_P0_IRNEN_EXINT2_SET(reg,val) (reg) = ((reg & ~PORT_P0_IRNEN_EXINT2) | (((val) & 0x1) << 9))
/* EXINT1 Interrupt Request Enable (8) */
#define PORT_P0_IRNEN_EXINT1 (0x1 << 8)
#define PORT_P0_IRNEN_EXINT1_VAL(val) (((val) & 0x1) << 8)
#define PORT_P0_IRNEN_EXINT1_GET(val) ((((val) & PORT_P0_IRNEN_EXINT1) >> 8) & 0x1)
#define PORT_P0_IRNEN_EXINT1_SET(reg,val) (reg) = ((reg & ~PORT_P0_IRNEN_EXINT1) | (((val) & 0x1) << 8))
/* EXINT0 Interrupt Request Enable (7) */
#define PORT_P0_IRNEN_EXINT0 (0x1 << 7)
#define PORT_P0_IRNEN_EXINT0_VAL(val) (((val) & 0x1) << 7)
#define PORT_P0_IRNEN_EXINT0_GET(val) ((((val) & PORT_P0_IRNEN_EXINT0) >> 7) & 0x1)
#define PORT_P0_IRNEN_EXINT0_SET(reg,val) (reg) = ((reg & ~PORT_P0_IRNEN_EXINT0) | (((val) & 0x1) << 7))
/*******************************************************************************
* P0_IRNICR Register
******************************************************************************/
/* EXINT16 Interrupt Request (19) */
#define PORT_P0_IRNICR_EXINT16 (0x1 << 19)
#define PORT_P0_IRNICR_EXINT16_GET(val) ((((val) & PORT_P0_IRNICR_EXINT16) >> 19) & 0x1)
/* EXINT10 Interrupt Request (17) */
#define PORT_P0_IRNICR_EXINT10 (0x1 << 17)
#define PORT_P0_IRNICR_EXINT10_GET(val) ((((val) & PORT_P0_IRNICR_EXINT10) >> 17) & 0x1)
/* EXINT9 Interrupt Request (16) */
#define PORT_P0_IRNICR_EXINT9 (0x1 << 16)
#define PORT_P0_IRNICR_EXINT9_GET(val) ((((val) & PORT_P0_IRNICR_EXINT9) >> 16) & 0x1)
/* EXINT8 Interrupt Request (15) */
#define PORT_P0_IRNICR_EXINT8 (0x1 << 15)
#define PORT_P0_IRNICR_EXINT8_GET(val) ((((val) & PORT_P0_IRNICR_EXINT8) >> 15) & 0x1)
/* EXINT7 Interrupt Request (14) */
#define PORT_P0_IRNICR_EXINT7 (0x1 << 14)
#define PORT_P0_IRNICR_EXINT7_GET(val) ((((val) & PORT_P0_IRNICR_EXINT7) >> 14) & 0x1)
/* EXINT6 Interrupt Request (13) */
#define PORT_P0_IRNICR_EXINT6 (0x1 << 13)
#define PORT_P0_IRNICR_EXINT6_GET(val) ((((val) & PORT_P0_IRNICR_EXINT6) >> 13) & 0x1)
/* EXINT5 Interrupt Request (12) */
#define PORT_P0_IRNICR_EXINT5 (0x1 << 12)
#define PORT_P0_IRNICR_EXINT5_GET(val) ((((val) & PORT_P0_IRNICR_EXINT5) >> 12) & 0x1)
/* EXINT4 Interrupt Request (11) */
#define PORT_P0_IRNICR_EXINT4 (0x1 << 11)
#define PORT_P0_IRNICR_EXINT4_GET(val) ((((val) & PORT_P0_IRNICR_EXINT4) >> 11) & 0x1)
/* EXINT3 Interrupt Request (10) */
#define PORT_P0_IRNICR_EXINT3 (0x1 << 10)
#define PORT_P0_IRNICR_EXINT3_GET(val) ((((val) & PORT_P0_IRNICR_EXINT3) >> 10) & 0x1)
/* EXINT2 Interrupt Request (9) */
#define PORT_P0_IRNICR_EXINT2 (0x1 << 9)
#define PORT_P0_IRNICR_EXINT2_GET(val) ((((val) & PORT_P0_IRNICR_EXINT2) >> 9) & 0x1)
/* EXINT1 Interrupt Request (8) */
#define PORT_P0_IRNICR_EXINT1 (0x1 << 8)
#define PORT_P0_IRNICR_EXINT1_GET(val) ((((val) & PORT_P0_IRNICR_EXINT1) >> 8) & 0x1)
/* EXINT0 Interrupt Request (7) */
#define PORT_P0_IRNICR_EXINT0 (0x1 << 7)
#define PORT_P0_IRNICR_EXINT0_GET(val) ((((val) & PORT_P0_IRNICR_EXINT0) >> 7) & 0x1)
/*******************************************************************************
* P0_IRNCR Register
******************************************************************************/
/* EXINT16 Interrupt Request (19) */
#define PORT_P0_IRNCR_EXINT16 (0x1 << 19)
#define PORT_P0_IRNCR_EXINT16_GET(val) ((((val) & PORT_P0_IRNCR_EXINT16) >> 19) & 0x1)
/* EXINT10 Interrupt Request (17) */
#define PORT_P0_IRNCR_EXINT10 (0x1 << 17)
#define PORT_P0_IRNCR_EXINT10_GET(val) ((((val) & PORT_P0_IRNCR_EXINT10) >> 17) & 0x1)
/* EXINT9 Interrupt Request (16) */
#define PORT_P0_IRNCR_EXINT9 (0x1 << 16)
#define PORT_P0_IRNCR_EXINT9_GET(val) ((((val) & PORT_P0_IRNCR_EXINT9) >> 16) & 0x1)
/* EXINT8 Interrupt Request (15) */
#define PORT_P0_IRNCR_EXINT8 (0x1 << 15)
#define PORT_P0_IRNCR_EXINT8_GET(val) ((((val) & PORT_P0_IRNCR_EXINT8) >> 15) & 0x1)
/* EXINT7 Interrupt Request (14) */
#define PORT_P0_IRNCR_EXINT7 (0x1 << 14)
#define PORT_P0_IRNCR_EXINT7_GET(val) ((((val) & PORT_P0_IRNCR_EXINT7) >> 14) & 0x1)
/* EXINT6 Interrupt Request (13) */
#define PORT_P0_IRNCR_EXINT6 (0x1 << 13)
#define PORT_P0_IRNCR_EXINT6_GET(val) ((((val) & PORT_P0_IRNCR_EXINT6) >> 13) & 0x1)
/* EXINT5 Interrupt Request (12) */
#define PORT_P0_IRNCR_EXINT5 (0x1 << 12)
#define PORT_P0_IRNCR_EXINT5_GET(val) ((((val) & PORT_P0_IRNCR_EXINT5) >> 12) & 0x1)
/* EXINT4 Interrupt Request (11) */
#define PORT_P0_IRNCR_EXINT4 (0x1 << 11)
#define PORT_P0_IRNCR_EXINT4_GET(val) ((((val) & PORT_P0_IRNCR_EXINT4) >> 11) & 0x1)
/* EXINT3 Interrupt Request (10) */
#define PORT_P0_IRNCR_EXINT3 (0x1 << 10)
#define PORT_P0_IRNCR_EXINT3_GET(val) ((((val) & PORT_P0_IRNCR_EXINT3) >> 10) & 0x1)
/* EXINT2 Interrupt Request (9) */
#define PORT_P0_IRNCR_EXINT2 (0x1 << 9)
#define PORT_P0_IRNCR_EXINT2_GET(val) ((((val) & PORT_P0_IRNCR_EXINT2) >> 9) & 0x1)
/* EXINT1 Interrupt Request (8) */
#define PORT_P0_IRNCR_EXINT1 (0x1 << 8)
#define PORT_P0_IRNCR_EXINT1_GET(val) ((((val) & PORT_P0_IRNCR_EXINT1) >> 8) & 0x1)
/* EXINT0 Interrupt Request (7) */
#define PORT_P0_IRNCR_EXINT0 (0x1 << 7)
#define PORT_P0_IRNCR_EXINT0_GET(val) ((((val) & PORT_P0_IRNCR_EXINT0) >> 7) & 0x1)
/*******************************************************************************
* P0 External Event Detection Configuration Register
******************************************************************************/
/* EXINT16 configured for Edge or Level Detection (19) */
#define PORT_P0_IRNCFG_EXINT16 (0x1 << 19)
#define PORT_P0_IRNCFG_EXINT16_VAL(val) (((val) & 0x1) << 19)
#define PORT_P0_IRNCFG_EXINT16_GET(val) ((((val) & PORT_P0_IRNCFG_EXINT16) >> 19) & 0x1)
#define PORT_P0_IRNCFG_EXINT16_SET(reg,val) (reg) = ((reg & ~PORT_P0_IRNCFG_EXINT16) | (((val) & 0x1) << 19))
/* EXINT10 configured for Edge or Level Detection (17) */
#define PORT_P0_IRNCFG_EXINT10 (0x1 << 17)
#define PORT_P0_IRNCFG_EXINT10_VAL(val) (((val) & 0x1) << 17)
#define PORT_P0_IRNCFG_EXINT10_GET(val) ((((val) & PORT_P0_IRNCFG_EXINT10) >> 17) & 0x1)
#define PORT_P0_IRNCFG_EXINT10_SET(reg,val) (reg) = ((reg & ~PORT_P0_IRNCFG_EXINT10) | (((val) & 0x1) << 17))
/* EXINT9 configured for Edge or Level Detection (16) */
#define PORT_P0_IRNCFG_EXINT9 (0x1 << 16)
#define PORT_P0_IRNCFG_EXINT9_VAL(val) (((val) & 0x1) << 16)
#define PORT_P0_IRNCFG_EXINT9_GET(val) ((((val) & PORT_P0_IRNCFG_EXINT9) >> 16) & 0x1)
#define PORT_P0_IRNCFG_EXINT9_SET(reg,val) (reg) = ((reg & ~PORT_P0_IRNCFG_EXINT9) | (((val) & 0x1) << 16))
/* EXINT8 configured for Edge or Level Detection (15) */
#define PORT_P0_IRNCFG_EXINT8 (0x1 << 15)
#define PORT_P0_IRNCFG_EXINT8_VAL(val) (((val) & 0x1) << 15)
#define PORT_P0_IRNCFG_EXINT8_GET(val) ((((val) & PORT_P0_IRNCFG_EXINT8) >> 15) & 0x1)
#define PORT_P0_IRNCFG_EXINT8_SET(reg,val) (reg) = ((reg & ~PORT_P0_IRNCFG_EXINT8) | (((val) & 0x1) << 15))
/* EXINT7 configured for Edge or Level Detection (14) */
#define PORT_P0_IRNCFG_EXINT7 (0x1 << 14)
#define PORT_P0_IRNCFG_EXINT7_VAL(val) (((val) & 0x1) << 14)
#define PORT_P0_IRNCFG_EXINT7_GET(val) ((((val) & PORT_P0_IRNCFG_EXINT7) >> 14) & 0x1)
#define PORT_P0_IRNCFG_EXINT7_SET(reg,val) (reg) = ((reg & ~PORT_P0_IRNCFG_EXINT7) | (((val) & 0x1) << 14))
/* EXINT6 configured for Edge or Level Detection (13) */
#define PORT_P0_IRNCFG_EXINT6 (0x1 << 13)
#define PORT_P0_IRNCFG_EXINT6_VAL(val) (((val) & 0x1) << 13)
#define PORT_P0_IRNCFG_EXINT6_GET(val) ((((val) & PORT_P0_IRNCFG_EXINT6) >> 13) & 0x1)
#define PORT_P0_IRNCFG_EXINT6_SET(reg,val) (reg) = ((reg & ~PORT_P0_IRNCFG_EXINT6) | (((val) & 0x1) << 13))
/* EXINT5 configured for Edge or Level Detection (12) */
#define PORT_P0_IRNCFG_EXINT5 (0x1 << 12)
#define PORT_P0_IRNCFG_EXINT5_VAL(val) (((val) & 0x1) << 12)
#define PORT_P0_IRNCFG_EXINT5_GET(val) ((((val) & PORT_P0_IRNCFG_EXINT5) >> 12) & 0x1)
#define PORT_P0_IRNCFG_EXINT5_SET(reg,val) (reg) = ((reg & ~PORT_P0_IRNCFG_EXINT5) | (((val) & 0x1) << 12))
/* EXINT4 configured for Edge or Level Detection (11) */
#define PORT_P0_IRNCFG_EXINT4 (0x1 << 11)
#define PORT_P0_IRNCFG_EXINT4_VAL(val) (((val) & 0x1) << 11)
#define PORT_P0_IRNCFG_EXINT4_GET(val) ((((val) & PORT_P0_IRNCFG_EXINT4) >> 11) & 0x1)
#define PORT_P0_IRNCFG_EXINT4_SET(reg,val) (reg) = ((reg & ~PORT_P0_IRNCFG_EXINT4) | (((val) & 0x1) << 11))
/* EXINT3 configured for Edge or Level Detection (10) */
#define PORT_P0_IRNCFG_EXINT3 (0x1 << 10)
#define PORT_P0_IRNCFG_EXINT3_VAL(val) (((val) & 0x1) << 10)
#define PORT_P0_IRNCFG_EXINT3_GET(val) ((((val) & PORT_P0_IRNCFG_EXINT3) >> 10) & 0x1)
#define PORT_P0_IRNCFG_EXINT3_SET(reg,val) (reg) = ((reg & ~PORT_P0_IRNCFG_EXINT3) | (((val) & 0x1) << 10))
/* EXINT2 configured for Edge or Level Detection (9) */
#define PORT_P0_IRNCFG_EXINT2 (0x1 << 9)
#define PORT_P0_IRNCFG_EXINT2_VAL(val) (((val) & 0x1) << 9)
#define PORT_P0_IRNCFG_EXINT2_GET(val) ((((val) & PORT_P0_IRNCFG_EXINT2) >> 9) & 0x1)
#define PORT_P0_IRNCFG_EXINT2_SET(reg,val) (reg) = ((reg & ~PORT_P0_IRNCFG_EXINT2) | (((val) & 0x1) << 9))
/* EXINT1 configured for Edge or Level Detection (8) */
#define PORT_P0_IRNCFG_EXINT1 (0x1 << 8)
#define PORT_P0_IRNCFG_EXINT1_VAL(val) (((val) & 0x1) << 8)
#define PORT_P0_IRNCFG_EXINT1_GET(val) ((((val) & PORT_P0_IRNCFG_EXINT1) >> 8) & 0x1)
#define PORT_P0_IRNCFG_EXINT1_SET(reg,val) (reg) = ((reg & ~PORT_P0_IRNCFG_EXINT1) | (((val) & 0x1) << 8))
/* EXINT0 configured for Edge or Level Detection (7) */
#define PORT_P0_IRNCFG_EXINT0 (0x1 << 7)
#define PORT_P0_IRNCFG_EXINT0_VAL(val) (((val) & 0x1) << 7)
#define PORT_P0_IRNCFG_EXINT0_GET(val) ((((val) & PORT_P0_IRNCFG_EXINT0) >> 7) & 0x1)
#define PORT_P0_IRNCFG_EXINT0_SET(reg,val) (reg) = ((reg & ~PORT_P0_IRNCFG_EXINT0) | (((val) & 0x1) << 7))
/*******************************************************************************
* P0_IRNENSET Register
******************************************************************************/
/* Set Interrupt Node Enable Flag EXINT16 (19) */
#define PORT_P0_IRNENSET_EXINT16 (0x1 << 19)
#define PORT_P0_IRNENSET_EXINT16_VAL(val) (((val) & 0x1) << 19)
#define PORT_P0_IRNENSET_EXINT16_SET(reg,val) (reg) = (((reg & ~PORT_P0_IRNENSET_EXINT16) | (val) & 1) << 19)
/* Set Interrupt Node Enable Flag EXINT10 (17) */
#define PORT_P0_IRNENSET_EXINT10 (0x1 << 17)
#define PORT_P0_IRNENSET_EXINT10_VAL(val) (((val) & 0x1) << 17)
#define PORT_P0_IRNENSET_EXINT10_SET(reg,val) (reg) = (((reg & ~PORT_P0_IRNENSET_EXINT10) | (val) & 1) << 17)
/* Set Interrupt Node Enable Flag EXINT9 (16) */
#define PORT_P0_IRNENSET_EXINT9 (0x1 << 16)
#define PORT_P0_IRNENSET_EXINT9_VAL(val) (((val) & 0x1) << 16)
#define PORT_P0_IRNENSET_EXINT9_SET(reg,val) (reg) = (((reg & ~PORT_P0_IRNENSET_EXINT9) | (val) & 1) << 16)
/* Set Interrupt Node Enable Flag EXINT8 (15) */
#define PORT_P0_IRNENSET_EXINT8 (0x1 << 15)
#define PORT_P0_IRNENSET_EXINT8_VAL(val) (((val) & 0x1) << 15)
#define PORT_P0_IRNENSET_EXINT8_SET(reg,val) (reg) = (((reg & ~PORT_P0_IRNENSET_EXINT8) | (val) & 1) << 15)
/* Set Interrupt Node Enable Flag EXINT7 (14) */
#define PORT_P0_IRNENSET_EXINT7 (0x1 << 14)
#define PORT_P0_IRNENSET_EXINT7_VAL(val) (((val) & 0x1) << 14)
#define PORT_P0_IRNENSET_EXINT7_SET(reg,val) (reg) = (((reg & ~PORT_P0_IRNENSET_EXINT7) | (val) & 1) << 14)
/* Set Interrupt Node Enable Flag EXINT6 (13) */
#define PORT_P0_IRNENSET_EXINT6 (0x1 << 13)
#define PORT_P0_IRNENSET_EXINT6_VAL(val) (((val) & 0x1) << 13)
#define PORT_P0_IRNENSET_EXINT6_SET(reg,val) (reg) = (((reg & ~PORT_P0_IRNENSET_EXINT6) | (val) & 1) << 13)
/* Set Interrupt Node Enable Flag EXINT5 (12) */
#define PORT_P0_IRNENSET_EXINT5 (0x1 << 12)
#define PORT_P0_IRNENSET_EXINT5_VAL(val) (((val) & 0x1) << 12)
#define PORT_P0_IRNENSET_EXINT5_SET(reg,val) (reg) = (((reg & ~PORT_P0_IRNENSET_EXINT5) | (val) & 1) << 12)
/* Set Interrupt Node Enable Flag EXINT4 (11) */
#define PORT_P0_IRNENSET_EXINT4 (0x1 << 11)
#define PORT_P0_IRNENSET_EXINT4_VAL(val) (((val) & 0x1) << 11)
#define PORT_P0_IRNENSET_EXINT4_SET(reg,val) (reg) = (((reg & ~PORT_P0_IRNENSET_EXINT4) | (val) & 1) << 11)
/* Set Interrupt Node Enable Flag EXINT3 (10) */
#define PORT_P0_IRNENSET_EXINT3 (0x1 << 10)
#define PORT_P0_IRNENSET_EXINT3_VAL(val) (((val) & 0x1) << 10)
#define PORT_P0_IRNENSET_EXINT3_SET(reg,val) (reg) = (((reg & ~PORT_P0_IRNENSET_EXINT3) | (val) & 1) << 10)
/* Set Interrupt Node Enable Flag EXINT2 (9) */
#define PORT_P0_IRNENSET_EXINT2 (0x1 << 9)
#define PORT_P0_IRNENSET_EXINT2_VAL(val) (((val) & 0x1) << 9)
#define PORT_P0_IRNENSET_EXINT2_SET(reg,val) (reg) = (((reg & ~PORT_P0_IRNENSET_EXINT2) | (val) & 1) << 9)
/* Set Interrupt Node Enable Flag EXINT1 (8) */
#define PORT_P0_IRNENSET_EXINT1 (0x1 << 8)
#define PORT_P0_IRNENSET_EXINT1_VAL(val) (((val) & 0x1) << 8)
#define PORT_P0_IRNENSET_EXINT1_SET(reg,val) (reg) = (((reg & ~PORT_P0_IRNENSET_EXINT1) | (val) & 1) << 8)
/* Set Interrupt Node Enable Flag EXINT0 (7) */
#define PORT_P0_IRNENSET_EXINT0 (0x1 << 7)
#define PORT_P0_IRNENSET_EXINT0_VAL(val) (((val) & 0x1) << 7)
#define PORT_P0_IRNENSET_EXINT0_SET(reg,val) (reg) = (((reg & ~PORT_P0_IRNENSET_EXINT0) | (val) & 1) << 7)
/*******************************************************************************
* P0_IRNENCLR Register
******************************************************************************/
/* Clear Interrupt Node Enable Flag EXINT16 (19) */
#define PORT_P0_IRNENCLR_EXINT16 (0x1 << 19)
#define PORT_P0_IRNENCLR_EXINT16_VAL(val) (((val) & 0x1) << 19)
#define PORT_P0_IRNENCLR_EXINT16_SET(reg,val) (reg) = (((reg & ~PORT_P0_IRNENCLR_EXINT16) | (val) & 1) << 19)
/* Clear Interrupt Node Enable Flag EXINT10 (17) */
#define PORT_P0_IRNENCLR_EXINT10 (0x1 << 17)
#define PORT_P0_IRNENCLR_EXINT10_VAL(val) (((val) & 0x1) << 17)
#define PORT_P0_IRNENCLR_EXINT10_SET(reg,val) (reg) = (((reg & ~PORT_P0_IRNENCLR_EXINT10) | (val) & 1) << 17)
/* Clear Interrupt Node Enable Flag EXINT9 (16) */
#define PORT_P0_IRNENCLR_EXINT9 (0x1 << 16)
#define PORT_P0_IRNENCLR_EXINT9_VAL(val) (((val) & 0x1) << 16)
#define PORT_P0_IRNENCLR_EXINT9_SET(reg,val) (reg) = (((reg & ~PORT_P0_IRNENCLR_EXINT9) | (val) & 1) << 16)
/* Clear Interrupt Node Enable Flag EXINT8 (15) */
#define PORT_P0_IRNENCLR_EXINT8 (0x1 << 15)
#define PORT_P0_IRNENCLR_EXINT8_VAL(val) (((val) & 0x1) << 15)
#define PORT_P0_IRNENCLR_EXINT8_SET(reg,val) (reg) = (((reg & ~PORT_P0_IRNENCLR_EXINT8) | (val) & 1) << 15)
/* Clear Interrupt Node Enable Flag EXINT7 (14) */
#define PORT_P0_IRNENCLR_EXINT7 (0x1 << 14)
#define PORT_P0_IRNENCLR_EXINT7_VAL(val) (((val) & 0x1) << 14)
#define PORT_P0_IRNENCLR_EXINT7_SET(reg,val) (reg) = (((reg & ~PORT_P0_IRNENCLR_EXINT7) | (val) & 1) << 14)
/* Clear Interrupt Node Enable Flag EXINT6 (13) */
#define PORT_P0_IRNENCLR_EXINT6 (0x1 << 13)
#define PORT_P0_IRNENCLR_EXINT6_VAL(val) (((val) & 0x1) << 13)
#define PORT_P0_IRNENCLR_EXINT6_SET(reg,val) (reg) = (((reg & ~PORT_P0_IRNENCLR_EXINT6) | (val) & 1) << 13)
/* Clear Interrupt Node Enable Flag EXINT5 (12) */
#define PORT_P0_IRNENCLR_EXINT5 (0x1 << 12)
#define PORT_P0_IRNENCLR_EXINT5_VAL(val) (((val) & 0x1) << 12)
#define PORT_P0_IRNENCLR_EXINT5_SET(reg,val) (reg) = (((reg & ~PORT_P0_IRNENCLR_EXINT5) | (val) & 1) << 12)
/* Clear Interrupt Node Enable Flag EXINT4 (11) */
#define PORT_P0_IRNENCLR_EXINT4 (0x1 << 11)
#define PORT_P0_IRNENCLR_EXINT4_VAL(val) (((val) & 0x1) << 11)
#define PORT_P0_IRNENCLR_EXINT4_SET(reg,val) (reg) = (((reg & ~PORT_P0_IRNENCLR_EXINT4) | (val) & 1) << 11)
/* Clear Interrupt Node Enable Flag EXINT3 (10) */
#define PORT_P0_IRNENCLR_EXINT3 (0x1 << 10)
#define PORT_P0_IRNENCLR_EXINT3_VAL(val) (((val) & 0x1) << 10)
#define PORT_P0_IRNENCLR_EXINT3_SET(reg,val) (reg) = (((reg & ~PORT_P0_IRNENCLR_EXINT3) | (val) & 1) << 10)
/* Clear Interrupt Node Enable Flag EXINT2 (9) */
#define PORT_P0_IRNENCLR_EXINT2 (0x1 << 9)
#define PORT_P0_IRNENCLR_EXINT2_VAL(val) (((val) & 0x1) << 9)
#define PORT_P0_IRNENCLR_EXINT2_SET(reg,val) (reg) = (((reg & ~PORT_P0_IRNENCLR_EXINT2) | (val) & 1) << 9)
/* Clear Interrupt Node Enable Flag EXINT1 (8) */
#define PORT_P0_IRNENCLR_EXINT1 (0x1 << 8)
#define PORT_P0_IRNENCLR_EXINT1_VAL(val) (((val) & 0x1) << 8)
#define PORT_P0_IRNENCLR_EXINT1_SET(reg,val) (reg) = (((reg & ~PORT_P0_IRNENCLR_EXINT1) | (val) & 1) << 8)
/* Clear Interrupt Node Enable Flag EXINT0 (7) */
#define PORT_P0_IRNENCLR_EXINT0 (0x1 << 7)
#define PORT_P0_IRNENCLR_EXINT0_VAL(val) (((val) & 0x1) << 7)
#define PORT_P0_IRNENCLR_EXINT0_SET(reg,val) (reg) = (((reg & ~PORT_P0_IRNENCLR_EXINT0) | (val) & 1) << 7)
/*******************************************************************************
* Port 1 Data Output Register
******************************************************************************/
/* Port 1 Pin # Output Value (19) */
#define PORT_P1_OUT_P19 (0x1 << 19)
#define PORT_P1_OUT_P19_VAL(val) (((val) & 0x1) << 19)
#define PORT_P1_OUT_P19_GET(val) ((((val) & PORT_P1_OUT_P19) >> 19) & 0x1)
#define PORT_P1_OUT_P19_SET(reg,val) (reg) = ((reg & ~PORT_P1_OUT_P19) | (((val) & 0x1) << 19))
/* Port 1 Pin # Output Value (18) */
#define PORT_P1_OUT_P18 (0x1 << 18)
#define PORT_P1_OUT_P18_VAL(val) (((val) & 0x1) << 18)
#define PORT_P1_OUT_P18_GET(val) ((((val) & PORT_P1_OUT_P18) >> 18) & 0x1)
#define PORT_P1_OUT_P18_SET(reg,val) (reg) = ((reg & ~PORT_P1_OUT_P18) | (((val) & 0x1) << 18))
/* Port 1 Pin # Output Value (17) */
#define PORT_P1_OUT_P17 (0x1 << 17)
#define PORT_P1_OUT_P17_VAL(val) (((val) & 0x1) << 17)
#define PORT_P1_OUT_P17_GET(val) ((((val) & PORT_P1_OUT_P17) >> 17) & 0x1)
#define PORT_P1_OUT_P17_SET(reg,val) (reg) = ((reg & ~PORT_P1_OUT_P17) | (((val) & 0x1) << 17))
/* Port 1 Pin # Output Value (16) */
#define PORT_P1_OUT_P16 (0x1 << 16)
#define PORT_P1_OUT_P16_VAL(val) (((val) & 0x1) << 16)
#define PORT_P1_OUT_P16_GET(val) ((((val) & PORT_P1_OUT_P16) >> 16) & 0x1)
#define PORT_P1_OUT_P16_SET(reg,val) (reg) = ((reg & ~PORT_P1_OUT_P16) | (((val) & 0x1) << 16))
/* Port 1 Pin # Output Value (15) */
#define PORT_P1_OUT_P15 (0x1 << 15)
#define PORT_P1_OUT_P15_VAL(val) (((val) & 0x1) << 15)
#define PORT_P1_OUT_P15_GET(val) ((((val) & PORT_P1_OUT_P15) >> 15) & 0x1)
#define PORT_P1_OUT_P15_SET(reg,val) (reg) = ((reg & ~PORT_P1_OUT_P15) | (((val) & 0x1) << 15))
/* Port 1 Pin # Output Value (14) */
#define PORT_P1_OUT_P14 (0x1 << 14)
#define PORT_P1_OUT_P14_VAL(val) (((val) & 0x1) << 14)
#define PORT_P1_OUT_P14_GET(val) ((((val) & PORT_P1_OUT_P14) >> 14) & 0x1)
#define PORT_P1_OUT_P14_SET(reg,val) (reg) = ((reg & ~PORT_P1_OUT_P14) | (((val) & 0x1) << 14))
/* Port 1 Pin # Output Value (13) */
#define PORT_P1_OUT_P13 (0x1 << 13)
#define PORT_P1_OUT_P13_VAL(val) (((val) & 0x1) << 13)
#define PORT_P1_OUT_P13_GET(val) ((((val) & PORT_P1_OUT_P13) >> 13) & 0x1)
#define PORT_P1_OUT_P13_SET(reg,val) (reg) = ((reg & ~PORT_P1_OUT_P13) | (((val) & 0x1) << 13))
/* Port 1 Pin # Output Value (12) */
#define PORT_P1_OUT_P12 (0x1 << 12)
#define PORT_P1_OUT_P12_VAL(val) (((val) & 0x1) << 12)
#define PORT_P1_OUT_P12_GET(val) ((((val) & PORT_P1_OUT_P12) >> 12) & 0x1)
#define PORT_P1_OUT_P12_SET(reg,val) (reg) = ((reg & ~PORT_P1_OUT_P12) | (((val) & 0x1) << 12))
/* Port 1 Pin # Output Value (11) */
#define PORT_P1_OUT_P11 (0x1 << 11)
#define PORT_P1_OUT_P11_VAL(val) (((val) & 0x1) << 11)
#define PORT_P1_OUT_P11_GET(val) ((((val) & PORT_P1_OUT_P11) >> 11) & 0x1)
#define PORT_P1_OUT_P11_SET(reg,val) (reg) = ((reg & ~PORT_P1_OUT_P11) | (((val) & 0x1) << 11))
/* Port 1 Pin # Output Value (10) */
#define PORT_P1_OUT_P10 (0x1 << 10)
#define PORT_P1_OUT_P10_VAL(val) (((val) & 0x1) << 10)
#define PORT_P1_OUT_P10_GET(val) ((((val) & PORT_P1_OUT_P10) >> 10) & 0x1)
#define PORT_P1_OUT_P10_SET(reg,val) (reg) = ((reg & ~PORT_P1_OUT_P10) | (((val) & 0x1) << 10))
/* Port 1 Pin # Output Value (9) */
#define PORT_P1_OUT_P9 (0x1 << 9)
#define PORT_P1_OUT_P9_VAL(val) (((val) & 0x1) << 9)
#define PORT_P1_OUT_P9_GET(val) ((((val) & PORT_P1_OUT_P9) >> 9) & 0x1)
#define PORT_P1_OUT_P9_SET(reg,val) (reg) = ((reg & ~PORT_P1_OUT_P9) | (((val) & 0x1) << 9))
/* Port 1 Pin # Output Value (8) */
#define PORT_P1_OUT_P8 (0x1 << 8)
#define PORT_P1_OUT_P8_VAL(val) (((val) & 0x1) << 8)
#define PORT_P1_OUT_P8_GET(val) ((((val) & PORT_P1_OUT_P8) >> 8) & 0x1)
#define PORT_P1_OUT_P8_SET(reg,val) (reg) = ((reg & ~PORT_P1_OUT_P8) | (((val) & 0x1) << 8))
/* Port 1 Pin # Output Value (7) */
#define PORT_P1_OUT_P7 (0x1 << 7)
#define PORT_P1_OUT_P7_VAL(val) (((val) & 0x1) << 7)
#define PORT_P1_OUT_P7_GET(val) ((((val) & PORT_P1_OUT_P7) >> 7) & 0x1)
#define PORT_P1_OUT_P7_SET(reg,val) (reg) = ((reg & ~PORT_P1_OUT_P7) | (((val) & 0x1) << 7))
/* Port 1 Pin # Output Value (6) */
#define PORT_P1_OUT_P6 (0x1 << 6)
#define PORT_P1_OUT_P6_VAL(val) (((val) & 0x1) << 6)
#define PORT_P1_OUT_P6_GET(val) ((((val) & PORT_P1_OUT_P6) >> 6) & 0x1)
#define PORT_P1_OUT_P6_SET(reg,val) (reg) = ((reg & ~PORT_P1_OUT_P6) | (((val) & 0x1) << 6))
/* Port 1 Pin # Output Value (5) */
#define PORT_P1_OUT_P5 (0x1 << 5)
#define PORT_P1_OUT_P5_VAL(val) (((val) & 0x1) << 5)
#define PORT_P1_OUT_P5_GET(val) ((((val) & PORT_P1_OUT_P5) >> 5) & 0x1)
#define PORT_P1_OUT_P5_SET(reg,val) (reg) = ((reg & ~PORT_P1_OUT_P5) | (((val) & 0x1) << 5))
/* Port 1 Pin # Output Value (4) */
#define PORT_P1_OUT_P4 (0x1 << 4)
#define PORT_P1_OUT_P4_VAL(val) (((val) & 0x1) << 4)
#define PORT_P1_OUT_P4_GET(val) ((((val) & PORT_P1_OUT_P4) >> 4) & 0x1)
#define PORT_P1_OUT_P4_SET(reg,val) (reg) = ((reg & ~PORT_P1_OUT_P4) | (((val) & 0x1) << 4))
/* Port 1 Pin # Output Value (3) */
#define PORT_P1_OUT_P3 (0x1 << 3)
#define PORT_P1_OUT_P3_VAL(val) (((val) & 0x1) << 3)
#define PORT_P1_OUT_P3_GET(val) ((((val) & PORT_P1_OUT_P3) >> 3) & 0x1)
#define PORT_P1_OUT_P3_SET(reg,val) (reg) = ((reg & ~PORT_P1_OUT_P3) | (((val) & 0x1) << 3))
/* Port 1 Pin # Output Value (2) */
#define PORT_P1_OUT_P2 (0x1 << 2)
#define PORT_P1_OUT_P2_VAL(val) (((val) & 0x1) << 2)
#define PORT_P1_OUT_P2_GET(val) ((((val) & PORT_P1_OUT_P2) >> 2) & 0x1)
#define PORT_P1_OUT_P2_SET(reg,val) (reg) = ((reg & ~PORT_P1_OUT_P2) | (((val) & 0x1) << 2))
/* Port 1 Pin # Output Value (1) */
#define PORT_P1_OUT_P1 (0x1 << 1)
#define PORT_P1_OUT_P1_VAL(val) (((val) & 0x1) << 1)
#define PORT_P1_OUT_P1_GET(val) ((((val) & PORT_P1_OUT_P1) >> 1) & 0x1)
#define PORT_P1_OUT_P1_SET(reg,val) (reg) = ((reg & ~PORT_P1_OUT_P1) | (((val) & 0x1) << 1))
/* Port 1 Pin # Output Value (0) */
#define PORT_P1_OUT_P0 (0x1)
#define PORT_P1_OUT_P0_VAL(val) (((val) & 0x1) << 0)
#define PORT_P1_OUT_P0_GET(val) ((((val) & PORT_P1_OUT_P0) >> 0) & 0x1)
#define PORT_P1_OUT_P0_SET(reg,val) (reg) = ((reg & ~PORT_P1_OUT_P0) | (((val) & 0x1) << 0))
/*******************************************************************************
* Port 1 Data Input Register
******************************************************************************/
/* Port 1 Pin # Latched Input Value (19) */
#define PORT_P1_IN_P19 (0x1 << 19)
#define PORT_P1_IN_P19_GET(val) ((((val) & PORT_P1_IN_P19) >> 19) & 0x1)
/* Port 1 Pin # Latched Input Value (18) */
#define PORT_P1_IN_P18 (0x1 << 18)
#define PORT_P1_IN_P18_GET(val) ((((val) & PORT_P1_IN_P18) >> 18) & 0x1)
/* Port 1 Pin # Latched Input Value (17) */
#define PORT_P1_IN_P17 (0x1 << 17)
#define PORT_P1_IN_P17_GET(val) ((((val) & PORT_P1_IN_P17) >> 17) & 0x1)
/* Port 1 Pin # Latched Input Value (16) */
#define PORT_P1_IN_P16 (0x1 << 16)
#define PORT_P1_IN_P16_GET(val) ((((val) & PORT_P1_IN_P16) >> 16) & 0x1)
/* Port 1 Pin # Latched Input Value (15) */
#define PORT_P1_IN_P15 (0x1 << 15)
#define PORT_P1_IN_P15_GET(val) ((((val) & PORT_P1_IN_P15) >> 15) & 0x1)
/* Port 1 Pin # Latched Input Value (14) */
#define PORT_P1_IN_P14 (0x1 << 14)
#define PORT_P1_IN_P14_GET(val) ((((val) & PORT_P1_IN_P14) >> 14) & 0x1)
/* Port 1 Pin # Latched Input Value (13) */
#define PORT_P1_IN_P13 (0x1 << 13)
#define PORT_P1_IN_P13_GET(val) ((((val) & PORT_P1_IN_P13) >> 13) & 0x1)
/* Port 1 Pin # Latched Input Value (12) */
#define PORT_P1_IN_P12 (0x1 << 12)
#define PORT_P1_IN_P12_GET(val) ((((val) & PORT_P1_IN_P12) >> 12) & 0x1)
/* Port 1 Pin # Latched Input Value (11) */
#define PORT_P1_IN_P11 (0x1 << 11)
#define PORT_P1_IN_P11_GET(val) ((((val) & PORT_P1_IN_P11) >> 11) & 0x1)
/* Port 1 Pin # Latched Input Value (10) */
#define PORT_P1_IN_P10 (0x1 << 10)
#define PORT_P1_IN_P10_GET(val) ((((val) & PORT_P1_IN_P10) >> 10) & 0x1)
/* Port 1 Pin # Latched Input Value (9) */
#define PORT_P1_IN_P9 (0x1 << 9)
#define PORT_P1_IN_P9_GET(val) ((((val) & PORT_P1_IN_P9) >> 9) & 0x1)
/* Port 1 Pin # Latched Input Value (8) */
#define PORT_P1_IN_P8 (0x1 << 8)
#define PORT_P1_IN_P8_GET(val) ((((val) & PORT_P1_IN_P8) >> 8) & 0x1)
/* Port 1 Pin # Latched Input Value (7) */
#define PORT_P1_IN_P7 (0x1 << 7)
#define PORT_P1_IN_P7_GET(val) ((((val) & PORT_P1_IN_P7) >> 7) & 0x1)
/* Port 1 Pin # Latched Input Value (6) */
#define PORT_P1_IN_P6 (0x1 << 6)
#define PORT_P1_IN_P6_GET(val) ((((val) & PORT_P1_IN_P6) >> 6) & 0x1)
/* Port 1 Pin # Latched Input Value (5) */
#define PORT_P1_IN_P5 (0x1 << 5)
#define PORT_P1_IN_P5_GET(val) ((((val) & PORT_P1_IN_P5) >> 5) & 0x1)
/* Port 1 Pin # Latched Input Value (4) */
#define PORT_P1_IN_P4 (0x1 << 4)
#define PORT_P1_IN_P4_GET(val) ((((val) & PORT_P1_IN_P4) >> 4) & 0x1)
/* Port 1 Pin # Latched Input Value (3) */
#define PORT_P1_IN_P3 (0x1 << 3)
#define PORT_P1_IN_P3_GET(val) ((((val) & PORT_P1_IN_P3) >> 3) & 0x1)
/* Port 1 Pin # Latched Input Value (2) */
#define PORT_P1_IN_P2 (0x1 << 2)
#define PORT_P1_IN_P2_GET(val) ((((val) & PORT_P1_IN_P2) >> 2) & 0x1)
/* Port 1 Pin # Latched Input Value (1) */
#define PORT_P1_IN_P1 (0x1 << 1)
#define PORT_P1_IN_P1_GET(val) ((((val) & PORT_P1_IN_P1) >> 1) & 0x1)
/* Port 1 Pin # Latched Input Value (0) */
#define PORT_P1_IN_P0 (0x1)
#define PORT_P1_IN_P0_GET(val) ((((val) & PORT_P1_IN_P0) >> 0) & 0x1)
/*******************************************************************************
* Port 1 Direction Register
******************************************************************************/
/* Port 1 Pin #Direction Control (19) */
#define PORT_P1_DIR_P19 (0x1 << 19)
#define PORT_P1_DIR_P19_VAL(val) (((val) & 0x1) << 19)
#define PORT_P1_DIR_P19_GET(val) ((((val) & PORT_P1_DIR_P19) >> 19) & 0x1)
#define PORT_P1_DIR_P19_SET(reg,val) (reg) = ((reg & ~PORT_P1_DIR_P19) | (((val) & 0x1) << 19))
/* Port 1 Pin #Direction Control (18) */
#define PORT_P1_DIR_P18 (0x1 << 18)
#define PORT_P1_DIR_P18_VAL(val) (((val) & 0x1) << 18)
#define PORT_P1_DIR_P18_GET(val) ((((val) & PORT_P1_DIR_P18) >> 18) & 0x1)
#define PORT_P1_DIR_P18_SET(reg,val) (reg) = ((reg & ~PORT_P1_DIR_P18) | (((val) & 0x1) << 18))
/* Port 1 Pin #Direction Control (17) */
#define PORT_P1_DIR_P17 (0x1 << 17)
#define PORT_P1_DIR_P17_VAL(val) (((val) & 0x1) << 17)
#define PORT_P1_DIR_P17_GET(val) ((((val) & PORT_P1_DIR_P17) >> 17) & 0x1)
#define PORT_P1_DIR_P17_SET(reg,val) (reg) = ((reg & ~PORT_P1_DIR_P17) | (((val) & 0x1) << 17))
/* Port 1 Pin #Direction Control (16) */
#define PORT_P1_DIR_P16 (0x1 << 16)
#define PORT_P1_DIR_P16_VAL(val) (((val) & 0x1) << 16)
#define PORT_P1_DIR_P16_GET(val) ((((val) & PORT_P1_DIR_P16) >> 16) & 0x1)
#define PORT_P1_DIR_P16_SET(reg,val) (reg) = ((reg & ~PORT_P1_DIR_P16) | (((val) & 0x1) << 16))
/* Port 1 Pin #Direction Control (15) */
#define PORT_P1_DIR_P15 (0x1 << 15)
#define PORT_P1_DIR_P15_VAL(val) (((val) & 0x1) << 15)
#define PORT_P1_DIR_P15_GET(val) ((((val) & PORT_P1_DIR_P15) >> 15) & 0x1)
#define PORT_P1_DIR_P15_SET(reg,val) (reg) = ((reg & ~PORT_P1_DIR_P15) | (((val) & 0x1) << 15))
/* Port 1 Pin #Direction Control (14) */
#define PORT_P1_DIR_P14 (0x1 << 14)
#define PORT_P1_DIR_P14_VAL(val) (((val) & 0x1) << 14)
#define PORT_P1_DIR_P14_GET(val) ((((val) & PORT_P1_DIR_P14) >> 14) & 0x1)
#define PORT_P1_DIR_P14_SET(reg,val) (reg) = ((reg & ~PORT_P1_DIR_P14) | (((val) & 0x1) << 14))
/* Port 1 Pin #Direction Control (13) */
#define PORT_P1_DIR_P13 (0x1 << 13)
#define PORT_P1_DIR_P13_VAL(val) (((val) & 0x1) << 13)
#define PORT_P1_DIR_P13_GET(val) ((((val) & PORT_P1_DIR_P13) >> 13) & 0x1)
#define PORT_P1_DIR_P13_SET(reg,val) (reg) = ((reg & ~PORT_P1_DIR_P13) | (((val) & 0x1) << 13))
/* Port 1 Pin #Direction Control (12) */
#define PORT_P1_DIR_P12 (0x1 << 12)
#define PORT_P1_DIR_P12_VAL(val) (((val) & 0x1) << 12)
#define PORT_P1_DIR_P12_GET(val) ((((val) & PORT_P1_DIR_P12) >> 12) & 0x1)
#define PORT_P1_DIR_P12_SET(reg,val) (reg) = ((reg & ~PORT_P1_DIR_P12) | (((val) & 0x1) << 12))
/* Port 1 Pin #Direction Control (11) */
#define PORT_P1_DIR_P11 (0x1 << 11)
#define PORT_P1_DIR_P11_VAL(val) (((val) & 0x1) << 11)
#define PORT_P1_DIR_P11_GET(val) ((((val) & PORT_P1_DIR_P11) >> 11) & 0x1)
#define PORT_P1_DIR_P11_SET(reg,val) (reg) = ((reg & ~PORT_P1_DIR_P11) | (((val) & 0x1) << 11))
/* Port 1 Pin #Direction Control (10) */
#define PORT_P1_DIR_P10 (0x1 << 10)
#define PORT_P1_DIR_P10_VAL(val) (((val) & 0x1) << 10)
#define PORT_P1_DIR_P10_GET(val) ((((val) & PORT_P1_DIR_P10) >> 10) & 0x1)
#define PORT_P1_DIR_P10_SET(reg,val) (reg) = ((reg & ~PORT_P1_DIR_P10) | (((val) & 0x1) << 10))
/* Port 1 Pin #Direction Control (9) */
#define PORT_P1_DIR_P9 (0x1 << 9)
#define PORT_P1_DIR_P9_VAL(val) (((val) & 0x1) << 9)
#define PORT_P1_DIR_P9_GET(val) ((((val) & PORT_P1_DIR_P9) >> 9) & 0x1)
#define PORT_P1_DIR_P9_SET(reg,val) (reg) = ((reg & ~PORT_P1_DIR_P9) | (((val) & 0x1) << 9))
/* Port 1 Pin #Direction Control (8) */
#define PORT_P1_DIR_P8 (0x1 << 8)
#define PORT_P1_DIR_P8_VAL(val) (((val) & 0x1) << 8)
#define PORT_P1_DIR_P8_GET(val) ((((val) & PORT_P1_DIR_P8) >> 8) & 0x1)
#define PORT_P1_DIR_P8_SET(reg,val) (reg) = ((reg & ~PORT_P1_DIR_P8) | (((val) & 0x1) << 8))
/* Port 1 Pin #Direction Control (7) */
#define PORT_P1_DIR_P7 (0x1 << 7)
#define PORT_P1_DIR_P7_VAL(val) (((val) & 0x1) << 7)
#define PORT_P1_DIR_P7_GET(val) ((((val) & PORT_P1_DIR_P7) >> 7) & 0x1)
#define PORT_P1_DIR_P7_SET(reg,val) (reg) = ((reg & ~PORT_P1_DIR_P7) | (((val) & 0x1) << 7))
/* Port 1 Pin #Direction Control (6) */
#define PORT_P1_DIR_P6 (0x1 << 6)
#define PORT_P1_DIR_P6_VAL(val) (((val) & 0x1) << 6)
#define PORT_P1_DIR_P6_GET(val) ((((val) & PORT_P1_DIR_P6) >> 6) & 0x1)
#define PORT_P1_DIR_P6_SET(reg,val) (reg) = ((reg & ~PORT_P1_DIR_P6) | (((val) & 0x1) << 6))
/* Port 1 Pin #Direction Control (5) */
#define PORT_P1_DIR_P5 (0x1 << 5)
#define PORT_P1_DIR_P5_VAL(val) (((val) & 0x1) << 5)
#define PORT_P1_DIR_P5_GET(val) ((((val) & PORT_P1_DIR_P5) >> 5) & 0x1)
#define PORT_P1_DIR_P5_SET(reg,val) (reg) = ((reg & ~PORT_P1_DIR_P5) | (((val) & 0x1) << 5))
/* Port 1 Pin #Direction Control (4) */
#define PORT_P1_DIR_P4 (0x1 << 4)
#define PORT_P1_DIR_P4_VAL(val) (((val) & 0x1) << 4)
#define PORT_P1_DIR_P4_GET(val) ((((val) & PORT_P1_DIR_P4) >> 4) & 0x1)
#define PORT_P1_DIR_P4_SET(reg,val) (reg) = ((reg & ~PORT_P1_DIR_P4) | (((val) & 0x1) << 4))
/* Port 1 Pin #Direction Control (3) */
#define PORT_P1_DIR_P3 (0x1 << 3)
#define PORT_P1_DIR_P3_VAL(val) (((val) & 0x1) << 3)
#define PORT_P1_DIR_P3_GET(val) ((((val) & PORT_P1_DIR_P3) >> 3) & 0x1)
#define PORT_P1_DIR_P3_SET(reg,val) (reg) = ((reg & ~PORT_P1_DIR_P3) | (((val) & 0x1) << 3))
/* Port 1 Pin #Direction Control (2) */
#define PORT_P1_DIR_P2 (0x1 << 2)
#define PORT_P1_DIR_P2_VAL(val) (((val) & 0x1) << 2)
#define PORT_P1_DIR_P2_GET(val) ((((val) & PORT_P1_DIR_P2) >> 2) & 0x1)
#define PORT_P1_DIR_P2_SET(reg,val) (reg) = ((reg & ~PORT_P1_DIR_P2) | (((val) & 0x1) << 2))
/* Port 1 Pin #Direction Control (1) */
#define PORT_P1_DIR_P1 (0x1 << 1)
#define PORT_P1_DIR_P1_VAL(val) (((val) & 0x1) << 1)
#define PORT_P1_DIR_P1_GET(val) ((((val) & PORT_P1_DIR_P1) >> 1) & 0x1)
#define PORT_P1_DIR_P1_SET(reg,val) (reg) = ((reg & ~PORT_P1_DIR_P1) | (((val) & 0x1) << 1))
/* Port 1 Pin #Direction Control (0) */
#define PORT_P1_DIR_P0 (0x1)
#define PORT_P1_DIR_P0_VAL(val) (((val) & 0x1) << 0)
#define PORT_P1_DIR_P0_GET(val) ((((val) & PORT_P1_DIR_P0) >> 0) & 0x1)
#define PORT_P1_DIR_P0_SET(reg,val) (reg) = ((reg & ~PORT_P1_DIR_P0) | (((val) & 0x1) << 0))
/*******************************************************************************
* Port 1 Alternate Function Select Register 0
******************************************************************************/
/* Alternate Function at Port 1 Bit # (19) */
#define PORT_P1_ALTSEL0_P19 (0x1 << 19)
#define PORT_P1_ALTSEL0_P19_VAL(val) (((val) & 0x1) << 19)
#define PORT_P1_ALTSEL0_P19_GET(val) ((((val) & PORT_P1_ALTSEL0_P19) >> 19) & 0x1)
#define PORT_P1_ALTSEL0_P19_SET(reg,val) (reg) = ((reg & ~PORT_P1_ALTSEL0_P19) | (((val) & 0x1) << 19))
/* Alternate Function at Port 1 Bit # (18) */
#define PORT_P1_ALTSEL0_P18 (0x1 << 18)
#define PORT_P1_ALTSEL0_P18_VAL(val) (((val) & 0x1) << 18)
#define PORT_P1_ALTSEL0_P18_GET(val) ((((val) & PORT_P1_ALTSEL0_P18) >> 18) & 0x1)
#define PORT_P1_ALTSEL0_P18_SET(reg,val) (reg) = ((reg & ~PORT_P1_ALTSEL0_P18) | (((val) & 0x1) << 18))
/* Alternate Function at Port 1 Bit # (17) */
#define PORT_P1_ALTSEL0_P17 (0x1 << 17)
#define PORT_P1_ALTSEL0_P17_VAL(val) (((val) & 0x1) << 17)
#define PORT_P1_ALTSEL0_P17_GET(val) ((((val) & PORT_P1_ALTSEL0_P17) >> 17) & 0x1)
#define PORT_P1_ALTSEL0_P17_SET(reg,val) (reg) = ((reg & ~PORT_P1_ALTSEL0_P17) | (((val) & 0x1) << 17))
/* Alternate Function at Port 1 Bit # (16) */
#define PORT_P1_ALTSEL0_P16 (0x1 << 16)
#define PORT_P1_ALTSEL0_P16_VAL(val) (((val) & 0x1) << 16)
#define PORT_P1_ALTSEL0_P16_GET(val) ((((val) & PORT_P1_ALTSEL0_P16) >> 16) & 0x1)
#define PORT_P1_ALTSEL0_P16_SET(reg,val) (reg) = ((reg & ~PORT_P1_ALTSEL0_P16) | (((val) & 0x1) << 16))
/* Alternate Function at Port 1 Bit # (15) */
#define PORT_P1_ALTSEL0_P15 (0x1 << 15)
#define PORT_P1_ALTSEL0_P15_VAL(val) (((val) & 0x1) << 15)
#define PORT_P1_ALTSEL0_P15_GET(val) ((((val) & PORT_P1_ALTSEL0_P15) >> 15) & 0x1)
#define PORT_P1_ALTSEL0_P15_SET(reg,val) (reg) = ((reg & ~PORT_P1_ALTSEL0_P15) | (((val) & 0x1) << 15))
/* Alternate Function at Port 1 Bit # (14) */
#define PORT_P1_ALTSEL0_P14 (0x1 << 14)
#define PORT_P1_ALTSEL0_P14_VAL(val) (((val) & 0x1) << 14)
#define PORT_P1_ALTSEL0_P14_GET(val) ((((val) & PORT_P1_ALTSEL0_P14) >> 14) & 0x1)
#define PORT_P1_ALTSEL0_P14_SET(reg,val) (reg) = ((reg & ~PORT_P1_ALTSEL0_P14) | (((val) & 0x1) << 14))
/* Alternate Function at Port 1 Bit # (13) */
#define PORT_P1_ALTSEL0_P13 (0x1 << 13)
#define PORT_P1_ALTSEL0_P13_VAL(val) (((val) & 0x1) << 13)
#define PORT_P1_ALTSEL0_P13_GET(val) ((((val) & PORT_P1_ALTSEL0_P13) >> 13) & 0x1)
#define PORT_P1_ALTSEL0_P13_SET(reg,val) (reg) = ((reg & ~PORT_P1_ALTSEL0_P13) | (((val) & 0x1) << 13))
/* Alternate Function at Port 1 Bit # (12) */
#define PORT_P1_ALTSEL0_P12 (0x1 << 12)
#define PORT_P1_ALTSEL0_P12_VAL(val) (((val) & 0x1) << 12)
#define PORT_P1_ALTSEL0_P12_GET(val) ((((val) & PORT_P1_ALTSEL0_P12) >> 12) & 0x1)
#define PORT_P1_ALTSEL0_P12_SET(reg,val) (reg) = ((reg & ~PORT_P1_ALTSEL0_P12) | (((val) & 0x1) << 12))
/* Alternate Function at Port 1 Bit # (11) */
#define PORT_P1_ALTSEL0_P11 (0x1 << 11)
#define PORT_P1_ALTSEL0_P11_VAL(val) (((val) & 0x1) << 11)
#define PORT_P1_ALTSEL0_P11_GET(val) ((((val) & PORT_P1_ALTSEL0_P11) >> 11) & 0x1)
#define PORT_P1_ALTSEL0_P11_SET(reg,val) (reg) = ((reg & ~PORT_P1_ALTSEL0_P11) | (((val) & 0x1) << 11))
/* Alternate Function at Port 1 Bit # (10) */
#define PORT_P1_ALTSEL0_P10 (0x1 << 10)
#define PORT_P1_ALTSEL0_P10_VAL(val) (((val) & 0x1) << 10)
#define PORT_P1_ALTSEL0_P10_GET(val) ((((val) & PORT_P1_ALTSEL0_P10) >> 10) & 0x1)
#define PORT_P1_ALTSEL0_P10_SET(reg,val) (reg) = ((reg & ~PORT_P1_ALTSEL0_P10) | (((val) & 0x1) << 10))
/* Alternate Function at Port 1 Bit # (9) */
#define PORT_P1_ALTSEL0_P9 (0x1 << 9)
#define PORT_P1_ALTSEL0_P9_VAL(val) (((val) & 0x1) << 9)
#define PORT_P1_ALTSEL0_P9_GET(val) ((((val) & PORT_P1_ALTSEL0_P9) >> 9) & 0x1)
#define PORT_P1_ALTSEL0_P9_SET(reg,val) (reg) = ((reg & ~PORT_P1_ALTSEL0_P9) | (((val) & 0x1) << 9))
/* Alternate Function at Port 1 Bit # (8) */
#define PORT_P1_ALTSEL0_P8 (0x1 << 8)
#define PORT_P1_ALTSEL0_P8_VAL(val) (((val) & 0x1) << 8)
#define PORT_P1_ALTSEL0_P8_GET(val) ((((val) & PORT_P1_ALTSEL0_P8) >> 8) & 0x1)
#define PORT_P1_ALTSEL0_P8_SET(reg,val) (reg) = ((reg & ~PORT_P1_ALTSEL0_P8) | (((val) & 0x1) << 8))
/* Alternate Function at Port 1 Bit # (7) */
#define PORT_P1_ALTSEL0_P7 (0x1 << 7)
#define PORT_P1_ALTSEL0_P7_VAL(val) (((val) & 0x1) << 7)
#define PORT_P1_ALTSEL0_P7_GET(val) ((((val) & PORT_P1_ALTSEL0_P7) >> 7) & 0x1)
#define PORT_P1_ALTSEL0_P7_SET(reg,val) (reg) = ((reg & ~PORT_P1_ALTSEL0_P7) | (((val) & 0x1) << 7))
/* Alternate Function at Port 1 Bit # (6) */
#define PORT_P1_ALTSEL0_P6 (0x1 << 6)
#define PORT_P1_ALTSEL0_P6_VAL(val) (((val) & 0x1) << 6)
#define PORT_P1_ALTSEL0_P6_GET(val) ((((val) & PORT_P1_ALTSEL0_P6) >> 6) & 0x1)
#define PORT_P1_ALTSEL0_P6_SET(reg,val) (reg) = ((reg & ~PORT_P1_ALTSEL0_P6) | (((val) & 0x1) << 6))
/* Alternate Function at Port 1 Bit # (5) */
#define PORT_P1_ALTSEL0_P5 (0x1 << 5)
#define PORT_P1_ALTSEL0_P5_VAL(val) (((val) & 0x1) << 5)
#define PORT_P1_ALTSEL0_P5_GET(val) ((((val) & PORT_P1_ALTSEL0_P5) >> 5) & 0x1)
#define PORT_P1_ALTSEL0_P5_SET(reg,val) (reg) = ((reg & ~PORT_P1_ALTSEL0_P5) | (((val) & 0x1) << 5))
/* Alternate Function at Port 1 Bit # (4) */
#define PORT_P1_ALTSEL0_P4 (0x1 << 4)
#define PORT_P1_ALTSEL0_P4_VAL(val) (((val) & 0x1) << 4)
#define PORT_P1_ALTSEL0_P4_GET(val) ((((val) & PORT_P1_ALTSEL0_P4) >> 4) & 0x1)
#define PORT_P1_ALTSEL0_P4_SET(reg,val) (reg) = ((reg & ~PORT_P1_ALTSEL0_P4) | (((val) & 0x1) << 4))
/* Alternate Function at Port 1 Bit # (3) */
#define PORT_P1_ALTSEL0_P3 (0x1 << 3)
#define PORT_P1_ALTSEL0_P3_VAL(val) (((val) & 0x1) << 3)
#define PORT_P1_ALTSEL0_P3_GET(val) ((((val) & PORT_P1_ALTSEL0_P3) >> 3) & 0x1)
#define PORT_P1_ALTSEL0_P3_SET(reg,val) (reg) = ((reg & ~PORT_P1_ALTSEL0_P3) | (((val) & 0x1) << 3))
/* Alternate Function at Port 1 Bit # (2) */
#define PORT_P1_ALTSEL0_P2 (0x1 << 2)
#define PORT_P1_ALTSEL0_P2_VAL(val) (((val) & 0x1) << 2)
#define PORT_P1_ALTSEL0_P2_GET(val) ((((val) & PORT_P1_ALTSEL0_P2) >> 2) & 0x1)
#define PORT_P1_ALTSEL0_P2_SET(reg,val) (reg) = ((reg & ~PORT_P1_ALTSEL0_P2) | (((val) & 0x1) << 2))
/* Alternate Function at Port 1 Bit # (1) */
#define PORT_P1_ALTSEL0_P1 (0x1 << 1)
#define PORT_P1_ALTSEL0_P1_VAL(val) (((val) & 0x1) << 1)
#define PORT_P1_ALTSEL0_P1_GET(val) ((((val) & PORT_P1_ALTSEL0_P1) >> 1) & 0x1)
#define PORT_P1_ALTSEL0_P1_SET(reg,val) (reg) = ((reg & ~PORT_P1_ALTSEL0_P1) | (((val) & 0x1) << 1))
/* Alternate Function at Port 1 Bit # (0) */
#define PORT_P1_ALTSEL0_P0 (0x1)
#define PORT_P1_ALTSEL0_P0_VAL(val) (((val) & 0x1) << 0)
#define PORT_P1_ALTSEL0_P0_GET(val) ((((val) & PORT_P1_ALTSEL0_P0) >> 0) & 0x1)
#define PORT_P1_ALTSEL0_P0_SET(reg,val) (reg) = ((reg & ~PORT_P1_ALTSEL0_P0) | (((val) & 0x1) << 0))
/*******************************************************************************
* Port 1 Pull Up Device Enable Register
******************************************************************************/
/* Pull Up Device Enable at Port 1 Bit # (19) */
#define PORT_P1_PUEN_P19 (0x1 << 19)
#define PORT_P1_PUEN_P19_VAL(val) (((val) & 0x1) << 19)
#define PORT_P1_PUEN_P19_GET(val) ((((val) & PORT_P1_PUEN_P19) >> 19) & 0x1)
#define PORT_P1_PUEN_P19_SET(reg,val) (reg) = ((reg & ~PORT_P1_PUEN_P19) | (((val) & 0x1) << 19))
/* Pull Up Device Enable at Port 1 Bit # (18) */
#define PORT_P1_PUEN_P18 (0x1 << 18)
#define PORT_P1_PUEN_P18_VAL(val) (((val) & 0x1) << 18)
#define PORT_P1_PUEN_P18_GET(val) ((((val) & PORT_P1_PUEN_P18) >> 18) & 0x1)
#define PORT_P1_PUEN_P18_SET(reg,val) (reg) = ((reg & ~PORT_P1_PUEN_P18) | (((val) & 0x1) << 18))
/* Pull Up Device Enable at Port 1 Bit # (17) */
#define PORT_P1_PUEN_P17 (0x1 << 17)
#define PORT_P1_PUEN_P17_VAL(val) (((val) & 0x1) << 17)
#define PORT_P1_PUEN_P17_GET(val) ((((val) & PORT_P1_PUEN_P17) >> 17) & 0x1)
#define PORT_P1_PUEN_P17_SET(reg,val) (reg) = ((reg & ~PORT_P1_PUEN_P17) | (((val) & 0x1) << 17))
/* Pull Up Device Enable at Port 1 Bit # (16) */
#define PORT_P1_PUEN_P16 (0x1 << 16)
#define PORT_P1_PUEN_P16_VAL(val) (((val) & 0x1) << 16)
#define PORT_P1_PUEN_P16_GET(val) ((((val) & PORT_P1_PUEN_P16) >> 16) & 0x1)
#define PORT_P1_PUEN_P16_SET(reg,val) (reg) = ((reg & ~PORT_P1_PUEN_P16) | (((val) & 0x1) << 16))
/* Pull Up Device Enable at Port 1 Bit # (15) */
#define PORT_P1_PUEN_P15 (0x1 << 15)
#define PORT_P1_PUEN_P15_VAL(val) (((val) & 0x1) << 15)
#define PORT_P1_PUEN_P15_GET(val) ((((val) & PORT_P1_PUEN_P15) >> 15) & 0x1)
#define PORT_P1_PUEN_P15_SET(reg,val) (reg) = ((reg & ~PORT_P1_PUEN_P15) | (((val) & 0x1) << 15))
/* Pull Up Device Enable at Port 1 Bit # (14) */
#define PORT_P1_PUEN_P14 (0x1 << 14)
#define PORT_P1_PUEN_P14_VAL(val) (((val) & 0x1) << 14)
#define PORT_P1_PUEN_P14_GET(val) ((((val) & PORT_P1_PUEN_P14) >> 14) & 0x1)
#define PORT_P1_PUEN_P14_SET(reg,val) (reg) = ((reg & ~PORT_P1_PUEN_P14) | (((val) & 0x1) << 14))
/* Pull Up Device Enable at Port 1 Bit # (13) */
#define PORT_P1_PUEN_P13 (0x1 << 13)
#define PORT_P1_PUEN_P13_VAL(val) (((val) & 0x1) << 13)
#define PORT_P1_PUEN_P13_GET(val) ((((val) & PORT_P1_PUEN_P13) >> 13) & 0x1)
#define PORT_P1_PUEN_P13_SET(reg,val) (reg) = ((reg & ~PORT_P1_PUEN_P13) | (((val) & 0x1) << 13))
/* Pull Up Device Enable at Port 1 Bit # (12) */
#define PORT_P1_PUEN_P12 (0x1 << 12)
#define PORT_P1_PUEN_P12_VAL(val) (((val) & 0x1) << 12)
#define PORT_P1_PUEN_P12_GET(val) ((((val) & PORT_P1_PUEN_P12) >> 12) & 0x1)
#define PORT_P1_PUEN_P12_SET(reg,val) (reg) = ((reg & ~PORT_P1_PUEN_P12) | (((val) & 0x1) << 12))
/* Pull Up Device Enable at Port 1 Bit # (11) */
#define PORT_P1_PUEN_P11 (0x1 << 11)
#define PORT_P1_PUEN_P11_VAL(val) (((val) & 0x1) << 11)
#define PORT_P1_PUEN_P11_GET(val) ((((val) & PORT_P1_PUEN_P11) >> 11) & 0x1)
#define PORT_P1_PUEN_P11_SET(reg,val) (reg) = ((reg & ~PORT_P1_PUEN_P11) | (((val) & 0x1) << 11))
/* Pull Up Device Enable at Port 1 Bit # (10) */
#define PORT_P1_PUEN_P10 (0x1 << 10)
#define PORT_P1_PUEN_P10_VAL(val) (((val) & 0x1) << 10)
#define PORT_P1_PUEN_P10_GET(val) ((((val) & PORT_P1_PUEN_P10) >> 10) & 0x1)
#define PORT_P1_PUEN_P10_SET(reg,val) (reg) = ((reg & ~PORT_P1_PUEN_P10) | (((val) & 0x1) << 10))
/* Pull Up Device Enable at Port 1 Bit # (9) */
#define PORT_P1_PUEN_P9 (0x1 << 9)
#define PORT_P1_PUEN_P9_VAL(val) (((val) & 0x1) << 9)
#define PORT_P1_PUEN_P9_GET(val) ((((val) & PORT_P1_PUEN_P9) >> 9) & 0x1)
#define PORT_P1_PUEN_P9_SET(reg,val) (reg) = ((reg & ~PORT_P1_PUEN_P9) | (((val) & 0x1) << 9))
/* Pull Up Device Enable at Port 1 Bit # (8) */
#define PORT_P1_PUEN_P8 (0x1 << 8)
#define PORT_P1_PUEN_P8_VAL(val) (((val) & 0x1) << 8)
#define PORT_P1_PUEN_P8_GET(val) ((((val) & PORT_P1_PUEN_P8) >> 8) & 0x1)
#define PORT_P1_PUEN_P8_SET(reg,val) (reg) = ((reg & ~PORT_P1_PUEN_P8) | (((val) & 0x1) << 8))
/* Pull Up Device Enable at Port 1 Bit # (7) */
#define PORT_P1_PUEN_P7 (0x1 << 7)
#define PORT_P1_PUEN_P7_VAL(val) (((val) & 0x1) << 7)
#define PORT_P1_PUEN_P7_GET(val) ((((val) & PORT_P1_PUEN_P7) >> 7) & 0x1)
#define PORT_P1_PUEN_P7_SET(reg,val) (reg) = ((reg & ~PORT_P1_PUEN_P7) | (((val) & 0x1) << 7))
/* Pull Up Device Enable at Port 1 Bit # (6) */
#define PORT_P1_PUEN_P6 (0x1 << 6)
#define PORT_P1_PUEN_P6_VAL(val) (((val) & 0x1) << 6)
#define PORT_P1_PUEN_P6_GET(val) ((((val) & PORT_P1_PUEN_P6) >> 6) & 0x1)
#define PORT_P1_PUEN_P6_SET(reg,val) (reg) = ((reg & ~PORT_P1_PUEN_P6) | (((val) & 0x1) << 6))
/* Pull Up Device Enable at Port 1 Bit # (5) */
#define PORT_P1_PUEN_P5 (0x1 << 5)
#define PORT_P1_PUEN_P5_VAL(val) (((val) & 0x1) << 5)
#define PORT_P1_PUEN_P5_GET(val) ((((val) & PORT_P1_PUEN_P5) >> 5) & 0x1)
#define PORT_P1_PUEN_P5_SET(reg,val) (reg) = ((reg & ~PORT_P1_PUEN_P5) | (((val) & 0x1) << 5))
/* Pull Up Device Enable at Port 1 Bit # (4) */
#define PORT_P1_PUEN_P4 (0x1 << 4)
#define PORT_P1_PUEN_P4_VAL(val) (((val) & 0x1) << 4)
#define PORT_P1_PUEN_P4_GET(val) ((((val) & PORT_P1_PUEN_P4) >> 4) & 0x1)
#define PORT_P1_PUEN_P4_SET(reg,val) (reg) = ((reg & ~PORT_P1_PUEN_P4) | (((val) & 0x1) << 4))
/* Pull Up Device Enable at Port 1 Bit # (3) */
#define PORT_P1_PUEN_P3 (0x1 << 3)
#define PORT_P1_PUEN_P3_VAL(val) (((val) & 0x1) << 3)
#define PORT_P1_PUEN_P3_GET(val) ((((val) & PORT_P1_PUEN_P3) >> 3) & 0x1)
#define PORT_P1_PUEN_P3_SET(reg,val) (reg) = ((reg & ~PORT_P1_PUEN_P3) | (((val) & 0x1) << 3))
/* Pull Up Device Enable at Port 1 Bit # (2) */
#define PORT_P1_PUEN_P2 (0x1 << 2)
#define PORT_P1_PUEN_P2_VAL(val) (((val) & 0x1) << 2)
#define PORT_P1_PUEN_P2_GET(val) ((((val) & PORT_P1_PUEN_P2) >> 2) & 0x1)
#define PORT_P1_PUEN_P2_SET(reg,val) (reg) = ((reg & ~PORT_P1_PUEN_P2) | (((val) & 0x1) << 2))
/* Pull Up Device Enable at Port 1 Bit # (1) */
#define PORT_P1_PUEN_P1 (0x1 << 1)
#define PORT_P1_PUEN_P1_VAL(val) (((val) & 0x1) << 1)
#define PORT_P1_PUEN_P1_GET(val) ((((val) & PORT_P1_PUEN_P1) >> 1) & 0x1)
#define PORT_P1_PUEN_P1_SET(reg,val) (reg) = ((reg & ~PORT_P1_PUEN_P1) | (((val) & 0x1) << 1))
/* Pull Up Device Enable at Port 1 Bit # (0) */
#define PORT_P1_PUEN_P0 (0x1)
#define PORT_P1_PUEN_P0_VAL(val) (((val) & 0x1) << 0)
#define PORT_P1_PUEN_P0_GET(val) ((((val) & PORT_P1_PUEN_P0) >> 0) & 0x1)
#define PORT_P1_PUEN_P0_SET(reg,val) (reg) = ((reg & ~PORT_P1_PUEN_P0) | (((val) & 0x1) << 0))
/*******************************************************************************
* External Interrupt Control Register 0
******************************************************************************/
/* Type of Level or Edge Detection of EXINT15 (19) */
#define PORT_P1_EXINTCR0_EXINT15 (0x1 << 19)
#define PORT_P1_EXINTCR0_EXINT15_VAL(val) (((val) & 0x1) << 19)
#define PORT_P1_EXINTCR0_EXINT15_GET(val) ((((val) & PORT_P1_EXINTCR0_EXINT15) >> 19) & 0x1)
#define PORT_P1_EXINTCR0_EXINT15_SET(reg,val) (reg) = ((reg & ~PORT_P1_EXINTCR0_EXINT15) | (((val) & 0x1) << 19))
/* Type of Level or Edge Detection of EXINT11 (18) */
#define PORT_P1_EXINTCR0_EXINT11 (0x1 << 18)
#define PORT_P1_EXINTCR0_EXINT11_VAL(val) (((val) & 0x1) << 18)
#define PORT_P1_EXINTCR0_EXINT11_GET(val) ((((val) & PORT_P1_EXINTCR0_EXINT11) >> 18) & 0x1)
#define PORT_P1_EXINTCR0_EXINT11_SET(reg,val) (reg) = ((reg & ~PORT_P1_EXINTCR0_EXINT11) | (((val) & 0x1) << 18))
/* Type of Level or Edge Detection of EXINT12 (17) */
#define PORT_P1_EXINTCR0_EXINT12 (0x1 << 17)
#define PORT_P1_EXINTCR0_EXINT12_VAL(val) (((val) & 0x1) << 17)
#define PORT_P1_EXINTCR0_EXINT12_GET(val) ((((val) & PORT_P1_EXINTCR0_EXINT12) >> 17) & 0x1)
#define PORT_P1_EXINTCR0_EXINT12_SET(reg,val) (reg) = ((reg & ~PORT_P1_EXINTCR0_EXINT12) | (((val) & 0x1) << 17))
/* Type of Level or Edge Detection of EXINT13 (16) */
#define PORT_P1_EXINTCR0_EXINT13 (0x1 << 16)
#define PORT_P1_EXINTCR0_EXINT13_VAL(val) (((val) & 0x1) << 16)
#define PORT_P1_EXINTCR0_EXINT13_GET(val) ((((val) & PORT_P1_EXINTCR0_EXINT13) >> 16) & 0x1)
#define PORT_P1_EXINTCR0_EXINT13_SET(reg,val) (reg) = ((reg & ~PORT_P1_EXINTCR0_EXINT13) | (((val) & 0x1) << 16))
/* Type of Level or Edge Detection of EXINT14 (15) */
#define PORT_P1_EXINTCR0_EXINT14 (0x1 << 15)
#define PORT_P1_EXINTCR0_EXINT14_VAL(val) (((val) & 0x1) << 15)
#define PORT_P1_EXINTCR0_EXINT14_GET(val) ((((val) & PORT_P1_EXINTCR0_EXINT14) >> 15) & 0x1)
#define PORT_P1_EXINTCR0_EXINT14_SET(reg,val) (reg) = ((reg & ~PORT_P1_EXINTCR0_EXINT14) | (((val) & 0x1) << 15))
/*******************************************************************************
* External Interrupt Control Register 1
******************************************************************************/
/* Type of Level or Edge Detection of EXINT15 (19) */
#define PORT_P1_EXINTCR1_EXINT15 (0x1 << 19)
#define PORT_P1_EXINTCR1_EXINT15_VAL(val) (((val) & 0x1) << 19)
#define PORT_P1_EXINTCR1_EXINT15_GET(val) ((((val) & PORT_P1_EXINTCR1_EXINT15) >> 19) & 0x1)
#define PORT_P1_EXINTCR1_EXINT15_SET(reg,val) (reg) = ((reg & ~PORT_P1_EXINTCR1_EXINT15) | (((val) & 0x1) << 19))
/* Type of Level or Edge Detection of EXINT11 (18) */
#define PORT_P1_EXINTCR1_EXINT11 (0x1 << 18)
#define PORT_P1_EXINTCR1_EXINT11_VAL(val) (((val) & 0x1) << 18)
#define PORT_P1_EXINTCR1_EXINT11_GET(val) ((((val) & PORT_P1_EXINTCR1_EXINT11) >> 18) & 0x1)
#define PORT_P1_EXINTCR1_EXINT11_SET(reg,val) (reg) = ((reg & ~PORT_P1_EXINTCR1_EXINT11) | (((val) & 0x1) << 18))
/* Type of Level or Edge Detection of EXINT12 (17) */
#define PORT_P1_EXINTCR1_EXINT12 (0x1 << 17)
#define PORT_P1_EXINTCR1_EXINT12_VAL(val) (((val) & 0x1) << 17)
#define PORT_P1_EXINTCR1_EXINT12_GET(val) ((((val) & PORT_P1_EXINTCR1_EXINT12) >> 17) & 0x1)
#define PORT_P1_EXINTCR1_EXINT12_SET(reg,val) (reg) = ((reg & ~PORT_P1_EXINTCR1_EXINT12) | (((val) & 0x1) << 17))
/* Type of Level or Edge Detection of EXINT13 (16) */
#define PORT_P1_EXINTCR1_EXINT13 (0x1 << 16)
#define PORT_P1_EXINTCR1_EXINT13_VAL(val) (((val) & 0x1) << 16)
#define PORT_P1_EXINTCR1_EXINT13_GET(val) ((((val) & PORT_P1_EXINTCR1_EXINT13) >> 16) & 0x1)
#define PORT_P1_EXINTCR1_EXINT13_SET(reg,val) (reg) = ((reg & ~PORT_P1_EXINTCR1_EXINT13) | (((val) & 0x1) << 16))
/* Type of Level or Edge Detection of EXINT14 (15) */
#define PORT_P1_EXINTCR1_EXINT14 (0x1 << 15)
#define PORT_P1_EXINTCR1_EXINT14_VAL(val) (((val) & 0x1) << 15)
#define PORT_P1_EXINTCR1_EXINT14_GET(val) ((((val) & PORT_P1_EXINTCR1_EXINT14) >> 15) & 0x1)
#define PORT_P1_EXINTCR1_EXINT14_SET(reg,val) (reg) = ((reg & ~PORT_P1_EXINTCR1_EXINT14) | (((val) & 0x1) << 15))
/*******************************************************************************
* P1_IRNEN Register
******************************************************************************/
/* EXINT15 Interrupt Request Enable (19) */
#define PORT_P1_IRNEN_EXINT15 (0x1 << 19)
#define PORT_P1_IRNEN_EXINT15_VAL(val) (((val) & 0x1) << 19)
#define PORT_P1_IRNEN_EXINT15_GET(val) ((((val) & PORT_P1_IRNEN_EXINT15) >> 19) & 0x1)
#define PORT_P1_IRNEN_EXINT15_SET(reg,val) (reg) = ((reg & ~PORT_P1_IRNEN_EXINT15) | (((val) & 0x1) << 19))
/* EXINT11 Interrupt Request Enable (18) */
#define PORT_P1_IRNEN_EXINT11 (0x1 << 18)
#define PORT_P1_IRNEN_EXINT11_VAL(val) (((val) & 0x1) << 18)
#define PORT_P1_IRNEN_EXINT11_GET(val) ((((val) & PORT_P1_IRNEN_EXINT11) >> 18) & 0x1)
#define PORT_P1_IRNEN_EXINT11_SET(reg,val) (reg) = ((reg & ~PORT_P1_IRNEN_EXINT11) | (((val) & 0x1) << 18))
/* EXINT12 Interrupt Request Enable (17) */
#define PORT_P1_IRNEN_EXINT12 (0x1 << 17)
#define PORT_P1_IRNEN_EXINT12_VAL(val) (((val) & 0x1) << 17)
#define PORT_P1_IRNEN_EXINT12_GET(val) ((((val) & PORT_P1_IRNEN_EXINT12) >> 17) & 0x1)
#define PORT_P1_IRNEN_EXINT12_SET(reg,val) (reg) = ((reg & ~PORT_P1_IRNEN_EXINT12) | (((val) & 0x1) << 17))
/* EXINT13 Interrupt Request Enable (16) */
#define PORT_P1_IRNEN_EXINT13 (0x1 << 16)
#define PORT_P1_IRNEN_EXINT13_VAL(val) (((val) & 0x1) << 16)
#define PORT_P1_IRNEN_EXINT13_GET(val) ((((val) & PORT_P1_IRNEN_EXINT13) >> 16) & 0x1)
#define PORT_P1_IRNEN_EXINT13_SET(reg,val) (reg) = ((reg & ~PORT_P1_IRNEN_EXINT13) | (((val) & 0x1) << 16))
/* EXINT14 Interrupt Request Enable (15) */
#define PORT_P1_IRNEN_EXINT14 (0x1 << 15)
#define PORT_P1_IRNEN_EXINT14_VAL(val) (((val) & 0x1) << 15)
#define PORT_P1_IRNEN_EXINT14_GET(val) ((((val) & PORT_P1_IRNEN_EXINT14) >> 15) & 0x1)
#define PORT_P1_IRNEN_EXINT14_SET(reg,val) (reg) = ((reg & ~PORT_P1_IRNEN_EXINT14) | (((val) & 0x1) << 15))
/*******************************************************************************
* P1_IRNICR Register
******************************************************************************/
/* EXINT15 Interrupt Request (19) */
#define PORT_P1_IRNICR_EXINT15 (0x1 << 19)
#define PORT_P1_IRNICR_EXINT15_GET(val) ((((val) & PORT_P1_IRNICR_EXINT15) >> 19) & 0x1)
/* EXINT11 Interrupt Request (18) */
#define PORT_P1_IRNICR_EXINT11 (0x1 << 18)
#define PORT_P1_IRNICR_EXINT11_GET(val) ((((val) & PORT_P1_IRNICR_EXINT11) >> 18) & 0x1)
/* EXINT12 Interrupt Request (17) */
#define PORT_P1_IRNICR_EXINT12 (0x1 << 17)
#define PORT_P1_IRNICR_EXINT12_GET(val) ((((val) & PORT_P1_IRNICR_EXINT12) >> 17) & 0x1)
/* EXINT13 Interrupt Request (16) */
#define PORT_P1_IRNICR_EXINT13 (0x1 << 16)
#define PORT_P1_IRNICR_EXINT13_GET(val) ((((val) & PORT_P1_IRNICR_EXINT13) >> 16) & 0x1)
/* EXINT14 Interrupt Request (15) */
#define PORT_P1_IRNICR_EXINT14 (0x1 << 15)
#define PORT_P1_IRNICR_EXINT14_GET(val) ((((val) & PORT_P1_IRNICR_EXINT14) >> 15) & 0x1)
/*******************************************************************************
* P1_IRNCR Register
******************************************************************************/
/* EXINT15 Interrupt Request (19) */
#define PORT_P1_IRNCR_EXINT15 (0x1 << 19)
#define PORT_P1_IRNCR_EXINT15_GET(val) ((((val) & PORT_P1_IRNCR_EXINT15) >> 19) & 0x1)
/* EXINT11 Interrupt Request (18) */
#define PORT_P1_IRNCR_EXINT11 (0x1 << 18)
#define PORT_P1_IRNCR_EXINT11_GET(val) ((((val) & PORT_P1_IRNCR_EXINT11) >> 18) & 0x1)
/* EXINT12 Interrupt Request (17) */
#define PORT_P1_IRNCR_EXINT12 (0x1 << 17)
#define PORT_P1_IRNCR_EXINT12_GET(val) ((((val) & PORT_P1_IRNCR_EXINT12) >> 17) & 0x1)
/* EXINT13 Interrupt Request (16) */
#define PORT_P1_IRNCR_EXINT13 (0x1 << 16)
#define PORT_P1_IRNCR_EXINT13_GET(val) ((((val) & PORT_P1_IRNCR_EXINT13) >> 16) & 0x1)
/* EXINT14 Interrupt Request (15) */
#define PORT_P1_IRNCR_EXINT14 (0x1 << 15)
#define PORT_P1_IRNCR_EXINT14_GET(val) ((((val) & PORT_P1_IRNCR_EXINT14) >> 15) & 0x1)
/*******************************************************************************
* P1 External Event Detection Configuration Register
******************************************************************************/
/* EXINT15 configured for Edge or Level Detection (19) */
#define PORT_P1_IRNCFG_EXINT15 (0x1 << 19)
#define PORT_P1_IRNCFG_EXINT15_VAL(val) (((val) & 0x1) << 19)
#define PORT_P1_IRNCFG_EXINT15_GET(val) ((((val) & PORT_P1_IRNCFG_EXINT15) >> 19) & 0x1)
#define PORT_P1_IRNCFG_EXINT15_SET(reg,val) (reg) = ((reg & ~PORT_P1_IRNCFG_EXINT15) | (((val) & 0x1) << 19))
/* EXINT11 configured for Edge or Level Detection (18) */
#define PORT_P1_IRNCFG_EXINT11 (0x1 << 18)
#define PORT_P1_IRNCFG_EXINT11_VAL(val) (((val) & 0x1) << 18)
#define PORT_P1_IRNCFG_EXINT11_GET(val) ((((val) & PORT_P1_IRNCFG_EXINT11) >> 18) & 0x1)
#define PORT_P1_IRNCFG_EXINT11_SET(reg,val) (reg) = ((reg & ~PORT_P1_IRNCFG_EXINT11) | (((val) & 0x1) << 18))
/* EXINT12 configured for Edge or Level Detection (17) */
#define PORT_P1_IRNCFG_EXINT12 (0x1 << 17)
#define PORT_P1_IRNCFG_EXINT12_VAL(val) (((val) & 0x1) << 17)
#define PORT_P1_IRNCFG_EXINT12_GET(val) ((((val) & PORT_P1_IRNCFG_EXINT12) >> 17) & 0x1)
#define PORT_P1_IRNCFG_EXINT12_SET(reg,val) (reg) = ((reg & ~PORT_P1_IRNCFG_EXINT12) | (((val) & 0x1) << 17))
/* EXINT13 configured for Edge or Level Detection (16) */
#define PORT_P1_IRNCFG_EXINT13 (0x1 << 16)
#define PORT_P1_IRNCFG_EXINT13_VAL(val) (((val) & 0x1) << 16)
#define PORT_P1_IRNCFG_EXINT13_GET(val) ((((val) & PORT_P1_IRNCFG_EXINT13) >> 16) & 0x1)
#define PORT_P1_IRNCFG_EXINT13_SET(reg,val) (reg) = ((reg & ~PORT_P1_IRNCFG_EXINT13) | (((val) & 0x1) << 16))
/* EXINT14 configured for Edge or Level Detection (15) */
#define PORT_P1_IRNCFG_EXINT14 (0x1 << 15)
#define PORT_P1_IRNCFG_EXINT14_VAL(val) (((val) & 0x1) << 15)
#define PORT_P1_IRNCFG_EXINT14_GET(val) ((((val) & PORT_P1_IRNCFG_EXINT14) >> 15) & 0x1)
#define PORT_P1_IRNCFG_EXINT14_SET(reg,val) (reg) = ((reg & ~PORT_P1_IRNCFG_EXINT14) | (((val) & 0x1) << 15))
/*******************************************************************************
* P1_IRNENSET Register
******************************************************************************/
/* Set Interrupt Node Enable Flag EXINT15 (19) */
#define PORT_P1_IRNENSET_EXINT15 (0x1 << 19)
#define PORT_P1_IRNENSET_EXINT15_VAL(val) (((val) & 0x1) << 19)
#define PORT_P1_IRNENSET_EXINT15_SET(reg,val) (reg) = (((reg & ~PORT_P1_IRNENSET_EXINT15) | (val) & 1) << 19)
/* Set Interrupt Node Enable Flag EXINT11 (18) */
#define PORT_P1_IRNENSET_EXINT11 (0x1 << 18)
#define PORT_P1_IRNENSET_EXINT11_VAL(val) (((val) & 0x1) << 18)
#define PORT_P1_IRNENSET_EXINT11_SET(reg,val) (reg) = (((reg & ~PORT_P1_IRNENSET_EXINT11) | (val) & 1) << 18)
/* Set Interrupt Node Enable Flag EXINT12 (17) */
#define PORT_P1_IRNENSET_EXINT12 (0x1 << 17)
#define PORT_P1_IRNENSET_EXINT12_VAL(val) (((val) & 0x1) << 17)
#define PORT_P1_IRNENSET_EXINT12_SET(reg,val) (reg) = (((reg & ~PORT_P1_IRNENSET_EXINT12) | (val) & 1) << 17)
/* Set Interrupt Node Enable Flag EXINT13 (16) */
#define PORT_P1_IRNENSET_EXINT13 (0x1 << 16)
#define PORT_P1_IRNENSET_EXINT13_VAL(val) (((val) & 0x1) << 16)
#define PORT_P1_IRNENSET_EXINT13_SET(reg,val) (reg) = (((reg & ~PORT_P1_IRNENSET_EXINT13) | (val) & 1) << 16)
/* Set Interrupt Node Enable Flag EXINT14 (15) */
#define PORT_P1_IRNENSET_EXINT14 (0x1 << 15)
#define PORT_P1_IRNENSET_EXINT14_VAL(val) (((val) & 0x1) << 15)
#define PORT_P1_IRNENSET_EXINT14_SET(reg,val) (reg) = (((reg & ~PORT_P1_IRNENSET_EXINT14) | (val) & 1) << 15)
/*******************************************************************************
* P1_IRNENCLR Register
******************************************************************************/
/* Clear Interrupt Node Enable Flag EXINT15 (19) */
#define PORT_P1_IRNENCLR_EXINT15 (0x1 << 19)
#define PORT_P1_IRNENCLR_EXINT15_VAL(val) (((val) & 0x1) << 19)
#define PORT_P1_IRNENCLR_EXINT15_SET(reg,val) (reg) = (((reg & ~PORT_P1_IRNENCLR_EXINT15) | (val) & 1) << 19)
/* Clear Interrupt Node Enable Flag EXINT11 (18) */
#define PORT_P1_IRNENCLR_EXINT11 (0x1 << 18)
#define PORT_P1_IRNENCLR_EXINT11_VAL(val) (((val) & 0x1) << 18)
#define PORT_P1_IRNENCLR_EXINT11_SET(reg,val) (reg) = (((reg & ~PORT_P1_IRNENCLR_EXINT11) | (val) & 1) << 18)
/* Clear Interrupt Node Enable Flag EXINT12 (17) */
#define PORT_P1_IRNENCLR_EXINT12 (0x1 << 17)
#define PORT_P1_IRNENCLR_EXINT12_VAL(val) (((val) & 0x1) << 17)
#define PORT_P1_IRNENCLR_EXINT12_SET(reg,val) (reg) = (((reg & ~PORT_P1_IRNENCLR_EXINT12) | (val) & 1) << 17)
/* Clear Interrupt Node Enable Flag EXINT13 (16) */
#define PORT_P1_IRNENCLR_EXINT13 (0x1 << 16)
#define PORT_P1_IRNENCLR_EXINT13_VAL(val) (((val) & 0x1) << 16)
#define PORT_P1_IRNENCLR_EXINT13_SET(reg,val) (reg) = (((reg & ~PORT_P1_IRNENCLR_EXINT13) | (val) & 1) << 16)
/* Clear Interrupt Node Enable Flag EXINT14 (15) */
#define PORT_P1_IRNENCLR_EXINT14 (0x1 << 15)
#define PORT_P1_IRNENCLR_EXINT14_VAL(val) (((val) & 0x1) << 15)
#define PORT_P1_IRNENCLR_EXINT14_SET(reg,val) (reg) = (((reg & ~PORT_P1_IRNENCLR_EXINT14) | (val) & 1) << 15)
/*******************************************************************************
* Port 2 Data Output Register
******************************************************************************/
/* Port 2 Pin # Output Value (19) */
#define PORT_P2_OUT_P19 (0x1 << 19)
#define PORT_P2_OUT_P19_VAL(val) (((val) & 0x1) << 19)
#define PORT_P2_OUT_P19_GET(val) ((((val) & PORT_P2_OUT_P19) >> 19) & 0x1)
#define PORT_P2_OUT_P19_SET(reg,val) (reg) = ((reg & ~PORT_P2_OUT_P19) | (((val) & 0x1) << 19))
/* Port 2 Pin # Output Value (18) */
#define PORT_P2_OUT_P18 (0x1 << 18)
#define PORT_P2_OUT_P18_VAL(val) (((val) & 0x1) << 18)
#define PORT_P2_OUT_P18_GET(val) ((((val) & PORT_P2_OUT_P18) >> 18) & 0x1)
#define PORT_P2_OUT_P18_SET(reg,val) (reg) = ((reg & ~PORT_P2_OUT_P18) | (((val) & 0x1) << 18))
/* Port 2 Pin # Output Value (17) */
#define PORT_P2_OUT_P17 (0x1 << 17)
#define PORT_P2_OUT_P17_VAL(val) (((val) & 0x1) << 17)
#define PORT_P2_OUT_P17_GET(val) ((((val) & PORT_P2_OUT_P17) >> 17) & 0x1)
#define PORT_P2_OUT_P17_SET(reg,val) (reg) = ((reg & ~PORT_P2_OUT_P17) | (((val) & 0x1) << 17))
/* Port 2 Pin # Output Value (16) */
#define PORT_P2_OUT_P16 (0x1 << 16)
#define PORT_P2_OUT_P16_VAL(val) (((val) & 0x1) << 16)
#define PORT_P2_OUT_P16_GET(val) ((((val) & PORT_P2_OUT_P16) >> 16) & 0x1)
#define PORT_P2_OUT_P16_SET(reg,val) (reg) = ((reg & ~PORT_P2_OUT_P16) | (((val) & 0x1) << 16))
/* Port 2 Pin # Output Value (15) */
#define PORT_P2_OUT_P15 (0x1 << 15)
#define PORT_P2_OUT_P15_VAL(val) (((val) & 0x1) << 15)
#define PORT_P2_OUT_P15_GET(val) ((((val) & PORT_P2_OUT_P15) >> 15) & 0x1)
#define PORT_P2_OUT_P15_SET(reg,val) (reg) = ((reg & ~PORT_P2_OUT_P15) | (((val) & 0x1) << 15))
/* Port 2 Pin # Output Value (14) */
#define PORT_P2_OUT_P14 (0x1 << 14)
#define PORT_P2_OUT_P14_VAL(val) (((val) & 0x1) << 14)
#define PORT_P2_OUT_P14_GET(val) ((((val) & PORT_P2_OUT_P14) >> 14) & 0x1)
#define PORT_P2_OUT_P14_SET(reg,val) (reg) = ((reg & ~PORT_P2_OUT_P14) | (((val) & 0x1) << 14))
/* Port 2 Pin # Output Value (13) */
#define PORT_P2_OUT_P13 (0x1 << 13)
#define PORT_P2_OUT_P13_VAL(val) (((val) & 0x1) << 13)
#define PORT_P2_OUT_P13_GET(val) ((((val) & PORT_P2_OUT_P13) >> 13) & 0x1)
#define PORT_P2_OUT_P13_SET(reg,val) (reg) = ((reg & ~PORT_P2_OUT_P13) | (((val) & 0x1) << 13))
/* Port 2 Pin # Output Value (12) */
#define PORT_P2_OUT_P12 (0x1 << 12)
#define PORT_P2_OUT_P12_VAL(val) (((val) & 0x1) << 12)
#define PORT_P2_OUT_P12_GET(val) ((((val) & PORT_P2_OUT_P12) >> 12) & 0x1)
#define PORT_P2_OUT_P12_SET(reg,val) (reg) = ((reg & ~PORT_P2_OUT_P12) | (((val) & 0x1) << 12))
/* Port 2 Pin # Output Value (11) */
#define PORT_P2_OUT_P11 (0x1 << 11)
#define PORT_P2_OUT_P11_VAL(val) (((val) & 0x1) << 11)
#define PORT_P2_OUT_P11_GET(val) ((((val) & PORT_P2_OUT_P11) >> 11) & 0x1)
#define PORT_P2_OUT_P11_SET(reg,val) (reg) = ((reg & ~PORT_P2_OUT_P11) | (((val) & 0x1) << 11))
/* Port 2 Pin # Output Value (10) */
#define PORT_P2_OUT_P10 (0x1 << 10)
#define PORT_P2_OUT_P10_VAL(val) (((val) & 0x1) << 10)
#define PORT_P2_OUT_P10_GET(val) ((((val) & PORT_P2_OUT_P10) >> 10) & 0x1)
#define PORT_P2_OUT_P10_SET(reg,val) (reg) = ((reg & ~PORT_P2_OUT_P10) | (((val) & 0x1) << 10))
/* Port 2 Pin # Output Value (9) */
#define PORT_P2_OUT_P9 (0x1 << 9)
#define PORT_P2_OUT_P9_VAL(val) (((val) & 0x1) << 9)
#define PORT_P2_OUT_P9_GET(val) ((((val) & PORT_P2_OUT_P9) >> 9) & 0x1)
#define PORT_P2_OUT_P9_SET(reg,val) (reg) = ((reg & ~PORT_P2_OUT_P9) | (((val) & 0x1) << 9))
/* Port 2 Pin # Output Value (8) */
#define PORT_P2_OUT_P8 (0x1 << 8)
#define PORT_P2_OUT_P8_VAL(val) (((val) & 0x1) << 8)
#define PORT_P2_OUT_P8_GET(val) ((((val) & PORT_P2_OUT_P8) >> 8) & 0x1)
#define PORT_P2_OUT_P8_SET(reg,val) (reg) = ((reg & ~PORT_P2_OUT_P8) | (((val) & 0x1) << 8))
/* Port 2 Pin # Output Value (7) */
#define PORT_P2_OUT_P7 (0x1 << 7)
#define PORT_P2_OUT_P7_VAL(val) (((val) & 0x1) << 7)
#define PORT_P2_OUT_P7_GET(val) ((((val) & PORT_P2_OUT_P7) >> 7) & 0x1)
#define PORT_P2_OUT_P7_SET(reg,val) (reg) = ((reg & ~PORT_P2_OUT_P7) | (((val) & 0x1) << 7))
/* Port 2 Pin # Output Value (6) */
#define PORT_P2_OUT_P6 (0x1 << 6)
#define PORT_P2_OUT_P6_VAL(val) (((val) & 0x1) << 6)
#define PORT_P2_OUT_P6_GET(val) ((((val) & PORT_P2_OUT_P6) >> 6) & 0x1)
#define PORT_P2_OUT_P6_SET(reg,val) (reg) = ((reg & ~PORT_P2_OUT_P6) | (((val) & 0x1) << 6))
/* Port 2 Pin # Output Value (5) */
#define PORT_P2_OUT_P5 (0x1 << 5)
#define PORT_P2_OUT_P5_VAL(val) (((val) & 0x1) << 5)
#define PORT_P2_OUT_P5_GET(val) ((((val) & PORT_P2_OUT_P5) >> 5) & 0x1)
#define PORT_P2_OUT_P5_SET(reg,val) (reg) = ((reg & ~PORT_P2_OUT_P5) | (((val) & 0x1) << 5))
/* Port 2 Pin # Output Value (4) */
#define PORT_P2_OUT_P4 (0x1 << 4)
#define PORT_P2_OUT_P4_VAL(val) (((val) & 0x1) << 4)
#define PORT_P2_OUT_P4_GET(val) ((((val) & PORT_P2_OUT_P4) >> 4) & 0x1)
#define PORT_P2_OUT_P4_SET(reg,val) (reg) = ((reg & ~PORT_P2_OUT_P4) | (((val) & 0x1) << 4))
/* Port 2 Pin # Output Value (3) */
#define PORT_P2_OUT_P3 (0x1 << 3)
#define PORT_P2_OUT_P3_VAL(val) (((val) & 0x1) << 3)
#define PORT_P2_OUT_P3_GET(val) ((((val) & PORT_P2_OUT_P3) >> 3) & 0x1)
#define PORT_P2_OUT_P3_SET(reg,val) (reg) = ((reg & ~PORT_P2_OUT_P3) | (((val) & 0x1) << 3))
/* Port 2 Pin # Output Value (2) */
#define PORT_P2_OUT_P2 (0x1 << 2)
#define PORT_P2_OUT_P2_VAL(val) (((val) & 0x1) << 2)
#define PORT_P2_OUT_P2_GET(val) ((((val) & PORT_P2_OUT_P2) >> 2) & 0x1)
#define PORT_P2_OUT_P2_SET(reg,val) (reg) = ((reg & ~PORT_P2_OUT_P2) | (((val) & 0x1) << 2))
/* Port 2 Pin # Output Value (1) */
#define PORT_P2_OUT_P1 (0x1 << 1)
#define PORT_P2_OUT_P1_VAL(val) (((val) & 0x1) << 1)
#define PORT_P2_OUT_P1_GET(val) ((((val) & PORT_P2_OUT_P1) >> 1) & 0x1)
#define PORT_P2_OUT_P1_SET(reg,val) (reg) = ((reg & ~PORT_P2_OUT_P1) | (((val) & 0x1) << 1))
/* Port 2 Pin # Output Value (0) */
#define PORT_P2_OUT_P0 (0x1)
#define PORT_P2_OUT_P0_VAL(val) (((val) & 0x1) << 0)
#define PORT_P2_OUT_P0_GET(val) ((((val) & PORT_P2_OUT_P0) >> 0) & 0x1)
#define PORT_P2_OUT_P0_SET(reg,val) (reg) = ((reg & ~PORT_P2_OUT_P0) | (((val) & 0x1) << 0))
/*******************************************************************************
* Port 2 Data Input Register
******************************************************************************/
/* Port 2 Pin # Latched Input Value (19) */
#define PORT_P2_IN_P19 (0x1 << 19)
#define PORT_P2_IN_P19_GET(val) ((((val) & PORT_P2_IN_P19) >> 19) & 0x1)
/* Port 2 Pin # Latched Input Value (18) */
#define PORT_P2_IN_P18 (0x1 << 18)
#define PORT_P2_IN_P18_GET(val) ((((val) & PORT_P2_IN_P18) >> 18) & 0x1)
/* Port 2 Pin # Latched Input Value (17) */
#define PORT_P2_IN_P17 (0x1 << 17)
#define PORT_P2_IN_P17_GET(val) ((((val) & PORT_P2_IN_P17) >> 17) & 0x1)
/* Port 2 Pin # Latched Input Value (16) */
#define PORT_P2_IN_P16 (0x1 << 16)
#define PORT_P2_IN_P16_GET(val) ((((val) & PORT_P2_IN_P16) >> 16) & 0x1)
/* Port 2 Pin # Latched Input Value (15) */
#define PORT_P2_IN_P15 (0x1 << 15)
#define PORT_P2_IN_P15_GET(val) ((((val) & PORT_P2_IN_P15) >> 15) & 0x1)
/* Port 2 Pin # Latched Input Value (14) */
#define PORT_P2_IN_P14 (0x1 << 14)
#define PORT_P2_IN_P14_GET(val) ((((val) & PORT_P2_IN_P14) >> 14) & 0x1)
/* Port 2 Pin # Latched Input Value (13) */
#define PORT_P2_IN_P13 (0x1 << 13)
#define PORT_P2_IN_P13_GET(val) ((((val) & PORT_P2_IN_P13) >> 13) & 0x1)
/* Port 2 Pin # Latched Input Value (12) */
#define PORT_P2_IN_P12 (0x1 << 12)
#define PORT_P2_IN_P12_GET(val) ((((val) & PORT_P2_IN_P12) >> 12) & 0x1)
/* Port 2 Pin # Latched Input Value (11) */
#define PORT_P2_IN_P11 (0x1 << 11)
#define PORT_P2_IN_P11_GET(val) ((((val) & PORT_P2_IN_P11) >> 11) & 0x1)
/* Port 2 Pin # Latched Input Value (10) */
#define PORT_P2_IN_P10 (0x1 << 10)
#define PORT_P2_IN_P10_GET(val) ((((val) & PORT_P2_IN_P10) >> 10) & 0x1)
/* Port 2 Pin # Latched Input Value (9) */
#define PORT_P2_IN_P9 (0x1 << 9)
#define PORT_P2_IN_P9_GET(val) ((((val) & PORT_P2_IN_P9) >> 9) & 0x1)
/* Port 2 Pin # Latched Input Value (8) */
#define PORT_P2_IN_P8 (0x1 << 8)
#define PORT_P2_IN_P8_GET(val) ((((val) & PORT_P2_IN_P8) >> 8) & 0x1)
/* Port 2 Pin # Latched Input Value (7) */
#define PORT_P2_IN_P7 (0x1 << 7)
#define PORT_P2_IN_P7_GET(val) ((((val) & PORT_P2_IN_P7) >> 7) & 0x1)
/* Port 2 Pin # Latched Input Value (6) */
#define PORT_P2_IN_P6 (0x1 << 6)
#define PORT_P2_IN_P6_GET(val) ((((val) & PORT_P2_IN_P6) >> 6) & 0x1)
/* Port 2 Pin # Latched Input Value (5) */
#define PORT_P2_IN_P5 (0x1 << 5)
#define PORT_P2_IN_P5_GET(val) ((((val) & PORT_P2_IN_P5) >> 5) & 0x1)
/* Port 2 Pin # Latched Input Value (4) */
#define PORT_P2_IN_P4 (0x1 << 4)
#define PORT_P2_IN_P4_GET(val) ((((val) & PORT_P2_IN_P4) >> 4) & 0x1)
/* Port 2 Pin # Latched Input Value (3) */
#define PORT_P2_IN_P3 (0x1 << 3)
#define PORT_P2_IN_P3_GET(val) ((((val) & PORT_P2_IN_P3) >> 3) & 0x1)
/* Port 2 Pin # Latched Input Value (2) */
#define PORT_P2_IN_P2 (0x1 << 2)
#define PORT_P2_IN_P2_GET(val) ((((val) & PORT_P2_IN_P2) >> 2) & 0x1)
/* Port 2 Pin # Latched Input Value (1) */
#define PORT_P2_IN_P1 (0x1 << 1)
#define PORT_P2_IN_P1_GET(val) ((((val) & PORT_P2_IN_P1) >> 1) & 0x1)
/* Port 2 Pin # Latched Input Value (0) */
#define PORT_P2_IN_P0 (0x1)
#define PORT_P2_IN_P0_GET(val) ((((val) & PORT_P2_IN_P0) >> 0) & 0x1)
/*******************************************************************************
* Port 2 Direction Register
******************************************************************************/
/* Port 2 Pin #Direction Control (19) */
#define PORT_P2_DIR_P19 (0x1 << 19)
#define PORT_P2_DIR_P19_VAL(val) (((val) & 0x1) << 19)
#define PORT_P2_DIR_P19_GET(val) ((((val) & PORT_P2_DIR_P19) >> 19) & 0x1)
#define PORT_P2_DIR_P19_SET(reg,val) (reg) = ((reg & ~PORT_P2_DIR_P19) | (((val) & 0x1) << 19))
/* Port 2 Pin #Direction Control (18) */
#define PORT_P2_DIR_P18 (0x1 << 18)
#define PORT_P2_DIR_P18_VAL(val) (((val) & 0x1) << 18)
#define PORT_P2_DIR_P18_GET(val) ((((val) & PORT_P2_DIR_P18) >> 18) & 0x1)
#define PORT_P2_DIR_P18_SET(reg,val) (reg) = ((reg & ~PORT_P2_DIR_P18) | (((val) & 0x1) << 18))
/* Port 2 Pin #Direction Control (17) */
#define PORT_P2_DIR_P17 (0x1 << 17)
#define PORT_P2_DIR_P17_VAL(val) (((val) & 0x1) << 17)
#define PORT_P2_DIR_P17_GET(val) ((((val) & PORT_P2_DIR_P17) >> 17) & 0x1)
#define PORT_P2_DIR_P17_SET(reg,val) (reg) = ((reg & ~PORT_P2_DIR_P17) | (((val) & 0x1) << 17))
/* Port 2 Pin #Direction Control (16) */
#define PORT_P2_DIR_P16 (0x1 << 16)
#define PORT_P2_DIR_P16_VAL(val) (((val) & 0x1) << 16)
#define PORT_P2_DIR_P16_GET(val) ((((val) & PORT_P2_DIR_P16) >> 16) & 0x1)
#define PORT_P2_DIR_P16_SET(reg,val) (reg) = ((reg & ~PORT_P2_DIR_P16) | (((val) & 0x1) << 16))
/* Port 2 Pin #Direction Control (15) */
#define PORT_P2_DIR_P15 (0x1 << 15)
#define PORT_P2_DIR_P15_VAL(val) (((val) & 0x1) << 15)
#define PORT_P2_DIR_P15_GET(val) ((((val) & PORT_P2_DIR_P15) >> 15) & 0x1)
#define PORT_P2_DIR_P15_SET(reg,val) (reg) = ((reg & ~PORT_P2_DIR_P15) | (((val) & 0x1) << 15))
/* Port 2 Pin #Direction Control (14) */
#define PORT_P2_DIR_P14 (0x1 << 14)
#define PORT_P2_DIR_P14_VAL(val) (((val) & 0x1) << 14)
#define PORT_P2_DIR_P14_GET(val) ((((val) & PORT_P2_DIR_P14) >> 14) & 0x1)
#define PORT_P2_DIR_P14_SET(reg,val) (reg) = ((reg & ~PORT_P2_DIR_P14) | (((val) & 0x1) << 14))
/* Port 2 Pin #Direction Control (13) */
#define PORT_P2_DIR_P13 (0x1 << 13)
#define PORT_P2_DIR_P13_VAL(val) (((val) & 0x1) << 13)
#define PORT_P2_DIR_P13_GET(val) ((((val) & PORT_P2_DIR_P13) >> 13) & 0x1)
#define PORT_P2_DIR_P13_SET(reg,val) (reg) = ((reg & ~PORT_P2_DIR_P13) | (((val) & 0x1) << 13))
/* Port 2 Pin #Direction Control (12) */
#define PORT_P2_DIR_P12 (0x1 << 12)
#define PORT_P2_DIR_P12_VAL(val) (((val) & 0x1) << 12)
#define PORT_P2_DIR_P12_GET(val) ((((val) & PORT_P2_DIR_P12) >> 12) & 0x1)
#define PORT_P2_DIR_P12_SET(reg,val) (reg) = ((reg & ~PORT_P2_DIR_P12) | (((val) & 0x1) << 12))
/* Port 2 Pin #Direction Control (11) */
#define PORT_P2_DIR_P11 (0x1 << 11)
#define PORT_P2_DIR_P11_VAL(val) (((val) & 0x1) << 11)
#define PORT_P2_DIR_P11_GET(val) ((((val) & PORT_P2_DIR_P11) >> 11) & 0x1)
#define PORT_P2_DIR_P11_SET(reg,val) (reg) = ((reg & ~PORT_P2_DIR_P11) | (((val) & 0x1) << 11))
/* Port 2 Pin #Direction Control (10) */
#define PORT_P2_DIR_P10 (0x1 << 10)
#define PORT_P2_DIR_P10_VAL(val) (((val) & 0x1) << 10)
#define PORT_P2_DIR_P10_GET(val) ((((val) & PORT_P2_DIR_P10) >> 10) & 0x1)
#define PORT_P2_DIR_P10_SET(reg,val) (reg) = ((reg & ~PORT_P2_DIR_P10) | (((val) & 0x1) << 10))
/* Port 2 Pin #Direction Control (9) */
#define PORT_P2_DIR_P9 (0x1 << 9)
#define PORT_P2_DIR_P9_VAL(val) (((val) & 0x1) << 9)
#define PORT_P2_DIR_P9_GET(val) ((((val) & PORT_P2_DIR_P9) >> 9) & 0x1)
#define PORT_P2_DIR_P9_SET(reg,val) (reg) = ((reg & ~PORT_P2_DIR_P9) | (((val) & 0x1) << 9))
/* Port 2 Pin #Direction Control (8) */
#define PORT_P2_DIR_P8 (0x1 << 8)
#define PORT_P2_DIR_P8_VAL(val) (((val) & 0x1) << 8)
#define PORT_P2_DIR_P8_GET(val) ((((val) & PORT_P2_DIR_P8) >> 8) & 0x1)
#define PORT_P2_DIR_P8_SET(reg,val) (reg) = ((reg & ~PORT_P2_DIR_P8) | (((val) & 0x1) << 8))
/* Port 2 Pin #Direction Control (7) */
#define PORT_P2_DIR_P7 (0x1 << 7)
#define PORT_P2_DIR_P7_VAL(val) (((val) & 0x1) << 7)
#define PORT_P2_DIR_P7_GET(val) ((((val) & PORT_P2_DIR_P7) >> 7) & 0x1)
#define PORT_P2_DIR_P7_SET(reg,val) (reg) = ((reg & ~PORT_P2_DIR_P7) | (((val) & 0x1) << 7))
/* Port 2 Pin #Direction Control (6) */
#define PORT_P2_DIR_P6 (0x1 << 6)
#define PORT_P2_DIR_P6_VAL(val) (((val) & 0x1) << 6)
#define PORT_P2_DIR_P6_GET(val) ((((val) & PORT_P2_DIR_P6) >> 6) & 0x1)
#define PORT_P2_DIR_P6_SET(reg,val) (reg) = ((reg & ~PORT_P2_DIR_P6) | (((val) & 0x1) << 6))
/* Port 2 Pin #Direction Control (5) */
#define PORT_P2_DIR_P5 (0x1 << 5)
#define PORT_P2_DIR_P5_VAL(val) (((val) & 0x1) << 5)
#define PORT_P2_DIR_P5_GET(val) ((((val) & PORT_P2_DIR_P5) >> 5) & 0x1)
#define PORT_P2_DIR_P5_SET(reg,val) (reg) = ((reg & ~PORT_P2_DIR_P5) | (((val) & 0x1) << 5))
/* Port 2 Pin #Direction Control (4) */
#define PORT_P2_DIR_P4 (0x1 << 4)
#define PORT_P2_DIR_P4_VAL(val) (((val) & 0x1) << 4)
#define PORT_P2_DIR_P4_GET(val) ((((val) & PORT_P2_DIR_P4) >> 4) & 0x1)
#define PORT_P2_DIR_P4_SET(reg,val) (reg) = ((reg & ~PORT_P2_DIR_P4) | (((val) & 0x1) << 4))
/* Port 2 Pin #Direction Control (3) */
#define PORT_P2_DIR_P3 (0x1 << 3)
#define PORT_P2_DIR_P3_VAL(val) (((val) & 0x1) << 3)
#define PORT_P2_DIR_P3_GET(val) ((((val) & PORT_P2_DIR_P3) >> 3) & 0x1)
#define PORT_P2_DIR_P3_SET(reg,val) (reg) = ((reg & ~PORT_P2_DIR_P3) | (((val) & 0x1) << 3))
/* Port 2 Pin #Direction Control (2) */
#define PORT_P2_DIR_P2 (0x1 << 2)
#define PORT_P2_DIR_P2_VAL(val) (((val) & 0x1) << 2)
#define PORT_P2_DIR_P2_GET(val) ((((val) & PORT_P2_DIR_P2) >> 2) & 0x1)
#define PORT_P2_DIR_P2_SET(reg,val) (reg) = ((reg & ~PORT_P2_DIR_P2) | (((val) & 0x1) << 2))
/* Port 2 Pin #Direction Control (1) */
#define PORT_P2_DIR_P1 (0x1 << 1)
#define PORT_P2_DIR_P1_VAL(val) (((val) & 0x1) << 1)
#define PORT_P2_DIR_P1_GET(val) ((((val) & PORT_P2_DIR_P1) >> 1) & 0x1)
#define PORT_P2_DIR_P1_SET(reg,val) (reg) = ((reg & ~PORT_P2_DIR_P1) | (((val) & 0x1) << 1))
/* Port 2 Pin #Direction Control (0) */
#define PORT_P2_DIR_P0 (0x1)
#define PORT_P2_DIR_P0_VAL(val) (((val) & 0x1) << 0)
#define PORT_P2_DIR_P0_GET(val) ((((val) & PORT_P2_DIR_P0) >> 0) & 0x1)
#define PORT_P2_DIR_P0_SET(reg,val) (reg) = ((reg & ~PORT_P2_DIR_P0) | (((val) & 0x1) << 0))
/*******************************************************************************
* Port 2 Alternate Function Select Register 0
******************************************************************************/
/* Alternate Function at Port 2 Bit # (19) */
#define PORT_P2_ALTSEL0_P19 (0x1 << 19)
#define PORT_P2_ALTSEL0_P19_VAL(val) (((val) & 0x1) << 19)
#define PORT_P2_ALTSEL0_P19_GET(val) ((((val) & PORT_P2_ALTSEL0_P19) >> 19) & 0x1)
#define PORT_P2_ALTSEL0_P19_SET(reg,val) (reg) = ((reg & ~PORT_P2_ALTSEL0_P19) | (((val) & 0x1) << 19))
/* Alternate Function at Port 2 Bit # (18) */
#define PORT_P2_ALTSEL0_P18 (0x1 << 18)
#define PORT_P2_ALTSEL0_P18_VAL(val) (((val) & 0x1) << 18)
#define PORT_P2_ALTSEL0_P18_GET(val) ((((val) & PORT_P2_ALTSEL0_P18) >> 18) & 0x1)
#define PORT_P2_ALTSEL0_P18_SET(reg,val) (reg) = ((reg & ~PORT_P2_ALTSEL0_P18) | (((val) & 0x1) << 18))
/* Alternate Function at Port 2 Bit # (17) */
#define PORT_P2_ALTSEL0_P17 (0x1 << 17)
#define PORT_P2_ALTSEL0_P17_VAL(val) (((val) & 0x1) << 17)
#define PORT_P2_ALTSEL0_P17_GET(val) ((((val) & PORT_P2_ALTSEL0_P17) >> 17) & 0x1)
#define PORT_P2_ALTSEL0_P17_SET(reg,val) (reg) = ((reg & ~PORT_P2_ALTSEL0_P17) | (((val) & 0x1) << 17))
/* Alternate Function at Port 2 Bit # (16) */
#define PORT_P2_ALTSEL0_P16 (0x1 << 16)
#define PORT_P2_ALTSEL0_P16_VAL(val) (((val) & 0x1) << 16)
#define PORT_P2_ALTSEL0_P16_GET(val) ((((val) & PORT_P2_ALTSEL0_P16) >> 16) & 0x1)
#define PORT_P2_ALTSEL0_P16_SET(reg,val) (reg) = ((reg & ~PORT_P2_ALTSEL0_P16) | (((val) & 0x1) << 16))
/* Alternate Function at Port 2 Bit # (15) */
#define PORT_P2_ALTSEL0_P15 (0x1 << 15)
#define PORT_P2_ALTSEL0_P15_VAL(val) (((val) & 0x1) << 15)
#define PORT_P2_ALTSEL0_P15_GET(val) ((((val) & PORT_P2_ALTSEL0_P15) >> 15) & 0x1)
#define PORT_P2_ALTSEL0_P15_SET(reg,val) (reg) = ((reg & ~PORT_P2_ALTSEL0_P15) | (((val) & 0x1) << 15))
/* Alternate Function at Port 2 Bit # (14) */
#define PORT_P2_ALTSEL0_P14 (0x1 << 14)
#define PORT_P2_ALTSEL0_P14_VAL(val) (((val) & 0x1) << 14)
#define PORT_P2_ALTSEL0_P14_GET(val) ((((val) & PORT_P2_ALTSEL0_P14) >> 14) & 0x1)
#define PORT_P2_ALTSEL0_P14_SET(reg,val) (reg) = ((reg & ~PORT_P2_ALTSEL0_P14) | (((val) & 0x1) << 14))
/* Alternate Function at Port 2 Bit # (13) */
#define PORT_P2_ALTSEL0_P13 (0x1 << 13)
#define PORT_P2_ALTSEL0_P13_VAL(val) (((val) & 0x1) << 13)
#define PORT_P2_ALTSEL0_P13_GET(val) ((((val) & PORT_P2_ALTSEL0_P13) >> 13) & 0x1)
#define PORT_P2_ALTSEL0_P13_SET(reg,val) (reg) = ((reg & ~PORT_P2_ALTSEL0_P13) | (((val) & 0x1) << 13))
/* Alternate Function at Port 2 Bit # (12) */
#define PORT_P2_ALTSEL0_P12 (0x1 << 12)
#define PORT_P2_ALTSEL0_P12_VAL(val) (((val) & 0x1) << 12)
#define PORT_P2_ALTSEL0_P12_GET(val) ((((val) & PORT_P2_ALTSEL0_P12) >> 12) & 0x1)
#define PORT_P2_ALTSEL0_P12_SET(reg,val) (reg) = ((reg & ~PORT_P2_ALTSEL0_P12) | (((val) & 0x1) << 12))
/* Alternate Function at Port 2 Bit # (11) */
#define PORT_P2_ALTSEL0_P11 (0x1 << 11)
#define PORT_P2_ALTSEL0_P11_VAL(val) (((val) & 0x1) << 11)
#define PORT_P2_ALTSEL0_P11_GET(val) ((((val) & PORT_P2_ALTSEL0_P11) >> 11) & 0x1)
#define PORT_P2_ALTSEL0_P11_SET(reg,val) (reg) = ((reg & ~PORT_P2_ALTSEL0_P11) | (((val) & 0x1) << 11))
/* Alternate Function at Port 2 Bit # (10) */
#define PORT_P2_ALTSEL0_P10 (0x1 << 10)
#define PORT_P2_ALTSEL0_P10_VAL(val) (((val) & 0x1) << 10)
#define PORT_P2_ALTSEL0_P10_GET(val) ((((val) & PORT_P2_ALTSEL0_P10) >> 10) & 0x1)
#define PORT_P2_ALTSEL0_P10_SET(reg,val) (reg) = ((reg & ~PORT_P2_ALTSEL0_P10) | (((val) & 0x1) << 10))
/* Alternate Function at Port 2 Bit # (9) */
#define PORT_P2_ALTSEL0_P9 (0x1 << 9)
#define PORT_P2_ALTSEL0_P9_VAL(val) (((val) & 0x1) << 9)
#define PORT_P2_ALTSEL0_P9_GET(val) ((((val) & PORT_P2_ALTSEL0_P9) >> 9) & 0x1)
#define PORT_P2_ALTSEL0_P9_SET(reg,val) (reg) = ((reg & ~PORT_P2_ALTSEL0_P9) | (((val) & 0x1) << 9))
/* Alternate Function at Port 2 Bit # (8) */
#define PORT_P2_ALTSEL0_P8 (0x1 << 8)
#define PORT_P2_ALTSEL0_P8_VAL(val) (((val) & 0x1) << 8)
#define PORT_P2_ALTSEL0_P8_GET(val) ((((val) & PORT_P2_ALTSEL0_P8) >> 8) & 0x1)
#define PORT_P2_ALTSEL0_P8_SET(reg,val) (reg) = ((reg & ~PORT_P2_ALTSEL0_P8) | (((val) & 0x1) << 8))
/* Alternate Function at Port 2 Bit # (7) */
#define PORT_P2_ALTSEL0_P7 (0x1 << 7)
#define PORT_P2_ALTSEL0_P7_VAL(val) (((val) & 0x1) << 7)
#define PORT_P2_ALTSEL0_P7_GET(val) ((((val) & PORT_P2_ALTSEL0_P7) >> 7) & 0x1)
#define PORT_P2_ALTSEL0_P7_SET(reg,val) (reg) = ((reg & ~PORT_P2_ALTSEL0_P7) | (((val) & 0x1) << 7))
/* Alternate Function at Port 2 Bit # (6) */
#define PORT_P2_ALTSEL0_P6 (0x1 << 6)
#define PORT_P2_ALTSEL0_P6_VAL(val) (((val) & 0x1) << 6)
#define PORT_P2_ALTSEL0_P6_GET(val) ((((val) & PORT_P2_ALTSEL0_P6) >> 6) & 0x1)
#define PORT_P2_ALTSEL0_P6_SET(reg,val) (reg) = ((reg & ~PORT_P2_ALTSEL0_P6) | (((val) & 0x1) << 6))
/* Alternate Function at Port 2 Bit # (5) */
#define PORT_P2_ALTSEL0_P5 (0x1 << 5)
#define PORT_P2_ALTSEL0_P5_VAL(val) (((val) & 0x1) << 5)
#define PORT_P2_ALTSEL0_P5_GET(val) ((((val) & PORT_P2_ALTSEL0_P5) >> 5) & 0x1)
#define PORT_P2_ALTSEL0_P5_SET(reg,val) (reg) = ((reg & ~PORT_P2_ALTSEL0_P5) | (((val) & 0x1) << 5))
/* Alternate Function at Port 2 Bit # (4) */
#define PORT_P2_ALTSEL0_P4 (0x1 << 4)
#define PORT_P2_ALTSEL0_P4_VAL(val) (((val) & 0x1) << 4)
#define PORT_P2_ALTSEL0_P4_GET(val) ((((val) & PORT_P2_ALTSEL0_P4) >> 4) & 0x1)
#define PORT_P2_ALTSEL0_P4_SET(reg,val) (reg) = ((reg & ~PORT_P2_ALTSEL0_P4) | (((val) & 0x1) << 4))
/* Alternate Function at Port 2 Bit # (3) */
#define PORT_P2_ALTSEL0_P3 (0x1 << 3)
#define PORT_P2_ALTSEL0_P3_VAL(val) (((val) & 0x1) << 3)
#define PORT_P2_ALTSEL0_P3_GET(val) ((((val) & PORT_P2_ALTSEL0_P3) >> 3) & 0x1)
#define PORT_P2_ALTSEL0_P3_SET(reg,val) (reg) = ((reg & ~PORT_P2_ALTSEL0_P3) | (((val) & 0x1) << 3))
/* Alternate Function at Port 2 Bit # (2) */
#define PORT_P2_ALTSEL0_P2 (0x1 << 2)
#define PORT_P2_ALTSEL0_P2_VAL(val) (((val) & 0x1) << 2)
#define PORT_P2_ALTSEL0_P2_GET(val) ((((val) & PORT_P2_ALTSEL0_P2) >> 2) & 0x1)
#define PORT_P2_ALTSEL0_P2_SET(reg,val) (reg) = ((reg & ~PORT_P2_ALTSEL0_P2) | (((val) & 0x1) << 2))
/* Alternate Function at Port 2 Bit # (1) */
#define PORT_P2_ALTSEL0_P1 (0x1 << 1)
#define PORT_P2_ALTSEL0_P1_VAL(val) (((val) & 0x1) << 1)
#define PORT_P2_ALTSEL0_P1_GET(val) ((((val) & PORT_P2_ALTSEL0_P1) >> 1) & 0x1)
#define PORT_P2_ALTSEL0_P1_SET(reg,val) (reg) = ((reg & ~PORT_P2_ALTSEL0_P1) | (((val) & 0x1) << 1))
/* Alternate Function at Port 2 Bit # (0) */
#define PORT_P2_ALTSEL0_P0 (0x1)
#define PORT_P2_ALTSEL0_P0_VAL(val) (((val) & 0x1) << 0)
#define PORT_P2_ALTSEL0_P0_GET(val) ((((val) & PORT_P2_ALTSEL0_P0) >> 0) & 0x1)
#define PORT_P2_ALTSEL0_P0_SET(reg,val) (reg) = ((reg & ~PORT_P2_ALTSEL0_P0) | (((val) & 0x1) << 0))
/*******************************************************************************
* Port 2 Pull Up Device Enable Register
******************************************************************************/
/* Pull Up Device Enable at Port 2 Bit # (19) */
#define PORT_P2_PUEN_P19 (0x1 << 19)
#define PORT_P2_PUEN_P19_VAL(val) (((val) & 0x1) << 19)
#define PORT_P2_PUEN_P19_GET(val) ((((val) & PORT_P2_PUEN_P19) >> 19) & 0x1)
#define PORT_P2_PUEN_P19_SET(reg,val) (reg) = ((reg & ~PORT_P2_PUEN_P19) | (((val) & 0x1) << 19))
/* Pull Up Device Enable at Port 2 Bit # (18) */
#define PORT_P2_PUEN_P18 (0x1 << 18)
#define PORT_P2_PUEN_P18_VAL(val) (((val) & 0x1) << 18)
#define PORT_P2_PUEN_P18_GET(val) ((((val) & PORT_P2_PUEN_P18) >> 18) & 0x1)
#define PORT_P2_PUEN_P18_SET(reg,val) (reg) = ((reg & ~PORT_P2_PUEN_P18) | (((val) & 0x1) << 18))
/* Pull Up Device Enable at Port 2 Bit # (17) */
#define PORT_P2_PUEN_P17 (0x1 << 17)
#define PORT_P2_PUEN_P17_VAL(val) (((val) & 0x1) << 17)
#define PORT_P2_PUEN_P17_GET(val) ((((val) & PORT_P2_PUEN_P17) >> 17) & 0x1)
#define PORT_P2_PUEN_P17_SET(reg,val) (reg) = ((reg & ~PORT_P2_PUEN_P17) | (((val) & 0x1) << 17))
/* Pull Up Device Enable at Port 2 Bit # (16) */
#define PORT_P2_PUEN_P16 (0x1 << 16)
#define PORT_P2_PUEN_P16_VAL(val) (((val) & 0x1) << 16)
#define PORT_P2_PUEN_P16_GET(val) ((((val) & PORT_P2_PUEN_P16) >> 16) & 0x1)
#define PORT_P2_PUEN_P16_SET(reg,val) (reg) = ((reg & ~PORT_P2_PUEN_P16) | (((val) & 0x1) << 16))
/* Pull Up Device Enable at Port 2 Bit # (15) */
#define PORT_P2_PUEN_P15 (0x1 << 15)
#define PORT_P2_PUEN_P15_VAL(val) (((val) & 0x1) << 15)
#define PORT_P2_PUEN_P15_GET(val) ((((val) & PORT_P2_PUEN_P15) >> 15) & 0x1)
#define PORT_P2_PUEN_P15_SET(reg,val) (reg) = ((reg & ~PORT_P2_PUEN_P15) | (((val) & 0x1) << 15))
/* Pull Up Device Enable at Port 2 Bit # (14) */
#define PORT_P2_PUEN_P14 (0x1 << 14)
#define PORT_P2_PUEN_P14_VAL(val) (((val) & 0x1) << 14)
#define PORT_P2_PUEN_P14_GET(val) ((((val) & PORT_P2_PUEN_P14) >> 14) & 0x1)
#define PORT_P2_PUEN_P14_SET(reg,val) (reg) = ((reg & ~PORT_P2_PUEN_P14) | (((val) & 0x1) << 14))
/* Pull Up Device Enable at Port 2 Bit # (13) */
#define PORT_P2_PUEN_P13 (0x1 << 13)
#define PORT_P2_PUEN_P13_VAL(val) (((val) & 0x1) << 13)
#define PORT_P2_PUEN_P13_GET(val) ((((val) & PORT_P2_PUEN_P13) >> 13) & 0x1)
#define PORT_P2_PUEN_P13_SET(reg,val) (reg) = ((reg & ~PORT_P2_PUEN_P13) | (((val) & 0x1) << 13))
/* Pull Up Device Enable at Port 2 Bit # (12) */
#define PORT_P2_PUEN_P12 (0x1 << 12)
#define PORT_P2_PUEN_P12_VAL(val) (((val) & 0x1) << 12)
#define PORT_P2_PUEN_P12_GET(val) ((((val) & PORT_P2_PUEN_P12) >> 12) & 0x1)
#define PORT_P2_PUEN_P12_SET(reg,val) (reg) = ((reg & ~PORT_P2_PUEN_P12) | (((val) & 0x1) << 12))
/* Pull Up Device Enable at Port 2 Bit # (11) */
#define PORT_P2_PUEN_P11 (0x1 << 11)
#define PORT_P2_PUEN_P11_VAL(val) (((val) & 0x1) << 11)
#define PORT_P2_PUEN_P11_GET(val) ((((val) & PORT_P2_PUEN_P11) >> 11) & 0x1)
#define PORT_P2_PUEN_P11_SET(reg,val) (reg) = ((reg & ~PORT_P2_PUEN_P11) | (((val) & 0x1) << 11))
/* Pull Up Device Enable at Port 2 Bit # (10) */
#define PORT_P2_PUEN_P10 (0x1 << 10)
#define PORT_P2_PUEN_P10_VAL(val) (((val) & 0x1) << 10)
#define PORT_P2_PUEN_P10_GET(val) ((((val) & PORT_P2_PUEN_P10) >> 10) & 0x1)
#define PORT_P2_PUEN_P10_SET(reg,val) (reg) = ((reg & ~PORT_P2_PUEN_P10) | (((val) & 0x1) << 10))
/* Pull Up Device Enable at Port 2 Bit # (9) */
#define PORT_P2_PUEN_P9 (0x1 << 9)
#define PORT_P2_PUEN_P9_VAL(val) (((val) & 0x1) << 9)
#define PORT_P2_PUEN_P9_GET(val) ((((val) & PORT_P2_PUEN_P9) >> 9) & 0x1)
#define PORT_P2_PUEN_P9_SET(reg,val) (reg) = ((reg & ~PORT_P2_PUEN_P9) | (((val) & 0x1) << 9))
/* Pull Up Device Enable at Port 2 Bit # (8) */
#define PORT_P2_PUEN_P8 (0x1 << 8)
#define PORT_P2_PUEN_P8_VAL(val) (((val) & 0x1) << 8)
#define PORT_P2_PUEN_P8_GET(val) ((((val) & PORT_P2_PUEN_P8) >> 8) & 0x1)
#define PORT_P2_PUEN_P8_SET(reg,val) (reg) = ((reg & ~PORT_P2_PUEN_P8) | (((val) & 0x1) << 8))
/* Pull Up Device Enable at Port 2 Bit # (7) */
#define PORT_P2_PUEN_P7 (0x1 << 7)
#define PORT_P2_PUEN_P7_VAL(val) (((val) & 0x1) << 7)
#define PORT_P2_PUEN_P7_GET(val) ((((val) & PORT_P2_PUEN_P7) >> 7) & 0x1)
#define PORT_P2_PUEN_P7_SET(reg,val) (reg) = ((reg & ~PORT_P2_PUEN_P7) | (((val) & 0x1) << 7))
/* Pull Up Device Enable at Port 2 Bit # (6) */
#define PORT_P2_PUEN_P6 (0x1 << 6)
#define PORT_P2_PUEN_P6_VAL(val) (((val) & 0x1) << 6)
#define PORT_P2_PUEN_P6_GET(val) ((((val) & PORT_P2_PUEN_P6) >> 6) & 0x1)
#define PORT_P2_PUEN_P6_SET(reg,val) (reg) = ((reg & ~PORT_P2_PUEN_P6) | (((val) & 0x1) << 6))
/* Pull Up Device Enable at Port 2 Bit # (5) */
#define PORT_P2_PUEN_P5 (0x1 << 5)
#define PORT_P2_PUEN_P5_VAL(val) (((val) & 0x1) << 5)
#define PORT_P2_PUEN_P5_GET(val) ((((val) & PORT_P2_PUEN_P5) >> 5) & 0x1)
#define PORT_P2_PUEN_P5_SET(reg,val) (reg) = ((reg & ~PORT_P2_PUEN_P5) | (((val) & 0x1) << 5))
/* Pull Up Device Enable at Port 2 Bit # (4) */
#define PORT_P2_PUEN_P4 (0x1 << 4)
#define PORT_P2_PUEN_P4_VAL(val) (((val) & 0x1) << 4)
#define PORT_P2_PUEN_P4_GET(val) ((((val) & PORT_P2_PUEN_P4) >> 4) & 0x1)
#define PORT_P2_PUEN_P4_SET(reg,val) (reg) = ((reg & ~PORT_P2_PUEN_P4) | (((val) & 0x1) << 4))
/* Pull Up Device Enable at Port 2 Bit # (3) */
#define PORT_P2_PUEN_P3 (0x1 << 3)
#define PORT_P2_PUEN_P3_VAL(val) (((val) & 0x1) << 3)
#define PORT_P2_PUEN_P3_GET(val) ((((val) & PORT_P2_PUEN_P3) >> 3) & 0x1)
#define PORT_P2_PUEN_P3_SET(reg,val) (reg) = ((reg & ~PORT_P2_PUEN_P3) | (((val) & 0x1) << 3))
/* Pull Up Device Enable at Port 2 Bit # (2) */
#define PORT_P2_PUEN_P2 (0x1 << 2)
#define PORT_P2_PUEN_P2_VAL(val) (((val) & 0x1) << 2)
#define PORT_P2_PUEN_P2_GET(val) ((((val) & PORT_P2_PUEN_P2) >> 2) & 0x1)
#define PORT_P2_PUEN_P2_SET(reg,val) (reg) = ((reg & ~PORT_P2_PUEN_P2) | (((val) & 0x1) << 2))
/* Pull Up Device Enable at Port 2 Bit # (1) */
#define PORT_P2_PUEN_P1 (0x1 << 1)
#define PORT_P2_PUEN_P1_VAL(val) (((val) & 0x1) << 1)
#define PORT_P2_PUEN_P1_GET(val) ((((val) & PORT_P2_PUEN_P1) >> 1) & 0x1)
#define PORT_P2_PUEN_P1_SET(reg,val) (reg) = ((reg & ~PORT_P2_PUEN_P1) | (((val) & 0x1) << 1))
/* Pull Up Device Enable at Port 2 Bit # (0) */
#define PORT_P2_PUEN_P0 (0x1)
#define PORT_P2_PUEN_P0_VAL(val) (((val) & 0x1) << 0)
#define PORT_P2_PUEN_P0_GET(val) ((((val) & PORT_P2_PUEN_P0) >> 0) & 0x1)
#define PORT_P2_PUEN_P0_SET(reg,val) (reg) = ((reg & ~PORT_P2_PUEN_P0) | (((val) & 0x1) << 0))
/*******************************************************************************
* Port 3 Data Output Register
******************************************************************************/
/* Port 3 Pin # Output Value (19) */
#define PORT_P3_OUT_P19 (0x1 << 19)
#define PORT_P3_OUT_P19_VAL(val) (((val) & 0x1) << 19)
#define PORT_P3_OUT_P19_GET(val) ((((val) & PORT_P3_OUT_P19) >> 19) & 0x1)
#define PORT_P3_OUT_P19_SET(reg,val) (reg) = ((reg & ~PORT_P3_OUT_P19) | (((val) & 0x1) << 19))
/* Port 3 Pin # Output Value (18) */
#define PORT_P3_OUT_P18 (0x1 << 18)
#define PORT_P3_OUT_P18_VAL(val) (((val) & 0x1) << 18)
#define PORT_P3_OUT_P18_GET(val) ((((val) & PORT_P3_OUT_P18) >> 18) & 0x1)
#define PORT_P3_OUT_P18_SET(reg,val) (reg) = ((reg & ~PORT_P3_OUT_P18) | (((val) & 0x1) << 18))
/* Port 3 Pin # Output Value (17) */
#define PORT_P3_OUT_P17 (0x1 << 17)
#define PORT_P3_OUT_P17_VAL(val) (((val) & 0x1) << 17)
#define PORT_P3_OUT_P17_GET(val) ((((val) & PORT_P3_OUT_P17) >> 17) & 0x1)
#define PORT_P3_OUT_P17_SET(reg,val) (reg) = ((reg & ~PORT_P3_OUT_P17) | (((val) & 0x1) << 17))
/* Port 3 Pin # Output Value (16) */
#define PORT_P3_OUT_P16 (0x1 << 16)
#define PORT_P3_OUT_P16_VAL(val) (((val) & 0x1) << 16)
#define PORT_P3_OUT_P16_GET(val) ((((val) & PORT_P3_OUT_P16) >> 16) & 0x1)
#define PORT_P3_OUT_P16_SET(reg,val) (reg) = ((reg & ~PORT_P3_OUT_P16) | (((val) & 0x1) << 16))
/* Port 3 Pin # Output Value (15) */
#define PORT_P3_OUT_P15 (0x1 << 15)
#define PORT_P3_OUT_P15_VAL(val) (((val) & 0x1) << 15)
#define PORT_P3_OUT_P15_GET(val) ((((val) & PORT_P3_OUT_P15) >> 15) & 0x1)
#define PORT_P3_OUT_P15_SET(reg,val) (reg) = ((reg & ~PORT_P3_OUT_P15) | (((val) & 0x1) << 15))
/* Port 3 Pin # Output Value (14) */
#define PORT_P3_OUT_P14 (0x1 << 14)
#define PORT_P3_OUT_P14_VAL(val) (((val) & 0x1) << 14)
#define PORT_P3_OUT_P14_GET(val) ((((val) & PORT_P3_OUT_P14) >> 14) & 0x1)
#define PORT_P3_OUT_P14_SET(reg,val) (reg) = ((reg & ~PORT_P3_OUT_P14) | (((val) & 0x1) << 14))
/* Port 3 Pin # Output Value (13) */
#define PORT_P3_OUT_P13 (0x1 << 13)
#define PORT_P3_OUT_P13_VAL(val) (((val) & 0x1) << 13)
#define PORT_P3_OUT_P13_GET(val) ((((val) & PORT_P3_OUT_P13) >> 13) & 0x1)
#define PORT_P3_OUT_P13_SET(reg,val) (reg) = ((reg & ~PORT_P3_OUT_P13) | (((val) & 0x1) << 13))
/* Port 3 Pin # Output Value (12) */
#define PORT_P3_OUT_P12 (0x1 << 12)
#define PORT_P3_OUT_P12_VAL(val) (((val) & 0x1) << 12)
#define PORT_P3_OUT_P12_GET(val) ((((val) & PORT_P3_OUT_P12) >> 12) & 0x1)
#define PORT_P3_OUT_P12_SET(reg,val) (reg) = ((reg & ~PORT_P3_OUT_P12) | (((val) & 0x1) << 12))
/* Port 3 Pin # Output Value (11) */
#define PORT_P3_OUT_P11 (0x1 << 11)
#define PORT_P3_OUT_P11_VAL(val) (((val) & 0x1) << 11)
#define PORT_P3_OUT_P11_GET(val) ((((val) & PORT_P3_OUT_P11) >> 11) & 0x1)
#define PORT_P3_OUT_P11_SET(reg,val) (reg) = ((reg & ~PORT_P3_OUT_P11) | (((val) & 0x1) << 11))
/* Port 3 Pin # Output Value (10) */
#define PORT_P3_OUT_P10 (0x1 << 10)
#define PORT_P3_OUT_P10_VAL(val) (((val) & 0x1) << 10)
#define PORT_P3_OUT_P10_GET(val) ((((val) & PORT_P3_OUT_P10) >> 10) & 0x1)
#define PORT_P3_OUT_P10_SET(reg,val) (reg) = ((reg & ~PORT_P3_OUT_P10) | (((val) & 0x1) << 10))
/* Port 3 Pin # Output Value (9) */
#define PORT_P3_OUT_P9 (0x1 << 9)
#define PORT_P3_OUT_P9_VAL(val) (((val) & 0x1) << 9)
#define PORT_P3_OUT_P9_GET(val) ((((val) & PORT_P3_OUT_P9) >> 9) & 0x1)
#define PORT_P3_OUT_P9_SET(reg,val) (reg) = ((reg & ~PORT_P3_OUT_P9) | (((val) & 0x1) << 9))
/* Port 3 Pin # Output Value (8) */
#define PORT_P3_OUT_P8 (0x1 << 8)
#define PORT_P3_OUT_P8_VAL(val) (((val) & 0x1) << 8)
#define PORT_P3_OUT_P8_GET(val) ((((val) & PORT_P3_OUT_P8) >> 8) & 0x1)
#define PORT_P3_OUT_P8_SET(reg,val) (reg) = ((reg & ~PORT_P3_OUT_P8) | (((val) & 0x1) << 8))
/* Port 3 Pin # Output Value (7) */
#define PORT_P3_OUT_P7 (0x1 << 7)
#define PORT_P3_OUT_P7_VAL(val) (((val) & 0x1) << 7)
#define PORT_P3_OUT_P7_GET(val) ((((val) & PORT_P3_OUT_P7) >> 7) & 0x1)
#define PORT_P3_OUT_P7_SET(reg,val) (reg) = ((reg & ~PORT_P3_OUT_P7) | (((val) & 0x1) << 7))
/* Port 3 Pin # Output Value (6) */
#define PORT_P3_OUT_P6 (0x1 << 6)
#define PORT_P3_OUT_P6_VAL(val) (((val) & 0x1) << 6)
#define PORT_P3_OUT_P6_GET(val) ((((val) & PORT_P3_OUT_P6) >> 6) & 0x1)
#define PORT_P3_OUT_P6_SET(reg,val) (reg) = ((reg & ~PORT_P3_OUT_P6) | (((val) & 0x1) << 6))
/* Port 3 Pin # Output Value (5) */
#define PORT_P3_OUT_P5 (0x1 << 5)
#define PORT_P3_OUT_P5_VAL(val) (((val) & 0x1) << 5)
#define PORT_P3_OUT_P5_GET(val) ((((val) & PORT_P3_OUT_P5) >> 5) & 0x1)
#define PORT_P3_OUT_P5_SET(reg,val) (reg) = ((reg & ~PORT_P3_OUT_P5) | (((val) & 0x1) << 5))
/* Port 3 Pin # Output Value (4) */
#define PORT_P3_OUT_P4 (0x1 << 4)
#define PORT_P3_OUT_P4_VAL(val) (((val) & 0x1) << 4)
#define PORT_P3_OUT_P4_GET(val) ((((val) & PORT_P3_OUT_P4) >> 4) & 0x1)
#define PORT_P3_OUT_P4_SET(reg,val) (reg) = ((reg & ~PORT_P3_OUT_P4) | (((val) & 0x1) << 4))
/* Port 3 Pin # Output Value (3) */
#define PORT_P3_OUT_P3 (0x1 << 3)
#define PORT_P3_OUT_P3_VAL(val) (((val) & 0x1) << 3)
#define PORT_P3_OUT_P3_GET(val) ((((val) & PORT_P3_OUT_P3) >> 3) & 0x1)
#define PORT_P3_OUT_P3_SET(reg,val) (reg) = ((reg & ~PORT_P3_OUT_P3) | (((val) & 0x1) << 3))
/* Port 3 Pin # Output Value (2) */
#define PORT_P3_OUT_P2 (0x1 << 2)
#define PORT_P3_OUT_P2_VAL(val) (((val) & 0x1) << 2)
#define PORT_P3_OUT_P2_GET(val) ((((val) & PORT_P3_OUT_P2) >> 2) & 0x1)
#define PORT_P3_OUT_P2_SET(reg,val) (reg) = ((reg & ~PORT_P3_OUT_P2) | (((val) & 0x1) << 2))
/* Port 3 Pin # Output Value (1) */
#define PORT_P3_OUT_P1 (0x1 << 1)
#define PORT_P3_OUT_P1_VAL(val) (((val) & 0x1) << 1)
#define PORT_P3_OUT_P1_GET(val) ((((val) & PORT_P3_OUT_P1) >> 1) & 0x1)
#define PORT_P3_OUT_P1_SET(reg,val) (reg) = ((reg & ~PORT_P3_OUT_P1) | (((val) & 0x1) << 1))
/* Port 3 Pin # Output Value (0) */
#define PORT_P3_OUT_P0 (0x1)
#define PORT_P3_OUT_P0_VAL(val) (((val) & 0x1) << 0)
#define PORT_P3_OUT_P0_GET(val) ((((val) & PORT_P3_OUT_P0) >> 0) & 0x1)
#define PORT_P3_OUT_P0_SET(reg,val) (reg) = ((reg & ~PORT_P3_OUT_P0) | (((val) & 0x1) << 0))
/*******************************************************************************
* Port 3 Data Input Register
******************************************************************************/
/* Port 3 Pin # Latched Input Value (19) */
#define PORT_P3_IN_P19 (0x1 << 19)
#define PORT_P3_IN_P19_GET(val) ((((val) & PORT_P3_IN_P19) >> 19) & 0x1)
/* Port 3 Pin # Latched Input Value (18) */
#define PORT_P3_IN_P18 (0x1 << 18)
#define PORT_P3_IN_P18_GET(val) ((((val) & PORT_P3_IN_P18) >> 18) & 0x1)
/* Port 3 Pin # Latched Input Value (17) */
#define PORT_P3_IN_P17 (0x1 << 17)
#define PORT_P3_IN_P17_GET(val) ((((val) & PORT_P3_IN_P17) >> 17) & 0x1)
/* Port 3 Pin # Latched Input Value (16) */
#define PORT_P3_IN_P16 (0x1 << 16)
#define PORT_P3_IN_P16_GET(val) ((((val) & PORT_P3_IN_P16) >> 16) & 0x1)
/* Port 3 Pin # Latched Input Value (15) */
#define PORT_P3_IN_P15 (0x1 << 15)
#define PORT_P3_IN_P15_GET(val) ((((val) & PORT_P3_IN_P15) >> 15) & 0x1)
/* Port 3 Pin # Latched Input Value (14) */
#define PORT_P3_IN_P14 (0x1 << 14)
#define PORT_P3_IN_P14_GET(val) ((((val) & PORT_P3_IN_P14) >> 14) & 0x1)
/* Port 3 Pin # Latched Input Value (13) */
#define PORT_P3_IN_P13 (0x1 << 13)
#define PORT_P3_IN_P13_GET(val) ((((val) & PORT_P3_IN_P13) >> 13) & 0x1)
/* Port 3 Pin # Latched Input Value (12) */
#define PORT_P3_IN_P12 (0x1 << 12)
#define PORT_P3_IN_P12_GET(val) ((((val) & PORT_P3_IN_P12) >> 12) & 0x1)
/* Port 3 Pin # Latched Input Value (11) */
#define PORT_P3_IN_P11 (0x1 << 11)
#define PORT_P3_IN_P11_GET(val) ((((val) & PORT_P3_IN_P11) >> 11) & 0x1)
/* Port 3 Pin # Latched Input Value (10) */
#define PORT_P3_IN_P10 (0x1 << 10)
#define PORT_P3_IN_P10_GET(val) ((((val) & PORT_P3_IN_P10) >> 10) & 0x1)
/* Port 3 Pin # Latched Input Value (9) */
#define PORT_P3_IN_P9 (0x1 << 9)
#define PORT_P3_IN_P9_GET(val) ((((val) & PORT_P3_IN_P9) >> 9) & 0x1)
/* Port 3 Pin # Latched Input Value (8) */
#define PORT_P3_IN_P8 (0x1 << 8)
#define PORT_P3_IN_P8_GET(val) ((((val) & PORT_P3_IN_P8) >> 8) & 0x1)
/* Port 3 Pin # Latched Input Value (7) */
#define PORT_P3_IN_P7 (0x1 << 7)
#define PORT_P3_IN_P7_GET(val) ((((val) & PORT_P3_IN_P7) >> 7) & 0x1)
/* Port 3 Pin # Latched Input Value (6) */
#define PORT_P3_IN_P6 (0x1 << 6)
#define PORT_P3_IN_P6_GET(val) ((((val) & PORT_P3_IN_P6) >> 6) & 0x1)
/* Port 3 Pin # Latched Input Value (5) */
#define PORT_P3_IN_P5 (0x1 << 5)
#define PORT_P3_IN_P5_GET(val) ((((val) & PORT_P3_IN_P5) >> 5) & 0x1)
/* Port 3 Pin # Latched Input Value (4) */
#define PORT_P3_IN_P4 (0x1 << 4)
#define PORT_P3_IN_P4_GET(val) ((((val) & PORT_P3_IN_P4) >> 4) & 0x1)
/* Port 3 Pin # Latched Input Value (3) */
#define PORT_P3_IN_P3 (0x1 << 3)
#define PORT_P3_IN_P3_GET(val) ((((val) & PORT_P3_IN_P3) >> 3) & 0x1)
/* Port 3 Pin # Latched Input Value (2) */
#define PORT_P3_IN_P2 (0x1 << 2)
#define PORT_P3_IN_P2_GET(val) ((((val) & PORT_P3_IN_P2) >> 2) & 0x1)
/* Port 3 Pin # Latched Input Value (1) */
#define PORT_P3_IN_P1 (0x1 << 1)
#define PORT_P3_IN_P1_GET(val) ((((val) & PORT_P3_IN_P1) >> 1) & 0x1)
/* Port 3 Pin # Latched Input Value (0) */
#define PORT_P3_IN_P0 (0x1)
#define PORT_P3_IN_P0_GET(val) ((((val) & PORT_P3_IN_P0) >> 0) & 0x1)
/*******************************************************************************
* Port 3 Direction Register
******************************************************************************/
/* Port 3 Pin #Direction Control (19) */
#define PORT_P3_DIR_P19 (0x1 << 19)
#define PORT_P3_DIR_P19_VAL(val) (((val) & 0x1) << 19)
#define PORT_P3_DIR_P19_GET(val) ((((val) & PORT_P3_DIR_P19) >> 19) & 0x1)
#define PORT_P3_DIR_P19_SET(reg,val) (reg) = ((reg & ~PORT_P3_DIR_P19) | (((val) & 0x1) << 19))
/* Port 3 Pin #Direction Control (18) */
#define PORT_P3_DIR_P18 (0x1 << 18)
#define PORT_P3_DIR_P18_VAL(val) (((val) & 0x1) << 18)
#define PORT_P3_DIR_P18_GET(val) ((((val) & PORT_P3_DIR_P18) >> 18) & 0x1)
#define PORT_P3_DIR_P18_SET(reg,val) (reg) = ((reg & ~PORT_P3_DIR_P18) | (((val) & 0x1) << 18))
/* Port 3 Pin #Direction Control (17) */
#define PORT_P3_DIR_P17 (0x1 << 17)
#define PORT_P3_DIR_P17_VAL(val) (((val) & 0x1) << 17)
#define PORT_P3_DIR_P17_GET(val) ((((val) & PORT_P3_DIR_P17) >> 17) & 0x1)
#define PORT_P3_DIR_P17_SET(reg,val) (reg) = ((reg & ~PORT_P3_DIR_P17) | (((val) & 0x1) << 17))
/* Port 3 Pin #Direction Control (16) */
#define PORT_P3_DIR_P16 (0x1 << 16)
#define PORT_P3_DIR_P16_VAL(val) (((val) & 0x1) << 16)
#define PORT_P3_DIR_P16_GET(val) ((((val) & PORT_P3_DIR_P16) >> 16) & 0x1)
#define PORT_P3_DIR_P16_SET(reg,val) (reg) = ((reg & ~PORT_P3_DIR_P16) | (((val) & 0x1) << 16))
/* Port 3 Pin #Direction Control (15) */
#define PORT_P3_DIR_P15 (0x1 << 15)
#define PORT_P3_DIR_P15_VAL(val) (((val) & 0x1) << 15)
#define PORT_P3_DIR_P15_GET(val) ((((val) & PORT_P3_DIR_P15) >> 15) & 0x1)
#define PORT_P3_DIR_P15_SET(reg,val) (reg) = ((reg & ~PORT_P3_DIR_P15) | (((val) & 0x1) << 15))
/* Port 3 Pin #Direction Control (14) */
#define PORT_P3_DIR_P14 (0x1 << 14)
#define PORT_P3_DIR_P14_VAL(val) (((val) & 0x1) << 14)
#define PORT_P3_DIR_P14_GET(val) ((((val) & PORT_P3_DIR_P14) >> 14) & 0x1)
#define PORT_P3_DIR_P14_SET(reg,val) (reg) = ((reg & ~PORT_P3_DIR_P14) | (((val) & 0x1) << 14))
/* Port 3 Pin #Direction Control (13) */
#define PORT_P3_DIR_P13 (0x1 << 13)
#define PORT_P3_DIR_P13_VAL(val) (((val) & 0x1) << 13)
#define PORT_P3_DIR_P13_GET(val) ((((val) & PORT_P3_DIR_P13) >> 13) & 0x1)
#define PORT_P3_DIR_P13_SET(reg,val) (reg) = ((reg & ~PORT_P3_DIR_P13) | (((val) & 0x1) << 13))
/* Port 3 Pin #Direction Control (12) */
#define PORT_P3_DIR_P12 (0x1 << 12)
#define PORT_P3_DIR_P12_VAL(val) (((val) & 0x1) << 12)
#define PORT_P3_DIR_P12_GET(val) ((((val) & PORT_P3_DIR_P12) >> 12) & 0x1)
#define PORT_P3_DIR_P12_SET(reg,val) (reg) = ((reg & ~PORT_P3_DIR_P12) | (((val) & 0x1) << 12))
/* Port 3 Pin #Direction Control (11) */
#define PORT_P3_DIR_P11 (0x1 << 11)
#define PORT_P3_DIR_P11_VAL(val) (((val) & 0x1) << 11)
#define PORT_P3_DIR_P11_GET(val) ((((val) & PORT_P3_DIR_P11) >> 11) & 0x1)
#define PORT_P3_DIR_P11_SET(reg,val) (reg) = ((reg & ~PORT_P3_DIR_P11) | (((val) & 0x1) << 11))
/* Port 3 Pin #Direction Control (10) */
#define PORT_P3_DIR_P10 (0x1 << 10)
#define PORT_P3_DIR_P10_VAL(val) (((val) & 0x1) << 10)
#define PORT_P3_DIR_P10_GET(val) ((((val) & PORT_P3_DIR_P10) >> 10) & 0x1)
#define PORT_P3_DIR_P10_SET(reg,val) (reg) = ((reg & ~PORT_P3_DIR_P10) | (((val) & 0x1) << 10))
/* Port 3 Pin #Direction Control (9) */
#define PORT_P3_DIR_P9 (0x1 << 9)
#define PORT_P3_DIR_P9_VAL(val) (((val) & 0x1) << 9)
#define PORT_P3_DIR_P9_GET(val) ((((val) & PORT_P3_DIR_P9) >> 9) & 0x1)
#define PORT_P3_DIR_P9_SET(reg,val) (reg) = ((reg & ~PORT_P3_DIR_P9) | (((val) & 0x1) << 9))
/* Port 3 Pin #Direction Control (8) */
#define PORT_P3_DIR_P8 (0x1 << 8)
#define PORT_P3_DIR_P8_VAL(val) (((val) & 0x1) << 8)
#define PORT_P3_DIR_P8_GET(val) ((((val) & PORT_P3_DIR_P8) >> 8) & 0x1)
#define PORT_P3_DIR_P8_SET(reg,val) (reg) = ((reg & ~PORT_P3_DIR_P8) | (((val) & 0x1) << 8))
/* Port 3 Pin #Direction Control (7) */
#define PORT_P3_DIR_P7 (0x1 << 7)
#define PORT_P3_DIR_P7_VAL(val) (((val) & 0x1) << 7)
#define PORT_P3_DIR_P7_GET(val) ((((val) & PORT_P3_DIR_P7) >> 7) & 0x1)
#define PORT_P3_DIR_P7_SET(reg,val) (reg) = ((reg & ~PORT_P3_DIR_P7) | (((val) & 0x1) << 7))
/* Port 3 Pin #Direction Control (6) */
#define PORT_P3_DIR_P6 (0x1 << 6)
#define PORT_P3_DIR_P6_VAL(val) (((val) & 0x1) << 6)
#define PORT_P3_DIR_P6_GET(val) ((((val) & PORT_P3_DIR_P6) >> 6) & 0x1)
#define PORT_P3_DIR_P6_SET(reg,val) (reg) = ((reg & ~PORT_P3_DIR_P6) | (((val) & 0x1) << 6))
/* Port 3 Pin #Direction Control (5) */
#define PORT_P3_DIR_P5 (0x1 << 5)
#define PORT_P3_DIR_P5_VAL(val) (((val) & 0x1) << 5)
#define PORT_P3_DIR_P5_GET(val) ((((val) & PORT_P3_DIR_P5) >> 5) & 0x1)
#define PORT_P3_DIR_P5_SET(reg,val) (reg) = ((reg & ~PORT_P3_DIR_P5) | (((val) & 0x1) << 5))
/* Port 3 Pin #Direction Control (4) */
#define PORT_P3_DIR_P4 (0x1 << 4)
#define PORT_P3_DIR_P4_VAL(val) (((val) & 0x1) << 4)
#define PORT_P3_DIR_P4_GET(val) ((((val) & PORT_P3_DIR_P4) >> 4) & 0x1)
#define PORT_P3_DIR_P4_SET(reg,val) (reg) = ((reg & ~PORT_P3_DIR_P4) | (((val) & 0x1) << 4))
/* Port 3 Pin #Direction Control (3) */
#define PORT_P3_DIR_P3 (0x1 << 3)
#define PORT_P3_DIR_P3_VAL(val) (((val) & 0x1) << 3)
#define PORT_P3_DIR_P3_GET(val) ((((val) & PORT_P3_DIR_P3) >> 3) & 0x1)
#define PORT_P3_DIR_P3_SET(reg,val) (reg) = ((reg & ~PORT_P3_DIR_P3) | (((val) & 0x1) << 3))
/* Port 3 Pin #Direction Control (2) */
#define PORT_P3_DIR_P2 (0x1 << 2)
#define PORT_P3_DIR_P2_VAL(val) (((val) & 0x1) << 2)
#define PORT_P3_DIR_P2_GET(val) ((((val) & PORT_P3_DIR_P2) >> 2) & 0x1)
#define PORT_P3_DIR_P2_SET(reg,val) (reg) = ((reg & ~PORT_P3_DIR_P2) | (((val) & 0x1) << 2))
/* Port 3 Pin #Direction Control (1) */
#define PORT_P3_DIR_P1 (0x1 << 1)
#define PORT_P3_DIR_P1_VAL(val) (((val) & 0x1) << 1)
#define PORT_P3_DIR_P1_GET(val) ((((val) & PORT_P3_DIR_P1) >> 1) & 0x1)
#define PORT_P3_DIR_P1_SET(reg,val) (reg) = ((reg & ~PORT_P3_DIR_P1) | (((val) & 0x1) << 1))
/* Port 3 Pin #Direction Control (0) */
#define PORT_P3_DIR_P0 (0x1)
#define PORT_P3_DIR_P0_VAL(val) (((val) & 0x1) << 0)
#define PORT_P3_DIR_P0_GET(val) ((((val) & PORT_P3_DIR_P0) >> 0) & 0x1)
#define PORT_P3_DIR_P0_SET(reg,val) (reg) = ((reg & ~PORT_P3_DIR_P0) | (((val) & 0x1) << 0))
/*******************************************************************************
* Port 3 Alternate Function Select Register 0
******************************************************************************/
/* Alternate Function at Port 3 Bit # (19) */
#define PORT_P3_ALTSEL0_P19 (0x1 << 19)
#define PORT_P3_ALTSEL0_P19_VAL(val) (((val) & 0x1) << 19)
#define PORT_P3_ALTSEL0_P19_GET(val) ((((val) & PORT_P3_ALTSEL0_P19) >> 19) & 0x1)
#define PORT_P3_ALTSEL0_P19_SET(reg,val) (reg) = ((reg & ~PORT_P3_ALTSEL0_P19) | (((val) & 0x1) << 19))
/* Alternate Function at Port 3 Bit # (18) */
#define PORT_P3_ALTSEL0_P18 (0x1 << 18)
#define PORT_P3_ALTSEL0_P18_VAL(val) (((val) & 0x1) << 18)
#define PORT_P3_ALTSEL0_P18_GET(val) ((((val) & PORT_P3_ALTSEL0_P18) >> 18) & 0x1)
#define PORT_P3_ALTSEL0_P18_SET(reg,val) (reg) = ((reg & ~PORT_P3_ALTSEL0_P18) | (((val) & 0x1) << 18))
/* Alternate Function at Port 3 Bit # (17) */
#define PORT_P3_ALTSEL0_P17 (0x1 << 17)
#define PORT_P3_ALTSEL0_P17_VAL(val) (((val) & 0x1) << 17)
#define PORT_P3_ALTSEL0_P17_GET(val) ((((val) & PORT_P3_ALTSEL0_P17) >> 17) & 0x1)
#define PORT_P3_ALTSEL0_P17_SET(reg,val) (reg) = ((reg & ~PORT_P3_ALTSEL0_P17) | (((val) & 0x1) << 17))
/* Alternate Function at Port 3 Bit # (16) */
#define PORT_P3_ALTSEL0_P16 (0x1 << 16)
#define PORT_P3_ALTSEL0_P16_VAL(val) (((val) & 0x1) << 16)
#define PORT_P3_ALTSEL0_P16_GET(val) ((((val) & PORT_P3_ALTSEL0_P16) >> 16) & 0x1)
#define PORT_P3_ALTSEL0_P16_SET(reg,val) (reg) = ((reg & ~PORT_P3_ALTSEL0_P16) | (((val) & 0x1) << 16))
/* Alternate Function at Port 3 Bit # (15) */
#define PORT_P3_ALTSEL0_P15 (0x1 << 15)
#define PORT_P3_ALTSEL0_P15_VAL(val) (((val) & 0x1) << 15)
#define PORT_P3_ALTSEL0_P15_GET(val) ((((val) & PORT_P3_ALTSEL0_P15) >> 15) & 0x1)
#define PORT_P3_ALTSEL0_P15_SET(reg,val) (reg) = ((reg & ~PORT_P3_ALTSEL0_P15) | (((val) & 0x1) << 15))
/* Alternate Function at Port 3 Bit # (14) */
#define PORT_P3_ALTSEL0_P14 (0x1 << 14)
#define PORT_P3_ALTSEL0_P14_VAL(val) (((val) & 0x1) << 14)
#define PORT_P3_ALTSEL0_P14_GET(val) ((((val) & PORT_P3_ALTSEL0_P14) >> 14) & 0x1)
#define PORT_P3_ALTSEL0_P14_SET(reg,val) (reg) = ((reg & ~PORT_P3_ALTSEL0_P14) | (((val) & 0x1) << 14))
/* Alternate Function at Port 3 Bit # (13) */
#define PORT_P3_ALTSEL0_P13 (0x1 << 13)
#define PORT_P3_ALTSEL0_P13_VAL(val) (((val) & 0x1) << 13)
#define PORT_P3_ALTSEL0_P13_GET(val) ((((val) & PORT_P3_ALTSEL0_P13) >> 13) & 0x1)
#define PORT_P3_ALTSEL0_P13_SET(reg,val) (reg) = ((reg & ~PORT_P3_ALTSEL0_P13) | (((val) & 0x1) << 13))
/* Alternate Function at Port 3 Bit # (12) */
#define PORT_P3_ALTSEL0_P12 (0x1 << 12)
#define PORT_P3_ALTSEL0_P12_VAL(val) (((val) & 0x1) << 12)
#define PORT_P3_ALTSEL0_P12_GET(val) ((((val) & PORT_P3_ALTSEL0_P12) >> 12) & 0x1)
#define PORT_P3_ALTSEL0_P12_SET(reg,val) (reg) = ((reg & ~PORT_P3_ALTSEL0_P12) | (((val) & 0x1) << 12))
/* Alternate Function at Port 3 Bit # (11) */
#define PORT_P3_ALTSEL0_P11 (0x1 << 11)
#define PORT_P3_ALTSEL0_P11_VAL(val) (((val) & 0x1) << 11)
#define PORT_P3_ALTSEL0_P11_GET(val) ((((val) & PORT_P3_ALTSEL0_P11) >> 11) & 0x1)
#define PORT_P3_ALTSEL0_P11_SET(reg,val) (reg) = ((reg & ~PORT_P3_ALTSEL0_P11) | (((val) & 0x1) << 11))
/* Alternate Function at Port 3 Bit # (10) */
#define PORT_P3_ALTSEL0_P10 (0x1 << 10)
#define PORT_P3_ALTSEL0_P10_VAL(val) (((val) & 0x1) << 10)
#define PORT_P3_ALTSEL0_P10_GET(val) ((((val) & PORT_P3_ALTSEL0_P10) >> 10) & 0x1)
#define PORT_P3_ALTSEL0_P10_SET(reg,val) (reg) = ((reg & ~PORT_P3_ALTSEL0_P10) | (((val) & 0x1) << 10))
/* Alternate Function at Port 3 Bit # (9) */
#define PORT_P3_ALTSEL0_P9 (0x1 << 9)
#define PORT_P3_ALTSEL0_P9_VAL(val) (((val) & 0x1) << 9)
#define PORT_P3_ALTSEL0_P9_GET(val) ((((val) & PORT_P3_ALTSEL0_P9) >> 9) & 0x1)
#define PORT_P3_ALTSEL0_P9_SET(reg,val) (reg) = ((reg & ~PORT_P3_ALTSEL0_P9) | (((val) & 0x1) << 9))
/* Alternate Function at Port 3 Bit # (8) */
#define PORT_P3_ALTSEL0_P8 (0x1 << 8)
#define PORT_P3_ALTSEL0_P8_VAL(val) (((val) & 0x1) << 8)
#define PORT_P3_ALTSEL0_P8_GET(val) ((((val) & PORT_P3_ALTSEL0_P8) >> 8) & 0x1)
#define PORT_P3_ALTSEL0_P8_SET(reg,val) (reg) = ((reg & ~PORT_P3_ALTSEL0_P8) | (((val) & 0x1) << 8))
/* Alternate Function at Port 3 Bit # (7) */
#define PORT_P3_ALTSEL0_P7 (0x1 << 7)
#define PORT_P3_ALTSEL0_P7_VAL(val) (((val) & 0x1) << 7)
#define PORT_P3_ALTSEL0_P7_GET(val) ((((val) & PORT_P3_ALTSEL0_P7) >> 7) & 0x1)
#define PORT_P3_ALTSEL0_P7_SET(reg,val) (reg) = ((reg & ~PORT_P3_ALTSEL0_P7) | (((val) & 0x1) << 7))
/* Alternate Function at Port 3 Bit # (6) */
#define PORT_P3_ALTSEL0_P6 (0x1 << 6)
#define PORT_P3_ALTSEL0_P6_VAL(val) (((val) & 0x1) << 6)
#define PORT_P3_ALTSEL0_P6_GET(val) ((((val) & PORT_P3_ALTSEL0_P6) >> 6) & 0x1)
#define PORT_P3_ALTSEL0_P6_SET(reg,val) (reg) = ((reg & ~PORT_P3_ALTSEL0_P6) | (((val) & 0x1) << 6))
/* Alternate Function at Port 3 Bit # (5) */
#define PORT_P3_ALTSEL0_P5 (0x1 << 5)
#define PORT_P3_ALTSEL0_P5_VAL(val) (((val) & 0x1) << 5)
#define PORT_P3_ALTSEL0_P5_GET(val) ((((val) & PORT_P3_ALTSEL0_P5) >> 5) & 0x1)
#define PORT_P3_ALTSEL0_P5_SET(reg,val) (reg) = ((reg & ~PORT_P3_ALTSEL0_P5) | (((val) & 0x1) << 5))
/* Alternate Function at Port 3 Bit # (4) */
#define PORT_P3_ALTSEL0_P4 (0x1 << 4)
#define PORT_P3_ALTSEL0_P4_VAL(val) (((val) & 0x1) << 4)
#define PORT_P3_ALTSEL0_P4_GET(val) ((((val) & PORT_P3_ALTSEL0_P4) >> 4) & 0x1)
#define PORT_P3_ALTSEL0_P4_SET(reg,val) (reg) = ((reg & ~PORT_P3_ALTSEL0_P4) | (((val) & 0x1) << 4))
/* Alternate Function at Port 3 Bit # (3) */
#define PORT_P3_ALTSEL0_P3 (0x1 << 3)
#define PORT_P3_ALTSEL0_P3_VAL(val) (((val) & 0x1) << 3)
#define PORT_P3_ALTSEL0_P3_GET(val) ((((val) & PORT_P3_ALTSEL0_P3) >> 3) & 0x1)
#define PORT_P3_ALTSEL0_P3_SET(reg,val) (reg) = ((reg & ~PORT_P3_ALTSEL0_P3) | (((val) & 0x1) << 3))
/* Alternate Function at Port 3 Bit # (2) */
#define PORT_P3_ALTSEL0_P2 (0x1 << 2)
#define PORT_P3_ALTSEL0_P2_VAL(val) (((val) & 0x1) << 2)
#define PORT_P3_ALTSEL0_P2_GET(val) ((((val) & PORT_P3_ALTSEL0_P2) >> 2) & 0x1)
#define PORT_P3_ALTSEL0_P2_SET(reg,val) (reg) = ((reg & ~PORT_P3_ALTSEL0_P2) | (((val) & 0x1) << 2))
/* Alternate Function at Port 3 Bit # (1) */
#define PORT_P3_ALTSEL0_P1 (0x1 << 1)
#define PORT_P3_ALTSEL0_P1_VAL(val) (((val) & 0x1) << 1)
#define PORT_P3_ALTSEL0_P1_GET(val) ((((val) & PORT_P3_ALTSEL0_P1) >> 1) & 0x1)
#define PORT_P3_ALTSEL0_P1_SET(reg,val) (reg) = ((reg & ~PORT_P3_ALTSEL0_P1) | (((val) & 0x1) << 1))
/* Alternate Function at Port 3 Bit # (0) */
#define PORT_P3_ALTSEL0_P0 (0x1)
#define PORT_P3_ALTSEL0_P0_VAL(val) (((val) & 0x1) << 0)
#define PORT_P3_ALTSEL0_P0_GET(val) ((((val) & PORT_P3_ALTSEL0_P0) >> 0) & 0x1)
#define PORT_P3_ALTSEL0_P0_SET(reg,val) (reg) = ((reg & ~PORT_P3_ALTSEL0_P0) | (((val) & 0x1) << 0))
/*******************************************************************************
* Port 3 Pull Up Device Enable Register
******************************************************************************/
/* Pull Up Device Enable at Port 3 Bit # (19) */
#define PORT_P3_PUEN_P19 (0x1 << 19)
#define PORT_P3_PUEN_P19_VAL(val) (((val) & 0x1) << 19)
#define PORT_P3_PUEN_P19_GET(val) ((((val) & PORT_P3_PUEN_P19) >> 19) & 0x1)
#define PORT_P3_PUEN_P19_SET(reg,val) (reg) = ((reg & ~PORT_P3_PUEN_P19) | (((val) & 0x1) << 19))
/* Pull Up Device Enable at Port 3 Bit # (18) */
#define PORT_P3_PUEN_P18 (0x1 << 18)
#define PORT_P3_PUEN_P18_VAL(val) (((val) & 0x1) << 18)
#define PORT_P3_PUEN_P18_GET(val) ((((val) & PORT_P3_PUEN_P18) >> 18) & 0x1)
#define PORT_P3_PUEN_P18_SET(reg,val) (reg) = ((reg & ~PORT_P3_PUEN_P18) | (((val) & 0x1) << 18))
/* Pull Up Device Enable at Port 3 Bit # (17) */
#define PORT_P3_PUEN_P17 (0x1 << 17)
#define PORT_P3_PUEN_P17_VAL(val) (((val) & 0x1) << 17)
#define PORT_P3_PUEN_P17_GET(val) ((((val) & PORT_P3_PUEN_P17) >> 17) & 0x1)
#define PORT_P3_PUEN_P17_SET(reg,val) (reg) = ((reg & ~PORT_P3_PUEN_P17) | (((val) & 0x1) << 17))
/* Pull Up Device Enable at Port 3 Bit # (16) */
#define PORT_P3_PUEN_P16 (0x1 << 16)
#define PORT_P3_PUEN_P16_VAL(val) (((val) & 0x1) << 16)
#define PORT_P3_PUEN_P16_GET(val) ((((val) & PORT_P3_PUEN_P16) >> 16) & 0x1)
#define PORT_P3_PUEN_P16_SET(reg,val) (reg) = ((reg & ~PORT_P3_PUEN_P16) | (((val) & 0x1) << 16))
/* Pull Up Device Enable at Port 3 Bit # (15) */
#define PORT_P3_PUEN_P15 (0x1 << 15)
#define PORT_P3_PUEN_P15_VAL(val) (((val) & 0x1) << 15)
#define PORT_P3_PUEN_P15_GET(val) ((((val) & PORT_P3_PUEN_P15) >> 15) & 0x1)
#define PORT_P3_PUEN_P15_SET(reg,val) (reg) = ((reg & ~PORT_P3_PUEN_P15) | (((val) & 0x1) << 15))
/* Pull Up Device Enable at Port 3 Bit # (14) */
#define PORT_P3_PUEN_P14 (0x1 << 14)
#define PORT_P3_PUEN_P14_VAL(val) (((val) & 0x1) << 14)
#define PORT_P3_PUEN_P14_GET(val) ((((val) & PORT_P3_PUEN_P14) >> 14) & 0x1)
#define PORT_P3_PUEN_P14_SET(reg,val) (reg) = ((reg & ~PORT_P3_PUEN_P14) | (((val) & 0x1) << 14))
/* Pull Up Device Enable at Port 3 Bit # (13) */
#define PORT_P3_PUEN_P13 (0x1 << 13)
#define PORT_P3_PUEN_P13_VAL(val) (((val) & 0x1) << 13)
#define PORT_P3_PUEN_P13_GET(val) ((((val) & PORT_P3_PUEN_P13) >> 13) & 0x1)
#define PORT_P3_PUEN_P13_SET(reg,val) (reg) = ((reg & ~PORT_P3_PUEN_P13) | (((val) & 0x1) << 13))
/* Pull Up Device Enable at Port 3 Bit # (12) */
#define PORT_P3_PUEN_P12 (0x1 << 12)
#define PORT_P3_PUEN_P12_VAL(val) (((val) & 0x1) << 12)
#define PORT_P3_PUEN_P12_GET(val) ((((val) & PORT_P3_PUEN_P12) >> 12) & 0x1)
#define PORT_P3_PUEN_P12_SET(reg,val) (reg) = ((reg & ~PORT_P3_PUEN_P12) | (((val) & 0x1) << 12))
/* Pull Up Device Enable at Port 3 Bit # (11) */
#define PORT_P3_PUEN_P11 (0x1 << 11)
#define PORT_P3_PUEN_P11_VAL(val) (((val) & 0x1) << 11)
#define PORT_P3_PUEN_P11_GET(val) ((((val) & PORT_P3_PUEN_P11) >> 11) & 0x1)
#define PORT_P3_PUEN_P11_SET(reg,val) (reg) = ((reg & ~PORT_P3_PUEN_P11) | (((val) & 0x1) << 11))
/* Pull Up Device Enable at Port 3 Bit # (10) */
#define PORT_P3_PUEN_P10 (0x1 << 10)
#define PORT_P3_PUEN_P10_VAL(val) (((val) & 0x1) << 10)
#define PORT_P3_PUEN_P10_GET(val) ((((val) & PORT_P3_PUEN_P10) >> 10) & 0x1)
#define PORT_P3_PUEN_P10_SET(reg,val) (reg) = ((reg & ~PORT_P3_PUEN_P10) | (((val) & 0x1) << 10))
/* Pull Up Device Enable at Port 3 Bit # (9) */
#define PORT_P3_PUEN_P9 (0x1 << 9)
#define PORT_P3_PUEN_P9_VAL(val) (((val) & 0x1) << 9)
#define PORT_P3_PUEN_P9_GET(val) ((((val) & PORT_P3_PUEN_P9) >> 9) & 0x1)
#define PORT_P3_PUEN_P9_SET(reg,val) (reg) = ((reg & ~PORT_P3_PUEN_P9) | (((val) & 0x1) << 9))
/* Pull Up Device Enable at Port 3 Bit # (8) */
#define PORT_P3_PUEN_P8 (0x1 << 8)
#define PORT_P3_PUEN_P8_VAL(val) (((val) & 0x1) << 8)
#define PORT_P3_PUEN_P8_GET(val) ((((val) & PORT_P3_PUEN_P8) >> 8) & 0x1)
#define PORT_P3_PUEN_P8_SET(reg,val) (reg) = ((reg & ~PORT_P3_PUEN_P8) | (((val) & 0x1) << 8))
/* Pull Up Device Enable at Port 3 Bit # (7) */
#define PORT_P3_PUEN_P7 (0x1 << 7)
#define PORT_P3_PUEN_P7_VAL(val) (((val) & 0x1) << 7)
#define PORT_P3_PUEN_P7_GET(val) ((((val) & PORT_P3_PUEN_P7) >> 7) & 0x1)
#define PORT_P3_PUEN_P7_SET(reg,val) (reg) = ((reg & ~PORT_P3_PUEN_P7) | (((val) & 0x1) << 7))
/* Pull Up Device Enable at Port 3 Bit # (6) */
#define PORT_P3_PUEN_P6 (0x1 << 6)
#define PORT_P3_PUEN_P6_VAL(val) (((val) & 0x1) << 6)
#define PORT_P3_PUEN_P6_GET(val) ((((val) & PORT_P3_PUEN_P6) >> 6) & 0x1)
#define PORT_P3_PUEN_P6_SET(reg,val) (reg) = ((reg & ~PORT_P3_PUEN_P6) | (((val) & 0x1) << 6))
/* Pull Up Device Enable at Port 3 Bit # (5) */
#define PORT_P3_PUEN_P5 (0x1 << 5)
#define PORT_P3_PUEN_P5_VAL(val) (((val) & 0x1) << 5)
#define PORT_P3_PUEN_P5_GET(val) ((((val) & PORT_P3_PUEN_P5) >> 5) & 0x1)
#define PORT_P3_PUEN_P5_SET(reg,val) (reg) = ((reg & ~PORT_P3_PUEN_P5) | (((val) & 0x1) << 5))
/* Pull Up Device Enable at Port 3 Bit # (4) */
#define PORT_P3_PUEN_P4 (0x1 << 4)
#define PORT_P3_PUEN_P4_VAL(val) (((val) & 0x1) << 4)
#define PORT_P3_PUEN_P4_GET(val) ((((val) & PORT_P3_PUEN_P4) >> 4) & 0x1)
#define PORT_P3_PUEN_P4_SET(reg,val) (reg) = ((reg & ~PORT_P3_PUEN_P4) | (((val) & 0x1) << 4))
/* Pull Up Device Enable at Port 3 Bit # (3) */
#define PORT_P3_PUEN_P3 (0x1 << 3)
#define PORT_P3_PUEN_P3_VAL(val) (((val) & 0x1) << 3)
#define PORT_P3_PUEN_P3_GET(val) ((((val) & PORT_P3_PUEN_P3) >> 3) & 0x1)
#define PORT_P3_PUEN_P3_SET(reg,val) (reg) = ((reg & ~PORT_P3_PUEN_P3) | (((val) & 0x1) << 3))
/* Pull Up Device Enable at Port 3 Bit # (2) */
#define PORT_P3_PUEN_P2 (0x1 << 2)
#define PORT_P3_PUEN_P2_VAL(val) (((val) & 0x1) << 2)
#define PORT_P3_PUEN_P2_GET(val) ((((val) & PORT_P3_PUEN_P2) >> 2) & 0x1)
#define PORT_P3_PUEN_P2_SET(reg,val) (reg) = ((reg & ~PORT_P3_PUEN_P2) | (((val) & 0x1) << 2))
/* Pull Up Device Enable at Port 3 Bit # (1) */
#define PORT_P3_PUEN_P1 (0x1 << 1)
#define PORT_P3_PUEN_P1_VAL(val) (((val) & 0x1) << 1)
#define PORT_P3_PUEN_P1_GET(val) ((((val) & PORT_P3_PUEN_P1) >> 1) & 0x1)
#define PORT_P3_PUEN_P1_SET(reg,val) (reg) = ((reg & ~PORT_P3_PUEN_P1) | (((val) & 0x1) << 1))
/* Pull Up Device Enable at Port 3 Bit # (0) */
#define PORT_P3_PUEN_P0 (0x1)
#define PORT_P3_PUEN_P0_VAL(val) (((val) & 0x1) << 0)
#define PORT_P3_PUEN_P0_GET(val) ((((val) & PORT_P3_PUEN_P0) >> 0) & 0x1)
#define PORT_P3_PUEN_P0_SET(reg,val) (reg) = ((reg & ~PORT_P3_PUEN_P0) | (((val) & 0x1) << 0))
/*******************************************************************************
* Port 4 Data Output Register
******************************************************************************/
/* Port 4 Pin # Output Value (23) */
#define PORT_P4_OUT_P23 (0x1 << 23)
#define PORT_P4_OUT_P23_VAL(val) (((val) & 0x1) << 23)
#define PORT_P4_OUT_P23_GET(val) ((((val) & PORT_P4_OUT_P23) >> 23) & 0x1)
#define PORT_P4_OUT_P23_SET(reg,val) (reg) = ((reg & ~PORT_P4_OUT_P23) | (((val) & 0x1) << 23))
/* Port 4 Pin # Output Value (22) */
#define PORT_P4_OUT_P22 (0x1 << 22)
#define PORT_P4_OUT_P22_VAL(val) (((val) & 0x1) << 22)
#define PORT_P4_OUT_P22_GET(val) ((((val) & PORT_P4_OUT_P22) >> 22) & 0x1)
#define PORT_P4_OUT_P22_SET(reg,val) (reg) = ((reg & ~PORT_P4_OUT_P22) | (((val) & 0x1) << 22))
/* Port 4 Pin # Output Value (21) */
#define PORT_P4_OUT_P21 (0x1 << 21)
#define PORT_P4_OUT_P21_VAL(val) (((val) & 0x1) << 21)
#define PORT_P4_OUT_P21_GET(val) ((((val) & PORT_P4_OUT_P21) >> 21) & 0x1)
#define PORT_P4_OUT_P21_SET(reg,val) (reg) = ((reg & ~PORT_P4_OUT_P21) | (((val) & 0x1) << 21))
/* Port 4 Pin # Output Value (20) */
#define PORT_P4_OUT_P20 (0x1 << 20)
#define PORT_P4_OUT_P20_VAL(val) (((val) & 0x1) << 20)
#define PORT_P4_OUT_P20_GET(val) ((((val) & PORT_P4_OUT_P20) >> 20) & 0x1)
#define PORT_P4_OUT_P20_SET(reg,val) (reg) = ((reg & ~PORT_P4_OUT_P20) | (((val) & 0x1) << 20))
/* Port 4 Pin # Output Value (19) */
#define PORT_P4_OUT_P19 (0x1 << 19)
#define PORT_P4_OUT_P19_VAL(val) (((val) & 0x1) << 19)
#define PORT_P4_OUT_P19_GET(val) ((((val) & PORT_P4_OUT_P19) >> 19) & 0x1)
#define PORT_P4_OUT_P19_SET(reg,val) (reg) = ((reg & ~PORT_P4_OUT_P19) | (((val) & 0x1) << 19))
/* Port 4 Pin # Output Value (18) */
#define PORT_P4_OUT_P18 (0x1 << 18)
#define PORT_P4_OUT_P18_VAL(val) (((val) & 0x1) << 18)
#define PORT_P4_OUT_P18_GET(val) ((((val) & PORT_P4_OUT_P18) >> 18) & 0x1)
#define PORT_P4_OUT_P18_SET(reg,val) (reg) = ((reg & ~PORT_P4_OUT_P18) | (((val) & 0x1) << 18))
/* Port 4 Pin # Output Value (17) */
#define PORT_P4_OUT_P17 (0x1 << 17)
#define PORT_P4_OUT_P17_VAL(val) (((val) & 0x1) << 17)
#define PORT_P4_OUT_P17_GET(val) ((((val) & PORT_P4_OUT_P17) >> 17) & 0x1)
#define PORT_P4_OUT_P17_SET(reg,val) (reg) = ((reg & ~PORT_P4_OUT_P17) | (((val) & 0x1) << 17))
/* Port 4 Pin # Output Value (16) */
#define PORT_P4_OUT_P16 (0x1 << 16)
#define PORT_P4_OUT_P16_VAL(val) (((val) & 0x1) << 16)
#define PORT_P4_OUT_P16_GET(val) ((((val) & PORT_P4_OUT_P16) >> 16) & 0x1)
#define PORT_P4_OUT_P16_SET(reg,val) (reg) = ((reg & ~PORT_P4_OUT_P16) | (((val) & 0x1) << 16))
/* Port 4 Pin # Output Value (15) */
#define PORT_P4_OUT_P15 (0x1 << 15)
#define PORT_P4_OUT_P15_VAL(val) (((val) & 0x1) << 15)
#define PORT_P4_OUT_P15_GET(val) ((((val) & PORT_P4_OUT_P15) >> 15) & 0x1)
#define PORT_P4_OUT_P15_SET(reg,val) (reg) = ((reg & ~PORT_P4_OUT_P15) | (((val) & 0x1) << 15))
/* Port 4 Pin # Output Value (14) */
#define PORT_P4_OUT_P14 (0x1 << 14)
#define PORT_P4_OUT_P14_VAL(val) (((val) & 0x1) << 14)
#define PORT_P4_OUT_P14_GET(val) ((((val) & PORT_P4_OUT_P14) >> 14) & 0x1)
#define PORT_P4_OUT_P14_SET(reg,val) (reg) = ((reg & ~PORT_P4_OUT_P14) | (((val) & 0x1) << 14))
/* Port 4 Pin # Output Value (13) */
#define PORT_P4_OUT_P13 (0x1 << 13)
#define PORT_P4_OUT_P13_VAL(val) (((val) & 0x1) << 13)
#define PORT_P4_OUT_P13_GET(val) ((((val) & PORT_P4_OUT_P13) >> 13) & 0x1)
#define PORT_P4_OUT_P13_SET(reg,val) (reg) = ((reg & ~PORT_P4_OUT_P13) | (((val) & 0x1) << 13))
/* Port 4 Pin # Output Value (12) */
#define PORT_P4_OUT_P12 (0x1 << 12)
#define PORT_P4_OUT_P12_VAL(val) (((val) & 0x1) << 12)
#define PORT_P4_OUT_P12_GET(val) ((((val) & PORT_P4_OUT_P12) >> 12) & 0x1)
#define PORT_P4_OUT_P12_SET(reg,val) (reg) = ((reg & ~PORT_P4_OUT_P12) | (((val) & 0x1) << 12))
/* Port 4 Pin # Output Value (11) */
#define PORT_P4_OUT_P11 (0x1 << 11)
#define PORT_P4_OUT_P11_VAL(val) (((val) & 0x1) << 11)
#define PORT_P4_OUT_P11_GET(val) ((((val) & PORT_P4_OUT_P11) >> 11) & 0x1)
#define PORT_P4_OUT_P11_SET(reg,val) (reg) = ((reg & ~PORT_P4_OUT_P11) | (((val) & 0x1) << 11))
/* Port 4 Pin # Output Value (10) */
#define PORT_P4_OUT_P10 (0x1 << 10)
#define PORT_P4_OUT_P10_VAL(val) (((val) & 0x1) << 10)
#define PORT_P4_OUT_P10_GET(val) ((((val) & PORT_P4_OUT_P10) >> 10) & 0x1)
#define PORT_P4_OUT_P10_SET(reg,val) (reg) = ((reg & ~PORT_P4_OUT_P10) | (((val) & 0x1) << 10))
/* Port 4 Pin # Output Value (9) */
#define PORT_P4_OUT_P9 (0x1 << 9)
#define PORT_P4_OUT_P9_VAL(val) (((val) & 0x1) << 9)
#define PORT_P4_OUT_P9_GET(val) ((((val) & PORT_P4_OUT_P9) >> 9) & 0x1)
#define PORT_P4_OUT_P9_SET(reg,val) (reg) = ((reg & ~PORT_P4_OUT_P9) | (((val) & 0x1) << 9))
/* Port 4 Pin # Output Value (8) */
#define PORT_P4_OUT_P8 (0x1 << 8)
#define PORT_P4_OUT_P8_VAL(val) (((val) & 0x1) << 8)
#define PORT_P4_OUT_P8_GET(val) ((((val) & PORT_P4_OUT_P8) >> 8) & 0x1)
#define PORT_P4_OUT_P8_SET(reg,val) (reg) = ((reg & ~PORT_P4_OUT_P8) | (((val) & 0x1) << 8))
/* Port 4 Pin # Output Value (7) */
#define PORT_P4_OUT_P7 (0x1 << 7)
#define PORT_P4_OUT_P7_VAL(val) (((val) & 0x1) << 7)
#define PORT_P4_OUT_P7_GET(val) ((((val) & PORT_P4_OUT_P7) >> 7) & 0x1)
#define PORT_P4_OUT_P7_SET(reg,val) (reg) = ((reg & ~PORT_P4_OUT_P7) | (((val) & 0x1) << 7))
/* Port 4 Pin # Output Value (6) */
#define PORT_P4_OUT_P6 (0x1 << 6)
#define PORT_P4_OUT_P6_VAL(val) (((val) & 0x1) << 6)
#define PORT_P4_OUT_P6_GET(val) ((((val) & PORT_P4_OUT_P6) >> 6) & 0x1)
#define PORT_P4_OUT_P6_SET(reg,val) (reg) = ((reg & ~PORT_P4_OUT_P6) | (((val) & 0x1) << 6))
/* Port 4 Pin # Output Value (5) */
#define PORT_P4_OUT_P5 (0x1 << 5)
#define PORT_P4_OUT_P5_VAL(val) (((val) & 0x1) << 5)
#define PORT_P4_OUT_P5_GET(val) ((((val) & PORT_P4_OUT_P5) >> 5) & 0x1)
#define PORT_P4_OUT_P5_SET(reg,val) (reg) = ((reg & ~PORT_P4_OUT_P5) | (((val) & 0x1) << 5))
/* Port 4 Pin # Output Value (4) */
#define PORT_P4_OUT_P4 (0x1 << 4)
#define PORT_P4_OUT_P4_VAL(val) (((val) & 0x1) << 4)
#define PORT_P4_OUT_P4_GET(val) ((((val) & PORT_P4_OUT_P4) >> 4) & 0x1)
#define PORT_P4_OUT_P4_SET(reg,val) (reg) = ((reg & ~PORT_P4_OUT_P4) | (((val) & 0x1) << 4))
/* Port 4 Pin # Output Value (3) */
#define PORT_P4_OUT_P3 (0x1 << 3)
#define PORT_P4_OUT_P3_VAL(val) (((val) & 0x1) << 3)
#define PORT_P4_OUT_P3_GET(val) ((((val) & PORT_P4_OUT_P3) >> 3) & 0x1)
#define PORT_P4_OUT_P3_SET(reg,val) (reg) = ((reg & ~PORT_P4_OUT_P3) | (((val) & 0x1) << 3))
/* Port 4 Pin # Output Value (2) */
#define PORT_P4_OUT_P2 (0x1 << 2)
#define PORT_P4_OUT_P2_VAL(val) (((val) & 0x1) << 2)
#define PORT_P4_OUT_P2_GET(val) ((((val) & PORT_P4_OUT_P2) >> 2) & 0x1)
#define PORT_P4_OUT_P2_SET(reg,val) (reg) = ((reg & ~PORT_P4_OUT_P2) | (((val) & 0x1) << 2))
/* Port 4 Pin # Output Value (1) */
#define PORT_P4_OUT_P1 (0x1 << 1)
#define PORT_P4_OUT_P1_VAL(val) (((val) & 0x1) << 1)
#define PORT_P4_OUT_P1_GET(val) ((((val) & PORT_P4_OUT_P1) >> 1) & 0x1)
#define PORT_P4_OUT_P1_SET(reg,val) (reg) = ((reg & ~PORT_P4_OUT_P1) | (((val) & 0x1) << 1))
/* Port 4 Pin # Output Value (0) */
#define PORT_P4_OUT_P0 (0x1)
#define PORT_P4_OUT_P0_VAL(val) (((val) & 0x1) << 0)
#define PORT_P4_OUT_P0_GET(val) ((((val) & PORT_P4_OUT_P0) >> 0) & 0x1)
#define PORT_P4_OUT_P0_SET(reg,val) (reg) = ((reg & ~PORT_P4_OUT_P0) | (((val) & 0x1) << 0))
/*******************************************************************************
* Port 4 Data Input Register
******************************************************************************/
/* Port 4 Pin # Latched Input Value (23) */
#define PORT_P4_IN_P23 (0x1 << 23)
#define PORT_P4_IN_P23_GET(val) ((((val) & PORT_P4_IN_P23) >> 23) & 0x1)
/* Port 4 Pin # Latched Input Value (22) */
#define PORT_P4_IN_P22 (0x1 << 22)
#define PORT_P4_IN_P22_GET(val) ((((val) & PORT_P4_IN_P22) >> 22) & 0x1)
/* Port 4 Pin # Latched Input Value (21) */
#define PORT_P4_IN_P21 (0x1 << 21)
#define PORT_P4_IN_P21_GET(val) ((((val) & PORT_P4_IN_P21) >> 21) & 0x1)
/* Port 4 Pin # Latched Input Value (20) */
#define PORT_P4_IN_P20 (0x1 << 20)
#define PORT_P4_IN_P20_GET(val) ((((val) & PORT_P4_IN_P20) >> 20) & 0x1)
/* Port 4 Pin # Latched Input Value (19) */
#define PORT_P4_IN_P19 (0x1 << 19)
#define PORT_P4_IN_P19_GET(val) ((((val) & PORT_P4_IN_P19) >> 19) & 0x1)
/* Port 4 Pin # Latched Input Value (18) */
#define PORT_P4_IN_P18 (0x1 << 18)
#define PORT_P4_IN_P18_GET(val) ((((val) & PORT_P4_IN_P18) >> 18) & 0x1)
/* Port 4 Pin # Latched Input Value (17) */
#define PORT_P4_IN_P17 (0x1 << 17)
#define PORT_P4_IN_P17_GET(val) ((((val) & PORT_P4_IN_P17) >> 17) & 0x1)
/* Port 4 Pin # Latched Input Value (16) */
#define PORT_P4_IN_P16 (0x1 << 16)
#define PORT_P4_IN_P16_GET(val) ((((val) & PORT_P4_IN_P16) >> 16) & 0x1)
/* Port 4 Pin # Latched Input Value (15) */
#define PORT_P4_IN_P15 (0x1 << 15)
#define PORT_P4_IN_P15_GET(val) ((((val) & PORT_P4_IN_P15) >> 15) & 0x1)
/* Port 4 Pin # Latched Input Value (14) */
#define PORT_P4_IN_P14 (0x1 << 14)
#define PORT_P4_IN_P14_GET(val) ((((val) & PORT_P4_IN_P14) >> 14) & 0x1)
/* Port 4 Pin # Latched Input Value (13) */
#define PORT_P4_IN_P13 (0x1 << 13)
#define PORT_P4_IN_P13_GET(val) ((((val) & PORT_P4_IN_P13) >> 13) & 0x1)
/* Port 4 Pin # Latched Input Value (12) */
#define PORT_P4_IN_P12 (0x1 << 12)
#define PORT_P4_IN_P12_GET(val) ((((val) & PORT_P4_IN_P12) >> 12) & 0x1)
/* Port 4 Pin # Latched Input Value (11) */
#define PORT_P4_IN_P11 (0x1 << 11)
#define PORT_P4_IN_P11_GET(val) ((((val) & PORT_P4_IN_P11) >> 11) & 0x1)
/* Port 4 Pin # Latched Input Value (10) */
#define PORT_P4_IN_P10 (0x1 << 10)
#define PORT_P4_IN_P10_GET(val) ((((val) & PORT_P4_IN_P10) >> 10) & 0x1)
/* Port 4 Pin # Latched Input Value (9) */
#define PORT_P4_IN_P9 (0x1 << 9)
#define PORT_P4_IN_P9_GET(val) ((((val) & PORT_P4_IN_P9) >> 9) & 0x1)
/* Port 4 Pin # Latched Input Value (8) */
#define PORT_P4_IN_P8 (0x1 << 8)
#define PORT_P4_IN_P8_GET(val) ((((val) & PORT_P4_IN_P8) >> 8) & 0x1)
/* Port 4 Pin # Latched Input Value (7) */
#define PORT_P4_IN_P7 (0x1 << 7)
#define PORT_P4_IN_P7_GET(val) ((((val) & PORT_P4_IN_P7) >> 7) & 0x1)
/* Port 4 Pin # Latched Input Value (6) */
#define PORT_P4_IN_P6 (0x1 << 6)
#define PORT_P4_IN_P6_GET(val) ((((val) & PORT_P4_IN_P6) >> 6) & 0x1)
/* Port 4 Pin # Latched Input Value (5) */
#define PORT_P4_IN_P5 (0x1 << 5)
#define PORT_P4_IN_P5_GET(val) ((((val) & PORT_P4_IN_P5) >> 5) & 0x1)
/* Port 4 Pin # Latched Input Value (4) */
#define PORT_P4_IN_P4 (0x1 << 4)
#define PORT_P4_IN_P4_GET(val) ((((val) & PORT_P4_IN_P4) >> 4) & 0x1)
/* Port 4 Pin # Latched Input Value (3) */
#define PORT_P4_IN_P3 (0x1 << 3)
#define PORT_P4_IN_P3_GET(val) ((((val) & PORT_P4_IN_P3) >> 3) & 0x1)
/* Port 4 Pin # Latched Input Value (2) */
#define PORT_P4_IN_P2 (0x1 << 2)
#define PORT_P4_IN_P2_GET(val) ((((val) & PORT_P4_IN_P2) >> 2) & 0x1)
/* Port 4 Pin # Latched Input Value (1) */
#define PORT_P4_IN_P1 (0x1 << 1)
#define PORT_P4_IN_P1_GET(val) ((((val) & PORT_P4_IN_P1) >> 1) & 0x1)
/* Port 4 Pin # Latched Input Value (0) */
#define PORT_P4_IN_P0 (0x1)
#define PORT_P4_IN_P0_GET(val) ((((val) & PORT_P4_IN_P0) >> 0) & 0x1)
/*******************************************************************************
* Port 4 Direction Register
******************************************************************************/
/* Port 4 Pin #Direction Control (23) */
#define PORT_P4_DIR_P23 (0x1 << 23)
#define PORT_P4_DIR_P23_VAL(val) (((val) & 0x1) << 23)
#define PORT_P4_DIR_P23_GET(val) ((((val) & PORT_P4_DIR_P23) >> 23) & 0x1)
#define PORT_P4_DIR_P23_SET(reg,val) (reg) = ((reg & ~PORT_P4_DIR_P23) | (((val) & 0x1) << 23))
/* Port 4 Pin #Direction Control (22) */
#define PORT_P4_DIR_P22 (0x1 << 22)
#define PORT_P4_DIR_P22_VAL(val) (((val) & 0x1) << 22)
#define PORT_P4_DIR_P22_GET(val) ((((val) & PORT_P4_DIR_P22) >> 22) & 0x1)
#define PORT_P4_DIR_P22_SET(reg,val) (reg) = ((reg & ~PORT_P4_DIR_P22) | (((val) & 0x1) << 22))
/* Port 4 Pin #Direction Control (21) */
#define PORT_P4_DIR_P21 (0x1 << 21)
#define PORT_P4_DIR_P21_VAL(val) (((val) & 0x1) << 21)
#define PORT_P4_DIR_P21_GET(val) ((((val) & PORT_P4_DIR_P21) >> 21) & 0x1)
#define PORT_P4_DIR_P21_SET(reg,val) (reg) = ((reg & ~PORT_P4_DIR_P21) | (((val) & 0x1) << 21))
/* Port 4 Pin #Direction Control (20) */
#define PORT_P4_DIR_P20 (0x1 << 20)
#define PORT_P4_DIR_P20_VAL(val) (((val) & 0x1) << 20)
#define PORT_P4_DIR_P20_GET(val) ((((val) & PORT_P4_DIR_P20) >> 20) & 0x1)
#define PORT_P4_DIR_P20_SET(reg,val) (reg) = ((reg & ~PORT_P4_DIR_P20) | (((val) & 0x1) << 20))
/* Port 4 Pin #Direction Control (19) */
#define PORT_P4_DIR_P19 (0x1 << 19)
#define PORT_P4_DIR_P19_VAL(val) (((val) & 0x1) << 19)
#define PORT_P4_DIR_P19_GET(val) ((((val) & PORT_P4_DIR_P19) >> 19) & 0x1)
#define PORT_P4_DIR_P19_SET(reg,val) (reg) = ((reg & ~PORT_P4_DIR_P19) | (((val) & 0x1) << 19))
/* Port 4 Pin #Direction Control (18) */
#define PORT_P4_DIR_P18 (0x1 << 18)
#define PORT_P4_DIR_P18_VAL(val) (((val) & 0x1) << 18)
#define PORT_P4_DIR_P18_GET(val) ((((val) & PORT_P4_DIR_P18) >> 18) & 0x1)
#define PORT_P4_DIR_P18_SET(reg,val) (reg) = ((reg & ~PORT_P4_DIR_P18) | (((val) & 0x1) << 18))
/* Port 4 Pin #Direction Control (17) */
#define PORT_P4_DIR_P17 (0x1 << 17)
#define PORT_P4_DIR_P17_VAL(val) (((val) & 0x1) << 17)
#define PORT_P4_DIR_P17_GET(val) ((((val) & PORT_P4_DIR_P17) >> 17) & 0x1)
#define PORT_P4_DIR_P17_SET(reg,val) (reg) = ((reg & ~PORT_P4_DIR_P17) | (((val) & 0x1) << 17))
/* Port 4 Pin #Direction Control (16) */
#define PORT_P4_DIR_P16 (0x1 << 16)
#define PORT_P4_DIR_P16_VAL(val) (((val) & 0x1) << 16)
#define PORT_P4_DIR_P16_GET(val) ((((val) & PORT_P4_DIR_P16) >> 16) & 0x1)
#define PORT_P4_DIR_P16_SET(reg,val) (reg) = ((reg & ~PORT_P4_DIR_P16) | (((val) & 0x1) << 16))
/* Port 4 Pin #Direction Control (15) */
#define PORT_P4_DIR_P15 (0x1 << 15)
#define PORT_P4_DIR_P15_VAL(val) (((val) & 0x1) << 15)
#define PORT_P4_DIR_P15_GET(val) ((((val) & PORT_P4_DIR_P15) >> 15) & 0x1)
#define PORT_P4_DIR_P15_SET(reg,val) (reg) = ((reg & ~PORT_P4_DIR_P15) | (((val) & 0x1) << 15))
/* Port 4 Pin #Direction Control (14) */
#define PORT_P4_DIR_P14 (0x1 << 14)
#define PORT_P4_DIR_P14_VAL(val) (((val) & 0x1) << 14)
#define PORT_P4_DIR_P14_GET(val) ((((val) & PORT_P4_DIR_P14) >> 14) & 0x1)
#define PORT_P4_DIR_P14_SET(reg,val) (reg) = ((reg & ~PORT_P4_DIR_P14) | (((val) & 0x1) << 14))
/* Port 4 Pin #Direction Control (13) */
#define PORT_P4_DIR_P13 (0x1 << 13)
#define PORT_P4_DIR_P13_VAL(val) (((val) & 0x1) << 13)
#define PORT_P4_DIR_P13_GET(val) ((((val) & PORT_P4_DIR_P13) >> 13) & 0x1)
#define PORT_P4_DIR_P13_SET(reg,val) (reg) = ((reg & ~PORT_P4_DIR_P13) | (((val) & 0x1) << 13))
/* Port 4 Pin #Direction Control (12) */
#define PORT_P4_DIR_P12 (0x1 << 12)
#define PORT_P4_DIR_P12_VAL(val) (((val) & 0x1) << 12)
#define PORT_P4_DIR_P12_GET(val) ((((val) & PORT_P4_DIR_P12) >> 12) & 0x1)
#define PORT_P4_DIR_P12_SET(reg,val) (reg) = ((reg & ~PORT_P4_DIR_P12) | (((val) & 0x1) << 12))
/* Port 4 Pin #Direction Control (11) */
#define PORT_P4_DIR_P11 (0x1 << 11)
#define PORT_P4_DIR_P11_VAL(val) (((val) & 0x1) << 11)
#define PORT_P4_DIR_P11_GET(val) ((((val) & PORT_P4_DIR_P11) >> 11) & 0x1)
#define PORT_P4_DIR_P11_SET(reg,val) (reg) = ((reg & ~PORT_P4_DIR_P11) | (((val) & 0x1) << 11))
/* Port 4 Pin #Direction Control (10) */
#define PORT_P4_DIR_P10 (0x1 << 10)
#define PORT_P4_DIR_P10_VAL(val) (((val) & 0x1) << 10)
#define PORT_P4_DIR_P10_GET(val) ((((val) & PORT_P4_DIR_P10) >> 10) & 0x1)
#define PORT_P4_DIR_P10_SET(reg,val) (reg) = ((reg & ~PORT_P4_DIR_P10) | (((val) & 0x1) << 10))
/* Port 4 Pin #Direction Control (9) */
#define PORT_P4_DIR_P9 (0x1 << 9)
#define PORT_P4_DIR_P9_VAL(val) (((val) & 0x1) << 9)
#define PORT_P4_DIR_P9_GET(val) ((((val) & PORT_P4_DIR_P9) >> 9) & 0x1)
#define PORT_P4_DIR_P9_SET(reg,val) (reg) = ((reg & ~PORT_P4_DIR_P9) | (((val) & 0x1) << 9))
/* Port 4 Pin #Direction Control (8) */
#define PORT_P4_DIR_P8 (0x1 << 8)
#define PORT_P4_DIR_P8_VAL(val) (((val) & 0x1) << 8)
#define PORT_P4_DIR_P8_GET(val) ((((val) & PORT_P4_DIR_P8) >> 8) & 0x1)
#define PORT_P4_DIR_P8_SET(reg,val) (reg) = ((reg & ~PORT_P4_DIR_P8) | (((val) & 0x1) << 8))
/* Port 4 Pin #Direction Control (7) */
#define PORT_P4_DIR_P7 (0x1 << 7)
#define PORT_P4_DIR_P7_VAL(val) (((val) & 0x1) << 7)
#define PORT_P4_DIR_P7_GET(val) ((((val) & PORT_P4_DIR_P7) >> 7) & 0x1)
#define PORT_P4_DIR_P7_SET(reg,val) (reg) = ((reg & ~PORT_P4_DIR_P7) | (((val) & 0x1) << 7))
/* Port 4 Pin #Direction Control (6) */
#define PORT_P4_DIR_P6 (0x1 << 6)
#define PORT_P4_DIR_P6_VAL(val) (((val) & 0x1) << 6)
#define PORT_P4_DIR_P6_GET(val) ((((val) & PORT_P4_DIR_P6) >> 6) & 0x1)
#define PORT_P4_DIR_P6_SET(reg,val) (reg) = ((reg & ~PORT_P4_DIR_P6) | (((val) & 0x1) << 6))
/* Port 4 Pin #Direction Control (5) */
#define PORT_P4_DIR_P5 (0x1 << 5)
#define PORT_P4_DIR_P5_VAL(val) (((val) & 0x1) << 5)
#define PORT_P4_DIR_P5_GET(val) ((((val) & PORT_P4_DIR_P5) >> 5) & 0x1)
#define PORT_P4_DIR_P5_SET(reg,val) (reg) = ((reg & ~PORT_P4_DIR_P5) | (((val) & 0x1) << 5))
/* Port 4 Pin #Direction Control (4) */
#define PORT_P4_DIR_P4 (0x1 << 4)
#define PORT_P4_DIR_P4_VAL(val) (((val) & 0x1) << 4)
#define PORT_P4_DIR_P4_GET(val) ((((val) & PORT_P4_DIR_P4) >> 4) & 0x1)
#define PORT_P4_DIR_P4_SET(reg,val) (reg) = ((reg & ~PORT_P4_DIR_P4) | (((val) & 0x1) << 4))
/* Port 4 Pin #Direction Control (3) */
#define PORT_P4_DIR_P3 (0x1 << 3)
#define PORT_P4_DIR_P3_VAL(val) (((val) & 0x1) << 3)
#define PORT_P4_DIR_P3_GET(val) ((((val) & PORT_P4_DIR_P3) >> 3) & 0x1)
#define PORT_P4_DIR_P3_SET(reg,val) (reg) = ((reg & ~PORT_P4_DIR_P3) | (((val) & 0x1) << 3))
/* Port 4 Pin #Direction Control (2) */
#define PORT_P4_DIR_P2 (0x1 << 2)
#define PORT_P4_DIR_P2_VAL(val) (((val) & 0x1) << 2)
#define PORT_P4_DIR_P2_GET(val) ((((val) & PORT_P4_DIR_P2) >> 2) & 0x1)
#define PORT_P4_DIR_P2_SET(reg,val) (reg) = ((reg & ~PORT_P4_DIR_P2) | (((val) & 0x1) << 2))
/* Port 4 Pin #Direction Control (1) */
#define PORT_P4_DIR_P1 (0x1 << 1)
#define PORT_P4_DIR_P1_VAL(val) (((val) & 0x1) << 1)
#define PORT_P4_DIR_P1_GET(val) ((((val) & PORT_P4_DIR_P1) >> 1) & 0x1)
#define PORT_P4_DIR_P1_SET(reg,val) (reg) = ((reg & ~PORT_P4_DIR_P1) | (((val) & 0x1) << 1))
/* Port 4 Pin #Direction Control (0) */
#define PORT_P4_DIR_P0 (0x1)
#define PORT_P4_DIR_P0_VAL(val) (((val) & 0x1) << 0)
#define PORT_P4_DIR_P0_GET(val) ((((val) & PORT_P4_DIR_P0) >> 0) & 0x1)
#define PORT_P4_DIR_P0_SET(reg,val) (reg) = ((reg & ~PORT_P4_DIR_P0) | (((val) & 0x1) << 0))
/*******************************************************************************
* Port 4 Alternate Function Select Register 0
******************************************************************************/
/* Alternate Function at Port 4 Bit # (23) */
#define PORT_P4_ALTSEL0_P23 (0x1 << 23)
#define PORT_P4_ALTSEL0_P23_VAL(val) (((val) & 0x1) << 23)
#define PORT_P4_ALTSEL0_P23_GET(val) ((((val) & PORT_P4_ALTSEL0_P23) >> 23) & 0x1)
#define PORT_P4_ALTSEL0_P23_SET(reg,val) (reg) = ((reg & ~PORT_P4_ALTSEL0_P23) | (((val) & 0x1) << 23))
/* Alternate Function at Port 4 Bit # (22) */
#define PORT_P4_ALTSEL0_P22 (0x1 << 22)
#define PORT_P4_ALTSEL0_P22_VAL(val) (((val) & 0x1) << 22)
#define PORT_P4_ALTSEL0_P22_GET(val) ((((val) & PORT_P4_ALTSEL0_P22) >> 22) & 0x1)
#define PORT_P4_ALTSEL0_P22_SET(reg,val) (reg) = ((reg & ~PORT_P4_ALTSEL0_P22) | (((val) & 0x1) << 22))
/* Alternate Function at Port 4 Bit # (21) */
#define PORT_P4_ALTSEL0_P21 (0x1 << 21)
#define PORT_P4_ALTSEL0_P21_VAL(val) (((val) & 0x1) << 21)
#define PORT_P4_ALTSEL0_P21_GET(val) ((((val) & PORT_P4_ALTSEL0_P21) >> 21) & 0x1)
#define PORT_P4_ALTSEL0_P21_SET(reg,val) (reg) = ((reg & ~PORT_P4_ALTSEL0_P21) | (((val) & 0x1) << 21))
/* Alternate Function at Port 4 Bit # (20) */
#define PORT_P4_ALTSEL0_P20 (0x1 << 20)
#define PORT_P4_ALTSEL0_P20_VAL(val) (((val) & 0x1) << 20)
#define PORT_P4_ALTSEL0_P20_GET(val) ((((val) & PORT_P4_ALTSEL0_P20) >> 20) & 0x1)
#define PORT_P4_ALTSEL0_P20_SET(reg,val) (reg) = ((reg & ~PORT_P4_ALTSEL0_P20) | (((val) & 0x1) << 20))
/* Alternate Function at Port 4 Bit # (19) */
#define PORT_P4_ALTSEL0_P19 (0x1 << 19)
#define PORT_P4_ALTSEL0_P19_VAL(val) (((val) & 0x1) << 19)
#define PORT_P4_ALTSEL0_P19_GET(val) ((((val) & PORT_P4_ALTSEL0_P19) >> 19) & 0x1)
#define PORT_P4_ALTSEL0_P19_SET(reg,val) (reg) = ((reg & ~PORT_P4_ALTSEL0_P19) | (((val) & 0x1) << 19))
/* Alternate Function at Port 4 Bit # (18) */
#define PORT_P4_ALTSEL0_P18 (0x1 << 18)
#define PORT_P4_ALTSEL0_P18_VAL(val) (((val) & 0x1) << 18)
#define PORT_P4_ALTSEL0_P18_GET(val) ((((val) & PORT_P4_ALTSEL0_P18) >> 18) & 0x1)
#define PORT_P4_ALTSEL0_P18_SET(reg,val) (reg) = ((reg & ~PORT_P4_ALTSEL0_P18) | (((val) & 0x1) << 18))
/* Alternate Function at Port 4 Bit # (17) */
#define PORT_P4_ALTSEL0_P17 (0x1 << 17)
#define PORT_P4_ALTSEL0_P17_VAL(val) (((val) & 0x1) << 17)
#define PORT_P4_ALTSEL0_P17_GET(val) ((((val) & PORT_P4_ALTSEL0_P17) >> 17) & 0x1)
#define PORT_P4_ALTSEL0_P17_SET(reg,val) (reg) = ((reg & ~PORT_P4_ALTSEL0_P17) | (((val) & 0x1) << 17))
/* Alternate Function at Port 4 Bit # (16) */
#define PORT_P4_ALTSEL0_P16 (0x1 << 16)
#define PORT_P4_ALTSEL0_P16_VAL(val) (((val) & 0x1) << 16)
#define PORT_P4_ALTSEL0_P16_GET(val) ((((val) & PORT_P4_ALTSEL0_P16) >> 16) & 0x1)
#define PORT_P4_ALTSEL0_P16_SET(reg,val) (reg) = ((reg & ~PORT_P4_ALTSEL0_P16) | (((val) & 0x1) << 16))
/* Alternate Function at Port 4 Bit # (15) */
#define PORT_P4_ALTSEL0_P15 (0x1 << 15)
#define PORT_P4_ALTSEL0_P15_VAL(val) (((val) & 0x1) << 15)
#define PORT_P4_ALTSEL0_P15_GET(val) ((((val) & PORT_P4_ALTSEL0_P15) >> 15) & 0x1)
#define PORT_P4_ALTSEL0_P15_SET(reg,val) (reg) = ((reg & ~PORT_P4_ALTSEL0_P15) | (((val) & 0x1) << 15))
/* Alternate Function at Port 4 Bit # (14) */
#define PORT_P4_ALTSEL0_P14 (0x1 << 14)
#define PORT_P4_ALTSEL0_P14_VAL(val) (((val) & 0x1) << 14)
#define PORT_P4_ALTSEL0_P14_GET(val) ((((val) & PORT_P4_ALTSEL0_P14) >> 14) & 0x1)
#define PORT_P4_ALTSEL0_P14_SET(reg,val) (reg) = ((reg & ~PORT_P4_ALTSEL0_P14) | (((val) & 0x1) << 14))
/* Alternate Function at Port 4 Bit # (13) */
#define PORT_P4_ALTSEL0_P13 (0x1 << 13)
#define PORT_P4_ALTSEL0_P13_VAL(val) (((val) & 0x1) << 13)
#define PORT_P4_ALTSEL0_P13_GET(val) ((((val) & PORT_P4_ALTSEL0_P13) >> 13) & 0x1)
#define PORT_P4_ALTSEL0_P13_SET(reg,val) (reg) = ((reg & ~PORT_P4_ALTSEL0_P13) | (((val) & 0x1) << 13))
/* Alternate Function at Port 4 Bit # (12) */
#define PORT_P4_ALTSEL0_P12 (0x1 << 12)
#define PORT_P4_ALTSEL0_P12_VAL(val) (((val) & 0x1) << 12)
#define PORT_P4_ALTSEL0_P12_GET(val) ((((val) & PORT_P4_ALTSEL0_P12) >> 12) & 0x1)
#define PORT_P4_ALTSEL0_P12_SET(reg,val) (reg) = ((reg & ~PORT_P4_ALTSEL0_P12) | (((val) & 0x1) << 12))
/* Alternate Function at Port 4 Bit # (11) */
#define PORT_P4_ALTSEL0_P11 (0x1 << 11)
#define PORT_P4_ALTSEL0_P11_VAL(val) (((val) & 0x1) << 11)
#define PORT_P4_ALTSEL0_P11_GET(val) ((((val) & PORT_P4_ALTSEL0_P11) >> 11) & 0x1)
#define PORT_P4_ALTSEL0_P11_SET(reg,val) (reg) = ((reg & ~PORT_P4_ALTSEL0_P11) | (((val) & 0x1) << 11))
/* Alternate Function at Port 4 Bit # (10) */
#define PORT_P4_ALTSEL0_P10 (0x1 << 10)
#define PORT_P4_ALTSEL0_P10_VAL(val) (((val) & 0x1) << 10)
#define PORT_P4_ALTSEL0_P10_GET(val) ((((val) & PORT_P4_ALTSEL0_P10) >> 10) & 0x1)
#define PORT_P4_ALTSEL0_P10_SET(reg,val) (reg) = ((reg & ~PORT_P4_ALTSEL0_P10) | (((val) & 0x1) << 10))
/* Alternate Function at Port 4 Bit # (9) */
#define PORT_P4_ALTSEL0_P9 (0x1 << 9)
#define PORT_P4_ALTSEL0_P9_VAL(val) (((val) & 0x1) << 9)
#define PORT_P4_ALTSEL0_P9_GET(val) ((((val) & PORT_P4_ALTSEL0_P9) >> 9) & 0x1)
#define PORT_P4_ALTSEL0_P9_SET(reg,val) (reg) = ((reg & ~PORT_P4_ALTSEL0_P9) | (((val) & 0x1) << 9))
/* Alternate Function at Port 4 Bit # (8) */
#define PORT_P4_ALTSEL0_P8 (0x1 << 8)
#define PORT_P4_ALTSEL0_P8_VAL(val) (((val) & 0x1) << 8)
#define PORT_P4_ALTSEL0_P8_GET(val) ((((val) & PORT_P4_ALTSEL0_P8) >> 8) & 0x1)
#define PORT_P4_ALTSEL0_P8_SET(reg,val) (reg) = ((reg & ~PORT_P4_ALTSEL0_P8) | (((val) & 0x1) << 8))
/* Alternate Function at Port 4 Bit # (7) */
#define PORT_P4_ALTSEL0_P7 (0x1 << 7)
#define PORT_P4_ALTSEL0_P7_VAL(val) (((val) & 0x1) << 7)
#define PORT_P4_ALTSEL0_P7_GET(val) ((((val) & PORT_P4_ALTSEL0_P7) >> 7) & 0x1)
#define PORT_P4_ALTSEL0_P7_SET(reg,val) (reg) = ((reg & ~PORT_P4_ALTSEL0_P7) | (((val) & 0x1) << 7))
/* Alternate Function at Port 4 Bit # (6) */
#define PORT_P4_ALTSEL0_P6 (0x1 << 6)
#define PORT_P4_ALTSEL0_P6_VAL(val) (((val) & 0x1) << 6)
#define PORT_P4_ALTSEL0_P6_GET(val) ((((val) & PORT_P4_ALTSEL0_P6) >> 6) & 0x1)
#define PORT_P4_ALTSEL0_P6_SET(reg,val) (reg) = ((reg & ~PORT_P4_ALTSEL0_P6) | (((val) & 0x1) << 6))
/* Alternate Function at Port 4 Bit # (5) */
#define PORT_P4_ALTSEL0_P5 (0x1 << 5)
#define PORT_P4_ALTSEL0_P5_VAL(val) (((val) & 0x1) << 5)
#define PORT_P4_ALTSEL0_P5_GET(val) ((((val) & PORT_P4_ALTSEL0_P5) >> 5) & 0x1)
#define PORT_P4_ALTSEL0_P5_SET(reg,val) (reg) = ((reg & ~PORT_P4_ALTSEL0_P5) | (((val) & 0x1) << 5))
/* Alternate Function at Port 4 Bit # (4) */
#define PORT_P4_ALTSEL0_P4 (0x1 << 4)
#define PORT_P4_ALTSEL0_P4_VAL(val) (((val) & 0x1) << 4)
#define PORT_P4_ALTSEL0_P4_GET(val) ((((val) & PORT_P4_ALTSEL0_P4) >> 4) & 0x1)
#define PORT_P4_ALTSEL0_P4_SET(reg,val) (reg) = ((reg & ~PORT_P4_ALTSEL0_P4) | (((val) & 0x1) << 4))
/* Alternate Function at Port 4 Bit # (3) */
#define PORT_P4_ALTSEL0_P3 (0x1 << 3)
#define PORT_P4_ALTSEL0_P3_VAL(val) (((val) & 0x1) << 3)
#define PORT_P4_ALTSEL0_P3_GET(val) ((((val) & PORT_P4_ALTSEL0_P3) >> 3) & 0x1)
#define PORT_P4_ALTSEL0_P3_SET(reg,val) (reg) = ((reg & ~PORT_P4_ALTSEL0_P3) | (((val) & 0x1) << 3))
/* Alternate Function at Port 4 Bit # (2) */
#define PORT_P4_ALTSEL0_P2 (0x1 << 2)
#define PORT_P4_ALTSEL0_P2_VAL(val) (((val) & 0x1) << 2)
#define PORT_P4_ALTSEL0_P2_GET(val) ((((val) & PORT_P4_ALTSEL0_P2) >> 2) & 0x1)
#define PORT_P4_ALTSEL0_P2_SET(reg,val) (reg) = ((reg & ~PORT_P4_ALTSEL0_P2) | (((val) & 0x1) << 2))
/* Alternate Function at Port 4 Bit # (1) */
#define PORT_P4_ALTSEL0_P1 (0x1 << 1)
#define PORT_P4_ALTSEL0_P1_VAL(val) (((val) & 0x1) << 1)
#define PORT_P4_ALTSEL0_P1_GET(val) ((((val) & PORT_P4_ALTSEL0_P1) >> 1) & 0x1)
#define PORT_P4_ALTSEL0_P1_SET(reg,val) (reg) = ((reg & ~PORT_P4_ALTSEL0_P1) | (((val) & 0x1) << 1))
/* Alternate Function at Port 4 Bit # (0) */
#define PORT_P4_ALTSEL0_P0 (0x1)
#define PORT_P4_ALTSEL0_P0_VAL(val) (((val) & 0x1) << 0)
#define PORT_P4_ALTSEL0_P0_GET(val) ((((val) & PORT_P4_ALTSEL0_P0) >> 0) & 0x1)
#define PORT_P4_ALTSEL0_P0_SET(reg,val) (reg) = ((reg & ~PORT_P4_ALTSEL0_P0) | (((val) & 0x1) << 0))
/*******************************************************************************
* Port 4 Pull Up Device Enable Register
******************************************************************************/
/* Pull Up Device Enable at Port 4 Bit # (23) */
#define PORT_P4_PUEN_P23 (0x1 << 23)
#define PORT_P4_PUEN_P23_VAL(val) (((val) & 0x1) << 23)
#define PORT_P4_PUEN_P23_GET(val) ((((val) & PORT_P4_PUEN_P23) >> 23) & 0x1)
#define PORT_P4_PUEN_P23_SET(reg,val) (reg) = ((reg & ~PORT_P4_PUEN_P23) | (((val) & 0x1) << 23))
/* Pull Up Device Enable at Port 4 Bit # (22) */
#define PORT_P4_PUEN_P22 (0x1 << 22)
#define PORT_P4_PUEN_P22_VAL(val) (((val) & 0x1) << 22)
#define PORT_P4_PUEN_P22_GET(val) ((((val) & PORT_P4_PUEN_P22) >> 22) & 0x1)
#define PORT_P4_PUEN_P22_SET(reg,val) (reg) = ((reg & ~PORT_P4_PUEN_P22) | (((val) & 0x1) << 22))
/* Pull Up Device Enable at Port 4 Bit # (21) */
#define PORT_P4_PUEN_P21 (0x1 << 21)
#define PORT_P4_PUEN_P21_VAL(val) (((val) & 0x1) << 21)
#define PORT_P4_PUEN_P21_GET(val) ((((val) & PORT_P4_PUEN_P21) >> 21) & 0x1)
#define PORT_P4_PUEN_P21_SET(reg,val) (reg) = ((reg & ~PORT_P4_PUEN_P21) | (((val) & 0x1) << 21))
/* Pull Up Device Enable at Port 4 Bit # (20) */
#define PORT_P4_PUEN_P20 (0x1 << 20)
#define PORT_P4_PUEN_P20_VAL(val) (((val) & 0x1) << 20)
#define PORT_P4_PUEN_P20_GET(val) ((((val) & PORT_P4_PUEN_P20) >> 20) & 0x1)
#define PORT_P4_PUEN_P20_SET(reg,val) (reg) = ((reg & ~PORT_P4_PUEN_P20) | (((val) & 0x1) << 20))
/* Pull Up Device Enable at Port 4 Bit # (19) */
#define PORT_P4_PUEN_P19 (0x1 << 19)
#define PORT_P4_PUEN_P19_VAL(val) (((val) & 0x1) << 19)
#define PORT_P4_PUEN_P19_GET(val) ((((val) & PORT_P4_PUEN_P19) >> 19) & 0x1)
#define PORT_P4_PUEN_P19_SET(reg,val) (reg) = ((reg & ~PORT_P4_PUEN_P19) | (((val) & 0x1) << 19))
/* Pull Up Device Enable at Port 4 Bit # (18) */
#define PORT_P4_PUEN_P18 (0x1 << 18)
#define PORT_P4_PUEN_P18_VAL(val) (((val) & 0x1) << 18)
#define PORT_P4_PUEN_P18_GET(val) ((((val) & PORT_P4_PUEN_P18) >> 18) & 0x1)
#define PORT_P4_PUEN_P18_SET(reg,val) (reg) = ((reg & ~PORT_P4_PUEN_P18) | (((val) & 0x1) << 18))
/* Pull Up Device Enable at Port 4 Bit # (17) */
#define PORT_P4_PUEN_P17 (0x1 << 17)
#define PORT_P4_PUEN_P17_VAL(val) (((val) & 0x1) << 17)
#define PORT_P4_PUEN_P17_GET(val) ((((val) & PORT_P4_PUEN_P17) >> 17) & 0x1)
#define PORT_P4_PUEN_P17_SET(reg,val) (reg) = ((reg & ~PORT_P4_PUEN_P17) | (((val) & 0x1) << 17))
/* Pull Up Device Enable at Port 4 Bit # (16) */
#define PORT_P4_PUEN_P16 (0x1 << 16)
#define PORT_P4_PUEN_P16_VAL(val) (((val) & 0x1) << 16)
#define PORT_P4_PUEN_P16_GET(val) ((((val) & PORT_P4_PUEN_P16) >> 16) & 0x1)
#define PORT_P4_PUEN_P16_SET(reg,val) (reg) = ((reg & ~PORT_P4_PUEN_P16) | (((val) & 0x1) << 16))
/* Pull Up Device Enable at Port 4 Bit # (15) */
#define PORT_P4_PUEN_P15 (0x1 << 15)
#define PORT_P4_PUEN_P15_VAL(val) (((val) & 0x1) << 15)
#define PORT_P4_PUEN_P15_GET(val) ((((val) & PORT_P4_PUEN_P15) >> 15) & 0x1)
#define PORT_P4_PUEN_P15_SET(reg,val) (reg) = ((reg & ~PORT_P4_PUEN_P15) | (((val) & 0x1) << 15))
/* Pull Up Device Enable at Port 4 Bit # (14) */
#define PORT_P4_PUEN_P14 (0x1 << 14)
#define PORT_P4_PUEN_P14_VAL(val) (((val) & 0x1) << 14)
#define PORT_P4_PUEN_P14_GET(val) ((((val) & PORT_P4_PUEN_P14) >> 14) & 0x1)
#define PORT_P4_PUEN_P14_SET(reg,val) (reg) = ((reg & ~PORT_P4_PUEN_P14) | (((val) & 0x1) << 14))
/* Pull Up Device Enable at Port 4 Bit # (13) */
#define PORT_P4_PUEN_P13 (0x1 << 13)
#define PORT_P4_PUEN_P13_VAL(val) (((val) & 0x1) << 13)
#define PORT_P4_PUEN_P13_GET(val) ((((val) & PORT_P4_PUEN_P13) >> 13) & 0x1)
#define PORT_P4_PUEN_P13_SET(reg,val) (reg) = ((reg & ~PORT_P4_PUEN_P13) | (((val) & 0x1) << 13))
/* Pull Up Device Enable at Port 4 Bit # (12) */
#define PORT_P4_PUEN_P12 (0x1 << 12)
#define PORT_P4_PUEN_P12_VAL(val) (((val) & 0x1) << 12)
#define PORT_P4_PUEN_P12_GET(val) ((((val) & PORT_P4_PUEN_P12) >> 12) & 0x1)
#define PORT_P4_PUEN_P12_SET(reg,val) (reg) = ((reg & ~PORT_P4_PUEN_P12) | (((val) & 0x1) << 12))
/* Pull Up Device Enable at Port 4 Bit # (11) */
#define PORT_P4_PUEN_P11 (0x1 << 11)
#define PORT_P4_PUEN_P11_VAL(val) (((val) & 0x1) << 11)
#define PORT_P4_PUEN_P11_GET(val) ((((val) & PORT_P4_PUEN_P11) >> 11) & 0x1)
#define PORT_P4_PUEN_P11_SET(reg,val) (reg) = ((reg & ~PORT_P4_PUEN_P11) | (((val) & 0x1) << 11))
/* Pull Up Device Enable at Port 4 Bit # (10) */
#define PORT_P4_PUEN_P10 (0x1 << 10)
#define PORT_P4_PUEN_P10_VAL(val) (((val) & 0x1) << 10)
#define PORT_P4_PUEN_P10_GET(val) ((((val) & PORT_P4_PUEN_P10) >> 10) & 0x1)
#define PORT_P4_PUEN_P10_SET(reg,val) (reg) = ((reg & ~PORT_P4_PUEN_P10) | (((val) & 0x1) << 10))
/* Pull Up Device Enable at Port 4 Bit # (9) */
#define PORT_P4_PUEN_P9 (0x1 << 9)
#define PORT_P4_PUEN_P9_VAL(val) (((val) & 0x1) << 9)
#define PORT_P4_PUEN_P9_GET(val) ((((val) & PORT_P4_PUEN_P9) >> 9) & 0x1)
#define PORT_P4_PUEN_P9_SET(reg,val) (reg) = ((reg & ~PORT_P4_PUEN_P9) | (((val) & 0x1) << 9))
/* Pull Up Device Enable at Port 4 Bit # (8) */
#define PORT_P4_PUEN_P8 (0x1 << 8)
#define PORT_P4_PUEN_P8_VAL(val) (((val) & 0x1) << 8)
#define PORT_P4_PUEN_P8_GET(val) ((((val) & PORT_P4_PUEN_P8) >> 8) & 0x1)
#define PORT_P4_PUEN_P8_SET(reg,val) (reg) = ((reg & ~PORT_P4_PUEN_P8) | (((val) & 0x1) << 8))
/* Pull Up Device Enable at Port 4 Bit # (7) */
#define PORT_P4_PUEN_P7 (0x1 << 7)
#define PORT_P4_PUEN_P7_VAL(val) (((val) & 0x1) << 7)
#define PORT_P4_PUEN_P7_GET(val) ((((val) & PORT_P4_PUEN_P7) >> 7) & 0x1)
#define PORT_P4_PUEN_P7_SET(reg,val) (reg) = ((reg & ~PORT_P4_PUEN_P7) | (((val) & 0x1) << 7))
/* Pull Up Device Enable at Port 4 Bit # (6) */
#define PORT_P4_PUEN_P6 (0x1 << 6)
#define PORT_P4_PUEN_P6_VAL(val) (((val) & 0x1) << 6)
#define PORT_P4_PUEN_P6_GET(val) ((((val) & PORT_P4_PUEN_P6) >> 6) & 0x1)
#define PORT_P4_PUEN_P6_SET(reg,val) (reg) = ((reg & ~PORT_P4_PUEN_P6) | (((val) & 0x1) << 6))
/* Pull Up Device Enable at Port 4 Bit # (5) */
#define PORT_P4_PUEN_P5 (0x1 << 5)
#define PORT_P4_PUEN_P5_VAL(val) (((val) & 0x1) << 5)
#define PORT_P4_PUEN_P5_GET(val) ((((val) & PORT_P4_PUEN_P5) >> 5) & 0x1)
#define PORT_P4_PUEN_P5_SET(reg,val) (reg) = ((reg & ~PORT_P4_PUEN_P5) | (((val) & 0x1) << 5))
/* Pull Up Device Enable at Port 4 Bit # (4) */
#define PORT_P4_PUEN_P4 (0x1 << 4)
#define PORT_P4_PUEN_P4_VAL(val) (((val) & 0x1) << 4)
#define PORT_P4_PUEN_P4_GET(val) ((((val) & PORT_P4_PUEN_P4) >> 4) & 0x1)
#define PORT_P4_PUEN_P4_SET(reg,val) (reg) = ((reg & ~PORT_P4_PUEN_P4) | (((val) & 0x1) << 4))
/* Pull Up Device Enable at Port 4 Bit # (3) */
#define PORT_P4_PUEN_P3 (0x1 << 3)
#define PORT_P4_PUEN_P3_VAL(val) (((val) & 0x1) << 3)
#define PORT_P4_PUEN_P3_GET(val) ((((val) & PORT_P4_PUEN_P3) >> 3) & 0x1)
#define PORT_P4_PUEN_P3_SET(reg,val) (reg) = ((reg & ~PORT_P4_PUEN_P3) | (((val) & 0x1) << 3))
/* Pull Up Device Enable at Port 4 Bit # (2) */
#define PORT_P4_PUEN_P2 (0x1 << 2)
#define PORT_P4_PUEN_P2_VAL(val) (((val) & 0x1) << 2)
#define PORT_P4_PUEN_P2_GET(val) ((((val) & PORT_P4_PUEN_P2) >> 2) & 0x1)
#define PORT_P4_PUEN_P2_SET(reg,val) (reg) = ((reg & ~PORT_P4_PUEN_P2) | (((val) & 0x1) << 2))
/* Pull Up Device Enable at Port 4 Bit # (1) */
#define PORT_P4_PUEN_P1 (0x1 << 1)
#define PORT_P4_PUEN_P1_VAL(val) (((val) & 0x1) << 1)
#define PORT_P4_PUEN_P1_GET(val) ((((val) & PORT_P4_PUEN_P1) >> 1) & 0x1)
#define PORT_P4_PUEN_P1_SET(reg,val) (reg) = ((reg & ~PORT_P4_PUEN_P1) | (((val) & 0x1) << 1))
/* Pull Up Device Enable at Port 4 Bit # (0) */
#define PORT_P4_PUEN_P0 (0x1)
#define PORT_P4_PUEN_P0_VAL(val) (((val) & 0x1) << 0)
#define PORT_P4_PUEN_P0_GET(val) ((((val) & PORT_P4_PUEN_P0) >> 0) & 0x1)
#define PORT_P4_PUEN_P0_SET(reg,val) (reg) = ((reg & ~PORT_P4_PUEN_P0) | (((val) & 0x1) << 0))
#endif /* __PORT_H */
|
// -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*-
// Copyright (c) 2005, Google Inc.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// ---
// Author: Sanjay Ghemawat
//
// Produce stack trace.
//
// There are three different ways we can try to get the stack trace:
//
// 1) Our hand-coded stack-unwinder. This depends on a certain stack
// layout, which is used by gcc (and those systems using a
// gcc-compatible ABI) on x86 systems, at least since gcc 2.95.
// It uses the frame pointer to do its work.
//
// 2) The libunwind library. This is still in development, and as a
// separate library adds a new dependency, abut doesn't need a frame
// pointer. It also doesn't call malloc.
//
// 3) The gdb unwinder -- also the one used by the c++ exception code.
// It's obviously well-tested, but has a fatal flaw: it can call
// malloc() from the unwinder. This is a problem because we're
// trying to use the unwinder to instrument malloc().
//
// Note: if you add a new implementation here, make sure it works
// correctly when GetStackTrace() is called with max_depth == 0.
// Some code may do that.
#include <config.h>
#include <stdlib.h> // for getenv
#include <string.h> // for strcmp
#include <stdio.h> // for fprintf
#include "gperftools/stacktrace.h"
#include "base/commandlineflags.h"
#include "base/googleinit.h"
// we're using plain struct and not class to avoid any possible issues
// during initialization. Struct of pointers is easy to init at
// link-time.
struct GetStackImplementation {
int (*GetStackFramesPtr)(void** result, int* sizes, int max_depth,
int skip_count);
int (*GetStackFramesWithContextPtr)(void** result, int* sizes, int max_depth,
int skip_count, const void *uc);
int (*GetStackTracePtr)(void** result, int max_depth,
int skip_count);
int (*GetStackTraceWithContextPtr)(void** result, int max_depth,
int skip_count, const void *uc);
const char *name;
};
#if HAVE_DECL_BACKTRACE
#define STACKTRACE_INL_HEADER "stacktrace_generic-inl.h"
#define GST_SUFFIX generic
#include "stacktrace_impl_setup-inl.h"
#undef GST_SUFFIX
#undef STACKTRACE_INL_HEADER
#define HAVE_GST_generic
#endif
// libunwind uses __thread so we check for both libunwind.h and
// __thread support
#if defined(HAVE_LIBUNWIND_H) && defined(HAVE_TLS)
#define STACKTRACE_INL_HEADER "stacktrace_libunwind-inl.h"
#define GST_SUFFIX libunwind
#include "stacktrace_impl_setup-inl.h"
#undef GST_SUFFIX
#undef STACKTRACE_INL_HEADER
#define HAVE_GST_libunwind
#endif // HAVE_LIBUNWIND_H
#if defined(__i386__) || defined(__x86_64__)
#define STACKTRACE_INL_HEADER "stacktrace_x86-inl.h"
#define GST_SUFFIX x86
#include "stacktrace_impl_setup-inl.h"
#undef GST_SUFFIX
#undef STACKTRACE_INL_HEADER
#define HAVE_GST_x86
#endif // i386 || x86_64
#if defined(__ppc__) || defined(__PPC__)
#if defined(__linux__)
#define STACKTRACE_INL_HEADER "stacktrace_powerpc-linux-inl.h"
#else
#define STACKTRACE_INL_HEADER "stacktrace_powerpc-darwin-inl.h"
#endif
#define GST_SUFFIX ppc
#include "stacktrace_impl_setup-inl.h"
#undef GST_SUFFIX
#undef STACKTRACE_INL_HEADER
#define HAVE_GST_ppc
#endif
#if defined(__arm__)
#define STACKTRACE_INL_HEADER "stacktrace_arm-inl.h"
#define GST_SUFFIX arm
#include "stacktrace_impl_setup-inl.h"
#undef GST_SUFFIX
#undef STACKTRACE_INL_HEADER
#define HAVE_GST_arm
#endif
#ifdef TCMALLOC_ENABLE_INSTRUMENT_STACKTRACE
#define STACKTRACE_INL_HEADER "stacktrace_instrument-inl.h"
#define GST_SUFFIX instrument
#include "stacktrace_impl_setup-inl.h"
#undef GST_SUFFIX
#undef STACKTRACE_INL_HEADER
#define HAVE_GST_instrument
#endif
// The Windows case -- probably cygwin and mingw will use one of the
// x86-includes above, but if not, we can fall back to windows intrinsics.
#if defined(_WIN32) || defined(__CYGWIN__) || defined(__CYGWIN32__) || defined(__MINGW32__)
#define STACKTRACE_INL_HEADER "stacktrace_win32-inl.h"
#define GST_SUFFIX win32
#include "stacktrace_impl_setup-inl.h"
#undef GST_SUFFIX
#undef STACKTRACE_INL_HEADER
#define HAVE_GST_win32
#endif
static GetStackImplementation *all_impls[] = {
#ifdef HAVE_GST_generic
&impl__generic,
#endif
#ifdef HAVE_GST_libunwind
&impl__libunwind,
#endif
#ifdef HAVE_GST_x86
&impl__x86,
#endif
#ifdef HAVE_GST_arm
&impl__arm,
#endif
#ifdef HAVE_GST_ppc
&impl__ppc,
#endif
#ifdef HAVE_GST_instrument
&impl__instrument,
#endif
#ifdef HAVE_GST_win32
&impl__win32,
#endif
NULL
};
// ppc and i386 implementations prefer arch-specific asm implementations.
// arm's asm implementation is broken
#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__PPC__)
#if !defined(NO_FRAME_POINTER)
#define TCMALLOC_DONT_PREFER_LIBUNWIND
#endif
#endif
#if defined(HAVE_GST_instrument)
static GetStackImplementation *get_stack_impl = &impl__instrument;
#elif defined(HAVE_GST_win32)
static GetStackImplementation *get_stack_impl = &impl__win32;
#elif defined(HAVE_GST_x86) && defined(TCMALLOC_DONT_PREFER_LIBUNWIND)
static GetStackImplementation *get_stack_impl = &impl__x86;
#elif defined(HAVE_GST_ppc) && defined(TCMALLOC_DONT_PREFER_LIBUNWIND)
static GetStackImplementation *get_stack_impl = &impl__ppc;
#elif defined(HAVE_GST_libunwind)
static GetStackImplementation *get_stack_impl = &impl__libunwind;
#elif defined(HAVE_GST_arm)
static GetStackImplementation *get_stack_impl = &impl__arm;
#elif defined(HAVE_GST_generic)
static GetStackImplementation *get_stack_impl = &impl__generic;
#elif 0
// This is for the benefit of code analysis tools that may have
// trouble with the computed #include above.
# include "stacktrace_x86-inl.h"
# include "stacktrace_libunwind-inl.h"
# include "stacktrace_generic-inl.h"
# include "stacktrace_powerpc-inl.h"
# include "stacktrace_win32-inl.h"
# include "stacktrace_arm-inl.h"
# include "stacktrace_instrument-inl.h"
#else
#error Cannot calculate stack trace: will need to write for your environment
#endif
static int ATTRIBUTE_NOINLINE frame_forcer(int rv) {
return rv;
}
PERFTOOLS_DLL_DECL int GetStackFrames(void** result, int* sizes, int max_depth,
int skip_count) {
return frame_forcer(get_stack_impl->GetStackFramesPtr(result, sizes, max_depth, skip_count));
}
PERFTOOLS_DLL_DECL int GetStackFramesWithContext(void** result, int* sizes, int max_depth,
int skip_count, const void *uc) {
return frame_forcer(get_stack_impl->GetStackFramesWithContextPtr(
result, sizes, max_depth,
skip_count, uc));
}
PERFTOOLS_DLL_DECL int GetStackTrace(void** result, int max_depth,
int skip_count) {
return frame_forcer(get_stack_impl->GetStackTracePtr(result, max_depth, skip_count));
}
PERFTOOLS_DLL_DECL int GetStackTraceWithContext(void** result, int max_depth,
int skip_count, const void *uc) {
return frame_forcer(get_stack_impl->GetStackTraceWithContextPtr(
result, max_depth, skip_count, uc));
}
static void init_default_stack_impl_inner(void) {
char *val = getenv("TCMALLOC_STACKTRACE_METHOD");
if (!val || !*val) {
return;
}
for (GetStackImplementation **p = all_impls; *p; p++) {
GetStackImplementation *c = *p;
if (strcmp(c->name, val) == 0) {
get_stack_impl = c;
return;
}
}
fprintf(stderr, "Unknown or unsupported stacktrace method requested: %s. Ignoring it\n", val);
}
static void init_default_stack_impl(void) {
init_default_stack_impl_inner();
if (EnvToBool("TCMALLOC_STACKTRACE_METHOD_VERBOSE", false)) {
fprintf(stderr, "Chosen stacktrace method is %s\nSupported methods:\n", get_stack_impl->name);
for (GetStackImplementation **p = all_impls; *p; p++) {
GetStackImplementation *c = *p;
fprintf(stderr, "* %s\n", c->name);
}
fputs("\n", stderr);
}
}
REGISTER_MODULE_INITIALIZER(stacktrace_init_default_stack_impl, init_default_stack_impl());
|
#!/usr/local/bin/perl
# Normal is the
# md5_block_x86(MD5_CTX *c, ULONG *X);
# version, non-normal is the
# md5_block_x86(MD5_CTX *c, ULONG *X,int blocks);
$normal=0;
push(@INC,"perlasm","../../perlasm");
require "x86asm.pl";
&asm_init($ARGV[0],$0);
$A="eax";
$B="ebx";
$C="ecx";
$D="edx";
$tmp1="edi";
$tmp2="ebp";
$X="esi";
# What we need to load into $tmp for the next round
%Ltmp1=("R0",&Np($C), "R1",&Np($C), "R2",&Np($C), "R3",&Np($D));
@xo=(
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, # R0
1, 6, 11, 0, 5, 10, 15, 4, 9, 14, 3, 8, 13, 2, 7, 12, # R1
5, 8, 11, 14, 1, 4, 7, 10, 13, 0, 3, 6, 9, 12, 15, 2, # R2
0, 7, 14, 5, 12, 3, 10, 1, 8, 15, 6, 13, 4, 11, 2, 9, # R3
);
&md5_block("md5_block_asm_data_order");
&asm_finish();
sub Np
{
local($p)=@_;
local(%n)=($A,$D,$B,$A,$C,$B,$D,$C);
return($n{$p});
}
sub R0
{
local($pos,$a,$b,$c,$d,$K,$ki,$s,$t)=@_;
&mov($tmp1,$C) if $pos < 0;
&mov($tmp2,&DWP($xo[$ki]*4,$K,"",0)) if $pos < 0; # very first one
# body proper
&comment("R0 $ki");
&xor($tmp1,$d); # F function - part 2
&and($tmp1,$b); # F function - part 3
&lea($a,&DWP($t,$a,$tmp2,1));
&xor($tmp1,$d); # F function - part 4
&add($a,$tmp1);
&mov($tmp1,&Np($c)) if $pos < 1; # next tmp1 for R0
&mov($tmp1,&Np($c)) if $pos == 1; # next tmp1 for R1
&rotl($a,$s);
&mov($tmp2,&DWP($xo[$ki+1]*4,$K,"",0)) if ($pos != 2);
&add($a,$b);
}
sub R1
{
local($pos,$a,$b,$c,$d,$K,$ki,$s,$t)=@_;
&comment("R1 $ki");
&lea($a,&DWP($t,$a,$tmp2,1));
&xor($tmp1,$b); # G function - part 2
&and($tmp1,$d); # G function - part 3
&mov($tmp2,&DWP($xo[$ki+1]*4,$K,"",0)) if ($pos != 2);
&xor($tmp1,$c); # G function - part 4
&add($a,$tmp1);
&mov($tmp1,&Np($c)) if $pos < 1; # G function - part 1
&mov($tmp1,&Np($c)) if $pos == 1; # G function - part 1
&rotl($a,$s);
&add($a,$b);
}
sub R2
{
local($n,$pos,$a,$b,$c,$d,$K,$ki,$s,$t)=@_;
# This one is different, only 3 logical operations
if (($n & 1) == 0)
{
&comment("R2 $ki");
# make sure to do 'D' first, not 'B', else we clash with
# the last add from the previous round.
&xor($tmp1,$d); # H function - part 2
&xor($tmp1,$b); # H function - part 3
&lea($a,&DWP($t,$a,$tmp2,1));
&add($a,$tmp1);
&rotl($a,$s);
&mov($tmp2,&DWP($xo[$ki+1]*4,$K,"",0));
&mov($tmp1,&Np($c));
}
else
{
&comment("R2 $ki");
# make sure to do 'D' first, not 'B', else we clash with
# the last add from the previous round.
&lea($a,&DWP($t,$a,$tmp2,1));
&add($b,$c); # MOVED FORWARD
&xor($tmp1,$d); # H function - part 2
&xor($tmp1,$b); # H function - part 3
&mov($tmp2,&DWP($xo[$ki+1]*4,$K,"",0)) if ($pos != 2);
&add($a,$tmp1);
&mov($tmp1,&Np($c)) if $pos < 1; # H function - part 1
&mov($tmp1,-1) if $pos == 1; # I function - part 1
&rotl($a,$s);
&add($a,$b);
}
}
sub R3
{
local($pos,$a,$b,$c,$d,$K,$ki,$s,$t)=@_;
&comment("R3 $ki");
# ¬($tmp1)
&xor($tmp1,$d) if $pos < 0; # I function - part 2
&or($tmp1,$b); # I function - part 3
&lea($a,&DWP($t,$a,$tmp2,1));
&xor($tmp1,$c); # I function - part 4
&mov($tmp2,&DWP($xo[$ki+1]*4,$K,"",0)) if $pos != 2; # load X/k value
&mov($tmp2,&wparam(0)) if $pos == 2;
&add($a,$tmp1);
&mov($tmp1,-1) if $pos < 1; # H function - part 1
&add($K,64) if $pos >=1 && !$normal;
&rotl($a,$s);
&xor($tmp1,&Np($d)) if $pos <= 0; # I function - part = first time
&mov($tmp1,&DWP( 0,$tmp2,"",0)) if $pos > 0;
&add($a,$b);
}
sub md5_block
{
local($name)=@_;
&function_begin_B($name,"",3);
# parameter 1 is the MD5_CTX structure.
# A 0
# B 4
# C 8
# D 12
&push("esi");
&push("edi");
&mov($tmp1, &wparam(0)); # edi
&mov($X, &wparam(1)); # esi
&mov($C, &wparam(2));
&push("ebp");
&shl($C, 6);
&push("ebx");
&add($C, $X); # offset we end at
&sub($C, 64);
&mov($A, &DWP( 0,$tmp1,"",0));
&push($C); # Put on the TOS
&mov($B, &DWP( 4,$tmp1,"",0));
&mov($C, &DWP( 8,$tmp1,"",0));
&mov($D, &DWP(12,$tmp1,"",0));
&set_label("start") unless $normal;
&comment("");
&comment("R0 section");
&R0(-2,$A,$B,$C,$D,$X, 0, 7,0xd76aa478);
&R0( 0,$D,$A,$B,$C,$X, 1,12,0xe8c7b756);
&R0( 0,$C,$D,$A,$B,$X, 2,17,0x242070db);
&R0( 0,$B,$C,$D,$A,$X, 3,22,0xc1bdceee);
&R0( 0,$A,$B,$C,$D,$X, 4, 7,0xf57c0faf);
&R0( 0,$D,$A,$B,$C,$X, 5,12,0x4787c62a);
&R0( 0,$C,$D,$A,$B,$X, 6,17,0xa8304613);
&R0( 0,$B,$C,$D,$A,$X, 7,22,0xfd469501);
&R0( 0,$A,$B,$C,$D,$X, 8, 7,0x698098d8);
&R0( 0,$D,$A,$B,$C,$X, 9,12,0x8b44f7af);
&R0( 0,$C,$D,$A,$B,$X,10,17,0xffff5bb1);
&R0( 0,$B,$C,$D,$A,$X,11,22,0x895cd7be);
&R0( 0,$A,$B,$C,$D,$X,12, 7,0x6b901122);
&R0( 0,$D,$A,$B,$C,$X,13,12,0xfd987193);
&R0( 0,$C,$D,$A,$B,$X,14,17,0xa679438e);
&R0( 1,$B,$C,$D,$A,$X,15,22,0x49b40821);
&comment("");
&comment("R1 section");
&R1(-1,$A,$B,$C,$D,$X,16, 5,0xf61e2562);
&R1( 0,$D,$A,$B,$C,$X,17, 9,0xc040b340);
&R1( 0,$C,$D,$A,$B,$X,18,14,0x265e5a51);
&R1( 0,$B,$C,$D,$A,$X,19,20,0xe9b6c7aa);
&R1( 0,$A,$B,$C,$D,$X,20, 5,0xd62f105d);
&R1( 0,$D,$A,$B,$C,$X,21, 9,0x02441453);
&R1( 0,$C,$D,$A,$B,$X,22,14,0xd8a1e681);
&R1( 0,$B,$C,$D,$A,$X,23,20,0xe7d3fbc8);
&R1( 0,$A,$B,$C,$D,$X,24, 5,0x21e1cde6);
&R1( 0,$D,$A,$B,$C,$X,25, 9,0xc33707d6);
&R1( 0,$C,$D,$A,$B,$X,26,14,0xf4d50d87);
&R1( 0,$B,$C,$D,$A,$X,27,20,0x455a14ed);
&R1( 0,$A,$B,$C,$D,$X,28, 5,0xa9e3e905);
&R1( 0,$D,$A,$B,$C,$X,29, 9,0xfcefa3f8);
&R1( 0,$C,$D,$A,$B,$X,30,14,0x676f02d9);
&R1( 1,$B,$C,$D,$A,$X,31,20,0x8d2a4c8a);
&comment("");
&comment("R2 section");
&R2( 0,-1,$A,$B,$C,$D,$X,32, 4,0xfffa3942);
&R2( 1, 0,$D,$A,$B,$C,$X,33,11,0x8771f681);
&R2( 2, 0,$C,$D,$A,$B,$X,34,16,0x6d9d6122);
&R2( 3, 0,$B,$C,$D,$A,$X,35,23,0xfde5380c);
&R2( 4, 0,$A,$B,$C,$D,$X,36, 4,0xa4beea44);
&R2( 5, 0,$D,$A,$B,$C,$X,37,11,0x4bdecfa9);
&R2( 6, 0,$C,$D,$A,$B,$X,38,16,0xf6bb4b60);
&R2( 7, 0,$B,$C,$D,$A,$X,39,23,0xbebfbc70);
&R2( 8, 0,$A,$B,$C,$D,$X,40, 4,0x289b7ec6);
&R2( 9, 0,$D,$A,$B,$C,$X,41,11,0xeaa127fa);
&R2(10, 0,$C,$D,$A,$B,$X,42,16,0xd4ef3085);
&R2(11, 0,$B,$C,$D,$A,$X,43,23,0x04881d05);
&R2(12, 0,$A,$B,$C,$D,$X,44, 4,0xd9d4d039);
&R2(13, 0,$D,$A,$B,$C,$X,45,11,0xe6db99e5);
&R2(14, 0,$C,$D,$A,$B,$X,46,16,0x1fa27cf8);
&R2(15, 1,$B,$C,$D,$A,$X,47,23,0xc4ac5665);
&comment("");
&comment("R3 section");
&R3(-1,$A,$B,$C,$D,$X,48, 6,0xf4292244);
&R3( 0,$D,$A,$B,$C,$X,49,10,0x432aff97);
&R3( 0,$C,$D,$A,$B,$X,50,15,0xab9423a7);
&R3( 0,$B,$C,$D,$A,$X,51,21,0xfc93a039);
&R3( 0,$A,$B,$C,$D,$X,52, 6,0x655b59c3);
&R3( 0,$D,$A,$B,$C,$X,53,10,0x8f0ccc92);
&R3( 0,$C,$D,$A,$B,$X,54,15,0xffeff47d);
&R3( 0,$B,$C,$D,$A,$X,55,21,0x85845dd1);
&R3( 0,$A,$B,$C,$D,$X,56, 6,0x6fa87e4f);
&R3( 0,$D,$A,$B,$C,$X,57,10,0xfe2ce6e0);
&R3( 0,$C,$D,$A,$B,$X,58,15,0xa3014314);
&R3( 0,$B,$C,$D,$A,$X,59,21,0x4e0811a1);
&R3( 0,$A,$B,$C,$D,$X,60, 6,0xf7537e82);
&R3( 0,$D,$A,$B,$C,$X,61,10,0xbd3af235);
&R3( 0,$C,$D,$A,$B,$X,62,15,0x2ad7d2bb);
&R3( 2,$B,$C,$D,$A,$X,63,21,0xeb86d391);
# &mov($tmp2,&wparam(0)); # done in the last R3
# &mov($tmp1, &DWP( 0,$tmp2,"",0)); # done is the last R3
&add($A,$tmp1);
&mov($tmp1, &DWP( 4,$tmp2,"",0));
&add($B,$tmp1);
&mov($tmp1, &DWP( 8,$tmp2,"",0));
&add($C,$tmp1);
&mov($tmp1, &DWP(12,$tmp2,"",0));
&add($D,$tmp1);
&mov(&DWP( 0,$tmp2,"",0),$A);
&mov(&DWP( 4,$tmp2,"",0),$B);
&mov($tmp1,&swtmp(0)) unless $normal;
&mov(&DWP( 8,$tmp2,"",0),$C);
&mov(&DWP(12,$tmp2,"",0),$D);
&cmp($tmp1,$X) unless $normal; # check count
&jae(&label("start")) unless $normal;
&pop("eax"); # pop the temp variable off the stack
&pop("ebx");
&pop("ebp");
&pop("edi");
&pop("esi");
&ret();
&function_end_B($name);
}
|
<?php
/**
* @file
* Contains \Drupal\Tests\Core\DependencyInjection\Compiler\StackedKernelPassTest.
*/
namespace Drupal\Tests\Core\DependencyInjection\Compiler;
use Drupal\Core\DependencyInjection\Compiler\StackedKernelPass;
use Drupal\Core\DependencyInjection\ContainerBuilder;
use Drupal\Tests\UnitTestCase;
use Symfony\Component\DependencyInjection\Definition;
/**
* @coversDefaultClass \Drupal\Core\DependencyInjection\Compiler\StackedKernelPass
* @group DependencyInjection
*/
class StackedKernelPassTest extends UnitTestCase {
/**
* The stacked kernel pass.
*
* @var \Drupal\Core\DependencyInjection\Compiler\StackedKernelPass
*/
protected $stackedKernelPass;
/**
* @var \Drupal\Core\DependencyInjection\Container
*/
protected $containerBuilder;
/**
* {@inheritdoc}
*/
public function setUp() {
$this->stackedKernelPass = new StackedKernelPass();
$this->containerBuilder = new ContainerBuilder();
}
/**
* @covers ::process
*/
public function testProcessWithStackedKernel() {
$stacked_kernel = new Definition('Stack\StackedHttpKernel');
$this->containerBuilder->setDefinition('http_kernel', $stacked_kernel);
$this->containerBuilder->setDefinition('http_kernel.basic', $this->createMiddlewareServiceDefinition(FALSE, 0));
$this->containerBuilder->setDefinition('http_kernel.three', $this->createMiddlewareServiceDefinition());
$this->containerBuilder->setDefinition('http_kernel.one', $this->createMiddlewareServiceDefinition(TRUE, 10));
$this->containerBuilder->setDefinition('http_kernel.two', $this->createMiddlewareServiceDefinition(TRUE, 5));
$this->stackedKernelPass->process($this->containerBuilder);
$stacked_kernel_args = $this->containerBuilder->getDefinition('http_kernel')->getArguments();
// Check the stacked kernel args.
$this->assertSame((string) $stacked_kernel_args[0], 'http_kernel.one');
$this->assertCount(4, $stacked_kernel_args[1]);
$this->assertSame((string) $stacked_kernel_args[1][0], 'http_kernel.one');
$this->assertSame((string) $stacked_kernel_args[1][1], 'http_kernel.two');
$this->assertSame((string) $stacked_kernel_args[1][2], 'http_kernel.three');
$this->assertSame((string) $stacked_kernel_args[1][3], 'http_kernel.basic');
// Check the modified definitions.
$definition = $this->containerBuilder->getDefinition('http_kernel.one');
$args = $definition->getArguments();
$this->assertSame('http_kernel.two', (string) $args[0]);
$this->assertSame('test', $args[1]);
$definition = $this->containerBuilder->getDefinition('http_kernel.two');
$args = $definition->getArguments();
$this->assertSame('http_kernel.three', (string) $args[0]);
$this->assertSame('test', $args[1]);
$definition = $this->containerBuilder->getDefinition('http_kernel.three');
$args = $definition->getArguments();
$this->assertSame('http_kernel.basic', (string) $args[0]);
$this->assertSame('test', $args[1]);
}
/**
* @covers ::process
*/
public function testProcessWithHttpKernel() {
$kernel = new Definition('Symfony\Component\HttpKernel\HttpKernelInterface');
$this->containerBuilder->setDefinition('http_kernel', $kernel);
$this->stackedKernelPass->process($this->containerBuilder);
$unprocessed_kernel = $this->containerBuilder->getDefinition('http_kernel');
$this->assertSame($kernel, $unprocessed_kernel);
$this->assertSame($kernel->getArguments(), $unprocessed_kernel->getArguments());
}
/**
* Creates a middleware definition.
*
* @param bool $tag
* Whether ot not to set the http_middleware tag.
* @param int $priority
* The priority to be used for the tag.
*
* @return \Symfony\Component\DependencyInjection\Definition
*/
protected function createMiddlewareServiceDefinition($tag = TRUE, $priority = 0) {
$definition = new Definition('Symfony\Component\HttpKernel\HttpKernelInterface', ['test']);
if ($tag) {
$definition->addTag('http_middleware', ['priority' => $priority]);
}
return $definition;
}
}
|
<!doctype html>
<html lang="en">
<head>
<title>jQuery UI Resizable - Snap to grid</title>
<link type="text/css" href="../../themes/base/ui.all.css" rel="stylesheet" />
<script type="text/javascript" src="../../jquery-1.3.2.js"></script>
<script type="text/javascript" src="../../ui/ui.core.js"></script>
<script type="text/javascript" src="../../ui/ui.resizable.js"></script>
<link type="text/css" href="../demos.css" rel="stylesheet" />
<style type="text/css">
#resizable { width: 150px; height: 150px; padding: 0.5em; }
#resizable h3 { text-align: center; margin: 0; }
</style>
<script type="text/javascript">
$(function() {
$("#resizable").resizable({
grid: 50
});
});
</script>
</head>
<body>
<div class="demo">
<div id="resizable" class="ui-widget-content">
<h3 class="ui-widget-header">Grid</h3>
</div>
</div><!-- End demo -->
<div class="demo-description">
<p>Snap the resizable element to a grid. Set the dimensions of grid cells (height and width in pixels) with the <code>grid</code> option.</p>
</div><!-- End demo-description -->
</body>
</html>
|
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Bridge\Monolog\Tests\Processor;
use Monolog\Logger;
use Symfony\Bridge\Monolog\Processor\WebProcessor;
use Symfony\Component\HttpFoundation\Request;
class WebProcessorTest extends \PHPUnit_Framework_TestCase
{
public function testUsesRequestServerData()
{
$server = array(
'REQUEST_URI' => 'A',
'REMOTE_ADDR' => 'B',
'REQUEST_METHOD' => 'C',
'SERVER_NAME' => 'D',
'HTTP_REFERER' => 'E'
);
$request = new Request();
$request->server->replace($server);
$event = $this->getMockBuilder('Symfony\Component\HttpKernel\Event\GetResponseEvent')
->disableOriginalConstructor()
->getMock();
$event->expects($this->any())
->method('isMasterRequest')
->will($this->returnValue(true));
$event->expects($this->any())
->method('getRequest')
->will($this->returnValue($request));
$processor = new WebProcessor();
$processor->onKernelRequest($event);
$record = $processor($this->getRecord());
$this->assertEquals($server['REQUEST_URI'], $record['extra']['url']);
$this->assertEquals($server['REMOTE_ADDR'], $record['extra']['ip']);
$this->assertEquals($server['REQUEST_METHOD'], $record['extra']['http_method']);
$this->assertEquals($server['SERVER_NAME'], $record['extra']['server']);
$this->assertEquals($server['HTTP_REFERER'], $record['extra']['referrer']);
}
/**
* @param integer $level
* @param string $message
*
* @return array Record
*/
protected function getRecord($level = Logger::WARNING, $message = 'test')
{
return array(
'message' => $message,
'context' => array(),
'level' => $level,
'level_name' => Logger::getLevelName($level),
'channel' => 'test',
'datetime' => new \DateTime(),
'extra' => array(),
);
}
}
|
/* sound/soc/samsung/s3c2412-i2s.c
*
* ALSA Soc Audio Layer - S3C2412 I2S driver
*
* Copyright (c) 2006 Wolfson Microelectronics PLC.
* Graeme Gregory graeme.gregory@wolfsonmicro.com
* linux@wolfsonmicro.com
*
* Copyright (c) 2007, 2004-2005 Simtec Electronics
* http://armlinux.simtec.co.uk/
* Ben Dooks <ben@simtec.co.uk>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*/
#include <linux/delay.h>
#include <linux/gpio.h>
#include <linux/clk.h>
#include <linux/io.h>
#include <linux/module.h>
#include <sound/soc.h>
#include <sound/pcm_params.h>
#include <mach/dma.h>
#include "dma.h"
#include "regs-i2s-v2.h"
#include "s3c2412-i2s.h"
static struct s3c2410_dma_client s3c2412_dma_client_out = {
.name = "I2S PCM Stereo out"
};
static struct s3c2410_dma_client s3c2412_dma_client_in = {
.name = "I2S PCM Stereo in"
};
static struct s3c_dma_params s3c2412_i2s_pcm_stereo_out = {
.client = &s3c2412_dma_client_out,
.channel = DMACH_I2S_OUT,
.dma_addr = S3C2410_PA_IIS + S3C2412_IISTXD,
.dma_size = 4,
};
static struct s3c_dma_params s3c2412_i2s_pcm_stereo_in = {
.client = &s3c2412_dma_client_in,
.channel = DMACH_I2S_IN,
.dma_addr = S3C2410_PA_IIS + S3C2412_IISRXD,
.dma_size = 4,
};
static struct s3c_i2sv2_info s3c2412_i2s;
static int s3c2412_i2s_probe(struct snd_soc_dai *dai)
{
int ret;
pr_debug("Entered %s\n", __func__);
ret = s3c_i2sv2_probe(dai, &s3c2412_i2s, S3C2410_PA_IIS);
if (ret)
return ret;
s3c2412_i2s.dma_capture = &s3c2412_i2s_pcm_stereo_in;
s3c2412_i2s.dma_playback = &s3c2412_i2s_pcm_stereo_out;
s3c2412_i2s.iis_cclk = clk_get(dai->dev, "i2sclk");
if (IS_ERR(s3c2412_i2s.iis_cclk)) {
pr_err("failed to get i2sclk clock\n");
iounmap(s3c2412_i2s.regs);
return PTR_ERR(s3c2412_i2s.iis_cclk);
}
/* Set MPLL as the source for IIS CLK */
clk_set_parent(s3c2412_i2s.iis_cclk, clk_get(NULL, "mpll"));
clk_enable(s3c2412_i2s.iis_cclk);
s3c2412_i2s.iis_cclk = s3c2412_i2s.iis_pclk;
/* Configure the I2S pins (GPE0...GPE4) in correct mode */
s3c_gpio_cfgall_range(S3C2410_GPE(0), 5, S3C_GPIO_SFN(2),
S3C_GPIO_PULL_NONE);
return 0;
}
static int s3c2412_i2s_remove(struct snd_soc_dai *dai)
{
clk_disable(s3c2412_i2s.iis_cclk);
clk_put(s3c2412_i2s.iis_cclk);
iounmap(s3c2412_i2s.regs);
return 0;
}
static int s3c2412_i2s_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params,
struct snd_soc_dai *cpu_dai)
{
struct s3c_i2sv2_info *i2s = snd_soc_dai_get_drvdata(cpu_dai);
struct s3c_dma_params *dma_data;
u32 iismod;
pr_debug("Entered %s\n", __func__);
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
dma_data = i2s->dma_playback;
else
dma_data = i2s->dma_capture;
snd_soc_dai_set_dma_data(cpu_dai, substream, dma_data);
iismod = readl(i2s->regs + S3C2412_IISMOD);
pr_debug("%s: r: IISMOD: %x\n", __func__, iismod);
switch (params_format(params)) {
case SNDRV_PCM_FORMAT_S8:
iismod |= S3C2412_IISMOD_8BIT;
break;
case SNDRV_PCM_FORMAT_S16_LE:
iismod &= ~S3C2412_IISMOD_8BIT;
break;
}
writel(iismod, i2s->regs + S3C2412_IISMOD);
pr_debug("%s: w: IISMOD: %x\n", __func__, iismod);
return 0;
}
#define S3C2412_I2S_RATES \
(SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_11025 | SNDRV_PCM_RATE_16000 | \
SNDRV_PCM_RATE_22050 | SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 | \
SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_88200 | SNDRV_PCM_RATE_96000)
static const struct snd_soc_dai_ops s3c2412_i2s_dai_ops = {
.hw_params = s3c2412_i2s_hw_params,
};
static struct snd_soc_dai_driver s3c2412_i2s_dai = {
.probe = s3c2412_i2s_probe,
.remove = s3c2412_i2s_remove,
.playback = {
.channels_min = 2,
.channels_max = 2,
.rates = S3C2412_I2S_RATES,
.formats = SNDRV_PCM_FMTBIT_S8 | SNDRV_PCM_FMTBIT_S16_LE,
},
.capture = {
.channels_min = 2,
.channels_max = 2,
.rates = S3C2412_I2S_RATES,
.formats = SNDRV_PCM_FMTBIT_S8 | SNDRV_PCM_FMTBIT_S16_LE,
},
.ops = &s3c2412_i2s_dai_ops,
};
static const struct snd_soc_component_driver s3c2412_i2s_component = {
.name = "s3c2412-i2s",
};
static int s3c2412_iis_dev_probe(struct platform_device *pdev)
{
int ret = 0;
ret = s3c_i2sv2_register_component(&pdev->dev, -1,
&s3c2412_i2s_component,
&s3c2412_i2s_dai);
if (ret) {
pr_err("failed to register the dai\n");
return ret;
}
ret = asoc_dma_platform_register(&pdev->dev);
if (ret) {
pr_err("failed to register the DMA: %d\n", ret);
goto err;
}
return 0;
err:
snd_soc_unregister_component(&pdev->dev);
return ret;
}
static int s3c2412_iis_dev_remove(struct platform_device *pdev)
{
asoc_dma_platform_unregister(&pdev->dev);
snd_soc_unregister_component(&pdev->dev);
return 0;
}
static struct platform_driver s3c2412_iis_driver = {
.probe = s3c2412_iis_dev_probe,
.remove = s3c2412_iis_dev_remove,
.driver = {
.name = "s3c2412-iis",
.owner = THIS_MODULE,
},
};
module_platform_driver(s3c2412_iis_driver);
/* Module information */
MODULE_AUTHOR("Ben Dooks, <ben@simtec.co.uk>");
MODULE_DESCRIPTION("S3C2412 I2S SoC Interface");
MODULE_LICENSE("GPL");
MODULE_ALIAS("platform:s3c2412-iis");
|
//*********************************************************
//
// Copyright (c) Microsoft. All rights reserved.
// This code is licensed under the MIT License (MIT).
// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
//
//*********************************************************
#pragma once
// GameInfoOverlay:
// This class maintains a D2D1 Bitmap surface to provide information to the player
// on the state of the game when the game is not in active play.
// This class has several different status modes:
// GameLoading - this displays a title and a series of dots to show progress.
// GameStats - this displays a title and the Max level achieved, the hit and shot counts.
// GameOver - this displays a title and the game status.
// Pause - this displays only a title - 'Paused'.
// In addition to the status modes, there is a region at the bottom that displays what the
// player is expected to do next. This can be one of four things:
// None - the action is blank. This is usually set when the game does not currently have focus.
// TapToContinue - the game is waiting for the player to provide input that they are ready to
// proceed.
// PleaseWait - the game is actively doing some background processing (like loading a level).
// PlayAgain - the game has completed and is waiting for the player to indicate they are ready
// to play another round of the game.
#include "GameUIControl.h"
ref class GameInfoOverlay : public Simple3DGameDX::IGameUIControl
{
internal:
GameInfoOverlay(const std::shared_ptr<DX::DeviceResources>& deviceResources);
void CreateDeviceDependentResources();
void CreateWindowSizeDependentResources(D2D_SIZE_F overlaySize);
void ReleaseDeviceDependentResources();
bool Visible() { return m_visible; };
ID2D1Bitmap1* Bitmap();
public:
// IGameUIControl interface
virtual void SetGameLoading(uint32 dots);
virtual void SetGameStats(int maxLevel, int hitCount, int shotCount);
virtual void SetGameOver(bool win, int maxLevel, int hitCount, int shotCount, int highScore);
virtual void SetLevelStart(int level, Platform::String^ objective, float timeLimit, float bonusTime);
virtual void SetPause(int level, int hitCount, int shotCount, float timeRemaining);
virtual void SetAction(Simple3DGameDX::GameInfoOverlayCommand action);
virtual void HideGameInfoOverlay() { m_visible = false; };
virtual void ShowGameInfoOverlay() { m_visible = true; };
virtual void ShowTooSmall();
virtual void HideTooSmall();
private:
// Cached pointer to device resources.
std::shared_ptr<DX::DeviceResources> m_deviceResources;
bool m_visible;
bool m_tooSmallActive;
D2D1_RECT_F m_titleRectangle;
D2D1_RECT_F m_bodyRectangle;
D2D1_RECT_F m_actionRectangle;
Microsoft::WRL::ComPtr<ID2D1Bitmap1> m_levelBitmap;
Microsoft::WRL::ComPtr<ID2D1Bitmap1> m_tooSmallBitmap;
Microsoft::WRL::ComPtr<IDWriteTextFormat> m_textFormatTitle;
Microsoft::WRL::ComPtr<IDWriteTextFormat> m_textFormatBody;
Microsoft::WRL::ComPtr<ID2D1SolidColorBrush> m_textBrush;
Microsoft::WRL::ComPtr<ID2D1SolidColorBrush> m_backgroundBrush;
Microsoft::WRL::ComPtr<ID2D1SolidColorBrush> m_actionBrush;
Platform::String^ m_titleString;
Platform::String^ m_bodyString;
Platform::String^ m_actionString;
};
|
var assert = require('assert')
var UINT32 = require('..').UINT32
describe('and method', function () {
describe('0&1', function () {
it('should return 0', function (done) {
var u = UINT32(0).and( UINT32(1) )
assert.equal( u.toNumber(), 0 )
done()
})
})
describe('1&2', function () {
it('should return 0', function (done) {
var u = UINT32(1).and( UINT32(2) )
assert.equal( u.toNumber(), 0 )
done()
})
})
describe('1&2^16', function () {
it('should return 0', function (done) {
var n = Math.pow(2, 16)
var u = UINT32(1).and( UINT32(n) )
assert.equal( u.toNumber(), 0 )
done()
})
})
describe('2^16&1', function () {
it('should return 0', function (done) {
var n = Math.pow(2, 16)
var u = UINT32(n).and( UINT32(1) )
assert.equal( u.toNumber(), 0 )
done()
})
})
describe('2^16&2^16', function () {
it('should return n', function (done) {
var n = Math.pow(2, 16)
var u = UINT32(n).and( UINT32(n) )
assert.equal( u.toNumber(), n )
done()
})
})
})
|
// SPDX-License-Identifier: GPL-2.0
//
// Copyright 2003-2008 Simtec Electronics
// Ben Dooks <ben@simtec.co.uk>
//
// http://www.simtec.co.uk/products/EB2410ITX/
#include <linux/kernel.h>
#include <linux/types.h>
#include <linux/interrupt.h>
#include <linux/list.h>
#include <linux/timer.h>
#include <linux/init.h>
#include <linux/gpio.h>
#include <linux/syscore_ops.h>
#include <linux/serial_core.h>
#include <linux/serial_s3c.h>
#include <linux/platform_device.h>
#include <linux/dm9000.h>
#include <linux/ata_platform.h>
#include <linux/i2c.h>
#include <linux/io.h>
#include <linux/serial_8250.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/rawnand.h>
#include <linux/mtd/nand-ecc-sw-hamming.h>
#include <linux/mtd/partitions.h>
#include <linux/platform_data/asoc-s3c24xx_simtec.h>
#include <linux/platform_data/hwmon-s3c.h>
#include <linux/platform_data/i2c-s3c2410.h>
#include <linux/platform_data/mtd-nand-s3c2410.h>
#include <net/ax88796.h>
#include <asm/irq.h>
#include <asm/mach/arch.h>
#include <asm/mach/map.h>
#include <asm/mach/irq.h>
#include <asm/mach-types.h>
#include <linux/platform_data/fb-s3c2410.h>
#include "regs-gpio.h"
#include "gpio-samsung.h"
#include "cpu.h"
#include <linux/soc/samsung/s3c-cpu-freq.h>
#include "devs.h"
#include "gpio-cfg.h"
#include "bast.h"
#include "s3c24xx.h"
#include "simtec.h"
#define COPYRIGHT ", Copyright 2004-2008 Simtec Electronics"
/* macros for virtual address mods for the io space entries */
#define VA_C5(item) ((unsigned long)(item) + BAST_VAM_CS5)
#define VA_C4(item) ((unsigned long)(item) + BAST_VAM_CS4)
#define VA_C3(item) ((unsigned long)(item) + BAST_VAM_CS3)
#define VA_C2(item) ((unsigned long)(item) + BAST_VAM_CS2)
/* macros to modify the physical addresses for io space */
#define PA_CS2(item) (__phys_to_pfn((item) + S3C2410_CS2))
#define PA_CS3(item) (__phys_to_pfn((item) + S3C2410_CS3))
#define PA_CS4(item) (__phys_to_pfn((item) + S3C2410_CS4))
#define PA_CS5(item) (__phys_to_pfn((item) + S3C2410_CS5))
static struct map_desc bast_iodesc[] __initdata = {
/* ISA IO areas */
{
.virtual = (u32)S3C24XX_VA_ISA_BYTE,
.pfn = PA_CS2(BAST_PA_ISAIO),
.length = SZ_16M,
.type = MT_DEVICE,
}, {
.virtual = (u32)S3C24XX_VA_ISA_WORD,
.pfn = PA_CS3(BAST_PA_ISAIO),
.length = SZ_16M,
.type = MT_DEVICE,
},
/* bast CPLD control registers, and external interrupt controls */
{
.virtual = (u32)BAST_VA_CTRL1,
.pfn = __phys_to_pfn(BAST_PA_CTRL1),
.length = SZ_1M,
.type = MT_DEVICE,
}, {
.virtual = (u32)BAST_VA_CTRL2,
.pfn = __phys_to_pfn(BAST_PA_CTRL2),
.length = SZ_1M,
.type = MT_DEVICE,
}, {
.virtual = (u32)BAST_VA_CTRL3,
.pfn = __phys_to_pfn(BAST_PA_CTRL3),
.length = SZ_1M,
.type = MT_DEVICE,
}, {
.virtual = (u32)BAST_VA_CTRL4,
.pfn = __phys_to_pfn(BAST_PA_CTRL4),
.length = SZ_1M,
.type = MT_DEVICE,
},
/* PC104 IRQ mux */
{
.virtual = (u32)BAST_VA_PC104_IRQREQ,
.pfn = __phys_to_pfn(BAST_PA_PC104_IRQREQ),
.length = SZ_1M,
.type = MT_DEVICE,
}, {
.virtual = (u32)BAST_VA_PC104_IRQRAW,
.pfn = __phys_to_pfn(BAST_PA_PC104_IRQRAW),
.length = SZ_1M,
.type = MT_DEVICE,
}, {
.virtual = (u32)BAST_VA_PC104_IRQMASK,
.pfn = __phys_to_pfn(BAST_PA_PC104_IRQMASK),
.length = SZ_1M,
.type = MT_DEVICE,
},
/* peripheral space... one for each of fast/slow/byte/16bit */
/* note, ide is only decoded in word space, even though some registers
* are only 8bit */
/* slow, byte */
{ VA_C2(BAST_VA_ISAIO), PA_CS2(BAST_PA_ISAIO), SZ_16M, MT_DEVICE },
{ VA_C2(BAST_VA_ISAMEM), PA_CS2(BAST_PA_ISAMEM), SZ_16M, MT_DEVICE },
{ VA_C2(BAST_VA_SUPERIO), PA_CS2(BAST_PA_SUPERIO), SZ_1M, MT_DEVICE },
/* slow, word */
{ VA_C3(BAST_VA_ISAIO), PA_CS3(BAST_PA_ISAIO), SZ_16M, MT_DEVICE },
{ VA_C3(BAST_VA_ISAMEM), PA_CS3(BAST_PA_ISAMEM), SZ_16M, MT_DEVICE },
{ VA_C3(BAST_VA_SUPERIO), PA_CS3(BAST_PA_SUPERIO), SZ_1M, MT_DEVICE },
/* fast, byte */
{ VA_C4(BAST_VA_ISAIO), PA_CS4(BAST_PA_ISAIO), SZ_16M, MT_DEVICE },
{ VA_C4(BAST_VA_ISAMEM), PA_CS4(BAST_PA_ISAMEM), SZ_16M, MT_DEVICE },
{ VA_C4(BAST_VA_SUPERIO), PA_CS4(BAST_PA_SUPERIO), SZ_1M, MT_DEVICE },
/* fast, word */
{ VA_C5(BAST_VA_ISAIO), PA_CS5(BAST_PA_ISAIO), SZ_16M, MT_DEVICE },
{ VA_C5(BAST_VA_ISAMEM), PA_CS5(BAST_PA_ISAMEM), SZ_16M, MT_DEVICE },
{ VA_C5(BAST_VA_SUPERIO), PA_CS5(BAST_PA_SUPERIO), SZ_1M, MT_DEVICE },
};
#define UCON S3C2410_UCON_DEFAULT | S3C2410_UCON_UCLK
#define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB
#define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE
static struct s3c2410_uartcfg bast_uartcfgs[] __initdata = {
[0] = {
.hwport = 0,
.flags = 0,
.ucon = UCON,
.ulcon = ULCON,
.ufcon = UFCON,
},
[1] = {
.hwport = 1,
.flags = 0,
.ucon = UCON,
.ulcon = ULCON,
.ufcon = UFCON,
},
/* port 2 is not actually used */
[2] = {
.hwport = 2,
.flags = 0,
.ucon = UCON,
.ulcon = ULCON,
.ufcon = UFCON,
}
};
/* NAND Flash on BAST board */
#ifdef CONFIG_PM
static int bast_pm_suspend(void)
{
/* ensure that an nRESET is not generated on resume. */
gpio_direction_output(S3C2410_GPA(21), 1);
return 0;
}
static void bast_pm_resume(void)
{
s3c_gpio_cfgpin(S3C2410_GPA(21), S3C2410_GPA21_nRSTOUT);
}
#else
#define bast_pm_suspend NULL
#define bast_pm_resume NULL
#endif
static struct syscore_ops bast_pm_syscore_ops = {
.suspend = bast_pm_suspend,
.resume = bast_pm_resume,
};
static int smartmedia_map[] = { 0 };
static int chip0_map[] = { 1 };
static int chip1_map[] = { 2 };
static int chip2_map[] = { 3 };
static struct mtd_partition __initdata bast_default_nand_part[] = {
[0] = {
.name = "Boot Agent",
.size = SZ_16K,
.offset = 0,
},
[1] = {
.name = "/boot",
.size = SZ_4M - SZ_16K,
.offset = SZ_16K,
},
[2] = {
.name = "user",
.offset = SZ_4M,
.size = MTDPART_SIZ_FULL,
}
};
/* the bast has 4 selectable slots for nand-flash, the three
* on-board chip areas, as well as the external SmartMedia
* slot.
*
* Note, there is no current hot-plug support for the SmartMedia
* socket.
*/
static struct s3c2410_nand_set __initdata bast_nand_sets[] = {
[0] = {
.name = "SmartMedia",
.nr_chips = 1,
.nr_map = smartmedia_map,
.options = NAND_SCAN_SILENT_NODEV,
.nr_partitions = ARRAY_SIZE(bast_default_nand_part),
.partitions = bast_default_nand_part,
},
[1] = {
.name = "chip0",
.nr_chips = 1,
.nr_map = chip0_map,
.nr_partitions = ARRAY_SIZE(bast_default_nand_part),
.partitions = bast_default_nand_part,
},
[2] = {
.name = "chip1",
.nr_chips = 1,
.nr_map = chip1_map,
.options = NAND_SCAN_SILENT_NODEV,
.nr_partitions = ARRAY_SIZE(bast_default_nand_part),
.partitions = bast_default_nand_part,
},
[3] = {
.name = "chip2",
.nr_chips = 1,
.nr_map = chip2_map,
.options = NAND_SCAN_SILENT_NODEV,
.nr_partitions = ARRAY_SIZE(bast_default_nand_part),
.partitions = bast_default_nand_part,
}
};
static void bast_nand_select(struct s3c2410_nand_set *set, int slot)
{
unsigned int tmp;
slot = set->nr_map[slot] & 3;
pr_debug("bast_nand: selecting slot %d (set %p,%p)\n",
slot, set, set->nr_map);
tmp = __raw_readb(BAST_VA_CTRL2);
tmp &= BAST_CPLD_CTLR2_IDERST;
tmp |= slot;
tmp |= BAST_CPLD_CTRL2_WNAND;
pr_debug("bast_nand: ctrl2 now %02x\n", tmp);
__raw_writeb(tmp, BAST_VA_CTRL2);
}
static struct s3c2410_platform_nand __initdata bast_nand_info = {
.tacls = 30,
.twrph0 = 60,
.twrph1 = 60,
.nr_sets = ARRAY_SIZE(bast_nand_sets),
.sets = bast_nand_sets,
.select_chip = bast_nand_select,
.engine_type = NAND_ECC_ENGINE_TYPE_SOFT,
};
/* DM9000 */
static struct resource bast_dm9k_resource[] = {
[0] = DEFINE_RES_MEM(S3C2410_CS5 + BAST_PA_DM9000, 4),
[1] = DEFINE_RES_MEM(S3C2410_CS5 + BAST_PA_DM9000 + 0x40, 0x40),
[2] = DEFINE_RES_NAMED(BAST_IRQ_DM9000 , 1, NULL, IORESOURCE_IRQ \
| IORESOURCE_IRQ_HIGHLEVEL),
};
/* for the moment we limit ourselves to 16bit IO until some
* better IO routines can be written and tested
*/
static struct dm9000_plat_data bast_dm9k_platdata = {
.flags = DM9000_PLATF_16BITONLY,
};
static struct platform_device bast_device_dm9k = {
.name = "dm9000",
.id = 0,
.num_resources = ARRAY_SIZE(bast_dm9k_resource),
.resource = bast_dm9k_resource,
.dev = {
.platform_data = &bast_dm9k_platdata,
}
};
/* serial devices */
#define SERIAL_BASE (S3C2410_CS2 + BAST_PA_SUPERIO)
#define SERIAL_FLAGS (UPF_BOOT_AUTOCONF | UPF_IOREMAP | UPF_SHARE_IRQ)
#define SERIAL_CLK (1843200)
static struct plat_serial8250_port bast_sio_data[] = {
[0] = {
.mapbase = SERIAL_BASE + 0x2f8,
.irq = BAST_IRQ_PCSERIAL1,
.flags = SERIAL_FLAGS,
.iotype = UPIO_MEM,
.regshift = 0,
.uartclk = SERIAL_CLK,
},
[1] = {
.mapbase = SERIAL_BASE + 0x3f8,
.irq = BAST_IRQ_PCSERIAL2,
.flags = SERIAL_FLAGS,
.iotype = UPIO_MEM,
.regshift = 0,
.uartclk = SERIAL_CLK,
},
{ }
};
static struct platform_device bast_sio = {
.name = "serial8250",
.id = PLAT8250_DEV_PLATFORM,
.dev = {
.platform_data = &bast_sio_data,
},
};
/* we have devices on the bus which cannot work much over the
* standard 100KHz i2c bus frequency
*/
static struct s3c2410_platform_i2c __initdata bast_i2c_info = {
.flags = 0,
.slave_addr = 0x10,
.frequency = 100*1000,
};
/* Asix AX88796 10/100 ethernet controller */
static struct ax_plat_data bast_asix_platdata = {
.flags = AXFLG_MAC_FROMDEV,
.wordlength = 2,
.dcr_val = 0x48,
.rcr_val = 0x40,
};
static struct resource bast_asix_resource[] = {
[0] = DEFINE_RES_MEM(S3C2410_CS5 + BAST_PA_ASIXNET, 0x18 * 0x20),
[1] = DEFINE_RES_MEM(S3C2410_CS5 + BAST_PA_ASIXNET + (0x1f * 0x20), 1),
[2] = DEFINE_RES_IRQ(BAST_IRQ_ASIX),
};
static struct platform_device bast_device_asix = {
.name = "ax88796",
.id = 0,
.num_resources = ARRAY_SIZE(bast_asix_resource),
.resource = bast_asix_resource,
.dev = {
.platform_data = &bast_asix_platdata
}
};
/* Asix AX88796 10/100 ethernet controller parallel port */
static struct resource bast_asixpp_resource[] = {
[0] = DEFINE_RES_MEM(S3C2410_CS5 + BAST_PA_ASIXNET + (0x18 * 0x20), \
0x30 * 0x20),
};
static struct platform_device bast_device_axpp = {
.name = "ax88796-pp",
.id = 0,
.num_resources = ARRAY_SIZE(bast_asixpp_resource),
.resource = bast_asixpp_resource,
};
/* LCD/VGA controller */
static struct s3c2410fb_display __initdata bast_lcd_info[] = {
{
.type = S3C2410_LCDCON1_TFT,
.width = 640,
.height = 480,
.pixclock = 33333,
.xres = 640,
.yres = 480,
.bpp = 4,
.left_margin = 40,
.right_margin = 20,
.hsync_len = 88,
.upper_margin = 30,
.lower_margin = 32,
.vsync_len = 3,
.lcdcon5 = 0x00014b02,
},
{
.type = S3C2410_LCDCON1_TFT,
.width = 640,
.height = 480,
.pixclock = 33333,
.xres = 640,
.yres = 480,
.bpp = 8,
.left_margin = 40,
.right_margin = 20,
.hsync_len = 88,
.upper_margin = 30,
.lower_margin = 32,
.vsync_len = 3,
.lcdcon5 = 0x00014b02,
},
{
.type = S3C2410_LCDCON1_TFT,
.width = 640,
.height = 480,
.pixclock = 33333,
.xres = 640,
.yres = 480,
.bpp = 16,
.left_margin = 40,
.right_margin = 20,
.hsync_len = 88,
.upper_margin = 30,
.lower_margin = 32,
.vsync_len = 3,
.lcdcon5 = 0x00014b02,
},
};
/* LCD/VGA controller */
static struct s3c2410fb_mach_info __initdata bast_fb_info = {
.displays = bast_lcd_info,
.num_displays = ARRAY_SIZE(bast_lcd_info),
.default_display = 1,
};
/* I2C devices fitted. */
static struct i2c_board_info bast_i2c_devs[] __initdata = {
{
I2C_BOARD_INFO("tlv320aic23", 0x1a),
}, {
I2C_BOARD_INFO("simtec-pmu", 0x6b),
}, {
I2C_BOARD_INFO("ch7013", 0x75),
},
};
static struct s3c_hwmon_pdata bast_hwmon_info = {
/* LCD contrast (0-6.6V) */
.in[0] = &(struct s3c_hwmon_chcfg) {
.name = "lcd-contrast",
.mult = 3300,
.div = 512,
},
/* LED current feedback */
.in[1] = &(struct s3c_hwmon_chcfg) {
.name = "led-feedback",
.mult = 3300,
.div = 1024,
},
/* LCD feedback (0-6.6V) */
.in[2] = &(struct s3c_hwmon_chcfg) {
.name = "lcd-feedback",
.mult = 3300,
.div = 512,
},
/* Vcore (1.8-2.0V), Vref 3.3V */
.in[3] = &(struct s3c_hwmon_chcfg) {
.name = "vcore",
.mult = 3300,
.div = 1024,
},
};
/* Standard BAST devices */
// cat /sys/devices/platform/s3c24xx-adc/s3c-hwmon/in_0
static struct platform_device *bast_devices[] __initdata = {
&s3c2410_device_dclk,
&s3c_device_ohci,
&s3c_device_lcd,
&s3c_device_wdt,
&s3c_device_i2c0,
&s3c_device_rtc,
&s3c_device_nand,
&s3c_device_adc,
&s3c_device_hwmon,
&bast_device_dm9k,
&bast_device_asix,
&bast_device_axpp,
&bast_sio,
};
static struct s3c_cpufreq_board __initdata bast_cpufreq = {
.refresh = 7800, /* 7.8usec */
.auto_io = 1,
.need_io = 1,
};
static struct s3c24xx_audio_simtec_pdata __initdata bast_audio = {
.have_mic = 1,
.have_lout = 1,
};
static void __init bast_map_io(void)
{
s3c_hwmon_set_platdata(&bast_hwmon_info);
s3c24xx_init_io(bast_iodesc, ARRAY_SIZE(bast_iodesc));
s3c24xx_init_uarts(bast_uartcfgs, ARRAY_SIZE(bast_uartcfgs));
s3c24xx_set_timer_source(S3C24XX_PWM3, S3C24XX_PWM4);
}
static void __init bast_init_time(void)
{
s3c2410_init_clocks(12000000);
s3c24xx_timer_init();
}
static void __init bast_init(void)
{
register_syscore_ops(&bast_pm_syscore_ops);
s3c_i2c0_set_platdata(&bast_i2c_info);
s3c_nand_set_platdata(&bast_nand_info);
s3c24xx_fb_set_platdata(&bast_fb_info);
platform_add_devices(bast_devices, ARRAY_SIZE(bast_devices));
i2c_register_board_info(0, bast_i2c_devs,
ARRAY_SIZE(bast_i2c_devs));
usb_simtec_init();
nor_simtec_init();
simtec_audio_add(NULL, true, &bast_audio);
WARN_ON(gpio_request(S3C2410_GPA(21), "bast nreset"));
s3c_cpufreq_setboard(&bast_cpufreq);
}
MACHINE_START(BAST, "Simtec-BAST")
/* Maintainer: Ben Dooks <ben@simtec.co.uk> */
.atag_offset = 0x100,
.map_io = bast_map_io,
.init_irq = s3c2410_init_irq,
.init_machine = bast_init,
.init_time = bast_init_time,
MACHINE_END
|
from django.conf import settings
from django.core.mail import send_mail
from django.core.urlresolvers import reverse
def send_validation(strategy, backend, code):
url = '{0}?verification_code={1}'.format(
reverse('social:complete', args=(backend.name,)),
code.code
)
url = strategy.request.build_absolute_uri(url)
send_mail('Validate your account', 'Validate your account {0}'.format(url),
settings.EMAIL_FROM, [code.email], fail_silently=False)
|
<!DOCTYPE html>
<!-- DO NOT EDIT! Generated by referrer-policy/generic/tools/generate.py using referrer-policy/generic/template/test.release.html.template. -->
<html>
<head>
<title>Referrer-Policy: Referrer Policy is set to 'origin-when-cross-origin'</title>
<meta name="description" content="Check that cross-origin subresources get the origin portion of the referrer URL and same-origin get the stripped referrer URL.">
<link rel="author" title="Kristijan Burnik" href="burnik@chromium.org">
<link rel="help" href="https://w3c.github.io/webappsec-referrer-policy/#referrer-policy-origin-when-cross-origin">
<meta name="assert" content="The referrer URL is origin when a
document served over http requires an http
sub-resource via iframe-tag using the attr-referrer
delivery method with swap-origin-redirect and when
the target request is same-origin.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<!-- TODO(kristijanburnik): Minify and merge both: -->
<script src="/referrer-policy/generic/common.js"></script>
<script src="/referrer-policy/generic/referrer-policy-test-case.js?pipe=sub"></script>
</head>
<body>
<script>
ReferrerPolicyTestCase(
{
"referrer_policy": "origin-when-cross-origin",
"delivery_method": "attr-referrer",
"redirection": "swap-origin-redirect",
"origin": "same-origin",
"source_protocol": "http",
"target_protocol": "http",
"subresource": "iframe-tag",
"subresource_path": "/referrer-policy/generic/subresource/document.py",
"referrer_url": "origin"
},
document.querySelector("meta[name=assert]").content,
new SanityChecker()
).start();
</script>
<div id="log"></div>
</body>
</html>
|
/*
* Copyright (C) 2012 Intel Corporation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
#include "GLPlatformContext.h"
#if USE(ACCELERATED_COMPOSITING)
#if USE(GLX)
#include "GLXContext.h"
#elif USE(EGL)
#include "EGLContext.h"
#endif
#include "NotImplemented.h"
namespace WebCore {
#if USE(OPENGL_ES_2)
static PFNGLGETGRAPHICSRESETSTATUSEXTPROC glGetGraphicsResetStatus = 0;
#else
static PFNGLGETGRAPHICSRESETSTATUSARBPROC glGetGraphicsResetStatus = 0;
#endif
static GLPlatformContext* m_currentContext = 0;
class GLCurrentContextWrapper : public GLPlatformContext {
public:
GLCurrentContextWrapper()
: GLPlatformContext()
{
#if USE(GLX)
m_contextHandle = glXGetCurrentContext();
#elif USE(EGL)
m_contextHandle = eglGetCurrentContext();
#endif
if (m_contextHandle)
m_currentContext = this;
}
virtual ~GLCurrentContextWrapper() { }
};
static PassOwnPtr<GLPlatformContext> createOffScreenContext()
{
#if USE(GLX)
return adoptPtr(new GLXOffScreenContext());
#elif USE(EGL)
return adoptPtr(new EGLOffScreenContext());
#else
return nullptr;
#endif
}
static HashSet<String> parseExtensions(const String& extensionsString)
{
Vector<String> extNames;
extensionsString.split(" ", extNames);
HashSet<String> splitExtNames;
unsigned size = extNames.size();
for (unsigned i = 0; i < size; ++i)
splitExtNames.add(extNames[i]);
extNames.clear();
return splitExtNames;
}
static void resolveResetStatusExtension()
{
static bool resolvedRobustnessExtension = false;
if (!resolvedRobustnessExtension) {
resolvedRobustnessExtension = true;
#if USE(OPENGL_ES_2)
glGetGraphicsResetStatus = reinterpret_cast<PFNGLGETGRAPHICSRESETSTATUSEXTPROC>(eglGetProcAddress("glGetGraphicsResetStatusEXT"));
#elif USE(EGL)
glGetGraphicsResetStatus = reinterpret_cast<PFNGLGETGRAPHICSRESETSTATUSARBPROC>(eglGetProcAddress("glGetGraphicsResetStatusARB"));
#elif USE(GLX)
glGetGraphicsResetStatus = reinterpret_cast<PFNGLGETGRAPHICSRESETSTATUSARBPROC>(glXGetProcAddressARB(reinterpret_cast<const GLubyte*>("glGetGraphicsResetStatusARB")));
#endif
}
}
PassOwnPtr<GLPlatformContext> GLPlatformContext::createContext(GraphicsContext3D::RenderStyle renderStyle)
{
#if !USE(OPENGL_ES_2)
if (!initializeOpenGLShims())
return nullptr;
#endif
switch (renderStyle) {
case GraphicsContext3D::RenderOffscreen:
if (OwnPtr<GLPlatformContext> context = createOffScreenContext())
return context.release();
break;
case GraphicsContext3D::RenderToCurrentGLContext:
if (OwnPtr<GLPlatformContext> context = adoptPtr(new GLCurrentContextWrapper()))
return context.release();
break;
case GraphicsContext3D::RenderDirectlyToHostWindow:
ASSERT_NOT_REACHED();
break;
}
return nullptr;
}
bool GLPlatformContext::supportsGLExtension(const String& name)
{
static HashSet<String> supportedExtensions;
if (!supportedExtensions.size()) {
String rawExtensions = reinterpret_cast<const char*>(::glGetString(GL_EXTENSIONS));
supportedExtensions = parseExtensions(rawExtensions);
}
if (supportedExtensions.contains(name))
return true;
return false;
}
#if USE(EGL)
bool GLPlatformContext::supportsEGLExtension(EGLDisplay display, const String& name)
{
static HashSet<String> supportedExtensions;
if (!supportedExtensions.size()) {
if (display == EGL_NO_DISPLAY)
return false;
String rawExtensions = reinterpret_cast<const char*>(eglQueryString(display, EGL_EXTENSIONS));
supportedExtensions = parseExtensions(rawExtensions);
}
if (supportedExtensions.contains(name))
return true;
return false;
}
#endif
#if USE(GLX)
bool GLPlatformContext::supportsGLXExtension(Display* display, const String& name)
{
static HashSet<String> supportedExtensions;
if (!supportedExtensions.size()) {
if (!display)
return false;
String rawExtensions = glXQueryExtensionsString(display, DefaultScreen(display));
supportedExtensions = parseExtensions(rawExtensions);
}
if (supportedExtensions.contains(name))
return true;
return false;
}
#endif
GLPlatformContext::GLPlatformContext()
: m_contextHandle(0)
, m_resetLostContext(false)
{
}
GLPlatformContext::~GLPlatformContext()
{
if (this == m_currentContext)
m_currentContext = 0;
}
bool GLPlatformContext::makeCurrent(GLPlatformSurface* surface)
{
m_contextLost = false;
if (m_currentContext == this && (!surface || surface->isCurrentDrawable()))
return true;
m_currentContext = 0;
if (!surface || (surface && !surface->drawable()))
platformReleaseCurrent();
else if (platformMakeCurrent(surface)) {
m_currentContext = this;
surface->onMakeCurrent();
}
if (m_resetLostContext) {
resolveResetStatusExtension();
if (glGetGraphicsResetStatus) {
GLenum status = glGetGraphicsResetStatus();
switch (status) {
case PLATFORMCONTEXT_NO_ERROR:
break;
case PLATFORMCONTEXT_GUILTY_CONTEXT_RESET:
m_contextLost = true;
break;
case PLATFORMCONTEXT_INNOCENT_CONTEXT_RESET:
break;
case PLATFORMCONTEXT_UNKNOWN_CONTEXT_RESET:
m_contextLost = true;
break;
default:
break;
}
}
}
return m_currentContext;
}
bool GLPlatformContext::isValid() const
{
return !m_contextLost;
}
void GLPlatformContext::releaseCurrent()
{
if (this == m_currentContext) {
m_currentContext = 0;
platformReleaseCurrent();
}
}
PlatformContext GLPlatformContext::handle() const
{
return m_contextHandle;
}
bool GLPlatformContext::isCurrentContext() const
{
return true;
}
bool GLPlatformContext::initialize(GLPlatformSurface*, PlatformContext)
{
return true;
}
GLPlatformContext* GLPlatformContext::getCurrent()
{
return m_currentContext;
}
bool GLPlatformContext::platformMakeCurrent(GLPlatformSurface*)
{
return true;
}
void GLPlatformContext::platformReleaseCurrent()
{
notImplemented();
}
void GLPlatformContext::destroy()
{
m_contextHandle = 0;
m_resetLostContext = false;
}
} // namespace WebCore
#endif
|
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef _ASM_X86_MSI_H
#define _ASM_X86_MSI_H
#include <asm/hw_irq.h>
#include <asm/irqdomain.h>
typedef struct irq_alloc_info msi_alloc_info_t;
int pci_msi_prepare(struct irq_domain *domain, struct device *dev, int nvec,
msi_alloc_info_t *arg);
/* Structs and defines for the X86 specific MSI message format */
typedef struct x86_msi_data {
u32 vector : 8,
delivery_mode : 3,
dest_mode_logical : 1,
reserved : 2,
active_low : 1,
is_level : 1;
u32 dmar_subhandle;
} __attribute__ ((packed)) arch_msi_msg_data_t;
#define arch_msi_msg_data x86_msi_data
typedef struct x86_msi_addr_lo {
union {
struct {
u32 reserved_0 : 2,
dest_mode_logical : 1,
redirect_hint : 1,
reserved_1 : 1,
virt_destid_8_14 : 7,
destid_0_7 : 8,
base_address : 12;
};
struct {
u32 dmar_reserved_0 : 2,
dmar_index_15 : 1,
dmar_subhandle_valid : 1,
dmar_format : 1,
dmar_index_0_14 : 15,
dmar_base_address : 12;
};
};
} __attribute__ ((packed)) arch_msi_msg_addr_lo_t;
#define arch_msi_msg_addr_lo x86_msi_addr_lo
#define X86_MSI_BASE_ADDRESS_LOW (0xfee00000 >> 20)
typedef struct x86_msi_addr_hi {
u32 reserved : 8,
destid_8_31 : 24;
} __attribute__ ((packed)) arch_msi_msg_addr_hi_t;
#define arch_msi_msg_addr_hi x86_msi_addr_hi
#define X86_MSI_BASE_ADDRESS_HIGH (0)
struct msi_msg;
u32 x86_msi_msg_get_destid(struct msi_msg *msg, bool extid);
#endif /* _ASM_X86_MSI_H */
|
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _rest = require('./internal/rest');
var _rest2 = _interopRequireDefault(_rest);
var _initialParams = require('./internal/initialParams');
var _initialParams2 = _interopRequireDefault(_initialParams);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* Returns a function that when called, calls-back with the values provided.
* Useful as the first function in a [`waterfall`]{@link module:ControlFlow.waterfall}, or for plugging values in to
* [`auto`]{@link module:ControlFlow.auto}.
*
* @name constant
* @static
* @memberOf module:Utils
* @method
* @category Util
* @param {...*} arguments... - Any number of arguments to automatically invoke
* callback with.
* @returns {AsyncFunction} Returns a function that when invoked, automatically
* invokes the callback with the previous given arguments.
* @example
*
* async.waterfall([
* async.constant(42),
* function (value, next) {
* // value === 42
* },
* //...
* ], callback);
*
* async.waterfall([
* async.constant(filename, "utf8"),
* fs.readFile,
* function (fileData, next) {
* //...
* }
* //...
* ], callback);
*
* async.auto({
* hostname: async.constant("https://server.net/"),
* port: findFreePort,
* launchServer: ["hostname", "port", function (options, cb) {
* startServer(options, cb);
* }],
* //...
* }, callback);
*/
exports.default = (0, _rest2.default)(function (values) {
var args = [null].concat(values);
return (0, _initialParams2.default)(function (ignoredArgs, callback) {
return callback.apply(this, args);
});
});
module.exports = exports['default']; |
// Copyright 2004-present Facebook. All Rights Reserved.
package com.facebook.react;
import javax.inject.Provider;
import com.facebook.react.bridge.NativeModule;
/**
* Provider for an already initialized and non-lazy NativeModule.
*/
public class EagerModuleProvider implements Provider<NativeModule> {
private final NativeModule mModule;
public EagerModuleProvider(NativeModule module) {
mModule = module;
}
@Override
public NativeModule get() {
return mModule;
}
}
|
package godo
import (
"fmt"
"net/url"
)
// DropletActionsService is an interface for interfacing with the droplet actions
// endpoints of the Digital Ocean API
// See: https://developers.digitalocean.com/#droplet-actions
type DropletActionsService interface {
Shutdown(int) (*Action, *Response, error)
PowerOff(int) (*Action, *Response, error)
PowerOn(int) (*Action, *Response, error)
PowerCycle(int) (*Action, *Response, error)
Reboot(int) (*Action, *Response, error)
Restore(int, int) (*Action, *Response, error)
Resize(int, string) (*Action, *Response, error)
Rename(int, string) (*Action, *Response, error)
doAction(int, *ActionRequest) (*Action, *Response, error)
Get(int, int) (*Action, *Response, error)
GetByURI(string) (*Action, *Response, error)
}
// DropletActionsServiceOp handles communication with the droplet action related
// methods of the DigitalOcean API.
type DropletActionsServiceOp struct {
client *Client
}
// Shutdown a Droplet
func (s *DropletActionsServiceOp) Shutdown(id int) (*Action, *Response, error) {
request := &ActionRequest{Type: "shutdown"}
return s.doAction(id, request)
}
// PowerOff a Droplet
func (s *DropletActionsServiceOp) PowerOff(id int) (*Action, *Response, error) {
request := &ActionRequest{Type: "power_off"}
return s.doAction(id, request)
}
// PowerOn a Droplet
func (s *DropletActionsServiceOp) PowerOn(id int) (*Action, *Response, error) {
request := &ActionRequest{Type: "power_on"}
return s.doAction(id, request)
}
// PowerCycle a Droplet
func (s *DropletActionsServiceOp) PowerCycle(id int) (*Action, *Response, error) {
request := &ActionRequest{Type: "power_cycle"}
return s.doAction(id, request)
}
// Reboot a Droplet
func (s *DropletActionsServiceOp) Reboot(id int) (*Action, *Response, error) {
request := &ActionRequest{Type: "reboot"}
return s.doAction(id, request)
}
// Restore an image to a Droplet
func (s *DropletActionsServiceOp) Restore(id, imageID int) (*Action, *Response, error) {
options := map[string]interface{}{
"image": float64(imageID),
}
requestType := "restore"
request := &ActionRequest{
Type: requestType,
Params: options,
}
return s.doAction(id, request)
}
// Resize a Droplet
func (s *DropletActionsServiceOp) Resize(id int, sizeSlug string) (*Action, *Response, error) {
options := map[string]interface{}{
"size": sizeSlug,
}
requestType := "resize"
request := &ActionRequest{
Type: requestType,
Params: options,
}
return s.doAction(id, request)
}
// Rename a Droplet
func (s *DropletActionsServiceOp) Rename(id int, name string) (*Action, *Response, error) {
options := map[string]interface{}{
"name": name,
}
requestType := "rename"
request := &ActionRequest{
Type: requestType,
Params: options,
}
return s.doAction(id, request)
}
func (s *DropletActionsServiceOp) doAction(id int, request *ActionRequest) (*Action, *Response, error) {
path := dropletActionPath(id)
req, err := s.client.NewRequest("POST", path, request)
if err != nil {
return nil, nil, err
}
root := new(actionRoot)
resp, err := s.client.Do(req, root)
if err != nil {
return nil, resp, err
}
return &root.Event, resp, err
}
// Get an action for a particular droplet by id.
func (s *DropletActionsServiceOp) Get(dropletID, actionID int) (*Action, *Response, error) {
path := fmt.Sprintf("%s/%d", dropletActionPath(dropletID), actionID)
return s.get(path)
}
// GetByURI gets an action for a particular droplet by id.
func (s *DropletActionsServiceOp) GetByURI(rawurl string) (*Action, *Response, error) {
u, err := url.Parse(rawurl)
if err != nil {
return nil, nil, err
}
return s.get(u.Path)
}
func (s *DropletActionsServiceOp) get(path string) (*Action, *Response, error) {
req, err := s.client.NewRequest("GET", path, nil)
if err != nil {
return nil, nil, err
}
root := new(actionRoot)
resp, err := s.client.Do(req, root)
if err != nil {
return nil, resp, err
}
return &root.Event, resp, err
}
func dropletActionPath(dropletID int) string {
return fmt.Sprintf("v2/droplets/%d/actions", dropletID)
}
|
<?php
/* Development */
define('DB_NAME', getenv('DB_NAME'));
define('DB_USER', getenv('DB_USER'));
define('DB_PASSWORD', getenv('DB_PASSWORD'));
define('DB_HOST', getenv('DB_HOST') ? getenv('DB_HOST') : 'localhost');
define('WP_HOME', getenv('WP_HOME'));
define('WP_SITEURL', getenv('WP_SITEURL'));
define('SAVEQUERIES', true);
define('WP_DEBUG', true);
define('SCRIPT_DEBUG', true);
|
/**
* @file
* Network Point to Point Protocol over Layer 2 Tunneling Protocol header file.
*
*/
/*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
* OF SUCH DAMAGE.
*
* This file is part of the lwIP TCP/IP stack.
*
*/
#include "netif/ppp/ppp_opts.h"
#if PPP_SUPPORT && PPPOL2TP_SUPPORT /* don't build if not configured for use in lwipopts.h */
#ifndef PPPOL2TP_H
#define PPPOL2TP_H
#include "ppp.h"
/* Timeout */
#define PPPOL2TP_CONTROL_TIMEOUT (5*1000) /* base for quick timeout calculation */
#define PPPOL2TP_SLOW_RETRY (60*1000) /* persistent retry interval */
#define PPPOL2TP_MAXSCCRQ 4 /* retry SCCRQ four times (quickly) */
#define PPPOL2TP_MAXICRQ 4 /* retry IRCQ four times */
#define PPPOL2TP_MAXICCN 4 /* retry ICCN four times */
/* L2TP header flags */
#define PPPOL2TP_HEADERFLAG_CONTROL 0x8000
#define PPPOL2TP_HEADERFLAG_LENGTH 0x4000
#define PPPOL2TP_HEADERFLAG_SEQUENCE 0x0800
#define PPPOL2TP_HEADERFLAG_OFFSET 0x0200
#define PPPOL2TP_HEADERFLAG_PRIORITY 0x0100
#define PPPOL2TP_HEADERFLAG_VERSION 0x0002
/* Mandatory bits for control: Control, Length, Sequence, Version 2 */
#define PPPOL2TP_HEADERFLAG_CONTROL_MANDATORY (PPPOL2TP_HEADERFLAG_CONTROL|PPPOL2TP_HEADERFLAG_LENGTH|PPPOL2TP_HEADERFLAG_SEQUENCE|PPPOL2TP_HEADERFLAG_VERSION)
/* Forbidden bits for control: Offset, Priority */
#define PPPOL2TP_HEADERFLAG_CONTROL_FORBIDDEN (PPPOL2TP_HEADERFLAG_OFFSET|PPPOL2TP_HEADERFLAG_PRIORITY)
/* Mandatory bits for data: Version 2 */
#define PPPOL2TP_HEADERFLAG_DATA_MANDATORY (PPPOL2TP_HEADERFLAG_VERSION)
/* AVP (Attribute Value Pair) header */
#define PPPOL2TP_AVPHEADERFLAG_MANDATORY 0x8000
#define PPPOL2TP_AVPHEADERFLAG_HIDDEN 0x4000
#define PPPOL2TP_AVPHEADERFLAG_LENGTHMASK 0x03ff
/* -- AVP - Message type */
#define PPPOL2TP_AVPTYPE_MESSAGE 0 /* Message type */
/* Control Connection Management */
#define PPPOL2TP_MESSAGETYPE_SCCRQ 1 /* Start Control Connection Request */
#define PPPOL2TP_MESSAGETYPE_SCCRP 2 /* Start Control Connection Reply */
#define PPPOL2TP_MESSAGETYPE_SCCCN 3 /* Start Control Connection Connected */
#define PPPOL2TP_MESSAGETYPE_STOPCCN 4 /* Stop Control Connection Notification */
#define PPPOL2TP_MESSAGETYPE_HELLO 6 /* Hello */
/* Call Management */
#define PPPOL2TP_MESSAGETYPE_OCRQ 7 /* Outgoing Call Request */
#define PPPOL2TP_MESSAGETYPE_OCRP 8 /* Outgoing Call Reply */
#define PPPOL2TP_MESSAGETYPE_OCCN 9 /* Outgoing Call Connected */
#define PPPOL2TP_MESSAGETYPE_ICRQ 10 /* Incoming Call Request */
#define PPPOL2TP_MESSAGETYPE_ICRP 11 /* Incoming Call Reply */
#define PPPOL2TP_MESSAGETYPE_ICCN 12 /* Incoming Call Connected */
#define PPPOL2TP_MESSAGETYPE_CDN 14 /* Call Disconnect Notify */
/* Error reporting */
#define PPPOL2TP_MESSAGETYPE_WEN 15 /* WAN Error Notify */
/* PPP Session Control */
#define PPPOL2TP_MESSAGETYPE_SLI 16 /* Set Link Info */
/* -- AVP - Result code */
#define PPPOL2TP_AVPTYPE_RESULTCODE 1 /* Result code */
#define PPPOL2TP_RESULTCODE 1 /* General request to clear control connection */
/* -- AVP - Protocol version (!= L2TP Header version) */
#define PPPOL2TP_AVPTYPE_VERSION 2
#define PPPOL2TP_VERSION 0x0100 /* L2TP Protocol version 1, revision 0 */
/* -- AVP - Framing capabilities */
#define PPPOL2TP_AVPTYPE_FRAMINGCAPABILITIES 3 /* Bearer capabilities */
#define PPPOL2TP_FRAMINGCAPABILITIES 0x00000003 /* Async + Sync framing */
/* -- AVP - Bearer capabilities */
#define PPPOL2TP_AVPTYPE_BEARERCAPABILITIES 4 /* Bearer capabilities */
#define PPPOL2TP_BEARERCAPABILITIES 0x00000003 /* Analog + Digital Access */
/* -- AVP - Tie breaker */
#define PPPOL2TP_AVPTYPE_TIEBREAKER 5
/* -- AVP - Host name */
#define PPPOL2TP_AVPTYPE_HOSTNAME 7 /* Host name */
#define PPPOL2TP_HOSTNAME "lwIP" /* FIXME: make it configurable */
/* -- AVP - Vendor name */
#define PPPOL2TP_AVPTYPE_VENDORNAME 8 /* Vendor name */
#define PPPOL2TP_VENDORNAME "lwIP" /* FIXME: make it configurable */
/* -- AVP - Assign tunnel ID */
#define PPPOL2TP_AVPTYPE_TUNNELID 9 /* Assign Tunnel ID */
/* -- AVP - Receive window size */
#define PPPOL2TP_AVPTYPE_RECEIVEWINDOWSIZE 10 /* Receive window size */
#define PPPOL2TP_RECEIVEWINDOWSIZE 8 /* FIXME: make it configurable */
/* -- AVP - Challenge */
#define PPPOL2TP_AVPTYPE_CHALLENGE 11 /* Challenge */
/* -- AVP - Cause code */
#define PPPOL2TP_AVPTYPE_CAUSECODE 12 /* Cause code*/
/* -- AVP - Challenge response */
#define PPPOL2TP_AVPTYPE_CHALLENGERESPONSE 13 /* Challenge response */
#define PPPOL2TP_AVPTYPE_CHALLENGERESPONSE_SIZE 16
/* -- AVP - Assign session ID */
#define PPPOL2TP_AVPTYPE_SESSIONID 14 /* Assign Session ID */
/* -- AVP - Call serial number */
#define PPPOL2TP_AVPTYPE_CALLSERIALNUMBER 15 /* Call Serial Number */
/* -- AVP - Framing type */
#define PPPOL2TP_AVPTYPE_FRAMINGTYPE 19 /* Framing Type */
#define PPPOL2TP_FRAMINGTYPE 0x00000001 /* Sync framing */
/* -- AVP - TX Connect Speed */
#define PPPOL2TP_AVPTYPE_TXCONNECTSPEED 24 /* TX Connect Speed */
#define PPPOL2TP_TXCONNECTSPEED 100000000 /* Connect speed: 100 Mbits/s */
/* L2TP Session state */
#define PPPOL2TP_STATE_INITIAL 0
#define PPPOL2TP_STATE_SCCRQ_SENT 1
#define PPPOL2TP_STATE_ICRQ_SENT 2
#define PPPOL2TP_STATE_ICCN_SENT 3
#define PPPOL2TP_STATE_DATA 4
#define PPPOL2TP_OUTPUT_DATA_HEADER_LEN 6 /* Our data header len */
/*
* PPPoL2TP interface control block.
*/
typedef struct pppol2tp_pcb_s pppol2tp_pcb;
struct pppol2tp_pcb_s {
ppp_pcb *ppp; /* PPP PCB */
u8_t phase; /* L2TP phase */
struct udp_pcb *udp; /* UDP L2TP Socket */
struct netif *netif; /* Output interface, used as a default route */
ip_addr_t remote_ip; /* LNS IP Address */
u16_t remote_port; /* LNS port */
#if PPPOL2TP_AUTH_SUPPORT
const u8_t *secret; /* Secret string */
u8_t secret_len; /* Secret string length */
u8_t secret_rv[16]; /* Random vector */
u8_t challenge_hash[16]; /* Challenge response */
u8_t send_challenge; /* Boolean whether the next sent packet should contains a challenge response */
#endif /* PPPOL2TP_AUTH_SUPPORT */
u16_t tunnel_port; /* Tunnel port */
u16_t our_ns; /* NS to peer */
u16_t peer_nr; /* NR from peer */
u16_t peer_ns; /* NS from peer */
u16_t source_tunnel_id; /* Tunnel ID assigned by peer */
u16_t remote_tunnel_id; /* Tunnel ID assigned to peer */
u16_t source_session_id; /* Session ID assigned by peer */
u16_t remote_session_id; /* Session ID assigned to peer */
u8_t sccrq_retried; /* number of SCCRQ retries already done */
u8_t icrq_retried; /* number of ICRQ retries already done */
u8_t iccn_retried; /* number of ICCN retries already done */
};
/* Create a new L2TP session. */
ppp_pcb *pppol2tp_create(struct netif *pppif,
struct netif *netif, const ip_addr_t *ipaddr, u16_t port,
const u8_t *secret, u8_t secret_len,
ppp_link_status_cb_fn link_status_cb, void *ctx_cb);
#endif /* PPPOL2TP_H */
#endif /* PPP_SUPPORT && PPPOL2TP_SUPPORT */
|
alter table ACT_HI_DETAIL
add DUE_DATE_ timestamp;
alter table ACT_HI_TASKINST
add DUE_DATE_ timestamp;
create table ACT_HI_COMMENT (
ID_ varchar(64) not null,
TIME_ timestamp not null,
USER_ID_ varchar(255),
TASK_ID_ varchar(64),
PROC_INST_ID_ varchar(64),
MESSAGE_ varchar(255),
primary key (ID_)
);
create table ACT_HI_ATTACHMENT (
ID_ varchar(64) not null,
REV_ integer,
NAME_ varchar(255),
DESCRIPTION_ varchar(255),
TYPE_ varchar(255),
TASK_ID_ varchar(64),
PROC_INST_ID_ varchar(64),
URL_ varchar(255),
CONTENT_ID_ varchar(64),
primary key (ID_)
);
|
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* PHPUnit data generator tests
*
* @package mod_data
* @category phpunit
* @copyright 2012 Petr Skoda {@link http://skodak.org}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
/**
* PHPUnit data generator testcase
*
* @package mod_data
* @category phpunit
* @copyright 2012 Petr Skoda {@link http://skodak.org}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class mod_data_generator_testcase extends advanced_testcase {
public function test_generator() {
global $DB;
$this->resetAfterTest(true);
$this->assertEquals(0, $DB->count_records('data'));
$course = $this->getDataGenerator()->create_course();
/** @var mod_data_generator $generator */
$generator = $this->getDataGenerator()->get_plugin_generator('mod_data');
$this->assertInstanceOf('mod_data_generator', $generator);
$this->assertEquals('data', $generator->get_modulename());
$generator->create_instance(array('course'=>$course->id));
$generator->create_instance(array('course'=>$course->id));
$data = $generator->create_instance(array('course'=>$course->id));
$this->assertEquals(3, $DB->count_records('data'));
$cm = get_coursemodule_from_instance('data', $data->id);
$this->assertEquals($data->id, $cm->instance);
$this->assertEquals('data', $cm->modname);
$this->assertEquals($course->id, $cm->course);
$context = context_module::instance($cm->id);
$this->assertEquals($data->cmid, $context->instanceid);
// test gradebook integration using low level DB access - DO NOT USE IN PLUGIN CODE!
$data = $generator->create_instance(array('course'=>$course->id, 'assessed'=>1, 'scale'=>100));
$gitem = $DB->get_record('grade_items', array('courseid'=>$course->id, 'itemtype'=>'mod', 'itemmodule'=>'data', 'iteminstance'=>$data->id));
$this->assertNotEmpty($gitem);
$this->assertEquals(100, $gitem->grademax);
$this->assertEquals(0, $gitem->grademin);
$this->assertEquals(GRADE_TYPE_VALUE, $gitem->gradetype);
}
}
|
package com.iluwatar.callback;
/**
*
* Callback interface
*
*/
public interface Callback {
public void call();
}
|
/*
* linux/fs/nfs/dir.c
*
* Copyright (C) 1992 Rick Sladkey
*
* nfs directory handling functions
*
* 10 Apr 1996 Added silly rename for unlink --okir
* 28 Sep 1996 Improved directory cache --okir
* 23 Aug 1997 Claus Heine claus@momo.math.rwth-aachen.de
* Re-implemented silly rename for unlink, newly implemented
* silly rename for nfs_rename() following the suggestions
* of Olaf Kirch (okir) found in this file.
* Following Linus comments on my original hack, this version
* depends only on the dcache stuff and doesn't touch the inode
* layer (iput() and friends).
* 6 Jun 1999 Cache readdir lookups in the page cache. -DaveM
*/
#include <linux/module.h>
#include <linux/time.h>
#include <linux/errno.h>
#include <linux/stat.h>
#include <linux/fcntl.h>
#include <linux/string.h>
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/mm.h>
#include <linux/sunrpc/clnt.h>
#include <linux/nfs_fs.h>
#include <linux/nfs_mount.h>
#include <linux/pagemap.h>
#include <linux/pagevec.h>
#include <linux/namei.h>
#include <linux/mount.h>
#include <linux/swap.h>
#include <linux/sched.h>
#include <linux/kmemleak.h>
#include <linux/xattr.h>
#include "delegation.h"
#include "iostat.h"
#include "internal.h"
#include "fscache.h"
#include "nfstrace.h"
/* #define NFS_DEBUG_VERBOSE 1 */
static int nfs_opendir(struct inode *, struct file *);
static int nfs_closedir(struct inode *, struct file *);
static int nfs_readdir(struct file *, struct dir_context *);
static int nfs_fsync_dir(struct file *, loff_t, loff_t, int);
static loff_t nfs_llseek_dir(struct file *, loff_t, int);
static void nfs_readdir_clear_array(struct page*);
const struct file_operations nfs_dir_operations = {
.llseek = nfs_llseek_dir,
.read = generic_read_dir,
.iterate = nfs_readdir,
.open = nfs_opendir,
.release = nfs_closedir,
.fsync = nfs_fsync_dir,
};
const struct address_space_operations nfs_dir_aops = {
.freepage = nfs_readdir_clear_array,
};
static struct nfs_open_dir_context *alloc_nfs_open_dir_context(struct inode *dir, struct rpc_cred *cred)
{
struct nfs_inode *nfsi = NFS_I(dir);
struct nfs_open_dir_context *ctx;
ctx = kmalloc(sizeof(*ctx), GFP_KERNEL);
if (ctx != NULL) {
ctx->duped = 0;
ctx->attr_gencount = nfsi->attr_gencount;
ctx->dir_cookie = 0;
ctx->dup_cookie = 0;
ctx->cred = get_rpccred(cred);
spin_lock(&dir->i_lock);
list_add(&ctx->list, &nfsi->open_files);
spin_unlock(&dir->i_lock);
return ctx;
}
return ERR_PTR(-ENOMEM);
}
static void put_nfs_open_dir_context(struct inode *dir, struct nfs_open_dir_context *ctx)
{
spin_lock(&dir->i_lock);
list_del(&ctx->list);
spin_unlock(&dir->i_lock);
put_rpccred(ctx->cred);
kfree(ctx);
}
/*
* Open file
*/
static int
nfs_opendir(struct inode *inode, struct file *filp)
{
int res = 0;
struct nfs_open_dir_context *ctx;
struct rpc_cred *cred;
dfprintk(FILE, "NFS: open dir(%pD2)\n", filp);
nfs_inc_stats(inode, NFSIOS_VFSOPEN);
cred = rpc_lookup_cred();
if (IS_ERR(cred))
return PTR_ERR(cred);
ctx = alloc_nfs_open_dir_context(inode, cred);
if (IS_ERR(ctx)) {
res = PTR_ERR(ctx);
goto out;
}
filp->private_data = ctx;
if (filp->f_path.dentry == filp->f_path.mnt->mnt_root) {
/* This is a mountpoint, so d_revalidate will never
* have been called, so we need to refresh the
* inode (for close-open consistency) ourselves.
*/
__nfs_revalidate_inode(NFS_SERVER(inode), inode);
}
out:
put_rpccred(cred);
return res;
}
static int
nfs_closedir(struct inode *inode, struct file *filp)
{
put_nfs_open_dir_context(file_inode(filp), filp->private_data);
return 0;
}
struct nfs_cache_array_entry {
u64 cookie;
u64 ino;
struct qstr string;
unsigned char d_type;
};
struct nfs_cache_array {
int size;
int eof_index;
u64 last_cookie;
struct nfs_cache_array_entry array[0];
};
typedef int (*decode_dirent_t)(struct xdr_stream *, struct nfs_entry *, int);
typedef struct {
struct file *file;
struct page *page;
struct dir_context *ctx;
unsigned long page_index;
u64 *dir_cookie;
u64 last_cookie;
loff_t current_index;
decode_dirent_t decode;
unsigned long timestamp;
unsigned long gencount;
unsigned int cache_entry_index;
unsigned int plus:1;
unsigned int eof:1;
} nfs_readdir_descriptor_t;
/*
* The caller is responsible for calling nfs_readdir_release_array(page)
*/
static
struct nfs_cache_array *nfs_readdir_get_array(struct page *page)
{
void *ptr;
if (page == NULL)
return ERR_PTR(-EIO);
ptr = kmap(page);
if (ptr == NULL)
return ERR_PTR(-ENOMEM);
return ptr;
}
static
void nfs_readdir_release_array(struct page *page)
{
kunmap(page);
}
/*
* we are freeing strings created by nfs_add_to_readdir_array()
*/
static
void nfs_readdir_clear_array(struct page *page)
{
struct nfs_cache_array *array;
int i;
array = kmap_atomic(page);
for (i = 0; i < array->size; i++)
kfree(array->array[i].string.name);
kunmap_atomic(array);
}
/*
* the caller is responsible for freeing qstr.name
* when called by nfs_readdir_add_to_array, the strings will be freed in
* nfs_clear_readdir_array()
*/
static
int nfs_readdir_make_qstr(struct qstr *string, const char *name, unsigned int len)
{
string->len = len;
string->name = kmemdup(name, len, GFP_KERNEL);
if (string->name == NULL)
return -ENOMEM;
/*
* Avoid a kmemleak false positive. The pointer to the name is stored
* in a page cache page which kmemleak does not scan.
*/
kmemleak_not_leak(string->name);
string->hash = full_name_hash(name, len);
return 0;
}
static
int nfs_readdir_add_to_array(struct nfs_entry *entry, struct page *page)
{
struct nfs_cache_array *array = nfs_readdir_get_array(page);
struct nfs_cache_array_entry *cache_entry;
int ret;
if (IS_ERR(array))
return PTR_ERR(array);
cache_entry = &array->array[array->size];
/* Check that this entry lies within the page bounds */
ret = -ENOSPC;
if ((char *)&cache_entry[1] - (char *)page_address(page) > PAGE_SIZE)
goto out;
cache_entry->cookie = entry->prev_cookie;
cache_entry->ino = entry->ino;
cache_entry->d_type = entry->d_type;
ret = nfs_readdir_make_qstr(&cache_entry->string, entry->name, entry->len);
if (ret)
goto out;
array->last_cookie = entry->cookie;
array->size++;
if (entry->eof != 0)
array->eof_index = array->size;
out:
nfs_readdir_release_array(page);
return ret;
}
static
int nfs_readdir_search_for_pos(struct nfs_cache_array *array, nfs_readdir_descriptor_t *desc)
{
loff_t diff = desc->ctx->pos - desc->current_index;
unsigned int index;
if (diff < 0)
goto out_eof;
if (diff >= array->size) {
if (array->eof_index >= 0)
goto out_eof;
return -EAGAIN;
}
index = (unsigned int)diff;
*desc->dir_cookie = array->array[index].cookie;
desc->cache_entry_index = index;
return 0;
out_eof:
desc->eof = 1;
return -EBADCOOKIE;
}
static bool
nfs_readdir_inode_mapping_valid(struct nfs_inode *nfsi)
{
if (nfsi->cache_validity & (NFS_INO_INVALID_ATTR|NFS_INO_INVALID_DATA))
return false;
smp_rmb();
return !test_bit(NFS_INO_INVALIDATING, &nfsi->flags);
}
static
int nfs_readdir_search_for_cookie(struct nfs_cache_array *array, nfs_readdir_descriptor_t *desc)
{
int i;
loff_t new_pos;
int status = -EAGAIN;
for (i = 0; i < array->size; i++) {
if (array->array[i].cookie == *desc->dir_cookie) {
struct nfs_inode *nfsi = NFS_I(file_inode(desc->file));
struct nfs_open_dir_context *ctx = desc->file->private_data;
new_pos = desc->current_index + i;
if (ctx->attr_gencount != nfsi->attr_gencount ||
!nfs_readdir_inode_mapping_valid(nfsi)) {
ctx->duped = 0;
ctx->attr_gencount = nfsi->attr_gencount;
} else if (new_pos < desc->ctx->pos) {
if (ctx->duped > 0
&& ctx->dup_cookie == *desc->dir_cookie) {
if (printk_ratelimit()) {
pr_notice("NFS: directory %pD2 contains a readdir loop."
"Please contact your server vendor. "
"The file: %.*s has duplicate cookie %llu\n",
desc->file, array->array[i].string.len,
array->array[i].string.name, *desc->dir_cookie);
}
status = -ELOOP;
goto out;
}
ctx->dup_cookie = *desc->dir_cookie;
ctx->duped = -1;
}
desc->ctx->pos = new_pos;
desc->cache_entry_index = i;
return 0;
}
}
if (array->eof_index >= 0) {
status = -EBADCOOKIE;
if (*desc->dir_cookie == array->last_cookie)
desc->eof = 1;
}
out:
return status;
}
static
int nfs_readdir_search_array(nfs_readdir_descriptor_t *desc)
{
struct nfs_cache_array *array;
int status;
array = nfs_readdir_get_array(desc->page);
if (IS_ERR(array)) {
status = PTR_ERR(array);
goto out;
}
if (*desc->dir_cookie == 0)
status = nfs_readdir_search_for_pos(array, desc);
else
status = nfs_readdir_search_for_cookie(array, desc);
if (status == -EAGAIN) {
desc->last_cookie = array->last_cookie;
desc->current_index += array->size;
desc->page_index++;
}
nfs_readdir_release_array(desc->page);
out:
return status;
}
/* Fill a page with xdr information before transferring to the cache page */
static
int nfs_readdir_xdr_filler(struct page **pages, nfs_readdir_descriptor_t *desc,
struct nfs_entry *entry, struct file *file, struct inode *inode)
{
struct nfs_open_dir_context *ctx = file->private_data;
struct rpc_cred *cred = ctx->cred;
unsigned long timestamp, gencount;
int error;
again:
timestamp = jiffies;
gencount = nfs_inc_attr_generation_counter();
error = NFS_PROTO(inode)->readdir(file->f_path.dentry, cred, entry->cookie, pages,
NFS_SERVER(inode)->dtsize, desc->plus);
if (error < 0) {
/* We requested READDIRPLUS, but the server doesn't grok it */
if (error == -ENOTSUPP && desc->plus) {
NFS_SERVER(inode)->caps &= ~NFS_CAP_READDIRPLUS;
clear_bit(NFS_INO_ADVISE_RDPLUS, &NFS_I(inode)->flags);
desc->plus = 0;
goto again;
}
goto error;
}
desc->timestamp = timestamp;
desc->gencount = gencount;
error:
return error;
}
static int xdr_decode(nfs_readdir_descriptor_t *desc,
struct nfs_entry *entry, struct xdr_stream *xdr)
{
int error;
error = desc->decode(xdr, entry, desc->plus);
if (error)
return error;
entry->fattr->time_start = desc->timestamp;
entry->fattr->gencount = desc->gencount;
return 0;
}
/* Match file and dirent using either filehandle or fileid
* Note: caller is responsible for checking the fsid
*/
static
int nfs_same_file(struct dentry *dentry, struct nfs_entry *entry)
{
struct nfs_inode *nfsi;
if (dentry->d_inode == NULL)
goto different;
nfsi = NFS_I(dentry->d_inode);
if (entry->fattr->fileid == nfsi->fileid)
return 1;
if (nfs_compare_fh(entry->fh, &nfsi->fh) == 0)
return 1;
different:
return 0;
}
static
bool nfs_use_readdirplus(struct inode *dir, struct dir_context *ctx)
{
if (!nfs_server_capable(dir, NFS_CAP_READDIRPLUS))
return false;
if (test_and_clear_bit(NFS_INO_ADVISE_RDPLUS, &NFS_I(dir)->flags))
return true;
if (ctx->pos == 0)
return true;
return false;
}
/*
* This function is called by the lookup code to request the use of
* readdirplus to accelerate any future lookups in the same
* directory.
*/
static
void nfs_advise_use_readdirplus(struct inode *dir)
{
set_bit(NFS_INO_ADVISE_RDPLUS, &NFS_I(dir)->flags);
}
/*
* This function is mainly for use by nfs_getattr().
*
* If this is an 'ls -l', we want to force use of readdirplus.
* Do this by checking if there is an active file descriptor
* and calling nfs_advise_use_readdirplus, then forcing a
* cache flush.
*/
void nfs_force_use_readdirplus(struct inode *dir)
{
if (!list_empty(&NFS_I(dir)->open_files)) {
nfs_advise_use_readdirplus(dir);
nfs_zap_mapping(dir, dir->i_mapping);
}
}
static
void nfs_prime_dcache(struct dentry *parent, struct nfs_entry *entry)
{
struct qstr filename = QSTR_INIT(entry->name, entry->len);
struct dentry *dentry;
struct dentry *alias;
struct inode *dir = parent->d_inode;
struct inode *inode;
int status;
if (!(entry->fattr->valid & NFS_ATTR_FATTR_FILEID))
return;
if (!(entry->fattr->valid & NFS_ATTR_FATTR_FSID))
return;
if (filename.name[0] == '.') {
if (filename.len == 1)
return;
if (filename.len == 2 && filename.name[1] == '.')
return;
}
filename.hash = full_name_hash(filename.name, filename.len);
dentry = d_lookup(parent, &filename);
if (dentry != NULL) {
/* Is there a mountpoint here? If so, just exit */
if (!nfs_fsid_equal(&NFS_SB(dentry->d_sb)->fsid,
&entry->fattr->fsid))
goto out;
if (nfs_same_file(dentry, entry)) {
nfs_set_verifier(dentry, nfs_save_change_attribute(dir));
status = nfs_refresh_inode(dentry->d_inode, entry->fattr);
if (!status)
nfs_setsecurity(dentry->d_inode, entry->fattr, entry->label);
goto out;
} else {
d_invalidate(dentry);
dput(dentry);
}
}
dentry = d_alloc(parent, &filename);
if (dentry == NULL)
return;
inode = nfs_fhget(dentry->d_sb, entry->fh, entry->fattr, entry->label);
if (IS_ERR(inode))
goto out;
alias = d_splice_alias(inode, dentry);
if (IS_ERR(alias))
goto out;
else if (alias) {
nfs_set_verifier(alias, nfs_save_change_attribute(dir));
dput(alias);
} else
nfs_set_verifier(dentry, nfs_save_change_attribute(dir));
out:
dput(dentry);
}
/* Perform conversion from xdr to cache array */
static
int nfs_readdir_page_filler(nfs_readdir_descriptor_t *desc, struct nfs_entry *entry,
struct page **xdr_pages, struct page *page, unsigned int buflen)
{
struct xdr_stream stream;
struct xdr_buf buf;
struct page *scratch;
struct nfs_cache_array *array;
unsigned int count = 0;
int status;
scratch = alloc_page(GFP_KERNEL);
if (scratch == NULL)
return -ENOMEM;
xdr_init_decode_pages(&stream, &buf, xdr_pages, buflen);
xdr_set_scratch_buffer(&stream, page_address(scratch), PAGE_SIZE);
do {
status = xdr_decode(desc, entry, &stream);
if (status != 0) {
if (status == -EAGAIN)
status = 0;
break;
}
count++;
if (desc->plus != 0)
nfs_prime_dcache(desc->file->f_path.dentry, entry);
status = nfs_readdir_add_to_array(entry, page);
if (status != 0)
break;
} while (!entry->eof);
if (count == 0 || (status == -EBADCOOKIE && entry->eof != 0)) {
array = nfs_readdir_get_array(page);
if (!IS_ERR(array)) {
array->eof_index = array->size;
status = 0;
nfs_readdir_release_array(page);
} else
status = PTR_ERR(array);
}
put_page(scratch);
return status;
}
static
void nfs_readdir_free_pagearray(struct page **pages, unsigned int npages)
{
unsigned int i;
for (i = 0; i < npages; i++)
put_page(pages[i]);
}
static
void nfs_readdir_free_large_page(void *ptr, struct page **pages,
unsigned int npages)
{
nfs_readdir_free_pagearray(pages, npages);
}
/*
* nfs_readdir_large_page will allocate pages that must be freed with a call
* to nfs_readdir_free_large_page
*/
static
int nfs_readdir_large_page(struct page **pages, unsigned int npages)
{
unsigned int i;
for (i = 0; i < npages; i++) {
struct page *page = alloc_page(GFP_KERNEL);
if (page == NULL)
goto out_freepages;
pages[i] = page;
}
return 0;
out_freepages:
nfs_readdir_free_pagearray(pages, i);
return -ENOMEM;
}
static
int nfs_readdir_xdr_to_array(nfs_readdir_descriptor_t *desc, struct page *page, struct inode *inode)
{
struct page *pages[NFS_MAX_READDIR_PAGES];
void *pages_ptr = NULL;
struct nfs_entry entry;
struct file *file = desc->file;
struct nfs_cache_array *array;
int status = -ENOMEM;
unsigned int array_size = ARRAY_SIZE(pages);
entry.prev_cookie = 0;
entry.cookie = desc->last_cookie;
entry.eof = 0;
entry.fh = nfs_alloc_fhandle();
entry.fattr = nfs_alloc_fattr();
entry.server = NFS_SERVER(inode);
if (entry.fh == NULL || entry.fattr == NULL)
goto out;
entry.label = nfs4_label_alloc(NFS_SERVER(inode), GFP_NOWAIT);
if (IS_ERR(entry.label)) {
status = PTR_ERR(entry.label);
goto out;
}
array = nfs_readdir_get_array(page);
if (IS_ERR(array)) {
status = PTR_ERR(array);
goto out_label_free;
}
memset(array, 0, sizeof(struct nfs_cache_array));
array->eof_index = -1;
status = nfs_readdir_large_page(pages, array_size);
if (status < 0)
goto out_release_array;
do {
unsigned int pglen;
status = nfs_readdir_xdr_filler(pages, desc, &entry, file, inode);
if (status < 0)
break;
pglen = status;
status = nfs_readdir_page_filler(desc, &entry, pages, page, pglen);
if (status < 0) {
if (status == -ENOSPC)
status = 0;
break;
}
} while (array->eof_index < 0);
nfs_readdir_free_large_page(pages_ptr, pages, array_size);
out_release_array:
nfs_readdir_release_array(page);
out_label_free:
nfs4_label_free(entry.label);
out:
nfs_free_fattr(entry.fattr);
nfs_free_fhandle(entry.fh);
return status;
}
/*
* Now we cache directories properly, by converting xdr information
* to an array that can be used for lookups later. This results in
* fewer cache pages, since we can store more information on each page.
* We only need to convert from xdr once so future lookups are much simpler
*/
static
int nfs_readdir_filler(nfs_readdir_descriptor_t *desc, struct page* page)
{
struct inode *inode = file_inode(desc->file);
int ret;
ret = nfs_readdir_xdr_to_array(desc, page, inode);
if (ret < 0)
goto error;
SetPageUptodate(page);
if (invalidate_inode_pages2_range(inode->i_mapping, page->index + 1, -1) < 0) {
/* Should never happen */
nfs_zap_mapping(inode, inode->i_mapping);
}
unlock_page(page);
return 0;
error:
unlock_page(page);
return ret;
}
static
void cache_page_release(nfs_readdir_descriptor_t *desc)
{
if (!desc->page->mapping)
nfs_readdir_clear_array(desc->page);
page_cache_release(desc->page);
desc->page = NULL;
}
static
struct page *get_cache_page(nfs_readdir_descriptor_t *desc)
{
return read_cache_page(file_inode(desc->file)->i_mapping,
desc->page_index, (filler_t *)nfs_readdir_filler, desc);
}
/*
* Returns 0 if desc->dir_cookie was found on page desc->page_index
*/
static
int find_cache_page(nfs_readdir_descriptor_t *desc)
{
int res;
desc->page = get_cache_page(desc);
if (IS_ERR(desc->page))
return PTR_ERR(desc->page);
res = nfs_readdir_search_array(desc);
if (res != 0)
cache_page_release(desc);
return res;
}
/* Search for desc->dir_cookie from the beginning of the page cache */
static inline
int readdir_search_pagecache(nfs_readdir_descriptor_t *desc)
{
int res;
if (desc->page_index == 0) {
desc->current_index = 0;
desc->last_cookie = 0;
}
do {
res = find_cache_page(desc);
} while (res == -EAGAIN);
return res;
}
/*
* Once we've found the start of the dirent within a page: fill 'er up...
*/
static
int nfs_do_filldir(nfs_readdir_descriptor_t *desc)
{
struct file *file = desc->file;
int i = 0;
int res = 0;
struct nfs_cache_array *array = NULL;
struct nfs_open_dir_context *ctx = file->private_data;
array = nfs_readdir_get_array(desc->page);
if (IS_ERR(array)) {
res = PTR_ERR(array);
goto out;
}
for (i = desc->cache_entry_index; i < array->size; i++) {
struct nfs_cache_array_entry *ent;
ent = &array->array[i];
if (!dir_emit(desc->ctx, ent->string.name, ent->string.len,
nfs_compat_user_ino64(ent->ino), ent->d_type)) {
desc->eof = 1;
break;
}
desc->ctx->pos++;
if (i < (array->size-1))
*desc->dir_cookie = array->array[i+1].cookie;
else
*desc->dir_cookie = array->last_cookie;
if (ctx->duped != 0)
ctx->duped = 1;
}
if (array->eof_index >= 0)
desc->eof = 1;
nfs_readdir_release_array(desc->page);
out:
cache_page_release(desc);
dfprintk(DIRCACHE, "NFS: nfs_do_filldir() filling ended @ cookie %Lu; returning = %d\n",
(unsigned long long)*desc->dir_cookie, res);
return res;
}
/*
* If we cannot find a cookie in our cache, we suspect that this is
* because it points to a deleted file, so we ask the server to return
* whatever it thinks is the next entry. We then feed this to filldir.
* If all goes well, we should then be able to find our way round the
* cache on the next call to readdir_search_pagecache();
*
* NOTE: we cannot add the anonymous page to the pagecache because
* the data it contains might not be page aligned. Besides,
* we should already have a complete representation of the
* directory in the page cache by the time we get here.
*/
static inline
int uncached_readdir(nfs_readdir_descriptor_t *desc)
{
struct page *page = NULL;
int status;
struct inode *inode = file_inode(desc->file);
struct nfs_open_dir_context *ctx = desc->file->private_data;
dfprintk(DIRCACHE, "NFS: uncached_readdir() searching for cookie %Lu\n",
(unsigned long long)*desc->dir_cookie);
page = alloc_page(GFP_HIGHUSER);
if (!page) {
status = -ENOMEM;
goto out;
}
desc->page_index = 0;
desc->last_cookie = *desc->dir_cookie;
desc->page = page;
ctx->duped = 0;
status = nfs_readdir_xdr_to_array(desc, page, inode);
if (status < 0)
goto out_release;
status = nfs_do_filldir(desc);
out:
dfprintk(DIRCACHE, "NFS: %s: returns %d\n",
__func__, status);
return status;
out_release:
cache_page_release(desc);
goto out;
}
static bool nfs_dir_mapping_need_revalidate(struct inode *dir)
{
struct nfs_inode *nfsi = NFS_I(dir);
if (nfs_attribute_cache_expired(dir))
return true;
if (nfsi->cache_validity & NFS_INO_INVALID_DATA)
return true;
return false;
}
/* The file offset position represents the dirent entry number. A
last cookie cache takes care of the common case of reading the
whole directory.
*/
static int nfs_readdir(struct file *file, struct dir_context *ctx)
{
struct dentry *dentry = file->f_path.dentry;
struct inode *inode = dentry->d_inode;
nfs_readdir_descriptor_t my_desc,
*desc = &my_desc;
struct nfs_open_dir_context *dir_ctx = file->private_data;
int res = 0;
dfprintk(FILE, "NFS: readdir(%pD2) starting at cookie %llu\n",
file, (long long)ctx->pos);
nfs_inc_stats(inode, NFSIOS_VFSGETDENTS);
/*
* ctx->pos points to the dirent entry number.
* *desc->dir_cookie has the cookie for the next entry. We have
* to either find the entry with the appropriate number or
* revalidate the cookie.
*/
memset(desc, 0, sizeof(*desc));
desc->file = file;
desc->ctx = ctx;
desc->dir_cookie = &dir_ctx->dir_cookie;
desc->decode = NFS_PROTO(inode)->decode_dirent;
desc->plus = nfs_use_readdirplus(inode, ctx) ? 1 : 0;
nfs_block_sillyrename(dentry);
if (ctx->pos == 0 || nfs_dir_mapping_need_revalidate(inode))
res = nfs_revalidate_mapping(inode, file->f_mapping);
if (res < 0)
goto out;
do {
res = readdir_search_pagecache(desc);
if (res == -EBADCOOKIE) {
res = 0;
/* This means either end of directory */
if (*desc->dir_cookie && desc->eof == 0) {
/* Or that the server has 'lost' a cookie */
res = uncached_readdir(desc);
if (res == 0)
continue;
}
break;
}
if (res == -ETOOSMALL && desc->plus) {
clear_bit(NFS_INO_ADVISE_RDPLUS, &NFS_I(inode)->flags);
nfs_zap_caches(inode);
desc->page_index = 0;
desc->plus = 0;
desc->eof = 0;
continue;
}
if (res < 0)
break;
res = nfs_do_filldir(desc);
if (res < 0)
break;
} while (!desc->eof);
out:
nfs_unblock_sillyrename(dentry);
if (res > 0)
res = 0;
dfprintk(FILE, "NFS: readdir(%pD2) returns %d\n", file, res);
return res;
}
static loff_t nfs_llseek_dir(struct file *filp, loff_t offset, int whence)
{
struct inode *inode = file_inode(filp);
struct nfs_open_dir_context *dir_ctx = filp->private_data;
dfprintk(FILE, "NFS: llseek dir(%pD2, %lld, %d)\n",
filp, offset, whence);
mutex_lock(&inode->i_mutex);
switch (whence) {
case 1:
offset += filp->f_pos;
case 0:
if (offset >= 0)
break;
default:
offset = -EINVAL;
goto out;
}
if (offset != filp->f_pos) {
filp->f_pos = offset;
dir_ctx->dir_cookie = 0;
dir_ctx->duped = 0;
}
out:
mutex_unlock(&inode->i_mutex);
return offset;
}
/*
* All directory operations under NFS are synchronous, so fsync()
* is a dummy operation.
*/
static int nfs_fsync_dir(struct file *filp, loff_t start, loff_t end,
int datasync)
{
struct inode *inode = file_inode(filp);
dfprintk(FILE, "NFS: fsync dir(%pD2) datasync %d\n", filp, datasync);
mutex_lock(&inode->i_mutex);
nfs_inc_stats(inode, NFSIOS_VFSFSYNC);
mutex_unlock(&inode->i_mutex);
return 0;
}
/**
* nfs_force_lookup_revalidate - Mark the directory as having changed
* @dir - pointer to directory inode
*
* This forces the revalidation code in nfs_lookup_revalidate() to do a
* full lookup on all child dentries of 'dir' whenever a change occurs
* on the server that might have invalidated our dcache.
*
* The caller should be holding dir->i_lock
*/
void nfs_force_lookup_revalidate(struct inode *dir)
{
NFS_I(dir)->cache_change_attribute++;
}
EXPORT_SYMBOL_GPL(nfs_force_lookup_revalidate);
/*
* A check for whether or not the parent directory has changed.
* In the case it has, we assume that the dentries are untrustworthy
* and may need to be looked up again.
* If rcu_walk prevents us from performing a full check, return 0.
*/
static int nfs_check_verifier(struct inode *dir, struct dentry *dentry,
int rcu_walk)
{
int ret;
if (IS_ROOT(dentry))
return 1;
if (NFS_SERVER(dir)->flags & NFS_MOUNT_LOOKUP_CACHE_NONE)
return 0;
if (!nfs_verify_change_attribute(dir, dentry->d_time))
return 0;
/* Revalidate nfsi->cache_change_attribute before we declare a match */
if (rcu_walk)
ret = nfs_revalidate_inode_rcu(NFS_SERVER(dir), dir);
else
ret = nfs_revalidate_inode(NFS_SERVER(dir), dir);
if (ret < 0)
return 0;
if (!nfs_verify_change_attribute(dir, dentry->d_time))
return 0;
return 1;
}
/*
* Use intent information to check whether or not we're going to do
* an O_EXCL create using this path component.
*/
static int nfs_is_exclusive_create(struct inode *dir, unsigned int flags)
{
if (NFS_PROTO(dir)->version == 2)
return 0;
return flags & LOOKUP_EXCL;
}
/*
* Inode and filehandle revalidation for lookups.
*
* We force revalidation in the cases where the VFS sets LOOKUP_REVAL,
* or if the intent information indicates that we're about to open this
* particular file and the "nocto" mount flag is not set.
*
*/
static
int nfs_lookup_verify_inode(struct inode *inode, unsigned int flags)
{
struct nfs_server *server = NFS_SERVER(inode);
int ret;
if (IS_AUTOMOUNT(inode))
return 0;
/* VFS wants an on-the-wire revalidation */
if (flags & LOOKUP_REVAL)
goto out_force;
/* This is an open(2) */
if ((flags & LOOKUP_OPEN) && !(server->flags & NFS_MOUNT_NOCTO) &&
(S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode)))
goto out_force;
out:
return (inode->i_nlink == 0) ? -ENOENT : 0;
out_force:
if (flags & LOOKUP_RCU)
return -ECHILD;
ret = __nfs_revalidate_inode(server, inode);
if (ret != 0)
return ret;
goto out;
}
/*
* We judge how long we want to trust negative
* dentries by looking at the parent inode mtime.
*
* If parent mtime has changed, we revalidate, else we wait for a
* period corresponding to the parent's attribute cache timeout value.
*
* If LOOKUP_RCU prevents us from performing a full check, return 1
* suggesting a reval is needed.
*/
static inline
int nfs_neg_need_reval(struct inode *dir, struct dentry *dentry,
unsigned int flags)
{
/* Don't revalidate a negative dentry if we're creating a new file */
if (flags & LOOKUP_CREATE)
return 0;
if (NFS_SERVER(dir)->flags & NFS_MOUNT_LOOKUP_CACHE_NONEG)
return 1;
return !nfs_check_verifier(dir, dentry, flags & LOOKUP_RCU);
}
/*
* This is called every time the dcache has a lookup hit,
* and we should check whether we can really trust that
* lookup.
*
* NOTE! The hit can be a negative hit too, don't assume
* we have an inode!
*
* If the parent directory is seen to have changed, we throw out the
* cached dentry and do a new lookup.
*/
static int nfs_lookup_revalidate(struct dentry *dentry, unsigned int flags)
{
struct inode *dir;
struct inode *inode;
struct dentry *parent;
struct nfs_fh *fhandle = NULL;
struct nfs_fattr *fattr = NULL;
struct nfs4_label *label = NULL;
int error;
if (flags & LOOKUP_RCU) {
parent = ACCESS_ONCE(dentry->d_parent);
dir = ACCESS_ONCE(parent->d_inode);
if (!dir)
return -ECHILD;
} else {
parent = dget_parent(dentry);
dir = parent->d_inode;
}
nfs_inc_stats(dir, NFSIOS_DENTRYREVALIDATE);
inode = dentry->d_inode;
if (!inode) {
if (nfs_neg_need_reval(dir, dentry, flags)) {
if (flags & LOOKUP_RCU)
return -ECHILD;
goto out_bad;
}
goto out_valid_noent;
}
if (is_bad_inode(inode)) {
if (flags & LOOKUP_RCU)
return -ECHILD;
dfprintk(LOOKUPCACHE, "%s: %pd2 has dud inode\n",
__func__, dentry);
goto out_bad;
}
if (NFS_PROTO(dir)->have_delegation(inode, FMODE_READ))
goto out_set_verifier;
/* Force a full look up iff the parent directory has changed */
if (!nfs_is_exclusive_create(dir, flags) &&
nfs_check_verifier(dir, dentry, flags & LOOKUP_RCU)) {
if (nfs_lookup_verify_inode(inode, flags)) {
if (flags & LOOKUP_RCU)
return -ECHILD;
goto out_zap_parent;
}
goto out_valid;
}
if (flags & LOOKUP_RCU)
return -ECHILD;
if (NFS_STALE(inode))
goto out_bad;
error = -ENOMEM;
fhandle = nfs_alloc_fhandle();
fattr = nfs_alloc_fattr();
if (fhandle == NULL || fattr == NULL)
goto out_error;
label = nfs4_label_alloc(NFS_SERVER(inode), GFP_NOWAIT);
if (IS_ERR(label))
goto out_error;
trace_nfs_lookup_revalidate_enter(dir, dentry, flags);
error = NFS_PROTO(dir)->lookup(dir, &dentry->d_name, fhandle, fattr, label);
trace_nfs_lookup_revalidate_exit(dir, dentry, flags, error);
if (error)
goto out_bad;
if (nfs_compare_fh(NFS_FH(inode), fhandle))
goto out_bad;
if ((error = nfs_refresh_inode(inode, fattr)) != 0)
goto out_bad;
nfs_setsecurity(inode, fattr, label);
nfs_free_fattr(fattr);
nfs_free_fhandle(fhandle);
nfs4_label_free(label);
out_set_verifier:
nfs_set_verifier(dentry, nfs_save_change_attribute(dir));
out_valid:
/* Success: notify readdir to use READDIRPLUS */
nfs_advise_use_readdirplus(dir);
out_valid_noent:
if (flags & LOOKUP_RCU) {
if (parent != ACCESS_ONCE(dentry->d_parent))
return -ECHILD;
} else
dput(parent);
dfprintk(LOOKUPCACHE, "NFS: %s(%pd2) is valid\n",
__func__, dentry);
return 1;
out_zap_parent:
nfs_zap_caches(dir);
out_bad:
WARN_ON(flags & LOOKUP_RCU);
nfs_free_fattr(fattr);
nfs_free_fhandle(fhandle);
nfs4_label_free(label);
nfs_mark_for_revalidate(dir);
if (inode && S_ISDIR(inode->i_mode)) {
/* Purge readdir caches. */
nfs_zap_caches(inode);
/*
* We can't d_drop the root of a disconnected tree:
* its d_hash is on the s_anon list and d_drop() would hide
* it from shrink_dcache_for_unmount(), leading to busy
* inodes on unmount and further oopses.
*/
if (IS_ROOT(dentry))
goto out_valid;
}
dput(parent);
dfprintk(LOOKUPCACHE, "NFS: %s(%pd2) is invalid\n",
__func__, dentry);
return 0;
out_error:
WARN_ON(flags & LOOKUP_RCU);
nfs_free_fattr(fattr);
nfs_free_fhandle(fhandle);
nfs4_label_free(label);
dput(parent);
dfprintk(LOOKUPCACHE, "NFS: %s(%pd2) lookup returned error %d\n",
__func__, dentry, error);
return error;
}
/*
* A weaker form of d_revalidate for revalidating just the dentry->d_inode
* when we don't really care about the dentry name. This is called when a
* pathwalk ends on a dentry that was not found via a normal lookup in the
* parent dir (e.g.: ".", "..", procfs symlinks or mountpoint traversals).
*
* In this situation, we just want to verify that the inode itself is OK
* since the dentry might have changed on the server.
*/
static int nfs_weak_revalidate(struct dentry *dentry, unsigned int flags)
{
int error;
struct inode *inode = dentry->d_inode;
/*
* I believe we can only get a negative dentry here in the case of a
* procfs-style symlink. Just assume it's correct for now, but we may
* eventually need to do something more here.
*/
if (!inode) {
dfprintk(LOOKUPCACHE, "%s: %pd2 has negative inode\n",
__func__, dentry);
return 1;
}
if (is_bad_inode(inode)) {
dfprintk(LOOKUPCACHE, "%s: %pd2 has dud inode\n",
__func__, dentry);
return 0;
}
error = nfs_revalidate_inode(NFS_SERVER(inode), inode);
dfprintk(LOOKUPCACHE, "NFS: %s: inode %lu is %s\n",
__func__, inode->i_ino, error ? "invalid" : "valid");
return !error;
}
/*
* This is called from dput() when d_count is going to 0.
*/
static int nfs_dentry_delete(const struct dentry *dentry)
{
dfprintk(VFS, "NFS: dentry_delete(%pd2, %x)\n",
dentry, dentry->d_flags);
/* Unhash any dentry with a stale inode */
if (dentry->d_inode != NULL && NFS_STALE(dentry->d_inode))
return 1;
if (dentry->d_flags & DCACHE_NFSFS_RENAMED) {
/* Unhash it, so that ->d_iput() would be called */
return 1;
}
if (!(dentry->d_sb->s_flags & MS_ACTIVE)) {
/* Unhash it, so that ancestors of killed async unlink
* files will be cleaned up during umount */
return 1;
}
return 0;
}
/* Ensure that we revalidate inode->i_nlink */
static void nfs_drop_nlink(struct inode *inode)
{
spin_lock(&inode->i_lock);
/* drop the inode if we're reasonably sure this is the last link */
if (inode->i_nlink == 1)
clear_nlink(inode);
NFS_I(inode)->cache_validity |= NFS_INO_INVALID_ATTR;
spin_unlock(&inode->i_lock);
}
/*
* Called when the dentry loses inode.
* We use it to clean up silly-renamed files.
*/
static void nfs_dentry_iput(struct dentry *dentry, struct inode *inode)
{
if (S_ISDIR(inode->i_mode))
/* drop any readdir cache as it could easily be old */
NFS_I(inode)->cache_validity |= NFS_INO_INVALID_DATA;
if (dentry->d_flags & DCACHE_NFSFS_RENAMED) {
nfs_complete_unlink(dentry, inode);
nfs_drop_nlink(inode);
}
iput(inode);
}
static void nfs_d_release(struct dentry *dentry)
{
/* free cached devname value, if it survived that far */
if (unlikely(dentry->d_fsdata)) {
if (dentry->d_flags & DCACHE_NFSFS_RENAMED)
WARN_ON(1);
else
kfree(dentry->d_fsdata);
}
}
const struct dentry_operations nfs_dentry_operations = {
.d_revalidate = nfs_lookup_revalidate,
.d_weak_revalidate = nfs_weak_revalidate,
.d_delete = nfs_dentry_delete,
.d_iput = nfs_dentry_iput,
.d_automount = nfs_d_automount,
.d_release = nfs_d_release,
};
EXPORT_SYMBOL_GPL(nfs_dentry_operations);
struct dentry *nfs_lookup(struct inode *dir, struct dentry * dentry, unsigned int flags)
{
struct dentry *res;
struct dentry *parent;
struct inode *inode = NULL;
struct nfs_fh *fhandle = NULL;
struct nfs_fattr *fattr = NULL;
struct nfs4_label *label = NULL;
int error;
dfprintk(VFS, "NFS: lookup(%pd2)\n", dentry);
nfs_inc_stats(dir, NFSIOS_VFSLOOKUP);
res = ERR_PTR(-ENAMETOOLONG);
if (dentry->d_name.len > NFS_SERVER(dir)->namelen)
goto out;
/*
* If we're doing an exclusive create, optimize away the lookup
* but don't hash the dentry.
*/
if (nfs_is_exclusive_create(dir, flags)) {
d_instantiate(dentry, NULL);
res = NULL;
goto out;
}
res = ERR_PTR(-ENOMEM);
fhandle = nfs_alloc_fhandle();
fattr = nfs_alloc_fattr();
if (fhandle == NULL || fattr == NULL)
goto out;
label = nfs4_label_alloc(NFS_SERVER(dir), GFP_NOWAIT);
if (IS_ERR(label))
goto out;
parent = dentry->d_parent;
/* Protect against concurrent sillydeletes */
trace_nfs_lookup_enter(dir, dentry, flags);
nfs_block_sillyrename(parent);
error = NFS_PROTO(dir)->lookup(dir, &dentry->d_name, fhandle, fattr, label);
if (error == -ENOENT)
goto no_entry;
if (error < 0) {
res = ERR_PTR(error);
goto out_unblock_sillyrename;
}
inode = nfs_fhget(dentry->d_sb, fhandle, fattr, label);
res = ERR_CAST(inode);
if (IS_ERR(res))
goto out_unblock_sillyrename;
/* Success: notify readdir to use READDIRPLUS */
nfs_advise_use_readdirplus(dir);
no_entry:
res = d_splice_alias(inode, dentry);
if (res != NULL) {
if (IS_ERR(res))
goto out_unblock_sillyrename;
dentry = res;
}
nfs_set_verifier(dentry, nfs_save_change_attribute(dir));
out_unblock_sillyrename:
nfs_unblock_sillyrename(parent);
trace_nfs_lookup_exit(dir, dentry, flags, error);
nfs4_label_free(label);
out:
nfs_free_fattr(fattr);
nfs_free_fhandle(fhandle);
return res;
}
EXPORT_SYMBOL_GPL(nfs_lookup);
#if IS_ENABLED(CONFIG_NFS_V4)
static int nfs4_lookup_revalidate(struct dentry *, unsigned int);
const struct dentry_operations nfs4_dentry_operations = {
.d_revalidate = nfs4_lookup_revalidate,
.d_delete = nfs_dentry_delete,
.d_iput = nfs_dentry_iput,
.d_automount = nfs_d_automount,
.d_release = nfs_d_release,
};
EXPORT_SYMBOL_GPL(nfs4_dentry_operations);
static fmode_t flags_to_mode(int flags)
{
fmode_t res = (__force fmode_t)flags & FMODE_EXEC;
if ((flags & O_ACCMODE) != O_WRONLY)
res |= FMODE_READ;
if ((flags & O_ACCMODE) != O_RDONLY)
res |= FMODE_WRITE;
return res;
}
static struct nfs_open_context *create_nfs_open_context(struct dentry *dentry, int open_flags)
{
return alloc_nfs_open_context(dentry, flags_to_mode(open_flags));
}
static int do_open(struct inode *inode, struct file *filp)
{
nfs_fscache_open_file(inode, filp);
return 0;
}
static int nfs_finish_open(struct nfs_open_context *ctx,
struct dentry *dentry,
struct file *file, unsigned open_flags,
int *opened)
{
int err;
if ((open_flags & (O_CREAT | O_EXCL)) == (O_CREAT | O_EXCL))
*opened |= FILE_CREATED;
err = finish_open(file, dentry, do_open, opened);
if (err)
goto out;
nfs_file_set_open_context(file, ctx);
out:
return err;
}
int nfs_atomic_open(struct inode *dir, struct dentry *dentry,
struct file *file, unsigned open_flags,
umode_t mode, int *opened)
{
struct nfs_open_context *ctx;
struct dentry *res;
struct iattr attr = { .ia_valid = ATTR_OPEN };
struct inode *inode;
unsigned int lookup_flags = 0;
int err;
/* Expect a negative dentry */
BUG_ON(dentry->d_inode);
dfprintk(VFS, "NFS: atomic_open(%s/%lu), %pd\n",
dir->i_sb->s_id, dir->i_ino, dentry);
err = nfs_check_flags(open_flags);
if (err)
return err;
/* NFS only supports OPEN on regular files */
if ((open_flags & O_DIRECTORY)) {
if (!d_unhashed(dentry)) {
/*
* Hashed negative dentry with O_DIRECTORY: dentry was
* revalidated and is fine, no need to perform lookup
* again
*/
return -ENOENT;
}
lookup_flags = LOOKUP_OPEN|LOOKUP_DIRECTORY;
goto no_open;
}
if (dentry->d_name.len > NFS_SERVER(dir)->namelen)
return -ENAMETOOLONG;
if (open_flags & O_CREAT) {
attr.ia_valid |= ATTR_MODE;
attr.ia_mode = mode & ~current_umask();
}
if (open_flags & O_TRUNC) {
attr.ia_valid |= ATTR_SIZE;
attr.ia_size = 0;
}
ctx = create_nfs_open_context(dentry, open_flags);
err = PTR_ERR(ctx);
if (IS_ERR(ctx))
goto out;
trace_nfs_atomic_open_enter(dir, ctx, open_flags);
nfs_block_sillyrename(dentry->d_parent);
inode = NFS_PROTO(dir)->open_context(dir, ctx, open_flags, &attr, opened);
nfs_unblock_sillyrename(dentry->d_parent);
if (IS_ERR(inode)) {
err = PTR_ERR(inode);
trace_nfs_atomic_open_exit(dir, ctx, open_flags, err);
put_nfs_open_context(ctx);
switch (err) {
case -ENOENT:
d_drop(dentry);
d_add(dentry, NULL);
nfs_set_verifier(dentry, nfs_save_change_attribute(dir));
break;
case -EISDIR:
case -ENOTDIR:
goto no_open;
case -ELOOP:
if (!(open_flags & O_NOFOLLOW))
goto no_open;
break;
/* case -EINVAL: */
default:
break;
}
goto out;
}
err = nfs_finish_open(ctx, ctx->dentry, file, open_flags, opened);
trace_nfs_atomic_open_exit(dir, ctx, open_flags, err);
put_nfs_open_context(ctx);
out:
return err;
no_open:
res = nfs_lookup(dir, dentry, lookup_flags);
err = PTR_ERR(res);
if (IS_ERR(res))
goto out;
return finish_no_open(file, res);
}
EXPORT_SYMBOL_GPL(nfs_atomic_open);
static int nfs4_lookup_revalidate(struct dentry *dentry, unsigned int flags)
{
struct inode *inode;
int ret = 0;
if (!(flags & LOOKUP_OPEN) || (flags & LOOKUP_DIRECTORY))
goto no_open;
if (d_mountpoint(dentry))
goto no_open;
if (NFS_SB(dentry->d_sb)->caps & NFS_CAP_ATOMIC_OPEN_V1)
goto no_open;
inode = dentry->d_inode;
/* We can't create new files in nfs_open_revalidate(), so we
* optimize away revalidation of negative dentries.
*/
if (inode == NULL) {
struct dentry *parent;
struct inode *dir;
if (flags & LOOKUP_RCU) {
parent = ACCESS_ONCE(dentry->d_parent);
dir = ACCESS_ONCE(parent->d_inode);
if (!dir)
return -ECHILD;
} else {
parent = dget_parent(dentry);
dir = parent->d_inode;
}
if (!nfs_neg_need_reval(dir, dentry, flags))
ret = 1;
else if (flags & LOOKUP_RCU)
ret = -ECHILD;
if (!(flags & LOOKUP_RCU))
dput(parent);
else if (parent != ACCESS_ONCE(dentry->d_parent))
return -ECHILD;
goto out;
}
/* NFS only supports OPEN on regular files */
if (!S_ISREG(inode->i_mode))
goto no_open;
/* We cannot do exclusive creation on a positive dentry */
if (flags & LOOKUP_EXCL)
goto no_open;
/* Let f_op->open() actually open (and revalidate) the file */
ret = 1;
out:
return ret;
no_open:
return nfs_lookup_revalidate(dentry, flags);
}
#endif /* CONFIG_NFSV4 */
/*
* Code common to create, mkdir, and mknod.
*/
int nfs_instantiate(struct dentry *dentry, struct nfs_fh *fhandle,
struct nfs_fattr *fattr,
struct nfs4_label *label)
{
struct dentry *parent = dget_parent(dentry);
struct inode *dir = parent->d_inode;
struct inode *inode;
int error = -EACCES;
d_drop(dentry);
/* We may have been initialized further down */
if (dentry->d_inode)
goto out;
if (fhandle->size == 0) {
error = NFS_PROTO(dir)->lookup(dir, &dentry->d_name, fhandle, fattr, NULL);
if (error)
goto out_error;
}
nfs_set_verifier(dentry, nfs_save_change_attribute(dir));
if (!(fattr->valid & NFS_ATTR_FATTR)) {
struct nfs_server *server = NFS_SB(dentry->d_sb);
error = server->nfs_client->rpc_ops->getattr(server, fhandle, fattr, NULL);
if (error < 0)
goto out_error;
}
inode = nfs_fhget(dentry->d_sb, fhandle, fattr, label);
error = PTR_ERR(inode);
if (IS_ERR(inode))
goto out_error;
d_add(dentry, inode);
out:
dput(parent);
return 0;
out_error:
nfs_mark_for_revalidate(dir);
dput(parent);
return error;
}
EXPORT_SYMBOL_GPL(nfs_instantiate);
/*
* Following a failed create operation, we drop the dentry rather
* than retain a negative dentry. This avoids a problem in the event
* that the operation succeeded on the server, but an error in the
* reply path made it appear to have failed.
*/
int nfs_create(struct inode *dir, struct dentry *dentry,
umode_t mode, bool excl)
{
struct iattr attr;
int open_flags = excl ? O_CREAT | O_EXCL : O_CREAT;
int error;
dfprintk(VFS, "NFS: create(%s/%lu), %pd\n",
dir->i_sb->s_id, dir->i_ino, dentry);
attr.ia_mode = mode;
attr.ia_valid = ATTR_MODE;
trace_nfs_create_enter(dir, dentry, open_flags);
error = NFS_PROTO(dir)->create(dir, dentry, &attr, open_flags);
trace_nfs_create_exit(dir, dentry, open_flags, error);
if (error != 0)
goto out_err;
return 0;
out_err:
d_drop(dentry);
return error;
}
EXPORT_SYMBOL_GPL(nfs_create);
/*
* See comments for nfs_proc_create regarding failed operations.
*/
int
nfs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, dev_t rdev)
{
struct iattr attr;
int status;
dfprintk(VFS, "NFS: mknod(%s/%lu), %pd\n",
dir->i_sb->s_id, dir->i_ino, dentry);
if (!new_valid_dev(rdev))
return -EINVAL;
attr.ia_mode = mode;
attr.ia_valid = ATTR_MODE;
trace_nfs_mknod_enter(dir, dentry);
status = NFS_PROTO(dir)->mknod(dir, dentry, &attr, rdev);
trace_nfs_mknod_exit(dir, dentry, status);
if (status != 0)
goto out_err;
return 0;
out_err:
d_drop(dentry);
return status;
}
EXPORT_SYMBOL_GPL(nfs_mknod);
/*
* See comments for nfs_proc_create regarding failed operations.
*/
int nfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
{
struct iattr attr;
int error;
dfprintk(VFS, "NFS: mkdir(%s/%lu), %pd\n",
dir->i_sb->s_id, dir->i_ino, dentry);
attr.ia_valid = ATTR_MODE;
attr.ia_mode = mode | S_IFDIR;
trace_nfs_mkdir_enter(dir, dentry);
error = NFS_PROTO(dir)->mkdir(dir, dentry, &attr);
trace_nfs_mkdir_exit(dir, dentry, error);
if (error != 0)
goto out_err;
return 0;
out_err:
d_drop(dentry);
return error;
}
EXPORT_SYMBOL_GPL(nfs_mkdir);
static void nfs_dentry_handle_enoent(struct dentry *dentry)
{
if (dentry->d_inode != NULL && !d_unhashed(dentry))
d_delete(dentry);
}
int nfs_rmdir(struct inode *dir, struct dentry *dentry)
{
int error;
dfprintk(VFS, "NFS: rmdir(%s/%lu), %pd\n",
dir->i_sb->s_id, dir->i_ino, dentry);
trace_nfs_rmdir_enter(dir, dentry);
if (dentry->d_inode) {
nfs_wait_on_sillyrename(dentry);
error = NFS_PROTO(dir)->rmdir(dir, &dentry->d_name);
/* Ensure the VFS deletes this inode */
switch (error) {
case 0:
clear_nlink(dentry->d_inode);
break;
case -ENOENT:
nfs_dentry_handle_enoent(dentry);
}
} else
error = NFS_PROTO(dir)->rmdir(dir, &dentry->d_name);
trace_nfs_rmdir_exit(dir, dentry, error);
return error;
}
EXPORT_SYMBOL_GPL(nfs_rmdir);
/*
* Remove a file after making sure there are no pending writes,
* and after checking that the file has only one user.
*
* We invalidate the attribute cache and free the inode prior to the operation
* to avoid possible races if the server reuses the inode.
*/
static int nfs_safe_remove(struct dentry *dentry)
{
struct inode *dir = dentry->d_parent->d_inode;
struct inode *inode = dentry->d_inode;
int error = -EBUSY;
dfprintk(VFS, "NFS: safe_remove(%pd2)\n", dentry);
/* If the dentry was sillyrenamed, we simply call d_delete() */
if (dentry->d_flags & DCACHE_NFSFS_RENAMED) {
error = 0;
goto out;
}
trace_nfs_remove_enter(dir, dentry);
if (inode != NULL) {
NFS_PROTO(inode)->return_delegation(inode);
error = NFS_PROTO(dir)->remove(dir, &dentry->d_name);
if (error == 0)
nfs_drop_nlink(inode);
} else
error = NFS_PROTO(dir)->remove(dir, &dentry->d_name);
if (error == -ENOENT)
nfs_dentry_handle_enoent(dentry);
trace_nfs_remove_exit(dir, dentry, error);
out:
return error;
}
/* We do silly rename. In case sillyrename() returns -EBUSY, the inode
* belongs to an active ".nfs..." file and we return -EBUSY.
*
* If sillyrename() returns 0, we do nothing, otherwise we unlink.
*/
int nfs_unlink(struct inode *dir, struct dentry *dentry)
{
int error;
int need_rehash = 0;
dfprintk(VFS, "NFS: unlink(%s/%lu, %pd)\n", dir->i_sb->s_id,
dir->i_ino, dentry);
trace_nfs_unlink_enter(dir, dentry);
spin_lock(&dentry->d_lock);
if (d_count(dentry) > 1) {
spin_unlock(&dentry->d_lock);
/* Start asynchronous writeout of the inode */
write_inode_now(dentry->d_inode, 0);
error = nfs_sillyrename(dir, dentry);
goto out;
}
if (!d_unhashed(dentry)) {
__d_drop(dentry);
need_rehash = 1;
}
spin_unlock(&dentry->d_lock);
error = nfs_safe_remove(dentry);
if (!error || error == -ENOENT) {
nfs_set_verifier(dentry, nfs_save_change_attribute(dir));
} else if (need_rehash)
d_rehash(dentry);
out:
trace_nfs_unlink_exit(dir, dentry, error);
return error;
}
EXPORT_SYMBOL_GPL(nfs_unlink);
/*
* To create a symbolic link, most file systems instantiate a new inode,
* add a page to it containing the path, then write it out to the disk
* using prepare_write/commit_write.
*
* Unfortunately the NFS client can't create the in-core inode first
* because it needs a file handle to create an in-core inode (see
* fs/nfs/inode.c:nfs_fhget). We only have a file handle *after* the
* symlink request has completed on the server.
*
* So instead we allocate a raw page, copy the symname into it, then do
* the SYMLINK request with the page as the buffer. If it succeeds, we
* now have a new file handle and can instantiate an in-core NFS inode
* and move the raw page into its mapping.
*/
int nfs_symlink(struct inode *dir, struct dentry *dentry, const char *symname)
{
struct page *page;
char *kaddr;
struct iattr attr;
unsigned int pathlen = strlen(symname);
int error;
dfprintk(VFS, "NFS: symlink(%s/%lu, %pd, %s)\n", dir->i_sb->s_id,
dir->i_ino, dentry, symname);
if (pathlen > PAGE_SIZE)
return -ENAMETOOLONG;
attr.ia_mode = S_IFLNK | S_IRWXUGO;
attr.ia_valid = ATTR_MODE;
page = alloc_page(GFP_HIGHUSER);
if (!page)
return -ENOMEM;
kaddr = kmap_atomic(page);
memcpy(kaddr, symname, pathlen);
if (pathlen < PAGE_SIZE)
memset(kaddr + pathlen, 0, PAGE_SIZE - pathlen);
kunmap_atomic(kaddr);
trace_nfs_symlink_enter(dir, dentry);
error = NFS_PROTO(dir)->symlink(dir, dentry, page, pathlen, &attr);
trace_nfs_symlink_exit(dir, dentry, error);
if (error != 0) {
dfprintk(VFS, "NFS: symlink(%s/%lu, %pd, %s) error %d\n",
dir->i_sb->s_id, dir->i_ino,
dentry, symname, error);
d_drop(dentry);
__free_page(page);
return error;
}
/*
* No big deal if we can't add this page to the page cache here.
* READLINK will get the missing page from the server if needed.
*/
if (!add_to_page_cache_lru(page, dentry->d_inode->i_mapping, 0,
GFP_KERNEL)) {
SetPageUptodate(page);
unlock_page(page);
/*
* add_to_page_cache_lru() grabs an extra page refcount.
* Drop it here to avoid leaking this page later.
*/
page_cache_release(page);
} else
__free_page(page);
return 0;
}
EXPORT_SYMBOL_GPL(nfs_symlink);
int
nfs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry)
{
struct inode *inode = old_dentry->d_inode;
int error;
dfprintk(VFS, "NFS: link(%pd2 -> %pd2)\n",
old_dentry, dentry);
trace_nfs_link_enter(inode, dir, dentry);
NFS_PROTO(inode)->return_delegation(inode);
d_drop(dentry);
error = NFS_PROTO(dir)->link(inode, dir, &dentry->d_name);
if (error == 0) {
ihold(inode);
d_add(dentry, inode);
}
trace_nfs_link_exit(inode, dir, dentry, error);
return error;
}
EXPORT_SYMBOL_GPL(nfs_link);
/*
* RENAME
* FIXME: Some nfsds, like the Linux user space nfsd, may generate a
* different file handle for the same inode after a rename (e.g. when
* moving to a different directory). A fail-safe method to do so would
* be to look up old_dir/old_name, create a link to new_dir/new_name and
* rename the old file using the sillyrename stuff. This way, the original
* file in old_dir will go away when the last process iput()s the inode.
*
* FIXED.
*
* It actually works quite well. One needs to have the possibility for
* at least one ".nfs..." file in each directory the file ever gets
* moved or linked to which happens automagically with the new
* implementation that only depends on the dcache stuff instead of
* using the inode layer
*
* Unfortunately, things are a little more complicated than indicated
* above. For a cross-directory move, we want to make sure we can get
* rid of the old inode after the operation. This means there must be
* no pending writes (if it's a file), and the use count must be 1.
* If these conditions are met, we can drop the dentries before doing
* the rename.
*/
int nfs_rename(struct inode *old_dir, struct dentry *old_dentry,
struct inode *new_dir, struct dentry *new_dentry)
{
struct inode *old_inode = old_dentry->d_inode;
struct inode *new_inode = new_dentry->d_inode;
struct dentry *dentry = NULL, *rehash = NULL;
struct rpc_task *task;
int error = -EBUSY;
dfprintk(VFS, "NFS: rename(%pd2 -> %pd2, ct=%d)\n",
old_dentry, new_dentry,
d_count(new_dentry));
trace_nfs_rename_enter(old_dir, old_dentry, new_dir, new_dentry);
/*
* For non-directories, check whether the target is busy and if so,
* make a copy of the dentry and then do a silly-rename. If the
* silly-rename succeeds, the copied dentry is hashed and becomes
* the new target.
*/
if (new_inode && !S_ISDIR(new_inode->i_mode)) {
/*
* To prevent any new references to the target during the
* rename, we unhash the dentry in advance.
*/
if (!d_unhashed(new_dentry)) {
d_drop(new_dentry);
rehash = new_dentry;
}
if (d_count(new_dentry) > 2) {
int err;
/* copy the target dentry's name */
dentry = d_alloc(new_dentry->d_parent,
&new_dentry->d_name);
if (!dentry)
goto out;
/* silly-rename the existing target ... */
err = nfs_sillyrename(new_dir, new_dentry);
if (err)
goto out;
new_dentry = dentry;
rehash = NULL;
new_inode = NULL;
}
}
NFS_PROTO(old_inode)->return_delegation(old_inode);
if (new_inode != NULL)
NFS_PROTO(new_inode)->return_delegation(new_inode);
task = nfs_async_rename(old_dir, new_dir, old_dentry, new_dentry, NULL);
if (IS_ERR(task)) {
error = PTR_ERR(task);
goto out;
}
error = rpc_wait_for_completion_task(task);
if (error == 0)
error = task->tk_status;
rpc_put_task(task);
nfs_mark_for_revalidate(old_inode);
out:
if (rehash)
d_rehash(rehash);
trace_nfs_rename_exit(old_dir, old_dentry,
new_dir, new_dentry, error);
if (!error) {
if (new_inode != NULL)
nfs_drop_nlink(new_inode);
d_move(old_dentry, new_dentry);
nfs_set_verifier(new_dentry,
nfs_save_change_attribute(new_dir));
} else if (error == -ENOENT)
nfs_dentry_handle_enoent(old_dentry);
/* new dentry created? */
if (dentry)
dput(dentry);
return error;
}
EXPORT_SYMBOL_GPL(nfs_rename);
static DEFINE_SPINLOCK(nfs_access_lru_lock);
static LIST_HEAD(nfs_access_lru_list);
static atomic_long_t nfs_access_nr_entries;
static unsigned long nfs_access_max_cachesize = ULONG_MAX;
module_param(nfs_access_max_cachesize, ulong, 0644);
MODULE_PARM_DESC(nfs_access_max_cachesize, "NFS access maximum total cache length");
static void nfs_access_free_entry(struct nfs_access_entry *entry)
{
put_rpccred(entry->cred);
kfree_rcu(entry, rcu_head);
smp_mb__before_atomic();
atomic_long_dec(&nfs_access_nr_entries);
smp_mb__after_atomic();
}
static void nfs_access_free_list(struct list_head *head)
{
struct nfs_access_entry *cache;
while (!list_empty(head)) {
cache = list_entry(head->next, struct nfs_access_entry, lru);
list_del(&cache->lru);
nfs_access_free_entry(cache);
}
}
static unsigned long
nfs_do_access_cache_scan(unsigned int nr_to_scan)
{
LIST_HEAD(head);
struct nfs_inode *nfsi, *next;
struct nfs_access_entry *cache;
long freed = 0;
spin_lock(&nfs_access_lru_lock);
list_for_each_entry_safe(nfsi, next, &nfs_access_lru_list, access_cache_inode_lru) {
struct inode *inode;
if (nr_to_scan-- == 0)
break;
inode = &nfsi->vfs_inode;
spin_lock(&inode->i_lock);
if (list_empty(&nfsi->access_cache_entry_lru))
goto remove_lru_entry;
cache = list_entry(nfsi->access_cache_entry_lru.next,
struct nfs_access_entry, lru);
list_move(&cache->lru, &head);
rb_erase(&cache->rb_node, &nfsi->access_cache);
freed++;
if (!list_empty(&nfsi->access_cache_entry_lru))
list_move_tail(&nfsi->access_cache_inode_lru,
&nfs_access_lru_list);
else {
remove_lru_entry:
list_del_init(&nfsi->access_cache_inode_lru);
smp_mb__before_atomic();
clear_bit(NFS_INO_ACL_LRU_SET, &nfsi->flags);
smp_mb__after_atomic();
}
spin_unlock(&inode->i_lock);
}
spin_unlock(&nfs_access_lru_lock);
nfs_access_free_list(&head);
return freed;
}
unsigned long
nfs_access_cache_scan(struct shrinker *shrink, struct shrink_control *sc)
{
int nr_to_scan = sc->nr_to_scan;
gfp_t gfp_mask = sc->gfp_mask;
if ((gfp_mask & GFP_KERNEL) != GFP_KERNEL)
return SHRINK_STOP;
return nfs_do_access_cache_scan(nr_to_scan);
}
unsigned long
nfs_access_cache_count(struct shrinker *shrink, struct shrink_control *sc)
{
return vfs_pressure_ratio(atomic_long_read(&nfs_access_nr_entries));
}
static void
nfs_access_cache_enforce_limit(void)
{
long nr_entries = atomic_long_read(&nfs_access_nr_entries);
unsigned long diff;
unsigned int nr_to_scan;
if (nr_entries < 0 || nr_entries <= nfs_access_max_cachesize)
return;
nr_to_scan = 100;
diff = nr_entries - nfs_access_max_cachesize;
if (diff < nr_to_scan)
nr_to_scan = diff;
nfs_do_access_cache_scan(nr_to_scan);
}
static void __nfs_access_zap_cache(struct nfs_inode *nfsi, struct list_head *head)
{
struct rb_root *root_node = &nfsi->access_cache;
struct rb_node *n;
struct nfs_access_entry *entry;
/* Unhook entries from the cache */
while ((n = rb_first(root_node)) != NULL) {
entry = rb_entry(n, struct nfs_access_entry, rb_node);
rb_erase(n, root_node);
list_move(&entry->lru, head);
}
nfsi->cache_validity &= ~NFS_INO_INVALID_ACCESS;
}
void nfs_access_zap_cache(struct inode *inode)
{
LIST_HEAD(head);
if (test_bit(NFS_INO_ACL_LRU_SET, &NFS_I(inode)->flags) == 0)
return;
/* Remove from global LRU init */
spin_lock(&nfs_access_lru_lock);
if (test_and_clear_bit(NFS_INO_ACL_LRU_SET, &NFS_I(inode)->flags))
list_del_init(&NFS_I(inode)->access_cache_inode_lru);
spin_lock(&inode->i_lock);
__nfs_access_zap_cache(NFS_I(inode), &head);
spin_unlock(&inode->i_lock);
spin_unlock(&nfs_access_lru_lock);
nfs_access_free_list(&head);
}
EXPORT_SYMBOL_GPL(nfs_access_zap_cache);
static struct nfs_access_entry *nfs_access_search_rbtree(struct inode *inode, struct rpc_cred *cred)
{
struct rb_node *n = NFS_I(inode)->access_cache.rb_node;
struct nfs_access_entry *entry;
while (n != NULL) {
entry = rb_entry(n, struct nfs_access_entry, rb_node);
if (cred < entry->cred)
n = n->rb_left;
else if (cred > entry->cred)
n = n->rb_right;
else
return entry;
}
return NULL;
}
static int nfs_access_get_cached(struct inode *inode, struct rpc_cred *cred, struct nfs_access_entry *res)
{
struct nfs_inode *nfsi = NFS_I(inode);
struct nfs_access_entry *cache;
int err = -ENOENT;
spin_lock(&inode->i_lock);
if (nfsi->cache_validity & NFS_INO_INVALID_ACCESS)
goto out_zap;
cache = nfs_access_search_rbtree(inode, cred);
if (cache == NULL)
goto out;
if (!nfs_have_delegated_attributes(inode) &&
!time_in_range_open(jiffies, cache->jiffies, cache->jiffies + nfsi->attrtimeo))
goto out_stale;
res->jiffies = cache->jiffies;
res->cred = cache->cred;
res->mask = cache->mask;
list_move_tail(&cache->lru, &nfsi->access_cache_entry_lru);
err = 0;
out:
spin_unlock(&inode->i_lock);
return err;
out_stale:
rb_erase(&cache->rb_node, &nfsi->access_cache);
list_del(&cache->lru);
spin_unlock(&inode->i_lock);
nfs_access_free_entry(cache);
return -ENOENT;
out_zap:
spin_unlock(&inode->i_lock);
nfs_access_zap_cache(inode);
return -ENOENT;
}
static int nfs_access_get_cached_rcu(struct inode *inode, struct rpc_cred *cred, struct nfs_access_entry *res)
{
/* Only check the most recently returned cache entry,
* but do it without locking.
*/
struct nfs_inode *nfsi = NFS_I(inode);
struct nfs_access_entry *cache;
int err = -ECHILD;
struct list_head *lh;
rcu_read_lock();
if (nfsi->cache_validity & NFS_INO_INVALID_ACCESS)
goto out;
lh = rcu_dereference(nfsi->access_cache_entry_lru.prev);
cache = list_entry(lh, struct nfs_access_entry, lru);
if (lh == &nfsi->access_cache_entry_lru ||
cred != cache->cred)
cache = NULL;
if (cache == NULL)
goto out;
if (!nfs_have_delegated_attributes(inode) &&
!time_in_range_open(jiffies, cache->jiffies, cache->jiffies + nfsi->attrtimeo))
goto out;
res->jiffies = cache->jiffies;
res->cred = cache->cred;
res->mask = cache->mask;
err = 0;
out:
rcu_read_unlock();
return err;
}
static void nfs_access_add_rbtree(struct inode *inode, struct nfs_access_entry *set)
{
struct nfs_inode *nfsi = NFS_I(inode);
struct rb_root *root_node = &nfsi->access_cache;
struct rb_node **p = &root_node->rb_node;
struct rb_node *parent = NULL;
struct nfs_access_entry *entry;
spin_lock(&inode->i_lock);
while (*p != NULL) {
parent = *p;
entry = rb_entry(parent, struct nfs_access_entry, rb_node);
if (set->cred < entry->cred)
p = &parent->rb_left;
else if (set->cred > entry->cred)
p = &parent->rb_right;
else
goto found;
}
rb_link_node(&set->rb_node, parent, p);
rb_insert_color(&set->rb_node, root_node);
list_add_tail(&set->lru, &nfsi->access_cache_entry_lru);
spin_unlock(&inode->i_lock);
return;
found:
rb_replace_node(parent, &set->rb_node, root_node);
list_add_tail(&set->lru, &nfsi->access_cache_entry_lru);
list_del(&entry->lru);
spin_unlock(&inode->i_lock);
nfs_access_free_entry(entry);
}
void nfs_access_add_cache(struct inode *inode, struct nfs_access_entry *set)
{
struct nfs_access_entry *cache = kmalloc(sizeof(*cache), GFP_KERNEL);
if (cache == NULL)
return;
RB_CLEAR_NODE(&cache->rb_node);
cache->jiffies = set->jiffies;
cache->cred = get_rpccred(set->cred);
cache->mask = set->mask;
/* The above field assignments must be visible
* before this item appears on the lru. We cannot easily
* use rcu_assign_pointer, so just force the memory barrier.
*/
smp_wmb();
nfs_access_add_rbtree(inode, cache);
/* Update accounting */
smp_mb__before_atomic();
atomic_long_inc(&nfs_access_nr_entries);
smp_mb__after_atomic();
/* Add inode to global LRU list */
if (!test_bit(NFS_INO_ACL_LRU_SET, &NFS_I(inode)->flags)) {
spin_lock(&nfs_access_lru_lock);
if (!test_and_set_bit(NFS_INO_ACL_LRU_SET, &NFS_I(inode)->flags))
list_add_tail(&NFS_I(inode)->access_cache_inode_lru,
&nfs_access_lru_list);
spin_unlock(&nfs_access_lru_lock);
}
nfs_access_cache_enforce_limit();
}
EXPORT_SYMBOL_GPL(nfs_access_add_cache);
void nfs_access_set_mask(struct nfs_access_entry *entry, u32 access_result)
{
entry->mask = 0;
if (access_result & NFS4_ACCESS_READ)
entry->mask |= MAY_READ;
if (access_result &
(NFS4_ACCESS_MODIFY | NFS4_ACCESS_EXTEND | NFS4_ACCESS_DELETE))
entry->mask |= MAY_WRITE;
if (access_result & (NFS4_ACCESS_LOOKUP|NFS4_ACCESS_EXECUTE))
entry->mask |= MAY_EXEC;
}
EXPORT_SYMBOL_GPL(nfs_access_set_mask);
static int nfs_do_access(struct inode *inode, struct rpc_cred *cred, int mask)
{
struct nfs_access_entry cache;
int status;
trace_nfs_access_enter(inode);
status = nfs_access_get_cached_rcu(inode, cred, &cache);
if (status != 0)
status = nfs_access_get_cached(inode, cred, &cache);
if (status == 0)
goto out_cached;
status = -ECHILD;
if (mask & MAY_NOT_BLOCK)
goto out;
/* Be clever: ask server to check for all possible rights */
cache.mask = MAY_EXEC | MAY_WRITE | MAY_READ;
cache.cred = cred;
cache.jiffies = jiffies;
status = NFS_PROTO(inode)->access(inode, &cache);
if (status != 0) {
if (status == -ESTALE) {
nfs_zap_caches(inode);
if (!S_ISDIR(inode->i_mode))
set_bit(NFS_INO_STALE, &NFS_I(inode)->flags);
}
goto out;
}
nfs_access_add_cache(inode, &cache);
out_cached:
if ((mask & ~cache.mask & (MAY_READ | MAY_WRITE | MAY_EXEC)) != 0)
status = -EACCES;
out:
trace_nfs_access_exit(inode, status);
return status;
}
static int nfs_open_permission_mask(int openflags)
{
int mask = 0;
if (openflags & __FMODE_EXEC) {
/* ONLY check exec rights */
mask = MAY_EXEC;
} else {
if ((openflags & O_ACCMODE) != O_WRONLY)
mask |= MAY_READ;
if ((openflags & O_ACCMODE) != O_RDONLY)
mask |= MAY_WRITE;
}
return mask;
}
int nfs_may_open(struct inode *inode, struct rpc_cred *cred, int openflags)
{
return nfs_do_access(inode, cred, nfs_open_permission_mask(openflags));
}
EXPORT_SYMBOL_GPL(nfs_may_open);
int nfs_permission(struct inode *inode, int mask)
{
struct rpc_cred *cred;
int res = 0;
nfs_inc_stats(inode, NFSIOS_VFSACCESS);
if ((mask & (MAY_READ | MAY_WRITE | MAY_EXEC)) == 0)
goto out;
/* Is this sys_access() ? */
if (mask & (MAY_ACCESS | MAY_CHDIR))
goto force_lookup;
switch (inode->i_mode & S_IFMT) {
case S_IFLNK:
goto out;
case S_IFREG:
break;
case S_IFDIR:
/*
* Optimize away all write operations, since the server
* will check permissions when we perform the op.
*/
if ((mask & MAY_WRITE) && !(mask & MAY_READ))
goto out;
}
force_lookup:
if (!NFS_PROTO(inode)->access)
goto out_notsup;
/* Always try fast lookups first */
rcu_read_lock();
cred = rpc_lookup_cred_nonblock();
if (!IS_ERR(cred))
res = nfs_do_access(inode, cred, mask|MAY_NOT_BLOCK);
else
res = PTR_ERR(cred);
rcu_read_unlock();
if (res == -ECHILD && !(mask & MAY_NOT_BLOCK)) {
/* Fast lookup failed, try the slow way */
cred = rpc_lookup_cred();
if (!IS_ERR(cred)) {
res = nfs_do_access(inode, cred, mask);
put_rpccred(cred);
} else
res = PTR_ERR(cred);
}
out:
if (!res && (mask & MAY_EXEC) && !execute_ok(inode))
res = -EACCES;
dfprintk(VFS, "NFS: permission(%s/%lu), mask=0x%x, res=%d\n",
inode->i_sb->s_id, inode->i_ino, mask, res);
return res;
out_notsup:
if (mask & MAY_NOT_BLOCK)
return -ECHILD;
res = nfs_revalidate_inode(NFS_SERVER(inode), inode);
if (res == 0)
res = generic_permission(inode, mask);
goto out;
}
EXPORT_SYMBOL_GPL(nfs_permission);
/*
* Local variables:
* version-control: t
* kept-new-versions: 5
* End:
*/
|
/*
* Copyright (C) 2003, 2006 Apple Computer, Inc. All rights reserved.
* Copyright (C) 2005 Nokia. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
#include "FloatRect.h"
#if USE(CG)
#include <ApplicationServices/ApplicationServices.h>
namespace WebCore {
FloatRect::FloatRect(const CGRect& r) : m_location(r.origin), m_size(r.size)
{
}
FloatRect::operator CGRect() const
{
return CGRectMake(x(), y(), width(), height());
}
}
#endif // USE(CG)
|
#!/bin/sh
#
# Copyright (c) 2006 Brian C Gernhardt
#
test_description='Format-patch numbering options'
. ./test-lib.sh
test_expect_success setup '
echo A > file &&
git add file &&
git commit -m First &&
echo B >> file &&
git commit -a -m Second &&
echo C >> file &&
git commit -a -m Third
'
# Each of these gets used multiple times.
test_num_no_numbered() {
cnt=$(grep "^Subject: \[PATCH\]" $1 | wc -l) &&
test $cnt = $2
}
test_single_no_numbered() {
test_num_no_numbered $1 1
}
test_no_numbered() {
test_num_no_numbered $1 2
}
test_single_numbered() {
grep "^Subject: \[PATCH 1/1\]" $1
}
test_numbered() {
grep "^Subject: \[PATCH 1/2\]" $1 &&
grep "^Subject: \[PATCH 2/2\]" $1
}
test_expect_success 'single patch defaults to no numbers' '
git format-patch --stdout HEAD~1 >patch0.single &&
test_single_no_numbered patch0.single
'
test_expect_success 'multiple patch defaults to numbered' '
git format-patch --stdout HEAD~2 >patch0.multiple &&
test_numbered patch0.multiple
'
test_expect_success 'Use --numbered' '
git format-patch --numbered --stdout HEAD~1 >patch1 &&
test_single_numbered patch1
'
test_expect_success 'format.numbered = true' '
git config format.numbered true &&
git format-patch --stdout HEAD~2 >patch2 &&
test_numbered patch2
'
test_expect_success 'format.numbered && single patch' '
git format-patch --stdout HEAD^ > patch3 &&
test_single_numbered patch3
'
test_expect_success 'format.numbered && --no-numbered' '
git format-patch --no-numbered --stdout HEAD~2 >patch4 &&
test_no_numbered patch4
'
test_expect_success 'format.numbered && --keep-subject' '
git format-patch --keep-subject --stdout HEAD^ >patch4a &&
grep "^Subject: Third" patch4a
'
test_expect_success 'format.numbered = auto' '
git config format.numbered auto &&
git format-patch --stdout HEAD~2 > patch5 &&
test_numbered patch5
'
test_expect_success 'format.numbered = auto && single patch' '
git format-patch --stdout HEAD^ > patch6 &&
test_single_no_numbered patch6
'
test_expect_success 'format.numbered = auto && --no-numbered' '
git format-patch --no-numbered --stdout HEAD~2 > patch7 &&
test_no_numbered patch7
'
test_expect_success '--start-number && --numbered' '
git format-patch --start-number 3 --numbered --stdout HEAD~1 > patch8 &&
grep "^Subject: \[PATCH 3/3\]" patch8
'
test_done
|
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.
*/
package org.apache.camel.component.seda;
import org.apache.camel.ContextTestSupport;
import org.apache.camel.builder.RouteBuilder;
/**
* @version
*/
public class SedaInOnlyTest extends ContextTestSupport {
public void testInOnly() throws Exception {
getMockEndpoint("mock:result").expectedBodiesReceived("Hello World");
template.sendBody("direct:start", "Hello World");
assertMockEndpointsSatisfied();
}
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
@Override
public void configure() throws Exception {
from("direct:start").to("seda:foo");
from("seda:foo").to("mock:result");
}
};
}
}
|
/*
* Copyright (c) 2014 MundoReader S.L.
* Author: Heiko Stuebner <heiko@sntech.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#ifndef _DT_BINDINGS_CLK_ROCKCHIP_RK3188_COMMON_H
#define _DT_BINDINGS_CLK_ROCKCHIP_RK3188_COMMON_H
/* core clocks from */
#define PLL_APLL 1
#define PLL_DPLL 2
#define PLL_CPLL 3
#define PLL_GPLL 4
#define CORE_PERI 5
#define CORE_L2C 6
#define ARMCLK 7
/* sclk gates (special clocks) */
#define SCLK_UART0 64
#define SCLK_UART1 65
#define SCLK_UART2 66
#define SCLK_UART3 67
#define SCLK_MAC 68
#define SCLK_SPI0 69
#define SCLK_SPI1 70
#define SCLK_SARADC 71
#define SCLK_SDMMC 72
#define SCLK_SDIO 73
#define SCLK_EMMC 74
#define SCLK_I2S0 75
#define SCLK_I2S1 76
#define SCLK_I2S2 77
#define SCLK_SPDIF 78
#define SCLK_CIF0 79
#define SCLK_CIF1 80
#define SCLK_OTGPHY0 81
#define SCLK_OTGPHY1 82
#define SCLK_HSADC 83
#define SCLK_TIMER0 84
#define SCLK_TIMER1 85
#define SCLK_TIMER2 86
#define SCLK_TIMER3 87
#define SCLK_TIMER4 88
#define SCLK_TIMER5 89
#define SCLK_TIMER6 90
#define SCLK_JTAG 91
#define SCLK_SMC 92
#define SCLK_TSADC 93
#define DCLK_LCDC0 190
#define DCLK_LCDC1 191
/* aclk gates */
#define ACLK_DMA1 192
#define ACLK_DMA2 193
#define ACLK_GPS 194
#define ACLK_LCDC0 195
#define ACLK_LCDC1 196
#define ACLK_GPU 197
#define ACLK_SMC 198
#define ACLK_CIF 199
#define ACLK_IPP 200
#define ACLK_RGA 201
#define ACLK_CIF0 202
#define ACLK_CPU 203
#define ACLK_PERI 204
/* pclk gates */
#define PCLK_GRF 320
#define PCLK_PMU 321
#define PCLK_TIMER0 322
#define PCLK_TIMER1 323
#define PCLK_TIMER2 324
#define PCLK_TIMER3 325
#define PCLK_PWM01 326
#define PCLK_PWM23 327
#define PCLK_SPI0 328
#define PCLK_SPI1 329
#define PCLK_SARADC 330
#define PCLK_WDT 331
#define PCLK_UART0 332
#define PCLK_UART1 333
#define PCLK_UART2 334
#define PCLK_UART3 335
#define PCLK_I2C0 336
#define PCLK_I2C1 337
#define PCLK_I2C2 338
#define PCLK_I2C3 339
#define PCLK_I2C4 340
#define PCLK_GPIO0 341
#define PCLK_GPIO1 342
#define PCLK_GPIO2 343
#define PCLK_GPIO3 344
#define PCLK_GPIO4 345
#define PCLK_GPIO6 346
#define PCLK_EFUSE 347
#define PCLK_TZPC 348
#define PCLK_TSADC 349
#define PCLK_CPU 350
#define PCLK_PERI 351
#define PCLK_DDRUPCTL 352
#define PCLK_PUBL 353
/* hclk gates */
#define HCLK_SDMMC 448
#define HCLK_SDIO 449
#define HCLK_EMMC 450
#define HCLK_OTG0 451
#define HCLK_EMAC 452
#define HCLK_SPDIF 453
#define HCLK_I2S0 454
#define HCLK_I2S1 455
#define HCLK_I2S2 456
#define HCLK_OTG1 457
#define HCLK_HSIC 458
#define HCLK_HSADC 459
#define HCLK_PIDF 460
#define HCLK_LCDC0 461
#define HCLK_LCDC1 462
#define HCLK_ROM 463
#define HCLK_CIF0 464
#define HCLK_IPP 465
#define HCLK_RGA 466
#define HCLK_NANDC0 467
#define HCLK_CPU 468
#define HCLK_PERI 469
#define CLK_NR_CLKS (HCLK_PERI + 1)
/* soft-reset indices */
#define SRST_MCORE 2
#define SRST_CORE0 3
#define SRST_CORE1 4
#define SRST_MCORE_DBG 7
#define SRST_CORE0_DBG 8
#define SRST_CORE1_DBG 9
#define SRST_CORE0_WDT 12
#define SRST_CORE1_WDT 13
#define SRST_STRC_SYS 14
#define SRST_L2C 15
#define SRST_CPU_AHB 17
#define SRST_AHB2APB 19
#define SRST_DMA1 20
#define SRST_INTMEM 21
#define SRST_ROM 22
#define SRST_SPDIF 26
#define SRST_TIMER0 27
#define SRST_TIMER1 28
#define SRST_EFUSE 30
#define SRST_GPIO0 32
#define SRST_GPIO1 33
#define SRST_GPIO2 34
#define SRST_GPIO3 35
#define SRST_UART0 39
#define SRST_UART1 40
#define SRST_UART2 41
#define SRST_UART3 42
#define SRST_I2C0 43
#define SRST_I2C1 44
#define SRST_I2C2 45
#define SRST_I2C3 46
#define SRST_I2C4 47
#define SRST_PWM0 48
#define SRST_PWM1 49
#define SRST_DAP_PO 50
#define SRST_DAP 51
#define SRST_DAP_SYS 52
#define SRST_TPIU_ATB 53
#define SRST_PMU_APB 54
#define SRST_GRF 55
#define SRST_PMU 56
#define SRST_PERI_AXI 57
#define SRST_PERI_AHB 58
#define SRST_PERI_APB 59
#define SRST_PERI_NIU 60
#define SRST_CPU_PERI 61
#define SRST_EMEM_PERI 62
#define SRST_USB_PERI 63
#define SRST_DMA2 64
#define SRST_SMC 65
#define SRST_MAC 66
#define SRST_NANC0 68
#define SRST_USBOTG0 69
#define SRST_USBPHY0 70
#define SRST_OTGC0 71
#define SRST_USBOTG1 72
#define SRST_USBPHY1 73
#define SRST_OTGC1 74
#define SRST_HSADC 76
#define SRST_PIDFILTER 77
#define SRST_DDR_MSCH 79
#define SRST_TZPC 80
#define SRST_SDMMC 81
#define SRST_SDIO 82
#define SRST_EMMC 83
#define SRST_SPI0 84
#define SRST_SPI1 85
#define SRST_WDT 86
#define SRST_SARADC 87
#define SRST_DDRPHY 88
#define SRST_DDRPHY_APB 89
#define SRST_DDRCTL 90
#define SRST_DDRCTL_APB 91
#define SRST_DDRPUB 93
#define SRST_VIO0_AXI 98
#define SRST_VIO0_AHB 99
#define SRST_LCDC0_AXI 100
#define SRST_LCDC0_AHB 101
#define SRST_LCDC0_DCLK 102
#define SRST_LCDC1_AXI 103
#define SRST_LCDC1_AHB 104
#define SRST_LCDC1_DCLK 105
#define SRST_IPP_AXI 106
#define SRST_IPP_AHB 107
#define SRST_RGA_AXI 108
#define SRST_RGA_AHB 109
#define SRST_CIF0 110
#define SRST_VCODEC_AXI 112
#define SRST_VCODEC_AHB 113
#define SRST_VIO1_AXI 114
#define SRST_VCODEC_CPU 115
#define SRST_VCODEC_NIU 116
#define SRST_GPU 120
#define SRST_GPU_NIU 122
#define SRST_TFUN_ATB 125
#define SRST_TFUN_APB 126
#define SRST_CTI4_APB 127
#define SRST_TPIU_APB 128
#define SRST_TRACE 129
#define SRST_CORE_DBG 130
#define SRST_DBG_APB 131
#define SRST_CTI0 132
#define SRST_CTI0_APB 133
#define SRST_CTI1 134
#define SRST_CTI1_APB 135
#define SRST_PTM_CORE0 136
#define SRST_PTM_CORE1 137
#define SRST_PTM0 138
#define SRST_PTM0_ATB 139
#define SRST_PTM1 140
#define SRST_PTM1_ATB 141
#define SRST_CTM 142
#define SRST_TS 143
#endif
|
// Copyright Aleksey Gurtovoy 2000-2004
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// Preprocessed version of "boost/mpl/vector/vector10.hpp" header
// -- DO NOT modify by hand!
namespace boost { namespace mpl {
template<
typename T0
>
struct vector1
: v_item<
T0
, vector0< >
>
{
typedef vector1 type;
};
template<
typename T0, typename T1
>
struct vector2
: v_item<
T1
, vector1<T0>
>
{
typedef vector2 type;
};
template<
typename T0, typename T1, typename T2
>
struct vector3
: v_item<
T2
, vector2< T0,T1 >
>
{
typedef vector3 type;
};
template<
typename T0, typename T1, typename T2, typename T3
>
struct vector4
: v_item<
T3
, vector3< T0,T1,T2 >
>
{
typedef vector4 type;
};
template<
typename T0, typename T1, typename T2, typename T3, typename T4
>
struct vector5
: v_item<
T4
, vector4< T0,T1,T2,T3 >
>
{
typedef vector5 type;
};
template<
typename T0, typename T1, typename T2, typename T3, typename T4
, typename T5
>
struct vector6
: v_item<
T5
, vector5< T0,T1,T2,T3,T4 >
>
{
typedef vector6 type;
};
template<
typename T0, typename T1, typename T2, typename T3, typename T4
, typename T5, typename T6
>
struct vector7
: v_item<
T6
, vector6< T0,T1,T2,T3,T4,T5 >
>
{
typedef vector7 type;
};
template<
typename T0, typename T1, typename T2, typename T3, typename T4
, typename T5, typename T6, typename T7
>
struct vector8
: v_item<
T7
, vector7< T0,T1,T2,T3,T4,T5,T6 >
>
{
typedef vector8 type;
};
template<
typename T0, typename T1, typename T2, typename T3, typename T4
, typename T5, typename T6, typename T7, typename T8
>
struct vector9
: v_item<
T8
, vector8< T0,T1,T2,T3,T4,T5,T6,T7 >
>
{
typedef vector9 type;
};
template<
typename T0, typename T1, typename T2, typename T3, typename T4
, typename T5, typename T6, typename T7, typename T8, typename T9
>
struct vector10
: v_item<
T9
, vector9< T0,T1,T2,T3,T4,T5,T6,T7,T8 >
>
{
typedef vector10 type;
};
}}
|
package org.elasticsearch.index.analysis;
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.
*/
import com.carrotsearch.randomizedtesting.annotations.Listeners;
import com.carrotsearch.randomizedtesting.annotations.ThreadLeakScope;
import com.carrotsearch.randomizedtesting.annotations.ThreadLeakScope.Scope;
import com.carrotsearch.randomizedtesting.annotations.TimeoutSuite;
import org.apache.lucene.util.ArrayUtil;
import org.apache.lucene.util.LuceneTestCase;
import org.apache.lucene.util.TimeUnits;
import org.elasticsearch.test.junit.listeners.ReproduceInfoPrinter;
import org.junit.BeforeClass;
import java.util.Locale;
/**
* @deprecated Remove when IndexableBinaryStringTools is removed.
*/
@Deprecated
@Listeners({
ReproduceInfoPrinter.class
})
@ThreadLeakScope(Scope.NONE)
@TimeoutSuite(millis = TimeUnits.HOUR)
@LuceneTestCase.SuppressSysoutChecks(bugUrl = "we log a lot on purpose")
public class IndexableBinaryStringToolsTests extends LuceneTestCase {
private static int NUM_RANDOM_TESTS;
private static int MAX_RANDOM_BINARY_LENGTH;
private static final String LINE_SEPARATOR = System.lineSeparator();
@BeforeClass
public static void beforeClass() throws Exception {
NUM_RANDOM_TESTS = atLeast(200);
MAX_RANDOM_BINARY_LENGTH = atLeast(300);
}
public void testSingleBinaryRoundTrip() {
byte[] binary = new byte[] { (byte) 0x23, (byte) 0x98, (byte) 0x13,
(byte) 0xE4, (byte) 0x76, (byte) 0x41, (byte) 0xB2, (byte) 0xC9,
(byte) 0x7F, (byte) 0x0A, (byte) 0xA6, (byte) 0xD8 };
int encodedLen = IndexableBinaryStringTools.getEncodedLength(binary, 0,
binary.length);
char encoded[] = new char[encodedLen];
IndexableBinaryStringTools.encode(binary, 0, binary.length, encoded, 0,
encoded.length);
int decodedLen = IndexableBinaryStringTools.getDecodedLength(encoded, 0,
encoded.length);
byte decoded[] = new byte[decodedLen];
IndexableBinaryStringTools.decode(encoded, 0, encoded.length, decoded, 0,
decoded.length);
assertEquals("Round trip decode/decode returned different results:"
+ LINE_SEPARATOR + "original: "
+ binaryDump(binary, binary.length)
+ LINE_SEPARATOR + " encoded: "
+ charArrayDump(encoded, encoded.length)
+ LINE_SEPARATOR + " decoded: "
+ binaryDump(decoded, decoded.length),
binaryDump(binary, binary.length), binaryDump(decoded, decoded.length));
}
public void testEncodedSortability() {
byte[] originalArray1 = new byte[MAX_RANDOM_BINARY_LENGTH];
char[] originalString1 = new char[MAX_RANDOM_BINARY_LENGTH];
char[] encoded1 = new char[MAX_RANDOM_BINARY_LENGTH * 10];
byte[] original2 = new byte[MAX_RANDOM_BINARY_LENGTH];
char[] originalString2 = new char[MAX_RANDOM_BINARY_LENGTH];
char[] encoded2 = new char[MAX_RANDOM_BINARY_LENGTH * 10];
for (int testNum = 0; testNum < NUM_RANDOM_TESTS; ++testNum) {
int numBytes1 = random().nextInt(MAX_RANDOM_BINARY_LENGTH - 1) + 1; // Min == 1
for (int byteNum = 0; byteNum < numBytes1; ++byteNum) {
int randomInt = random().nextInt(0x100);
originalArray1[byteNum] = (byte) randomInt;
originalString1[byteNum] = (char) randomInt;
}
int numBytes2 = random().nextInt(MAX_RANDOM_BINARY_LENGTH - 1) + 1; // Min == 1
for (int byteNum = 0; byteNum < numBytes2; ++byteNum) {
int randomInt = random().nextInt(0x100);
original2[byteNum] = (byte) randomInt;
originalString2[byteNum] = (char) randomInt;
}
int originalComparison = new String(originalString1, 0, numBytes1)
.compareTo(new String(originalString2, 0, numBytes2));
originalComparison = originalComparison < 0 ? -1
: originalComparison > 0 ? 1 : 0;
int encodedLen1 = IndexableBinaryStringTools.getEncodedLength(
originalArray1, 0, numBytes1);
if (encodedLen1 > encoded1.length)
encoded1 = new char[ArrayUtil.oversize(encodedLen1, Character.BYTES)];
IndexableBinaryStringTools.encode(originalArray1, 0, numBytes1, encoded1,
0, encodedLen1);
int encodedLen2 = IndexableBinaryStringTools.getEncodedLength(original2,
0, numBytes2);
if (encodedLen2 > encoded2.length)
encoded2 = new char[ArrayUtil.oversize(encodedLen2, Character.BYTES)];
IndexableBinaryStringTools.encode(original2, 0, numBytes2, encoded2, 0,
encodedLen2);
int encodedComparison = new String(encoded1, 0, encodedLen1)
.compareTo(new String(encoded2, 0, encodedLen2));
encodedComparison = encodedComparison < 0 ? -1
: encodedComparison > 0 ? 1 : 0;
assertEquals("Test #" + (testNum + 1)
+ ": Original bytes and encoded chars compare differently:"
+ LINE_SEPARATOR + " binary 1: "
+ binaryDump(originalArray1, numBytes1)
+ LINE_SEPARATOR + " binary 2: "
+ binaryDump(original2, numBytes2)
+ LINE_SEPARATOR + "encoded 1: "
+ charArrayDump(encoded1, encodedLen1)
+ LINE_SEPARATOR + "encoded 2: "
+ charArrayDump(encoded2, encodedLen2)
+ LINE_SEPARATOR, originalComparison,
encodedComparison);
}
}
public void testEmptyInput() {
byte[] binary = new byte[0];
int encodedLen = IndexableBinaryStringTools.getEncodedLength(binary, 0,
binary.length);
char[] encoded = new char[encodedLen];
IndexableBinaryStringTools.encode(binary, 0, binary.length, encoded, 0,
encoded.length);
int decodedLen = IndexableBinaryStringTools.getDecodedLength(encoded, 0,
encoded.length);
byte[] decoded = new byte[decodedLen];
IndexableBinaryStringTools.decode(encoded, 0, encoded.length, decoded, 0,
decoded.length);
assertEquals("decoded empty input was not empty", decoded.length, 0);
}
public void testAllNullInput() {
byte[] binary = new byte[] { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
int encodedLen = IndexableBinaryStringTools.getEncodedLength(binary, 0,
binary.length);
char encoded[] = new char[encodedLen];
IndexableBinaryStringTools.encode(binary, 0, binary.length, encoded, 0,
encoded.length);
int decodedLen = IndexableBinaryStringTools.getDecodedLength(encoded, 0,
encoded.length);
byte[] decoded = new byte[decodedLen];
IndexableBinaryStringTools.decode(encoded, 0, encoded.length, decoded, 0,
decoded.length);
assertEquals("Round trip decode/decode returned different results:"
+ LINE_SEPARATOR + " original: "
+ binaryDump(binary, binary.length)
+ LINE_SEPARATOR + "decodedBuf: "
+ binaryDump(decoded, decoded.length),
binaryDump(binary, binary.length), binaryDump(decoded, decoded.length));
}
public void testRandomBinaryRoundTrip() {
byte[] binary = new byte[MAX_RANDOM_BINARY_LENGTH];
char[] encoded = new char[MAX_RANDOM_BINARY_LENGTH * 10];
byte[] decoded = new byte[MAX_RANDOM_BINARY_LENGTH];
for (int testNum = 0; testNum < NUM_RANDOM_TESTS; ++testNum) {
int numBytes = random().nextInt(MAX_RANDOM_BINARY_LENGTH - 1) + 1; // Min == 1
for (int byteNum = 0; byteNum < numBytes; ++byteNum) {
binary[byteNum] = (byte) random().nextInt(0x100);
}
int encodedLen = IndexableBinaryStringTools.getEncodedLength(binary, 0,
numBytes);
if (encoded.length < encodedLen)
encoded = new char[ArrayUtil.oversize(encodedLen, Character.BYTES)];
IndexableBinaryStringTools.encode(binary, 0, numBytes, encoded, 0,
encodedLen);
int decodedLen = IndexableBinaryStringTools.getDecodedLength(encoded, 0,
encodedLen);
IndexableBinaryStringTools.decode(encoded, 0, encodedLen, decoded, 0,
decodedLen);
assertEquals("Test #" + (testNum + 1)
+ ": Round trip decode/decode returned different results:"
+ LINE_SEPARATOR + " original: "
+ binaryDump(binary, numBytes) + LINE_SEPARATOR
+ "encodedBuf: " + charArrayDump(encoded, encodedLen)
+ LINE_SEPARATOR + "decodedBuf: "
+ binaryDump(decoded, decodedLen), binaryDump(binary, numBytes),
binaryDump(decoded, decodedLen));
}
}
public String binaryDump(byte[] binary, int numBytes) {
StringBuilder buf = new StringBuilder();
for (int byteNum = 0 ; byteNum < numBytes ; ++byteNum) {
String hex = Integer.toHexString(binary[byteNum] & 0xFF);
if (hex.length() == 1) {
buf.append('0');
}
buf.append(hex.toUpperCase(Locale.ROOT));
if (byteNum < numBytes - 1) {
buf.append(' ');
}
}
return buf.toString();
}
public String charArrayDump(char[] charArray, int numBytes) {
StringBuilder buf = new StringBuilder();
for (int charNum = 0 ; charNum < numBytes ; ++charNum) {
String hex = Integer.toHexString(charArray[charNum]);
for (int digit = 0 ; digit < 4 - hex.length() ; ++digit) {
buf.append('0');
}
buf.append(hex.toUpperCase(Locale.ROOT));
if (charNum < numBytes - 1) {
buf.append(' ');
}
}
return buf.toString();
}
}
|
/* linux/arch/arm/mach-s3c64xx/mach-smdk6410.c
*
* Copyright 2008 Openmoko, Inc.
* Copyright 2008 Simtec Electronics
* Ben Dooks <ben@simtec.co.uk>
* http://armlinux.simtec.co.uk/
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
*/
#include <linux/kernel.h>
#include <linux/types.h>
#include <linux/interrupt.h>
#include <linux/list.h>
#include <linux/timer.h>
#include <linux/init.h>
#include <linux/input.h>
#include <linux/serial_core.h>
#include <linux/platform_device.h>
#include <linux/io.h>
#include <linux/i2c.h>
#include <linux/leds.h>
#include <linux/fb.h>
#include <linux/gpio.h>
#include <linux/delay.h>
#include <linux/smsc911x.h>
#include <linux/regulator/fixed.h>
#include <linux/regulator/machine.h>
#include <linux/pwm_backlight.h>
#ifdef CONFIG_SMDK6410_WM1190_EV1
#include <linux/mfd/wm8350/core.h>
#include <linux/mfd/wm8350/pmic.h>
#endif
#ifdef CONFIG_SMDK6410_WM1192_EV1
#include <linux/mfd/wm831x/core.h>
#include <linux/mfd/wm831x/pdata.h>
#endif
#include <video/platform_lcd.h>
#include <asm/mach/arch.h>
#include <asm/mach/map.h>
#include <asm/mach/irq.h>
#include <mach/hardware.h>
#include <mach/map.h>
#include <asm/irq.h>
#include <asm/mach-types.h>
#include <plat/regs-serial.h>
#include <mach/regs-modem.h>
#include <mach/regs-gpio.h>
#include <mach/regs-sys.h>
#include <mach/regs-srom.h>
#include <plat/ata.h>
#include <plat/iic.h>
#include <plat/fb.h>
#include <plat/gpio-cfg.h>
#include <mach/s3c6410.h>
#include <plat/clock.h>
#include <plat/devs.h>
#include <plat/cpu.h>
#include <plat/adc.h>
#include <plat/ts.h>
#include <plat/keypad.h>
#include <plat/backlight.h>
#include <plat/regs-fb-v4.h>
#define UCON S3C2410_UCON_DEFAULT | S3C2410_UCON_UCLK
#define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB
#define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE
static struct s3c2410_uartcfg smdk6410_uartcfgs[] __initdata = {
[0] = {
.hwport = 0,
.flags = 0,
.ucon = UCON,
.ulcon = ULCON,
.ufcon = UFCON,
},
[1] = {
.hwport = 1,
.flags = 0,
.ucon = UCON,
.ulcon = ULCON,
.ufcon = UFCON,
},
[2] = {
.hwport = 2,
.flags = 0,
.ucon = UCON,
.ulcon = ULCON,
.ufcon = UFCON,
},
[3] = {
.hwport = 3,
.flags = 0,
.ucon = UCON,
.ulcon = ULCON,
.ufcon = UFCON,
},
};
/* framebuffer and LCD setup. */
/* GPF15 = LCD backlight control
* GPF13 => Panel power
* GPN5 = LCD nRESET signal
* PWM_TOUT1 => backlight brightness
*/
static void smdk6410_lcd_power_set(struct plat_lcd_data *pd,
unsigned int power)
{
if (power) {
gpio_direction_output(S3C64XX_GPF(13), 1);
/* fire nRESET on power up */
gpio_direction_output(S3C64XX_GPN(5), 0);
msleep(10);
gpio_direction_output(S3C64XX_GPN(5), 1);
msleep(1);
} else {
gpio_direction_output(S3C64XX_GPF(13), 0);
}
}
static struct plat_lcd_data smdk6410_lcd_power_data = {
.set_power = smdk6410_lcd_power_set,
};
static struct platform_device smdk6410_lcd_powerdev = {
.name = "platform-lcd",
.dev.parent = &s3c_device_fb.dev,
.dev.platform_data = &smdk6410_lcd_power_data,
};
static struct s3c_fb_pd_win smdk6410_fb_win0 = {
/* this is to ensure we use win0 */
.win_mode = {
.left_margin = 8,
.right_margin = 13,
.upper_margin = 7,
.lower_margin = 5,
.hsync_len = 3,
.vsync_len = 1,
.xres = 800,
.yres = 480,
},
.max_bpp = 32,
.default_bpp = 16,
.virtual_y = 480 * 2,
.virtual_x = 800,
};
/* 405566 clocks per frame => 60Hz refresh requires 24333960Hz clock */
static struct s3c_fb_platdata smdk6410_lcd_pdata __initdata = {
.setup_gpio = s3c64xx_fb_gpio_setup_24bpp,
.win[0] = &smdk6410_fb_win0,
.vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
.vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
};
/*
* Configuring Ethernet on SMDK6410
*
* Both CS8900A and LAN9115 chips share one chip select mediated by CFG6.
* The constant address below corresponds to nCS1
*
* 1) Set CFGB2 p3 ON others off, no other CFGB selects "ethernet"
* 2) CFG6 needs to be switched to "LAN9115" side
*/
static struct resource smdk6410_smsc911x_resources[] = {
[0] = {
.start = S3C64XX_PA_XM0CSN1,
.end = S3C64XX_PA_XM0CSN1 + SZ_64K - 1,
.flags = IORESOURCE_MEM,
},
[1] = {
.start = S3C_EINT(10),
.end = S3C_EINT(10),
.flags = IORESOURCE_IRQ | IRQ_TYPE_LEVEL_LOW,
},
};
static struct smsc911x_platform_config smdk6410_smsc911x_pdata = {
.irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
.irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN,
.flags = SMSC911X_USE_32BIT | SMSC911X_FORCE_INTERNAL_PHY,
.phy_interface = PHY_INTERFACE_MODE_MII,
};
static struct platform_device smdk6410_smsc911x = {
.name = "smsc911x",
.id = -1,
.num_resources = ARRAY_SIZE(smdk6410_smsc911x_resources),
.resource = &smdk6410_smsc911x_resources[0],
.dev = {
.platform_data = &smdk6410_smsc911x_pdata,
},
};
#ifdef CONFIG_REGULATOR
static struct regulator_consumer_supply smdk6410_b_pwr_5v_consumers[] __initdata = {
REGULATOR_SUPPLY("PVDD", "0-001b"),
REGULATOR_SUPPLY("AVDD", "0-001b"),
};
static struct regulator_init_data smdk6410_b_pwr_5v_data = {
.constraints = {
.always_on = 1,
},
.num_consumer_supplies = ARRAY_SIZE(smdk6410_b_pwr_5v_consumers),
.consumer_supplies = smdk6410_b_pwr_5v_consumers,
};
static struct fixed_voltage_config smdk6410_b_pwr_5v_pdata = {
.supply_name = "B_PWR_5V",
.microvolts = 5000000,
.init_data = &smdk6410_b_pwr_5v_data,
.gpio = -EINVAL,
};
static struct platform_device smdk6410_b_pwr_5v = {
.name = "reg-fixed-voltage",
.id = -1,
.dev = {
.platform_data = &smdk6410_b_pwr_5v_pdata,
},
};
#endif
static struct s3c_ide_platdata smdk6410_ide_pdata __initdata = {
.setup_gpio = s3c64xx_ide_setup_gpio,
};
static uint32_t smdk6410_keymap[] __initdata = {
/* KEY(row, col, keycode) */
KEY(0, 3, KEY_1), KEY(0, 4, KEY_2), KEY(0, 5, KEY_3),
KEY(0, 6, KEY_4), KEY(0, 7, KEY_5),
KEY(1, 3, KEY_A), KEY(1, 4, KEY_B), KEY(1, 5, KEY_C),
KEY(1, 6, KEY_D), KEY(1, 7, KEY_E)
};
static struct matrix_keymap_data smdk6410_keymap_data __initdata = {
.keymap = smdk6410_keymap,
.keymap_size = ARRAY_SIZE(smdk6410_keymap),
};
static struct samsung_keypad_platdata smdk6410_keypad_data __initdata = {
.keymap_data = &smdk6410_keymap_data,
.rows = 2,
.cols = 8,
};
static struct map_desc smdk6410_iodesc[] = {};
static struct platform_device *smdk6410_devices[] __initdata = {
#ifdef CONFIG_SMDK6410_SD_CH0
&s3c_device_hsmmc0,
#endif
#ifdef CONFIG_SMDK6410_SD_CH1
&s3c_device_hsmmc1,
#endif
&s3c_device_i2c0,
&s3c_device_i2c1,
&s3c_device_fb,
&s3c_device_ohci,
&s3c_device_usb_hsotg,
&samsung_asoc_dma,
&s3c64xx_device_iisv4,
&samsung_device_keypad,
#ifdef CONFIG_REGULATOR
&smdk6410_b_pwr_5v,
#endif
&smdk6410_lcd_powerdev,
&smdk6410_smsc911x,
&s3c_device_adc,
&s3c_device_cfcon,
&s3c_device_rtc,
&s3c_device_ts,
&s3c_device_wdt,
};
#ifdef CONFIG_REGULATOR
/* ARM core */
static struct regulator_consumer_supply smdk6410_vddarm_consumers[] = {
REGULATOR_SUPPLY("vddarm", NULL),
};
/* VDDARM, BUCK1 on J5 */
static struct regulator_init_data smdk6410_vddarm = {
.constraints = {
.name = "PVDD_ARM",
.min_uV = 1000000,
.max_uV = 1300000,
.always_on = 1,
.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
},
.num_consumer_supplies = ARRAY_SIZE(smdk6410_vddarm_consumers),
.consumer_supplies = smdk6410_vddarm_consumers,
};
/* VDD_INT, BUCK2 on J5 */
static struct regulator_init_data smdk6410_vddint = {
.constraints = {
.name = "PVDD_INT",
.min_uV = 1000000,
.max_uV = 1200000,
.always_on = 1,
.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
},
};
/* VDD_HI, LDO3 on J5 */
static struct regulator_init_data smdk6410_vddhi = {
.constraints = {
.name = "PVDD_HI",
.always_on = 1,
},
};
/* VDD_PLL, LDO2 on J5 */
static struct regulator_init_data smdk6410_vddpll = {
.constraints = {
.name = "PVDD_PLL",
.always_on = 1,
},
};
/* VDD_UH_MMC, LDO5 on J5 */
static struct regulator_init_data smdk6410_vdduh_mmc = {
.constraints = {
.name = "PVDD_UH+PVDD_MMC",
.always_on = 1,
},
};
/* VCCM3BT, LDO8 on J5 */
static struct regulator_init_data smdk6410_vccmc3bt = {
.constraints = {
.name = "PVCCM3BT",
.always_on = 1,
},
};
/* VCCM2MTV, LDO11 on J5 */
static struct regulator_init_data smdk6410_vccm2mtv = {
.constraints = {
.name = "PVCCM2MTV",
.always_on = 1,
},
};
/* VDD_LCD, LDO12 on J5 */
static struct regulator_init_data smdk6410_vddlcd = {
.constraints = {
.name = "PVDD_LCD",
.always_on = 1,
},
};
/* VDD_OTGI, LDO9 on J5 */
static struct regulator_init_data smdk6410_vddotgi = {
.constraints = {
.name = "PVDD_OTGI",
.always_on = 1,
},
};
/* VDD_OTG, LDO14 on J5 */
static struct regulator_init_data smdk6410_vddotg = {
.constraints = {
.name = "PVDD_OTG",
.always_on = 1,
},
};
/* VDD_ALIVE, LDO15 on J5 */
static struct regulator_init_data smdk6410_vddalive = {
.constraints = {
.name = "PVDD_ALIVE",
.always_on = 1,
},
};
/* VDD_AUDIO, VLDO_AUDIO on J5 */
static struct regulator_init_data smdk6410_vddaudio = {
.constraints = {
.name = "PVDD_AUDIO",
.always_on = 1,
},
};
#endif
#ifdef CONFIG_SMDK6410_WM1190_EV1
/* S3C64xx internal logic & PLL */
static struct regulator_init_data wm8350_dcdc1_data = {
.constraints = {
.name = "PVDD_INT+PVDD_PLL",
.min_uV = 1200000,
.max_uV = 1200000,
.always_on = 1,
.apply_uV = 1,
},
};
/* Memory */
static struct regulator_init_data wm8350_dcdc3_data = {
.constraints = {
.name = "PVDD_MEM",
.min_uV = 1800000,
.max_uV = 1800000,
.always_on = 1,
.state_mem = {
.uV = 1800000,
.mode = REGULATOR_MODE_NORMAL,
.enabled = 1,
},
.initial_state = PM_SUSPEND_MEM,
},
};
/* USB, EXT, PCM, ADC/DAC, USB, MMC */
static struct regulator_consumer_supply wm8350_dcdc4_consumers[] = {
REGULATOR_SUPPLY("DVDD", "0-001b"),
};
static struct regulator_init_data wm8350_dcdc4_data = {
.constraints = {
.name = "PVDD_HI+PVDD_EXT+PVDD_SYS+PVCCM2MTV",
.min_uV = 3000000,
.max_uV = 3000000,
.always_on = 1,
},
.num_consumer_supplies = ARRAY_SIZE(wm8350_dcdc4_consumers),
.consumer_supplies = wm8350_dcdc4_consumers,
};
/* OTGi/1190-EV1 HPVDD & AVDD */
static struct regulator_init_data wm8350_ldo4_data = {
.constraints = {
.name = "PVDD_OTGI+HPVDD+AVDD",
.min_uV = 1200000,
.max_uV = 1200000,
.apply_uV = 1,
.always_on = 1,
},
};
static struct {
int regulator;
struct regulator_init_data *initdata;
} wm1190_regulators[] = {
{ WM8350_DCDC_1, &wm8350_dcdc1_data },
{ WM8350_DCDC_3, &wm8350_dcdc3_data },
{ WM8350_DCDC_4, &wm8350_dcdc4_data },
{ WM8350_DCDC_6, &smdk6410_vddarm },
{ WM8350_LDO_1, &smdk6410_vddalive },
{ WM8350_LDO_2, &smdk6410_vddotg },
{ WM8350_LDO_3, &smdk6410_vddlcd },
{ WM8350_LDO_4, &wm8350_ldo4_data },
};
static int __init smdk6410_wm8350_init(struct wm8350 *wm8350)
{
int i;
/* Configure the IRQ line */
s3c_gpio_setpull(S3C64XX_GPN(12), S3C_GPIO_PULL_UP);
/* Instantiate the regulators */
for (i = 0; i < ARRAY_SIZE(wm1190_regulators); i++)
wm8350_register_regulator(wm8350,
wm1190_regulators[i].regulator,
wm1190_regulators[i].initdata);
return 0;
}
static struct wm8350_platform_data __initdata smdk6410_wm8350_pdata = {
.init = smdk6410_wm8350_init,
.irq_high = 1,
.irq_base = IRQ_BOARD_START,
};
#endif
#ifdef CONFIG_SMDK6410_WM1192_EV1
static struct gpio_led wm1192_pmic_leds[] = {
{
.name = "PMIC:red:power",
.gpio = GPIO_BOARD_START + 3,
.default_state = LEDS_GPIO_DEFSTATE_ON,
},
};
static struct gpio_led_platform_data wm1192_pmic_led = {
.num_leds = ARRAY_SIZE(wm1192_pmic_leds),
.leds = wm1192_pmic_leds,
};
static struct platform_device wm1192_pmic_led_dev = {
.name = "leds-gpio",
.id = -1,
.dev = {
.platform_data = &wm1192_pmic_led,
},
};
static int wm1192_pre_init(struct wm831x *wm831x)
{
int ret;
/* Configure the IRQ line */
s3c_gpio_setpull(S3C64XX_GPN(12), S3C_GPIO_PULL_UP);
ret = platform_device_register(&wm1192_pmic_led_dev);
if (ret != 0)
dev_err(wm831x->dev, "Failed to add PMIC LED: %d\n", ret);
return 0;
}
static struct wm831x_backlight_pdata wm1192_backlight_pdata = {
.isink = 1,
.max_uA = 27554,
};
static struct regulator_init_data wm1192_dcdc3 = {
.constraints = {
.name = "PVDD_MEM+PVDD_GPS",
.always_on = 1,
},
};
static struct regulator_consumer_supply wm1192_ldo1_consumers[] = {
REGULATOR_SUPPLY("DVDD", "0-001b"), /* WM8580 */
};
static struct regulator_init_data wm1192_ldo1 = {
.constraints = {
.name = "PVDD_LCD+PVDD_EXT",
.always_on = 1,
},
.consumer_supplies = wm1192_ldo1_consumers,
.num_consumer_supplies = ARRAY_SIZE(wm1192_ldo1_consumers),
};
static struct wm831x_status_pdata wm1192_led7_pdata = {
.name = "LED7:green:",
};
static struct wm831x_status_pdata wm1192_led8_pdata = {
.name = "LED8:green:",
};
static struct wm831x_pdata smdk6410_wm1192_pdata = {
.pre_init = wm1192_pre_init,
.irq_base = IRQ_BOARD_START,
.backlight = &wm1192_backlight_pdata,
.dcdc = {
&smdk6410_vddarm, /* DCDC1 */
&smdk6410_vddint, /* DCDC2 */
&wm1192_dcdc3,
},
.gpio_base = GPIO_BOARD_START,
.ldo = {
&wm1192_ldo1, /* LDO1 */
&smdk6410_vdduh_mmc, /* LDO2 */
NULL, /* LDO3 NC */
&smdk6410_vddotgi, /* LDO4 */
&smdk6410_vddotg, /* LDO5 */
&smdk6410_vddhi, /* LDO6 */
&smdk6410_vddaudio, /* LDO7 */
&smdk6410_vccm2mtv, /* LDO8 */
&smdk6410_vddpll, /* LDO9 */
&smdk6410_vccmc3bt, /* LDO10 */
&smdk6410_vddalive, /* LDO11 */
},
.status = {
&wm1192_led7_pdata,
&wm1192_led8_pdata,
},
};
#endif
static struct i2c_board_info i2c_devs0[] __initdata = {
{ I2C_BOARD_INFO("24c08", 0x50), },
{ I2C_BOARD_INFO("wm8580", 0x1b), },
#ifdef CONFIG_SMDK6410_WM1192_EV1
{ I2C_BOARD_INFO("wm8312", 0x34),
.platform_data = &smdk6410_wm1192_pdata,
.irq = S3C_EINT(12),
},
#endif
#ifdef CONFIG_SMDK6410_WM1190_EV1
{ I2C_BOARD_INFO("wm8350", 0x1a),
.platform_data = &smdk6410_wm8350_pdata,
.irq = S3C_EINT(12),
},
#endif
};
static struct i2c_board_info i2c_devs1[] __initdata = {
{ I2C_BOARD_INFO("24c128", 0x57), }, /* Samsung S524AD0XD1 */
};
static struct s3c2410_ts_mach_info s3c_ts_platform __initdata = {
.delay = 10000,
.presc = 49,
.oversampling_shift = 2,
};
/* LCD Backlight data */
static struct samsung_bl_gpio_info smdk6410_bl_gpio_info = {
.no = S3C64XX_GPF(15),
.func = S3C_GPIO_SFN(2),
};
static struct platform_pwm_backlight_data smdk6410_bl_data = {
.pwm_id = 1,
};
static void __init smdk6410_map_io(void)
{
u32 tmp;
s3c64xx_init_io(smdk6410_iodesc, ARRAY_SIZE(smdk6410_iodesc));
s3c24xx_init_clocks(12000000);
s3c24xx_init_uarts(smdk6410_uartcfgs, ARRAY_SIZE(smdk6410_uartcfgs));
/* set the LCD type */
tmp = __raw_readl(S3C64XX_SPCON);
tmp &= ~S3C64XX_SPCON_LCD_SEL_MASK;
tmp |= S3C64XX_SPCON_LCD_SEL_RGB;
__raw_writel(tmp, S3C64XX_SPCON);
/* remove the lcd bypass */
tmp = __raw_readl(S3C64XX_MODEM_MIFPCON);
tmp &= ~MIFPCON_LCD_BYPASS;
__raw_writel(tmp, S3C64XX_MODEM_MIFPCON);
}
static void __init smdk6410_machine_init(void)
{
u32 cs1;
s3c_i2c0_set_platdata(NULL);
s3c_i2c1_set_platdata(NULL);
s3c_fb_set_platdata(&smdk6410_lcd_pdata);
samsung_keypad_set_platdata(&smdk6410_keypad_data);
s3c24xx_ts_set_platdata(&s3c_ts_platform);
/* configure nCS1 width to 16 bits */
cs1 = __raw_readl(S3C64XX_SROM_BW) &
~(S3C64XX_SROM_BW__CS_MASK << S3C64XX_SROM_BW__NCS1__SHIFT);
cs1 |= ((1 << S3C64XX_SROM_BW__DATAWIDTH__SHIFT) |
(1 << S3C64XX_SROM_BW__WAITENABLE__SHIFT) |
(1 << S3C64XX_SROM_BW__BYTEENABLE__SHIFT)) <<
S3C64XX_SROM_BW__NCS1__SHIFT;
__raw_writel(cs1, S3C64XX_SROM_BW);
/* set timing for nCS1 suitable for ethernet chip */
__raw_writel((0 << S3C64XX_SROM_BCX__PMC__SHIFT) |
(6 << S3C64XX_SROM_BCX__TACP__SHIFT) |
(4 << S3C64XX_SROM_BCX__TCAH__SHIFT) |
(1 << S3C64XX_SROM_BCX__TCOH__SHIFT) |
(0xe << S3C64XX_SROM_BCX__TACC__SHIFT) |
(4 << S3C64XX_SROM_BCX__TCOS__SHIFT) |
(0 << S3C64XX_SROM_BCX__TACS__SHIFT), S3C64XX_SROM_BC1);
gpio_request(S3C64XX_GPN(5), "LCD power");
gpio_request(S3C64XX_GPF(13), "LCD power");
i2c_register_board_info(0, i2c_devs0, ARRAY_SIZE(i2c_devs0));
i2c_register_board_info(1, i2c_devs1, ARRAY_SIZE(i2c_devs1));
s3c_ide_set_platdata(&smdk6410_ide_pdata);
samsung_bl_set(&smdk6410_bl_gpio_info, &smdk6410_bl_data);
platform_add_devices(smdk6410_devices, ARRAY_SIZE(smdk6410_devices));
}
MACHINE_START(SMDK6410, "SMDK6410")
/* Maintainer: Ben Dooks <ben-linux@fluff.org> */
.boot_params = S3C64XX_PA_SDRAM + 0x100,
.init_irq = s3c6410_init_irq,
.map_io = smdk6410_map_io,
.init_machine = smdk6410_machine_init,
.timer = &s3c24xx_timer,
MACHINE_END
|
// https://github.com/OptimalBits/node_acl/blob/master/Readme.md
import Acl = require('acl');
import redis = require('redis');
declare var client: redis.RedisClient;
// Using the redis backend
var acl = new Acl(new Acl.redisBackend(client, 'acl_'));
// guest is allowed to view blogs
acl.allow('guest', 'blogs', 'view');
// allow function accepts arrays as any parameter
acl.allow('member', 'blogs', ['edit','view', 'delete']);
|
/*
* Copyright (c) 2013-2014 Chukong Technologies Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
/**
* @type {Object}
* @name jsb.AssetsManager
* jsb.AssetsManager is the native AssetsManager for your game resources or scripts.
* please refer to this document to know how to use it: http://www.cocos2d-x.org/docs/manual/framework/html5/v3/assets-manager/en
* Only available in JSB
*/
jsb.AssetsManager = cc.AssetsManager;
delete cc.AssetsManager;
/**
* @type {Object}
* @name jsb.EventListenerAssetsManager
* jsb.EventListenerAssetsManager is the native event listener for AssetsManager.
* please refer to this document to know how to use it: http://www.cocos2d-x.org/docs/manual/framework/html5/v3/assets-manager/en
* Only available in JSB
*/
jsb.EventListenerAssetsManager = cc.EventListenerAssetsManager;
delete cc.EventListenerAssetsManager;
/**
* @type {Object}
* @name jsb.EventAssetsManager
* jsb.EventAssetsManager is the native event for AssetsManager.
* please refer to this document to know how to use it: http://www.cocos2d-x.org/docs/manual/framework/html5/v3/assets-manager/en
* Only available in JSB
*/
jsb.EventAssetsManager = cc.EventAssetsManager;
delete cc.EventAssetsManager;
// move from jsb_cocos2d
//start------------------------------
cc.ControlButton.extend = cc.Class.extend;
cc.ControlColourPicker.extend = cc.Class.extend;
cc.ControlPotentiometer.extend = cc.Class.extend;
cc.ControlSlider.extend = cc.Class.extend;
cc.ControlStepper.extend = cc.Class.extend;
cc.ControlSwitch.extend = cc.Class.extend;
//end------------------------------
//
// cocos2d constants
//
// This helper file should be required after jsb_cocos2d.js
//
var cc = cc || {};
cc.SCROLLVIEW_DIRECTION_NONE = -1;
cc.SCROLLVIEW_DIRECTION_HORIZONTAL = 0;
cc.SCROLLVIEW_DIRECTION_VERTICAL = 1;
cc.SCROLLVIEW_DIRECTION_BOTH = 2;
cc.TABLEVIEW_FILL_TOPDOWN = 0;
cc.TABLEVIEW_FILL_BOTTOMUP = 1;
/**
* @constant
* @type Number
*/
cc.KEYBOARD_RETURNTYPE_DEFAULT = 0;
/**
* @constant
* @type Number
*/
cc.KEYBOARD_RETURNTYPE_DONE = 1;
/**
* @constant
* @type Number
*/
cc.KEYBOARD_RETURNTYPE_SEND = 2;
/**
* @constant
* @type Number
*/
cc.KEYBOARD_RETURNTYPE_SEARCH = 3;
/**
* @constant
* @type Number
*/
cc.KEYBOARD_RETURNTYPE_GO = 4;
/**
* The EditBox::InputMode defines the type of text that the user is allowed * to enter.
* @constant
* @type Number
*/
cc.EDITBOX_INPUT_MODE_ANY = 0;
/**
* The user is allowed to enter an e-mail address.
* @constant
* @type Number
*/
cc.EDITBOX_INPUT_MODE_EMAILADDR = 1;
/**
* The user is allowed to enter an integer value.
* @constant
* @type Number
*/
cc.EDITBOX_INPUT_MODE_NUMERIC = 2;
/**
* The user is allowed to enter a phone number.
* @constant
* @type Number
*/
cc.EDITBOX_INPUT_MODE_PHONENUMBER = 3;
/**
* The user is allowed to enter a URL.
* @constant
* @type Number
*/
cc.EDITBOX_INPUT_MODE_URL = 4;
/**
* The user is allowed to enter a real number value.
* This extends kEditBoxInputModeNumeric by allowing a decimal point.
* @constant
* @type Number
*/
cc.EDITBOX_INPUT_MODE_DECIMAL = 5;
/**
* The user is allowed to enter any text, except for line breaks.
* @constant
* @type Number
*/
cc.EDITBOX_INPUT_MODE_SINGLELINE = 6;
/**
* Indicates that the text entered is confidential data that should be
* obscured whenever possible. This implies EDIT_BOX_INPUT_FLAG_SENSITIVE.
* @constant
* @type Number
*/
cc.EDITBOX_INPUT_FLAG_PASSWORD = 0;
/**
* Indicates that the text entered is sensitive data that the
* implementation must never store into a dictionary or table for use
* in predictive, auto-completing, or other accelerated input schemes.
* A credit card number is an example of sensitive data.
* @constant
* @type Number
*/
cc.EDITBOX_INPUT_FLAG_SENSITIVE = 1;
/**
* This flag is a hint to the implementation that during text editing,
* the initial letter of each word should be capitalized.
* @constant
* @type Number
*/
cc.EDITBOX_INPUT_FLAG_INITIAL_CAPS_WORD = 2;
/**
* This flag is a hint to the implementation that during text editing,
* the initial letter of each sentence should be capitalized.
* @constant
* @type Number
*/
cc.EDITBOX_INPUT_FLAG_INITIAL_CAPS_SENTENCE = 3;
/**
* Capitalize all characters automatically.
* @constant
* @type Number
*/
cc.EDITBOX_INPUT_FLAG_INITIAL_CAPS_ALL_CHARACTERS = 4;
cc.CONTROL_EVENT_TOTAL_NUMBER = 9;
cc.CONTROL_EVENT_TOUCH_DOWN = 1 << 0; // A touch-down event in the control.
cc.CONTROL_EVENT_TOUCH_DRAG_INSIDE = 1 << 1; // An event where a finger is dragged inside the bounds of the control.
cc.CONTROL_EVENT_TOUCH_DRAG_OUTSIDE = 1 << 2; // An event where a finger is dragged just outside the bounds of the control.
cc.CONTROL_EVENT_TOUCH_DRAG_ENTER = 1 << 3; // An event where a finger is dragged into the bounds of the control.
cc.CONTROL_EVENT_TOUCH_DRAG_EXIT = 1 << 4; // An event where a finger is dragged from within a control to outside its bounds.
cc.CONTROL_EVENT_TOUCH_UP_INSIDE = 1 << 5; // A touch-up event in the control where the finger is inside the bounds of the control.
cc.CONTROL_EVENT_TOUCH_UP_OUTSIDE = 1 << 6; // A touch-up event in the control where the finger is outside the bounds of the control.
cc.CONTROL_EVENT_TOUCH_CANCEL = 1 << 7; // A system event canceling the current touches for the control.
cc.CONTROL_EVENT_VALUECHANGED = 1 << 8; // A touch dragging or otherwise manipulating a control; causing it to emit a series of different values.
cc.CONTROL_STATE_NORMAL = 1 << 0; // The normal; or default state of a control梩hat is; enabled but neither selected nor highlighted.
cc.CONTROL_STATE_HIGHLIGHTED = 1 << 1; // Highlighted state of a control. A control enters this state when a touch down; drag inside or drag enter is performed. You can retrieve and set this value through the highlighted property.
cc.CONTROL_STATE_DISABLED = 1 << 2; // Disabled state of a control. This state indicates that the control is currently disabled. You can retrieve and set this value through the enabled property.
cc.CONTROL_STATE_SELECTED = 1 << 3; // Selected state of a control. This state indicates that the control is currently selected. You can retrieve and set this value through the selected property.
cc.CONTROL_STATE_INITIAL = 1 << 3;
cc.CONTROL_ZOOM_ACTION_TAG = 0xCCCB0001; //CCControlButton.js
cc.CONTROL_STEPPER_PARTMINUS = 0; //CCControlStepper.js
cc.CONTROL_STEPPER_PARTPLUS = 1;
cc.CONTROL_STEPPER_PARTNONE = 2;
cc.CONTROL_STEPPER_LABELCOLOR_ENABLED = cc.color(55, 55, 55);
cc.CONTROL_STEPPER_LABELCOLOR_DISABLED = cc.color(147, 147, 147);
cc.CONTROL_STEPPER_LABELFONT = "CourierNewPSMT";
cc.AUTOREPEAT_DELTATIME = 0.15;
cc.AUTOREPEAT_INCREASETIME_INCREMENT = 12;
jsb.EventAssetsManager.ERROR_NO_LOCAL_MANIFEST = 0;
jsb.EventAssetsManager.ERROR_DOWNLOAD_MANIFEST = 1;
jsb.EventAssetsManager.ERROR_PARSE_MANIFEST = 2;
jsb.EventAssetsManager.NEW_VERSION_FOUND = 3;
jsb.EventAssetsManager.ALREADY_UP_TO_DATE = 4;
jsb.EventAssetsManager.UPDATE_PROGRESSION = 5;
jsb.EventAssetsManager.ASSET_UPDATED = 6;
jsb.EventAssetsManager.ERROR_UPDATING = 7;
jsb.EventAssetsManager.UPDATE_FINISHED = 8;
jsb.EventAssetsManager.UPDATE_FAILED = 9;
jsb.EventAssetsManager.ERROR_DECOMPRESS = 10;
cc.ScrollView.extend = cc.Class.extend;
cc.TableView.extend = cc.Class.extend;
cc.TableViewCell.extend = cc.Class.extend;
|
/* Copyright (c) 2010 Code Aurora Forum. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
* only version 2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*
*/
#include <linux/i2c.h>
#include <linux/gpio.h>
#include <linux/errno.h>
#include <linux/delay.h>
#include <linux/module.h>
#include <linux/debugfs.h>
#include <linux/workqueue.h>
#include <linux/interrupt.h>
#include <linux/slab.h>
#include <linux/i2c/smb137b.h>
#include <linux/power_supply.h>
#define SMB137B_MASK(BITS, POS) ((unsigned char)(((1 << BITS) - 1) << POS))
#define CHG_CURRENT_REG 0x00
#define FAST_CHG_CURRENT_MASK SMB137B_MASK(3, 5)
#define PRE_CHG_CURRENT_MASK SMB137B_MASK(2, 3)
#define TERM_CHG_CURRENT_MASK SMB137B_MASK(2, 1)
#define INPUT_CURRENT_LIMIT_REG 0x01
#define IN_CURRENT_MASK SMB137B_MASK(3, 5)
#define IN_CURRENT_LIMIT_EN_BIT BIT(2)
#define IN_CURRENT_DET_THRESH_MASK SMB137B_MASK(2, 0)
#define FLOAT_VOLTAGE_REG 0x02
#define STAT_OUT_POLARITY_BIT BIT(7)
#define FLOAT_VOLTAGE_MASK SMB137B_MASK(7, 0)
#define CONTROL_A_REG 0x03
#define AUTO_RECHARGE_DIS_BIT BIT(7)
#define CURR_CYCLE_TERM_BIT BIT(6)
#define PRE_TO_FAST_V_MASK SMB137B_MASK(3, 3)
#define TEMP_BEHAV_BIT BIT(2)
#define THERM_NTC_CURR_MODE_BIT BIT(1)
#define THERM_NTC_47KOHM_BIT BIT(0)
#define CONTROL_B_REG 0x04
#define STAT_OUTPUT_MODE_MASK SMB137B_MASK(2, 6)
#define BATT_OV_ENDS_CYCLE_BIT BIT(5)
#define AUTO_PRE_TO_FAST_DIS_BIT BIT(4)
#define SAFETY_TIMER_EN_BIT BIT(3)
#define OTG_LBR_WD_EN_BIT BIT(2)
#define CHG_WD_TIMER_EN_BIT BIT(1)
#define IRQ_OP_MASK BIT(0)
#define PIN_CTRL_REG 0x05
#define AUTO_CHG_EN_BIT BIT(7)
#define AUTO_LBR_EN_BIT BIT(6)
#define OTG_LBR_BIT BIT(5)
#define I2C_PIN_BIT BIT(4)
#define PIN_EN_CTRL_MASK SMB137B_MASK(2, 2)
#define OTG_LBR_PIN_CTRL_MASK SMB137B_MASK(2, 0)
#define OTG_LBR_CTRL_REG 0x06
#define BATT_MISSING_DET_EN_BIT BIT(7)
#define AUTO_RECHARGE_THRESH_MASK BIT(6)
#define USB_DP_DN_DET_EN_MASK BIT(5)
#define OTG_LBR_BATT_CURRENT_LIMIT_MASK SMB137B_MASK(2, 3)
#define OTG_LBR_UVLO_THRESH_MASK SMB137B_MASK(3, 0)
#define FAULT_INTR_REG 0x07
#define SAFETY_TIMER_EXP_MASK SMB137B_MASK(1, 7)
#define BATT_TEMP_UNSAFE_MASK SMB137B_MASK(1, 6)
#define INPUT_OVLO_IVLO_MASK SMB137B_MASK(1, 5)
#define BATT_OVLO_MASK SMB137B_MASK(1, 4)
#define INTERNAL_OVER_TEMP_MASK SMB137B_MASK(1, 2)
#define ENTER_TAPER_CHG_MASK SMB137B_MASK(1, 1)
#define CHG_MASK SMB137B_MASK(1, 0)
#define CELL_TEMP_MON_REG 0x08
#define THERMISTOR_CURR_MASK SMB137B_MASK(2, 6)
#define LOW_TEMP_CHG_INHIBIT_MASK SMB137B_MASK(3, 3)
#define HIGH_TEMP_CHG_INHIBIT_MASK SMB137B_MASK(3, 0)
#define SAFETY_TIMER_THERMAL_SHUTDOWN_REG 0x09
#define DCIN_OVLO_SEL_MASK SMB137B_MASK(2, 7)
#define RELOAD_EN_INPUT_VOLTAGE_MASK SMB137B_MASK(1, 6)
#define THERM_SHUTDN_EN_MASK SMB137B_MASK(1, 5)
#define STANDBY_WD_TIMER_EN_MASK SMB137B_MASK(1, 4)
#define COMPLETE_CHG_TMOUT_MASK SMB137B_MASK(2, 2)
#define PRE_CHG_TMOUT_MASK SMB137B_MASK(2, 0)
#define VSYS_REG 0x0A
#define VSYS_MASK SMB137B_MASK(3, 4)
#define IRQ_RESET_REG 0x30
#define COMMAND_A_REG 0x31
#define VOLATILE_REGS_WRITE_PERM_BIT BIT(7)
#define POR_BIT BIT(6)
#define FAST_CHG_SETTINGS_BIT BIT(5)
#define BATT_CHG_EN_BIT BIT(4)
#define USBIN_MODE_500_BIT BIT(3)
#define USBIN_MODE_HCMODE_BIT BIT(2)
#define OTG_LBR_EN_BIT BIT(1)
#define STAT_OE_BIT BIT(0)
#define STATUS_A_REG 0x32
#define INTERNAL_TEMP_IRQ_STAT BIT(4)
#define DCIN_OV_IRQ_STAT BIT(3)
#define DCIN_UV_IRQ_STAT BIT(2)
#define USBIN_OV_IRQ_STAT BIT(1)
#define USBIN_UV_IRQ_STAT BIT(0)
#define STATUS_B_REG 0x33
#define USB_PIN_STAT BIT(7)
#define USB51_MODE_STAT BIT(6)
#define USB51_HC_MODE_STAT BIT(5)
#define INTERNAL_TEMP_LIMIT_B_STAT BIT(4)
#define DC_IN_OV_STAT BIT(3)
#define DC_IN_UV_STAT BIT(2)
#define USB_IN_OV_STAT BIT(1)
#define USB_IN_UV_STAT BIT(0)
#define STATUS_C_REG 0x34
#define AUTO_IN_CURR_LIMIT_MASK SMB137B_MASK(4, 4)
#define AUTO_IN_CURR_LIMIT_STAT BIT(3)
#define AUTO_SOURCE_DET_COMP_STAT_MASK SMB137B_MASK(2, 1)
#define AUTO_SOURCE_DET_RESULT_STAT BIT(0)
#define STATUS_D_REG 0x35
#define VBATT_LESS_THAN_VSYS_STAT BIT(7)
#define USB_FAIL_STAT BIT(6)
#define BATT_TEMP_STAT_MASK SMB137B_MASK(2, 4)
#define INTERNAL_TEMP_LIMIT_STAT BIT(2)
#define OTG_LBR_MODE_EN_STAT BIT(1)
#define OTG_LBR_VBATT_UVLO_STAT BIT(0)
#define STATUS_E_REG 0x36
#define CHARGE_CYCLE_COUNT_STAT BIT(7)
#define CHARGER_TERM_STAT BIT(6)
#define SAFETY_TIMER_STAT_MASK SMB137B_MASK(2, 4)
#define CHARGER_ERROR_STAT BIT(3)
#define CHARGING_STAT_E SMB137B_MASK(2, 1)
#define CHARGING_EN BIT(0)
#define STATUS_F_REG 0x37
#define WD_IRQ_ACTIVE_STAT BIT(7)
#define OTG_OVERCURRENT_STAT BIT(6)
#define BATT_PRESENT_STAT BIT(4)
#define BATT_OV_LATCHED_STAT BIT(3)
#define CHARGER_OVLO_STAT BIT(2)
#define CHARGER_UVLO_STAT BIT(1)
#define BATT_LOW_STAT BIT(0)
#define STATUS_G_REG 0x38
#define CHARGE_TIMEOUT_IRQ_STAT BIT(7)
#define PRECHARGE_TIMEOUT_IRQ_STAT BIT(6)
#define BATT_HOT_IRQ_STAT BIT(5)
#define BATT_COLD_IRQ_STAT BIT(4)
#define BATT_OV_IRQ_STAT BIT(3)
#define TAPER_CHG_IRQ_STAT BIT(2)
#define FAST_CHG_IRQ_STAT BIT(1)
#define CHARGING_IRQ_STAT BIT(0)
#define STATUS_H_REG 0x39
#define CHARGE_TIMEOUT_STAT BIT(7)
#define PRECHARGE_TIMEOUT_STAT BIT(6)
#define BATT_HOT_STAT BIT(5)
#define BATT_COLD_STAT BIT(4)
#define BATT_OV_STAT BIT(3)
#define TAPER_CHG_STAT BIT(2)
#define FAST_CHG_STAT BIT(1)
#define CHARGING_STAT_H BIT(0)
#define DEV_ID_REG 0x3B
#define COMMAND_B_REG 0x3C
#define THERM_NTC_CURR_VERRIDE BIT(7)
#define SMB137B_CHG_PERIOD ((HZ) * 150)
#define INPUT_CURRENT_REG_DEFAULT 0xE1
#define INPUT_CURRENT_REG_MIN 0x01
#define COMMAND_A_REG_DEFAULT 0xA0
#define COMMAND_A_REG_OTG_MODE 0xA2
#define PIN_CTRL_REG_DEFAULT 0x08
#define PIN_CTRL_REG_CHG_OFF 0x04
#define FAST_CHG_E_STATUS 0x2
#define SMB137B_DEFAULT_BATT_RATING 950
struct smb137b_data {
struct i2c_client *client;
struct delayed_work charge_work;
bool charging;
int chgcurrent;
int term_current;
int max_system_voltage;
int min_system_voltage;
int valid_n_gpio;
struct power_supply psy_batt;
int batt_status;
int batt_chg_type;
int batt_present;
int min_design;
int max_design;
int batt_mah_rating;
struct power_supply psy_usb;
int usb_status;
bool stop_heartbeat;
bool disabled;
};
static void (*notify_vbus_state_func_ptr)(int);
static int usb_notified_of_insertion;
static struct smb137b_data *usb_smb137b_chg;
int smb137b_register_vbus_sn(void (*callback)(int))
{
pr_debug(KERN_INFO "%s\n", __func__);
notify_vbus_state_func_ptr = callback;
return 0;
}
void smb137b_unregister_vbus_sn(void (*callback)(int))
{
pr_debug(KERN_INFO "%s\n", __func__);
notify_vbus_state_func_ptr = NULL;
}
static void smb137b_notify_usb_of_the_plugin_event(struct smb137b_data
*smb137b_chg,
int plugin)
{
plugin = !!plugin;
if (plugin == 1 && usb_notified_of_insertion == 0) {
usb_notified_of_insertion = 1;
if (notify_vbus_state_func_ptr) {
pr_debug("%s notifying plugin\n", __func__);
(*notify_vbus_state_func_ptr) (plugin);
} else
pr_debug("%s unable to notify plugin\n",
__func__);
}
if (plugin == 0 && usb_notified_of_insertion == 1) {
if (notify_vbus_state_func_ptr) {
pr_debug("%s notifying unplugin\n",
__func__);
(*notify_vbus_state_func_ptr) (plugin);
} else
pr_debug("%s unable to notify unplugin\n",
__func__);
usb_notified_of_insertion = 0;
}
}
enum charger_stat {
SMB137B_ABSENT,
SMB137B_PRESENT,
SMB137B_ENUMERATED,
};
static enum power_supply_property power_props[] = {
POWER_SUPPLY_PROP_PRESENT,
POWER_SUPPLY_PROP_ONLINE,
};
static char *power_supplied_to[] = {
"battery",
};
static int power_get_property(struct power_supply *psy,
enum power_supply_property psp,
union power_supply_propval *val)
{
struct smb137b_data *smb137b_chg;
smb137b_chg = container_of(psy, struct smb137b_data,
psy_usb);
switch (psp) {
case POWER_SUPPLY_PROP_PRESENT:
val->intval = (smb137b_chg->usb_status != SMB137B_ABSENT);
break;
case POWER_SUPPLY_PROP_ONLINE:
val->intval = (smb137b_chg->usb_status == SMB137B_ENUMERATED);
break;
default:
return -EINVAL;
}
return 0;
}
static enum power_supply_property batt_power_props[] = {
POWER_SUPPLY_PROP_STATUS,
POWER_SUPPLY_PROP_CHARGE_TYPE,
POWER_SUPPLY_PROP_PRESENT,
POWER_SUPPLY_PROP_TECHNOLOGY,
POWER_SUPPLY_PROP_VOLTAGE_MAX_DESIGN,
POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN,
POWER_SUPPLY_PROP_VOLTAGE_NOW,
POWER_SUPPLY_PROP_CAPACITY,
};
static int batt_power_get_property(struct power_supply *psy,
enum power_supply_property psp,
union power_supply_propval *val)
{
struct smb137b_data *smb137b_chg;
smb137b_chg = container_of(psy, struct smb137b_data,
psy_batt);
switch (psp) {
case POWER_SUPPLY_PROP_STATUS:
val->intval = smb137b_chg->batt_status;
break;
case POWER_SUPPLY_PROP_CHARGE_TYPE:
val->intval = smb137b_chg->batt_chg_type;
break;
case POWER_SUPPLY_PROP_PRESENT:
val->intval = smb137b_chg->batt_present;
break;
case POWER_SUPPLY_PROP_TECHNOLOGY:
val->intval = POWER_SUPPLY_TECHNOLOGY_LION;
break;
case POWER_SUPPLY_PROP_VOLTAGE_MAX_DESIGN:
val->intval = smb137b_chg->max_design;
break;
case POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN:
val->intval = smb137b_chg->min_design;
break;
case POWER_SUPPLY_PROP_VOLTAGE_NOW:
/*TODO when the gauge driver is ready*/
val->intval = 3500000;
break;
case POWER_SUPPLY_PROP_CAPACITY:
/*TODO when the gauge driver is ready*/
val->intval = 50;
break;
default:
return -EINVAL;
}
return 0;
}
static int smb137b_read_reg(struct i2c_client *client, int reg,
u8 *val)
{
s32 ret;
struct smb137b_data *smb137b_chg;
smb137b_chg = i2c_get_clientdata(client);
ret = i2c_smbus_read_byte_data(smb137b_chg->client, reg);
if (ret < 0) {
dev_err(&smb137b_chg->client->dev,
"i2c read fail: can't read from %02x: %d\n", reg, ret);
return ret;
} else
*val = ret;
return 0;
}
static int smb137b_write_reg(struct i2c_client *client, int reg,
u8 val)
{
s32 ret;
struct smb137b_data *smb137b_chg;
smb137b_chg = i2c_get_clientdata(client);
ret = i2c_smbus_write_byte_data(smb137b_chg->client, reg, val);
if (ret < 0) {
dev_err(&smb137b_chg->client->dev,
"i2c write fail: can't write %02x to %02x: %d\n",
val, reg, ret);
return ret;
}
return 0;
}
#ifdef DEBUG
static void smb137b_dbg_print_status_regs(struct smb137b_data *smb137b_chg)
{
int ret;
u8 temp;
ret = smb137b_read_reg(smb137b_chg->client, STATUS_A_REG, &temp);
dev_dbg(&smb137b_chg->client->dev, "%s A=0x%x\n", __func__, temp);
ret = smb137b_read_reg(smb137b_chg->client, STATUS_B_REG, &temp);
dev_dbg(&smb137b_chg->client->dev, "%s B=0x%x\n", __func__, temp);
ret = smb137b_read_reg(smb137b_chg->client, STATUS_C_REG, &temp);
dev_dbg(&smb137b_chg->client->dev, "%s C=0x%x\n", __func__, temp);
ret = smb137b_read_reg(smb137b_chg->client, STATUS_D_REG, &temp);
dev_dbg(&smb137b_chg->client->dev, "%s D=0x%x\n", __func__, temp);
ret = smb137b_read_reg(smb137b_chg->client, STATUS_E_REG, &temp);
dev_dbg(&smb137b_chg->client->dev, "%s E=0x%x\n", __func__, temp);
ret = smb137b_read_reg(smb137b_chg->client, STATUS_F_REG, &temp);
dev_dbg(&smb137b_chg->client->dev, "%s F=0x%x\n", __func__, temp);
ret = smb137b_read_reg(smb137b_chg->client, STATUS_G_REG, &temp);
dev_dbg(&smb137b_chg->client->dev, "%s G=0x%x\n", __func__, temp);
ret = smb137b_read_reg(smb137b_chg->client, STATUS_H_REG, &temp);
dev_dbg(&smb137b_chg->client->dev, "%s H=0x%x\n", __func__, temp);
}
#else
static void smb137b_dbg_print_status_regs(struct smb137b_data *smb137b_chg)
{
}
#endif
static int smb137b_start_charging(struct smb137b_data *smb137b_chg,
int chg_current)
{
int cmd_val = COMMAND_A_REG_DEFAULT;
u8 temp = 0;
int ret = 0;
if (smb137b_chg->disabled) {
dev_err(&smb137b_chg->client->dev,
"%s called when disabled\n", __func__);
goto out;
}
if (smb137b_chg->charging == true
&& smb137b_chg->chgcurrent == chg_current)
/* we are already charging with the same current*/
dev_err(&smb137b_chg->client->dev,
"%s charge with same current %d called again\n",
__func__, chg_current);
dev_dbg(&smb137b_chg->client->dev, "%s\n", __func__);
if (chg_current < 500)
cmd_val &= ~USBIN_MODE_500_BIT;
else if (chg_current == 500)
cmd_val |= USBIN_MODE_500_BIT;
else
cmd_val |= USBIN_MODE_HCMODE_BIT;
smb137b_chg->chgcurrent = chg_current;
/*Due to non-volatile reload feature,always enable volatile
mirror writes before modifying any 00h~09h control register*/
ret = smb137b_write_reg(smb137b_chg->client,
COMMAND_A_REG, COMMAND_A_REG_DEFAULT);
if (ret) {
dev_err(&smb137b_chg->client->dev,
"%s couldn't write to command_reg\n", __func__);
goto out;
}
ret = smb137b_write_reg(smb137b_chg->client,
PIN_CTRL_REG, PIN_CTRL_REG_DEFAULT);
if (ret) {
dev_err(&smb137b_chg->client->dev,
"%s couldn't write to pin ctrl reg\n", __func__);
goto out;
}
ret = smb137b_write_reg(smb137b_chg->client, COMMAND_A_REG, cmd_val);
if (ret) {
dev_err(&smb137b_chg->client->dev,
"%s couldn't write to command_reg\n", __func__);
goto out;
}
smb137b_chg->charging = true;
smb137b_chg->batt_status = POWER_SUPPLY_STATUS_CHARGING;
smb137b_chg->batt_chg_type = POWER_SUPPLY_CHARGE_TYPE_TRICKLE;
ret = smb137b_read_reg(smb137b_chg->client, STATUS_E_REG, &temp);
if (ret) {
dev_err(&smb137b_chg->client->dev,
"%s couldn't read status e reg %d\n", __func__, ret);
} else {
if (temp & CHARGER_ERROR_STAT) {
dev_err(&smb137b_chg->client->dev,
"%s chg error E=0x%x\n", __func__, temp);
smb137b_dbg_print_status_regs(smb137b_chg);
}
if (((temp & CHARGING_STAT_E) >> 1) >= FAST_CHG_E_STATUS)
smb137b_chg->batt_chg_type
= POWER_SUPPLY_CHARGE_TYPE_FAST;
}
schedule_delayed_work(&smb137b_chg->charge_work, SMB137B_CHG_PERIOD);
power_supply_changed(&smb137b_chg->psy_batt);
out:
return ret;
}
static int smb137b_stop_charging(struct smb137b_data *smb137b_chg)
{
int ret = 0;
dev_dbg(&smb137b_chg->client->dev, "%s\n", __func__);
if (smb137b_chg->charging == false)
return 0;
smb137b_chg->charging = false;
smb137b_chg->batt_status = POWER_SUPPLY_STATUS_DISCHARGING;
smb137b_chg->batt_chg_type = POWER_SUPPLY_CHARGE_TYPE_NONE;
ret = smb137b_write_reg(smb137b_chg->client,
COMMAND_A_REG, COMMAND_A_REG_DEFAULT);
if (ret) {
dev_err(&smb137b_chg->client->dev,
"%s couldn't write to command_reg\n", __func__);
goto out;
}
ret = smb137b_write_reg(smb137b_chg->client,
PIN_CTRL_REG, PIN_CTRL_REG_CHG_OFF);
if (ret)
dev_err(&smb137b_chg->client->dev,
"%s couldn't write to pin ctrl reg\n", __func__);
power_supply_changed(&smb137b_chg->psy_batt);
out:
return ret;
}
static irqreturn_t smb137b_valid_handler(int irq, void *dev_id)
{
int val;
struct smb137b_data *smb137b_chg;
struct i2c_client *client = dev_id;
smb137b_chg = i2c_get_clientdata(client);
/*extra delay needed to allow CABLE_DET_N settling down and debounce
before trying to sample its correct value*/
usleep_range(1000, 1200);
val = gpio_get_value_cansleep(smb137b_chg->valid_n_gpio);
if (val < 0) {
dev_err(&smb137b_chg->client->dev,
"%s gpio_get_value failed for %d ret=%d\n", __func__,
smb137b_chg->valid_n_gpio, val);
goto err;
}
dev_dbg(&smb137b_chg->client->dev, "%s val=%d\n", __func__, val);
if (val) {
if (smb137b_chg->usb_status != SMB137B_ABSENT) {
smb137b_notify_usb_of_the_plugin_event(smb137b_chg,
0);
smb137b_stop_charging(smb137b_chg);
smb137b_chg->usb_status = SMB137B_ABSENT;
power_supply_changed(&smb137b_chg->psy_usb);
}
} else {
if (smb137b_chg->usb_status == SMB137B_ABSENT) {
smb137b_notify_usb_of_the_plugin_event(smb137b_chg,
1);
smb137b_chg->usb_status = SMB137B_PRESENT;
power_supply_changed(&smb137b_chg->psy_usb);
}
}
err:
return IRQ_HANDLED;
}
#ifdef CONFIG_DEBUG_FS
static struct dentry *dent;
static int debug_fs_otg;
static int otg_get(void *data, u64 *value)
{
*value = debug_fs_otg;
return 0;
}
static int otg_set(void *data, u64 value)
{
smb137b_otg_power(debug_fs_otg);
return 0;
}
DEFINE_SIMPLE_ATTRIBUTE(smb137b_otg_fops, otg_get, otg_set, "%llu\n");
static int disable_get(void *data, u64 *value)
{
struct smb137b_data *smb137b_chg = data;
*value = (u64)smb137b_chg->disabled;
return 0;
}
static int disable_set(void *data, u64 value)
{
struct smb137b_data *smb137b_chg = data;
smb137b_chg->disabled = !!value;
if (smb137b_chg->disabled)
smb137b_stop_charging(smb137b_chg);
return 0;
}
DEFINE_SIMPLE_ATTRIBUTE(smb137b_disable_fops,
disable_get, disable_set, "%llu\n");
static void smb137b_create_debugfs_entries(struct smb137b_data *smb137b_chg)
{
dent = debugfs_create_dir("smb137b", NULL);
if (dent) {
debugfs_create_file("otg", 0644, dent, NULL, &smb137b_otg_fops);
debugfs_create_file("disable", 0644, dent, smb137b_chg,
&smb137b_disable_fops);
}
}
static void smb137b_destroy_debugfs_entries(void)
{
if (dent)
debugfs_remove_recursive(dent);
}
#else
static void smb137b_create_debugfs_entries(struct smb137b_data *smb137b_chg)
{
}
static void smb137b_destroy_debugfs_entries(void)
{
}
#endif
static void smb137b_heartbeat(struct work_struct *smb137b_work)
{
int ret;
struct smb137b_data *smb137b_chg;
u8 temp = 0;
int notify_batt_changed = 0;
smb137b_chg = container_of(smb137b_work, struct smb137b_data,
charge_work.work);
if (smb137b_chg->stop_heartbeat)
return;
dev_dbg(&smb137b_chg->client->dev, "%s\n", __func__);
ret = smb137b_read_reg(smb137b_chg->client, STATUS_F_REG, &temp);
if (ret) {
dev_err(&smb137b_chg->client->dev,
"%s couldn't read status f reg %d\n", __func__, ret);
goto out;
}
if (smb137b_chg->batt_present != !(temp & BATT_PRESENT_STAT)) {
smb137b_chg->batt_present = !(temp & BATT_PRESENT_STAT);
notify_batt_changed = 1;
}
if (!smb137b_chg->batt_present)
smb137b_chg->batt_chg_type = POWER_SUPPLY_CHARGE_TYPE_NONE;
if (!smb137b_chg->batt_present && smb137b_chg->charging)
smb137b_stop_charging(smb137b_chg);
if (smb137b_chg->batt_present
&& smb137b_chg->charging
&& smb137b_chg->batt_chg_type
!= POWER_SUPPLY_CHARGE_TYPE_FAST) {
ret = smb137b_read_reg(smb137b_chg->client,
STATUS_E_REG, &temp);
if (ret) {
dev_err(&smb137b_chg->client->dev,
"%s couldn't read cntrl reg\n", __func__);
goto out;
} else {
if (temp && CHARGER_ERROR_STAT) {
dev_err(&smb137b_chg->client->dev,
"%s error E=0x%x\n", __func__, temp);
smb137b_dbg_print_status_regs(smb137b_chg);
}
if (((temp & CHARGING_STAT_E) >> 1)
>= FAST_CHG_E_STATUS) {
smb137b_chg->batt_chg_type
= POWER_SUPPLY_CHARGE_TYPE_FAST;
notify_batt_changed = 1;
} else {
smb137b_chg->batt_chg_type
= POWER_SUPPLY_CHARGE_TYPE_TRICKLE;
}
}
}
out:
if (notify_batt_changed == 1)
power_supply_changed(&smb137b_chg->psy_batt);
if (!smb137b_chg->stop_heartbeat)
schedule_delayed_work(&smb137b_chg->charge_work,
SMB137B_CHG_PERIOD);
}
static int __devinit smb137b_probe(struct i2c_client *client,
const struct i2c_device_id *id)
{
const struct smb137b_platform_data *pdata;
struct smb137b_data *smb137b_chg;
u8 temp;
int ret = 0;
pdata = client->dev.platform_data;
if (pdata == NULL) {
dev_err(&client->dev, "%s no platform data\n", __func__);
ret = -EINVAL;
goto out;
}
if (!i2c_check_functionality(client->adapter,
I2C_FUNC_SMBUS_BYTE_DATA)) {
ret = -EIO;
goto out;
}
smb137b_chg = kzalloc(sizeof(*smb137b_chg), GFP_KERNEL);
if (!smb137b_chg) {
ret = -ENOMEM;
goto out;
}
INIT_DELAYED_WORK(&smb137b_chg->charge_work, smb137b_heartbeat);
smb137b_chg->client = client;
smb137b_chg->valid_n_gpio = pdata->valid_n_gpio;
smb137b_chg->batt_mah_rating = pdata->batt_mah_rating;
if (smb137b_chg->batt_mah_rating == 0)
smb137b_chg->batt_mah_rating = SMB137B_DEFAULT_BATT_RATING;
if (pdata->chg_detection_config)
ret = pdata->chg_detection_config();
if (ret) {
dev_err(&client->dev, "%s valid config failed ret=%d\n",
__func__, ret);
goto free_smb137b_chg;
}
ret = gpio_request(pdata->valid_n_gpio, "smb137b_charger_valid");
if (ret) {
dev_err(&client->dev, "%s gpio_request failed for %d ret=%d\n",
__func__, pdata->valid_n_gpio, ret);
goto free_smb137b_chg;
}
i2c_set_clientdata(client, smb137b_chg);
ret = request_threaded_irq(client->irq, NULL,
smb137b_valid_handler,
IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING,
"smb137b_charger_valid", client);
if (ret) {
dev_err(&client->dev,
"%s request_threaded_irq failed for %d ret =%d\n",
__func__, client->irq, ret);
goto free_valid_gpio;
}
ret = gpio_get_value_cansleep(smb137b_chg->valid_n_gpio);
if (ret < 0) {
dev_err(&client->dev,
"%s gpio_get_value failed for %d ret=%d\n", __func__,
pdata->valid_n_gpio, ret);
/* assume absent */
ret = 1;
}
if (!ret) {
smb137b_notify_usb_of_the_plugin_event(smb137b_chg, 1);
smb137b_chg->usb_status = SMB137B_PRESENT;
}
/* enable the writes to non-volatile mirrors */
ret = smb137b_write_reg(client, COMMAND_A_REG, COMMAND_A_REG_DEFAULT);
temp = 0;
ret = smb137b_read_reg(smb137b_chg->client, OTG_LBR_CTRL_REG, &temp);
temp |= BATT_MISSING_DET_EN_BIT;
ret |= smb137b_write_reg(client, OTG_LBR_CTRL_REG, temp);
if (ret) {
dev_err(&smb137b_chg->client->dev,
"%s couldn't set registers for batt missing %d\n",
__func__, ret);
goto free_valid_irq;
}
/* turn off charging */
ret = smb137b_write_reg(smb137b_chg->client,
PIN_CTRL_REG, PIN_CTRL_REG_CHG_OFF);
smb137b_chg->psy_batt.name = "battery";
smb137b_chg->psy_batt.type = POWER_SUPPLY_TYPE_BATTERY;
smb137b_chg->psy_batt.properties = batt_power_props;
smb137b_chg->psy_batt.num_properties = ARRAY_SIZE(batt_power_props);
smb137b_chg->psy_batt.get_property = batt_power_get_property;
smb137b_chg->psy_usb.name = "usb";
smb137b_chg->psy_usb.type = POWER_SUPPLY_TYPE_USB;
smb137b_chg->psy_usb.supplied_to = power_supplied_to;
smb137b_chg->psy_usb.num_supplicants = ARRAY_SIZE(power_supplied_to);
smb137b_chg->psy_usb.properties = power_props;
smb137b_chg->psy_usb.num_properties = ARRAY_SIZE(power_props);
smb137b_chg->psy_usb.get_property = power_get_property;
/*TODO read min_design and max_design from chip registers*/
smb137b_chg->min_design = 3200;
smb137b_chg->max_design = 4200;
smb137b_chg->batt_status = POWER_SUPPLY_STATUS_DISCHARGING;
smb137b_chg->batt_chg_type = POWER_SUPPLY_CHARGE_TYPE_NONE;
ret = smb137b_read_reg(smb137b_chg->client, STATUS_F_REG, &temp);
if (ret) {
dev_err(&smb137b_chg->client->dev,
"%s couldn't read status f reg %d\n", __func__, ret);
goto free_valid_irq;
}
if (!(temp & BATT_PRESENT_STAT))
smb137b_chg->batt_present = 1;
ret = power_supply_register(&client->dev, &smb137b_chg->psy_batt);
if (ret) {
dev_err(&client->dev,
"%s power_supply_register fail for battery ret=%d\n",
__func__, ret);
goto free_valid_irq;
}
ret = power_supply_register(&client->dev, &smb137b_chg->psy_usb);
if (ret) {
dev_err(&client->dev,
"%s power_supply_register fail for usb ret=%d\n",
__func__, ret);
goto free_batt_psy;
}
usb_smb137b_chg = smb137b_chg;
dev_dbg(&smb137b_chg->client->dev, "%s start heartbeat\n", __func__);
schedule_delayed_work(&smb137b_chg->charge_work, SMB137B_CHG_PERIOD);
smb137b_create_debugfs_entries(smb137b_chg);
dev_dbg(&client->dev,
"%s OK chg_state=%d\n", __func__, smb137b_chg->usb_status);
return 0;
free_batt_psy:
power_supply_unregister(&smb137b_chg->psy_batt);
free_valid_irq:
free_irq(client->irq, client);
free_valid_gpio:
gpio_free(pdata->valid_n_gpio);
free_smb137b_chg:
kfree(smb137b_chg);
out:
return ret;
}
void smb137b_otg_power(int on)
{
int ret;
pr_debug("%s Enter on=%d\n", __func__, on);
if (on) {
ret = smb137b_write_reg(usb_smb137b_chg->client,
PIN_CTRL_REG, PIN_CTRL_REG_CHG_OFF);
if (ret) {
pr_err("%s turning off charging in pin_ctrl err=%d\n",
__func__, ret);
/*
* dont change the command register if we cant
* overwrite pin control
*/
return;
}
ret = smb137b_write_reg(usb_smb137b_chg->client,
COMMAND_A_REG, COMMAND_A_REG_OTG_MODE);
if (ret)
pr_err("%s failed turning on OTG mode ret=%d\n",
__func__, ret);
} else {
ret = smb137b_write_reg(usb_smb137b_chg->client,
COMMAND_A_REG, COMMAND_A_REG_DEFAULT);
if (ret)
pr_err("%s failed turning off OTG mode ret=%d\n",
__func__, ret);
ret = smb137b_write_reg(usb_smb137b_chg->client,
PIN_CTRL_REG, PIN_CTRL_REG_DEFAULT);
if (ret)
pr_err("%s failed writing to pn_ctrl ret=%d\n",
__func__, ret);
}
}
void smb137b_vbus_draw(unsigned int mA)
{
pr_debug("%s mA=%d\n", __func__, mA);
if (usb_smb137b_chg == NULL) {
pr_err("%s Called without charger notifying USB\n", __func__);
return;
}
if (mA == 0)
smb137b_stop_charging(usb_smb137b_chg);
else
smb137b_start_charging(usb_smb137b_chg, mA);
}
static int __devexit smb137b_remove(struct i2c_client *client)
{
const struct smb137b_platform_data *pdata;
struct smb137b_data *smb137b_chg = i2c_get_clientdata(client);
smb137b_chg->stop_heartbeat = true;
smp_mb();
pdata = client->dev.platform_data;
free_irq(client->irq, client);
gpio_free(pdata->valid_n_gpio);
cancel_delayed_work_sync(&smb137b_chg->charge_work);
smb137b_stop_charging(smb137b_chg);
power_supply_unregister(&smb137b_chg->psy_usb);
power_supply_unregister(&smb137b_chg->psy_batt);
smb137b_destroy_debugfs_entries();
kfree(smb137b_chg);
return 0;
}
#ifdef CONFIG_PM
static int smb137b_suspend(struct device *dev)
{
struct smb137b_data *smb137b_chg = dev_get_drvdata(dev);
dev_dbg(&smb137b_chg->client->dev, "%s\n", __func__);
if (delayed_work_pending(&smb137b_chg->charge_work)) {
smb137b_chg->stop_heartbeat = true;
smp_mb();
cancel_delayed_work_sync(&smb137b_chg->charge_work);
}
return 0;
}
static int smb137b_resume(struct device *dev)
{
struct smb137b_data *smb137b_chg = dev_get_drvdata(dev);
dev_dbg(&smb137b_chg->client->dev, "%s\n", __func__);
smb137b_chg->stop_heartbeat = false;
schedule_delayed_work(&smb137b_chg->charge_work,
SMB137B_CHG_PERIOD);
return 0;
}
static const struct dev_pm_ops smb137b_pm_ops = {
.suspend = smb137b_suspend,
.resume = smb137b_resume,
};
#endif
static const struct i2c_device_id smb137b_id[] = {
{"smb137b", 0},
{},
};
MODULE_DEVICE_TABLE(i2c, smb137b_id);
static struct i2c_driver smb137b_driver = {
.driver = {
.name = "smb137b",
.owner = THIS_MODULE,
#ifdef CONFIG_PM
.pm = &smb137b_pm_ops,
#endif
},
.probe = smb137b_probe,
.remove = __devexit_p(smb137b_remove),
.id_table = smb137b_id,
};
static int __init smb137b_init(void)
{
return i2c_add_driver(&smb137b_driver);
}
module_init(smb137b_init);
static void __exit smb137b_exit(void)
{
return i2c_del_driver(&smb137b_driver);
}
module_exit(smb137b_exit);
MODULE_AUTHOR("Abhijeet Dharmapurikar <adharmap@codeaurora.org>");
MODULE_DESCRIPTION("Driver for SMB137B Charger chip");
MODULE_LICENSE("GPL v2");
MODULE_ALIAS("i2c:smb137b");
|
/*
* Copyright (C) 2011, Red Hat Inc, Arnaldo Carvalho de Melo <acme@redhat.com>
*
* Parts came from builtin-{top,stat,record}.c, see those files for further
* copyright notes.
*
* Released under the GPL v2. (and only v2, not any later version)
*/
#include "util.h"
#include "debugfs.h"
#include <poll.h>
#include "cpumap.h"
#include "thread_map.h"
#include "target.h"
#include "evlist.h"
#include "evsel.h"
#include <unistd.h>
#include "parse-events.h"
#include <sys/mman.h>
#include <linux/bitops.h>
#include <linux/hash.h>
#define FD(e, x, y) (*(int *)xyarray__entry(e->fd, x, y))
#define SID(e, x, y) xyarray__entry(e->sample_id, x, y)
void perf_evlist__init(struct perf_evlist *evlist, struct cpu_map *cpus,
struct thread_map *threads)
{
int i;
for (i = 0; i < PERF_EVLIST__HLIST_SIZE; ++i)
INIT_HLIST_HEAD(&evlist->heads[i]);
INIT_LIST_HEAD(&evlist->entries);
perf_evlist__set_maps(evlist, cpus, threads);
evlist->workload.pid = -1;
}
struct perf_evlist *perf_evlist__new(struct cpu_map *cpus,
struct thread_map *threads)
{
struct perf_evlist *evlist = zalloc(sizeof(*evlist));
if (evlist != NULL)
perf_evlist__init(evlist, cpus, threads);
return evlist;
}
void perf_evlist__config_attrs(struct perf_evlist *evlist,
struct perf_record_opts *opts)
{
struct perf_evsel *evsel;
if (evlist->cpus->map[0] < 0)
opts->no_inherit = true;
list_for_each_entry(evsel, &evlist->entries, node) {
perf_evsel__config(evsel, opts);
if (evlist->nr_entries > 1)
evsel->attr.sample_type |= PERF_SAMPLE_ID;
}
}
static void perf_evlist__purge(struct perf_evlist *evlist)
{
struct perf_evsel *pos, *n;
list_for_each_entry_safe(pos, n, &evlist->entries, node) {
list_del_init(&pos->node);
perf_evsel__delete(pos);
}
evlist->nr_entries = 0;
}
void perf_evlist__exit(struct perf_evlist *evlist)
{
free(evlist->mmap);
free(evlist->pollfd);
evlist->mmap = NULL;
evlist->pollfd = NULL;
}
void perf_evlist__delete(struct perf_evlist *evlist)
{
perf_evlist__purge(evlist);
perf_evlist__exit(evlist);
free(evlist);
}
void perf_evlist__add(struct perf_evlist *evlist, struct perf_evsel *entry)
{
list_add_tail(&entry->node, &evlist->entries);
++evlist->nr_entries;
}
void perf_evlist__splice_list_tail(struct perf_evlist *evlist,
struct list_head *list,
int nr_entries)
{
list_splice_tail(list, &evlist->entries);
evlist->nr_entries += nr_entries;
}
void __perf_evlist__set_leader(struct list_head *list)
{
struct perf_evsel *evsel, *leader;
leader = list_entry(list->next, struct perf_evsel, node);
leader->leader = NULL;
list_for_each_entry(evsel, list, node) {
if (evsel != leader)
evsel->leader = leader;
}
}
void perf_evlist__set_leader(struct perf_evlist *evlist)
{
if (evlist->nr_entries)
__perf_evlist__set_leader(&evlist->entries);
}
int perf_evlist__add_default(struct perf_evlist *evlist)
{
struct perf_event_attr attr = {
.type = PERF_TYPE_HARDWARE,
.config = PERF_COUNT_HW_CPU_CYCLES,
};
struct perf_evsel *evsel;
event_attr_init(&attr);
evsel = perf_evsel__new(&attr, 0);
if (evsel == NULL)
goto error;
/* use strdup() because free(evsel) assumes name is allocated */
evsel->name = strdup("cycles");
if (!evsel->name)
goto error_free;
perf_evlist__add(evlist, evsel);
return 0;
error_free:
perf_evsel__delete(evsel);
error:
return -ENOMEM;
}
static int perf_evlist__add_attrs(struct perf_evlist *evlist,
struct perf_event_attr *attrs, size_t nr_attrs)
{
struct perf_evsel *evsel, *n;
LIST_HEAD(head);
size_t i;
for (i = 0; i < nr_attrs; i++) {
evsel = perf_evsel__new(attrs + i, evlist->nr_entries + i);
if (evsel == NULL)
goto out_delete_partial_list;
list_add_tail(&evsel->node, &head);
}
perf_evlist__splice_list_tail(evlist, &head, nr_attrs);
return 0;
out_delete_partial_list:
list_for_each_entry_safe(evsel, n, &head, node)
perf_evsel__delete(evsel);
return -1;
}
int __perf_evlist__add_default_attrs(struct perf_evlist *evlist,
struct perf_event_attr *attrs, size_t nr_attrs)
{
size_t i;
for (i = 0; i < nr_attrs; i++)
event_attr_init(attrs + i);
return perf_evlist__add_attrs(evlist, attrs, nr_attrs);
}
struct perf_evsel *
perf_evlist__find_tracepoint_by_id(struct perf_evlist *evlist, int id)
{
struct perf_evsel *evsel;
list_for_each_entry(evsel, &evlist->entries, node) {
if (evsel->attr.type == PERF_TYPE_TRACEPOINT &&
(int)evsel->attr.config == id)
return evsel;
}
return NULL;
}
int perf_evlist__add_newtp(struct perf_evlist *evlist,
const char *sys, const char *name, void *handler)
{
struct perf_evsel *evsel;
evsel = perf_evsel__newtp(sys, name, evlist->nr_entries);
if (evsel == NULL)
return -1;
evsel->handler.func = handler;
perf_evlist__add(evlist, evsel);
return 0;
}
void perf_evlist__disable(struct perf_evlist *evlist)
{
int cpu, thread;
struct perf_evsel *pos;
for (cpu = 0; cpu < evlist->cpus->nr; cpu++) {
list_for_each_entry(pos, &evlist->entries, node) {
if (perf_evsel__is_group_member(pos))
continue;
for (thread = 0; thread < evlist->threads->nr; thread++)
ioctl(FD(pos, cpu, thread),
PERF_EVENT_IOC_DISABLE, 0);
}
}
}
void perf_evlist__enable(struct perf_evlist *evlist)
{
int cpu, thread;
struct perf_evsel *pos;
for (cpu = 0; cpu < cpu_map__nr(evlist->cpus); cpu++) {
list_for_each_entry(pos, &evlist->entries, node) {
if (perf_evsel__is_group_member(pos))
continue;
for (thread = 0; thread < evlist->threads->nr; thread++)
ioctl(FD(pos, cpu, thread),
PERF_EVENT_IOC_ENABLE, 0);
}
}
}
static int perf_evlist__alloc_pollfd(struct perf_evlist *evlist)
{
int nfds = cpu_map__nr(evlist->cpus) * evlist->threads->nr * evlist->nr_entries;
evlist->pollfd = malloc(sizeof(struct pollfd) * nfds);
return evlist->pollfd != NULL ? 0 : -ENOMEM;
}
void perf_evlist__add_pollfd(struct perf_evlist *evlist, int fd)
{
fcntl(fd, F_SETFL, O_NONBLOCK);
evlist->pollfd[evlist->nr_fds].fd = fd;
evlist->pollfd[evlist->nr_fds].events = POLLIN;
evlist->nr_fds++;
}
static void perf_evlist__id_hash(struct perf_evlist *evlist,
struct perf_evsel *evsel,
int cpu, int thread, u64 id)
{
int hash;
struct perf_sample_id *sid = SID(evsel, cpu, thread);
sid->id = id;
sid->evsel = evsel;
hash = hash_64(sid->id, PERF_EVLIST__HLIST_BITS);
hlist_add_head(&sid->node, &evlist->heads[hash]);
}
void perf_evlist__id_add(struct perf_evlist *evlist, struct perf_evsel *evsel,
int cpu, int thread, u64 id)
{
perf_evlist__id_hash(evlist, evsel, cpu, thread, id);
evsel->id[evsel->ids++] = id;
}
static int perf_evlist__id_add_fd(struct perf_evlist *evlist,
struct perf_evsel *evsel,
int cpu, int thread, int fd)
{
u64 read_data[4] = { 0, };
int id_idx = 1; /* The first entry is the counter value */
if (!(evsel->attr.read_format & PERF_FORMAT_ID) ||
read(fd, &read_data, sizeof(read_data)) == -1)
return -1;
if (evsel->attr.read_format & PERF_FORMAT_TOTAL_TIME_ENABLED)
++id_idx;
if (evsel->attr.read_format & PERF_FORMAT_TOTAL_TIME_RUNNING)
++id_idx;
perf_evlist__id_add(evlist, evsel, cpu, thread, read_data[id_idx]);
return 0;
}
struct perf_evsel *perf_evlist__id2evsel(struct perf_evlist *evlist, u64 id)
{
struct hlist_head *head;
struct hlist_node *pos;
struct perf_sample_id *sid;
int hash;
if (evlist->nr_entries == 1)
return perf_evlist__first(evlist);
hash = hash_64(id, PERF_EVLIST__HLIST_BITS);
head = &evlist->heads[hash];
hlist_for_each_entry(sid, pos, head, node)
if (sid->id == id)
return sid->evsel;
if (!perf_evlist__sample_id_all(evlist))
return perf_evlist__first(evlist);
return NULL;
}
union perf_event *perf_evlist__mmap_read(struct perf_evlist *evlist, int idx)
{
struct perf_mmap *md = &evlist->mmap[idx];
unsigned int head = perf_mmap__read_head(md);
unsigned int old = md->prev;
unsigned char *data = md->base + page_size;
union perf_event *event = NULL;
if (evlist->overwrite) {
/*
* If we're further behind than half the buffer, there's a chance
* the writer will bite our tail and mess up the samples under us.
*
* If we somehow ended up ahead of the head, we got messed up.
*
* In either case, truncate and restart at head.
*/
int diff = head - old;
if (diff > md->mask / 2 || diff < 0) {
fprintf(stderr, "WARNING: failed to keep up with mmap data.\n");
/*
* head points to a known good entry, start there.
*/
old = head;
}
}
if (old != head) {
size_t size;
event = (union perf_event *)&data[old & md->mask];
size = event->header.size;
/*
* Event straddles the mmap boundary -- header should always
* be inside due to u64 alignment of output.
*/
if ((old & md->mask) + size != ((old + size) & md->mask)) {
unsigned int offset = old;
unsigned int len = min(sizeof(*event), size), cpy;
void *dst = &evlist->event_copy;
do {
cpy = min(md->mask + 1 - (offset & md->mask), len);
memcpy(dst, &data[offset & md->mask], cpy);
offset += cpy;
dst += cpy;
len -= cpy;
} while (len);
event = &evlist->event_copy;
}
old += size;
}
md->prev = old;
if (!evlist->overwrite)
perf_mmap__write_tail(md, old);
return event;
}
void perf_evlist__munmap(struct perf_evlist *evlist)
{
int i;
for (i = 0; i < evlist->nr_mmaps; i++) {
if (evlist->mmap[i].base != NULL) {
munmap(evlist->mmap[i].base, evlist->mmap_len);
evlist->mmap[i].base = NULL;
}
}
free(evlist->mmap);
evlist->mmap = NULL;
}
static int perf_evlist__alloc_mmap(struct perf_evlist *evlist)
{
evlist->nr_mmaps = cpu_map__nr(evlist->cpus);
if (cpu_map__all(evlist->cpus))
evlist->nr_mmaps = evlist->threads->nr;
evlist->mmap = zalloc(evlist->nr_mmaps * sizeof(struct perf_mmap));
return evlist->mmap != NULL ? 0 : -ENOMEM;
}
static int __perf_evlist__mmap(struct perf_evlist *evlist,
int idx, int prot, int mask, int fd)
{
evlist->mmap[idx].prev = 0;
evlist->mmap[idx].mask = mask;
evlist->mmap[idx].base = mmap(NULL, evlist->mmap_len, prot,
MAP_SHARED, fd, 0);
if (evlist->mmap[idx].base == MAP_FAILED) {
evlist->mmap[idx].base = NULL;
return -1;
}
perf_evlist__add_pollfd(evlist, fd);
return 0;
}
static int perf_evlist__mmap_per_cpu(struct perf_evlist *evlist, int prot, int mask)
{
struct perf_evsel *evsel;
int cpu, thread;
for (cpu = 0; cpu < evlist->cpus->nr; cpu++) {
int output = -1;
for (thread = 0; thread < evlist->threads->nr; thread++) {
list_for_each_entry(evsel, &evlist->entries, node) {
int fd = FD(evsel, cpu, thread);
if (output == -1) {
output = fd;
if (__perf_evlist__mmap(evlist, cpu,
prot, mask, output) < 0)
goto out_unmap;
} else {
if (ioctl(fd, PERF_EVENT_IOC_SET_OUTPUT, output) != 0)
goto out_unmap;
}
if ((evsel->attr.read_format & PERF_FORMAT_ID) &&
perf_evlist__id_add_fd(evlist, evsel, cpu, thread, fd) < 0)
goto out_unmap;
}
}
}
return 0;
out_unmap:
for (cpu = 0; cpu < evlist->cpus->nr; cpu++) {
if (evlist->mmap[cpu].base != NULL) {
munmap(evlist->mmap[cpu].base, evlist->mmap_len);
evlist->mmap[cpu].base = NULL;
}
}
return -1;
}
static int perf_evlist__mmap_per_thread(struct perf_evlist *evlist, int prot, int mask)
{
struct perf_evsel *evsel;
int thread;
for (thread = 0; thread < evlist->threads->nr; thread++) {
int output = -1;
list_for_each_entry(evsel, &evlist->entries, node) {
int fd = FD(evsel, 0, thread);
if (output == -1) {
output = fd;
if (__perf_evlist__mmap(evlist, thread,
prot, mask, output) < 0)
goto out_unmap;
} else {
if (ioctl(fd, PERF_EVENT_IOC_SET_OUTPUT, output) != 0)
goto out_unmap;
}
if ((evsel->attr.read_format & PERF_FORMAT_ID) &&
perf_evlist__id_add_fd(evlist, evsel, 0, thread, fd) < 0)
goto out_unmap;
}
}
return 0;
out_unmap:
for (thread = 0; thread < evlist->threads->nr; thread++) {
if (evlist->mmap[thread].base != NULL) {
munmap(evlist->mmap[thread].base, evlist->mmap_len);
evlist->mmap[thread].base = NULL;
}
}
return -1;
}
/** perf_evlist__mmap - Create per cpu maps to receive events
*
* @evlist - list of events
* @pages - map length in pages
* @overwrite - overwrite older events?
*
* If overwrite is false the user needs to signal event consuption using:
*
* struct perf_mmap *m = &evlist->mmap[cpu];
* unsigned int head = perf_mmap__read_head(m);
*
* perf_mmap__write_tail(m, head)
*
* Using perf_evlist__read_on_cpu does this automatically.
*/
int perf_evlist__mmap(struct perf_evlist *evlist, unsigned int pages,
bool overwrite)
{
struct perf_evsel *evsel;
const struct cpu_map *cpus = evlist->cpus;
const struct thread_map *threads = evlist->threads;
int prot = PROT_READ | (overwrite ? 0 : PROT_WRITE), mask;
/* 512 kiB: default amount of unprivileged mlocked memory */
if (pages == UINT_MAX)
pages = (512 * 1024) / page_size;
else if (!is_power_of_2(pages))
return -EINVAL;
mask = pages * page_size - 1;
if (evlist->mmap == NULL && perf_evlist__alloc_mmap(evlist) < 0)
return -ENOMEM;
if (evlist->pollfd == NULL && perf_evlist__alloc_pollfd(evlist) < 0)
return -ENOMEM;
evlist->overwrite = overwrite;
evlist->mmap_len = (pages + 1) * page_size;
list_for_each_entry(evsel, &evlist->entries, node) {
if ((evsel->attr.read_format & PERF_FORMAT_ID) &&
evsel->sample_id == NULL &&
perf_evsel__alloc_id(evsel, cpu_map__nr(cpus), threads->nr) < 0)
return -ENOMEM;
}
if (cpu_map__all(cpus))
return perf_evlist__mmap_per_thread(evlist, prot, mask);
return perf_evlist__mmap_per_cpu(evlist, prot, mask);
}
int perf_evlist__create_maps(struct perf_evlist *evlist,
struct perf_target *target)
{
evlist->threads = thread_map__new_str(target->pid, target->tid,
target->uid);
if (evlist->threads == NULL)
return -1;
if (perf_target__has_task(target))
evlist->cpus = cpu_map__dummy_new();
else if (!perf_target__has_cpu(target) && !target->uses_mmap)
evlist->cpus = cpu_map__dummy_new();
else
evlist->cpus = cpu_map__new(target->cpu_list);
if (evlist->cpus == NULL)
goto out_delete_threads;
return 0;
out_delete_threads:
thread_map__delete(evlist->threads);
return -1;
}
void perf_evlist__delete_maps(struct perf_evlist *evlist)
{
cpu_map__delete(evlist->cpus);
thread_map__delete(evlist->threads);
evlist->cpus = NULL;
evlist->threads = NULL;
}
int perf_evlist__apply_filters(struct perf_evlist *evlist)
{
struct perf_evsel *evsel;
int err = 0;
const int ncpus = cpu_map__nr(evlist->cpus),
nthreads = evlist->threads->nr;
list_for_each_entry(evsel, &evlist->entries, node) {
if (evsel->filter == NULL)
continue;
err = perf_evsel__set_filter(evsel, ncpus, nthreads, evsel->filter);
if (err)
break;
}
return err;
}
int perf_evlist__set_filter(struct perf_evlist *evlist, const char *filter)
{
struct perf_evsel *evsel;
int err = 0;
const int ncpus = cpu_map__nr(evlist->cpus),
nthreads = evlist->threads->nr;
list_for_each_entry(evsel, &evlist->entries, node) {
err = perf_evsel__set_filter(evsel, ncpus, nthreads, filter);
if (err)
break;
}
return err;
}
bool perf_evlist__valid_sample_type(struct perf_evlist *evlist)
{
struct perf_evsel *first = perf_evlist__first(evlist), *pos = first;
list_for_each_entry_continue(pos, &evlist->entries, node) {
if (first->attr.sample_type != pos->attr.sample_type)
return false;
}
return true;
}
u64 perf_evlist__sample_type(struct perf_evlist *evlist)
{
struct perf_evsel *first = perf_evlist__first(evlist);
return first->attr.sample_type;
}
u16 perf_evlist__id_hdr_size(struct perf_evlist *evlist)
{
struct perf_evsel *first = perf_evlist__first(evlist);
struct perf_sample *data;
u64 sample_type;
u16 size = 0;
if (!first->attr.sample_id_all)
goto out;
sample_type = first->attr.sample_type;
if (sample_type & PERF_SAMPLE_TID)
size += sizeof(data->tid) * 2;
if (sample_type & PERF_SAMPLE_TIME)
size += sizeof(data->time);
if (sample_type & PERF_SAMPLE_ID)
size += sizeof(data->id);
if (sample_type & PERF_SAMPLE_STREAM_ID)
size += sizeof(data->stream_id);
if (sample_type & PERF_SAMPLE_CPU)
size += sizeof(data->cpu) * 2;
out:
return size;
}
bool perf_evlist__valid_sample_id_all(struct perf_evlist *evlist)
{
struct perf_evsel *first = perf_evlist__first(evlist), *pos = first;
list_for_each_entry_continue(pos, &evlist->entries, node) {
if (first->attr.sample_id_all != pos->attr.sample_id_all)
return false;
}
return true;
}
bool perf_evlist__sample_id_all(struct perf_evlist *evlist)
{
struct perf_evsel *first = perf_evlist__first(evlist);
return first->attr.sample_id_all;
}
void perf_evlist__set_selected(struct perf_evlist *evlist,
struct perf_evsel *evsel)
{
evlist->selected = evsel;
}
int perf_evlist__open(struct perf_evlist *evlist)
{
struct perf_evsel *evsel;
int err, ncpus, nthreads;
list_for_each_entry(evsel, &evlist->entries, node) {
err = perf_evsel__open(evsel, evlist->cpus, evlist->threads);
if (err < 0)
goto out_err;
}
return 0;
out_err:
ncpus = evlist->cpus ? evlist->cpus->nr : 1;
nthreads = evlist->threads ? evlist->threads->nr : 1;
list_for_each_entry_reverse(evsel, &evlist->entries, node)
perf_evsel__close(evsel, ncpus, nthreads);
errno = -err;
return err;
}
int perf_evlist__prepare_workload(struct perf_evlist *evlist,
struct perf_record_opts *opts,
const char *argv[])
{
int child_ready_pipe[2], go_pipe[2];
char bf;
if (pipe(child_ready_pipe) < 0) {
perror("failed to create 'ready' pipe");
return -1;
}
if (pipe(go_pipe) < 0) {
perror("failed to create 'go' pipe");
goto out_close_ready_pipe;
}
evlist->workload.pid = fork();
if (evlist->workload.pid < 0) {
perror("failed to fork");
goto out_close_pipes;
}
if (!evlist->workload.pid) {
if (opts->pipe_output)
dup2(2, 1);
close(child_ready_pipe[0]);
close(go_pipe[1]);
fcntl(go_pipe[0], F_SETFD, FD_CLOEXEC);
/*
* Do a dummy execvp to get the PLT entry resolved,
* so we avoid the resolver overhead on the real
* execvp call.
*/
execvp("", (char **)argv);
/*
* Tell the parent we're ready to go
*/
close(child_ready_pipe[1]);
/*
* Wait until the parent tells us to go.
*/
if (read(go_pipe[0], &bf, 1) == -1)
perror("unable to read pipe");
execvp(argv[0], (char **)argv);
perror(argv[0]);
kill(getppid(), SIGUSR1);
exit(-1);
}
if (perf_target__none(&opts->target))
evlist->threads->map[0] = evlist->workload.pid;
close(child_ready_pipe[1]);
close(go_pipe[0]);
/*
* wait for child to settle
*/
if (read(child_ready_pipe[0], &bf, 1) == -1) {
perror("unable to read pipe");
goto out_close_pipes;
}
evlist->workload.cork_fd = go_pipe[1];
close(child_ready_pipe[0]);
return 0;
out_close_pipes:
close(go_pipe[0]);
close(go_pipe[1]);
out_close_ready_pipe:
close(child_ready_pipe[0]);
close(child_ready_pipe[1]);
return -1;
}
int perf_evlist__start_workload(struct perf_evlist *evlist)
{
if (evlist->workload.cork_fd > 0) {
/*
* Remove the cork, let it rip!
*/
return close(evlist->workload.cork_fd);
}
return 0;
}
int perf_evlist__parse_sample(struct perf_evlist *evlist, union perf_event *event,
struct perf_sample *sample)
{
struct perf_evsel *evsel = perf_evlist__first(evlist);
return perf_evsel__parse_sample(evsel, event, sample);
}
size_t perf_evlist__fprintf(struct perf_evlist *evlist, FILE *fp)
{
struct perf_evsel *evsel;
size_t printed = 0;
list_for_each_entry(evsel, &evlist->entries, node) {
printed += fprintf(fp, "%s%s", evsel->idx ? ", " : "",
perf_evsel__name(evsel));
}
return printed + fprintf(fp, "\n");;
}
|
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You 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.
#
from __future__ import print_function
from pyspark import SparkContext
# $example on$
from pyspark.mllib.stat import Statistics
# $example off$
if __name__ == "__main__":
sc = SparkContext(appName="HypothesisTestingKolmogorovSmirnovTestExample")
# $example on$
parallelData = sc.parallelize([0.1, 0.15, 0.2, 0.3, 0.25])
# run a KS test for the sample versus a standard normal distribution
testResult = Statistics.kolmogorovSmirnovTest(parallelData, "norm", 0, 1)
# summary of the test including the p-value, test statistic, and null hypothesis
# if our p-value indicates significance, we can reject the null hypothesis
# Note that the Scala functionality of calling Statistics.kolmogorovSmirnovTest with
# a lambda to calculate the CDF is not made available in the Python API
print(testResult)
# $example off$
sc.stop()
|
<?php
/**
* BackPress Styles enqueue.
*
* These classes were refactored from the WordPress WP_Scripts and WordPress
* script enqueue API.
*
* @package BackPress
* @since r74
*/
/**
* BackPress Styles enqueue class.
*
* @package BackPress
* @uses WP_Dependencies
* @since r74
*/
class WP_Styles extends WP_Dependencies {
var $base_url;
var $content_url;
var $default_version;
var $text_direction = 'ltr';
var $concat = '';
var $concat_version = '';
var $do_concat = false;
var $print_html = '';
var $print_code = '';
var $default_dirs;
function __construct() {
do_action_ref_array( 'wp_default_styles', array(&$this) );
}
function do_item( $handle ) {
if ( !parent::do_item($handle) )
return false;
$obj = $this->registered[$handle];
if ( null === $obj->ver )
$ver = '';
else
$ver = $obj->ver ? $obj->ver : $this->default_version;
if ( isset($this->args[$handle]) )
$ver = $ver ? $ver . '&' . $this->args[$handle] : $this->args[$handle];
if ( $this->do_concat ) {
if ( $this->in_default_dir($obj->src) && !isset($obj->extra['conditional']) && !isset($obj->extra['alt']) ) {
$this->concat .= "$handle,";
$this->concat_version .= "$handle$ver";
$this->print_code .= $this->print_inline_style( $handle, false );
return true;
}
}
if ( isset($obj->args) )
$media = esc_attr( $obj->args );
else
$media = 'all';
$href = $this->_css_href( $obj->src, $ver, $handle );
$rel = isset($obj->extra['alt']) && $obj->extra['alt'] ? 'alternate stylesheet' : 'stylesheet';
$title = isset($obj->extra['title']) ? "title='" . esc_attr( $obj->extra['title'] ) . "'" : '';
$end_cond = $tag = '';
if ( isset($obj->extra['conditional']) && $obj->extra['conditional'] ) {
$tag .= "<!--[if {$obj->extra['conditional']}]>\n";
$end_cond = "<![endif]-->\n";
}
$tag .= apply_filters( 'style_loader_tag', "<link rel='$rel' id='$handle-css' $title href='$href' type='text/css' media='$media' />\n", $handle );
if ( 'rtl' === $this->text_direction && isset($obj->extra['rtl']) && $obj->extra['rtl'] ) {
if ( is_bool( $obj->extra['rtl'] ) ) {
$suffix = isset( $obj->extra['suffix'] ) ? $obj->extra['suffix'] : '';
$rtl_href = str_replace( "{$suffix}.css", "-rtl{$suffix}.css", $this->_css_href( $obj->src , $ver, "$handle-rtl" ));
} else {
$rtl_href = $this->_css_href( $obj->extra['rtl'], $ver, "$handle-rtl" );
}
$tag .= apply_filters( 'style_loader_tag', "<link rel='$rel' id='$handle-rtl-css' $title href='$rtl_href' type='text/css' media='$media' />\n", $handle );
}
$tag .= $end_cond;
if ( $this->do_concat ) {
$this->print_html .= $tag;
$this->print_html .= $this->print_inline_style( $handle, false );
} else {
echo $tag;
$this->print_inline_style( $handle );
}
return true;
}
function add_inline_style( $handle, $code ) {
if ( !$code )
return false;
$after = $this->get_data( $handle, 'after' );
if ( !$after )
$after = array();
$after[] = $code;
return $this->add_data( $handle, 'after', $after );
}
function print_inline_style( $handle, $echo = true ) {
$output = $this->get_data( $handle, 'after' );
if ( empty( $output ) )
return false;
$output = implode( "\n", $output );
if ( !$echo )
return $output;
echo "<style type='text/css'>\n";
echo "$output\n";
echo "</style>\n";
return true;
}
function all_deps( $handles, $recursion = false, $group = false ) {
$r = parent::all_deps( $handles, $recursion );
if ( !$recursion )
$this->to_do = apply_filters( 'print_styles_array', $this->to_do );
return $r;
}
function _css_href( $src, $ver, $handle ) {
if ( !is_bool($src) && !preg_match('|^(https?:)?//|', $src) && ! ( $this->content_url && 0 === strpos($src, $this->content_url) ) ) {
$src = $this->base_url . $src;
}
if ( !empty($ver) )
$src = add_query_arg('ver', $ver, $src);
$src = apply_filters( 'style_loader_src', $src, $handle );
return esc_url( $src );
}
function in_default_dir($src) {
if ( ! $this->default_dirs )
return true;
foreach ( (array) $this->default_dirs as $test ) {
if ( 0 === strpos($src, $test) )
return true;
}
return false;
}
function do_footer_items() { // HTML 5 allows styles in the body, grab late enqueued items and output them in the footer.
$this->do_items(false, 1);
return $this->done;
}
function reset() {
$this->do_concat = false;
$this->concat = '';
$this->concat_version = '';
$this->print_html = '';
}
}
|
/*
* Copyright (C) 2013 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef WTF_EnumClass_h
#define WTF_EnumClass_h
#include <wtf/Compiler.h>
namespace WTF {
// How to define a type safe enum list using the ENUM_CLASS macros?
// ===============================================================
// To get an enum list like this:
//
// enum class MyEnums {
// Value1,
// Value2,
// ...
// ValueN
// };
//
// ... write this:
//
// ENUM_CLASS(MyEnums) {
// Value1,
// Value2,
// ...
// ValueN
// } ENUM_CLASS_END(MyEnums);
//
// The ENUM_CLASS macros will use C++11's enum class if the compiler supports it.
// Otherwise, it will use the EnumClass template below.
#if COMPILER_SUPPORTS(CXX_STRONG_ENUMS)
#define ENUM_CLASS(__enumName) \
enum class __enumName
#define ENUM_CLASS_END(__enumName)
#else // !COMPILER_SUPPORTS(CXX_STRONG_ENUMS)
// How to define a type safe enum list using the EnumClass template?
// ================================================================
// Definition should be a struct that encapsulates an enum list.
// The enum list should be names Enums.
//
// Here's an example of how to define a type safe enum named MyEnum using
// the EnumClass template:
//
// struct MyEnumDefinition {
// enum Enums {
// ValueDefault,
// Value1,
// ...
// ValueN
// };
// };
// typedef EnumClass<MyEnumDefinition, MyEnumDefinition::ValueDefault> MyEnum;
//
// With that, you can now use MyEnum enum values as follow:
//
// MyEnum value1; // value1 is assigned MyEnum::ValueDefault by default.
// MyEnum value2 = MyEnum::Value1; // value2 is assigned MyEnum::Value1;
template <typename Definition>
class EnumClass : public Definition {
typedef enum Definition::Enums Value;
public:
ALWAYS_INLINE EnumClass() { }
ALWAYS_INLINE EnumClass(Value value) : m_value(value) { }
ALWAYS_INLINE Value value() const { return m_value; }
ALWAYS_INLINE bool operator==(const EnumClass other) { return m_value == other.m_value; }
ALWAYS_INLINE bool operator!=(const EnumClass other) { return m_value != other.m_value; }
ALWAYS_INLINE bool operator<(const EnumClass other) { return m_value < other.m_value; }
ALWAYS_INLINE bool operator<=(const EnumClass other) { return m_value <= other.m_value; }
ALWAYS_INLINE bool operator>(const EnumClass other) { return m_value > other.m_value; }
ALWAYS_INLINE bool operator>=(const EnumClass other) { return m_value >= other.m_value; }
ALWAYS_INLINE bool operator==(const Value value) { return m_value == value; }
ALWAYS_INLINE bool operator!=(const Value value) { return m_value != value; }
ALWAYS_INLINE bool operator<(const Value value) { return m_value < value; }
ALWAYS_INLINE bool operator<=(const Value value) { return m_value <= value; }
ALWAYS_INLINE bool operator>(const Value value) { return m_value > value; }
ALWAYS_INLINE bool operator>=(const Value value) { return m_value >= value; }
ALWAYS_INLINE operator Value() { return m_value; }
private:
Value m_value;
};
#define ENUM_CLASS(__enumName) \
struct __enumName ## Definition { \
enum Enums
#define ENUM_CLASS_END(__enumName) \
; \
}; \
typedef EnumClass< __enumName ## Definition > __enumName
#endif // !COMPILER_SUPPORTS(CXX_STRONG_ENUMS)
} // namespace WTF
#if !COMPILER_SUPPORTS(CXX_STRONG_ENUMS)
using WTF::EnumClass;
#endif
#endif // WTF_EnumClass_h
|
/*
* # Semantic - Breadcrumb
* http://github.com/jlukic/semantic-ui/
*
*
* Copyright 2013 Contributors
* Released under the MIT license
* http://opensource.org/licenses/MIT
*
*/
/*******************************
Breadcrumb
*******************************/
.ui.breadcrumb {
margin: 1em 0em;
display: inline-block;
vertical-align: middle;
}
.ui.breadcrumb:first-child {
margin-top: 0em;
}
.ui.breadcrumb:last-child {
margin-bottom: 0em;
}
/*******************************
Content
*******************************/
.ui.breadcrumb .divider {
display: inline-block;
opacity: 0.5;
margin: 0em 0.15em 0em;
font-size: 1em;
color: rgba(0, 0, 0, 0.3);
}
.ui.breadcrumb a.section {
cursor: pointer;
}
.ui.breadcrumb .section {
display: inline-block;
margin: 0em;
padding: 0em;
}
/* Loose Coupling */
.ui.breadcrumb.segment {
display: inline-block;
padding: 0.5em 1em;
}
/*******************************
States
*******************************/
.ui.breadcrumb .active.section {
font-weight: bold;
}
/*******************************
Variations
*******************************/
.ui.small.breadcrumb {
font-size: 0.75em;
}
.ui.large.breadcrumb {
font-size: 1.1em;
}
.ui.huge.breadcrumb {
font-size: 1.3em;
}
/*
* # Semantic - Form
* http://github.com/jlukic/semantic-ui/
*
*
* Copyright 2013 Contributors
* Released under the MIT license
* http://opensource.org/licenses/MIT
*
*/
/*******************************
Standard
*******************************/
/*--------------------
Form
---------------------*/
.ui.form {
position: relative;
max-width: 100%;
}
.ui.form :first-child {
margin-top: 0em;
}
.ui.form :last-child {
margin-bottom: 0em;
}
/*--------------------
Content
---------------------*/
.ui.form > p {
margin: 1em 0;
}
/*--------------------
Field
---------------------*/
.ui.form .field {
clear: both;
margin: 0em 0em 1em;
}
/*--------------------
Labels
---------------------*/
.ui.form .field > label {
margin: 0em 0em 0.3em;
display: block;
color: #555555;
font-size: 0.875em;
}
/*--------------------
Standard Inputs
---------------------*/
.ui.form textarea,
.ui.form select,
.ui.form input[type="text"],
.ui.form input[type="email"],
.ui.form input[type="date"],
.ui.form input[type="password"],
.ui.form input[type="number"],
.ui.form input[type="tel"],
.ui.form .ui.input {
width: 100%;
}
.ui.form textarea,
.ui.form select,
.ui.form input[type="text"],
.ui.form input[type="email"],
.ui.form input[type="date"],
.ui.form input[type="password"],
.ui.form input[type="number"],
.ui.form input[type="tel"] {
margin: 0em;
padding: 0.85em 1.2em;
font-size: 0.875em;
background-color: #FFFFFF;
border: 1px solid rgba(0, 0, 0, 0.15);
outline: none;
color: rgba(0, 0, 0, 0.7);
-webkit-border-radius: 0.3125em;
-moz-border-radius: 0.3125em;
border-radius: 0.3125em;
-webkit-transition: background-color 0.3s ease-out, box-shadow 0.2s ease, border-color 0.2s ease;
-moz-transition: background-color 0.3s ease-out, box-shadow 0.2s ease, border-color 0.2s ease;
-o-transition: background-color 0.3s ease-out, box-shadow 0.2s ease, border-color 0.2s ease;
-ms-transition: background-color 0.3s ease-out, box-shadow 0.2s ease, border-color 0.2s ease;
transition: background-color 0.3s ease-out, box-shadow 0.2s ease, border-color 0.2s ease;
-webkit-box-shadow: 0em 0em 0em 0em rgba(0, 0, 0, 0.3) inset;
-moz-box-shadow: 0em 0em 0em 0em rgba(0, 0, 0, 0.3) inset;
box-shadow: 0em 0em 0em 0em rgba(0, 0, 0, 0.3) inset;
-webkit-appearance: none;
-webkit-tap-highlight-color: rgba(255, 255, 255, 0);
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
-ms-box-sizing: border-box;
box-sizing: border-box;
}
.ui.textarea,
.ui.form textarea {
line-height: 1.33;
min-height: 8em;
height: 12em;
max-height: 24em;
resize: vertical;
}
.ui.form textarea,
.ui.form input[type="checkbox"] {
vertical-align: top;
}
/*--------------------
Dividers
---------------------*/
.ui.form .divider {
clear: both;
margin: 1em 0em;
}
/*--------------------
Types of Messages
---------------------*/
.ui.form .info.message,
.ui.form .warning.message,
.ui.form .error.message {
display: none;
}
/* Assumptions */
.ui.form .message:first-child {
margin-top: 0px;
}
/*--------------------
Validation Prompt
---------------------*/
.ui.form .field .prompt.label {
white-space: nowrap;
}
.ui.form .inline.field .prompt {
margin-top: 0em;
margin-left: 1em;
}
.ui.form .inline.field .prompt:before {
margin-top: -0.3em;
bottom: auto;
right: auto;
top: 50%;
left: 0em;
}
/*******************************
States
*******************************/
/*--------------------
Focus
---------------------*/
.ui.form input[type="text"]:focus,
.ui.form input[type="email"]:focus,
.ui.form input[type="date"]:focus,
.ui.form input[type="password"]:focus,
.ui.form input[type="number"]:focus,
.ui.form input[type="tel"]:focus,
.ui.form textarea:focus,
.ui.form select:focus {
color: rgba(0, 0, 0, 0.85);
border-color: rgba(0, 0, 0, 0.2);
border-bottom-left-radius: 0;
border-top-left-radius: 0;
-webkit-appearance: none;
-webkit-box-shadow: 0.3em 0em 0em 0em rgba(0, 0, 0, 0.2) inset;
-moz-box-shadow: 0.3em 0em 0em 0em rgba(0, 0, 0, 0.2) inset;
box-shadow: 0.3em 0em 0em 0em rgba(0, 0, 0, 0.2) inset;
}
/*--------------------
Error
---------------------*/
/* On Form */
.ui.form.warning .warning.message {
display: block;
}
/*--------------------
Warning
---------------------*/
/* On Form */
.ui.form.error .error.message {
display: block;
}
/* On Field(s) */
.ui.form .fields.error .field label,
.ui.form .field.error label {
color: #D95C5C;
}
.ui.form .fields.error .field textarea,
.ui.form .fields.error .field input[type="text"],
.ui.form .fields.error .field input[type="email"],
.ui.form .fields.error .field input[type="date"],
.ui.form .fields.error .field input[type="password"],
.ui.form .fields.error .field input[type="number"],
.ui.form .fields.error .field input[type="tel"],
.ui.form .field.error textarea,
.ui.form .field.error input[type="text"],
.ui.form .field.error input[type="email"],
.ui.form .field.error input[type="date"],
.ui.form .field.error input[type="password"],
.ui.form .field.error input[type="number"],
.ui.form .field.error input[type="tel"] {
background-color: #FFFAFA;
border-color: #E7BEBE;
border-left: none;
color: #D95C5C;
padding-left: 1.2em;
border-bottom-left-radius: 0;
border-top-left-radius: 0;
-webkit-box-shadow: 0.3em 0em 0em 0em #D95C5C inset;
-moz-box-shadow: 0.3em 0em 0em 0em #D95C5C inset;
box-shadow: 0.3em 0em 0em 0em #D95C5C inset;
}
.ui.form .field.error textarea:focus,
.ui.form .field.error input[type="text"]:focus,
.ui.form .field.error input[type="email"]:focus,
.ui.form .field.error input[type="date"]:focus,
.ui.form .field.error input[type="password"]:focus,
.ui.form .field.error input[type="number"]:focus,
.ui.form .field.error input[type="tel"]:focus {
border-color: #ff5050;
color: #ff5050;
-webkit-appearance: none;
-webkit-box-shadow: 0.3em 0em 0em 0em #FF5050 inset;
-moz-box-shadow: 0.3em 0em 0em 0em #FF5050 inset;
box-shadow: 0.3em 0em 0em 0em #FF5050 inset;
}
/*--------------------
Empty (Placeholder)
---------------------*/
/* browsers require these rules separate */
.ui.form ::-webkit-input-placeholder {
color: #E0E0E0;
}
.ui.form ::-moz-placeholder {
color: #E0E0E0;
}
.ui.form :focus::-webkit-input-placeholder {
color: #AAAAAA;
}
.ui.form :focus::-moz-placeholder {
color: #AAAAAA;
}
/* Error Placeholder */
.ui.form .error ::-webkit-input-placeholder {
color: rgba(255, 80, 80, 0.4);
}
.ui.form .error ::-moz-placeholder {
color: rgba(255, 80, 80, 0.4);
}
.ui.form .error :focus::-webkit-input-placeholder {
color: rgba(255, 80, 80, 0.7);
}
.ui.form .error :focus::-moz-placeholder {
color: rgba(255, 80, 80, 0.7);
}
/*--------------------
Disabled
---------------------*/
.ui.form .field :disabled,
.ui.form .field.disabled {
opacity: 0.5;
}
.ui.form .field.disabled label {
opacity: 0.5;
}
.ui.form .field.disabled :disabled {
opacity: 1;
}
/*--------------------
Loading State
---------------------*/
/* On Form */
.ui.form.loading {
position: relative;
}
.ui.form.loading:after {
position: absolute;
top: 0%;
left: 0%;
content: '';
width: 100%;
height: 100%;
background: rgba(255, 255, 255, 0.8) url(../images/loader-large.gif) no-repeat 50% 50%;
visibility: visible;
}
/*******************************
Variations
*******************************/
/*--------------------
Fluid Width
---------------------*/
.ui.form.fluid {
width: 100%;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
-ms-box-sizing: border-box;
box-sizing: border-box;
}
/*--------------------------
Input w/ attached Button
---------------------------*/
.ui.form input.attached {
width: auto;
}
/*--------------------
Date Input
---------------------*/
.ui.form .date.field > label {
position: relative;
}
.ui.form .date.field > label:after {
position: absolute;
top: 2em;
right: 0.5em;
font-family: 'Icons';
content: '\f133';
font-size: 1.2em;
font-weight: normal;
color: #CCCCCC;
}
/*--------------------
Inverted Colors
---------------------*/
.ui.inverted.form label {
color: #FFFFFF;
}
.ui.inverted.form .field.error textarea,
.ui.inverted.form .field.error input[type="text"],
.ui.inverted.form .field.error input[type="email"],
.ui.inverted.form .field.error input[type="date"],
.ui.inverted.form .field.error input[type="password"],
.ui.inverted.form .field.error input[type="number"],
.ui.inverted.form .field.error input[type="tel"] {
background-color: #FFCCCC;
}
/*--------------------
Field Groups
---------------------*/
/* Grouped Vertically */
.ui.form .grouped.fields {
margin: 0em 0em 1em;
}
.ui.form .grouped.fields .field {
display: block;
float: none;
margin: 0.5em 0em;
padding: 0em;
}
/*--------------------
Fields
---------------------*/
/* Split fields */
.ui.form .fields {
clear: both;
}
.ui.form .fields:after {
content: ' ';
display: block;
clear: both;
visibility: hidden;
line-height: 0;
height: 0;
}
.ui.form .fields > .field {
clear: none;
float: left;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
-ms-box-sizing: border-box;
box-sizing: border-box;
}
.ui.form .fields > .field:first-child {
border-left: none;
box-shadow: none;
}
/* Other Combinations */
.ui.form .two.fields > .fields,
.ui.form .two.fields > .field {
width: 50%;
padding-left: 1%;
padding-right: 1%;
}
.ui.form .three.fields > .fields,
.ui.form .three.fields > .field {
width: 33.333%;
padding-left: 1%;
padding-right: 1%;
}
.ui.form .four.fields > .fields,
.ui.form .four.fields > .field {
width: 25%;
padding-left: 1%;
padding-right: 1%;
}
.ui.form .five.fields > .fields,
.ui.form .five.fields > .field {
width: 20%;
padding-left: 1%;
padding-right: 1%;
}
.ui.form .fields .field:first-child {
padding-left: 0%;
}
.ui.form .fields .field:last-child {
padding-right: 0%;
}
/*--------------------
Inline Fields
---------------------*/
.ui.form .inline.fields .field {
min-height: 1.3em;
margin-right: 0.5em;
}
.ui.form .inline.fields .field > label,
.ui.form .inline.fields .field > p,
.ui.form .inline.fields .field > input,
.ui.form .inline.field > label,
.ui.form .inline.field > p,
.ui.form .inline.field > input {
display: inline-block;
width: auto;
margin-top: 0em;
margin-bottom: 0em;
vertical-align: middle;
font-size: 1em;
}
.ui.form .inline.fields .field > input,
.ui.form .inline.field > input {
font-size: 0.875em;
}
.ui.form .inline.fields .field > :first-child,
.ui.form .inline.field > :first-child {
margin: 0em 0.5em 0em 0em;
}
.ui.form .inline.fields .field > :only-child,
.ui.form .inline.field > :only-child {
margin: 0em;
}
/*--------------------
Sizes
---------------------*/
/* Standard */
.ui.small.form {
font-size: 0.875em;
}
.ui.small.form textarea,
.ui.small.form input[type="text"],
.ui.small.form input[type="email"],
.ui.small.form input[type="date"],
.ui.small.form input[type="password"],
.ui.small.form input[type="number"],
.ui.small.form input[type="tel"],
.ui.small.form label,
.ui.small.form select {
font-size: 1em;
}
/* Large */
.ui.large.form {
font-size: 1.125em;
}
/*
* # Semantic - Grid
* http://github.com/jlukic/semantic-ui/
*
*
* Copyright 2013 Contributors
* Released under the MIT license
* http://opensource.org/licenses/MIT
*
*/
/*******************************
Grid
*******************************/
.ui.grid {
display: block;
text-align: left;
font-size: 0em;
margin: 0% -1.5%;
padding: 0%;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
-ms-box-sizing: border-box;
box-sizing: border-box;
}
body > .ui.grid {
margin-left: 0%;
margin-right: 0%;
}
.ui.grid:after,
.ui.row:after {
content: ".";
display: block;
height: 0;
clear: both;
visibility: hidden;
}
/*-------------------
Columns
--------------------*/
.ui.grid > .column,
.ui.grid > .row > .column {
display: inline-block;
text-align: left;
font-size: 1rem;
padding-left: 1.5%;
padding-right: 1.5%;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
-ms-box-sizing: border-box;
box-sizing: border-box;
vertical-align: top;
}
/*-------------------
Rows
--------------------*/
.ui.grid > .row {
display: block;
width: 100% !important;
margin-top: 1.5%;
padding: 1.5% 0% 0%;
font-size: 0rem;
}
.ui.grid > .row:first-child {
padding-top: 0rem;
margin-top: 0rem;
}
/*-------------------
Content
--------------------*/
.ui.grid > .row > img,
.ui.grid > .row > .column > img {
max-width: 100%;
}
.ui.grid .column > .ui.segment:only-child {
margin: 0em;
}
/*******************************
Variations
*******************************/
/*-----------------------
Page Grid (Responsive)
-------------------------*/
.ui.page.grid {
min-width: 320px;
margin-left: 0%;
margin-right: 0%;
}
@media only screen and (max-width: 998px) {
.ui.page.grid {
padding: 0% 4%;
}
}
@media only screen and (min-width: 998px) {
.ui.page.grid {
padding: 0% 8%;
}
}
@media only screen and (min-width: 1500px) {
.ui.page.grid {
padding: 0% 13%;
}
}
@media only screen and (min-width: 1750px) {
.ui.page.grid {
padding: 0% 18%;
}
}
@media only screen and (min-width: 2000px) {
.ui.page.grid {
padding: 0% 23%;
}
}
/*-------------------
Column Width
--------------------*/
/* Sizing Combinations */
.ui.grid > .row > .one.wide.column,
.ui.grid > .one.wide.column {
width: 6.25%;
}
.ui.grid > .row > .two.wide.column,
.ui.grid > .two.wide.column {
width: 12.5%;
}
.ui.grid > .row > .three.wide.column,
.ui.grid > .three.wide.column {
width: 18.75%;
}
.ui.grid > .row > .four.wide.column,
.ui.grid > .four.wide.column {
width: 25%;
}
.ui.grid > .row > .five.wide.column,
.ui.grid > .five.wide.column {
width: 31.25%;
}
.ui.grid > .row > .six.wide.column,
.ui.grid > .six.wide.column {
width: 37.5%;
}
.ui.grid > .row > .seven.wide.column,
.ui.grid > .seven.wide.column {
width: 43.75%;
}
.ui.grid > .row > .eight.wide.column,
.ui.grid > .eight.wide.column {
width: 50%;
}
.ui.grid > .row > .nine.wide.column,
.ui.grid > .nine.wide.column {
width: 56.25%;
}
.ui.grid > .row > .ten.wide.column,
.ui.grid > .ten.wide.column {
width: 62.5%;
}
.ui.grid > .row > .eleven.wide.column,
.ui.grid > .eleven.wide.column {
width: 68.75%;
}
.ui.grid > .row > .twelve.wide.column,
.ui.grid > .twelve.wide.column {
width: 75%;
}
.ui.grid > .row > .thirteen.wide.column,
.ui.grid > .thirteen.wide.column {
width: 81.25%;
}
.ui.grid > .row > .fourteen.wide.column,
.ui.grid > .fourteen.wide.column {
width: 87.5%;
}
.ui.grid > .row > .fifteen.wide.column,
.ui.grid > .fifteen.wide.column {
width: 93.75%;
}
.ui.grid > .row > .sixteen.wide.column,
.ui.grid > .sixteen.wide.column {
width: 100%;
}
/*-------------------
Column Count
--------------------*/
/* Standard */
.ui.grid > .column,
.ui.grid > .row > .column {
width: 6.25%;
}
/* Assume full width with one column */
.ui.one.column.grid > .row > .column,
.ui.one.column.grid > .column,
.ui.grid > .one.column.row > .column {
width: 100%;
}
.ui.two.column.grid > .row > .column,
.ui.two.column.grid > .column,
.ui.grid > .two.column.row > .column {
width: 50%;
}
.ui.three.column.grid > .row > .column,
.ui.three.column.grid > .column,
.ui.grid > .three.column.row > .column {
width: 33.3333%;
}
.ui.four.column.grid > .row > .column,
.ui.four.column.grid > .column,
.ui.grid > .four.column.row > .column {
width: 25%;
}
.ui.five.column.grid > .row > .column,
.ui.five.column.grid > .column,
.ui.grid > .five.column.row > .column {
width: 20%;
}
.ui.six.column.grid > .row > .column,
.ui.six.column.grid > .column,
.ui.grid > .six.column.row > .column {
width: 16.66667%;
}
.ui.seven.column.grid > .row > .column,
.ui.seven.column.grid > .column,
.ui.grid > .seven.column.row > .column {
width: 14.2857%;
}
.ui.eight.column.grid > .row > .column,
.ui.eight.column.grid > .column,
.ui.grid > .eight.column.row > .column {
width: 12.5%;
}
.ui.nine.column.grid > .row > .column,
.ui.nine.column.grid > .column,
.ui.grid > .nine.column.row > .column {
width: 11.1111%;
}
.ui.ten.column.grid > .row > .column,
.ui.ten.column.grid > .column,
.ui.grid > .ten.column.row > .column {
width: 10%;
}
.ui.eleven.column.grid > .row > .column,
.ui.eleven.column.grid > .column,
.ui.grid > .eleven.column.row > .column {
width: 9.0909%;
}
.ui.twelve.column.grid > .row > .column,
.ui.twelve.column.grid > .column,
.ui.grid > .twelve.column.row > .column {
width: 8.3333%;
}
.ui.thirteen.column.grid > .row > .column,
.ui.thirteen.column.grid > .column,
.ui.grid > .thirteen.column.row > .column {
width: 7.6923%;
}
.ui.fourteen.column.grid > .row > .column,
.ui.fourteen.column.grid > .column,
.ui.grid > .fourteen.column.row > .column {
width: 7.1428%;
}
.ui.fifteen.column.grid > .row > .column,
.ui.fifteen.column.grid > .column,
.ui.grid > .fifteen.column.row > .column {
width: 6.6666%;
}
.ui.sixteen.column.grid > .row > .column,
.ui.sixteen.column.grid > .column,
.ui.grid > .sixteen.column.row > .column {
width: 6.25%;
}
/* Assume full width with one column */
.ui.grid > .column:only-child,
.ui.grid > .row > .column:only-child {
width: 100%;
}
/*----------------------
Relaxed
-----------------------*/
.ui.relaxed.grid {
margin: 0% -2.5%;
}
.ui.relaxed.grid > .column,
.ui.relaxed.grid > .row > .column {
padding-left: 2.5%;
padding-right: 2.5%;
}
/*----------------------
"Floated"
-----------------------*/
.ui.grid .left.floated.column {
float: left;
}
.ui.grid .right.floated.column {
float: right;
}
/*----------------------
Divided
-----------------------*/
.ui.divided.grid,
.ui.divided.grid > .row {
display: table;
width: 100%;
margin-left: 0% !important;
margin-right: 0% !important;
}
.ui.divided.grid > .column:not(.row),
.ui.divided.grid > .row > .column {
display: table-cell;
-webkit-box-shadow: -1px 0px 0px 0px rgba(0, 0, 0, 0.1), -2px 0px 0px 0px rgba(255, 255, 255, 0.8);
-moz-box-shadow: -1px 0px 0px 0px rgba(0, 0, 0, 0.1), -2px 0px 0px 0px rgba(255, 255, 255, 0.8);
box-shadow: -1px 0px 0px 0px rgba(0, 0, 0, 0.1), -2px 0px 0px 0px rgba(255, 255, 255, 0.8);
}
.ui.divided.grid > .column.row {
display: table;
}
.ui.divided.grid > .column:first-child,
.ui.divided.grid > .row > .column:first-child {
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
}
/* Vertically Divided */
.ui.vertically.divided.grid > .row {
-webkit-box-shadow: 0px -1px 0px 0px rgba(0, 0, 0, 0.1), 0px -2px 0px 0px rgba(255, 255, 255, 0.8) !important;
-moz-box-shadow: 0px -1px 0px 0px rgba(0, 0, 0, 0.1), 0px -2px 0px 0px rgba(255, 255, 255, 0.8) !important;
box-shadow: 0px -1px 0px 0px rgba(0, 0, 0, 0.1), 0px -2px 0px 0px rgba(255, 255, 255, 0.8) !important;
}
.ui.vertically.divided.grid > .row > .column,
.ui.vertically.divided.grid > .column:not(.row),
.ui.vertically.divided.grid > .row:first-child {
-webkit-box-shadow: none !important;
-moz-box-shadow: none !important;
box-shadow: none !important;
}
/*----------------------
Celled
-----------------------*/
.ui.celled.grid {
display: table;
width: 100%;
margin-left: 0% !important;
margin-right: 0% !important;
-webkit-box-shadow: 0px 0px 0px 1px #DFDFDF;
-moz-box-shadow: 0px 0px 0px 1px #DFDFDF;
box-shadow: 0px 0px 0px 1px #DFDFDF;
}
.ui.celled.grid > .row,
.ui.celled.grid > .column.row,
.ui.celled.grid > .column.row:first-child {
display: table;
width: 100%;
margin-top: 0em;
padding-top: 0em;
-webkit-box-shadow: 0px -1px 0px 0px #dfdfdf;
-moz-box-shadow: 0px -1px 0px 0px #dfdfdf;
box-shadow: 0px -1px 0px 0px #dfdfdf;
}
.ui.celled.grid > .column:not(.row),
.ui.celled.grid > .row > .column {
display: table-cell;
padding: 0.75em;
-webkit-box-shadow: -1px 0px 0px 0px #dfdfdf;
-moz-box-shadow: -1px 0px 0px 0px #dfdfdf;
box-shadow: -1px 0px 0px 0px #dfdfdf;
}
.ui.celled.grid > .column:first-child,
.ui.celled.grid > .row > .column:first-child {
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
}
.ui.celled.page.grid {
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
}
/*----------------------
Horizontally Centered
-----------------------*/
/* Vertical Centered */
.ui.left.aligned.grid,
.ui.left.aligned.grid > .row > .column,
.ui.left.aligned.grid > .column,
.ui.grid .left.aligned.column,
.ui.grid > .left.aligned.row > .column {
text-align: left;
}
.ui.center.aligned.grid,
.ui.center.aligned.grid > .row > .column,
.ui.center.aligned.grid > .column,
.ui.grid .center.aligned.column,
.ui.grid > .center.aligned.row > .column {
text-align: center;
}
.ui.right.aligned.grid,
.ui.right.aligned.grid > .row > .column,
.ui.right.aligned.grid > .column,
.ui.grid .right.aligned.column,
.ui.grid > .right.aligned.row > .column {
text-align: right;
}
/*----------------------
Vertically Centered
-----------------------*/
/* Vertical Centered */
.ui.top.aligned.grid,
.ui.top.aligned.grid > .row > .column,
.ui.top.aligned.grid > .column,
.ui.grid .top.aligned.column,
.ui.grid > .top.aligned.row > .column {
vertical-align: top;
}
.ui.middle.aligned.grid,
.ui.middle.aligned.grid > .row > .column,
.ui.middle.aligned.grid > .column,
.ui.grid .middle.aligned.column,
.ui.grid > .middle.aligned.row > .column {
vertical-align: middle;
}
.ui.bottom.aligned.grid,
.ui.bottom.aligned.grid > .row > .column,
.ui.bottom.aligned.grid > .column,
.ui.grid .bottom.aligned.column,
.ui.grid > .bottom.aligned.row > .column {
vertical-align: bottom;
}
/*----------------------
Equal Height Columns
-----------------------*/
.ui.grid > .equal.height.row {
display: table;
width: 100%;
}
.ui.grid > .equal.height.row > .column {
display: table-cell;
}
/*----------------------
Only (Device)
-----------------------*/
/* Mobile Only */
@media only screen and (max-width: 768px) {
.ui.mobile.only.grid,
.ui.grid > .mobile.only.row {
display: block !important;
}
.ui.grid > .row > .mobile.only.column {
display: inline-block !important;
}
.ui.divided.mobile.only.grid,
.ui.celled.mobile.only.grid,
.ui.divided.mobile.only.grid .row,
.ui.celled.mobile.only.grid .row,
.ui.divided.grid .mobile.only.row,
.ui.celled.grid .mobile.only.row,
.ui.grid .mobile.only.equal.height.row,
.ui.mobile.only.grid .equal.height.row {
display: table !important;
}
.ui.divided.grid > .row > .mobile.only.column,
.ui.celled.grid > .row > .mobile.only.column,
.ui.divided.mobile.only.grid > .row > .column,
.ui.celled.mobile.only.grid > .row > .column,
.ui.divided.mobile.only.grid > .column,
.ui.celled.mobile.only.grid > .column {
display: table-cell !important;
}
}
@media only screen and (min-width: 768px) {
.ui.mobile.only.grid,
.ui.grid > .mobile.only.row,
.ui.grid > .row > .mobile.only.column {
display: none;
}
}
/* Tablet Only */
@media only screen and (min-width: 768px) and (max-width: 998px) {
.ui.tablet.only.grid,
.ui.grid > .tablet.only.row {
display: block !important;
}
.ui.grid > .row > .tablet.only.column {
display: inline-block !important;
}
.ui.divided.tablet.only.grid,
.ui.celled.tablet.only.grid,
.ui.divided.tablet.only.grid .row,
.ui.celled.tablet.only.grid .row,
.ui.divided.grid .tablet.only.row,
.ui.celled.grid .tablet.only.row,
.ui.grid .tablet.only.equal.height.row,
.ui.tablet.only.grid .equal.height.row {
display: table !important;
}
.ui.divided.grid > .row > .tablet.only.column,
.ui.celled.grid > .row > .tablet.only.column,
.ui.divided.tablet.only.grid > .row > .column,
.ui.celled.tablet.only.grid > .row > .column,
.ui.divided.tablet.only.grid > .column,
.ui.celled.tablet.only.grid > .column {
display: table-cell !important;
}
}
@media only screen and (max-width: 768px), (min-width: 998px) {
.ui.tablet.only.grid,
.ui.grid > .tablet.only.row,
.ui.grid > .row > .tablet.only.column {
display: none;
}
}
/* Computer Only */
@media only screen and (min-width: 998px) {
.ui.computer.only.grid,
.ui.grid > .computer.only.row {
display: block !important;
}
.ui.grid > .row > .computer.only.column {
display: inline-block !important;
}
.ui.divided.computer.only.grid,
.ui.celled.computer.only.grid,
.ui.divided.computer.only.grid .row,
.ui.celled.computer.only.grid .row,
.ui.divided.grid .computer.only.row,
.ui.celled.grid .computer.only.row,
.ui.grid .computer.only.equal.height.row,
.ui.computer.only.grid .equal.height.row {
display: table !important;
}
.ui.divided.grid > .row > .computer.only.column,
.ui.celled.grid > .row > .computer.only.column,
.ui.divided.computer.only.grid > .row > .column,
.ui.celled.computer.only.grid > .row > .column,
.ui.divided.computer.only.grid > .column,
.ui.celled.computer.only.grid > .column {
display: table-cell !important;
}
}
@media only screen and (max-width: 998px) {
.ui.computer.only.grid,
.ui.grid > .computer.only.row,
.ui.grid > .row > .computer.only.column {
display: none;
}
}
/*-------------------
Stackable
--------------------*/
@media only screen and (max-width: 768px) {
.ui.stackable.grid {
display: block !important;
padding: 0em;
}
.ui.stackable.grid > .row > .column,
.ui.stackable.grid > .column {
display: block !important;
width: auto !important;
margin: 1.5em 5% 0em !important;
padding: 1.5em 0em 0em !important;
-webkit-box-shadow: none !important;
-moz-box-shadow: none !important;
box-shadow: none !important;
}
.ui.stackable.divided.grid .column,
.ui.stackable.celled.grid .column {
border-top: 1px dotted rgba(0, 0, 0, 0.1);
}
.ui.stackable.grid > .row:first-child > .column:first-child,
.ui.stackable.grid > .column:first-child {
margin-top: 0em !important;
padding-top: 0em !important;
}
.ui.stackable.divided.grid > .row:first-child > .column:first-child,
.ui.stackable.celled.grid > .row:first-child > .column:first-child,
.ui.stackable.divided.grid > .column:first-child,
.ui.stackable.celled.grid > .column:first-child {
border-top: none !important;
}
/* Remove pointers from vertical menus */
.ui.stackable.grid .vertical.pointing.menu .item:after {
display: none;
}
}
/*
* # Semantic - Menu
* http://github.com/jlukic/semantic-ui/
*
*
* Copyright 2013 Contributors
* Released under the MIT license
* http://opensource.org/licenses/MIT
*
*/
/*******************************
Standard
*******************************/
/*--------------
Menu
---------------*/
.ui.menu {
margin: 1rem 0rem;
background-color: #FFFFFF;
font-size: 0px;
font-weight: normal;
-webkit-box-shadow: 0px 0px 0px 1px rgba(0, 0, 0, 0.1);
-moz-box-shadow: 0px 0px 0px 1px rgba(0, 0, 0, 0.1);
box-shadow: 0px 0px 0px 1px rgba(0, 0, 0, 0.1);
-webkit-border-radius: 0.1875rem;
-moz-border-radius: 0.1875rem;
border-radius: 0.1875rem;
}
.ui.menu:first-child {
margin-top: 0rem;
}
.ui.menu:last-child {
margin-bottom: 0rem;
}
.ui.menu:after {
content: ".";
display: block;
height: 0;
clear: both;
visibility: hidden;
}
.ui.menu > .item:first-child {
border-radius: 0.1875em 0px 0px 0.1875em;
}
.ui.menu > .item:last-child {
border-radius: 0px 0.1875em 0.1875em 0px;
}
.ui.menu .item {
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
vertical-align: middle;
line-height: 1;
text-decoration: none;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
-ms-box-sizing: border-box;
box-sizing: border-box;
-webkit-transition: opacity 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
-moz-transition: opacity 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
-o-transition: opacity 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
-ms-transition: opacity 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
transition: opacity 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}
/*--------------
Colors
---------------*/
/* Text Color */
.ui.menu .item,
.ui.menu .item > a {
color: rgba(0, 0, 0, 0.75);
}
.ui.menu .item .item,
.ui.menu .item .item > a {
color: rgba(30, 30, 30, 0.7);
}
.ui.menu .item .item .item,
.ui.menu .item .item .item > a {
color: rgba(30, 30, 30, 0.6);
}
.ui.menu .dropdown.item .menu .item,
.ui.menu .dropdown.item .menu .item a {
color: rgba(0, 0, 0, 0.75);
}
/* Hover */
.ui.menu .item .menu a.item:hover,
.ui.menu .item .menu a.item.hover,
.ui.menu .item .menu .link.item:hover,
.ui.menu .item .menu .link.item.hover {
color: rgba(0, 0, 0, 0.85);
}
.ui.menu .dropdown.item .menu .item a:hover {
color: rgba(0, 0, 0, 0.85);
}
/* Active */
.ui.menu .active.item,
.ui.menu .active.item a {
color: rgba(0, 0, 0, 0.85);
-moz-border-radius: 0px;
-webkit-border-radius: 0px;
border-radius: 0px;
}
/*--------------
Items
---------------*/
.ui.menu .item {
position: relative;
display: inline-block;
padding: 0.83em 0.95em;
border-top: 0em solid rgba(0, 0, 0, 0);
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
-moz-user-select: -moz-none;
-khtml-user-select: none;
user-select: none;
}
.ui.menu .menu {
margin: 0em;
}
.ui.menu .item.left,
.ui.menu .menu.left {
float: left;
}
.ui.menu .item.right,
.ui.menu .menu.right {
float: right;
}
/*--------------
Borders
---------------*/
.ui.menu .item:before {
position: absolute;
content: '';
top: 0%;
right: 0px;
width: 1px;
height: 100%;
background-image: -webkit-linear-gradient(top, rgba(0, 0, 0, 0.05) 0%, rgba(0, 0, 0, 0.1) 50%, rgba(0, 0, 0, 0.05) 100%);
background-image: -moz-linear-gradient(top, rgba(0, 0, 0, 0.05) 0%, rgba(0, 0, 0, 0.1) 50%, rgba(0, 0, 0, 0.05) 100%);
background-image: -o-linear-gradient(top, rgba(0, 0, 0, 0.05) 0%, rgba(0, 0, 0, 0.1) 50%, rgba(0, 0, 0, 0.05) 100%);
background-image: -ms-linear-gradient(top, rgba(0, 0, 0, 0.05) 0%, rgba(0, 0, 0, 0.1) 50%, rgba(0, 0, 0, 0.05) 100%);
background-image: linear-gradient(top, rgba(0, 0, 0, 0.05) 0%, rgba(0, 0, 0, 0.1) 50%, rgba(0, 0, 0, 0.05) 100%);
}
.ui.menu .menu.right .item:before,
.ui.menu .item.right:before {
right: auto;
left: 0px;
}
/*--------------
Text Content
---------------*/
.ui.menu .text.item > *,
.ui.menu .item > p:only-child {
-webkit-user-select: text;
-moz-user-select: text;
-ms-user-select: text;
user-select: text;
line-height: 1.3;
color: rgba(0, 0, 0, 0.6);
}
.ui.menu .item > p:first-child {
margin-top: 0px;
}
.ui.menu .item > p:last-child {
margin-bottom: 0px;
}
/*--------------
Button
---------------*/
.ui.menu:not(.vertical) .item > .button {
position: relative;
top: -0.05em;
margin: -0.55em 0;
padding-bottom: 0.55em;
padding-top: 0.55em;
font-size: 0.875em;
box-shadow: none;
}
/*--------------
Inputs
---------------*/
.ui.menu:not(.vertical) .item > .input {
margin-top: -0.83em;
margin-bottom: -0.83em;
padding-top: 0.3em;
padding-bottom: 0.3em;
width: 100%;
}
.ui.menu .item > .input input {
padding-top: 0.5em;
padding-bottom: 0.5em;
}
.ui.vertical.menu .item > .input input {
margin: 0em;
padding-top: 0.63em;
padding-bottom: 0.63em;
}
.ui.vertical.menu .ui.input > .icon {
padding-top: 0.63em;
}
/*--------------
Header
---------------*/
.ui.menu .header.item {
background-color: rgba(0, 0, 0, 0.04);
margin: 0em;
}
.ui.vertical.menu .header.item {
font-weight: bold;
}
/*--------------
Dropdowns
---------------*/
.ui.menu .dropdown.item .menu {
left: 1px;
margin: 1px 0px 0px 0px;
min-width: calc(99%);
box-shadow: 0 1px 1px 1px #DDDDDD;
}
.ui.menu .pointing.dropdown.item .menu {
margin-top: 0.75em;
}
.ui.menu .simple.dropdown.item .menu {
margin: 0px !important;
}
.ui.menu .dropdown.item .menu .item {
width: 100%;
color: rgba(0, 0, 0, 0.75);
}
.ui.menu .dropdown.item .menu .active.item {
box-shadow: none !important;
}
.ui.menu .ui.dropdown .menu .item:before {
display: none;
}
/*--------------
Labels
---------------*/
.ui.menu .item > .label {
background-color: rgba(0, 0, 0, 0.35);
color: #FFFFFF;
margin: -0.15em 0em -0.15em 0.5em;
padding: 0.3em 0.8em;
vertical-align: baseline;
}
.ui.menu .item > .floating.label {
padding: 0.3em 0.8em;
}
/*--------------
Images
---------------*/
.ui.menu .item > img:only-child {
display: block;
max-width: 100%;
margin: 0em auto;
}
/*******************************
States
*******************************/
/*--------------
Hover
---------------*/
.ui.link.menu .item:hover,
.ui.menu .item.hover,
.ui.menu .link.item:hover,
.ui.menu a.item:hover,
.ui.menu .ui.dropdown .menu .item.hover,
.ui.menu .ui.dropdown .menu .item:hover {
cursor: pointer;
background-color: rgba(0, 0, 0, 0.02);
}
.ui.menu .ui.dropdown.active {
background-color: rgba(0, 0, 0, 0.02);
-webkit-box-shadow: none;
box-shadow: none;
-webkit-border-bottom-right-radius: 0em;
-moz-border-bottom-right-radius: 0em;
border-bottom-right-radius: 0em;
-webkit-border-bottom-left-radius: 0em;
-moz-border-bottom-left-radius: 0em;
border-bottom-left-radius: 0em;
}
/*--------------
Down
---------------*/
.ui.link.menu .item:active,
.ui.menu .link.item:active,
.ui.menu a.item:active,
.ui.menu .ui.dropdown .menu .item:active {
background-color: rgba(0, 0, 0, 0.05);
}
/*--------------
Active
---------------*/
.ui.menu .active.item {
background-color: rgba(0, 0, 0, 0.01);
color: rgba(0, 0, 0, 0.95);
-webkit-box-shadow: 0em 0.2em 0em inset;
-moz-box-shadow: 0em 0.2em 0em inset;
box-shadow: 0em 0.2em 0em inset;
}
.ui.vertical.menu .active.item {
-webkit-border-radius: 0em;
-moz-border-radius: 0em;
border-radius: 0em;
-moz-box-shadow: 0.2em 0em 0em inset;
-webkit-box-shadow: 0.2em 0em 0em inset;
box-shadow: 0.2em 0em 0em inset;
}
.ui.vertical.menu > .active.item:first-child {
-webkit-border-radius: 0em 0.1875em 0em 0em;
-moz-border-radius: 0em 0.1875em 0em 0em;
border-radius: 0em 0.1875em 0em 0em;
}
.ui.vertical.menu > .active.item:last-child {
-webkit-border-radius: 0em 0em 0.1875em 0em;
-moz-border-radius: 0em 0em 0.1875em 0em;
border-radius: 0em 0em 0.1875em 0em;
}
.ui.vertical.menu > .active.item:only-child {
-webkit-border-radius: 0em 0.1875em 0.1875em 0em;
-moz-border-radius: 0em 0.1875em 0.1875em 0em;
border-radius: 0em 0.1875em 0.1875em 0em;
}
.ui.vertical.menu .active.item .menu .active.item {
border-left: none;
}
.ui.vertical.menu .active.item .menu .active.item {
padding-left: 1.5rem;
}
.ui.vertical.menu .item .menu .active.item {
background-color: rgba(0, 0, 0, 0.03);
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
}
/*--------------
Disabled
---------------*/
.ui.menu .item.disabled,
.ui.menu .item.disabled:hover,
.ui.menu .item.disabled.hover {
cursor: default;
color: rgba(0, 0, 0, 0.2);
background-color: transparent !important;
}
/*--------------------
Loading
---------------------*/
/* On Form */
.ui.menu.loading {
position: relative;
}
.ui.menu.loading:after {
position: absolute;
top: 0%;
left: 0%;
content: '';
width: 100%;
height: 100%;
background: rgba(255, 255, 255, 0.8) url(../images/loader-large.gif) no-repeat 50% 50%;
visibility: visible;
}
/*******************************
Types
*******************************/
/*--------------
Vertical
---------------*/
.ui.vertical.menu .item {
display: block;
height: auto !important;
border-top: none;
border-left: 0em solid rgba(0, 0, 0, 0);
border-right: none;
}
.ui.vertical.menu > .item:first-child {
border-radius: 0.1875em 0.1875em 0px 0px;
}
.ui.vertical.menu > .item:last-child {
border-radius: 0px 0px 0.1875em 0.1875em;
}
.ui.vertical.menu .item > .label {
float: right;
text-align: center;
}
.ui.vertical.menu .item > .icon:not(.input) {
float: right;
width: 1.22em;
margin: 0em 0em 0em 0.5em;
}
.ui.vertical.menu .item > .label + .icon {
float: none;
margin: 0em 0.25em 0em 0em;
}
/*--- Border ---*/
.ui.vertical.menu .item:before {
position: absolute;
content: '';
top: 0%;
left: 0px;
width: 100%;
height: 1px;
background-image: -webkit-linear-gradient(left, rgba(0, 0, 0, 0.03) 0%, rgba(0, 0, 0, 0.1) 1.5em, rgba(0, 0, 0, 0.03) 100%);
background-image: -moz-linear-gradient(left, rgba(0, 0, 0, 0.03) 0%, rgba(0, 0, 0, 0.1) 1.5em, rgba(0, 0, 0, 0.03) 100%);
background-image: -o-linear-gradient(left, rgba(0, 0, 0, 0.03) 0%, rgba(0, 0, 0, 0.1) 1.5em, rgba(0, 0, 0, 0.03) 100%);
background-image: -ms-linear-gradient(left, rgba(0, 0, 0, 0.03) 0%, rgba(0, 0, 0, 0.1) 1.5em, rgba(0, 0, 0, 0.03) 100%);
background-image: linear-gradient(left, rgba(0, 0, 0, 0.03) 0%, rgba(0, 0, 0, 0.1) 1.5em, rgba(0, 0, 0, 0.03) 100%);
}
.ui.vertical.menu .item:first-child:before {
background-image: none !important;
}
/*--- Dropdown ---*/
.ui.vertical.menu .dropdown.item > i {
float: right;
content: "\f0da";
}
.ui.vertical.menu .dropdown.item .menu {
top: 0% !important;
left: 100%;
margin: 0px 0px 0px 1px;
box-shadow: 0 0px 1px 1px #DDDDDD;
}
.ui.vertical.menu .dropdown.item.active {
border-top-right-radius: 0em;
border-bottom-right-radius: 0em;
}
.ui.vertical.menu .dropdown.item .menu .item {
font-size: 1rem;
}
.ui.vertical.menu .dropdown.item .menu .item .icon {
margin-right: 0em;
}
.ui.vertical.menu .dropdown.item.active {
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
}
/*--- Sub Menu ---*/
.ui.vertical.menu .item > .menu {
margin: 0.5em -0.95em 0em;
}
.ui.vertical.menu .item > .menu > .item {
padding: 0.5rem 1.5rem;
font-size: 0.875em;
}
.ui.vertical.menu .item > .menu > .item:before {
display: none;
}
/*--------------
Tiered
---------------*/
.ui.tiered.menu > .sub.menu > .item {
color: rgba(0, 0, 0, 0.4);
}
.ui.tiered.menu > .menu > .item:hover,
.ui.tiered.menu > .menu > .item.hover {
color: rgba(0, 0, 0, 0.8);
}
.ui.tiered.menu .item.active {
color: rgba(0, 0, 0, 0.8);
}
.ui.tiered.menu > .menu .item.active:after {
position: absolute;
content: '';
margin-top: -1px;
top: 100%;
left: 0px;
width: 100%;
height: 2px;
background-color: #FBFBFB;
}
.ui.tiered.menu .sub.menu {
background-color: rgba(0, 0, 0, 0.01);
border-radius: 0em;
border-top: 1px solid rgba(0, 0, 0, 0.1);
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
color: #FFFFFF;
}
.ui.tiered.menu .sub.menu .item {
font-size: 0.875rem;
}
.ui.tiered.menu .sub.menu .item:before {
background-image: none;
}
.ui.tiered.menu .sub.menu .active.item {
padding-top: 0.83em;
background-color: transparent;
border-radius: 0 0 0 0;
border-top: medium none;
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
color: rgba(0, 0, 0, 0.7) !important;
}
.ui.tiered.menu .sub.menu .active.item:after {
display: none;
}
/* Inverted */
.ui.inverted.tiered.menu > .menu > .item {
color: rgba(255, 255, 255, 0.5);
}
.ui.inverted.tiered.menu .sub.menu {
background-color: rgba(0, 0, 0, 0.2);
}
.ui.inverted.tiered.menu .sub.menu .item {
color: rgba(255, 255, 255, 0.6);
}
.ui.inverted.tiered.menu > .menu > .item:hover,
.ui.inverted.tiered.menu > .menu > .item.hover {
color: rgba(255, 255, 255, 0.9);
}
.ui.inverted.tiered.menu .active.item:after {
display: none;
}
.ui.inverted.tiered.menu > .sub.menu > .active.item,
.ui.inverted.tiered.menu > .menu > .active.item {
color: #ffffff !important;
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
}
/* Tiered pointing */
.ui.pointing.tiered.menu > .menu > .item:after {
display: none;
}
.ui.pointing.tiered.menu > .sub.menu > .item:after {
display: block;
}
/*--------------
Tabular
---------------*/
.ui.tabular.menu {
background-color: transparent;
border-bottom: 1px solid #DCDDDE;
border-radius: 0em;
-webkit-box-shadow: none !important;
-moz-box-shadow: none !important;
box-shadow: none !important;
}
.ui.tabular.menu .item {
background-color: transparent;
border-left: 1px solid transparent;
border-right: 1px solid transparent;
border-top: 1px solid transparent;
padding-left: 1.4em;
padding-right: 1.4em;
color: rgba(0, 0, 0, 0.6);
}
.ui.tabular.menu .item:before {
display: none;
}
/* Hover */
.ui.tabular.menu .item:hover {
background-color: transparent;
color: rgba(0, 0, 0, 0.8);
}
/* Active */
.ui.tabular.menu .active.item {
position: relative;
background-color: #FFFFFF;
color: rgba(0, 0, 0, 0.8);
border-color: #DCDDDE;
font-weight: bold;
margin-bottom: -1px;
border-bottom: 1px solid #FFFFFF;
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
-webkit-border-radius: 5px 5px 0 0;
-moz-border-radius: 5px 5px 0 0;
border-radius: 5px 5px 0 0;
}
/* Coupling with segment for attachment */
.ui.attached.tabular.menu {
position: relative;
z-index: 2;
}
.ui.tabular.menu ~ .bottom.attached.segment {
margin: 1px 0px 0px 1px;
}
/*--------------
Pagination
---------------*/
.ui.pagination.menu {
margin: 0em;
display: inline-block;
vertical-align: middle;
}
.ui.pagination.menu .item {
min-width: 3em;
text-align: center;
}
.ui.pagination.menu .icon.item .icon {
vertical-align: top;
}
.ui.pagination.menu.floated {
display: block;
}
/* active */
.ui.pagination.menu .active.item {
border-top: none;
padding-top: 0.83em;
background-color: rgba(0, 0, 0, 0.05);
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
}
/*--------------
Secondary
---------------*/
.ui.secondary.menu {
background-color: transparent;
-webkit-border-radius: 0px;
-moz-border-radius: 0px;
border-radius: 0px;
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
}
.ui.secondary.menu > .menu > .item,
.ui.secondary.menu > .item {
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
border: none;
height: auto !important;
margin: 0em 0.25em;
padding: 0.5em 1em;
-webkit-border-radius: 0.3125em;
-moz-border-radius: 0.3125em;
border-radius: 0.3125em;
}
.ui.secondary.menu > .menu > .item:before,
.ui.secondary.menu > .item:before {
display: none !important;
}
.ui.secondary.menu .item > .input input {
background-color: transparent;
border: none;
}
.ui.secondary.menu .link.item,
.ui.secondary.menu a.item {
opacity: 0.8;
-webkit-transition: none;
-moz-transition: none;
-o-transition: none;
-ms-transition: none;
transition: none;
}
.ui.secondary.menu .header.item {
border-right: 0.1em solid rgba(0, 0, 0, 0.1);
background-color: transparent;
-webkit-border-radius: 0em;
-moz-border-radius: 0em;
border-radius: 0em;
}
/* hover */
.ui.secondary.menu .link.item:hover,
.ui.secondary.menu a.item:hover {
opacity: 1;
}
/* active */
.ui.secondary.menu > .menu > .active.item,
.ui.secondary.menu > .active.item {
background-color: rgba(0, 0, 0, 0.08);
opacity: 1;
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
}
.ui.secondary.vertical.menu > .active.item {
-webkit-border-radius: 0.3125em;
-moz-border-radius: 0.3125em;
border-radius: 0.3125em;
}
/* inverted */
.ui.secondary.inverted.menu .link.item,
.ui.secondary.inverted.menu a.item {
color: rgba(255, 255, 255, 0.5);
}
.ui.secondary.inverted.menu .link.item:hover,
.ui.secondary.inverted.menu a.item:hover {
color: rgba(255, 255, 255, 0.9);
}
.ui.secondary.inverted.menu > .active.item {
background-color: rgba(255, 255, 255, 0.9);
}
/* disable variations */
.ui.secondary.item.menu > .item {
margin: 0em;
}
.ui.secondary.attached.menu {
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
}
/*---------------------
Secondary Pointing
-----------------------*/
.ui.secondary.pointing.menu {
border-bottom: 3px solid rgba(0, 0, 0, 0.1);
}
.ui.secondary.pointing.menu > .menu > .item,
.ui.secondary.pointing.menu > .item {
margin: 0em 0em -3px;
padding: 0.6em 0.95em;
border-bottom: 3px solid rgba(0, 0, 0, 0);
-webkit-border-radius: 0em;
-moz-border-radius: 0em;
border-radius: 0em;
-webkit-transition: color 0.2s
;
-moz-transition: color 0.2s
;
-o-transition: color 0.2s
;
-ms-transition: color 0.2s
;
transition: color 0.2s
;
}
/* Item Types */
.ui.secondary.pointing.menu .header.item {
border-right-width: 0px;
font-weight: bold;
}
.ui.secondary.pointing.menu .text.item {
box-shadow: none !important;
}
.ui.secondary.pointing.menu > .menu > .item:after,
.ui.secondary.pointing.menu > .item:after {
display: none;
}
/* Hover */
.ui.secondary.pointing.menu > .menu > .link.item:hover,
.ui.secondary.pointing.menu > .link.item:hover,
.ui.secondary.pointing.menu > .menu > a.item:hover,
.ui.secondary.pointing.menu > a.item:hover {
background-color: transparent;
color: rgba(0, 0, 0, 0.7);
}
/* Down */
.ui.secondary.pointing.menu > .menu > .link.item:active,
.ui.secondary.pointing.menu > .link.item:active,
.ui.secondary.pointing.menu > .menu > a.item:active,
.ui.secondary.pointing.menu > a.item:active {
background-color: transparent;
border-color: rgba(0, 0, 0, 0.2);
}
/* Active */
.ui.secondary.pointing.menu > .menu > .item.active,
.ui.secondary.pointing.menu > .item.active {
background-color: transparent;
border-color: rgba(0, 0, 0, 0.4);
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
}
/*---------------------
Secondary Vertical
-----------------------*/
.ui.secondary.vertical.pointing.menu {
border: none;
border-right: 3px solid rgba(0, 0, 0, 0.1);
}
.ui.secondary.vertical.menu > .item {
border: none;
margin: 0em 0em 0.3em;
padding: 0.6em 0.8em;
-webkit-border-radius: 0.1875em;
-moz-border-radius: 0.1875em;
border-radius: 0.1875em;
}
.ui.secondary.vertical.menu > .header.item {
-webkit-border-radius: 0em;
-moz-border-radius: 0em;
border-radius: 0em;
}
.ui.secondary.vertical.pointing.menu > .item {
margin: 0em -3px 0em 0em;
border-bottom: none;
border-right: 3px solid transparent;
-webkit-border-radius: 0em;
-moz-border-radius: 0em;
border-radius: 0em;
}
/* Hover */
.ui.secondary.vertical.pointing.menu > .item.hover,
.ui.secondary.vertical.pointing.menu > .item:hover {
background-color: transparent;
color: rgba(0, 0, 0, 0.7);
}
/* Down */
.ui.secondary.vertical.pointing.menu > .item:active {
background-color: transparent;
border-color: rgba(0, 0, 0, 0.2);
}
/* Active */
.ui.secondary.vertical.pointing.menu > .item.active {
background-color: transparent;
border-color: rgba(0, 0, 0, 0.4);
color: rgba(0, 0, 0, 0.85);
}
/*--------------
Inverted
---------------*/
.ui.secondary.inverted.menu {
background-color: transparent;
}
.ui.secondary.inverted.pointing.menu {
border-bottom: 3px solid rgba(255, 255, 255, 0.1);
}
.ui.secondary.inverted.pointing.menu > .item {
color: rgba(255, 255, 255, 0.7);
}
/* Hover */
.ui.secondary.inverted.pointing.menu > .item.hover,
.ui.secondary.inverted.pointing.menu > .item:hover {
color: rgba(255, 255, 255, 0.85);
}
/* Down */
.ui.secondary.inverted.pointing.menu > .item:active {
border-color: rgba(255, 255, 255, 0.4) !important;
}
/* Active */
.ui.secondary.inverted.pointing.menu > .item.active {
border-color: rgba(255, 255, 255, 0.8) !important;
color: #ffffff;
}
/*---------------------
Inverted Vertical
----------------------*/
.ui.secondary.inverted.vertical.pointing.menu {
border-right: 3px solid rgba(255, 255, 255, 0.1);
border-bottom: none;
}
/*--------------
Text Menu
---------------*/
.ui.text.menu {
background-color: transparent;
margin: 1rem -1rem;
-moz-border-radius: 0px;
-webkit-border-radius: 0px;
border-radius: 0px;
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
}
.ui.text.menu > .item {
opacity: 0.8;
margin: 0em 1em;
padding: 0em;
height: auto !important;
-webkit-border-radius: 0px;
-moz-border-radius: 0px;
border-radius: 0px;
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
-webkit-transition: opacity 0.2s ease
;
-moz-transition: opacity 0.2s ease
;
-o-transition: opacity 0.2s ease
;
-ms-transition: opacity 0.2s ease
;
transition: opacity 0.2s ease
;
}
.ui.text.menu > .item:before {
display: none !important;
}
.ui.text.menu .header.item {
background-color: transparent;
opacity: 1;
color: rgba(50, 50, 50, 0.8);
font-size: 0.875rem;
padding: 0em;
text-transform: uppercase;
font-weight: bold;
}
/*--- fluid text ---*/
.ui.text.item.menu .item {
margin: 0em;
}
/*--- vertical text ---*/
.ui.vertical.text.menu {
margin: 1rem 0em;
}
.ui.vertical.text.menu:first-child {
margin-top: 0rem;
}
.ui.vertical.text.menu:last-child {
margin-bottom: 0rem;
}
.ui.vertical.text.menu .item {
float: left;
clear: left;
margin: 0.5em 0em;
}
.ui.vertical.text.menu .item > .icon {
float: none;
margin: 0em 0.83em 0em 0em;
}
.ui.vertical.text.menu .header.item {
margin: 0.8em 0em;
}
/*--- hover ---*/
.ui.text.menu .item.hover,
.ui.text.menu .item:hover {
opacity: 1;
background-color: transparent;
}
/*--- active ---*/
.ui.text.menu .active.item {
background-color: transparent;
padding: 0em;
border: none;
opacity: 1;
font-weight: bold;
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
}
/* disable variations */
.ui.text.pointing.menu .active.item:after {
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
}
.ui.text.attached.menu {
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
}
.ui.inverted.text.menu,
.ui.inverted.text.menu .item,
.ui.inverted.text.menu .item:hover,
.ui.inverted.text.menu .item.active {
background-color: transparent;
}
/*--------------
Icon Only
---------------*/
.ui.icon.menu,
.ui.vertical.icon.menu {
width: auto;
display: inline-block;
height: auto;
}
.ui.icon.menu > .item {
height: auto;
text-align: center;
color: rgba(60, 60, 60, 0.7);
}
.ui.icon.menu > .item > .icon {
display: block;
float: none !important;
opacity: 1;
margin: 0em auto !important;
}
.ui.icon.menu .icon:before {
opacity: 1;
}
/* Item Icon Only */
.ui.menu .icon.item .icon {
margin: 0em;
}
.ui.vertical.icon.menu {
float: none;
}
/*--- inverted ---*/
.ui.inverted.icon.menu .item {
color: rgba(255, 255, 255, 0.8);
}
.ui.inverted.icon.menu .icon {
color: #ffffff;
}
/*--------------
Labeled Icon
---------------*/
.ui.labeled.icon.menu {
text-align: center;
}
.ui.labeled.icon.menu > .item > .icon {
display: block;
font-size: 1.5em !important;
margin: 0em auto 0.3em !important;
}
/*******************************
Variations
*******************************/
/*--------------
Colors
---------------*/
/*--- Light Colors ---*/
.ui.menu .green.active.item,
.ui.green.menu .active.item {
border-color: #A1CF64 !important;
color: #A1CF64 !important;
}
.ui.menu .red.active.item,
.ui.red.menu .active.item {
border-color: #D95C5C !important;
color: #D95C5C !important;
}
.ui.menu .blue.active.item,
.ui.blue.menu .active.item {
border-color: #6ECFF5 !important;
color: #6ECFF5 !important;
}
.ui.menu .purple.active.item,
.ui.purple.menu .active.item {
border-color: #564F8A !important;
color: #564F8A !important;
}
.ui.menu .orange.active.item,
.ui.orange.menu .active.item {
border-color: #F05940 !important;
color: #F05940 !important;
}
.ui.menu .teal.active.item,
.ui.teal.menu .active.item {
border-color: #00B5AD !important;
color: #00B5AD !important;
}
/*--------------
Inverted
---------------*/
.ui.inverted.menu {
background-color: #333333;
box-shadow: none;
}
.ui.inverted.menu .header.item {
margin: 0em;
background-color: rgba(0, 0, 0, 0.3);
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
}
.ui.inverted.menu .item,
.ui.inverted.menu .item > a {
color: #FFFFFF;
}
.ui.inverted.menu .item .item,
.ui.inverted.menu .item .item > a {
color: rgba(255, 255, 255, 0.8);
}
.ui.inverted.menu .dropdown.item .menu .item,
.ui.inverted.menu .dropdown.item .menu .item a {
color: rgba(0, 0, 0, 0.75) !important;
}
.ui.inverted.menu .item.disabled,
.ui.inverted.menu .item.disabled:hover,
.ui.inverted.menu .item.disabled.hover {
color: rgba(255, 255, 255, 0.2);
}
/*--- Border ---*/
.ui.inverted.menu .item:before {
background-image: -webkit-linear-gradient(top, rgba(255, 255, 255, 0.03) 0%, rgba(255, 255, 255, 0.1) 50%, rgba(255, 255, 255, 0.03) 100%);
background-image: -moz-linear-gradient(top, rgba(255, 255, 255, 0.03) 0%, rgba(255, 255, 255, 0.1) 50%, rgba(255, 255, 255, 0.03) 100%);
background-image: -o-linear-gradient(top, rgba(255, 255, 255, 0.03) 0%, rgba(255, 255, 255, 0.1) 50%, rgba(255, 255, 255, 0.03) 100%);
background-image: -ms-linear-gradient(top, rgba(255, 255, 255, 0.03) 0%, rgba(255, 255, 255, 0.1) 50%, rgba(255, 255, 255, 0.03) 100%);
background-image: linear-gradient(top, rgba(255, 255, 255, 0.03) 0%, rgba(255, 255, 255, 0.1) 50%, rgba(255, 255, 255, 0.03) 100%);
}
.ui.vertical.inverted.menu .item:before {
background-image: -webkit-linear-gradient(left, rgba(255, 255, 255, 0.03) 0%, rgba(255, 255, 255, 0.1) 50%, rgba(255, 255, 255, 0.03) 100%);
background-image: -moz-linear-gradient(left, rgba(255, 255, 255, 0.03) 0%, rgba(255, 255, 255, 0.1) 50%, rgba(255, 255, 255, 0.03) 100%);
background-image: -o-linear-gradient(left, rgba(255, 255, 255, 0.03) 0%, rgba(255, 255, 255, 0.1) 50%, rgba(255, 255, 255, 0.03) 100%);
background-image: -ms-linear-gradient(left, rgba(255, 255, 255, 0.03) 0%, rgba(255, 255, 255, 0.1) 50%, rgba(255, 255, 255, 0.03) 100%);
background-image: linear-gradient(left, rgba(255, 255, 255, 0.03) 0%, rgba(255, 255, 255, 0.1) 50%, rgba(255, 255, 255, 0.03) 100%);
}
/*--- Hover ---*/
.ui.link.inverted.menu .item:hover,
.ui.inverted.menu .item.hover,
.ui.inverted.menu .link.item:hover,
.ui.inverted.menu a.item:hover,
.ui.inverted.menu .dropdown.item.hover,
.ui.inverted.menu .dropdown.item:hover {
background-color: rgba(255, 255, 255, 0.1);
}
.ui.inverted.menu a.item:hover,
.ui.inverted.menu .item.hover,
.ui.inverted.menu .item > a:hover,
.ui.inverted.menu .item .menu a.item:hover,
.ui.inverted.menu .item .menu a.item.hover,
.ui.inverted.menu .item .menu .link.item:hover,
.ui.inverted.menu .item .menu .link.item.hover {
color: #ffffff;
}
/*--- Down ---*/
.ui.inverted.menu a.item:active,
.ui.inverted.menu .dropdown.item:active,
.ui.inverted.menu .link.item:active,
.ui.inverted.menu a.item:active {
background-color: rgba(255, 255, 255, 0.15);
}
/*--- Active ---*/
.ui.inverted.menu .active.item {
box-shadow: none !important;
background-color: rgba(255, 255, 255, 0.2);
}
.ui.inverted.menu .active.item,
.ui.inverted.menu .active.item a {
color: #ffffff !important;
}
.ui.inverted.vertical.menu .item .menu .active.item {
background-color: rgba(255, 255, 255, 0.2);
color: #ffffff;
}
/*--- Pointers ---*/
.ui.inverted.pointing.menu .active.item:after {
background-color: #505050;
box-shadow: none;
}
.ui.inverted.pointing.menu .active.item:hover:after {
background-color: #3B3B3B;
}
/*--------------
Selection
---------------*/
.ui.selection.menu > .item {
color: rgba(0, 0, 0, 0.4);
}
.ui.selection.menu > .item:hover {
color: rgba(0, 0, 0, 0.6);
}
.ui.selection.menu > .item.active {
color: rgba(0, 0, 0, 0.85);
}
.ui.inverted.selection.menu > .item {
color: rgba(255, 255, 255, 0.4);
}
.ui.inverted.selection.menu > .item:hover {
color: rgba(255, 255, 255, 0.9);
}
.ui.inverted.selection.menu > .item.active {
color: #FFFFFF;
}
/*--------------
Floated
---------------*/
.ui.floated.menu {
float: left;
margin: 0rem 0.5rem 0rem 0rem;
}
.ui.right.floated.menu {
float: right;
margin: 0rem 0rem 0rem 0.5rem;
}
/*--------------
Inverted Colors
---------------*/
/*--- Light Colors ---*/
.ui.grey.menu {
background-color: #F0F0F0;
}
/*--- Inverted Colors ---*/
.ui.inverted.green.menu {
background-color: #A1CF64;
}
.ui.inverted.green.pointing.menu .active.item:after {
background-color: #A1CF64;
}
.ui.inverted.red.menu {
background-color: #D95C5C;
}
.ui.inverted.red.pointing.menu .active.item:after {
background-color: #F16883;
}
.ui.inverted.blue.menu {
background-color: #6ECFF5;
}
.ui.inverted.blue.pointing.menu .active.item:after {
background-color: #6ECFF5;
}
.ui.inverted.purple.menu {
background-color: #564F8A;
}
.ui.inverted.purple.pointing.menu .active.item:after {
background-color: #564F8A;
}
.ui.inverted.orange.menu {
background-color: #F05940;
}
.ui.inverted.orange.pointing.menu .active.item:after {
background-color: #F05940;
}
.ui.inverted.teal.menu {
background-color: #00B5AD;
}
.ui.inverted.teal.pointing.menu .active.item:after {
background-color: #00B5AD;
}
/*--------------
Fitted
---------------*/
.ui.fitted.menu .item,
.ui.fitted.menu .item .menu .item,
.ui.menu .fitted.item {
padding: 0em;
}
.ui.horizontally.fitted.menu .item,
.ui.horizontally.fitted.menu .item .menu .item,
.ui.menu .horizontally.fitted.item {
padding-top: 0.83em;
padding-bottom: 0.83em;
}
.ui.vertically.fitted.menu .item,
.ui.vertically.fitted.menu .item .menu .item,
.ui.menu .vertically.fitted.item {
padding-left: 0.95em;
padding-right: 0.95em;
}
/*--------------
Borderless
---------------*/
.ui.borderless.menu .item:before,
.ui.borderless.menu .item .menu .item:before,
.ui.menu .borderless.item:before {
background-image: none;
}
/*-------------------
Compact
--------------------*/
.ui.compact.menu {
display: inline-block;
margin: 0em;
vertical-align: middle;
}
.ui.compact.vertical.menu {
width: auto !important;
}
.ui.compact.vertical.menu .item:last-child::before {
display: block;
}
/*-------------------
Fluid
--------------------*/
.ui.menu.fluid,
.ui.vertical.menu.fluid {
display: block;
width: 100% !important;
}
/*-------------------
Evenly Sized
--------------------*/
.ui.item.menu,
.ui.item.menu .item {
width: 100%;
padding-left: 0px !important;
padding-right: 0px !important;
text-align: center;
}
.ui.menu.two.item .item {
width: 50%;
}
.ui.menu.three.item .item {
width: 33.333%;
}
.ui.menu.four.item .item {
width: 25%;
}
.ui.menu.five.item .item {
width: 20%;
}
.ui.menu.six.item .item {
width: 16.666%;
}
.ui.menu.seven.item .item {
width: 14.285%;
}
.ui.menu.eight.item .item {
width: 12.500%;
}
.ui.menu.nine.item .item {
width: 11.11%;
}
.ui.menu.ten.item .item {
width: 10.0%;
}
.ui.menu.eleven.item .item {
width: 9.09%;
}
.ui.menu.twelve.item .item {
width: 8.333%;
}
/*--------------
Fixed
---------------*/
.ui.menu.fixed {
position: fixed;
z-index: 10;
margin: 0em;
border: none;
width: 100%;
}
.ui.menu.fixed,
.ui.menu.fixed .item:first-child,
.ui.menu.fixed .item:last-child {
-webkit-border-radius: 0px !important;
-moz-border-radius: 0px !important;
border-radius: 0px !important;
}
.ui.menu.fixed.top {
top: 0px;
left: 0px;
right: auto;
bottom: auto;
}
.ui.menu.fixed.right {
top: 0px;
right: 0px;
left: auto;
bottom: auto;
width: auto;
height: 100%;
}
.ui.menu.fixed.bottom {
bottom: 0px;
left: 0px;
top: auto;
right: auto;
}
.ui.menu.fixed.left {
top: 0px;
left: 0px;
right: auto;
bottom: auto;
width: auto;
height: 100%;
}
/*-------------------
Pointing
--------------------*/
.ui.pointing.menu .active.item:after {
position: absolute;
bottom: -0.35em;
left: 50%;
content: "";
margin-left: -0.3em;
width: 0.6em;
height: 0.6em;
border: none;
border-bottom: 1px solid rgba(0, 0, 0, 0.1);
border-right: 1px solid rgba(0, 0, 0, 0.1);
background-image: none;
-webkit-transform: rotate(45deg);
-moz-transform: rotate(45deg);
transform: rotate(45deg);
z-index: 2;
-webkit-transition: background 0.2s ease
;
-moz-transition: background 0.2s ease
;
-o-transition: background 0.2s ease
;
-ms-transition: background 0.2s ease
;
transition: background 0.2s ease
;
}
/* Don't double up pointers */
.ui.pointing.menu .active.item .menu .active.item:after {
display: none;
}
.ui.vertical.pointing.menu .active.item:after {
position: absolute;
top: 50%;
margin-top: -0.3em;
right: -0.4em;
bottom: auto;
left: auto;
border: none;
border-top: 1px solid rgba(0, 0, 0, 0.1);
border-right: 1px solid rgba(0, 0, 0, 0.1);
}
/* Colors */
.ui.pointing.menu .active.item:after {
background-color: #FCFCFC;
}
.ui.pointing.menu .active.item.hover:after,
.ui.pointing.menu .active.item:hover:after {
background-color: #FAFAFA;
}
.ui.vertical.pointing.menu .menu .active.item:after {
background-color: #F4F4F4;
}
.ui.pointing.menu a.active.item:active:after {
background-color: #F0F0F0;
}
/*--------------
Attached
---------------*/
.ui.menu.attached {
margin: 0rem;
-moz-border-radius: 0px;
-webkit-border-radius: 0px;
border-radius: 0px;
/* avoid rgba multiplying */
-moz-box-shadow: 0px 0px 0px 1px #DDDDDD;
-webkit-box-shadow: 0px 0px 0px 1px #DDDDDD;
box-shadow: 0px 0px 0px 1px #DDDDDD;
}
.ui.top.attached.menu {
-moz-border-radius: 0.1875em 0.1875em 0px 0px;
-webkit-border-radius: 0.1875em 0.1875em 0px 0px;
border-radius: 0.1875em 0.1875em 0px 0px;
}
.ui.menu.bottom.attached {
-moz-border-radius: 0px 0px 0.1875em 0.1875em;
-webkit-border-radius: 0px 0px 0.1875em 0.1875em;
border-radius: 0px 0px 0.1875em 0.1875em;
}
/*--------------
Sizes
---------------*/
.ui.small.menu .item {
font-size: 0.875rem;
}
.ui.small.menu:not(.vertical) .item > .input input {
padding-top: 0.4em;
padding-bottom: 0.4em;
}
.ui.small.vertical.menu {
width: 13rem;
}
.ui.menu .item {
font-size: 1rem;
}
.ui.vertical.menu {
width: 15rem;
}
.ui.large.menu .item {
font-size: 1.125rem;
}
.ui.large.menu .item .item {
font-size: 0.875rem;
}
.ui.large.menu:not(.vertical) .item > .input input {
top: -0.125em;
padding-bottom: 0.6em;
padding-top: 0.6em;
}
.ui.large.menu .dropdown.item .item {
font-size: 1rem;
}
.ui.large.vertical.menu {
width: 18rem;
}
/*
* # Semantic - Message
* http://github.com/jlukic/semantic-ui/
*
*
* Copyright 2013 Contributors
* Released under the MIT license
* http://opensource.org/licenses/MIT
*
*/
/*******************************
Message
*******************************/
.ui.message {
position: relative;
min-height: 18px;
margin: 1em 0em;
height: auto;
background-color: #EFEFEF;
padding: 1em;
line-height: 1.33;
color: rgba(0, 0, 0, 0.6);
-webkit-transition: opacity 0.1s ease, color 0.1s ease, background 0.1s ease, box-shadow 0.1s ease;
-moz-transition: opacity 0.1s ease, color 0.1s ease, background 0.1s ease, box-shadow 0.1s ease;
-o-transition: opacity 0.1s ease, color 0.1s ease, background 0.1s ease, box-shadow 0.1s ease;
-ms-transition: opacity 0.1s ease, color 0.1s ease, background 0.1s ease, box-shadow 0.1s ease;
transition: opacity 0.1s ease, color 0.1s ease, background 0.1s ease, box-shadow 0.1s ease;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
-ms-box-sizing: border-box;
box-sizing: border-box;
-webkit-border-radius: 0.325em 0.325em 0.325em 0.325em;
-moz-border-radius: 0.325em 0.325em 0.325em 0.325em;
border-radius: 0.325em 0.325em 0.325em 0.325em;
}
.ui.message:first-child {
margin-top: 0em;
}
.ui.message:last-child {
margin-bottom: 0em;
}
/*--------------
Content
---------------*/
/* block with headers */
.ui.message .header {
margin: 0em;
font-size: 1.33em;
font-weight: bold;
}
/* block with paragraphs */
.ui.message p {
opacity: 0.85;
margin: 1em 0em;
}
.ui.message p:first-child {
margin-top: 0em;
}
.ui.message p:last-child {
margin-bottom: 0em;
}
.ui.message .header + p {
margin-top: 0.3em;
}
.ui.message > :first-child {
margin-top: 0em;
}
.ui.message > :last-child {
margin-bottom: 0em;
}
/* block with child list */
.ui.message ul.list {
opacity: 0.85;
list-style-position: inside;
margin: 0.2em 0em;
padding: 0em;
}
.ui.message ul.list li {
position: relative;
list-style-type: none;
margin: 0em 0em 0.3em 1em;
padding: 0em;
}
.ui.message ul.list li:before {
position: absolute;
content: '\2022';
top: -0.05em;
left: -0.8em;
height: 100%;
vertical-align: baseline;
opacity: 0.5;
}
.ui.message ul.list li:first-child {
margin-top: 0em;
}
/* dismissable block */
.ui.message > .close.icon {
cursor: pointer;
position: absolute;
top: 1em;
right: 0.5em;
opacity: 0.7;
-webkit-transition: opacity 0.1s linear
;
-moz-transition: opacity 0.1s linear
;
-o-transition: opacity 0.1s linear
;
-ms-transition: opacity 0.1s linear
;
transition: opacity 0.1s linear
;
}
.ui.message > .close.icon:hover {
opacity: 1;
}
/*******************************
States
*******************************/
.ui.message.visible,
.ui.header.visible {
display: block !important;
}
.ui.message.hidden,
.ui.header.hidden {
display: none;
}
/*******************************
Variations
*******************************/
/*--------------
Compact
---------------*/
.ui.compact.message {
display: inline-block;
}
/*--------------
Attached
---------------*/
.ui.attached.message {
margin-left: -1px;
margin-right: -1px;
margin-bottom: -1px;
-webkit-border-radius: 0.325em 0.325em 0em 0em;
-moz-border-radius: 0.325em 0.325em 0em 0em;
border-radius: 0.325em 0.325em 0em 0em;
-webkit-box-shadow: 0em 0em 0em 1px rgba(0, 0, 0, 0.1) inset;
-moz-box-shadow: 0em 0em 0em 1px rgba(0, 0, 0, 0.1) inset;
box-shadow: 0em 0em 0em 1px rgba(0, 0, 0, 0.1) inset;
}
.ui.bottom.attached.message {
margin-top: -1px;
-webkit-border-radius: 0em 0em 0.325em 0.325em;
-moz-border-radius: 0em 0em 0.325em 0.325em;
border-radius: 0em 0em 0.325em 0.325em;
}
/*--------------
Icon
---------------*/
.ui.icon.message {
display: table;
width: 100%;
}
.ui.icon.message > .icon {
display: table-cell;
vertical-align: middle;
font-size: 3.8em;
opacity: 0.5;
}
.ui.icon.message > .icon + .content {
padding-left: 1em;
}
.ui.icon.message > .content {
display: table-cell;
vertical-align: middle;
}
/*--------------
Inverted
---------------*/
.ui.inverted.message {
background-color: rgba(255, 255, 255, 0.05);
color: rgba(255, 255, 255, 0.95);
}
/*--------------
Floating
---------------*/
.ui.floating.message {
-webkit-box-shadow: 0px 1px 3px 0px rgba(0, 0, 0, 0.1), 0px 0px 0px 1px rgba(0, 0, 0, 0.05) inset;
-moz-box-shadow: 0px 1px 3px 0px rgba(0, 0, 0, 0.1), 0px 0px 0px 1px rgba(0, 0, 0, 0.05) inset;
box-shadow: 0px 1px 3px 0px rgba(0, 0, 0, 0.1), 0px 0px 0px 1px rgba(0, 0, 0, 0.05) inset;
}
/*--------------
Colors
---------------*/
.ui.black.message {
background-color: #333333;
color: rgba(255, 255, 255, 0.95);
}
/*--------------
Types
---------------*/
.ui.blue.message,
.ui.info.message {
background-color: #E6F4F9;
color: #4D8796;
}
/* Green Text Block */
.ui.green.message {
background-color: #DEFCD5;
color: #52A954;
}
/* Yellow Text Block */
.ui.yellow.message,
.ui.warning.message {
background-color: #F6F3D5;
color: #96904D;
}
/* Red Text Block */
.ui.red.message {
background-color: #F1D7D7;
color: #A95252;
}
/* Success Text Block */
.ui.success.message,
.ui.positive.message {
background-color: #DEFCD5;
color: #52A954;
}
/* Error Text Block */
.ui.error.message,
.ui.negative.message {
background-color: #F1D7D7;
color: #A95252;
}
/*--------------
Sizes
---------------*/
.ui.small.message {
font-size: 0.875em;
}
.ui.message {
font-size: 1em;
}
.ui.large.message {
font-size: 1.125em;
}
.ui.huge.message {
font-size: 1.5em;
}
.ui.massive.message {
font-size: 2em;
}
/*
* # Semantic - Table
* http://github.com/jlukic/semantic-ui/
*
*
* Copyright 2013 Contributors
* Released under the MIT license
* http://opensource.org/licenses/MIT
*
*/
/*******************************
Table
*******************************/
/* Prototype */
.ui.table {
width: 100%;
border-collapse: collapse;
}
/* Table Content */
.ui.table th,
.ui.table tr,
.ui.table td {
border-collapse: collapse;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
-ms-box-sizing: border-box;
box-sizing: border-box;
-webkit-transition: all 0.1s ease-out;
-moz-transition: all 0.1s ease-out;
-o-transition: all 0.1s ease-out;
-ms-transition: all 0.1s ease-out;
transition: all 0.1s ease-out;
}
/* Headers */
.ui.table thead {
border-bottom: 1px solid rgba(0, 0, 0, 0.03);
}
.ui.table tfoot th {
background-color: rgba(0, 0, 0, 0.03);
}
.ui.table th {
cursor: auto;
background-color: rgba(0, 0, 0, 0.05);
text-align: left;
color: rgba(0, 0, 0, 0.8);
padding: 0.5em 0.7em;
vertical-align: middle;
}
.ui.table thead th:first-child {
border-radius: 5px 0px 0px 0px;
}
.ui.table thead th:last-child {
border-radius: 0px 5px 0px 0px;
}
.ui.table tfoot th:first-child {
border-radius: 0px 0px 0px 5px;
}
.ui.table tfoot th:last-child {
border-radius: 0px 0px 5px 0px;
}
/* Table Cells */
.ui.table td {
padding: 0.40em 0.7em;
vertical-align: middle;
}
/* Footer */
.ui.table tfoot {
border-top: 1px solid rgba(0, 0, 0, 0.03);
}
.ui.table tfoot th {
font-weight: normal;
font-style: italic;
}
/* Table Striping */
.ui.table tbody tr:nth-child(2n) {
background-color: rgba(0, 0, 50, 0.02);
}
/* Icons */
.ui.table > .icon {
vertical-align: baseline;
}
.ui.table > .icon:only-child {
margin: 0em;
}
/* Table Segment */
.ui.table.segment:after {
display: none;
}
.ui.table.segment.stacked:after {
display: block;
}
/* Responsive */
@media only screen and (max-width: 768px) {
.ui.table {
display: block;
padding: 0em;
}
.ui.table thead,
.ui.table tfoot {
display: none;
}
.ui.table tbody {
display: block;
}
.ui.table tr {
display: block;
}
.ui.table tr > td {
width: 100% !important;
display: block;
border: none !important;
padding: 0.25em 0.75em;
box-shadow: 0px 1px 0px 0px rgba(0, 0, 0, 0.05) !important;
}
.ui.table td:first-child {
font-weight: bold;
padding-top: 1em;
}
.ui.table td:last-child {
box-shadow: 0px -1px 0px 0px rgba(0, 0, 0, 0.1) inset !important;
padding-bottom: 1em;
}
/* Clear BG Colors */
.ui.table tr > td.warning,
.ui.table tr > td.error,
.ui.table tr > td.active,
.ui.table tr > td.positive,
.ui.table tr > td.negative {
background-color: transparent !important;
}
}
/*******************************
States
*******************************/
/*--------------
Hover
---------------*/
/* Sortable */
.ui.sortable.table th.disabled:hover {
cursor: auto;
text-align: left;
font-weight: bold;
color: #333333;
color: rgba(0, 0, 0, 0.8);
}
.ui.sortable.table thead th:hover {
background-color: rgba(0, 0, 0, 0.13);
color: rgba(0, 0, 0, 0.8);
}
/* Inverted Sortable */
.ui.inverted.sortable.table thead th:hover {
background-color: rgba(255, 255, 255, 0.13);
color: #ffffff;
}
/*--------------
Positive
---------------*/
.ui.table tr.positive,
.ui.table td.positive {
-webkit-box-shadow: 2px 0px 0px #119000 inset;
-moz-box-shadow: 2px 0px 0px #119000 inset;
box-shadow: 2px 0px 0px #119000 inset;
}
.ui.table tr.positive td,
.ui.table td.positive {
background-color: #F2F8F0 !important;
color: #119000 !important;
}
.ui.celled.table tr.positive:hover td,
.ui.celled.table tr:hover td.positive,
.ui.table tr.positive:hover td,
.ui.table td:hover.positive,
.ui.table th:hover.positive {
background-color: #ECF5E9 !important;
color: #119000 !important;
}
/*--------------
Negative
---------------*/
.ui.table tr.negative,
.ui.table td.negative {
-webkit-box-shadow: 2px 0px 0px #CD2929 inset;
-moz-box-shadow: 2px 0px 0px #CD2929 inset;
box-shadow: 2px 0px 0px #CD2929 inset;
}
.ui.table tr.negative td,
.ui.table td.negative {
background-color: #F9F4F4;
color: #CD2929 !important;
}
.ui.celled.table tr.negative:hover td,
.ui.celled.table tr:hover td.negative,
.ui.table tr.negative:hover td,
.ui.table td:hover.negative,
.ui.table th:hover.negative {
background-color: #F2E8E8;
color: #CD2929;
}
/*--------------
Error
---------------*/
.ui.table tr.error,
.ui.table td.error {
-webkit-box-shadow: 2px 0px 0px #CD2929 inset;
-moz-box-shadow: 2px 0px 0px #CD2929 inset;
box-shadow: 2px 0px 0px #CD2929 inset;
}
.ui.table tr.error td,
.ui.table td.error,
.ui.table th.error {
background-color: #F9F4F4;
color: #CD2929;
}
.ui.celled.table tr.error:hover td,
.ui.celled.table tr:hover td.error,
.ui.table tr.error:hover td,
.ui.table td:hover.error,
.ui.table th:hover.error {
background-color: #F2E8E8;
color: #CD2929;
}
/*--------------
Warning
---------------*/
.ui.table tr.warning,
.ui.table td.warning {
-webkit-box-shadow: 2px 0px 0px #7D6C00 inset;
-moz-box-shadow: 2px 0px 0px #7D6C00 inset;
box-shadow: 2px 0px 0px #7D6C00 inset;
}
.ui.table tr.warning td,
.ui.table td.warning,
.ui.table th.warning {
background-color: #FBF6E9;
color: #7D6C00;
}
.ui.celled.table tr.warning:hover td,
.ui.celled.table tr:hover td.warning,
.ui.table tr.warning:hover td,
.ui.table td:hover.warning,
.ui.table th:hover.warning {
background-color: #F3EDDC;
color: #7D6C00;
}
/*--------------
Active
---------------*/
.ui.table tr.active,
.ui.table td.active {
-webkit-box-shadow: 2px 0px 0px rgba(50, 50, 50, 0.9) inset;
-moz-box-shadow: 2px 0px 0px rgba(50, 50, 50, 0.9) inset;
box-shadow: 2px 0px 0px rgba(50, 50, 50, 0.9) inset;
}
.ui.table tr.active td,
.ui.table tr td.active {
background-color: #E0E0E0;
color: rgba(50, 50, 50, 0.9);
/* border-color: rgba(0, 0, 0, 0.15) !important; */
}
/*--------------
Disabled
---------------*/
.ui.table tr.disabled td,
.ui.table tr td.disabled,
.ui.table tr.disabled:hover td,
.ui.table tr:hover td.disabled {
color: rgba(150, 150, 150, 0.3);
}
/*******************************
Variations
*******************************/
/*--------------
Column Count
---------------*/
.ui.two.column.table td {
width: 50%;
}
.ui.three.column.table td {
width: 33.3333%;
}
.ui.four.column.table td {
width: 25%;
}
.ui.five.column.table td {
width: 20%;
}
.ui.six.column.table td {
width: 16.66667%;
}
.ui.seven.column.table td {
width: 14.2857%;
}
.ui.eight.column.table td {
width: 12.5%;
}
.ui.nine.column.table td {
width: 11.1111%;
}
.ui.ten.column.table td {
width: 10%;
}
.ui.eleven.column.table td {
width: 9.0909%;
}
.ui.twelve.column.table td {
width: 8.3333%;
}
.ui.thirteen.column.table td {
width: 7.6923%;
}
.ui.fourteen.column.table td {
width: 7.1428%;
}
.ui.fifteen.column.table td {
width: 6.6666%;
}
.ui.sixteen.column.table td {
width: 6.25%;
}
/* Column Width */
.ui.table th.one.wide,
.ui.table td.one.wide {
width: 6.25%;
}
.ui.table th.two.wide,
.ui.table td.two.wide {
width: 12.5%;
}
.ui.table th.three.wide,
.ui.table td.three.wide {
width: 18.75%;
}
.ui.table th.four.wide,
.ui.table td.four.wide {
width: 25%;
}
.ui.table th.five.wide,
.ui.table td.five.wide {
width: 31.25%;
}
.ui.table th.six.wide,
.ui.table td.six.wide {
width: 37.5%;
}
.ui.table th.seven.wide,
.ui.table td.seven.wide {
width: 43.75%;
}
.ui.table th.eight.wide,
.ui.table td.eight.wide {
width: 50%;
}
.ui.table th.nine.wide,
.ui.table td.nine.wide {
width: 56.25%;
}
.ui.table th.ten.wide,
.ui.table td.ten.wide {
width: 62.5%;
}
.ui.table th.eleven.wide,
.ui.table td.eleven.wide {
width: 68.75%;
}
.ui.table th.twelve.wide,
.ui.table td.twelve.wide {
width: 75%;
}
.ui.table th.thirteen.wide,
.ui.table td.thirteen.wide {
width: 81.25%;
}
.ui.table th.fourteen.wide,
.ui.table td.fourteen.wide {
width: 87.5%;
}
.ui.table th.fifteen.wide,
.ui.table td.fifteen.wide {
width: 93.75%;
}
.ui.table th.sixteen.wide,
.ui.table td.sixteen.wide {
width: 100%;
}
/*--------------
Celled
---------------*/
.ui.celled.table {
color: rgba(0, 0, 0, 0.8);
}
.ui.celled.table tbody tr,
.ui.celled.table tfoot tr {
border: none;
}
.ui.celled.table th,
.ui.celled.table td {
border: 1px solid rgba(0, 0, 0, 0.1);
}
/* Coupling with segment */
.ui.celled.table.segment th:first-child,
.ui.celled.table.segment td:first-child {
border-left: none;
}
.ui.celled.table.segment th:last-child,
.ui.celled.table.segment td:last-child {
border-right: none;
}
/*--------------
Sortable
---------------*/
.ui.sortable.table thead th {
cursor: pointer;
white-space: nowrap;
}
.ui.sortable.table thead th.sorted,
.ui.sortable.table thead th.sorted:hover {
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.ui.sortable.table thead th:after {
display: inline-block;
content: '';
width: 1em;
opacity: 0.8;
margin: 0em 0em 0em 0.5em;
font-family: 'Icons';
font-style: normal;
font-weight: normal;
text-decoration: inherit;
}
.ui.sortable.table thead th.ascending:after {
content: '\25b4';
}
.ui.sortable.table thead th.descending:after {
content: '\25be';
}
/*--------------
Inverted
---------------*/
/* Text Color */
.ui.inverted.table td {
color: rgba(255, 255, 255, 0.9);
}
.ui.inverted.table th {
background-color: rgba(0, 0, 0, 0.15);
color: rgba(255, 255, 255, 0.9);
}
/* Stripes */
.ui.inverted.table tbody tr:nth-child(2n) {
background-color: rgba(255, 255, 255, 0.06);
}
/*--------------
Definition
---------------*/
.ui.definition.table td:first-child {
font-weight: bold;
}
/*--------------
Collapsing
---------------*/
.ui.collapsing.table {
width: auto;
}
/*--------------
Basic
---------------*/
.ui.basic.table th {
background-color: transparent;
padding: 0.5em;
}
.ui.basic.table tbody tr {
border-bottom: 1px solid rgba(0, 0, 0, 0.03);
}
.ui.basic.table td {
padding: 0.8em 0.5em;
}
.ui.basic.table tbody tr:nth-child(2n) {
background-color: transparent !important;
}
/*--------------
Padded
---------------*/
.ui.padded.table th,
.ui.padded.table td {
padding: 0.8em 1em;
}
.ui.compact.table th {
padding: 0.3em 0.5em;
}
.ui.compact.table td {
padding: 0.2em 0.5em;
}
/*--------------
Sizes
---------------*/
/* Small */
.ui.small.table {
font-size: 0.875em;
}
/* Standard */
.ui.table {
font-size: 1em;
}
/* Large */
.ui.large.table {
font-size: 1.1em;
}
/*
* # Semantic - basic.Icon (Basic)
* http://github.com/jlukic/semantic-ui/
*
*
* Copyright 2013 Contributors
* Released under the MIT license
* http://opensource.org/licenses/MIT
*
*/
/*******************************
basic.Icon
*******************************/
@font-face {
font-family: 'Basic Icons';
src: url(../fonts/basic.icons.eot);
src: url(../fonts/basic.icons.eot?#iefix) format('embedded-opentype'), url(../fonts/basic.icons.woff) format('woff'), url(../fonts/basic.icons.ttf) format('truetype'), url(../fonts/basic.icons.svg#basic.icons) format('svg');
font-style: normal;
font-weight: normal;
font-variant: normal;
text-decoration: inherit;
text-transform: none;
}
i.basic.icon {
display: inline-block;
opacity: 0.75;
margin: 0em 0.25em 0em 0em;
width: 1.23em;
height: 1em;
font-family: 'Basic Icons';
font-style: normal;
line-height: 1;
font-weight: normal;
text-decoration: inherit;
text-align: center;
speak: none;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
-ms-box-sizing: border-box;
box-sizing: border-box;
-webkit-font-smoothing: antialiased;
-moz-font-smoothing: antialiased;
font-smoothing: antialiased;
}
/* basic.icons available */
i.basic.icon.circle.attention:before {
content: '\2757';
}
/* '❗' */
i.basic.icon.circle.help:before {
content: '\e704';
}
/* '' */
i.basic.icon.circle.info:before {
content: '\e705';
}
/* '' */
i.basic.icon.add:before {
content: '\2795';
}
/* '➕' */
i.basic.icon.chart:before {
content: '📈';
}
/* '\1f4c8' */
i.basic.icon.chart.bar:before {
content: '📊';
}
/* '\1f4ca' */
i.basic.icon.chart.pie:before {
content: '\e7a2';
}
/* '' */
i.basic.icon.resize.full:before {
content: '\e744';
}
/* '' */
i.basic.icon.resize.horizontal:before {
content: '\2b0d';
}
/* '⬍' */
i.basic.icon.resize.small:before {
content: '\e746';
}
/* '' */
i.basic.icon.resize.vertical:before {
content: '\2b0c';
}
/* '⬌' */
i.basic.icon.down:before {
content: '\2193';
}
/* '↓' */
i.basic.icon.down.triangle:before {
content: '\25be';
}
/* '▾' */
i.basic.icon.down.arrow:before {
content: '\e75c';
}
/* '' */
i.basic.icon.left:before {
content: '\2190';
}
/* '←' */
i.basic.icon.left.triangle:before {
content: '\25c2';
}
/* '◂' */
i.basic.icon.left.arrow:before {
content: '\e75d';
}
/* '' */
i.basic.icon.right:before {
content: '\2192';
}
/* '→' */
i.basic.icon.right.triangle:before {
content: '\25b8';
}
/* '▸' */
i.basic.icon.right.arrow:before {
content: '\e75e';
}
/* '' */
i.basic.icon.up:before {
content: '\2191';
}
/* '↑' */
i.basic.icon.up.triangle:before {
content: '\25b4';
}
/* '▴' */
i.basic.icon.up.arrow:before {
content: '\e75f';
}
/* '' */
i.basic.icon.folder:before {
content: '\e810';
}
/* '' */
i.basic.icon.open.folder:before {
content: '📂';
}
/* '\1f4c2' */
i.basic.icon.globe:before {
content: '𝌍';
}
/* '\1d30d' */
i.basic.icon.desk.globe:before {
content: '🌐';
}
/* '\1f310' */
i.basic.icon.star:before {
content: '\e801';
}
/* '' */
i.basic.icon.star.empty:before {
content: '\e800';
}
/* '' */
i.basic.icon.star.half:before {
content: '\e701';
}
/* '' */
i.basic.icon.lock:before {
content: '🔒';
}
/* '\1f512' */
i.basic.icon.unlock:before {
content: '🔓';
}
/* '\1f513' */
i.basic.icon.layout.grid:before {
content: '\e80c';
}
/* '' */
i.basic.icon.layout.block:before {
content: '\e708';
}
/* '' */
i.basic.icon.layout.list:before {
content: '\e80b';
}
/* '' */
i.basic.icon.heart.empty:before {
content: '\2661';
}
/* '♡' */
i.basic.icon.heart:before {
content: '\2665';
}
/* '♥' */
i.basic.icon.asterisk:before {
content: '\2731';
}
/* '✱' */
i.basic.icon.attachment:before {
content: '📎';
}
/* '\1f4ce' */
i.basic.icon.attention:before {
content: '\26a0';
}
/* '⚠' */
i.basic.icon.trophy:before {
content: '🏉';
}
/* '\1f3c9' */
i.basic.icon.barcode:before {
content: '\e792';
}
/* '' */
i.basic.icon.cart:before {
content: '\e813';
}
/* '' */
i.basic.icon.block:before {
content: '🚫';
}
/* '\1f6ab' */
i.basic.icon.book:before {
content: '📖';
}
i.basic.icon.bookmark:before {
content: '🔖';
}
/* '\1f516' */
i.basic.icon.calendar:before {
content: '📅';
}
/* '\1f4c5' */
i.basic.icon.cancel:before {
content: '\2716';
}
/* '✖' */
i.basic.icon.close:before {
content: '\e80d';
}
/* '' */
i.basic.icon.color:before {
content: '\e794';
}
/* '' */
i.basic.icon.chat:before {
content: '\e720';
}
/* '' */
i.basic.icon.check:before {
content: '\2611';
}
/* '☑' */
i.basic.icon.time:before {
content: '🕔';
}
/* '\1f554' */
i.basic.icon.cloud:before {
content: '\2601';
}
/* '☁' */
i.basic.icon.code:before {
content: '\e714';
}
/* '' */
i.basic.icon.email:before {
content: '\40';
}
/* '@' */
i.basic.icon.settings:before {
content: '\26ef';
}
/* '⛯' */
i.basic.icon.setting:before {
content: '\2699';
}
/* '⚙' */
i.basic.icon.comment:before {
content: '\e802';
}
/* '' */
i.basic.icon.clockwise.counter:before {
content: '\27f2';
}
/* '⟲' */
i.basic.icon.clockwise:before {
content: '\27f3';
}
/* '⟳' */
i.basic.icon.cube:before {
content: '\e807';
}
/* '' */
i.basic.icon.direction:before {
content: '\27a2';
}
/* '➢' */
i.basic.icon.doc:before {
content: '📄';
}
/* '\1f4c4' */
i.basic.icon.docs:before {
content: '\e736';
}
/* '' */
i.basic.icon.dollar:before {
content: '💵';
}
/* '\1f4b5' */
i.basic.icon.paint:before {
content: '\e7b5';
}
/* '' */
i.basic.icon.edit:before {
content: '\270d';
}
/* '✍' */
i.basic.icon.eject:before {
content: '\2ecf';
}
/* '⻏' */
i.basic.icon.export:before {
content: '\e715';
}
/* '' */
i.basic.icon.hide:before {
content: '\e80f';
}
/* '' */
i.basic.icon.unhide:before {
content: '\e70b';
}
/* '' */
i.basic.icon.facebook:before {
content: '\f301';
}
/* '' */
i.basic.icon.fast-forward:before {
content: '\e804';
}
/* '' */
i.basic.icon.fire:before {
content: '🔥';
}
/* '\1f525' */
i.basic.icon.flag:before {
content: '\2691';
}
/* '⚑' */
i.basic.icon.lightning:before {
content: '\26a1';
}
/* '⚡' */
i.basic.icon.lab:before {
content: '\68';
}
/* 'h' */
i.basic.icon.flight:before {
content: '\2708';
}
/* '✈' */
i.basic.icon.forward:before {
content: '\27a6';
}
/* '➦' */
i.basic.icon.gift:before {
content: '🎁';
}
/* '\1f381' */
i.basic.icon.github:before {
content: '\f308';
}
/* '' */
i.basic.icon.globe:before {
content: '\e817';
}
/* '' */
i.basic.icon.headphones:before {
content: '🎧';
}
/* '\1f3a7' */
i.basic.icon.question:before {
content: '\2753';
}
/* '❓' */
i.basic.icon.home:before {
content: '\2302';
}
/* '⌂' */
i.basic.icon.i:before {
content: '\2139';
}
/* 'ℹ' */
i.basic.icon.idea:before {
content: '💡';
}
/* '\1f4a1' */
i.basic.icon.open:before {
content: '🔗';
}
/* '\1f517' */
i.basic.icon.content:before {
content: '\e782';
}
/* '' */
i.basic.icon.location:before {
content: '\e724';
}
/* '' */
i.basic.icon.mail:before {
content: '\2709';
}
/* '✉' */
i.basic.icon.mic:before {
content: '🎤';
}
/* '\1f3a4' */
i.basic.icon.minus:before {
content: '\2d';
}
/* '-' */
i.basic.icon.money:before {
content: '💰';
}
/* '\1f4b0' */
i.basic.icon.off:before {
content: '\e78e';
}
/* '' */
i.basic.icon.pause:before {
content: '\e808';
}
/* '' */
i.basic.icon.photos:before {
content: '\e812';
}
/* '' */
i.basic.icon.photo:before {
content: '🌄';
}
/* '\1f304' */
i.basic.icon.pin:before {
content: '📌';
}
/* '\1f4cc' */
i.basic.icon.play:before {
content: '\e809';
}
/* '' */
i.basic.icon.plus:before {
content: '\2b';
}
/* '+' */
i.basic.icon.print:before {
content: '\e716';
}
/* '' */
i.basic.icon.rss:before {
content: '\e73a';
}
/* '' */
i.basic.icon.search:before {
content: '🔍';
}
/* '\1f50d' */
i.basic.icon.shuffle:before {
content: '\e803';
}
/* '' */
i.basic.icon.tag:before {
content: '\e80a';
}
/* '' */
i.basic.icon.tags:before {
content: '\e70d';
}
/* '' */
i.basic.icon.terminal:before {
content: '\e7ac';
}
/* '' */
i.basic.icon.thumbs.down:before {
content: '👎';
}
/* '\1f44e' */
i.basic.icon.thumbs.up:before {
content: '👍';
}
/* '\1f44d' */
i.basic.icon.to-end:before {
content: '\e806';
}
/* '' */
i.basic.icon.to-start:before {
content: '\e805';
}
/* '' */
i.basic.icon.top.list:before {
content: '🏆';
}
/* '\1f3c6' */
i.basic.icon.trash:before {
content: '\e729';
}
/* '' */
i.basic.icon.twitter:before {
content: '\f303';
}
/* '' */
i.basic.icon.upload:before {
content: '\e711';
}
/* '' */
i.basic.icon.user.add:before {
content: '\e700';
}
/* '' */
i.basic.icon.user:before {
content: '👤';
}
/* '\1f464' */
i.basic.icon.community:before {
content: '\e814';
}
/* '' */
i.basic.icon.users:before {
content: '👥';
}
/* '\1f465' */
i.basic.icon.id:before {
content: '\e722';
}
/* '' */
i.basic.icon.url:before {
content: '🔗';
}
/* '\1f517' */
i.basic.icon.zoom.in:before {
content: '\e750';
}
/* '' */
i.basic.icon.zoom.out:before {
content: '\e751';
}
/* '' */
/*--------------
Spacing Fix
---------------*/
/* dropdown arrows are to the right */
i.dropdown.basic.icon {
margin: 0em 0em 0em 0.5em;
}
/* stars are usually consecutive */
i.basic.icon.star {
width: auto;
margin: 0em;
}
/* left side basic.icons */
i.basic.icon.left,
i.basic.icon.left,
i.basic.icon.left {
width: auto;
margin: 0em 0.5em 0em 0em;
}
/* right side basic.icons */
i.basic.icon.search,
i.basic.icon.up,
i.basic.icon.down,
i.basic.icon.right {
width: auto;
margin: 0em 0em 0em 0.5em;
}
/*--------------
Aliases
---------------*/
/* aliases for convenience */
i.basic.icon.delete:before {
content: '\e80d';
}
/* '' */
i.basic.icon.dropdown:before {
content: '\25be';
}
/* '▾' */
i.basic.icon.help:before {
content: '\e704';
}
/* '' */
i.basic.icon.info:before {
content: '\e705';
}
/* '' */
i.basic.icon.error:before {
content: '\e80d';
}
/* '' */
i.basic.icon.dislike:before {
content: '\2661';
}
/* '♡' */
i.basic.icon.like:before {
content: '\2665';
}
/* '♥' */
i.basic.icon.eye:before {
content: '\e80f';
}
/* '' */
i.basic.icon.eye.hidden:before {
content: '\e70b';
}
/* '' */
i.basic.icon.date:before {
content: '📅';
}
/* '\1f4c5' */
/*******************************
States
*******************************/
i.basic.icon.hover {
opacity: 1;
}
i.basic.icon.active {
opacity: 1;
}
i.emphasized.basic.icon {
opacity: 1;
}
i.basic.icon.disabled {
opacity: 0.3;
}
/*******************************
Variations
*******************************/
/*-------------------
Link
--------------------*/
i.link.basic.icon {
cursor: pointer;
opacity: 0.7;
-webkit-transition: opacity 0.3s ease-out;
-moz-transition: opacity 0.3s ease-out;
-o-transition: opacity 0.3s ease-out;
-ms-transition: opacity 0.3s ease-out;
transition: opacity 0.3s ease-out;
}
.link.basic.icon:hover {
opacity: 1 !important;
}
/*-------------------
Circular
--------------------*/
i.circular.basic.icon {
-webkit-border-radius: 500px !important;
-moz-border-radius: 500px !important;
border-radius: 500px !important;
padding: 0.5em 0em !important;
-webkit-box-shadow: 0em 0em 0em 0.1em rgba(0, 0, 0, 0.1) inset;
-moz-box-shadow: 0em 0em 0em 0.1em rgba(0, 0, 0, 0.1) inset;
box-shadow: 0em 0em 0em 0.1em rgba(0, 0, 0, 0.1) inset;
line-height: 1 !important;
width: 2em !important;
height: 2em !important;
}
i.circular.inverted.basic.icon {
border: none;
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
}
/*-------------------
Flipped
--------------------*/
i.vertically.flipped.basic.icon {
-webkit-transform: scale(1, -1);
-moz-transform: scale(1, -1);
-o-transform: scale(1, -1);
-ms-transform: scale(1, -1);
transform: scale(1, -1);
}
i.horizontally.flipped.basic.icon {
-webkit-transform: scale(-1, 1);
-moz-transform: scale(-1, 1);
-o-transform: scale(-1, 1);
-ms-transform: scale(-1, 1);
transform: scale(-1, 1);
}
/*-------------------
Rotated
--------------------*/
i.left.rotated.basic.icon {
-webkit-transform: rotate(-90deg);
-moz-transform: rotate(-90deg);
-o-transform: rotate(-90deg);
-ms-transform: rotate(-90deg);
transform: rotate(-90deg);
}
i.right.rotated.basic.icon {
-webkit-transform: rotate(90deg);
-moz-transform: rotate(90deg);
-o-transform: rotate(90deg);
-ms-transform: rotate(90deg);
transform: rotate(90deg);
}
/*-------------------
Square
--------------------*/
i.square.basic.icon {
width: 2em;
height: 2em;
padding: 0.5em 0.35em !important;
-webkit-box-shadow: 0em 0em 0em 0.1em rgba(0, 0, 0, 0.1) inset;
-moz-box-shadow: 0em 0em 0em 0.1em rgba(0, 0, 0, 0.1) inset;
box-shadow: 0em 0em 0em 0.1em rgba(0, 0, 0, 0.1) inset;
vertical-align: baseline;
}
i.square.basic.icon:before {
vertical-align: middle;
}
i.square.inverted.basic.icon {
border: none;
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
}
/*-------------------
Inverted
--------------------*/
i.inverted.basic.icon {
background-color: #222222;
color: #FFFFFF;
}
/*-------------------
Colors
--------------------*/
i.blue.basic.icon {
color: #6ECFF5 !important;
}
i.black.basic.icon {
color: #5C6166 !important;
}
i.green.basic.icon {
color: #A1CF64 !important;
}
i.red.basic.icon {
color: #D95C5C !important;
}
i.purple.basic.icon {
color: #564F8A !important;
}
i.teal.basic.icon {
color: #00B5AD !important;
}
/*-------------------
Inverted Colors
--------------------*/
i.inverted.black.basic.icon {
background-color: #5C6166 !important;
color: #FFFFFF !important;
}
i.inverted.blue.basic.icon {
background-color: #6ECFF5 !important;
color: #FFFFFF !important;
}
i.inverted.green.basic.icon {
background-color: #A1CF64 !important;
color: #FFFFFF !important;
}
i.inverted.red.basic.icon {
background-color: #D95C5C !important;
color: #FFFFFF !important;
}
i.inverted.purple.basic.icon {
background-color: #564F8A !important;
color: #FFFFFF !important;
}
i.inverted.teal.basic.icon {
background-color: #00B5AD !important;
color: #FFFFFF !important;
}
/*-------------------
Sizes
--------------------*/
i.small.basic.icon {
font-size: 0.875em;
}
i.basic.icon {
font-size: 1em;
}
i.large.basic.icon {
font-size: 1.5em;
margin-right: 0.2em;
vertical-align: middle;
}
i.big.basic.icon {
font-size: 2em;
margin-right: 0.5em;
vertical-align: middle;
}
i.huge.basic.icon {
font-size: 4em;
margin-right: 0.75em;
vertical-align: middle;
}
i.massive.basic.icon {
font-size: 8em;
margin-right: 1em;
vertical-align: middle;
}
/*
* # Semantic - Button
* http://github.com/jlukic/semantic-ui/
*
*
* Copyright 2013 Contributors
* Released under the MIT license
* http://opensource.org/licenses/MIT
*
*/
/*******************************
Button
*******************************/
/* Prototype */
.ui.button {
cursor: pointer;
display: inline-block;
vertical-align: middle;
min-height: 1em;
outline: none;
border: none;
background-color: #EBEBEB;
color: #808080;
margin: 0em;
padding: 0.8em 1.5em;
font-size: 1rem;
text-transform: uppercase;
line-height: 1;
font-weight: bold;
font-style: normal;
text-align: center;
text-decoration: none;
-webkit-border-radius: 0.2em;
-moz-border-radius: 0.2em;
border-radius: 0.2em;
-webkit-box-shadow: 0em -0.2rem 0em rgba(0, 0, 0, 0.1) inset;
-moz-box-shadow: 0em -0.2rem 0em rgba(0, 0, 0, 0.1) inset;
box-shadow: 0em -0.2rem 0em rgba(0, 0, 0, 0.1) inset;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
-ms-box-sizing: border-box;
box-sizing: border-box;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
-webkit-transition: opacity 0.25s ease, background-color 0.25s ease, color 0.25s ease, background 0.25s ease, box-shadow 0.25s ease;
-moz-transition: opacity 0.25s ease, background-color 0.25s ease, color 0.25s ease, background 0.25s ease, box-shadow 0.25s ease;
-o-transition: opacity 0.25s ease, background-color 0.25s ease, color 0.25s ease, background 0.25s ease, box-shadow 0.25s ease;
-ms-transition: opacity 0.25s ease, background-color 0.25s ease, color 0.25s ease, background 0.25s ease, box-shadow 0.25s ease;
transition: opacity 0.25s ease, background-color 0.25s ease, color 0.25s ease, background 0.25s ease, box-shadow 0.25s ease;
}
/*--------------
Count
---------------*/
.ui.count.button {
-webkit-box-shadow: 0px 0px 0px 1px rgba(0, 0, 0, 0.1) !important;
-moz-box-shadow: 0px 0px 0px 1px rgba(0, 0, 0, 0.1) !important;
box-shadow: 0px 0px 0px 1px rgba(0, 0, 0, 0.1) !important;
}
.ui.count.button > .count {
position: absolute;
background-color: #FFFFFF;
border: 1px solid #F0F0F0;
margin: -0.8em -1.5em;
padding: 0.8em 1.5em;
}
/*-------------------
Primary
--------------------*/
.ui.primary.buttons .button,
.ui.primary.button {
background-color: #D95C5C;
color: #FFFFFF;
}
.ui.primary.buttons .button:hover,
.ui.primary.button:hover,
.ui.primary.buttons .active.button,
.ui.primary.button.active {
background-color: #E75859;
color: #FFFFFF;
}
.ui.primary.buttons .button:active,
.ui.primary.button:active {
background-color: #D24B4C;
color: #FFFFFF;
}
/*-------------------
Secondary
--------------------*/
.ui.secondary.buttons .button,
.ui.secondary.button {
background-color: #00B5AD;
color: #FFFFFF;
}
.ui.secondary.buttons .button:hover,
.ui.secondary.button:hover,
.ui.secondary.buttons .active.button,
.ui.secondary.button.active {
background-color: #009A93;
color: #FFFFFF;
}
.ui.secondary.buttons .button:active,
.ui.secondary.button:active {
background-color: #00847E;
color: #FFFFFF;
}
/*-------------------
Social
--------------------*/
/* Facebook */
.ui.facebook.button {
background-color: #3B579D;
color: #FFFFFF;
}
.ui.facebook.button:hover {
background-color: #3A59A9;
}
.ui.facebook.button:active {
background-color: #334F95;
}
/* Twitter */
.ui.twitter.button {
background-color: #4092CC;
color: #FFFFFF;
}
.ui.twitter.button:hover {
background-color: #399ADE;
}
.ui.twitter.button:active {
background-color: #3283BC;
}
/* Google Plus */
.ui.google.plus.button {
background-color: #D34836;
color: #FFFFFF;
}
.ui.google.plus.button:hover {
background-color: #E3432E;
}
.ui.google.plus.button:active {
background-color: #CA3A27;
}
/* Linked In */
.ui.linkedin.button {
background-color: #1F88BE;
color: #FFFFFF;
}
.ui.linkedin.button:hover {
background-color: #1394D6;
}
.ui.linkedin.button:active {
background-color: #1179AE;
}
/* YouTube */
.ui.youtube.button {
background-color: #CC181E;
color: #FFFFFF;
}
.ui.youtube.button:hover {
background-color: #DF0209;
}
.ui.youtube.button:active {
background-color: #A50006;
}
/* Instagram */
.ui.instagram.button {
background-color: #49769C;
color: #FFFFFF;
}
.ui.instagram.button:hover {
background-color: #4781B1;
}
.ui.instagram.button:active {
background-color: #38658A;
}
/* Pinterest */
.ui.pinterest.button {
background-color: #00ACED;
color: #FFFFFF;
}
.ui.pinterest.button:hover {
background-color: #00B9FF;
}
.ui.pinterest.button:active {
background-color: #009EDA;
}
/*--------------
Icon
---------------*/
.ui.button > .icon {
margin-right: 0.5em;
line-height: 1;
-webkit-transition: opacity 0.1s ease
;
-moz-transition: opacity 0.1s ease
;
-o-transition: opacity 0.1s ease
;
-ms-transition: opacity 0.1s ease
;
transition: opacity 0.1s ease
;
}
/*******************************
States
*******************************/
/*--------------
Active
---------------*/
.ui.buttons .active.button,
.ui.active.button {
opacity: 1 !important;
background-color: #B0B0B0;
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(rgba(0, 0, 0, 0)), to(rgba(255, 255, 255, 0.1)));
background-image: -webkit-linear-gradient(rgba(0, 0, 0, 0) 0%, rgba(255, 255, 255, 0.1) 100%);
background-image: -moz-linear-gradient(rgba(0, 0, 0, 0) 0%, rgba(255, 255, 255, 0.1) 100%);
background-image: -o-linear-gradient(rgba(0, 0, 0, 0) 0%, rgba(255, 255, 255, 0.1) 100%);
background-image: linear-gradient(rgba(0, 0, 0, 0) 0%, rgba(255, 255, 255, 0.1) 100%);
color: #FFFFFF;
-webkit-box-shadow: 0px 0px 0.3em 0px rgba(0, 0, 0, 0.3) inset;
-moz-box-shadow: 0px 0px 0.3em 0px rgba(0, 0, 0, 0.3) inset;
box-shadow: 0px 0px 0.3em 0px rgba(0, 0, 0, 0.3) inset;
}
/*--------------
Hover
---------------*/
.ui.button:hover,
.ui.active.button:hover {
opacity: 1 !important;
background-color: #A4A4A4;
color: #FFFFFF;
}
.ui.button:hover .icon,
.ui.button.hover .icon {
opacity: 0.85;
}
/*--------------
Down
---------------*/
.ui.button:active,
.ui.active.button:active {
opacity: 1 !important;
background-color: #8C8C8C;
color: #FFFFFF;
-webkit-box-shadow: 0px 1px 0.2em 0px rgba(0, 0, 0, 0.3) inset;
-moz-box-shadow: 0px 1px 0.2em 0px rgba(0, 0, 0, 0.3) inset;
box-shadow: 0px 1px 0.2em 0px rgba(0, 0, 0, 0.3) inset;
}
/*--------------
Loading
---------------*/
.ui.loading.button {
position: relative;
cursor: default;
background-color: #F3F3F3 !important;
color: transparent !important;
background-image: none !important;
-webkit-box-shadow: none !important;
-moz-box-shadow: none !important;
box-shadow: none !important;
-webkit-transition: all 0s linear;
-moz-transition: all 0s linear;
-o-transition: all 0s linear;
-ms-transition: all 0s linear;
transition: all 0s linear;
}
.ui.loading.button:after {
position: absolute;
top: 0em;
left: 0em;
width: 100%;
height: 100%;
content: '';
background: transparent url(../images/loader-mini.gif) no-repeat 50% 50%;
}
.ui.labeled.icon.loading.button .icon {
background-color: transparent;
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
}
/*-------------------
Disabled
--------------------*/
.ui.disabled.button {
cursor: default;
color: #DDDDDD !important;
background-color: rgba(50, 50, 50, 0.05) !important;
background-image: none !important;
-webkit-box-shadow: none !important;
-moz-box-shadow: none !important;
box-shadow: none !important;
}
/*******************************
Variations
*******************************/
/*-------------------
Floated
--------------------*/
.ui.left.floated.buttons,
.ui.left.floated.button {
float: left;
margin-right: 0.25em;
}
.ui.right.floated.buttons,
.ui.right.floated.button {
float: right;
margin-left: 0.25em;
}
/*-------------------
Sizes
--------------------*/
.ui.buttons .button,
.ui.button {
font-size: 1rem;
}
.ui.buttons.mini .button,
.ui.mini.button {
font-size: 0.8125rem;
padding: 0.6em 0.8em;
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
}
.ui.tiny.buttons .button,
.ui.tiny.button {
font-size: 0.875rem;
padding: 0.6em 0.8em;
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
}
.ui.small.buttons .button,
.ui.small.button {
font-size: 0.875rem;
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
}
.ui.large.buttons .button,
.ui.large.button {
font-size: 1.125rem;
}
.ui.big.buttons .button,
.ui.big.button {
font-size: 1.25rem;
}
.ui.huge.buttons .button,
.ui.huge.button {
font-size: 1.375rem;
}
.ui.massive.buttons .button,
.ui.massive.button {
font-size: 1.5rem;
font-weight: bold;
}
/* loading */
.ui.huge.loading.button:after {
background-image: url(../images/loader-small.gif);
}
.ui.massive.buttons .loading.button:after,
.ui.gigantic.buttons .loading.button:after,
.ui.massive.loading.button:after,
.ui.gigantic.loading.button:after {
background-image: url(../images/loader-medium.gif);
}
.ui.huge.loading.button:after,
.ui.huge.loading.button.active:after {
background-image: url(../images/loader-small.gif);
}
.ui.massive.buttons .loading.button:after,
.ui.gigantic.buttons .loading.button:after,
.ui.massive.loading.button:after,
.ui.gigantic.loading.button:after,
.ui.massive.buttons .loading.button.active:after,
.ui.gigantic.buttons .loading.button.active:after,
.ui.massive.loading.button.active:after,
.ui.gigantic.loading.button.active:after {
background-image: url(../images/loader-medium.gif);
}
/*--------------
Icon Only
---------------*/
.ui.icon.buttons .button,
.ui.icon.button {
padding: 0.8em;
}
.ui.icon.buttons .button > .icon,
.ui.icon.button > .icon {
opacity: 1;
margin: 0em;
vertical-align: top;
}
/*-------------------
Basic
--------------------*/
.ui.basic.buttons .button,
.ui.basic.button {
background-color: transparent !important;
background-image: none;
color: #808080 !important;
font-weight: normal;
text-transform: none;
-webkit-box-shadow: 0px 0px 0px 1px rgba(0, 0, 0, 0.1) inset;
-moz-box-shadow: 0px 0px 0px 1px rgba(0, 0, 0, 0.1) inset;
box-shadow: 0px 0px 0px 1px rgba(0, 0, 0, 0.1) inset;
}
.ui.basic.buttons {
-webkit-box-shadow: 0px 0px 0px 1px rgba(0, 0, 0, 0.1) inset;
-moz-box-shadow: 0px 0px 0px 1px rgba(0, 0, 0, 0.1) inset;
box-shadow: 0px 0px 0px 1px rgba(0, 0, 0, 0.1) inset;
-webkit-border-radius: 0.2em;
-moz-border-radius: 0.2em;
border-radius: 0.2em;
}
.ui.basic.buttons .button:hover,
.ui.basic.button:hover {
color: #7F7F7F !important;
-webkit-box-shadow: 0px 0px 0px 1px rgba(0, 0, 0, 0.18) inset;
-moz-box-shadow: 0px 0px 0px 1px rgba(0, 0, 0, 0.18) inset;
box-shadow: 0px 0px 0px 1px rgba(0, 0, 0, 0.18) inset;
}
.ui.basic.buttons .button:active,
.ui.basic.button:active {
background-color: rgba(0, 0, 0, 0.02) !important;
color: #7F7F7F !important;
-webkit-box-shadow: 0px 0px 0px 1px rgba(0, 0, 0, 0.1) inset;
-moz-box-shadow: 0px 0px 0px 1px rgba(0, 0, 0, 0.1) inset;
box-shadow: 0px 0px 0px 1px rgba(0, 0, 0, 0.1) inset;
}
.ui.basic.buttons .button.active,
.ui.basic.button.active {
background-color: rgba(0, 0, 0, 0.05);
color: #7F7F7F;
-webkit-box-shadow: 0px 0px 0px 1px #BDBDBD inset;
-moz-box-shadow: 0px 0px 0px 1px #BDBDBD inset;
box-shadow: 0px 0px 0px 1px #BDBDBD inset;
}
.ui.basic.buttons .button.active:hover,
.ui.basic.button.active:hover {
background-color: rgba(0, 0, 0, 0.1);
}
/* Basic Group */
.ui.basic.buttons .button {
border: none;
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
}
.ui.basic.buttons .button:hover,
.ui.basic.buttons .button:active {
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
}
.ui.basic.buttons .button.active {
-webkit-box-shadow: 0px 0px 0px 1px rgba(0, 0, 0, 0.1) inset;
-moz-box-shadow: 0px 0px 0px 1px rgba(0, 0, 0, 0.1) inset;
box-shadow: 0px 0px 0px 1px rgba(0, 0, 0, 0.1) inset;
}
/*--------------
Labeled Icon
---------------*/
.ui.labeled.icon.buttons .button,
.ui.labeled.icon.button {
position: relative;
padding-left: 4em !important;
padding-right: 1.4em !important;
}
.ui.labeled.icon.buttons > .button > .icon,
.ui.labeled.icon.button > .icon {
position: absolute;
top: 0em;
left: 0em;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
-ms-box-sizing: border-box;
box-sizing: border-box;
width: 2.75em;
height: 100%;
padding-top: 0.8em;
background-color: rgba(0, 0, 0, 0.05);
text-align: center;
-webkit-border-radius: 0.2em 0px 0px 0.2em;
-moz-border-radius: 0.2em 0px 0px 0.2em;
border-radius: 0.2em 0px 0px 0.2em;
line-height: 1;
-webkit-box-shadow: -2px 0px 0px 0px rgba(0, 0, 0, 0.05) inset;
-moz-box-shadow: -2px 0px 0px 0px rgba(0, 0, 0, 0.05) inset;
box-shadow: -2px 0px 0px 0px rgba(0, 0, 0, 0.05) inset;
}
.ui.labeled.icon.buttons .button > .icon {
-webkit-border-radius: 0em;
-moz-border-radius: 0em;
border-radius: 0em;
}
.ui.labeled.icon.buttons .button:first-child > .icon {
border-top-left-radius: 0.2em;
border-bottom-left-radius: 0.2em;
}
.ui.labeled.icon.buttons .button:last-child > .icon {
border-top-right-radius: 0.2em;
border-bottom-right-radius: 0.2em;
}
.ui.vertical.labeled.icon.buttons .button:first-child > .icon {
-webkit-border-radius: 0em;
-moz-border-radius: 0em;
border-radius: 0em;
border-top-left-radius: 0.2em;
}
.ui.vertical.labeled.icon.buttons .button:last-child > .icon {
-webkit-border-radius: 0em;
-moz-border-radius: 0em;
border-radius: 0em;
border-bottom-left-radius: 0.2em;
}
.ui.right.labeled.icon.button {
padding-left: 1.4em !important;
padding-right: 4em !important;
}
.ui.left.fluid.labeled.icon.button,
.ui.right.fluid.labeled.icon.button {
padding-left: 1.4em !important;
padding-right: 1.4em !important;
}
.ui.right.labeled.icon.button .icon {
left: auto;
right: 0em;
-webkit-border-radius: 0em 0.2em 0.2em 0em;
-moz-border-radius: 0em 0.2em 0.2em 0em;
border-radius: 0em 0.2em 0.2em 0em;
-webkit-box-shadow: 2px 0px 0px 0px rgba(0, 0, 0, 0.05) inset;
-moz-box-shadow: 2px 0px 0px 0px rgba(0, 0, 0, 0.05) inset;
box-shadow: 2px 0px 0px 0px rgba(0, 0, 0, 0.05) inset;
}
/*--------------
Toggle
---------------*/
/* Toggle (Modifies active state to give affordances) */
.ui.toggle.buttons .active.button,
.ui.buttons .button.toggle.active,
.ui.button.toggle.active {
background-color: #5BBD72 !important;
color: #FFFFFF !important;
}
.ui.button.toggle.active:hover {
background-color: #58CB73 !important;
color: #FFFFFF !important;
}
/*--------------
Bubbly
---------------*/
.ui.circular.button {
-webkit-border-radius: 10em;
-moz-border-radius: 10em;
border-radius: 10em;
}
/*--------------
Attached
---------------*/
.ui.attached.button {
display: block;
-webkit-box-shadow: 0px 0px 0px 1px rgba(0, 0, 0, 0.1) !important;
-moz-box-shadow: 0px 0px 0px 1px rgba(0, 0, 0, 0.1) !important;
box-shadow: 0px 0px 0px 1px rgba(0, 0, 0, 0.1) !important;
}
.ui.attached.top.button {
-webkit-border-radius: 0.2em 0.2em 0em 0em;
-moz-border-radius: 0.2em 0.2em 0em 0em;
border-radius: 0.2em 0.2em 0em 0em;
}
.ui.attached.bottom.button {
-webkit-border-radius: 0em 0em 0.2em 0.2em;
-moz-border-radius: 0em 0em 0.2em 0.2em;
border-radius: 0em 0em 0.2em 0.2em;
}
.ui.attached.left.button {
display: inline-block;
border-left: none;
padding-right: 0.75em;
text-align: right;
-webkit-border-radius: 0.2em 0em 0em 0.2em;
-moz-border-radius: 0.2em 0em 0em 0.2em;
border-radius: 0.2em 0em 0em 0.2em;
}
.ui.attached.right.button {
display: inline-block;
padding-left: 0.75em;
text-align: left;
-webkit-border-radius: 0em 0.2em 0.2em 0em;
-moz-border-radius: 0em 0.2em 0.2em 0em;
border-radius: 0em 0.2em 0.2em 0em;
}
/*-------------------
Or Buttons
--------------------*/
.ui.buttons .or {
position: relative;
float: left;
width: 0.3em;
height: 1em;
z-index: 3;
}
.ui.buttons .or:before {
position: absolute;
top: 50%;
left: 50%;
content: 'or';
background-color: #FFFFFF;
margin-top: -0.15em;
margin-left: -0.9em;
width: 1.8em;
height: 1.8em;
line-height: 1.66;
color: #AAAAAA;
font-style: normal;
font-weight: normal;
text-align: center;
-moz-box-shadow: 0px 2px 1px 0px rgba(0, 0, 0, 0.2) inset;
-webkit-box-shadow: 0px 2px 1px 0px rgba(0, 0, 0, 0.2) inset;
box-shadow: 0px 2px 1px 0px rgba(0, 0, 0, 0.2) inset;
-moz-border-radius: 500px;
-webkit-border-radius: 500px;
border-radius: 500px;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
-ms-box-sizing: border-box;
box-sizing: border-box;
}
.ui.buttons .or:after {
position: absolute;
top: 0em;
left: 0em;
content: ' ';
width: 0.3em;
height: 1.8em;
background-color: transparent;
border-top: 0.6em solid #FFFFFF;
border-bottom: 0.6em solid #FFFFFF;
}
/* Fluid Or */
.ui.fluid.buttons .or {
width: 0em !important;
}
.ui.fluid.buttons .or:after {
display: none;
}
/*-------------------
Attached
--------------------*/
/* Plural Attached */
.attached.ui.buttons {
margin: 0px;
-webkit-border-radius: 4px 4px 0px 0px;
-moz-border-radius: 4px 4px 0px 0px;
border-radius: 4px 4px 0px 0px;
}
.attached.ui.buttons .button:first-child {
-webkit-border-radius: 4px 0px 0px 0px;
-moz-border-radius: 4px 0px 0px 0px;
border-radius: 4px 0px 0px 0px;
}
.attached.ui.buttons .button:last-child {
-webkit-border-radius: 0px 4px 0px 0px;
-moz-border-radius: 0px 4px 0px 0px;
border-radius: 0px 4px 0px 0px;
}
/* Bottom Side */
.bottom.attached.ui.buttons {
margin-top: -1px;
-webkit-border-radius: 0px 0px 4px 4px;
-moz-border-radius: 0px 0px 4px 4px;
border-radius: 0px 0px 4px 4px;
}
.bottom.attached.ui.buttons .button:first-child {
-webkit-border-radius: 0px 0px 0px 4px;
-moz-border-radius: 0px 0px 0px 4px;
border-radius: 0px 0px 0px 4px;
}
.bottom.attached.ui.buttons .button:last-child {
-webkit-border-radius: 0px 0px 4px 0px;
-moz-border-radius: 0px 0px 4px 0px;
border-radius: 0px 0px 4px 0px;
}
/* Left Side */
.left.attached.ui.buttons {
margin-left: -1px;
-webkit-border-radius: 0px 4px 4px 0px;
-moz-border-radius: 0px 4px 4px 0px;
border-radius: 0px 4px 4px 0px;
}
.left.attached.ui.buttons .button:first-child {
margin-left: -1px;
-webkit-border-radius: 0px 4px 0px 0px;
-moz-border-radius: 0px 4px 0px 0px;
border-radius: 0px 4px 0px 0px;
}
.left.attached.ui.buttons .button:last-child {
margin-left: -1px;
-webkit-border-radius: 0px 0px 4px 0px;
-moz-border-radius: 0px 0px 4px 0px;
border-radius: 0px 0px 4px 0px;
}
/* Right Side */
.right.attached.ui.buttons,
.right.attached.ui.buttons .button {
margin-right: -1px;
-webkit-border-radius: 4px 0px 0px 4px;
-moz-border-radius: 4px 0px 0px 4px;
border-radius: 4px 0px 0px 4px;
}
.right.attached.ui.buttons .button:first-child {
margin-left: -1px;
-webkit-border-radius: 4px 0px 0px 0px;
-moz-border-radius: 4px 0px 0px 0px;
border-radius: 4px 0px 0px 0px;
}
.right.attached.ui.buttons .button:last-child {
margin-left: -1px;
-webkit-border-radius: 0px 0px 0px 4px;
-moz-border-radius: 0px 0px 0px 4px;
border-radius: 0px 0px 0px 4px;
}
/* Fluid */
.ui.fluid.buttons,
.ui.button.fluid,
.ui.fluid.buttons > .button {
display: block;
width: 100%;
}
.ui.two.buttons > .button {
width: 50%;
}
.ui.three.buttons > .button {
width: 33.333%;
}
.ui.four.buttons > .button {
width: 25%;
}
.ui.five.buttons > .button {
width: 20%;
}
.ui.six.buttons > .button {
width: 16.666%;
}
.ui.seven.buttons > .button {
width: 14.285%;
}
.ui.eight.buttons > .button {
width: 12.500%;
}
.ui.nine.buttons > .button {
width: 11.11%;
}
.ui.ten.buttons > .button {
width: 10%;
}
.ui.eleven.buttons > .button {
width: 9.09%;
}
.ui.twelve.buttons > .button {
width: 8.3333%;
}
/* Fluid Vertical Buttons */
.ui.fluid.vertical.buttons,
.ui.fluid.vertical.buttons > .button {
display: block;
width: auto;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
-ms-box-sizing: border-box;
box-sizing: border-box;
}
.ui.two.vertical.buttons > .button {
height: 50%;
}
.ui.three.vertical.buttons > .button {
height: 33.333%;
}
.ui.four.vertical.buttons > .button {
height: 25%;
}
.ui.five.vertical.buttons > .button {
height: 20%;
}
.ui.six.vertical.buttons > .button {
height: 16.666%;
}
.ui.seven.vertical.buttons > .button {
height: 14.285%;
}
.ui.eight.vertical.buttons > .button {
height: 12.500%;
}
.ui.nine.vertical.buttons > .button {
height: 11.11%;
}
.ui.ten.vertical.buttons > .button {
height: 10%;
}
.ui.eleven.vertical.buttons > .button {
height: 9.09%;
}
.ui.twelve.vertical.buttons > .button {
height: 8.3333%;
}
/*-------------------
Colors
--------------------*/
/*--- White ---*/
.ui.white.buttons .button,
.ui.white.button {
background-color: #FFFFFF;
}
.ui.white.buttons .button:hover,
.ui.white.button:hover {
background-color: #A4A4A4;
}
/*--- Black ---*/
.ui.black.buttons .button,
.ui.black.button {
background-color: #5C6166;
color: #FFFFFF;
}
.ui.black.buttons .button:hover,
.ui.black.button:hover {
background-color: #4C4C4C;
color: #FFFFFF;
}
.ui.black.buttons .button:active,
.ui.black.button:active {
background-color: #333333;
color: #FFFFFF;
}
/*--- Green ---*/
.ui.green.buttons .button,
.ui.green.button {
background-color: #5BBD72;
color: #FFFFFF;
}
.ui.green.buttons .button:hover,
.ui.green.button:hover,
.ui.green.buttons .active.button,
.ui.green.button.active {
background-color: #58cb73;
color: #FFFFFF;
}
.ui.green.buttons .button:active,
.ui.green.button:active {
background-color: #4CB164;
color: #FFFFFF;
}
/*--- Red ---*/
.ui.red.buttons .button,
.ui.red.button {
background-color: #D95C5C;
color: #FFFFFF;
}
.ui.red.buttons .button:hover,
.ui.red.button:hover,
.ui.red.buttons .active.button,
.ui.red.button.active {
background-color: #E75859;
color: #FFFFFF;
}
.ui.red.buttons .button:active,
.ui.red.button:active {
background-color: #D24B4C;
color: #FFFFFF;
}
/*--- Orange ---*/
.ui.orange.buttons .button,
.ui.orange.button {
background-color: #E96633;
color: #FFFFFF;
}
.ui.orange.buttons .button:hover,
.ui.orange.button:hover,
.ui.orange.buttons .active.button,
.ui.orange.button.active {
background-color: #FF7038;
color: #FFFFFF;
}
.ui.orange.buttons .button:active,
.ui.orange.button:active {
background-color: #DA683B;
color: #FFFFFF;
}
/*--- Blue ---*/
.ui.blue.buttons .button,
.ui.blue.button {
background-color: #6ECFF5;
color: #FFFFFF;
}
.ui.blue.buttons .button:hover,
.ui.blue.button:hover,
.ui.blue.buttons .active.button,
.ui.blue.button.active {
background-color: #1AB8F3;
color: #FFFFFF;
}
.ui.blue.buttons .button:active,
.ui.blue.button:active {
background-color: #0AA5DF;
color: #FFFFFF;
}
/*--- Purple ---*/
.ui.purple.buttons .button,
.ui.purple.button {
background-color: #564F8A;
color: #FFFFFF;
}
.ui.purple.buttons .button:hover,
.ui.purple.button:hover,
.ui.purple.buttons .active.button,
.ui.purple.button.active {
background-color: #3E3773;
color: #FFFFFF;
}
.ui.purple.buttons .button:active,
.ui.purple.button:active {
background-color: #2E2860;
color: #FFFFFF;
}
/*--- Teal ---*/
.ui.teal.buttons .button,
.ui.teal.button {
background-color: #00B5AD;
color: #FFFFFF;
}
.ui.teal.buttons .button:hover,
.ui.teal.button:hover,
.ui.teal.buttons .active.button,
.ui.teal.button.active {
background-color: #009A93;
color: #FFFFFF;
}
.ui.teal.buttons .button:active,
.ui.teal.button:active {
background-color: #00847E;
color: #FFFFFF;
}
/*---------------
Positive
----------------*/
.ui.positive.buttons .button,
.ui.positive.button {
background-color: #5BBD72 !important;
color: #FFFFFF;
}
.ui.positive.buttons .button:hover,
.ui.positive.button:hover,
.ui.positive.buttons .active.button,
.ui.positive.button.active {
background-color: #58CB73 !important;
color: #FFFFFF;
}
.ui.positive.buttons .button:active,
.ui.positive.button:active {
background-color: #4CB164 !important;
color: #FFFFFF;
}
/*---------------
Negative
----------------*/
.ui.negative.buttons .button,
.ui.negative.button {
background-color: #D95C5C !important;
color: #FFFFFF;
}
.ui.negative.buttons .button:hover,
.ui.negative.button:hover,
.ui.negative.buttons .active.button,
.ui.negative.button.active {
background-color: #E75859 !important;
color: #FFFFFF;
}
.ui.negative.buttons .button:active,
.ui.negative.button:active {
background-color: #D24B4C !important;
color: #FFFFFF;
}
/*******************************
Groups
*******************************/
.ui.buttons {
display: inline-block;
vertical-align: middle;
}
.ui.buttons:after {
content: ".";
display: block;
height: 0;
clear: both;
visibility: hidden;
}
.ui.buttons .button:first-child {
border-left: none;
}
.ui.buttons .button {
float: left;
-webkit-border-radius: 0em;
-moz-border-radius: 0em;
border-radius: 0em;
border-left: 1px solid rgba(0, 0, 0, 0.05);
}
.ui.buttons .button:first-child {
margin-left: 0em;
border-top-left-radius: 0.2em;
border-bottom-left-radius: 0.2em;
}
.ui.buttons .button:last-child {
border-top-right-radius: 0.2em;
border-bottom-right-radius: 0.2em;
}
/* Vertical Style */
.ui.vertical.buttons {
display: inline-block;
}
.ui.vertical.buttons .button {
display: block;
float: none;
border-bottom: 1px solid rgba(0, 0, 0, 0.05);
border-left: none;
box-shadow: none;
}
.ui.vertical.buttons .button:first-child,
.ui.vertical.buttons .mini.button:first-child,
.ui.vertical.buttons .tiny.button:first-child,
.ui.vertical.buttons .small.button:first-child,
.ui.vertical.buttons .massive.button:first-child,
.ui.vertical.buttons .huge.button:first-child {
margin-top: 0px;
-moz-border-radius: 0.2em 0.2em 0px 0px;
-webkit-border-radius: 0.2em 0.2em 0px 0px;
border-radius: 0.2em 0.2em 0px 0px;
}
.ui.vertical.buttons .button:last-child,
.ui.vertical.buttons .mini.button:last-child,
.ui.vertical.buttons .tiny.button:last-child,
.ui.vertical.buttons .small.button:last-child,
.ui.vertical.buttons .massive.button:last-child,
.ui.vertical.buttons .huge.button:last-child,
.ui.vertical.buttons .gigantic.button:last-child {
-moz-border-radius: 0px 0px 0.2em 0.2em;
-webkit-border-radius: 0px 0px 0.2em 0.2em;
border-radius: 0px 0px 0.2em 0.2em;
}
/*
* # Semantic - Divider
* http://github.com/jlukic/semantic-ui/
*
*
* Copyright 2013 Contributors
* Released under the MIT license
* http://opensource.org/licenses/MIT
*
*/
/*******************************
Divider
*******************************/
.ui.divider {
margin: 1rem 0rem;
border-top: 1px solid rgba(0, 0, 0, 0.1);
border-bottom: 1px solid rgba(255, 255, 255, 0.8);
line-height: 1;
height: 0em;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
-ms-box-sizing: border-box;
box-sizing: border-box;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}
.ui.vertical.divider,
.ui.horizontal.divider {
position: absolute;
border: none;
height: 0em;
margin: 0em;
background-color: transparent;
font-size: 0.875rem;
font-weight: bold;
text-align: center;
text-transform: uppercase;
color: rgba(0, 0, 0, 0.8);
}
/*--------------
Vertical
---------------*/
.ui.vertical.divider {
position: absolute;
z-index: 2;
top: 50%;
left: 50%;
margin: 0% 0% 0% -3%;
width: 6%;
height: 50%;
line-height: 0;
padding: 0em;
}
.ui.vertical.divider:before,
.ui.vertical.divider:after {
position: absolute;
left: 50%;
content: " ";
z-index: 3;
border-left: 1px solid rgba(0, 0, 0, 0.1);
border-right: 1px solid rgba(255, 255, 255, 0.8);
width: 0%;
height: 80%;
}
.ui.vertical.divider:before {
top: -100%;
}
.ui.vertical.divider:after {
top: auto;
bottom: 0px;
}
/*--------------
Horizontal
---------------*/
.ui.horizontal.divider {
position: relative;
top: 0%;
left: 0%;
margin: 1rem 1.5rem;
height: auto;
padding: 0em;
line-height: 1;
}
.ui.horizontal.divider:before,
.ui.horizontal.divider:after {
position: absolute;
content: " ";
z-index: 3;
width: 50%;
top: 50%;
height: 0%;
border-top: 1px solid rgba(0, 0, 0, 0.1);
border-bottom: 1px solid rgba(255, 255, 255, 0.8);
}
.ui.horizontal.divider:before {
left: 0%;
margin-left: -1.5rem;
}
.ui.horizontal.divider:after {
left: auto;
right: 0%;
margin-right: -1.5rem;
}
/*--------------
Icon
---------------*/
.ui.divider > .icon {
margin: 0em;
font-size: 1rem;
vertical-align: middle;
}
/*******************************
Variations
*******************************/
/*--------------
Inverted
---------------*/
.ui.divider.inverted {
color: #ffffff;
}
.ui.vertical.inverted.divider,
.ui.horizontal.inverted.divider {
color: rgba(255, 255, 255, 0.9);
}
.ui.divider.inverted,
.ui.divider.inverted:after,
.ui.divider.inverted:before {
border-top-color: rgba(0, 0, 0, 0.15);
border-bottom-color: rgba(255, 255, 255, 0.15);
border-left-color: rgba(0, 0, 0, 0.15);
border-right-color: rgba(255, 255, 255, 0.15);
}
/*--------------
Fitted
---------------*/
.ui.fitted.divider {
margin: 0em;
}
/*--------------
Clearing
---------------*/
.ui.clearing.divider {
clear: both;
}
/*--------------
Section
---------------*/
.ui.section.divider {
margin-top: 2rem;
margin-bottom: 2rem;
}
/*
* # Semantic - Header
* http://github.com/jlukic/semantic-ui/
*
*
* Copyright 2013 Contributors
* Released under the MIT license
* http://opensource.org/licenses/MIT
*
*/
/*******************************
Header
*******************************/
/* Standard */
.ui.header {
border: none;
margin: 1em 0em 1rem;
padding: 0em;
font-size: 1.33em;
font-weight: bold;
line-height: 1.33;
}
.ui.header .sub.header {
font-size: 1rem;
font-weight: normal;
margin: 0em;
padding: 0em;
line-height: 1.2;
color: rgba(0, 0, 0, 0.5);
}
.ui.header .icon {
display: table-cell;
vertical-align: middle;
padding-right: 0.5em;
}
.ui.header .icon:only-child {
display: inline-block;
}
.ui.header .content {
display: inline-block;
vertical-align: top;
}
.ui.header .icon + .content {
padding-left: 0.5em;
display: table-cell;
}
/* Positioning */
.ui.header:first-child {
margin-top: 0em;
}
.ui.header:last-child {
margin-bottom: 0em;
}
.ui.header + p {
margin-top: 0em;
}
/*--------------
Page Heading
---------------*/
h1.ui.header {
min-height: 1rem;
line-height: 1.33;
font-size: 2rem;
}
h2.ui.header {
line-height: 1.33;
font-size: 1.75rem;
}
h3.ui.header {
line-height: 1.33;
font-size: 1.33rem;
}
h4.ui.header {
line-height: 1.33;
font-size: 1.1rem;
}
h5.ui.header {
line-height: 1.2;
font-size: 1rem;
}
/*--------------
Content Heading
---------------*/
.ui.huge.header {
min-height: 1em;
font-size: 2em;
}
.ui.large.header {
font-size: 1.75em;
}
.ui.medium.header {
font-size: 1.33em;
}
.ui.small.header {
font-size: 1.1em;
}
.ui.tiny.header {
font-size: 1em;
}
/*******************************
Types
*******************************/
/*-------------------
Icon
--------------------*/
.ui.icon.header {
display: inline-block;
text-align: center;
}
.ui.icon.header .icon {
float: none;
display: block;
font-size: 3em;
margin: 0em auto 0.2em;
padding: 0em;
}
.ui.icon.header .content {
display: block;
}
.ui.icon.header .circular.icon,
.ui.icon.header .square.icon {
font-size: 2em;
}
.ui.block.icon.header .icon {
margin-bottom: 0em;
}
.ui.icon.header.aligned {
margin-left: auto;
margin-right: auto;
display: block;
}
/*******************************
States
*******************************/
.ui.disabled.header {
opacity: 0.5;
}
/*******************************
Variations
*******************************/
/*-------------------
Colors
--------------------*/
.ui.blue.header {
color: #6ECFF5 !important;
}
.ui.black.header {
color: #5C6166 !important;
}
.ui.green.header {
color: #A1CF64 !important;
}
.ui.red.header {
color: #D95C5C !important;
}
.ui.purple.header {
color: #564F8A !important;
}
.ui.teal.header {
color: #00B5AD !important;
}
.ui.blue.dividing.header {
border-bottom: 3px solid #6ECFF5;
}
.ui.black.dividing.header {
border-bottom: 3px solid #5C6166;
}
.ui.green.dividing.header {
border-bottom: 3px solid #A1CF64;
}
.ui.red.dividing.header {
border-bottom: 3px solid #D95C5C;
}
.ui.purple.dividing.header {
border-bottom: 3px solid #564F8A;
}
.ui.teal.dividing.header {
border-bottom: 3px solid #00B5AD;
}
/*-------------------
Inverted
--------------------*/
.ui.inverted.header {
color: #FFFFFF;
}
.ui.inverted.header .sub.header {
color: rgba(255, 255, 255, 0.85);
}
/*-------------------
Inverted Colors
--------------------*/
.ui.inverted.black.header {
background-color: #5C6166 !important;
color: #FFFFFF !important;
}
.ui.inverted.blue.header {
background-color: #6ECFF5 !important;
color: #FFFFFF !important;
}
.ui.inverted.green.header {
background-color: #A1CF64 !important;
color: #FFFFFF !important;
}
.ui.inverted.red.header {
background-color: #D95C5C !important;
color: #FFFFFF !important;
}
.ui.inverted.purple.header {
background-color: #564F8A !important;
color: #FFFFFF !important;
}
.ui.inverted.teal.header {
background-color: #00B5AD !important;
color: #FFFFFF !important;
}
.ui.inverted.block.header {
border-bottom: none;
}
/*-------------------
Aligned
--------------------*/
.ui.left.aligned.header {
text-align: left;
}
.ui.right.aligned.header {
text-align: right;
}
.ui.center.aligned.header {
text-align: center;
}
/*-------------------
Floated
--------------------*/
.ui.floated.header,
.ui.left.floated.header {
float: left;
margin-top: 0em;
margin-right: 0.5em;
}
.ui.right.floated.header {
float: right;
margin-top: 0em;
margin-left: 0.5em;
}
/*-------------------
Fittted
--------------------*/
.ui.fitted.header {
padding: 0em;
}
/*-------------------
Dividing
--------------------*/
.ui.dividing.header {
padding-bottom: 0.2rem;
border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}
.ui.dividing.header .sub.header {
padding-bottom: 0.5em;
}
.ui.dividing.header .icon {
margin-bottom: 0.2em;
}
/*-------------------
Block
--------------------*/
.ui.block.header {
background-color: rgba(0, 0, 0, 0.05);
padding: 0.5em 1em;
}
/*-------------------
Attached
--------------------*/
.ui.attached.header {
background-color: #E0E0E0;
padding: 0.5em 1rem;
-webkit-box-shadow: 0px 0px 0px 1px rgba(0, 0, 0, 0.1);
-moz-box-shadow: 0px 0px 0px 1px rgba(0, 0, 0, 0.1);
box-shadow: 0px 0px 0px 1px rgba(0, 0, 0, 0.1);
}
.ui.top.attached.header {
margin-bottom: 0em;
-webkit-border-radius: 0.3125em 0.3125em 0em 0em;
-moz-border-radius: 0.3125em 0.3125em 0em 0em;
border-radius: 0.3125em 0.3125em 0em 0em;
}
.ui.bottom.attached.header {
margin-top: 0em;
-webkit-border-radius: 0em 0em 0.3125em 0.3125em;
-moz-border-radius: 0em 0em 0.3125em 0.3125em;
border-radius: 0em 0em 0.3125em 0.3125em;
}
/*
* # Semantic - Icon
* http://github.com/jlukic/semantic-ui/
*
*
* Copyright 2013 Contributors
* Released under the MIT license
* http://opensource.org/licenses/MIT
*
*/
/*!
* Font Awesome 3.2.1
* the iconic font designed for Bootstrap
* ------------------------------------------------------------------------------
* The full suite of pictographic icons, examples, and documentation can be
* found at http://fon.io. Stay up to date on Twitter at
* http://twitter.com/fon.
*
* License
* ------------------------------------------------------------------------------
* - The Font Awesome font is licensed under SIL OFL 1.1 -
* http://scripts.sil.org/OFL
/*******************************
Icon
*******************************/
@font-face {
font-family: 'Icons';
src: url(../fonts/icons.eot);
src: url(../fonts/icons.eot?#iefix) format('embedded-opentype'), url(../fonts/icons.woff) format('woff'), url(../fonts/icons.ttf) format('truetype'), url(../fonts/icons.svg#icons) format('svg');
font-style: normal;
font-weight: normal;
font-variant: normal;
text-decoration: inherit;
text-transform: none;
}
i.icon {
display: inline-block;
opacity: 0.75;
margin: 0em 0.25em 0em 0em;
width: 1.23em;
height: 1em;
font-family: 'Icons';
font-style: normal;
line-height: 1;
font-weight: normal;
text-decoration: inherit;
text-align: center;
speak: none;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
-ms-box-sizing: border-box;
box-sizing: border-box;
-webkit-font-smoothing: antialiased;
-moz-font-smoothing: antialiased;
font-smoothing: antialiased;
}
i.icon.left:before {
content: "\f060";
}
i.icon.right:before {
content: "\f061";
}
i.icon.add.sign.box:before {
content: "\f0fe";
}
i.icon.add.sign:before {
content: "\f055";
}
i.icon.add:before {
content: "\f067";
}
i.icon.adjust:before {
content: "\f042";
}
i.icon.adn:before {
content: "\f170";
}
i.icon.align.center:before {
content: "\f037";
}
i.icon.align.justify:before {
content: "\f039";
}
i.icon.align.left:before {
content: "\f036";
}
i.icon.align.right:before {
content: "\f038";
}
i.icon.ambulance:before {
content: "\f0f9";
}
i.icon.anchor:before {
content: "\f13d";
}
i.icon.android:before {
content: "\f17b";
}
i.icon.angle.down:before {
content: "\f107";
}
i.icon.angle.left:before {
content: "\f104";
}
i.icon.angle.right:before {
content: "\f105";
}
i.icon.angle.up:before {
content: "\f106";
}
i.icon.apple:before {
content: "\f179";
}
i.icon.archive:before {
content: "\f187";
}
i.icon.arrow.down:before {
content: "\f078";
}
i.icon.arrow.left:before {
content: "\f053";
}
i.icon.arrow.right:before {
content: "\f054";
}
i.icon.arrow.sign.down:before {
content: "\f13a";
}
i.icon.arrow.sign.left:before {
content: "\f137";
}
i.icon.arrow.sign.right:before {
content: "\f138";
}
i.icon.arrow.sign.up:before {
content: "\f139";
}
i.icon.arrow.up:before {
content: "\f077";
}
i.icon.asterisk:before {
content: "\f069";
}
i.icon.attachment:before {
content: "\f0c6";
}
i.icon.attention:before {
content: "\f06a";
}
i.icon.backward:before {
content: "\f04a";
}
i.icon.ban.circle:before {
content: "\f05e";
}
i.icon.bar.chart:before {
content: "\f080";
}
i.icon.barcode:before {
content: "\f02a";
}
i.icon.beer:before {
content: "\f0fc";
}
i.icon.bell.outline:before {
content: "\f0a2";
}
i.icon.bell:before {
content: "\f0f3";
}
i.icon.bitbucket.sign:before {
content: "\f172";
}
i.icon.bitbucket:before {
content: "\f171";
}
i.icon.bitcoin:before {
content: "\f15a";
}
i.icon.bold:before {
content: "\f032";
}
i.icon.bolt:before {
content: "\f0e7";
}
i.icon.book:before {
content: "\f02d";
}
i.icon.bookmark.empty:before {
content: "\f097";
}
i.icon.bookmark:before {
content: "\f02e";
}
i.icon.box.arrow.down:before {
content: "\f150";
}
i.icon.box.arrow.right:before {
content: "\f152";
}
i.icon.box.arrow.up:before {
content: "\f151";
}
i.icon.briefcase:before {
content: "\f0b1";
}
i.icon.browser:before {
content: "\f022";
}
i.icon.bug:before {
content: "\f188";
}
i.icon.building:before {
content: "\f0f7";
}
i.icon.bullhorn:before {
content: "\f0a1";
}
i.icon.bullseye:before {
content: "\f140";
}
i.icon.calendar.empty:before {
content: "\f133";
}
i.icon.calendar:before {
content: "\f073";
}
i.icon.camera.retro:before {
content: "\f083";
}
i.icon.camera:before {
content: "\f030";
}
i.icon.triangle.down:before {
content: "\f0d7";
}
i.icon.triangle.left:before {
content: "\f0d9";
}
i.icon.triangle.right:before {
content: "\f0da";
}
i.icon.triangle.up:before {
content: "\f0d8";
}
i.icon.cart:before {
content: "\f07a";
}
i.icon.certificate:before {
content: "\f0a3";
}
i.icon.chat.outline:before {
content: "\f0e6";
}
i.icon.chat:before {
content: "\f086";
}
i.icon.checkbox.empty:before {
content: "\f096";
}
i.icon.checkbox.minus:before {
content: "\f147";
}
i.icon.checked.checkbox:before {
content: "\f046";
}
i.icon.checkmark.sign:before {
content: "\f14a";
}
i.icon.checkmark:before {
content: "\f00c";
}
i.icon.circle.blank:before {
content: "\f10c";
}
i.icon.circle.down:before {
content: "\f0ab";
}
i.icon.circle.left:before {
content: "\f0a8";
}
i.icon.circle.right:before {
content: "\f0a9";
}
i.icon.circle.up:before {
content: "\f0aa";
}
i.icon.circle:before {
content: "\f111";
}
i.icon.cloud.download:before {
content: "\f0ed";
}
i.icon.cloud.upload:before {
content: "\f0ee";
}
i.icon.cloud:before {
content: "\f0c2";
}
i.icon.code.fork:before {
content: "\f126";
}
i.icon.code:before {
content: "\f121";
}
i.icon.coffee:before {
content: "\f0f4";
}
i.icon.collapse:before {
content: "\f117";
}
i.icon.comment.outline:before {
content: "\f0e5";
}
i.icon.comment:before {
content: "\f075";
}
i.icon.copy:before {
content: "\f0c5";
}
i.icon.crop:before {
content: "\f125";
}
i.icon.css3:before {
content: "\f13c";
}
i.icon.cut:before {
content: "\f0c4";
}
i.icon.dashboard:before {
content: "\f0e4";
}
i.icon.desktop:before {
content: "\f108";
}
i.icon.doctor:before {
content: "\f0f0";
}
i.icon.dollar:before {
content: "\f155";
}
i.icon.double.angle.down:before {
content: "\f103";
}
i.icon.double.angle.left:before {
content: "\f100";
}
i.icon.double.angle.right:before {
content: "\f101";
}
i.icon.double.angle.up:before {
content: "\f102";
}
i.icon.down:before {
content: "\f063";
}
i.icon.download.disk:before {
content: "\f019";
}
i.icon.download:before {
content: "\f01a";
}
i.icon.dribbble:before {
content: "\f17d";
}
i.icon.dropbox:before {
content: "\f16b";
}
i.icon.edit.sign:before {
content: "\f14b";
}
i.icon.edit:before {
content: "\f044";
}
i.icon.eject:before {
content: "\f052";
}
i.icon.ellipsis.horizontal:before {
content: "\f141";
}
i.icon.ellipsis.vertical:before {
content: "\f142";
}
i.icon.eraser:before {
content: "\f12d";
}
i.icon.euro:before {
content: "\f153";
}
i.icon.exchange:before {
content: "\f0ec";
}
i.icon.exclamation:before {
content: "\f12a";
}
i.icon.expand:before {
content: "\f116";
}
i.icon.external.url.sign:before {
content: "\f14c";
}
i.icon.external.url:before {
content: "\f08e";
}
i.icon.facebook.sign:before {
content: "\f082";
}
i.icon.facebook:before {
content: "\f09a";
}
i.icon.facetime.video:before {
content: "\f03d";
}
i.icon.fast.backward:before {
content: "\f049";
}
i.icon.fast.forward:before {
content: "\f050";
}
i.icon.female:before {
content: "\f182";
}
i.icon.fighter.jet:before {
content: "\f0fb";
}
i.icon.file.outline:before {
content: "\f016";
}
i.icon.file.text.outline:before {
content: "\f0f6";
}
i.icon.file.text:before {
content: "\f15c";
}
i.icon.file:before {
content: "\f15b";
}
i.icon.filter:before {
content: "\f0b0";
}
i.icon.fire.extinguisher:before {
content: "\f134";
}
i.icon.fire:before {
content: "\f06d";
}
i.icon.flag.checkered:before {
content: "\f11e";
}
i.icon.flag.empty:before {
content: "\f11d";
}
i.icon.flag:before {
content: "\f024";
}
i.icon.flickr:before {
content: "\f16e";
}
i.icon.folder.open.outline:before {
content: "\f115";
}
i.icon.folder.open:before {
content: "\f07c";
}
i.icon.folder.outline:before {
content: "\f114";
}
i.icon.folder:before {
content: "\f07b";
}
i.icon.font:before {
content: "\f031";
}
i.icon.food:before {
content: "\f0f5";
}
i.icon.forward.mail:before {
content: "\f064";
}
i.icon.forward:before {
content: "\f04e";
}
i.icon.foursquare:before {
content: "\f180";
}
i.icon.frown:before {
content: "\f119";
}
i.icon.fullscreen:before {
content: "\f0b2";
}
i.icon.gamepad:before {
content: "\f11b";
}
i.icon.gift:before {
content: "\f06b";
}
i.icon.github.alternate:before {
content: "\f09b";
}
i.icon.github.sign:before {
content: "\f092";
}
i.icon.github:before {
content: "\f113";
}
i.icon.gittip:before {
content: "\f184";
}
i.icon.glass:before {
content: "\f000";
}
i.icon.globe:before {
content: "\f0ac";
}
i.icon.google.plus.sign:before {
content: "\f0d4";
}
i.icon.google.plus:before {
content: "\f0d5";
}
i.icon.h.sign:before {
content: "\f0fd";
}
i.icon.hand.down:before {
content: "\f0a7";
}
i.icon.hand.left:before {
content: "\f0a5";
}
i.icon.hand.right:before {
content: "\f0a4";
}
i.icon.hand.up:before {
content: "\f0a6";
}
i.icon.hdd:before {
content: "\f0a0";
}
i.icon.headphones:before {
content: "\f025";
}
i.icon.heart.empty:before {
content: "\f08a";
}
i.icon.heart:before {
content: "\f004";
}
i.icon.help:before {
content: "\f059";
}
i.icon.hide:before {
content: "\f070";
}
i.icon.home:before {
content: "\f015";
}
i.icon.hospital:before {
content: "\f0f8";
}
i.icon.html5:before {
content: "\f13b";
}
i.icon.inbox:before {
content: "\f01c";
}
i.icon.indent.left:before {
content: "\f03b";
}
i.icon.indent.right:before {
content: "\f03c";
}
i.icon.info.letter:before {
content: "\f129";
}
i.icon.info:before {
content: "\f05a";
}
i.icon.instagram:before {
content: "\f16d";
}
i.icon.italic:before {
content: "\f033";
}
i.icon.key:before {
content: "\f084";
}
i.icon.keyboard:before {
content: "\f11c";
}
i.icon.lab:before {
content: "\f0c3";
}
i.icon.laptop:before {
content: "\f109";
}
i.icon.layout.block:before {
content: "\f009";
}
i.icon.layout.column:before {
content: "\f0db";
}
i.icon.layout.grid:before {
content: "\f00a";
}
i.icon.layout.list:before {
content: "\f00b";
}
i.icon.leaf:before {
content: "\f06c";
}
i.icon.legal:before {
content: "\f0e3";
}
i.icon.lemon:before {
content: "\f094";
}
i.icon.level.down:before {
content: "\f149";
}
i.icon.level.up:before {
content: "\f148";
}
i.icon.lightbulb:before {
content: "\f0eb";
}
i.icon.linkedin.sign:before {
content: "\f08c";
}
i.icon.linkedin:before {
content: "\f0e1";
}
i.icon.linux:before {
content: "\f17c";
}
i.icon.list.ordered:before {
content: "\f0cb";
}
i.icon.list.unordered:before {
content: "\f0ca";
}
i.icon.list:before {
content: "\f03a";
}
i.icon.loading:before {
content: "\f110";
}
i.icon.location:before {
content: "\f124";
}
i.icon.lock:before {
content: "\f023";
}
i.icon.long.arrow.down:before {
content: "\f175";
}
i.icon.long.arrow.left:before {
content: "\f177";
}
i.icon.long.arrow.right:before {
content: "\f178";
}
i.icon.long.arrow.up:before {
content: "\f176";
}
i.icon.magic:before {
content: "\f0d0";
}
i.icon.magnet:before {
content: "\f076";
}
i.icon.mail.outline:before {
content: "\f003";
}
i.icon.mail.reply:before {
content: "\f112";
}
i.icon.mail:before {
content: "\f0e0";
}
i.icon.male:before {
content: "\f183";
}
i.icon.map.marker:before {
content: "\f041";
}
i.icon.map:before {
content: "\f14e";
}
i.icon.maxcdn:before {
content: "\f136";
}
i.icon.medkit:before {
content: "\f0fa";
}
i.icon.meh:before {
content: "\f11a";
}
i.icon.minus.sign.alternate:before {
content: "\f146";
}
i.icon.minus.sign:before {
content: "\f056";
}
i.icon.minus:before {
content: "\f068";
}
i.icon.mobile:before {
content: "\f10b";
}
i.icon.money:before {
content: "\f0d6";
}
i.icon.moon:before {
content: "\f186";
}
i.icon.move:before {
content: "\f047";
}
i.icon.music:before {
content: "\f001";
}
i.icon.mute:before {
content: "\f131";
}
i.icon.off:before {
content: "\f011";
}
i.icon.ok.circle:before {
content: "\f05d";
}
i.icon.ok.sign:before {
content: "\f058";
}
i.icon.paste:before {
content: "\f0ea";
}
i.icon.pause:before {
content: "\f04c";
}
i.icon.payment:before {
content: "\f09d";
}
i.icon.pencil:before {
content: "\f040";
}
i.icon.phone.sign:before {
content: "\f098";
}
i.icon.phone:before {
content: "\f095";
}
i.icon.photo:before {
content: "\f03e";
}
i.icon.pin:before {
content: "\f08d";
}
i.icon.pinterest.sign:before {
content: "\f0d3";
}
i.icon.pinterest:before {
content: "\f0d2";
}
i.icon.plane:before {
content: "\f072";
}
i.icon.play.circle:before {
content: "\f01d";
}
i.icon.play.sign:before {
content: "\f144";
}
i.icon.play:before {
content: "\f04b";
}
i.icon.pound:before {
content: "\f154";
}
i.icon.print:before {
content: "\f02f";
}
i.icon.puzzle.piece:before {
content: "\f12e";
}
i.icon.qr.code:before {
content: "\f029";
}
i.icon.question:before {
content: "\f128";
}
i.icon.quote.left:before {
content: "\f10d";
}
i.icon.quote.right:before {
content: "\f10e";
}
i.icon.refresh:before {
content: "\f021";
}
i.icon.remove.circle:before {
content: "\f05c";
}
i.icon.remove.sign:before {
content: "\f057";
}
i.icon.remove:before {
content: "\f00d";
}
i.icon.renren:before {
content: "\f18b";
}
i.icon.reorder:before {
content: "\f0c9";
}
i.icon.repeat:before {
content: "\f01e";
}
i.icon.reply.all.mail:before {
content: "\f122";
}
i.icon.resize.full:before {
content: "\f065";
}
i.icon.resize.horizontal:before {
content: "\f07e";
}
i.icon.resize.small:before {
content: "\f066";
}
i.icon.resize.vertical:before {
content: "\f07d";
}
i.icon.retweet:before {
content: "\f079";
}
i.icon.road:before {
content: "\f018";
}
i.icon.rocket:before {
content: "\f135";
}
i.icon.rss.sign:before {
content: "\f143";
}
i.icon.rss:before {
content: "\f09e";
}
i.icon.rupee:before {
content: "\f156";
}
i.icon.save:before {
content: "\f0c7";
}
i.icon.screenshot:before {
content: "\f05b";
}
i.icon.search:before {
content: "\f002";
}
i.icon.setting:before {
content: "\f013";
}
i.icon.settings:before {
content: "\f085";
}
i.icon.share.sign:before {
content: "\f14d";
}
i.icon.share:before {
content: "\f045";
}
i.icon.shield:before {
content: "\f132";
}
i.icon.shuffle:before {
content: "\f074";
}
i.icon.sign.in:before {
content: "\f090";
}
i.icon.sign.out:before {
content: "\f08b";
}
i.icon.sign:before {
content: "\f0c8";
}
i.icon.signal:before {
content: "\f012";
}
i.icon.sitemap:before {
content: "\f0e8";
}
i.icon.skype:before {
content: "\f17e";
}
i.icon.smile:before {
content: "\f118";
}
i.icon.sort.alphabet.descending:before {
content: "\f15e";
}
i.icon.sort.alphabet:before {
content: "\f15d";
}
i.icon.sort.ascending:before {
content: "\f0de";
}
i.icon.sort.attributes.descending:before {
content: "\f161";
}
i.icon.sort.attributes:before {
content: "\f160";
}
i.icon.sort.descending:before {
content: "\f0dd";
}
i.icon.sort.order.descending:before {
content: "\f163";
}
i.icon.sort.order:before {
content: "\f162";
}
i.icon.sort:before {
content: "\f0dc";
}
i.icon.stackexchange:before {
content: "\f16c";
}
i.icon.star.empty:before {
content: "\f006";
}
i.icon.star.half.empty:before {
content: "\f123";
}
i.icon.star.half.full:before,
i.icon.star.half:before {
content: "\f089";
}
i.icon.star:before {
content: "\f005";
}
i.icon.step.backward:before {
content: "\f048";
}
i.icon.step.forward:before {
content: "\f051";
}
i.icon.stethoscope:before {
content: "\f0f1";
}
i.icon.stop:before {
content: "\f04d";
}
i.icon.strikethrough:before {
content: "\f0cc";
}
i.icon.subscript:before {
content: "\f12c";
}
i.icon.suitcase:before {
content: "\f0f2";
}
i.icon.sun:before {
content: "\f185";
}
i.icon.superscript:before {
content: "\f12b";
}
i.icon.table:before {
content: "\f0ce";
}
i.icon.tablet:before {
content: "\f10a";
}
i.icon.tag:before {
content: "\f02b";
}
i.icon.tags:before {
content: "\f02c";
}
i.icon.tasks:before {
content: "\f0ae";
}
i.icon.terminal:before {
content: "\f120";
}
i.icon.text.height:before {
content: "\f034";
}
i.icon.text.width:before {
content: "\f035";
}
i.icon.thumbs.down.outline:before {
content: "\f088";
}
i.icon.thumbs.down:before {
content: "\f165";
}
i.icon.thumbs.up.outline:before {
content: "\f087";
}
i.icon.thumbs.up:before {
content: "\f164";
}
i.icon.ticket:before {
content: "\f145";
}
i.icon.time:before {
content: "\f017";
}
i.icon.tint:before {
content: "\f043";
}
i.icon.trash:before {
content: "\f014";
}
i.icon.trello:before {
content: "\f181";
}
i.icon.trophy:before {
content: "\f091";
}
i.icon.truck:before {
content: "\f0d1";
}
i.icon.tumblr.sign:before {
content: "\f174";
}
i.icon.tumblr:before {
content: "\f173";
}
i.icon.twitter.sign:before {
content: "\f081";
}
i.icon.twitter:before {
content: "\f099";
}
i.icon.umbrella:before {
content: "\f0e9";
}
i.icon.underline:before {
content: "\f0cd";
}
i.icon.undo:before {
content: "\f0e2";
}
i.icon.unhide:before {
content: "\f06e";
}
i.icon.unlink:before {
content: "\f127";
}
i.icon.unlock.alternate:before {
content: "\f13e";
}
i.icon.unlock:before {
content: "\f09c";
}
i.icon.unmute:before {
content: "\f130";
}
i.icon.up:before {
content: "\f062";
}
i.icon.upload.disk:before {
content: "\f093";
}
i.icon.upload:before {
content: "\f01b";
}
i.icon.url:before {
content: "\f0c1";
}
i.icon.user:before {
content: "\f007";
}
i.icon.users:before {
content: "\f0c0";
}
i.icon.video:before {
content: "\f008";
}
i.icon.vk:before {
content: "\f189";
}
i.icon.volume.down:before {
content: "\f027";
}
i.icon.volume.off:before {
content: "\f026";
}
i.icon.volume.up:before {
content: "\f028";
}
i.icon.warning:before {
content: "\f071";
}
i.icon.weibo:before {
content: "\f18a";
}
i.icon.windows:before {
content: "\f17a";
}
i.icon.won:before {
content: "\f159";
}
i.icon.wrench:before {
content: "\f0ad";
}
i.icon.xing.sign:before {
content: "\f169";
}
i.icon.xing:before {
content: "\f168";
}
i.icon.yen:before {
content: "\f157";
}
i.icon.youtube.play:before {
content: "\f16a";
}
i.icon.youtube.sign:before {
content: "\f166";
}
i.icon.youtube:before {
content: "\f167";
}
i.icon.yuan:before {
content: "\f158";
}
i.icon.zoom.in:before {
content: "\f00e";
}
i.icon.zoom.out:before {
content: "\f010";
}
/*--------------
Aliases
---------------*/
i.icon.check:before {
content: "\f00c";
}
i.icon.close:before {
content: "\f00d";
}
i.icon.delete:before {
content: "\f00d";
}
i.icon.like:before {
content: "\f004";
}
i.icon.plus:before {
content: "\f067";
}
i.icon.signup:before {
content: "\f044";
}
/*--------------
Spacing Fix
---------------*/
/* stars are usually consecutive */
i.icon.star {
width: auto;
margin: 0em;
}
/* left side icons */
i.icon.left,
i.icon.left,
i.icon.left {
width: auto;
margin: 0em 0.5em 0em 0em;
}
/* right side icons */
i.icon.search,
i.icon.up,
i.icon.down,
i.icon.right {
width: auto;
margin: 0em 0em 0em 0.5em;
}
/*******************************
Types
*******************************/
/*--------------
Loading
---------------*/
i.icon.loading {
-webkit-animation: icon-loading 2s linear infinite;
-moz-animation: icon-loading 2s linear infinite;
-ms-animation: icon-loading 2s linear infinite;
-o-animation: icon-loading 2s linear infinite;
animation: icon-loading 2s linear infinite;
}
@keyframes icon-loading {
from {
-webkit-transform: rotate(0deg);
-moz-transform: rotate(0deg);
-o-transform: rotate(0deg);
-ms-transform: rotate(0deg);
transform: rotate(0deg);
}
to {
-webkit-transform: rotate(360deg);
-moz-transform: rotate(360deg);
-o-transform: rotate(360deg);
-ms-transform: rotate(360deg);
transform: rotate(360deg);
}
}
@-moz-keyframes icon-loading {
from {
-moz-transform: rotate(0deg);
transform: rotate(0deg);
}
to {
-moz-transform: rotate(360deg);
transform: rotate(360deg);
}
}
@-webkit-keyframes icon-loading {
from {
-webkit-transform: rotate(0deg);
transform: rotate(0deg);
}
to {
-webkit-transform: rotate(360deg);
transform: rotate(360deg);
}
}
@-ms-keyframes icon-loading {
from {
-ms-transform: rotate(0deg);
transform: rotate(0deg);
}
to {
-ms-transform: rotate(360deg);
transform: rotate(360deg);
}
}
@-o-keyframes icon-loading {
from {
-o-transform: rotate(0deg);
transform: rotate(0deg);
}
to {
-o-transform: rotate(360deg);
transform: rotate(360deg);
}
}
/*******************************
States
*******************************/
i.icon.hover {
opacity: 1;
}
i.icon.active {
opacity: 1;
}
i.emphasized.icon {
opacity: 1;
}
i.icon.disabled {
opacity: 0.3;
}
/*******************************
Variations
*******************************/
/*-------------------
Link
--------------------*/
i.link.icon {
cursor: pointer;
opacity: 0.7;
-webkit-transition: opacity 0.3s ease-out;
-moz-transition: opacity 0.3s ease-out;
-o-transition: opacity 0.3s ease-out;
-ms-transition: opacity 0.3s ease-out;
transition: opacity 0.3s ease-out;
}
i.link.icon:hover {
opacity: 1 !important;
}
/*-------------------
Circular
--------------------*/
i.circular.icon {
-webkit-border-radius: 500em !important;
-moz-border-radius: 500em !important;
border-radius: 500em !important;
padding: 0.5em 0.35em !important;
-webkit-box-shadow: 0em 0em 0em 0.1em rgba(0, 0, 0, 0.1) inset;
-moz-box-shadow: 0em 0em 0em 0.1em rgba(0, 0, 0, 0.1) inset;
box-shadow: 0em 0em 0em 0.1em rgba(0, 0, 0, 0.1) inset;
line-height: 1 !important;
width: 2em !important;
height: 2em !important;
}
i.circular.inverted.icon {
border: none;
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
}
/*-------------------
Flipped
--------------------*/
i.flipped.icon,
i.horizontally.flipped.icon {
-webkit-transform: scale(-1, 1);
-moz-transform: scale(-1, 1);
-o-transform: scale(-1, 1);
-ms-transform: scale(-1, 1);
transform: scale(-1, 1);
}
i.vertically.flipped.icon {
-webkit-transform: scale(1, -1);
-moz-transform: scale(1, -1);
-o-transform: scale(1, -1);
-ms-transform: scale(1, -1);
transform: scale(1, -1);
}
/*-------------------
Rotated
--------------------*/
i.rotated.icon,
i.right.rotated.icon,
i.clockwise.rotated.icon {
-webkit-transform: rotate(90deg);
-moz-transform: rotate(90deg);
-o-transform: rotate(90deg);
-ms-transform: rotate(90deg);
transform: rotate(90deg);
}
i.left.rotated.icon,
i.counterclockwise.rotated.icon {
-webkit-transform: rotate(-90deg);
-moz-transform: rotate(-90deg);
-o-transform: rotate(-90deg);
-ms-transform: rotate(-90deg);
transform: rotate(-90deg);
}
/*-------------------
Square
--------------------*/
i.square.icon {
width: 2em;
height: 2em;
padding: 0.5em 0.35em !important;
-webkit-box-shadow: 0em 0em 0em 0.1em rgba(0, 0, 0, 0.1) inset;
-moz-box-shadow: 0em 0em 0em 0.1em rgba(0, 0, 0, 0.1) inset;
box-shadow: 0em 0em 0em 0.1em rgba(0, 0, 0, 0.1) inset;
vertical-align: baseline;
}
i.square.inverted.icon {
border: none;
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
}
/*-------------------
Inverted
--------------------*/
i.inverted.icon {
background-color: #222222;
color: #FFFFFF;
}
/*-------------------
Colors
--------------------*/
i.blue.icon {
color: #6ECFF5 !important;
}
i.black.icon {
color: #5C6166 !important;
}
i.green.icon {
color: #A1CF64 !important;
}
i.red.icon {
color: #D95C5C !important;
}
i.purple.icon {
color: #564F8A !important;
}
i.teal.icon {
color: #00B5AD !important;
}
/*-------------------
Inverted Colors
--------------------*/
i.inverted.black.icon {
background-color: #5C6166 !important;
color: #FFFFFF !important;
}
i.inverted.blue.icon {
background-color: #6ECFF5 !important;
color: #FFFFFF !important;
}
i.inverted.green.icon {
background-color: #A1CF64 !important;
color: #FFFFFF !important;
}
i.inverted.red.icon {
background-color: #D95C5C !important;
color: #FFFFFF !important;
}
i.inverted.purple.icon {
background-color: #564F8A !important;
color: #FFFFFF !important;
}
i.inverted.teal.icon {
background-color: #00B5AD !important;
color: #FFFFFF !important;
}
/*-------------------
Sizes
--------------------*/
i.small.icon {
font-size: 0.875em;
}
i.icon {
font-size: 1em;
}
i.large.icon {
font-size: 1.5em;
vertical-align: middle;
}
i.big.icon {
font-size: 2em;
vertical-align: middle;
}
i.huge.icon {
font-size: 4em;
vertical-align: middle;
}
i.massive.icon {
font-size: 8em;
vertical-align: middle;
}
/*
* # Semantic - Image
* http://github.com/jlukic/semantic-ui/
*
*
* Copyright 2013 Contributors
* Released under the MIT license
* http://opensource.org/licenses/MIT
*
*/
/*******************************
Image
*******************************/
.ui.image {
position: relative;
display: inline-block;
vertical-align: middle;
max-width: 100%;
background-color: rgba(0, 0, 0, 0.05);
}
img.ui.image {
display: block;
background: none;
}
.ui.image img {
display: block;
max-width: 100%;
height: auto;
}
/*******************************
States
*******************************/
.ui.disabled.image {
cursor: default;
opacity: 0.3;
}
/*******************************
Variations
*******************************/
/*--------------
Rounded
---------------*/
.ui.rounded.images .image,
.ui.rounded.images img,
.ui.rounded.image img,
.ui.rounded.image {
-webkit-border-radius: 0.3125em;
-moz-border-radius: 0.3125em;
border-radius: 0.3125em;
}
/*--------------
Circular
---------------*/
.ui.circular.images .image,
.ui.circular.images img,
.ui.circular.image img,
.ui.circular.image {
-webkit-border-radius: 500rem;
-moz-border-radius: 500rem;
border-radius: 500rem;
}
/*--------------
Fluid
---------------*/
.ui.fluid.images,
.ui.fluid.image,
.ui.fluid.images img,
.ui.fluid.image img {
display: block;
width: 100%;
}
/*--------------
Avatar
---------------*/
.ui.avatar.images .image,
.ui.avatar.images img,
.ui.avatar.image img,
.ui.avatar.image {
margin-right: 0.5em;
display: inline-block;
width: 2em;
height: 2em;
-webkit-border-radius: 500rem;
-moz-border-radius: 500rem;
border-radius: 500rem;
}
/*-------------------
Floated
--------------------*/
.ui.floated.image,
.ui.floated.images {
float: left;
margin-right: 1em;
margin-bottom: 1em;
}
.ui.right.floated.images,
.ui.right.floated.image {
float: right;
margin-bottom: 1em;
margin-left: 1em;
}
/*--------------
Sizes
---------------*/
.ui.tiny.images .image,
.ui.tiny.images img,
.ui.tiny.image {
width: 20px;
font-size: 0.7rem;
}
.ui.mini.images .image,
.ui.mini.images img,
.ui.mini.image {
width: 35px;
font-size: 0.8rem;
}
.ui.small.images .image,
.ui.small.images img,
.ui.small.image {
width: 80px;
font-size: 0.9rem;
}
.ui.medium.images .image,
.ui.medium.images img,
.ui.medium.image {
width: 300px;
font-size: 1rem;
}
.ui.large.images .image,
.ui.large.images img,
.ui.large.image {
width: 450px;
font-size: 1.1rem;
}
.ui.huge.images .image,
.ui.huge.images img,
.ui.huge.image {
width: 600px;
font-size: 1.2rem;
}
/*******************************
Groups
*******************************/
.ui.images {
font-size: 0em;
margin: 0em -0.25rem 0rem;
}
.ui.images .image,
.ui.images img {
display: inline-block;
margin: 0em 0.25em 0.5em;
}
/*
* # Semantic - Input
* http://github.com/jlukic/semantic-ui/
*
*
* Copyright 2013 Contributors
* Released under the MIT license
* http://opensource.org/licenses/MIT
*
*/
/*******************************
Standard
*******************************/
/*--------------------
Inputs
---------------------*/
.ui.input {
display: inline-block;
position: relative;
color: rgba(0, 0, 0, 0.7);
}
.ui.input input {
width: 100%;
font-family: "Helvetica Neue", "Helvetica", Arial;
margin: 0em;
padding: 0.85em 1.2em;
font-size: 0.875em;
background-color: #FFFFFF;
border: 1px solid rgba(0, 0, 0, 0.15);
outline: none;
color: rgba(0, 0, 0, 0.7);
-webkit-border-radius: 0.3125em;
-moz-border-radius: 0.3125em;
border-radius: 0.3125em;
-webkit-transition: background-color 0.3s ease-out, box-shadow 0.2s ease, border-color 0.2s ease;
-moz-transition: background-color 0.3s ease-out, box-shadow 0.2s ease, border-color 0.2s ease;
-o-transition: background-color 0.3s ease-out, box-shadow 0.2s ease, border-color 0.2s ease;
-ms-transition: background-color 0.3s ease-out, box-shadow 0.2s ease, border-color 0.2s ease;
transition: background-color 0.3s ease-out, box-shadow 0.2s ease, border-color 0.2s ease;
-webkit-tap-highlight-color: rgba(255, 255, 255, 0);
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
-ms-box-sizing: border-box;
box-sizing: border-box;
}
/*--------------------
Placeholder
---------------------*/
/* browsers require these rules separate */
.ui.input::-web inputkit-input-placeholder {
color: #E0E0E0;
}
.ui.input::-moz input-placeholder {
color: #E0E0E0;
}
/*******************************
States
*******************************/
/*--------------------
Active
---------------------*/
.ui.input input:active,
.ui.input.down input {
border-color: rgba(0, 0, 0, 0.3);
background-color: #FAFAFA;
}
/*--------------------
Loading
---------------------*/
.ui.loading.input > .icon {
background: url(../images/loader-mini.gif) no-repeat 50% 50%;
}
.ui.loading.input > .icon:before,
.ui.loading.input > .icon:after {
display: none;
}
/*--------------------
Focus
---------------------*/
.ui.input.focus input,
.ui.input input:focus {
border-color: rgba(0, 0, 0, 0.2);
color: rgba(0, 0, 0, 0.85);
}
.ui.input.focus input input::-webkit-input-placeholder,
.ui.input input:focus input::-webkit-input-placeholder {
color: #AAAAAA;
}
.ui.input.focus input input::-moz-placeholder,
.ui.input input:focus input::-moz-placeholder {
color: #AAAAAA;
}
/*--------------------
Error
---------------------*/
.ui.input.error input {
background-color: #FFFAFA;
border-color: #E7BEBE;
color: #D95C5C;
}
/* Error Placeholder */
.ui.input.error input ::-webkit-input-placeholder {
color: rgba(255, 80, 80, 0.4);
}
.ui.input.error input ::-moz-placeholder {
color: rgba(255, 80, 80, 0.4);
}
.ui.input.error input :focus::-webkit-input-placeholder {
color: rgba(255, 80, 80, 0.7);
}
.ui.input.error input :focus::-moz-placeholder {
color: rgba(255, 80, 80, 0.7);
}
/*******************************
Variations
*******************************/
/*--------------------
Transparent
---------------------*/
.ui.transparent.input input {
border: none;
background-color: transparent;
}
/*--------------------
Icon
---------------------*/
.ui.icon.input > .icon {
cursor: default;
position: absolute;
opacity: 0.5;
top: 0px;
right: 0px;
margin: 0em;
width: 2.6em;
height: 100%;
padding-top: 0.82em;
text-align: center;
-webkit-border-radius: 0em 0.3125em 0.3125em 0em;
-moz-border-radius: 0em 0.3125em 0.3125em 0em;
border-radius: 0em 0.3125em 0.3125em 0em;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
-ms-box-sizing: border-box;
box-sizing: border-box;
-webkit-transition: opacity 0.3s ease-out;
-moz-transition: opacity 0.3s ease-out;
-o-transition: opacity 0.3s ease-out;
-ms-transition: opacity 0.3s ease-out;
transition: opacity 0.3s ease-out;
}
.ui.icon.input > .link.icon {
cursor: pointer;
}
.ui.icon.input input {
padding-right: 3em !important;
}
.ui.icon.input > .circular.icon {
top: 0.35em;
right: 0.5em;
}
/* Left Side */
.ui.left.icon.input > .icon {
right: auto;
left: 1px;
-webkit-border-radius: 0.3125em 0em 0em 0.3125em;
-moz-border-radius: 0.3125em 0em 0em 0.3125em;
border-radius: 0.3125em 0em 0em 0.3125em;
}
.ui.left.icon.input > .circular.icon {
right: auto;
left: 0.5em;
}
.ui.left.icon.input > input {
padding-left: 3em !important;
padding-right: 1.2em !important;
}
/* Focus */
.ui.icon.input > input:focus ~ .icon {
opacity: 1;
}
/*--------------------
Labeled
---------------------*/
.ui.labeled.input .corner.label {
top: 1px;
right: 1px;
-webkit-border-top-right-radius: 0.3125em;
-moz-border-top-right-radius: 0.3125em;
border-top-right-radius: 0.3125em;
}
.ui.labeled.input input {
padding-right: 2.5em !important;
}
/* Spacing with corner label */
.ui.labeled.icon.input:not(.left) > input {
padding-right: 3.25em !important;
}
.ui.labeled.icon.input:not(.left) > .icon {
margin-right: 0.75em;
}
/*--------------------
Action
---------------------*/
.ui.action.input {
display: table;
}
.ui.action.input > input {
display: table-cell;
border-top-right-radius: 0px !important;
border-bottom-right-radius: 0px !important;
border-right: none;
}
.ui.action.input > .button {
display: table-cell;
border-top-left-radius: 0px;
border-bottom-left-radius: 0px;
-webkit-box-shadow: 0px 0px 0px 1px rgba(0, 0, 0, 0.1) inset;
-moz-box-shadow: 0px 0px 0px 1px rgba(0, 0, 0, 0.1) inset;
box-shadow: 0px 0px 0px 1px rgba(0, 0, 0, 0.1) inset;
white-space: nowrap;
}
.ui.action.input > .button > .icon {
display: inline;
}
.ui.action.input > input:focus ~ .button {
-webkit-box-shadow: 0px 0px 0px 1px rgba(0, 0, 0, 0.2) inset;
-moz-box-shadow: 0px 0px 0px 1px rgba(0, 0, 0, 0.2) inset;
box-shadow: 0px 0px 0px 1px rgba(0, 0, 0, 0.2) inset;
}
/*--------------------
Fluid
---------------------*/
.ui.fluid.input {
display: block;
}
/*--------------------
Size
---------------------*/
.ui.mini.input {
font-size: 0.8125rem;
}
.ui.tiny.input {
font-size: 0.875rem;
}
.ui.small.input {
font-size: 0.875rem;
}
.ui.input {
font-size: 1rem;
}
.ui.large.input {
font-size: 1.125rem;
}
.ui.big.input {
font-size: 1.25rem;
}
.ui.huge.input {
font-size: 1.375rem;
}
.ui.massive.input {
font-size: 1.5rem;
}
/*
* # Semantic - Label
* http://github.com/jlukic/semantic-ui/
*
*
* Copyright 2013 Contributors
* Released under the MIT license
* http://opensource.org/licenses/MIT
*
*/
/*******************************
Label
*******************************/
.ui.label {
display: inline-block;
vertical-align: middle;
margin: -0.25em 0.25em 0em;
background-color: #E8E8E8;
border-color: #E8E8E8;
padding: 0.5em 0.8em;
color: rgba(0, 0, 0, 0.65);
text-transform: uppercase;
font-weight: normal;
-webkit-border-radius: 0.325em;
-moz-border-radius: 0.325em;
border-radius: 0.325em;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
-ms-box-sizing: border-box;
box-sizing: border-box;
-webkit-transition: background 0.1s linear
;
-moz-transition: background 0.1s linear
;
-o-transition: background 0.1s linear
;
-ms-transition: background 0.1s linear
;
transition: background 0.1s linear
;
}
.ui.label:first-child {
margin-left: 0em;
}
.ui.label:last-child {
margin-right: 0em;
}
/* Link */
a.ui.label {
cursor: pointer;
}
/* Detail */
.ui.label .detail {
display: inline-block;
margin-left: 0.5em;
font-weight: bold;
opacity: 0.8;
}
/* Icon */
.ui.label .icon {
width: auto;
}
/* Removable label */
.ui.label .delete.icon {
cursor: pointer;
margin: 0em 0em 0em 0.5em;
opacity: 0.7;
-webkit-transition: background 0.1s linear
;
-moz-transition: background 0.1s linear
;
-o-transition: background 0.1s linear
;
-ms-transition: background 0.1s linear
;
transition: background 0.1s linear
;
}
.ui.label .delete.icon:hover {
opacity: 0.99;
}
/*-------------------
Coupling
--------------------*/
/* Padding on next content after a label */
.ui.segment > .attached.label:first-child + * {
margin-top: 2.5em;
}
.ui.segment > .bottom.attached.label:first-child ~ :last-child {
margin-top: 0em;
margin-bottom: 2.5em;
}
/*******************************
Types
*******************************/
.ui.image.label {
width: auto !important;
margin-top: 0em;
margin-bottom: 0em;
padding-top: 0.4em;
padding-bottom: 0.4em;
line-height: 1.5em;
vertical-align: baseline;
text-transform: none;
-webkit-box-shadow: 0px 0px 0px 1px rgba(0, 0, 0, 0.1) inset;
-moz-box-shadow: 0px 0px 0px 1px rgba(0, 0, 0, 0.1) inset;
box-shadow: 0px 0px 0px 1px rgba(0, 0, 0, 0.1) inset;
}
.ui.image.label img {
display: inline-block;
height: 2.25em;
margin: -0.4em 0.8em -0.4em -0.8em;
vertical-align: top;
-moz-border-radius: 0.325em 0em 0em 0.325em;
-webkit-border-radius: 0.325em 0em 0em 0.325em;
border-radius: 0.325em 0em 0em 0.325em;
}
/*******************************
States
*******************************/
/*-------------------
Disabled
--------------------*/
.ui.label.disabled {
opacity: 0.5;
}
/*-------------------
Hover
--------------------*/
a.ui.labels .label:hover,
a.ui.label:hover {
background-color: #E0E0E0;
border-color: #E0E0E0;
color: rgba(0, 0, 0, 0.7);
}
.ui.labels a.label:hover:before,
a.ui.label:hover:before {
background-color: #E0E0E0;
color: rgba(0, 0, 0, 0.7);
}
/*-------------------
Visible
--------------------*/
.ui.labels.visible .label,
.ui.label.visible {
display: inline-block !important;
}
/*-------------------
Hidden
--------------------*/
.ui.labels.hidden .label,
.ui.label.hidden {
display: none !important;
}
/*******************************
Variations
*******************************/
/*-------------------
Tag
--------------------*/
.ui.tag.labels .label,
.ui.tag.label {
margin-left: 1em;
position: relative;
padding: 0.33em 1.3em 0.33em 1.4em;
-webkit-border-radius: 0px 3px 3px 0px;
-moz-border-radius: 0px 3px 3px 0px;
border-radius: 0px 3px 3px 0px;
}
.ui.tag.labels .label:before,
.ui.tag.label:before {
position: absolute;
top: 0.3em;
left: 0.3em;
content: '';
margin-left: -1em;
background-image: none;
width: 1.5em;
height: 1.5em;
-webkit-transform: rotate(45deg);
-moz-transform: rotate(45deg);
transform: rotate(45deg);
-webkit-transition: background 0.1s linear
;
-moz-transition: background 0.1s linear
;
-o-transition: background 0.1s linear
;
-ms-transition: background 0.1s linear
;
transition: background 0.1s linear
;
}
.ui.tag.labels .label:after,
.ui.tag.label:after {
position: absolute;
content: '';
top: 50%;
left: -0.25em;
margin-top: -0.3em;
background-color: #FFFFFF;
width: 0.55em;
height: 0.55em;
-webkit-box-shadow: 0 -1px 1px 0 rgba(0, 0, 0, 0.3);
-moz-box-shadow: 0 -1px 1px 0 rgba(0, 0, 0, 0.3);
box-shadow: 0 -1px 1px 0 rgba(0, 0, 0, 0.3);
-moz-border-radius: 100px 100px 100px 100px;
-webkit-border-radius: 100px 100px 100px 100px;
border-radius: 100px 100px 100px 100px;
}
/*-------------------
Ribbon
--------------------*/
.ui.ribbon.label {
position: relative;
margin: 0em 0.2em;
left: -2rem;
padding-left: 2rem;
-webkit-border-radius: 0px 4px 4px 0px;
-moz-border-radius: 0px 4px 4px 0px;
border-radius: 0px 4px 4px 0px;
border-color: rgba(0, 0, 0, 0.15);
}
.ui.ribbon.label:after {
position: absolute;
content: "";
top: 100%;
left: 0%;
border-top: 0em solid transparent;
border-right-width: 1em;
border-right-color: inherit;
border-right-style: solid;
border-bottom: 1em solid transparent;
border-left: 0em solid transparent;
width: 0em;
height: 0em;
}
/*-------------------
Attached
--------------------*/
.ui.top.attached.label,
.ui.attached.label {
width: 100%;
position: absolute;
margin: 0em;
top: 0em;
left: 0em;
padding: 0.75em 1em;
-webkit-border-radius: 4px 4px 0em 0em;
-moz-border-radius: 4px 4px 0em 0em;
border-radius: 4px 4px 0em 0em;
}
.ui.bottom.attached.label {
top: auto;
bottom: 0em;
-webkit-border-radius: 0em 0em 4px 4px;
-moz-border-radius: 0em 0em 4px 4px;
border-radius: 0em 0em 4px 4px;
}
.ui.top.left.attached.label {
width: auto;
margin-top: 0em !important;
-webkit-border-radius: 4px 0em 4px 0em;
-moz-border-radius: 4px 0em 4px 0em;
border-radius: 4px 0em 4px 0em;
}
.ui.top.right.attached.label {
width: auto;
left: auto;
right: 0em;
-webkit-border-radius: 0em 4px 0em 4px;
-moz-border-radius: 0em 4px 0em 4px;
border-radius: 0em 4px 0em 4px;
}
.ui.bottom.left.attached.label {
width: auto;
top: auto;
bottom: 0em;
-webkit-border-radius: 4px 0em 0em 4px;
-moz-border-radius: 4px 0em 0em 4px;
border-radius: 4px 0em 0em 4px;
}
.ui.bottom.right.attached.label {
top: auto;
bottom: 0em;
left: auto;
right: 0em;
width: auto;
-webkit-border-radius: 4px 0em 4px 0em;
-moz-border-radius: 4px 0em 4px 0em;
border-radius: 4px 0em 4px 0em;
}
/*-------------------
Corner Label
--------------------*/
.ui.corner.label {
background-color: transparent;
position: absolute;
top: 0em;
right: 0em;
z-index: 10;
margin: 0em;
font-size: 0.8125em;
width: 2rem;
height: 2rem;
padding: 0em;
text-align: center;
-webkit-transition: color 0.2s ease;
-moz-transition: color 0.2s ease;
-o-transition: color 0.2s ease;
-ms-transition: color 0.2s ease;
transition: color 0.2s ease;
}
.ui.corner.label:after {
position: absolute;
content: "";
right: 0em;
top: 0em;
z-index: -1;
width: 0em;
height: 0em;
border-top: 0em solid transparent;
border-right: 3em solid transparent;
border-bottom: 3em solid transparent;
border-left: 0em solid transparent;
border-right-color: inherit;
-webkit-transition: border-color 0.2s ease;
-moz-transition: border-color 0.2s ease;
-o-transition: border-color 0.2s ease;
-ms-transition: border-color 0.2s ease;
transition: border-color 0.2s ease;
}
.ui.corner.label .icon {
margin: 0.4em 0em 0em 0.7em;
}
.ui.corner.label .text {
display: inline-block;
font-weight: bold;
margin: 0.5em 0em 0em 0.6em;
width: 2.5em;
font-size: 0.82em;
text-align: center;
-webkit-transform: rotate(45deg);
-moz-transform: rotate(45deg);
-o-transform: rotate(45deg);
-ms-transform: rotate(45deg);
transform: rotate(45deg);
}
/* Left Corner */
.ui.left.corner.label,
.ui.left.corner.label:after {
right: auto;
left: 0em;
}
.ui.left.corner.label:after {
border-top: 3em solid transparent;
border-right: 3em solid transparent;
border-bottom: 0em solid transparent;
border-left: 0em solid transparent;
border-top-color: inherit;
}
.ui.left.corner.label .icon {
margin: 0.4em 0em 0em -0.7em;
}
.ui.left.corner.label .text {
margin: 0.5em 0em 0em -0.6em;
-webkit-transform: rotate(-45deg);
-moz-transform: rotate(-45deg);
-o-transform: rotate(-45deg);
-ms-transform: rotate(-45deg);
transform: rotate(-45deg);
}
/* Hover */
.ui.corner.label:hover {
background-color: transparent;
}
/*-------------------
Fluid
--------------------*/
.ui.label.fluid,
.ui.fluid.labels > .label {
width: 100%;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
-ms-box-sizing: border-box;
box-sizing: border-box;
}
/*-------------------
Inverted
--------------------*/
.ui.inverted.labels .label,
.ui.inverted.label {
color: #FFFFFF !important;
}
/*-------------------
Colors
--------------------*/
/*--- Black ---*/
.ui.black.labels .label,
.ui.black.label {
background-color: #5C6166 !important;
border-color: #5C6166 !important;
color: #FFFFFF !important;
}
.ui.labels .black.label:before,
.ui.black.labels .label:before,
.ui.black.label:before {
background-color: #5C6166 !important;
}
/* Hover */
a.ui.black.labels .label:hover,
a.ui.black.label:hover {
background-color: #333333 !important;
border-color: #333333 !important;
}
.ui.labels a.black.label:hover:before,
.ui.black.labels a.label:hover:before,
a.ui.black.label:hover:before {
background-color: #333333 !important;
}
/* Corner */
.ui.black.corner.label,
.ui.black.corner.label:hover {
background-color: transparent !important;
}
/* Ribbon */
.ui.black.ribbon.label {
border-color: #333333 !important;
}
/*--- Green ---*/
.ui.green.labels .label,
.ui.green.label {
background-color: #A1CF64 !important;
border-color: #A1CF64 !important;
color: #FFFFFF !important;
}
.ui.labels .green.label:before,
.ui.green.labels .label:before,
.ui.green.label:before {
background-color: #A1CF64 !important;
}
/* Hover */
a.ui.green.labels .label:hover,
a.ui.green.label:hover {
background-color: #89B84C !important;
border-color: #89B84C !important;
}
.ui.labels a.green.label:hover:before,
.ui.green.labels a.label:hover:before,
a.ui.green.label:hover:before {
background-color: #89B84C !important;
}
/* Corner */
.ui.green.corner.label,
.ui.green.corner.label:hover {
background-color: transparent !important;
}
/* Ribbon */
.ui.green.ribbon.label {
border-color: #89B84C !important;
}
/*--- Red ---*/
.ui.red.labels .label,
.ui.red.label {
background-color: #D95C5C !important;
border-color: #D95C5C !important;
color: #FFFFFF !important;
}
.ui.labels .red.label:before,
.ui.red.labels .label:before,
.ui.red.label:before {
background-color: #D95C5C !important;
}
/* Corner */
.ui.red.corner.label,
.ui.red.corner.label:hover {
background-color: transparent !important;
}
/* Hover */
a.ui.red.labels .label:hover,
a.ui.red.label:hover {
background-color: #DE3859 !important;
border-color: #DE3859 !important;
color: #FFFFFF !important;
}
.ui.labels a.red.label:hover:before,
.ui.red.labels a.label:hover:before,
a.ui.red.label:hover:before {
background-color: #DE3859 !important;
}
/* Ribbon */
.ui.red.ribbon.label {
border-color: #DE3859 !important;
}
/*--- Blue ---*/
.ui.blue.labels .label,
.ui.blue.label {
background-color: #6ECFF5 !important;
border-color: #6ECFF5 !important;
color: #FFFFFF !important;
}
.ui.labels .blue.label:before,
.ui.blue.labels .label:before,
.ui.blue.label:before {
background-color: #6ECFF5 !important;
}
/* Hover */
a.ui.blue.labels .label:hover,
.ui.blue.labels a.label:hover,
a.ui.blue.label:hover {
background-color: #1AB8F3 !important;
border-color: #1AB8F3 !important;
color: #FFFFFF !important;
}
.ui.labels a.blue.label:hover:before,
.ui.blue.labels a.label:hover:before,
a.ui.blue.label:hover:before {
background-color: #1AB8F3 !important;
}
/* Corner */
.ui.blue.corner.label,
.ui.blue.corner.label:hover {
background-color: transparent !important;
}
/* Ribbon */
.ui.blue.ribbon.label {
border-color: #1AB8F3 !important;
}
/*--- Purple ---*/
.ui.purple.labels .label,
.ui.purple.label {
background-color: #564F8A !important;
border-color: #564F8A !important;
color: #FFFFFF !important;
}
.ui.labels .purple.label:before,
.ui.purple.labels .label:before,
.ui.purple.label:before {
background-color: #564F8A !important;
}
/* Hover */
a.ui.purple.labels .label:hover,
.ui.purple.labels a.label:hover,
a.ui.purple.label:hover {
background-color: #3E3773 !important;
border-color: #3E3773 !important;
color: #FFFFFF !important;
}
.ui.labels a.purple.label:hover:before,
.ui.purple.labels a.label:hover:before,
a.ui.purple.label:hover:before {
background-color: #3E3773 !important;
}
/* Corner */
.ui.purple.corner.label,
.ui.purple.corner.label:hover {
background-color: transparent !important;
}
/* Ribbon */
.ui.purple.ribbon.label {
border-color: #3E3773 !important;
}
/*--- Orange ---*/
.ui.orange.labels .label,
.ui.orange.label {
background-color: #F05940 !important;
border-color: #F05940 !important;
color: #FFFFFF !important;
}
.ui.labels .orange.label:before,
.ui.orange.labels .label:before,
.ui.orange.label:before {
background-color: #F05940 !important;
}
/* Hover */
a.ui.orange.labels .label:hover,
.ui.orange.labels a.label:hover,
a.ui.orange.label:hover {
background-color: #FF4121 !important;
border-color: #FF4121 !important;
color: #FFFFFF !important;
}
.ui.labels a.orange.label:hover:before,
.ui.orange.labels a.label:hover:before,
a.ui.orange.label:hover:before {
background-color: #FF4121 !important;
}
/* Corner */
.ui.orange.corner.label,
.ui.orange.corner.label:hover {
background-color: transparent !important;
}
/* Ribbon */
.ui.orange.ribbon.label {
border-color: #FF4121 !important;
}
/*--- Teal ---*/
.ui.teal.labels .label,
.ui.teal.label {
background-color: #00B5AD !important;
border-color: #00B5AD !important;
color: #FFFFFF !important;
}
.ui.labels .teal.label:before,
.ui.teal.labels .label:before,
.ui.teal.label:before {
background-color: #00B5AD !important;
}
/* Hover */
a.ui.teal.labels .label:hover,
.ui.teal.labels a.label:hover,
a.ui.teal.label:hover {
background-color: #009A93 !important;
border-color: #009A93 !important;
color: #FFFFFF !important;
}
.ui.labels a.teal.label:hover:before,
.ui.teal.labels a.label:hover:before,
a.ui.teal.label:hover:before {
background-color: #009A93 !important;
}
/* Corner */
.ui.teal.corner.label,
.ui.teal.corner.label:hover {
background-color: transparent !important;
}
/* Ribbon */
.ui.teal.ribbon.label {
border-color: #009A93 !important;
}
/*-------------------
Horizontal
--------------------*/
.ui.horizontal.labels .label,
.ui.horizontal.label {
margin: -0.125em 0.5em -0.125em 0em;
padding: 0.35em 1em;
min-width: 6em;
text-align: center;
}
/*-------------------
Circular
--------------------*/
.ui.circular.labels .label,
.ui.circular.label {
min-height: 1em;
max-height: 2em;
padding: 0.5em !important;
line-height: 1em;
text-align: center;
-webkit-border-radius: 500rem;
-moz-border-radius: 500rem;
border-radius: 500rem;
}
/*-------------------
Pointing
--------------------*/
.ui.pointing.label {
position: relative;
}
.ui.attached.pointing.label {
position: absolute;
}
.ui.pointing.label:before {
position: absolute;
content: "";
width: 0.6em;
height: 0.6em;
background-image: none;
-webkit-transform: rotate(45deg);
-moz-transform: rotate(45deg);
transform: rotate(45deg);
z-index: 2;
-webkit-transition: background 0.1s linear
;
-moz-transition: background 0.1s linear
;
-o-transition: background 0.1s linear
;
-ms-transition: background 0.1s linear
;
transition: background 0.1s linear
;
}
/*--- Above ---*/
.ui.pointing.label:before {
background-color: #E8E8E8;
}
.ui.pointing.label,
.ui.pointing.above.label {
margin-top: 1em;
}
.ui.pointing.label:before,
.ui.pointing.above.label:before {
margin-left: -0.3em;
top: -0.3em;
left: 50%;
}
/*--- Below ---*/
.ui.pointing.below.label {
margin-top: 0em;
margin-bottom: 1em;
}
.ui.pointing.below.label:before {
margin-left: -0.3em;
top: auto;
right: auto;
bottom: -0.3em;
left: 50%;
}
/*--- Left ---*/
.ui.pointing.left.label {
margin-top: 0em;
margin-left: 1em;
}
.ui.pointing.left.label:before {
margin-top: -0.3em;
bottom: auto;
right: auto;
top: 50%;
left: 0em;
}
/*--- Right ---*/
.ui.pointing.right.label {
margin-top: 0em;
margin-right: 1em;
}
.ui.pointing.right.label:before {
margin-top: -0.3em;
right: -0.3em;
top: 50%;
bottom: auto;
left: auto;
}
/*------------------
Floating Label
-------------------*/
.ui.floating.label {
position: absolute;
z-index: 100;
top: -1em;
left: 100%;
margin: 0em 0em 0em -1.5em !important;
}
/*-------------------
Sizes
--------------------*/
.ui.small.labels .label,
.ui.small.label {
font-size: 0.75rem;
}
.ui.label {
font-size: 0.8125rem;
}
.ui.large.labels .label,
.ui.large.label {
font-size: 0.875rem;
}
.ui.huge.labels .label,
.ui.huge.label {
font-size: 1rem;
}
/*
* # Semantic - Loader
* http://github.com/jlukic/semantic-ui/
*
*
* Copyright 2013 Contributors
* Released under the MIT license
* http://opensource.org/licenses/MIT
*
*/
/*******************************
Loader
*******************************/
/* Standard Size */
.ui.loader {
display: none;
position: absolute;
top: 50%;
left: 50%;
margin: 0px;
z-index: 1000;
-webkit-transform: translateX(-50%) translateY(-50%);
-moz-transform: translateX(-50%) translateY(-50%);
-o-transform: translateX(-50%) translateY(-50%);
-ms-transform: translateX(-50%) translateY(-50%);
transform: translateX(-50%) translateY(-50%);
}
.ui.dimmer .loader {
display: block;
}
/*******************************
Types
*******************************/
/*-------------------
Text
--------------------*/
.ui.text.loader {
width: auto !important;
height: auto !important;
text-align: center;
font-style: normal;
}
.ui.mini.text.loader {
min-width: 16px;
padding-top: 2em;
font-size: 0.875em;
}
.ui.small.text.loader {
min-width: 24px;
padding-top: 2.5em;
font-size: 0.875em;
}
.ui.text.loader {
min-width: 32px;
font-size: 1em;
padding-top: 3em;
}
.ui.large.text.loader {
min-width: 64px;
padding-top: 5em;
font-size: 1.2em;
}
/*******************************
States
*******************************/
.ui.loader.active,
.ui.loader.visible {
display: block;
}
.ui.loader.disabled,
.ui.loader.hidden {
display: none;
}
/*******************************
Variations
*******************************/
/*-------------------
Inverted
--------------------*/
.ui.dimmer .ui.text.loader,
.ui.inverted.text.loader {
color: rgba(255, 255, 255, 0.8);
}
.ui.inverted.dimmer .ui.text.loader {
color: rgba(0, 0, 0, 0.8);
}
/* Tiny Size */
.ui.dimmer .mini.ui.loader,
.ui.inverted .mini.ui.loader {
background-image: url(../images/loader-mini-inverted.gif);
}
/* Small Size */
.ui.dimmer .small.ui.loader,
.ui.inverted .small.ui.loader {
background-image: url(../images/loader-small-inverted.gif);
}
/* Standard Size */
.ui.dimmer .ui.loader,
.ui.inverted.loader {
background-image: url(../images/loader-medium-inverted.gif);
}
/* Large Size */
.ui.dimmer .large.ui.loader,
.ui.inverted .large.ui.loader {
background-image: url(../images/loader-large-inverted.gif);
}
/*-------------------
Sizes
--------------------*/
/* Tiny Size */
.ui.inverted.dimmer .ui.mini.loader,
.ui.mini.loader {
width: 16px;
height: 16px;
background-image: url(../images/loader-mini.gif);
}
/* Small Size */
.ui.inverted.dimmer .ui.small.loader,
.ui.small.loader {
width: 24px;
height: 24px;
background-image: url(../images/loader-small.gif);
}
.ui.inverted.dimmer .ui.loader,
.ui.loader {
width: 32px;
height: 32px;
background: url(../images/loader-medium.gif) no-repeat;
background-position: 48% 0px;
}
/* Large Size */
.ui.inverted.dimmer .ui.loader.large,
.ui.loader.large {
width: 64px;
height: 64px;
background-image: url(../images/loader-large.gif);
}
/*-------------------
Inline
--------------------*/
.ui.inline.loader {
position: static;
vertical-align: middle;
margin: 0em;
-webkit-transform: none;
-moz-transform: none;
-o-transform: none;
-ms-transform: none;
transform: none;
}
.ui.inline.loader.active,
.ui.inline.loader.visible {
display: inline-block;
}
/*
* # Semantic - Progress Bar
* http://github.com/jlukic/semantic-ui/
*
*
* Copyright 2013 Contributors
* Released under the MIT license
* http://opensource.org/licenses/MIT
*
*/
/*******************************
Progress Bar
*******************************/
.ui.progress {
border: 1px solid rgba(0, 0, 0, 0.1);
width: 100%;
height: 35px;
background-color: #FAFAFA;
padding: 5px;
-webkit-border-radius: 0.3125em;
-moz-border-radius: 0.3125em;
border-radius: 0.3125em;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
-ms-box-sizing: border-box;
box-sizing: border-box;
}
.ui.progress .bar {
display: inline-block;
height: 100%;
background-color: #CCCCCC;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
border-radius: 3px;
-webkit-transition: width 1s ease-in-out, background-color 1s ease-out;
-moz-transition: width 1s ease-in-out, background-color 1s ease-out;
-ms-transition: width 1s ease-in-out, background-color 1s ease-out;
-o-transition: width 1s ease-in-out, background-color 1s ease-out;
transition: width 1s ease-in-out, background-color 1s ease-out;
}
/*******************************
States
*******************************/
/*--------------
Successful
---------------*/
.ui.successful.progress .bar {
background-color: #73E064 !important;
}
.ui.successful.progress .bar,
.ui.successful.progress .bar::after {
-webkit-animation: none !important;
-moz-animation: none !important;
animation: none !important;
}
/*--------------
Failed
---------------*/
.ui.failed.progress .bar {
background-color: #DF9BA4 !important;
}
.ui.failed.progress .bar,
.ui.failed.progress .bar::after {
-webkit-animation: none !important;
-moz-animation: none !important;
animation: none !important;
}
/*--------------
Active
---------------*/
.ui.active.progress .bar {
position: relative;
}
.ui.active.progress .bar::after {
content: '';
opacity: 0;
position: absolute;
top: 0px;
left: 0px;
right: 0px;
bottom: 0px;
background: #FFFFFF;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
border-radius: 3px;
-webkit-animation: progress-active 2s ease-out infinite;
-moz-animation: progress-active 2s ease-out infinite;
animation: progress-active 2s ease-out infinite;
}
@-webkit-keyframes progress-active {
0% {
opacity: 0;
width: 0;
}
50% {
opacity: 0.3;
}
100% {
opacity: 0;
width: 95%;
}
}
@-moz-keyframes progress-active {
0% {
opacity: 0;
width: 0;
}
50% {
opacity: 0.3;
}
100% {
opacity: 0;
width: 100%;
}
}
@keyframes progress-active {
0% {
opacity: 0;
width: 0;
}
50% {
opacity: 0.3;
}
100% {
opacity: 0;
width: 100%;
}
}
/*--------------
Disabled
---------------*/
.ui.disabled.progress {
opacity: 0.35;
}
.ui.disabled.progress .bar,
.ui.disabled.progress .bar::after {
-webkit-animation: none !important;
-moz-animation: none !important;
animation: none !important;
}
/*******************************
Variations
*******************************/
/*--------------
Attached
---------------*/
/* bottom attached */
.ui.progress.attached {
position: relative;
border: none;
}
.ui.progress.attached,
.ui.progress.attached .bar {
display: block;
height: 3px;
padding: 0px;
overflow: hidden;
-webkit-border-radius: 0em 0em 0.3125em 0.3125em;
-moz-border-radius: 0em 0em 0.3125em 0.3125em;
border-radius: 0em 0em 0.3125em 0.3125em;
}
.ui.progress.attached .bar {
-webkit-border-radius: 0em;
-moz-border-radius: 0em;
border-radius: 0em;
}
/* top attached */
.ui.progress.top.attached,
.ui.progress.top.attached .bar {
top: -2px;
-webkit-border-radius: 0.3125em 0.3125em 0em 0em;
-moz-border-radius: 0.3125em 0.3125em 0em 0em;
border-radius: 0.3125em 0.3125em 0em 0em;
}
.ui.progress.top.attached .bar {
-webkit-border-radius: 0em;
-moz-border-radius: 0em;
border-radius: 0em;
}
/*--------------
Colors
---------------*/
.ui.blue.progress .bar {
background-color: #6ECFF5;
}
.ui.black.progress .bar {
background-color: #5C6166;
}
.ui.green.progress .bar {
background-color: #A1CF64;
}
.ui.red.progress .bar {
background-color: #EF4D6D;
}
.ui.purple.progress .bar {
background-color: #564F8A;
}
.ui.teal.progress .bar {
background-color: #00B5AD;
}
/*--------------
Striped
---------------*/
.ui.progress.striped .bar {
-webkit-background-size: 30px 30px;
-moz-background-size: 30px 30px;
background-size: 30px 30px;
background-image: -webkit-gradient(linear, left top, right bottom, color-stop(0.25, rgba(255, 255, 255, 0.15)), color-stop(0.25, transparent), color-stop(0.5, transparent), color-stop(0.5, rgba(255, 255, 255, 0.15)), color-stop(0.75, rgba(255, 255, 255, 0.15)), color-stop(0.75, transparent), to(transparent));
background-image: -webkit-linear-gradient(135deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
background-image: -moz-linear-gradient(135deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
background-image: -ms-linear-gradient(135deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
background-image: -o-linear-gradient(135deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
background-image: linear-gradient(135deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
}
.ui.progress.active.striped .bar:after {
-webkit-animation: none;
-moz-animation: none;
-ms-animation: none;
-o-animation: none;
animation: none;
}
.ui.progress.active.striped .bar {
-webkit-animation: progress-striped 3s linear infinite;
-moz-animation: progress-striped 3s linear infinite;
animation: progress-striped 3s linear infinite;
}
@-webkit-keyframes progress-striped {
0% {
background-position: 0px 0;
}
100% {
background-position: 60px 0;
}
}
@-moz-keyframes progress-striped {
0% {
background-position: 0px 0;
}
100% {
background-position: 60px 0;
}
}
@keyframes progress-striped {
0% {
background-position: 0px 0;
}
100% {
background-position: 60px 0;
}
}
/*--------------
Sizes
---------------*/
.ui.small.progress .bar {
height: 14px;
}
/*
* # Semantic - Segment
* http://github.com/jlukic/semantic-ui/
*
*
* Copyright 2013 Contributors
* Released under the MIT license
* http://opensource.org/licenses/MIT
*
*/
/*******************************
Segment
*******************************/
.ui.segment {
position: relative;
background-color: #FFFFFF;
-webkit-box-shadow: 0px 0px 0px 1px rgba(0, 0, 0, 0.1);
-moz-box-shadow: 0px 0px 0px 1px rgba(0, 0, 0, 0.1);
box-shadow: 0px 0px 0px 1px rgba(0, 0, 0, 0.1);
margin: 1em 0em;
padding: 1em;
-webkit-border-radius: 5px 5px 5px 5px;
-moz-border-radius: 5px 5px 5px 5px;
border-radius: 5px 5px 5px 5px;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
-ms-box-sizing: border-box;
box-sizing: border-box;
}
.ui.segment:first-child {
margin-top: 0em;
}
.ui.segment:last-child {
margin-bottom: 0em;
}
.ui.segment:after {
content: '';
display: block;
height: 0;
clear: both;
visibility: hidden;
}
.ui.vertical.segment {
margin: 0em;
padding-left: 0em;
padding-right: 0em;
background-color: transparent;
-webkit-border-radius: 0px;
-moz-border-radius: 0px;
border-radius: 0px;
-webkit-box-shadow: 0px 1px 0px rgba(0, 0, 0, 0.1);
-moz-box-shadow: 0px 1px 0px rgba(0, 0, 0, 0.1);
box-shadow: 0px 1px 0px rgba(0, 0, 0, 0.1);
}
.ui.vertical.segment:first-child {
padding-top: 0em;
}
.ui.horizontal.segment {
margin: 0em;
padding-top: 0em;
padding-bottom: 0em;
background-color: transparent;
-webkit-border-radius: 0px;
-moz-border-radius: 0px;
border-radius: 0px;
-webkit-box-shadow: 1px 0px 0px rgba(0, 0, 0, 0.1);
-moz-box-shadow: 1px 0px 0px rgba(0, 0, 0, 0.1);
box-shadow: 1px 0px 0px rgba(0, 0, 0, 0.1);
}
.ui.horizontal.segment:first-child {
padding-left: 0em;
}
/*-------------------
Loose Coupling
--------------------*/
.ui.pointing.menu + .ui.attached.segment {
top: 1px;
}
/* No padding on edge content */
.ui.segment > :first-child {
margin-top: 0em;
}
.ui.segment > :last-child {
margin-bottom: 0em;
}
/*******************************
Types
*******************************/
/*-------------------
Piled
--------------------*/
.ui.piled.segment {
margin: 2em 0em;
-webkit-box-shadow: 0px 0px 1px 1px rgba(0, 0, 0, 0.15);
-moz-box-shadow: 0px 0px 1px 1px rgba(0, 0, 0, 0.15);
-ms-box-shadow: 0px 0px 1px 1px rgba(0, 0, 0, 0.15);
-o-box-shadow: 0px 0px 1px 1px rgba(0, 0, 0, 0.15);
box-shadow: 0px 0px 1px 1px rgba(0, 0, 0, 0.15);
}
.ui.piled.segment:first-child {
margin-top: 0em;
}
.ui.piled.segment:last-child {
margin-bottom: 0em;
}
.ui.piled.segment:after,
.ui.piled.segment:before {
background-color: #FFFFFF;
visibility: visible;
content: "";
display: block;
height: 100%;
left: -1px;
position: absolute;
width: 100%;
-webkit-box-shadow: 0px 0px 1px 1px rgba(0, 0, 0, 0.1);
-moz-box-shadow: 0px 0px 1px 1px rgba(0, 0, 0, 0.1);
box-shadow: 0px 0px 1px 1px rgba(0, 0, 0, 0.1);
}
.ui.piled.segment:after {
-webkit-transform: rotate(1.2deg);
-moz-transform: rotate(1.2deg);
-ms-transform: rotate(1.2deg);
-o-transform: rotate(1.2deg);
transform: rotate(1.2deg);
top: 0;
z-index: -1;
}
.ui.piled.segment:before {
-webkit-transform: rotate(-1.2deg);
-moz-transform: rotate(-1.2deg);
-ms-transform: rotate(-1.2deg);
-o-transform: rotate(-1.2deg);
transform: rotate(-1.2deg);
top: 0;
z-index: -2;
}
/*-------------------
Stacked
--------------------*/
.ui.stacked.segment {
padding-bottom: 1.7em;
}
.ui.stacked.segment:after,
.ui.stacked.segment:before {
content: '';
position: absolute;
bottom: -3px;
left: 0%;
border-top: 1px solid rgba(0, 0, 0, 0.1);
background-color: rgba(0, 0, 0, 0.02);
width: 100%;
height: 5px;
visibility: visible;
}
.ui.stacked.segment:before {
bottom: 0px;
}
/* Inverted */
.ui.stacked.inverted.segment:after,
.ui.stacked.inverted.segment:before {
background-color: rgba(255, 255, 255, 0.1);
border-top: 1px solid rgba(255, 255, 255, 0.35);
}
/*-------------------
Raised
--------------------*/
.ui.raised.segment {
-webkit-box-shadow: 0px 1px 2px 1px rgba(0, 0, 0, 0.1);
-moz-box-shadow: 0px 1px 2px 1px rgba(0, 0, 0, 0.1);
box-shadow: 0px 1px 2px 1px rgba(0, 0, 0, 0.1);
}
/*******************************
States
*******************************/
.ui.disabled.segment {
opacity: 0.8;
color: #DDDDDD;
}
/*******************************
Variations
*******************************/
/*-------------------
Basic
--------------------*/
.ui.basic.segment {
position: relative;
background-color: transparent;
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
-webkit-border-radius: 0px;
-moz-border-radius: 0px;
border-radius: 0px;
}
.ui.basic.segment:first-child {
padding-top: 0em;
}
.ui.basic.segment:last-child {
padding-bottom: 0em;
}
/*-------------------
Fittted
--------------------*/
.ui.fitted.segment {
padding: 0em;
}
/*-------------------
Colors
--------------------*/
.ui.blue.segment {
border-top: 0.2em solid #6ECFF5;
}
.ui.green.segment {
border-top: 0.2em solid #A1CF64;
}
.ui.red.segment {
border-top: 0.2em solid #D95C5C;
}
.ui.orange.segment {
border-top: 0.2em solid #F05940;
}
.ui.purple.segment {
border-top: 0.2em solid #564F8A;
}
.ui.teal.segment {
border-top: 0.2em solid #00B5AD;
}
/*-------------------
Inverted Colors
--------------------*/
.ui.inverted.black.segment {
background-color: #5C6166 !important;
color: #FFFFFF !important;
}
.ui.inverted.blue.segment {
background-color: #6ECFF5 !important;
color: #FFFFFF !important;
}
.ui.inverted.green.segment {
background-color: #A1CF64 !important;
color: #FFFFFF !important;
}
.ui.inverted.red.segment {
background-color: #D95C5C !important;
color: #FFFFFF !important;
}
.ui.inverted.orange.segment {
background-color: #F05940 !important;
color: #FFFFFF !important;
}
.ui.inverted.purple.segment {
background-color: #564F8A !important;
color: #FFFFFF !important;
}
.ui.inverted.teal.segment {
background-color: #00B5AD !important;
color: #FFFFFF !important;
}
/*-------------------
Aligned
--------------------*/
.ui.left.aligned.segment {
text-align: left;
}
.ui.right.aligned.segment {
text-align: right;
}
.ui.center.aligned.segment {
text-align: center;
}
/*-------------------
Floated
--------------------*/
.ui.floated.segment,
.ui.left.floated.segment {
float: left;
}
.ui.right.floated.segment {
float: right;
}
/*-------------------
Inverted
--------------------*/
.ui.inverted.segment {
border: none;
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
}
.ui.inverted.segment,
.ui.primary.inverted.segment {
background-color: #222222;
color: #FFFFFF;
}
/*-------------------
Ordinality
--------------------*/
.ui.primary.segment {
background-color: #FFFFFF;
color: #555555;
}
.ui.secondary.segment {
background-color: #FAF9FA;
color: #777777;
}
.ui.tertiary.segment {
background-color: #EBEBEB;
color: #B0B0B0;
}
.ui.secondary.inverted.segment {
background-color: #555555;
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(rgba(255, 255, 255, 0.3)), to(rgba(255, 255, 255, 0.3)));
background-image: -webkit-linear-gradient(rgba(255, 255, 255, 0.3) 0%, rgba(255, 255, 255, 0.3) 100%);
background-image: -moz-linear-gradient(rgba(255, 255, 255, 0.3) 0%, rgba(255, 255, 255, 0.3) 100%);
background-image: -o-linear-gradient(rgba(255, 255, 255, 0.3) 0%, rgba(255, 255, 255, 0.3) 100%);
background-image: linear-gradient(rgba(255, 255, 255, 0.3) 0%, rgba(255, 255, 255, 0.3) 100%);
color: #FAFAFA;
}
.ui.tertiary.inverted.segment {
background-color: #555555;
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(rgba(255, 255, 255, 0.6)), to(rgba(255, 255, 255, 0.6)));
background-image: -webkit-linear-gradient(rgba(255, 255, 255, 0.6) 0%, rgba(255, 255, 255, 0.6) 100%);
background-image: -moz-linear-gradient(rgba(255, 255, 255, 0.6) 0%, rgba(255, 255, 255, 0.6) 100%);
background-image: -o-linear-gradient(rgba(255, 255, 255, 0.6) 0%, rgba(255, 255, 255, 0.6) 100%);
background-image: linear-gradient(rgba(255, 255, 255, 0.6) 0%, rgba(255, 255, 255, 0.6) 100%);
color: #EEEEEE;
}
/*-------------------
Attached
--------------------*/
.ui.segment.attached {
top: -1px;
bottom: -1px;
-moz-border-radius: 0px;
-webkit-border-radius: 0px;
border-radius: 0px;
margin: 0em;
-moz-box-shadow: 0px 0px 0px 1px #DDDDDD;
-webkit-box-shadow: 0px 0px 0px 1px #DDDDDD;
box-shadow: 0px 0px 0px 1px #DDDDDD;
}
.ui.top.attached.segment {
top: 0px;
bottom: -1px;
margin-top: 1em;
margin-bottom: 0em;
-moz-border-radius: 5px 5px 0px 0px;
-webkit-border-radius: 5px 5px 0px 0px;
border-radius: 5px 5px 0px 0px;
}
.ui.segment.bottom.attached {
top: -1px;
bottom: 0px;
margin-top: 0em;
margin-bottom: 1em;
-moz-border-radius: 0px 0px 5px 5px;
-webkit-border-radius: 0px 0px 5px 5px;
border-radius: 0px 0px 5px 5px;
}
/*
* # Semantic - Steps
* http://github.com/jlukic/semantic-ui/
*
*
* Copyright 2013 Contributors
* Released under the MIT license
* http://opensource.org/licenses/MIT
*
*/
/*******************************
Step
*******************************/
.ui.step,
.ui.steps .step {
display: inline-block;
position: relative;
padding: 1em 2em 1em 3em;
vertical-align: top;
background-color: #FFFFFF;
color: #888888;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
-ms-box-sizing: border-box;
box-sizing: border-box;
}
.ui.step:after,
.ui.steps .step:after {
position: absolute;
z-index: 2;
content: '';
top: 0em;
right: -1.45em;
border-bottom: 1.5em solid transparent;
border-left: 1.5em solid #FFFFFF;
border-top: 1.5em solid transparent;
width: 0em;
height: 0em;
}
.ui.step,
.ui.steps .step,
.ui.steps .step:after {
-webkit-transition: opacity 0.1s ease, color 0.1s ease, box-shadow 0.1s ease;
-moz-transition: opacity 0.1s ease, color 0.1s ease, box-shadow 0.1s ease;
-o-transition: opacity 0.1s ease, color 0.1s ease, box-shadow 0.1s ease;
-ms-transition: opacity 0.1s ease, color 0.1s ease, box-shadow 0.1s ease;
transition: opacity 0.1s ease, color 0.1s ease, box-shadow 0.1s ease;
}
/*******************************
Group
*******************************/
.ui.steps {
cursor: pointer;
display: inline-block;
font-size: 0em;
-moz-box-shadow: 0px 0px 0px 1px rgba(0, 0, 0, 0.1);
-webkit-box-shadow: 0px 0px 0px 1px rgba(0, 0, 0, 0.1);
box-shadow: 0px 0px 0px 1px rgba(0, 0, 0, 0.1);
line-height: 1;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
-ms-box-sizing: border-box;
box-sizing: border-box;
-moz-border-radius: 0.3125rem;
-webkit-border-radius: 0.3125rem;
border-radius: 0.3125rem;
}
.ui.steps .step:first-child {
padding-left: 1.35em;
-webkit-border-radius: 0.3125em 0em 0em 0.3125em;
-moz-border-radius: 0.3125em 0em 0em 0.3125em;
border-radius: 0.3125em 0em 0em 0.3125em;
}
.ui.steps .step:last-child {
-webkit-border-radius: 0em 0.3125em 0.3125em 0em;
-moz-border-radius: 0em 0.3125em 0.3125em 0em;
border-radius: 0em 0.3125em 0.3125em 0em;
}
.ui.steps .step:only-child {
-webkit-border-radius: 0.3125em;
-moz-border-radius: 0.3125em;
border-radius: 0.3125em;
}
.ui.steps .step:last-child {
margin-right: 0em;
}
.ui.steps .step:last-child:after {
display: none;
}
/*******************************
States
*******************************/
/* Hover */
.ui.step:hover,
.ui.step.hover {
background-color: #F7F7F7;
color: rgba(0, 0, 0, 0.8);
}
.ui.steps .step.hover:after,
.ui.steps .step:hover:after,
.ui.step:hover,
.ui.step.hover::after {
border-left-color: #F7F7F7;
}
/* Hover */
.ui.steps .step.down,
.ui.steps .step:active,
.ui.step.down,
.ui.step:active {
background-color: #F0F0F0;
}
.ui.steps .step.down:after,
.ui.steps .step:active:after,
.ui.steps.down::after,
.ui.steps:active::after {
border-left-color: #F0F0F0;
}
/* Active */
.ui.steps .step.active,
.ui.active.step {
cursor: auto;
background-color: #555555;
color: #FFFFFF;
font-weight: bold;
}
.ui.steps .step.active:after,
.ui.active.steps:after {
border-left-color: #555555;
}
/* Disabled */
.ui.steps .disabled.step,
.ui.disabled.step {
cursor: auto;
background-color: #FFFFFF;
color: #CBCBCB;
}
.ui.disabled.step:after {
border: none;
background-color: #FFFFFF;
top: 0.42em;
right: -1em;
width: 2.15em;
height: 2.15em;
-webkit-transform: rotate(-45deg);
-moz-transform: rotate(-45deg);
-o-transform: rotate(-45deg);
-ms-transform: rotate(-45deg);
transform: rotate(-45deg);
-webkit-box-shadow: -1px -1px 0px 0px rgba(0, 0, 0, 0.1) inset;
-moz-box-shadow: -1px -1px 0px 0px rgba(0, 0, 0, 0.1) inset;
box-shadow: -1px -1px 0px 0px rgba(0, 0, 0, 0.1) inset;
}
/*******************************
Variations
*******************************/
/* Attached */
.attached.ui.steps {
margin: 0em;
-webkit-border-radius: 0.3125em 0.3125em 0em 0em;
-moz-border-radius: 0.3125em 0.3125em 0em 0em;
border-radius: 0.3125em 0.3125em 0em 0em;
}
.attached.ui.steps .step:first-child {
-webkit-border-radius: 0.3125em 0em 0em 0em;
-moz-border-radius: 0.3125em 0em 0em 0em;
border-radius: 0.3125em 0em 0em 0em;
}
.attached.ui.steps .step:last-child {
-webkit-border-radius: 0em 0.3125em 0em 0em;
-moz-border-radius: 0em 0.3125em 0em 0em;
border-radius: 0em 0.3125em 0em 0em;
}
/* Bottom Side */
.bottom.attached.ui.steps {
margin-top: -1px;
-webkit-border-radius: 0em 0em 0.3125em 0.3125em;
-moz-border-radius: 0em 0em 0.3125em 0.3125em;
border-radius: 0em 0em 0.3125em 0.3125em;
}
.bottom.attached.ui.steps .step:first-child {
-webkit-border-radius: 0em 0em 0em 0.3125em;
-moz-border-radius: 0em 0em 0em 0.3125em;
border-radius: 0em 0em 0em 0.3125em;
}
.bottom.attached.ui.steps .step:last-child {
-webkit-border-radius: 0em 0em 0.3125em 0em;
-moz-border-radius: 0em 0em 0.3125em 0em;
border-radius: 0em 0em 0.3125em 0em;
}
/* Evenly divided */
.ui.one.steps,
.ui.two.steps,
.ui.three.steps,
.ui.four.steps,
.ui.five.steps,
.ui.six.steps,
.ui.seven.steps,
.ui.eight.steps {
display: block;
}
.ui.one.steps > .step {
width: 100%;
}
.ui.two.steps > .step {
width: 50%;
}
.ui.three.steps > .step {
width: 33.333%;
}
.ui.four.steps > .step {
width: 25%;
}
.ui.five.steps > .step {
width: 20%;
}
.ui.six.steps > .step {
width: 16.666%;
}
.ui.seven.steps > .step {
width: 14.285%;
}
.ui.eight.steps > .step {
width: 12.500%;
}
/*******************************
Sizes
*******************************/
.ui.small.step,
.ui.small.steps .step {
font-size: 0.8rem;
}
.ui.step,
.ui.steps .step {
font-size: 1rem;
}
.ui.large.step,
.ui.large.steps .step {
font-size: 1.25rem;
}
/*
* # Semantic - Accordion
* http://github.com/jlukic/semantic-ui/
*
*
* Copyright 2013 Contributors
* Released under the MIT license
* http://opensource.org/licenses/MIT
*
*/
/*******************************
Accordion
*******************************/
.ui.accordion {
width: 600px;
max-width: 100%;
overflow: hidden;
font-size: 1rem;
border-radius: 0.3125em;
background-color: #FFFFFF;
-webkit-box-shadow: 0px 0px 0px 1px rgba(0, 0, 0, 0.1);
-moz-box-shadow: 0px 0px 0px 1px rgba(0, 0, 0, 0.1);
box-shadow: 0px 0px 0px 1px rgba(0, 0, 0, 0.1);
}
.ui.accordion .title {
cursor: pointer;
margin: 0em;
padding: 0.75em 1em;
color: rgba(0, 0, 0, 0.6);
border-top: 1px solid rgba(0, 0, 0, 0.05);
-webkit-transition: background-color 0.2s ease-out;
-moz-transition: background-color 0.2s ease-out;
-o-transition: background-color 0.2s ease-out;
-ms-transition: background-color 0.2s ease-out;
transition: background-color 0.2s ease-out;
}
.ui.accordion .title:first-child {
border-top: none;
}
/* Content */
.ui.accordion .content {
display: none;
margin: 0em;
padding: 1.3em 1em;
}
/* Arrow */
.ui.accordion .title .dropdown.icon {
display: inline-block;
float: none;
margin: 0em 0.5em 0em 0em;
-webkit-transition: -webkit-transform 0.2s ease, opacity 0.2s ease;
-moz-transition: -moz-transform 0.2s ease, opacity 0.2s ease;
-o-transition: -o-transform 0.2s ease, opacity 0.2s ease;
-ms-transition: -ms-transform 0.2s ease, opacity 0.2s ease;
transition: transform 0.2s ease,
opacity 0.2s ease
;
-webkit-transform: rotate(0deg);
-moz-transform: rotate(0deg);
-o-transform: rotate(0deg);
-ms-transform: rotate(0deg);
transform: rotate(0deg);
}
.ui.accordion .title .dropdown.icon:before {
content: '\f0da';
}
/*--------------
Loose Coupling
---------------*/
.ui.basic.accordion.menu {
background-color: #FFFFFF;
-webkit-box-shadow: 0px 0px 0px 1px rgba(0, 0, 0, 0.1);
-moz-box-shadow: 0px 0px 0px 1px rgba(0, 0, 0, 0.1);
box-shadow: 0px 0px 0px 1px rgba(0, 0, 0, 0.1);
}
.ui.basic.accordion.menu .title,
.ui.basic.accordion.menu .content {
padding: 0em;
}
/*******************************
Types
*******************************/
/*--------------
Basic
---------------*/
.ui.basic.accordion {
background-color: transparent;
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
}
.ui.basic.accordion .title,
.ui.basic.accordion .title {
background-color: transparent;
border-top: none;
padding-left: 0em;
padding-right: 0em;
}
.ui.basic.accordion .content {
padding: 0.5em 0em;
}
.ui.basic.accordion .active.title {
background-color: transparent;
}
/*******************************
States
*******************************/
/*--------------
Hover
---------------*/
.ui.accordion .title:hover,
.ui.accordion .active.title {
color: rgba(0, 0, 0, 0.8);
}
/*--------------
Active
---------------*/
.ui.accordion .active.title {
background-color: rgba(0, 0, 0, 0.1);
color: rgba(0, 0, 0, 0.8);
}
.ui.accordion .active.title .dropdown.icon {
-webkit-transform: rotate(90deg);
-moz-transform: rotate(90deg);
-o-transform: rotate(90deg);
-ms-transform: rotate(90deg);
transform: rotate(90deg);
}
.ui.accordion .active.content {
display: block;
}
/*******************************
Variations
*******************************/
/*--------------
Fluid
---------------*/
.ui.fluid.accordion {
width: 100%;
}
/*
* # Semantic - Chat Room
* http://github.com/jlukic/semantic-ui/
*
*
* Copyright 2013 Contributors
* Released under the MIT license
* http://opensource.org/licenses/MIT
*
*/
/*******************************
Chat Room
*******************************/
.ui.chatroom {
background-color: #F8F8F8;
width: 330px;
height: 370px;
padding: 0px;
}
.ui.chatroom .room {
position: relative;
background-color: #FFFFFF;
overflow: hidden;
height: 286px;
border: 1px solid rgba(0, 0, 0, 0.1);
border-top: none;
border-bottom: none;
}
.ui.chatroom .room .loader {
display: none;
margin: -25px 0px 0px -25px;
}
/* Chat Room Actions */
.ui.chatroom .actions {
overflow: hidden;
background-color: #EEEEEE;
padding: 4px;
border: 1px solid rgba(0, 0, 0, 0.1);
-moz-border-radius: 5px 5px 0px 0px;
-webkit-border-radius: 5px 5px 0px 0px;
border-radius: 5px 5px 0px 0px;
}
.ui.chatroom .actions .button {
float: right;
margin-left: 3px;
}
/* Online User Count */
.ui.chatroom .actions .message {
float: left;
margin-left: 6px;
font-size: 11px;
color: #AAAAAA;
text-shadow: 0px -1px 0px rgba(255, 255, 255, 0.8);
line-height: 28px;
}
.ui.chatroom .actions .message .loader {
display: inline-block;
margin-right: 8px;
}
/* Chat Room Text Log */
.ui.chatroom .log {
float: left;
overflow: auto;
overflow-x: hidden;
overflow-y: auto;
}
.ui.chatroom .log .message {
padding: 3px 0px;
border-top: 1px dotted #DADADA;
}
.ui.chatroom .log .message:first-child {
border-top: none;
}
/* status event */
.ui.chatroom .status {
padding: 5px 0px;
color: #AAAAAA;
font-size: 12px;
font-style: italic;
line-height: 1.33;
border-top: 1px dotted #DADADA;
}
.ui.chatroom .log .status:first-child {
border-top: none;
}
.ui.chatroom .log .flag {
float: left;
}
.ui.chatroom .log p {
margin-left: 0px;
}
.ui.chatroom .log .author {
font-weight: bold;
-webkit-transition: color 0.3s ease-out;
-moz-transition: color 0.3s ease-out;
-o-transition: color 0.3s ease-out;
-ms-transition: color 0.3s ease-out;
transition: color 0.3s ease-out;
}
.ui.chatroom .log a.author:hover {
opacity: 0.8;
}
.ui.chatroom .log .message.admin p {
font-weight: bold;
margin: 1px 0px 0px 23px;
}
.ui.chatroom .log .divider {
margin: -1px 0px;
font-size: 11px;
padding: 10px 0px;
border-top: 1px solid #F8F8F8;
border-bottom: 1px solid #F8F8F8;
}
.ui.chatroom .log .divider .rule {
top: 50%;
width: 15%;
}
.ui.chatroom .log .divider .label {
color: #777777;
margin: 0px;
}
/* Chat Room User List */
.ui.chatroom .room .list {
position: relative;
overflow: auto;
overflow-x: hidden;
overflow-y: auto;
float: left;
background-color: #EEEEEE;
border-left: 1px solid #DDDDDD;
}
.ui.chatroom .room .list .user {
display: table;
padding: 3px 7px;
border-bottom: 1px solid #DDDDDD;
}
.ui.chatroom .room .list .user:hover {
background-color: #F8F8F8;
}
.ui.chatroom .room .list .image {
display: table-cell;
vertical-align: middle;
width: 20px;
}
.ui.chatroom .room .list .image img {
width: 20px;
height: 20px;
vertical-align: middle;
}
.ui.chatroom .room .list p {
display: table-cell;
vertical-align: middle;
padding-left: 7px;
padding-right: 14px;
font-size: 11px;
line-height: 1.2;
font-weight: bold;
}
.ui.chatroom .room .list a:hover {
opacity: 0.8;
}
/* User List Loading */
.ui.chatroom.loading .loader {
display: block;
}
/* Chat Room Talk Input */
.ui.chatroom .talk {
border: 1px solid rgba(0, 0, 0, 0.1);
padding: 5px 0px 0px;
background-color: #EEEEEE;
-webkit-border-radius: 0px 0px 5px 5px;
-moz-border-radius: 0px 0px 5px 5px;
border-radius: 0px 0px 5px 5px;
}
.ui.chatroom .talk .avatar,
.ui.chatroom .talk input,
.ui.chatroom .talk .button {
float: left;
}
.ui.chatroom .talk .avatar img {
display: block;
width: 30px;
height: 30px;
margin-right: 4px;
border-radius: 500rem;
}
.ui.chatroom .talk input {
border: 1px solid #CCCCCC;
margin: 0px;
width: 196px;
height: 14px;
padding: 8px 5px;
font-size: 12px;
color: #555555;
}
.ui.chatroom .talk input.focus {
border: 1px solid #AAAAAA;
}
.ui.chatroom .send {
width: 80px;
height: 32px;
margin-left: -1px;
padding: 4px 12px;
font-size: 12px;
line-height: 23px;
-webkit-box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1) inset;
-moz-box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1) inset;
box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1) inset;
border-radius: 0 5px 5px 0;
}
.ui.chatroom .talk .log-in.button {
display: block;
float: none;
margin-top: -6px;
height: 22px;
border-radius: 0px 0px 4px 4px;
}
.ui.chatroom .talk .log-in.button i {
vertical-align: text-top;
}
/* Quirky Flags */
.ui.chatroom .log .team.flag {
width: 18px;
}
/* Chat room Loaded */
.ui.chatroom.loading .loader {
display: block;
}
/* Standard Size */
.ui.chatroom {
width: 330px;
height: 370px;
}
.ui.chatroom .room .container {
width: 3000px;
}
.ui.chatroom .log {
width: 314px;
height: 278px;
padding: 4px 7px;
}
.ui.chatroom .room .list {
width: 124px;
height: 278px;
padding: 4px 0px;
}
.ui.chatroom .room .list .user {
width: 110px;
}
.ui.chatroom .talk {
height: 40px;
}
/*
* # Semantic - Checkbox
* http://github.com/jlukic/semantic-ui/
*
*
* Copyright 2013 Contributors
* Released under the MIT license
* http://opensource.org/licenses/MIT
*
*/
/*******************************
Checkbox
*******************************/
/*--------------
Standard
---------------*/
/*--- Content ---*/
.ui.checkbox {
position: relative;
display: inline-block;
min-width: 1em;
height: 1.25em;
line-height: 1em;
outline: none;
vertical-align: middle;
}
.ui.checkbox input {
position: absolute;
top: 0px;
left: 0px;
opacity: 0;
outline: none;
}
/*--- Box ---*/
.ui.checkbox .box,
.ui.checkbox label {
cursor: pointer;
padding-left: 2em;
outline: none;
}
.ui.checkbox .box:before,
.ui.checkbox label:before {
position: absolute;
top: 0em;
line-height: 1;
width: 1em;
height: 1em;
left: 0em;
content: '';
border-radius: 4px;
background: #FFFFFF;
-webkit-transition: background-color 0.3s ease, box-shadow 0.3s ease;
-moz-transition: background-color 0.3s ease, box-shadow 0.3s ease;
-o-transition: background-color 0.3s ease, box-shadow 0.3s ease;
-ms-transition: background-color 0.3s ease, box-shadow 0.3s ease;
transition: background-color 0.3s ease, box-shadow 0.3s ease;
-webkit-box-shadow: 0em 0em 0em 1px rgba(0, 0, 0, 0.2);
-moz-box-shadow: 0em 0em 0em 1px rgba(0, 0, 0, 0.2);
box-shadow: 0em 0em 0em 1px rgba(0, 0, 0, 0.2);
}
/*--- Checkbox ---*/
.ui.checkbox .box:after,
.ui.checkbox label:after {
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
filter: alpha(opacity=0);
opacity: 0;
content: '';
position: absolute;
background: transparent;
border: 0.2em solid #333333;
border-top: none;
border-right: none;
-webkit-transform: rotate(-45deg);
-moz-transform: rotate(-45deg);
-o-transform: rotate(-45deg);
-ms-transform: rotate(-45deg);
transform: rotate(-45deg);
}
.ui.checkbox .box:after,
.ui.checkbox label:after {
top: 0.275em;
left: 0.2em;
width: 0.45em;
height: 0.15em;
}
/*--- Inside Label ---*/
.ui.checkbox label {
color: rgba(0, 0, 0, 0.6);
-webkit-transition: color 0.2s ease;
-moz-transition: color 0.2s ease;
-o-transition: color 0.2s ease;
-ms-transition: color 0.2s ease;
transition: color 0.2s ease;
}
.ui.checkbox label:hover {
color: rgba(0, 0, 0, 0.8);
}
.ui.checkbox input:focus + label {
color: rgba(0, 0, 0, 0.8);
}
/*--- Outside Label ---*/
.ui.checkbox + label {
cursor: pointer;
opacity: 0.85;
vertical-align: middle;
}
.ui.checkbox + label:hover {
opacity: 1;
}
/*******************************
States
*******************************/
/*--- Hover ---*/
.ui.checkbox .box:hover::before,
.ui.checkbox label:hover::before {
-webkit-box-shadow: 0em 0em 0em 1px rgba(0, 0, 0, 0.3);
-moz-box-shadow: 0em 0em 0em 1px rgba(0, 0, 0, 0.3);
box-shadow: 0em 0em 0em 1px rgba(0, 0, 0, 0.3);
}
/*--- Down ---*/
.ui.checkbox .box:active::before,
.ui.checkbox label:active::before {
background-color: #F5F5F5;
}
/*--- Focus ---*/
.ui.checkbox input:focus + .box:before,
.ui.checkbox input:focus + label:before {
-webkit-box-shadow: 0em 0em 0em 1px rgba(0, 0, 0, 0.3);
-moz-box-shadow: 0em 0em 0em 1px rgba(0, 0, 0, 0.3);
box-shadow: 0em 0em 0em 1px rgba(0, 0, 0, 0.3);
}
/*--- Active ---*/
.ui.checkbox input:checked + .box:after,
.ui.checkbox input:checked + label:after {
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)";
filter: alpha(opacity=100);
opacity: 1;
}
/*--- Disabled ---*/
.ui.disabled.checkbox + .box:after,
.ui.checkbox input[disabled] + .box:after,
.ui.disabled.checkbox label,
.ui.checkbox input[disabled] + label {
opacity: 0.4;
color: rgba(0, 0, 0, 0.3);
}
/*******************************
Variations
*******************************/
/*--------------
Radio
---------------*/
.ui.radio.checkbox .box:before,
.ui.radio.checkbox label:before {
min-width: 1em;
height: 1em;
-webkit-border-radius: 500px;
-moz-border-radius: 500px;
border-radius: 500px;
}
.ui.radio.checkbox .box:after,
.ui.radio.checkbox label:after {
border: none;
top: 0.2em;
left: 0.2em;
width: 0.6em;
height: 0.6em;
background-color: #555555;
transform: none;
-webkit-border-radius: 500px;
-moz-border-radius: 500px;
border-radius: 500px;
}
/*--------------
Slider
---------------*/
.ui.slider.checkbox {
cursor: pointer;
min-width: 3em;
}
/* Line */
.ui.slider.checkbox:after {
position: absolute;
top: 0.5em;
left: 0em;
content: '';
width: 3em;
height: 2px;
background-color: rgba(0, 0, 0, 0.1);
}
/* Button */
.ui.slider.checkbox .box,
.ui.slider.checkbox label {
padding-left: 4em;
}
.ui.slider.checkbox .box:before,
.ui.slider.checkbox label:before {
cursor: pointer;
display: block;
position: absolute;
top: -0.25em;
left: 0em;
z-index: 1;
width: 1.5em;
height: 1.5em;
-webkit-box-shadow: 0px 0px 0px 1px rgba(0, 0, 0, 0.1) inset;
-moz-box-shadow: 0px 0px 0px 1px rgba(0, 0, 0, 0.1) inset;
box-shadow: 0px 0px 0px 1px rgba(0, 0, 0, 0.1) inset;
border-radius: 50rem;
-webkit-transition: left 0.3s ease 0s;
-moz-transition: left 0.3s ease 0s;
-o-transition: left 0.3s ease 0s;
-ms-transition: left 0.3s ease 0s;
transition: left 0.3s ease 0s;
}
/* Button Activation Light */
.ui.slider.checkbox .box:after,
.ui.slider.checkbox label:after {
opacity: 1;
position: absolute;
content: '';
top: 0.15em;
left: 0em;
z-index: 2;
margin-left: 0.375em;
border: none;
width: 0.75em;
height: 0.75em;
border-radius: 50rem;
transform: none;
-webkit-transition: background 0.3s ease 0s,
left 0.3s ease 0s
;
-moz-transition: background 0.3s ease 0s,
left 0.3s ease 0s
;
-o-transition: background 0.3s ease 0s,
left 0.3s ease 0s
;
-ms-transition: background 0.3s ease 0s,
left 0.3s ease 0s
;
transition: background 0.3s ease 0s,
left 0.3s ease 0s
;
}
/* Selected Slider Toggle */
.ui.slider.checkbox input:checked + .box:before,
.ui.slider.checkbox input:checked + label:before,
.ui.slider.checkbox input:checked + .box:after,
.ui.slider.checkbox input:checked + label:after {
left: 1.75em;
}
/* Off Color */
.ui.slider.checkbox .box:after,
.ui.slider.checkbox label:after {
background-color: #D95C5C;
}
/* On Color */
.ui.slider.checkbox input:checked + .box:after,
.ui.slider.checkbox input:checked + label:after {
background-color: #89B84C;
}
/*--------------
Toggle
---------------*/
.ui.toggle.checkbox {
cursor: pointer;
}
.ui.toggle.checkbox .box,
.ui.toggle.checkbox label {
padding-left: 4em;
}
/* Switch */
.ui.toggle.checkbox .box:before,
.ui.toggle.checkbox label:before {
cursor: pointer;
display: block;
position: absolute;
content: '';
top: -0.25em;
left: 0em;
z-index: 1;
background-color: #FFFFFF;
width: 3em;
height: 1.5em;
-webkit-box-shadow: 0px 0px 0px 1px rgba(0, 0, 0, 0.1) inset;
-moz-box-shadow: 0px 0px 0px 1px rgba(0, 0, 0, 0.1) inset;
box-shadow: 0px 0px 0px 1px rgba(0, 0, 0, 0.1) inset;
border-radius: 50rem;
}
/* Activation Light */
.ui.toggle.checkbox .box:after,
.ui.toggle.checkbox label:after {
opacity: 1;
background-color: transparent;
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
content: '';
position: absolute;
top: 0.15em;
left: 0.5em;
z-index: 2;
border: none;
width: 0.75em;
height: 0.75em;
background-color: #D95C5C;
border-radius: 50rem;
-webkit-transition: background 0.3s ease 0s,
left 0.3s ease 0s
;
-moz-transition: background 0.3s ease 0s,
left 0.3s ease 0s
;
-o-transition: background 0.3s ease 0s,
left 0.3s ease 0s
;
-ms-transition: background 0.3s ease 0s,
left 0.3s ease 0s
;
transition: background 0.3s ease 0s,
left 0.3s ease 0s
;
}
/* Active */
.ui.toggle.checkbox:active .box:before,
.ui.toggle.checkbox:active label:before {
background-color: #F5F5F5;
}
/* Active */
.ui.toggle.checkbox input:checked + .box:after,
.ui.toggle.checkbox input:checked + label:after {
left: 1.75em;
background-color: #89B84C;
}
/*--------------
Sizes
---------------*/
.ui.checkbox {
font-size: 1em;
}
.ui.large.checkbox {
font-size: 1.25em;
}
.ui.huge.checkbox {
font-size: 1.5em;
}
/*
* # Semantic - Dimmer
* http://github.com/jlukic/semantic-ui/
*
*
* Copyright 2013 Contributors
* Released under the MIT license
* http://opensource.org/licenses/MIT
*
*/
/*******************************
Dimmer
*******************************/
.ui.dimmable {
position: relative;
}
.ui.dimmer {
display: none;
position: absolute;
top: 0em !important;
left: 0em !important;
width: 0%;
height: 0%;
text-align: center;
vertical-align: middle;
background-color: rgba(0, 0, 0, 0.85);
opacity: 0;
line-height: 1;
-webkit-animation-fill-mode: both;
-moz-animation-fill-mode: both;
-o-animation-fill-mode: both;
-ms-animation-fill-mode: both;
animation-fill-mode: both;
-webkit-animation-duration: 0.5s;
-moz-animation-duration: 0.5s;
-o-animation-duration: 0.5s;
-ms-animation-duration: 0.5s;
animation-duration: 0.5s;
-webkit-transition: background-color 0.5s linear;
-moz-transition: background-color 0.5s linear;
-o-transition: background-color 0.5s linear;
-ms-transition: background-color 0.5s linear;
transition: background-color 0.5s linear;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
-ms-box-sizing: border-box;
box-sizing: border-box;
z-index: 1000;
}
/* Dimmer Content */.ui.dimmer > .content {
width: 100%;
height: 100%;
display: table;
-webkit-user-select: text;
-moz-user-select: text;
-ms-user-select: text;
user-select: text;
}
.ui.dimmer > .content > div {
display: table-cell;
vertical-align: middle;
color: #FFFFFF;
}
/* Loose Coupling */
.ui.segment > .ui.dimmer {
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
}
.ui.horizontal.segment > .ui.dimmer,
.ui.vertical.segment > .ui.dimmer {
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
}
/*******************************
States
*******************************/
.ui.dimmed.dimmable:not(body) {
overflow: hidden;
}
.ui.dimmed.dimmable > .ui.dimmer,
.ui.active.dimmer {
display: block;
width: 100%;
height: 100%;
opacity: 1;
}
.ui.disabled.dimmer {
width: 0em !important;
height: 0em !important;
}
/*******************************
Variations
*******************************/
/*--------------
Page
---------------*/
.ui.page.dimmer {
position: fixed;
-webkit-transform-style: preserve-3d;
-moz-transform-style: preserve-3d;
-ms-transform-style: preserve-3d;
transform-style: preserve-3d;
-webkit-perspective: 2000px;
-moz-perspective: 2000px;
perspective: 2000px;
-webkit-transform-origin: center center;
-moz-transform-origin: center center;
-o-transform-origin: center center;
-ms-transform-origin: center center;
transform-origin: center center;
}
.ui.scrolling.page.dimmer {
position: absolute;
}
/*
body.ui.dimmed.dimmable > :not(.dimmer){
-webkit-filter: ~"blur(15px) grayscale(0.7)";
-moz-filter: ~"blur(15px) grayscale(0.7)";
}
*/
/*--------------
Aligned
---------------*/
.ui.dimmer > .top.aligned.content > * {
vertical-align: top;
}
.ui.dimmer > .bottom.aligned.content > * {
vertical-align: bottom;
}
/*--------------
Inverted
---------------*/
.ui.inverted.dimmer {
background-color: rgba(255, 255, 255, 0.85);
}
.ui.inverted.dimmer > .content > * {
color: rgba(0, 0, 0, 0.8);
}
/*--------------
Simple
---------------*/
/* Displays without javascript */
.ui.simple.dimmer {
display: block;
overflow: hidden;
opacity: 1;
z-index: -100;
background-color: rgba(0, 0, 0, 0);
}
.ui.dimmed.dimmable > .ui.simple.dimmer {
overflow: visible;
opacity: 1;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.85);
z-index: 1;
}
.ui.simple.inverted.dimmer {
background-color: rgba(255, 255, 255, 0);
}
.ui.dimmed.dimmable > .ui.simple.inverted.dimmer {
background-color: rgba(255, 255, 255, 0.85);
}
/*
* # Semantic - Dropdown
* http://github.com/jlukic/semantic-ui/
*
*
* Copyright 2013 Contributors
* Released under the MIT license
* http://opensource.org/licenses/MIT
*
*/
/*******************************
Dropdown
*******************************/
.ui.dropdown {
position: relative;
display: inline-block;
line-height: 1;
-webkit-transition: border-radius 0.1s ease, width 0.2s ease;
-moz-transition: border-radius 0.1s ease, width 0.2s ease;
-o-transition: border-radius 0.1s ease, width 0.2s ease;
-ms-transition: border-radius 0.1s ease, width 0.2s ease;
transition: border-radius 0.1s ease, width 0.2s ease;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
-moz-tap-highlight-color: rgba(0, 0, 0, 0);
tap-highlight-color: rgba(0, 0, 0, 0);
}
/*******************************
Content
*******************************/
/*--------------
Menu
---------------*/
.ui.dropdown .menu {
position: absolute;
display: none;
top: 100%;
margin: 0em;
background-color: #FFFFFF;
min-width: 100%;
white-space: nowrap;
font-size: 0.875em;
text-shadow: none;
-webkit-box-shadow: 0px 0px 1px 1px rgba(0, 0, 0, 0.1);
-moz-box-shadow: 0px 0px 1px 1px rgba(0, 0, 0, 0.1);
box-shadow: 0px 0px 1px 1px rgba(0, 0, 0, 0.1);
-moz-border-radius: 0px 0px 0.325em 0.325em;
-webkit-border-radius: 0px 0px 0.325em 0.325em;
border-radius: 0px 0px 0.325em 0.325em;
-webkit-transition: opacity 0.2s ease;
-moz-transition: opacity 0.2s ease;
-o-transition: opacity 0.2s ease;
-ms-transition: opacity 0.2s ease;
transition: opacity 0.2s ease;
z-index: 11;
}
/*--------------
Icon
---------------*/
.ui.dropdown > .dropdown.icon {
float: right;
width: auto;
margin: 0em 0em 0em 1em;
}
.ui.dropdown > .dropdown.icon:before {
content: "\f0d7";
}
.ui.dropdown .menu .item .dropdown.icon {
width: auto;
float: right;
margin: 0em 0em 0em 0.5em;
}
.ui.dropdown .menu .item .dropdown.icon:before {
content: "\f0da";
}
/*--------------
Text
---------------*/
.ui.dropdown > .text {
cursor: pointer;
display: inline-block;
-webkit-transition: color 0.2s ease;
-moz-transition: color 0.2s ease;
-o-transition: color 0.2s ease;
-ms-transition: color 0.2s ease;
transition: color 0.2s ease;
}
/* Flyout Direction */
.ui.dropdown .menu {
left: 0px;
}
/*--------------
Sub Menu
---------------*/
.ui.dropdown .menu .menu {
top: 0% !important;
left: 100% !important;
margin: 0em !important;
border-radius: 0 0.325em 0.325em 0em !important;
}
.ui.dropdown .menu .menu:after {
display: none;
}
.ui.dropdown .menu .item {
cursor: pointer;
border: none;
border-top: 1px solid rgba(0, 0, 0, 0.05);
height: auto;
font-size: 0.875em;
display: block;
color: rgba(0, 0, 0, 0.75);
padding: 0.85em 1em !important;
font-size: 0.875rem;
text-transform: none;
font-weight: normal;
text-align: left;
-webkit-touch-callout: none;
}
.ui.dropdown .menu .item:before {
display: none;
}
.ui.dropdown .menu .item .icon {
margin-right: 0.75em;
}
.ui.dropdown .menu .item:first-child {
border-top: none;
}
/*******************************
Coupling
*******************************/
/* Opposite on last menu on right */
.ui.menu .right.menu .dropdown:last-child .menu,
.ui.buttons > .ui.dropdown:last-child .menu {
left: auto;
right: 0px;
}
.ui.vertical.menu .dropdown.item > .dropdown.icon {
content: "\f0da";
}
.ui.dropdown.icon.button > .dropdown.icon {
margin: 0em;
}
/*******************************
States
*******************************/
/* Dropdown Visible */
.ui.visible.dropdown {
border-bottom-left-radius: 0em !important;
border-bottom-right-radius: 0em !important;
}
.ui.visible.dropdown > .menu {
display: block;
}
/* Menu Item Hover */
.ui.dropdown .menu .item:hover {
background-color: rgba(0, 0, 0, 0.02);
z-index: 12;
}
/* Menu Item Active */
.ui.dropdown .menu .active.item {
background-color: rgba(0, 0, 0, 0.06) !important;
border-left: none;
border-color: transparent !important;
-webkit-box-shadow: none;
-moz-shadow: none;
box-shadow: none;
z-index: 12;
}
/* Default Text */
.ui.dropdown > .default.text,
.ui.default.dropdown > .text {
color: rgba(0, 0, 0, 0.5);
}
.ui.dropdown:hover > .default.text,
.ui.default.dropdown:hover > .text {
color: rgba(0, 0, 0, 0.8);
}
/*******************************
Variations
*******************************/
/*--------------
Simple
---------------*/
/* Displays without javascript */
.ui.simple.dropdown .menu:before,
.ui.simple.dropdown .menu:after {
display: none;
}
.ui.simple.dropdown .menu {
display: block;
overflow: hidden;
top: -9999px !important;
position: absolute;
opacity: 0;
width: 0;
height: 0;
-webkit-transition: opacity 0.2s ease-out;
-moz-transition: opacity 0.2s ease-out;
-o-transition: opacity 0.2s ease-out;
-ms-transition: opacity 0.2s ease-out;
transition: opacity 0.2s ease-out;
}
.ui.simple.active.dropdown,
.ui.simple.dropdown:hover {
border-bottom-left-radius: 0em !important;
border-bottom-right-radius: 0em !important;
}
.ui.simple.active.dropdown > .menu,
.ui.simple.dropdown:hover > .menu {
overflow: visible;
width: auto;
height: auto;
top: 100% !important;
opacity: 1;
}
.ui.simple.dropdown > .menu .item:active > .menu,
.ui.simple.dropdown:hover > .menu .item:hover > .menu {
overflow: visible;
width: auto;
height: auto;
top: 0% !important;
left: 100% !important;
opacity: 1;
}
.ui.simple.disabled.dropdown:hover .menu {
display: none;
height: 0px;
width: 0px;
overflow: hidden;
}
/*--------------
Selection
---------------*/
/* Displays like a select box */
.ui.selection.dropdown {
cursor: pointer;
display: inline-block;
word-wrap: break-word;
white-space: normal;
background-color: #FFFFFF;
padding: 0.5em 1em;
line-height: 1.33;
color: rgba(0, 0, 0, 0.8);
-webkit-box-shadow: 0px 0px 0px 1px rgba(0, 0, 0, 0.1);
-moz-box-shadow: 0px 0px 0px 1px rgba(0, 0, 0, 0.1);
box-shadow: 0px 0px 0px 1px rgba(0, 0, 0, 0.1);
-webkit-border-radius: 0.3125em !important;
-moz-border-radius: 0.3125em !important;
border-radius: 0.3125em !important;
}
.ui.selection.dropdown select {
display: none;
}
.ui.selection.dropdown > .dropdown.icon {
opacity: 0.7;
margin: 0.2em 0em 0.2em 1.25em;
-webkit-transition: opacity 0.2s ease-out;
-moz-transition: opacity 0.2s ease-out;
-o-transition: opacity 0.2s ease-out;
-ms-transition: opacity 0.2s ease-out;
transition: opacity 0.2s ease-out;
}
.ui.selection.dropdown,
.ui.selection.dropdown .menu {
top: 100%;
-webkit-transition: box-shadow 0.2s ease-out;
-moz-transition: box-shadow 0.2s ease-out;
-o-transition: box-shadow 0.2s ease-out;
-ms-transition: box-shadow 0.2s ease-out;
transition: box-shadow 0.2s ease-out;
}
.ui.selection.dropdown .menu {
max-height: 312px;
overflow-x: hidden;
overflow-y: auto;
-webkit-box-shadow: 0px 1px 0px 1px #E0E0E0;
-moz-box-shadow: 0px 1px 0px 1px #E0E0E0;
box-shadow: 0px 1px 0px 1px #E0E0E0;
-moz-border-radius: 0px 0px 0.325em 0.325em;
-webkit-border-radius: 0px 0px 0.325em 0.325em;
border-radius: 0px 0px 0.325em 0.325em;
}
.ui.selection.dropdown .menu:after,
.ui.selection.dropdown .menu:before {
display: none;
}
.ui.selection.dropdown .menu img {
height: 2.5em;
display: inline-block;
vertical-align: middle;
margin-right: 0.5em;
}
/* Hover */
.ui.selection.dropdown:hover {
-webkit-box-shadow: 0px 0px 0px 1px rgba(0, 0, 0, 0.2);
-moz-box-shadow: 0px 0px 0px 1px rgba(0, 0, 0, 0.2);
box-shadow: 0px 0px 0px 1px rgba(0, 0, 0, 0.2);
}
.ui.selection.dropdown:hover .menu {
-webkit-box-shadow: 0px 1px 0px 1px #D3D3D3;
-moz-box-shadow: 0px 1px 0px 1px #D3D3D3;
box-shadow: 0px 1px 0px 1px #D3D3D3;
}
.ui.selection.dropdown:hover > .dropdown.icon {
opacity: 1;
}
/* Active */
.ui.active.selection.dropdown {
-webkit-border-radius: 0.3125em 0.3125em 0em 0em !important;
-moz-border-radius: 0.3125em 0.3125em 0em 0em !important;
border-radius: 0.3125em 0.3125em 0em 0em !important;
}
.ui.active.selection.dropdown > .dropdown.icon {
opacity: 1;
}
/*--------------
Fluid
---------------*/
.ui.fluid.dropdown {
display: block;
}
/*--------------
Inline
---------------*/
.ui.inline.dropdown {
cursor: pointer;
display: inline-block;
color: inherit;
}
.ui.inline.dropdown .dropdown.icon {
margin: 0em 0.5em 0em 0.25em;
}
.ui.inline.dropdown .text {
font-weight: bold;
}
.ui.inline.dropdown .menu {
cursor: auto;
margin-top: 0.25em;
-webkit-border-radius: 0.325em;
-moz-border-radius: 0.325em;
border-radius: 0.325em;
}
/*--------------
Floating
---------------*/
.ui.floating.dropdown .menu {
left: 0;
right: auto;
margin-top: 0.5em;
-webkit-border-radius: 0.325em;
-moz-border-radius: 0.325em;
border-radius: 0.325em;
}
/*--------------
Pointing
---------------*/
.ui.pointing.dropdown .menu {
top: 100%;
margin-top: 0.75em;
-moz-border-radius: 0.325em;
-webkit-border-radius: 0.325em;
border-radius: 0.325em;
}
.ui.pointing.dropdown .menu:after {
display: block;
position: absolute;
pointer-events: none;
content: " ";
visibility: visible;
width: 0.5em;
height: 0.5em;
-moz-box-shadow: -1px -1px 0px 1px rgba(0, 0, 0, 0.05);
-webkit-box-shadow: -1px -1px 0px 1px rgba(0, 0, 0, 0.05);
box-shadow: -1px -1px 0px 1px rgba(0, 0, 0, 0.05);
background-image: none;
background-color: #FFFFFF;
-webkit-transform: rotate(45deg);
-moz-transform: rotate(45deg);
transform: rotate(45deg);
z-index: 2;
}
.ui.pointing.dropdown .menu .active.item:first-child {
background: transparent -webkit-linear-gradient(transparent, rgba(0, 0, 0, 0.03));
background: transparent -moz-linear-gradient(transparent, rgba(0, 0, 0, 0.03));
background: transparent -o-linear-gradient(transparent, rgba(0, 0, 0, 0.03));
background: transparent -ms-linear-gradient(transparent, rgba(0, 0, 0, 0.03));
background: transparent linear-gradient(transparent, rgba(0, 0, 0, 0.03));
}
/* Directions */
.ui.pointing.dropdown .menu:after {
top: -0.25em;
left: 50%;
margin: 0em 0em 0em -0.25em;
}
.ui.top.left.pointing.dropdown .menu {
top: 100%;
bottom: auto;
left: 0%;
right: auto;
margin: 0.75em 0em 0em;
}
.ui.top.left.pointing.dropdown .menu:after {
top: -0.25em;
left: 1.25em;
right: auto;
margin: 0em;
-webkit-transform: rotate(45deg);
-moz-transform: rotate(45deg);
transform: rotate(45deg);
}
.ui.top.right.pointing.dropdown .menu {
top: 100%;
bottom: auto;
right: 0%;
left: auto;
margin: 0.75em 0em 0em;
}
.ui.top.right.pointing.dropdown .menu:after {
top: -0.25em;
left: auto;
right: 1.25em;
margin: 0em;
-webkit-transform: rotate(45deg);
-moz-transform: rotate(45deg);
transform: rotate(45deg);
}
.ui.left.pointing.dropdown .menu {
top: 0%;
left: 100%;
right: auto;
margin: 0em 0em 0em 0.75em;
}
.ui.left.pointing.dropdown .menu:after {
top: 1em;
left: -0.25em;
margin: 0em 0em 0em 0em;
-webkit-transform: rotate(-45deg);
-moz-transform: rotate(-45deg);
transform: rotate(-45deg);
}
.ui.right.pointing.dropdown .menu {
top: 0%;
left: auto;
right: 100%;
margin: 0em 0.75em 0em 0em;
}
.ui.right.pointing.dropdown .menu:after {
top: 1em;
left: auto;
right: -0.25em;
margin: 0em 0em 0em 0em;
-webkit-transform: rotate(135deg);
-moz-transform: rotate(135deg);
transform: rotate(135deg);
}
/*
* # Semantic - Modal
* http://github.com/jlukic/semantic-ui/
*
*
* Copyright 2013 Contributors
* Released under the MIT license
* http://opensource.org/licenses/MIT
*
*/
/*******************************
Modal
*******************************/
.ui.modal {
display: none;
position: fixed;
z-index: 1001;
top: 50%;
left: 50%;
text-align: left;
width: 90%;
margin-left: -45%;
background-color: #FFFFFF;
border: 1px solid #DDDDDD;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
}
/*******************************
Content
*******************************/
/*--------------
Close
---------------*/
.ui.modal > .close {
cursor: pointer;
position: absolute;
opacity: 0.8;
font-size: 1.25em;
top: -1.75em;
right: -1.75em;
color: #FFFFFF;
}
.ui.modal > .close:hover {
opacity: 1;
}
/*--------------
Header
---------------*/
.ui.modal > .header {
margin: 0em;
padding: 1.5rem 2rem;
font-size: 1.6em;
font-weight: bold;
-webkit-border-radius: 0.325em 0.325em 0px 0px;
-moz-border-radius: 0.325em 0.325em 0px 0px;
border-radius: 0.325em 0.325em 0px 0px;
}
/*--------------
Content
---------------*/
.ui.modal > .content {
display: table;
width: 100%;
position: relative;
padding: 2em;
background-color: #F4F4F4;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
-ms-box-sizing: border-box;
box-sizing: border-box;
}
.ui.modal > .content > .left {
display: table-cell;
padding-right: 1.5%;
min-width: 25%;
}
.ui.modal > .content > .right {
display: table-cell;
padding-left: 1.5%;
vertical-align: top;
}
.ui.modal > .content > .left > .icon {
font-size: 8em;
margin: 0em;
}
.ui.modal > .content p {
line-height: 1.6;
}
/*--------------
Actions
---------------*/
.ui.modal .actions {
padding: 1rem 2rem;
text-align: right;
}
.ui.modal .actions > .button {
margin-left: 0.75em;
}
/*-------------------
Sizing
--------------------*/
/* Mobile Only */
@media only screen and (max-width: 768px) {
.ui.modal .content .left {
display: block;
padding: 0em 0em 0em 1em;
}
.ui.modal .content .right {
display: block;
padding: 1em 0em 0em 0em;
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
}
}
/* Tablet and Mobile */
@media only screen and (max-width: 998px) {
.ui.modal {
width: 92%;
margin-left: -46%;
}
.ui.modal > .close {
color: rgba(0, 0, 0, 0.8);
top: 1.5rem;
right: 1rem;
}
}
/* Computer / Responsive */
@media only screen and (min-width: 998px) {
.ui.modal {
width: 74%;
margin-left: -37%;
}
}
@media only screen and (min-width: 1500px) {
.ui.modal {
width: 56%;
margin-left: -28%;
}
}
@media only screen and (min-width: 1750px) {
.ui.modal {
width: 42%;
margin-left: -21%;
}
}
@media only screen and (min-width: 2000px) {
.ui.modal {
width: 36%;
margin-left: -18%;
}
}
/*******************************
Types
*******************************/
.ui.basic.modal {
background-color: transparent;
border: none;
color: #FFFFFF;
}
.ui.basic.modal > .close {
top: 1.5rem;
right: 1rem;
}
.ui.basic.modal .content {
background-color: transparent;
}
/*******************************
Variations
*******************************/
/* A modal that cannot fit on the page */
.ui.modal.scrolling {
position: absolute;
margin-top: 10px;
}
/*******************************
States
*******************************/
.ui.active.modal {
display: block;
}
/*--------------
Size
---------------*/
/* Small */
.ui.small.modal > .header {
font-size: 1.3em;
}
@media only screen and (min-width: 998px) {
.ui.small.modal {
width: 58%;
margin-left: -29%;
}
}
@media only screen and (min-width: 1500px) {
.ui.small.modal {
width: 40%;
margin-left: -20%;
}
}
@media only screen and (min-width: 1750px) {
.ui.small.modal {
width: 26%;
margin-left: -13%;
}
}
@media only screen and (min-width: 2000px) {
.ui.small.modal {
width: 20%;
margin-left: -10%;
}
}
/* Large */
@media only screen and (min-width: 998px) {
.ui.large.modal {
width: 74%;
margin-left: -37%;
}
}
@media only screen and (min-width: 1500px) {
.ui.large.modal {
width: 64%;
margin-left: -32%;
}
}
@media only screen and (min-width: 1750px) {
.ui.large.modal {
width: 54%;
margin-left: -27%;
}
}
@media only screen and (min-width: 2000px) {
.ui.large.modal {
width: 44%;
margin-left: -22%;
}
}
/*
* # Semantic - Nag
* http://github.com/jlukic/semantic-ui/
*
*
* Copyright 2013 Contributors
* Released under the MIT license
* http://opensource.org/licenses/MIT
*
*/
/*******************************
Nag
*******************************/
.ui.nag {
display: none;
opacity: 0.95;
position: relative;
top: 0px;
left: 0%;
z-index: 101;
min-height: 0;
width: 100%;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
-ms-box-sizing: border-box;
box-sizing: border-box;
margin: 0em;
line-height: 3em;
padding: 0em 1em;
background-color: #555555;
-webkit-box-shadow: 0px 1px 2px 0px rgba(0, 0, 0, 0.2);
-moz-box-shadow: 0px 1px 2px 0px rgba(0, 0, 0, 0.2);
box-shadow: 0px 1px 2px 0px rgba(0, 0, 0, 0.2);
font-size: 1em;
text-align: center;
color: rgba(255, 255, 255, 0.8);
-webkit-border-radius: 0px 0px 5px 5px;
-moz-border-radius: 0px 0px 5px 5px;
border-radius: 0px 0px 5px 5px;
-webkit-transition: 0.2s background;
-moz-transition: 0.2s background;
-o-transition: 0.2s background;
-ms-transition: 0.2s background;
transition: 0.2s background;
}
a.ui.nag {
cursor: pointer;
}
.ui.nag > .title {
display: inline-block;
margin: 0em 0.5em;
color: #FFFFFF;
}
.ui.nag > .close.icon {
cursor: pointer;
opacity: 0.4;
position: absolute;
top: 50%;
right: 1em;
margin-top: -0.5em;
color: #FFFFFF;
-webkit-transition: 0.1s opacity;
-moz-transition: 0.1s opacity;
-o-transition: 0.1s opacity;
-ms-transition: 0.1s opacity;
transition: 0.1s opacity;
}
/*******************************
States
*******************************/
/* Hover */
.ui.nag:hover {
opacity: 1;
}
.ui.nag .close:hover {
opacity: 1;
}
/*******************************
Variations
*******************************/
/*--------------
Static
---------------*/
.ui.overlay.nag {
position: absolute;
display: block;
}
/*--------------
Fixed
---------------*/
.ui.fixed.nag {
position: fixed;
}
/*--------------
Bottom
---------------*/
.ui.botton.nag {
-webkit-border-radius: 5px 5px 0px 0px;
-moz-border-radius: 5px 5px 0px 0px;
border-radius: 5px 5px 0px 0px;
}
.ui.fixed.bottom.nags,
.ui.fixed.bottom.nag {
top: auto;
bottom: 0px;
}
/*--------------
White
---------------*/
.ui.white.nags .nag,
.ui.white.nag {
background-color: #F1F1F1;
text-shadow: 0px 1px 0px rgba(255, 255, 255, 0.8);
color: #ACACAC;
}
.ui.white.nags .nag .close,
.ui.white.nags .nag .title,
.ui.white.nag .close,
.ui.white.nag .title {
color: #333333;
}
/*******************************
Groups
*******************************/
.ui.nags .nag {
-webkit-border-radius: 0px;
-moz-border-radius: 0px;
border-radius: 0px;
}
/*
* # Semantic - Popup
* http://github.com/jlukic/semantic-ui/
*
*
* Copyright 2013 Contributors
* Released under the MIT license
* http://opensource.org/licenses/MIT
*
*/
/*******************************
Popup
*******************************/
.ui.popup {
display: none;
position: absolute;
top: 0px;
right: 0px;
z-index: 900;
border: 1px solid rgba(0, 0, 0, 0.1);
max-width: 250px;
background-color: #FFFFFF;
padding: 0.8em 1.2em;
font-size: 0.875rem;
font-weight: normal;
font-style: normal;
color: rgba(0, 0, 0, 0.7);
-webkit-border-radius: 0.2em;
-moz-border-radius: 0.2em;
border-radius: 0.2em;
-webkit-box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.1);
-moz-box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.1);
box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.1);
}
.ui.popup .header {
padding: 0em 0em 0.5em;
font-size: 1.125em;
line-height: 1.2;
font-weight: bold;
}
.ui.popup:before {
position: absolute;
content: "";
width: 0.75em;
height: 0.75rem;
background-image: none;
background-color: #FFFFFF;
-webkit-transform: rotate(45deg);
-moz-transform: rotate(45deg);
transform: rotate(45deg);
z-index: 2;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
-ms-box-sizing: border-box;
box-sizing: border-box;
-webkit-box-shadow: 1px 1px 1px rgba(0, 0, 0, 0.1);
-moz-box-shadow: 1px 1px 1px rgba(0, 0, 0, 0.1);
box-shadow: 1px 1px 1px rgba(0, 0, 0, 0.1);
}
.ui.popup .ui.button {
width: 100%;
}
/*******************************
Types
*******************************/
/*--------------
Spacing
---------------*/
.ui.popup {
margin: 0em;
}
.ui.popup.bottom {
margin: 0.75em 0em 0em;
}
.ui.popup.top {
margin: 0em 0em 0.75em;
}
.ui.popup.left.center {
margin: 0em 0.75em 0em 0em;
}
.ui.popup.right.center {
margin: 0em 0em 0em 0.75em;
}
.ui.popup.center {
margin-left: -1.25em;
}
/*--------------
Pointer
---------------*/
/*--- Below ---*/
.ui.bottom.center.popup:before {
margin-left: -0.4em;
top: -0.4em;
left: 50%;
right: auto;
bottom: auto;
-webkit-box-shadow: -1px -1px 1px rgba(0, 0, 0, 0.2);
-moz-box-shadow: -1px -1px 1px rgba(0, 0, 0, 0.2);
box-shadow: -1px -1px 1px rgba(0, 0, 0, 0.2);
}
.ui.bottom.left.popup {
margin-right: -2em;
}
.ui.bottom.left.popup:before {
top: -0.4em;
right: 1em;
bottom: auto;
left: auto;
margin-left: 0em;
-webkit-box-shadow: -1px -1px 1px rgba(0, 0, 0, 0.2);
-moz-box-shadow: -1px -1px 1px rgba(0, 0, 0, 0.2);
box-shadow: -1px -1px 1px rgba(0, 0, 0, 0.2);
}
.ui.bottom.right.popup {
margin-left: -2em;
}
.ui.bottom.right.popup:before {
top: -0.4em;
left: 1em;
right: auto;
bottom: auto;
margin-left: 0em;
-webkit-box-shadow: -1px -1px 1px rgba(0, 0, 0, 0.2);
-moz-box-shadow: -1px -1px 1px rgba(0, 0, 0, 0.2);
box-shadow: -1px -1px 1px rgba(0, 0, 0, 0.2);
}
/*--- Above ---*/
.ui.top.center.popup:before {
top: auto;
right: auto;
bottom: -0.4em;
left: 50%;
margin-left: -0.4em;
}
.ui.top.left.popup {
margin-right: -2em;
}
.ui.top.left.popup:before {
bottom: -0.4em;
right: 1em;
top: auto;
left: auto;
margin-left: 0em;
}
.ui.top.right.popup {
margin-left: -2em;
}
.ui.top.right.popup:before {
bottom: -0.4em;
left: 1em;
top: auto;
right: auto;
margin-left: 0em;
}
/*--- Left Center ---*/
.ui.left.center.popup:before {
top: 50%;
right: -0.35em;
bottom: auto;
left: auto;
margin-top: -0.4em;
-moz-box-shadow: 1px -1px 1px rgba(0, 0, 0, 0.2);
-webkit-box-shadow: 1px -1px 1px rgba(0, 0, 0, 0.2);
box-shadow: 1px -1px 1px rgba(0, 0, 0, 0.2);
}
/*--- Right Center ---*/
.ui.right.center.popup:before {
top: 50%;
left: -0.35em;
bottom: auto;
right: auto;
margin-top: -0.4em;
-moz-box-shadow: -1px 1px 1px rgba(0, 0, 0, 0.2);
-webkit-box-shadow: -1px 1px 1px rgba(0, 0, 0, 0.2);
box-shadow: -1px 1px 1px rgba(0, 0, 0, 0.2);
}
/*******************************
States
*******************************/
.ui.loading.popup {
display: block;
visibility: hidden;
}
.ui.active.popup {
display: block;
}
/*******************************
Variations
*******************************/
/*--------------
Size
---------------*/
.ui.small.popup {
font-size: 0.75rem;
}
.ui.large.popup {
font-size: 1rem;
}
/*--------------
Colors
---------------*/
/* Inverted colors */
.ui.inverted.popup {
background-color: #333333;
border: none;
color: #FFFFFF;
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
}
.ui.inverted.popup .header {
background-color: rgba(0, 0, 0, 0.2);
color: #FFFFFF;
}
.ui.inverted.popup:before {
background-color: #333333;
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
}
/*
* # Semantic - Rating
* http://github.com/jlukic/semantic-ui/
*
*
* Copyright 2013 Contributors
* Released under the MIT license
* http://opensource.org/licenses/MIT
*
*/
/*******************************
Rating
*******************************/
.ui.rating {
display: inline-block;
font-size: 0em;
vertical-align: baseline;
margin: 0em 0.5rem 0em 0em;
}
.ui.rating:last-child {
margin-right: 0em;
}
.ui.rating:before {
display: block;
content: '';
visibility: hidden;
clear: both;
height: 0;
}
/* Icon */
.ui.rating .icon {
cursor: default;
margin: 0em;
width: 1em;
height: auto;
padding: 0em;
color: rgba(0, 0, 0, 0.15);
font-weight: normal;
font-style: normal;
}
.ui.rating .icon:before {
content: "\2605";
-webkit-transition: color 0.3s ease,
opacity 0.3s ease
;
-moz-transition: color 0.3s ease,
opacity 0.3s ease
;
-ms-transition: color 0.3s ease,
opacity 0.3s ease
;
-o-transition: color 0.3s ease,
opacity 0.3s ease
;
transition: color 0.3s ease,
opacity 0.3s ease
;
}
/*******************************
Types
*******************************/
/*-------------------
Star
--------------------*/
.ui.star.rating .icon {
width: 1.2em;
}
/* Star */
.ui.star.rating .icon:before {
content: '\f006';
font-family: 'Icons';
}
/* Active Star */
.ui.star.rating .active.icon:before {
content: '\f005';
font-family: 'Icons';
}
/*-------------------
Heart
--------------------*/
.ui.heart.rating .icon {
width: 1.2em;
}
.ui.heart.rating .icon:before {
content: '\f08a';
font-family: 'Icons';
}
/* Active */
.ui.heart.rating .active.icon:before {
content: '\f004';
font-family: 'Icons';
}
.ui.heart.rating .active.icon {
color: #EF404A !important;
}
/* Hovered */
.ui.heart.rating .hover.icon,
.ui.heart.rating .active.hover.icon {
color: #FF2733 !important;
}
/*******************************
States
*******************************/
/*-------------------
Active
--------------------*/
/* active rating */
.ui.active.rating .icon {
cursor: pointer;
}
/* active icons */
.ui.rating .active.icon {
color: #FFCB08 !important;
}
/*-------------------
Hover
--------------------*/
/* rating */
.ui.rating.hover .active.icon {
opacity: 0.5;
}
/* icon */
.ui.rating .icon.hover,
.ui.rating .icon.hover.active {
opacity: 1;
color: #FFB70A !important;
}
/*******************************
Variations
*******************************/
.ui.small.rating .icon {
font-size: 0.75rem;
}
.ui.rating .icon {
font-size: 1rem;
}
.ui.large.rating .icon {
font-size: 1.5rem;
vertical-align: middle;
}
.ui.huge.rating .icon {
font-size: 2rem;
vertical-align: middle;
}
/*
* # Semantic - Reveal
* http://github.com/jlukic/semantic-ui/
*
*
* Copyright 2013 Contributors
* Released under the MIT license
* http://opensource.org/licenses/MIT
*
*/
/*******************************
Reveal
*******************************/
.ui.reveal {
display: inline-block;
position: relative !important;
z-index: 2 !important;
font-size: 0em !important;
}
.ui.reveal > .content {
font-size: 1em !important;
}
.ui.reveal > .visible.content {
-webkit-transition: all 0.8s cubic-bezier(0.175, 0.885, 0.32, 1) 0.15s;
-moz-transition: all 0.8s cubic-bezier(0.175, 0.885, 0.32, 1) 0.15s;
-ms-transition: all 0.8s cubic-bezier(0.175, 0.885, 0.32, 1) 0.15s;
transition: all 0.8s cubic-bezier(0.175, 0.885, 0.32, 1) 0.15s;
}
.ui.reveal > .visible.content {
position: absolute !important;
top: 0em !important;
left: 0em !important;
z-index: 4 !important;
-webkit-transition: all 0.8s cubic-bezier(0.175, 0.885, 0.32, 1) 0.15s;
-moz-transition: all 0.8s cubic-bezier(0.175, 0.885, 0.32, 1) 0.15s;
-ms-transition: all 0.8s cubic-bezier(0.175, 0.885, 0.32, 1) 0.15s;
transition: all 0.8s cubic-bezier(0.175, 0.885, 0.32, 1) 0.15s;
}
.ui.reveal > .hidden.content {
position: relative !important;
z-index: 3 !important;
}
/*------------------
Loose Coupling
-------------------*/
.ui.reveal.button {
overflow: hidden;
}
/*******************************
Types
*******************************/
/*--------------
Slide
---------------*/
.ui.slide.reveal {
position: relative !important;
display: block;
overflow: hidden !important;
white-space: nowrap;
}
.ui.slide.reveal > .content {
display: block;
float: left;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
-ms-box-sizing: border-box;
box-sizing: border-box;
margin: 0em;
-webkit-transition: top 0.8s cubic-bezier(0.175, 0.885, 0.32, 1) 0.15s, left 0.8s cubic-bezier(0.175, 0.885, 0.32, 1) 0.15s, right 0.8s cubic-bezier(0.175, 0.885, 0.32, 1) 0.15s, bottom 0.8s cubic-bezier(0.175, 0.885, 0.32, 1) 0.15s;
-moz-transition: top 0.8s cubic-bezier(0.175, 0.885, 0.32, 1) 0.15s, left 0.8s cubic-bezier(0.175, 0.885, 0.32, 1) 0.15s, right 0.8s cubic-bezier(0.175, 0.885, 0.32, 1) 0.15s, bottom 0.8s cubic-bezier(0.175, 0.885, 0.32, 1) 0.15s;
-ms-transition: top 0.8s cubic-bezier(0.175, 0.885, 0.32, 1) 0.15s, left 0.8s cubic-bezier(0.175, 0.885, 0.32, 1) 0.15s, right 0.8s cubic-bezier(0.175, 0.885, 0.32, 1) 0.15s, bottom 0.8s cubic-bezier(0.175, 0.885, 0.32, 1) 0.15s;
transition: top 0.8s cubic-bezier(0.175, 0.885, 0.32, 1) 0.15s, left 0.8s cubic-bezier(0.175, 0.885, 0.32, 1) 0.15s, right 0.8s cubic-bezier(0.175, 0.885, 0.32, 1) 0.15s, bottom 0.8s cubic-bezier(0.175, 0.885, 0.32, 1) 0.15s;
}
.ui.slide.reveal > .visible.content {
position: relative !important;
}
.ui.slide.reveal > .hidden.content {
position: absolute !important;
left: 100% !important;
width: 100% !important;
}
.ui.slide.reveal:hover > .visible.content {
left: -100% !important;
}
.ui.slide.reveal:hover > .hidden.content {
left: 0% !important;
}
.ui.right.slide.reveal > .visible.content {
left: 0%;
}
.ui.right.slide.reveal > .hidden.content {
left: auto !important;
right: 100% !important;
}
.ui.right.slide.reveal:hover > .visible.content {
left: 100% !important;
right: auto !important;
}
.ui.right.slide.reveal:hover > .hidden.content {
left: auto !important;
right: 0% !important;
}
.ui.up.slide.reveal > .visible.content {
top: 0% !important;
left: 0% !important;
right: auto !important;
bottom: auto !important;
}
.ui.up.slide.reveal > .hidden.content {
top: 100% !important;
left: 0% !important;
right: auto !important;
bottom: auto !important;
}
.ui.slide.up.reveal:hover > .visible.content {
top: -100% !important;
left: 0% !important;
}
.ui.slide.up.reveal:hover > .hidden.content {
top: 0% !important;
left: 0% !important;
}
.ui.down.slide.reveal > .visible.content {
top: auto !important;
right: auto !important;
bottom: auto !important;
bottom: 0% !important;
}
.ui.down.slide.reveal > .hidden.content {
top: auto !important;
right: auto !important;
bottom: 100% !important;
left: 0% !important;
}
.ui.slide.down.reveal:hover > .visible.content {
left: 0% !important;
bottom: -100% !important;
}
.ui.slide.down.reveal:hover > .hidden.content {
left: 0% !important;
bottom: 0% !important;
}
/*--------------
Fade
---------------*/
.ui.fade.reveal > .visible.content {
opacity: 1;
}
.ui.fade.reveal:hover > .visible.content {
opacity: 0;
}
/*--------------
Move
---------------*/
.ui.move.reveal > .visible.content,
.ui.move.left.reveal > .visible.content {
left: auto !important;
top: auto !important;
bottom: auto !important;
right: 0% !important;
}
.ui.move.reveal:hover > .visible.content,
.ui.move.left.reveal:hover > .visible.content {
right: 100% !important;
}
.ui.move.right.reveal > .visible.content {
right: auto !important;
top: auto !important;
bottom: auto !important;
left: 0% !important;
}
.ui.move.right.reveal:hover > .visible.content {
left: 100% !important;
}
.ui.move.up.reveal > .visible.content {
right: auto !important;
left: auto !important;
top: auto !important;
bottom: 0% !important;
}
.ui.move.up.reveal:hover > .visible.content {
bottom: 100% !important;
}
.ui.move.down.reveal > .visible.content {
right: auto !important;
left: auto !important;
top: 0% !important;
bottom: auto !important;
}
.ui.move.down.reveal:hover > .visible.content {
top: 100% !important;
}
/*--------------
Rotate
---------------*/
.ui.rotate.reveal > .visible.content {
-webkit-transition-duration: 0.8s;
-moz-transition-duration: 0.8s;
-o-transition-duration: 0.8s;
-ms-transition-duration: 0.8s;
transition-duration: 0.8s;
-webkit-transform: rotate(0deg);
-moz-transform: rotate(0deg);
-o-transform: rotate(0deg);
-ms-transform: rotate(0deg);
transform: rotate(0deg);
}
.ui.rotate.reveal > .visible.content,
.ui.rotate.right.reveal > .visible.content {
-webkit-transform-origin: bottom right;
-moz-transform-origin: bottom right;
-o-transform-origin: bottom right;
-ms-transform-origin: bottom right;
transform-origin: bottom right;
}
.ui.rotate.reveal:hover > .visible.content,
.ui.rotate.right.reveal:hover > .visible.content {
-webkit-transform: rotate(110deg);
-moz-transform: rotate(110deg);
-o-transform: rotate(110deg);
-ms-transform: rotate(110deg);
transform: rotate(110deg);
}
.ui.rotate.left.reveal > .visible.content {
-webkit-transform-origin: bottom left;
-moz-transform-origin: bottom left;
-o-transform-origin: bottom left;
-ms-transform-origin: bottom left;
transform-origin: bottom left;
}
.ui.rotate.left.reveal:hover > .visible.content {
-webkit-transform: rotate(-110deg);
-moz-transform: rotate(-110deg);
-o-transform: rotate(-110deg);
-ms-transform: rotate(-110deg);
transform: rotate(-110deg);
}
/*******************************
States
*******************************/
.ui.disabled.reveal {
opacity: 1 !important;
}
.ui.disabled.reveal > .content {
-webkit-transition: none !important;
-moz-transition: none !important;
-o-transition: none !important;
-ms-transition: none !important;
transition: none !important;
}
.ui.disabled.reveal:hover > .visible.content {
position: static !important;
display: block !important;
opacity: 1 !important;
top: 0 !important;
left: 0 !important;
right: auto !important;
bottom: auto !important;
transform: none !important;
}
.ui.disabled.reveal:hover > .hidden.content {
display: none !important;
}
/*******************************
Variations
*******************************/
/*--------------
Masked
---------------*/
.ui.masked.reveal {
overflow: hidden;
}
/*--------------
Instant
---------------*/
.ui.instant.reveal > .content {
-webkit-transition-delay: 0s !important;
-moz-transition-delay: 0s !important;
-o-transition-delay: 0s !important;
-ms-transition-delay: 0s !important;
transition-delay: 0s !important;
}
/*
* # Semantic - Search
* http://github.com/jlukic/semantic-ui/
*
*
* Copyright 2013 Contributors
* Released under the MIT license
* http://opensource.org/licenses/MIT
*
*/
/*******************************
Search
*******************************/
.ui.search {
position: relative;
text-shadow: none;
font-style: normal;
font-weight: normal;
}
.ui.search input {
-webkit-border-radius: 500rem;
-moz-border-radius: 500rem;
border-radius: 500rem;
}
/*--------------
Button
---------------*/
.ui.search > .button {
position: relative;
z-index: 2;
float: right;
margin: 0px 0px 0px -15px;
padding: 6px 15px 7px;
-webkit-border-radius: 0px 15px 15px 0px;
-moz-border-radius: 0px 15px 15px 0px;
border-radius: 0px 15px 15px 0px;
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
}
/*--------------
Results
---------------*/
.ui.search .results {
display: none;
position: absolute;
z-index: 999;
top: 100%;
left: 0px;
overflow: hidden;
background-color: #FFFFFF;
margin-top: 0.5em;
width: 380px;
font-size: 0.875em;
line-height: 1.2;
color: #555555;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
-webkit-box-shadow: 0px 0px 1px 1px rgba(0, 0, 0, 0.1), 0px -2px 0px 0px rgba(0, 0, 0, 0.1) inset;
-moz-box-shadow: 0px 0px 1px 1px rgba(0, 0, 0, 0.1), 0px -2px 0px 0px rgba(0, 0, 0, 0.1) inset;
box-shadow: 0px 0px 1px 1px rgba(0, 0, 0, 0.1), 0px -2px 0px 0px rgba(0, 0, 0, 0.1) inset;
}
.ui.search .result {
cursor: pointer;
overflow: hidden;
padding: 0.5em 1em;
}
.ui.search .result:first-child {
border-top: none;
}
.ui.search .result .image {
background: #F0F0F0;
margin-right: 10px;
float: left;
overflow: hidden;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
width: 38px;
height: 38px;
}
.ui.search .result .image img {
display: block;
width: 38px;
height: 38px;
}
.ui.search .result .image ~ .info {
float: none;
margin-left: 50px;
}
.ui.search .result .info {
float: left;
}
.ui.search .result .title {
font-weight: bold;
color: rgba(0, 0, 0, 0.8);
}
.ui.search .result .description {
color: rgba(0, 0, 0, 0.6);
}
.ui.search .result .price {
float: right;
color: #5BBD72;
font-weight: bold;
}
/*--------------
Message
---------------*/
.ui.search .message {
padding: 1em;
}
.ui.search .message .text .title {
margin: 0em 0em 0.5rem;
font-size: 1.25rem;
font-weight: bold;
color: rgba(0, 0, 0, 0.8);
}
.ui.search .message .text .description {
margin: 0em;
font-size: 1rem;
color: rgba(0, 0, 0, 0.5);
}
/*--------------
Categories
---------------*/
.ui.search .results .category {
background-color: #FAFAFA;
border-top: 1px solid rgba(0, 0, 0, 0.1);
-webkit-transition: background 0.2s ease-in;
-moz-transition: background 0.2s ease-in;
-o-transition: background 0.2s ease-in;
-ms-transition: background 0.2s ease-in;
transition: background 0.2s ease-in;
}
.ui.search .results .category:first-child {
border-top: none;
}
.ui.search .results .category > .name {
float: left;
padding: 12px 0px 0px 8px;
font-weight: bold;
color: #777777;
text-shadow: 0px 1px 0px rgba(255, 255, 255, 0.8);
}
.ui.search .results .category .result {
background-color: #FFFFFF;
margin-left: 80px;
border-left: 1px solid rgba(0, 0, 0, 0.1);
}
/* View All Results */
.ui.search .all {
display: block;
border-top: 1px solid rgba(0, 0, 0, 0.1);
background-color: #FAFAFA;
height: 2em;
line-height: 2em;
color: rgba(0, 0, 0, 0.6);
font-weight: bold;
text-align: center;
}
/*******************************
States
*******************************/
/*--------------
Hover
---------------*/
.ui.search .result:hover,
.ui.search .category .result:hover {
background-color: #F8F8F8;
}
.ui.search .all:hover {
background-color: #F0F0F0;
}
/*--------------
Loading
---------------*/
.ui.search.loading .input .icon {
background: url(../images/loader-mini.gif) no-repeat 50% 50%;
}
.ui.search.loading .input .icon:before,
.ui.search.loading .input .icon:after {
display: none;
}
/*--------------
Active
---------------*/
.ui.search .results .category.active {
background-color: #F1F1F1;
}
.ui.search .results .category.active > .name {
color: #333333;
}
.ui.search .result.active,
.ui.search .category .result.active {
background-color: #FBFBFB;
}
.ui.search .result.active .title {
color: #000000;
}
.ui.search .result.active .description {
color: #555555;
}
/*******************************
Variations
*******************************/
/* Large */
.ui.search .large.result .image,
.ui.search .large.result .image img {
width: 50px;
height: 50px;
}
.ui.search .large.results .indented.info {
margin-left: 65px;
}
.ui.search .large.results .info .title {
font-size: 16px;
}
.ui.search .large.results .info .description {
font-size: 11px;
}
/*
* # Semantic - Shape
* http://github.com/jlukic/semantic-ui/
*
*
* Copyright 2013 Contributors
* Released under the MIT license
* http://opensource.org/licenses/MIT
*
*/
/*******************************
Shape
*******************************/
.ui.shape {
display: inline-block;
position: relative;
-webkit-perspective: 2000px;
-moz-perspective: 2000px;
-ms-perspective: 2000px;
perspective: 2000px;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
-ms-box-sizing: border-box;
box-sizing: border-box;
}
.ui.shape .sides {
-webkit-transform-style: preserve-3d;
-moz-transform-style: preserve-3d;
-ms-transform-style: preserve-3d;
transform-style: preserve-3d;
}
.ui.shape .side {
opacity: 1;
width: 100%;
margin: 0em !important;
-webkit-backface-visibility: hidden;
-moz-backface-visibility: hidden;
-ms-backface-visibility: hidden;
backface-visibility: hidden;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
-ms-box-sizing: border-box;
box-sizing: border-box;
}
.ui.shape .side {
display: none;
}
/*******************************
Types
*******************************/
.ui.cube.shape .side {
min-width: 15em;
height: 15em;
padding: 2em;
background-color: #E6E6E6;
color: rgba(0, 0, 0, 0.6);
-moz-box-shadow: 0px 0px 2px rgba(0, 0, 0, 0.3);
-webkit-box-shadow: 0px 0px 2px rgba(0, 0, 0, 0.3);
box-shadow: 0px 0px 2px rgba(0, 0, 0, 0.3);
}
.ui.cube.shape .side > .content {
width: 100%;
height: 100%;
display: table;
text-align: center;
-webkit-user-select: text;
-moz-user-select: text;
-ms-user-select: text;
user-select: text;
}
.ui.cube.shape .side > .content > div {
display: table-cell;
vertical-align: middle;
font-size: 2em;
}
/*******************************
Variations
*******************************/
.ui.text.shape.animating .sides {
position: static;
}
.ui.text.shape .side {
white-space: nowrap;
}
.ui.text.shape .side > * {
white-space: normal;
}
/*******************************
States
*******************************/
/*--------------
Loading
---------------*/
.ui.loading.shape {
position: absolute;
top: -9999px;
left: -9999px;
}
/*--------------
Animating
---------------*/
.ui.shape .animating.side {
position: absolute;
top: 0px;
left: 0px;
z-index: 100;
}
.ui.shape .hidden.side {
opacity: 0.4;
}
/*--------------
CSS
---------------*/
.ui.shape.animating {
-webkit-transition: all 0.6s ease-in-out;
-moz-transition: all 0.6s ease-in-out;
-o-transition: all 0.6s ease-in-out;
-ms-transition: all 0.6s ease-in-out;
transition: all 0.6s ease-in-out;
}
.ui.shape.animating .sides {
position: absolute;
}
.ui.shape.animating .sides {
-webkit-transition: all 0.6s ease-in-out;
-moz-transition: all 0.6s ease-in-out;
-o-transition: all 0.6s ease-in-out;
-ms-transition: all 0.6s ease-in-out;
transition: all 0.6s ease-in-out;
}
.ui.shape.animating .side {
-webkit-transition: opacity 0.6s ease-in-out;
-moz-transition: opacity 0.6s ease-in-out;
-o-transition: opacity 0.6s ease-in-out;
-ms-transition: opacity 0.6s ease-in-out;
transition: opacity 0.6s ease-in-out;
}
/*--------------
Active
---------------*/
.ui.shape .active.side {
display: block;
}
/*
* # Semantic - Sidebar
* http://github.com/jlukic/semantic-ui/
*
*
* Copyright 2013 Contributors
* Released under the MIT license
* http://opensource.org/licenses/MIT
*
*/
/*******************************
Sidebar
*******************************/
body {
-webkit-transition: margin 0.3s ease, -webkit-transform 0.3s ease;
-moz-transition: margin 0.3s ease, -moz-transform 0.3s ease;
-o-transition: margin 0.3s ease,
transform 0.3s ease
;
-ms-transition: margin 0.3s ease,
transform 0.3s ease
;
transition: margin 0.3s ease,
transform 0.3s ease
;
}
.ui.sidebar {
position: fixed;
margin: 0 !important;
height: 100% !important;
-webkit-border-radius: 0px !important;
-moz-border-radius: 0px !important;
border-radius: 0px !important;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
-ms-box-sizing: border-box;
box-sizing: border-box;
-ms-overflow-y: auto;
overflow-y: auto;
top: 0px;
left: 0px;
z-index: 999;
-webkit-transition: margin-left 0.3s ease, margin-top 0.3s ease;
-moz-transition: margin-left 0.3s ease, margin-top 0.3s ease;
-o-transition: margin-left 0.3s ease, margin-top 0.3s ease;
-ms-transition: margin-left 0.3s ease, margin-top 0.3s ease;
transition: margin-left 0.3s ease, margin-top 0.3s ease;
}
/*******************************
Types
*******************************/
/*-------------------
Direction
--------------------*/
.ui.right.sidebar {
left: 100%;
margin: 0px !important;
}
.ui.top.sidebar {
width: 100% !important;
}
.ui.bottom.sidebar {
width: 100% !important;
top: 100%;
margin: 0px !important;
}
/*******************************
States
*******************************/
.ui.active.sidebar {
margin-left: 0px !important;
}
.ui.active.top.sidebar,
.ui.active.bottom.sidebar {
margin-top: 0px !important;
}
/*******************************
Variations
*******************************/
/*-------------------
Formatted
--------------------*/
.ui.styled.sidebar {
padding: 1em 1.5em;
background-color: #FFFFFF;
box-shadow: 1px 0px 0px rgba(0, 0, 0, 0.1);
}
.ui.styled.very.thin.sidebar {
padding: 0.5em;
}
.ui.styled.thin.sidebar {
padding: 1em;
}
/*-------------------
Floating
--------------------*/
.ui.floating.sidebar {
-webkit-box-shadow: 2px 0px 2px rgba(0, 0, 0, 0.2);
-moz-box-shadow: 2px 0px 2px rgba(0, 0, 0, 0.2);
box-shadow: 2px 0px 2px rgba(0, 0, 0, 0.2);
}
.ui.right.floating.sidebar {
-webkit-box-shadow: -2px 0px 2px rgba(0, 0, 0, 0.2);
-moz-box-shadow: -2px 0px 2px rgba(0, 0, 0, 0.2);
box-shadow: -2px 0px 2px rgba(0, 0, 0, 0.2);
}
.ui.top.floating.sidebar {
-webkit-box-shadow: 0px 4px 4px rgba(0, 0, 0, 0.2);
-moz-box-shadow: 0px 4px 4px rgba(0, 0, 0, 0.2);
box-shadow: 0px 4px 4px rgba(0, 0, 0, 0.2);
}
.ui.bottom.floating.sidebar {
-webkit-box-shadow: 0px -4px 4px rgba(0, 0, 0, 0.2);
-moz-box-shadow: 0px -4px 4px rgba(0, 0, 0, 0.2);
box-shadow: 0px -4px 4px rgba(0, 0, 0, 0.2);
}
/*-------------------
Width
--------------------*/
/* Very Thin */
.ui.very.thin.sidebar {
width: 60px !important;
margin-left: -60px !important;
}
.ui.active.very.thin.sidebar {
margin-left: 0px !important;
}
.ui.active.right.very.thin.sidebar {
margin-left: -60px !important;
}
/* Thin */
.ui.thin.sidebar {
width: 200px !important;
margin-left: -200px !important;
}
.ui.active.thin.sidebar {
margin-left: 0px !important;
}
.ui.active.right.thin.sidebar {
margin-left: -200px !important;
}
/* Standard */
.ui.sidebar {
width: 275px !important;
margin-left: -275px !important;
}
.ui.active.sidebar {
margin-left: 0px !important;
}
.ui.active.right.sidebar {
margin-left: -275px !important;
}
/* Wide */
.ui.wide.sidebar {
width: 350px !important;
margin-left: -350px !important;
}
.ui.active.wide.sidebar {
margin-left: 0px !important;
}
.ui.active.right.wide.sidebar {
margin-left: -350px !important;
}
/* Very Wide */
.ui.very.wide.sidebar {
width: 475px !important;
margin-left: -475px !important;
}
.ui.active.very.wide.sidebar {
margin-left: 0px !important;
}
.ui.active.right.very.wide.sidebar {
margin-left: -475px !important;
}
/*-------------------
Height
--------------------*/
/* Standard */
.ui.top.sidebar {
margin: -40px 0px 0px 0px !important;
}
.ui.top.sidebar,
.ui.bottom.sidebar {
height: 40px !important;
}
.ui.active.bottom.sidebar {
margin-top: -40px !important;
}
/*
* # Semantic - Tab
* http://github.com/jlukic/semantic-ui/
*
*
* Copyright 2013 Contributors
* Released under the MIT license
* http://opensource.org/licenses/MIT
*
*/
/*******************************
UI Tabs
*******************************/
.ui.tab {
display: none;
}
/*******************************
States
*******************************/
/*--------------------
Active
---------------------*/
.ui.tab.active,
.ui.tab.open {
display: block;
}
/*--------------------
Loading
---------------------*/
.ui.tab.loading {
position: relative;
overflow: hidden;
display: block;
min-height: 250px;
text-indent: -10000px;
}
.ui.tab.loading * {
position: relative !important;
left: -10000px !important;
}
.ui.tab.loading:after {
position: absolute;
top: 50px;
left: 50%;
content: 'Loading...';
margin-left: -32px;
text-indent: 5px;
color: rgba(0, 0, 0, 0.4);
width: 100%;
height: 100%;
padding-top: 75px;
background: url(../images/loader-large.gif) no-repeat 0px 0px;
visibility: visible;
}
/*******************************
Semantic - Transition
Author: Jack Lukic
CSS animation definitions for
transition module
*******************************/
/*
Some transitions adapted from Animate CSS
https://github.com/daneden/animate.css
*/
.ui.transition {
-webkit-animation-iteration-count: 1;
-moz-animation-iteration-count: 1;
-ms-animation-iteration-count: 1;
-o-animation-iteration-count: 1;
animation-iteration-count: 1;
-webkit-animation-duration: 1s;
-moz-animation-duration: 1s;
-ms-animation-duration: 1s;
-o-animation-duration: 1s;
animation-duration: 1s;
animation-timing-function: ease;
-webkit-animation-timing-function: ease;
-webkit-animation-fill-mode: both;
-moz-animation-fill-mode: both;
-ms-animation-fill-mode: both;
-o-animation-fill-mode: both;
animation-fill-mode: both;
}
/*******************************
States
*******************************/
.ui.animating.transition {
-webkit-backface-visibility: hidden;
-moz-backface-visibility: hidden;
-ms-backface-visibility: hidden;
-o-backface-visibility: hidden;
backface-visibility: hidden;
-webkit-transform: translateZ(0);
-moz-transform: translateZ(0);
-ms-transform: translateZ(0);
-o-transform: translateZ(0);
transform: translateZ(0);
}
/* Loading */
.ui.loading.transition {
position: absolute;
top: -999999px;
left: -99999px;
}
/* Hidden */
.ui.hidden.transition {
display: none;
}
/* Visible */
.ui.visible.transition {
display: block;
visibility: visible;
}
/* Disabled */
.ui.disabled.transition {
-webkit-animation-play-state: paused;
-moz-animation-play-state: paused;
-ms-animation-play-state: paused;
-o-animation-play-state: paused;
animation-play-state: paused;
}
/*******************************
Variations
*******************************/
.ui.looping.transition {
-webkit-animation-iteration-count: infinite;
-moz-animation-iteration-count: infinite;
-ms-animation-iteration-count: infinite;
-o-animation-iteration-count: infinite;
animation-iteration-count: infinite;
}
/*******************************
Types
*******************************/
/*--------------
Emphasis
---------------*/
.ui.flash.transition {
-webkit-animation-name: flash;
-moz-animation-name: flash;
-o-animation-name: flash;
animation-name: flash;
}
.ui.shake.transition {
-webkit-animation-name: shake;
-moz-animation-name: shake;
-o-animation-name: shake;
animation-name: shake;
}
.ui.bounce.transition {
-webkit-animation-name: bounce;
-moz-animation-name: bounce;
-o-animation-name: bounce;
animation-name: bounce;
}
.ui.tada.transition {
-webkit-animation-name: tada;
-moz-animation-name: tada;
-o-animation-name: tada;
animation-name: tada;
}
/* originally authored by Nick Pettit - https://github.com/nickpettit/glide */
.ui.pulse.transition {
-webkit-animation-name: pulse;
-moz-animation-name: pulse;
-o-animation-name: pulse;
animation-name: pulse;
}
/*--------------
Flips
---------------*/
.ui.flip.transition.in,
.ui.flip.transition.out {
-webkit-perspective: 2000px;
perspective: 2000px;
}
.ui.horizontal.flip.transition.in,
.ui.horizontal.flip.transition.out {
-webkit-animation-name: horizontalFlip;
-moz-animation-name: horizontalFlip;
-o-animation-name: horizontalFlip;
animation-name: horizontalFlip;
}
.ui.horizontal.flip.transition.out {
-webkit-animation-name: horizontalFlipOut;
-moz-animation-name: horizontalFlipOut;
-o-animation-name: horizontalFlipOut;
animation-name: horizontalFlipOut;
}
.ui.vertical.flip.transition.in,
.ui.vertical.flip.transition.out {
-webkit-animation-name: verticalFlip;
-moz-animation-name: verticalFlip;
-o-animation-name: verticalFlip;
animation-name: verticalFlip;
}
.ui.vertical.flip.transition.out {
-webkit-animation-name: verticalFlipOut;
-moz-animation-name: verticalFlipOut;
-o-animation-name: verticalFlipOut;
animation-name: verticalFlipOut;
}
/*--------------
Fades
---------------*/
.ui.fade.transition.in {
-webkit-animation-name: fade;
-moz-animation-name: fade;
-o-animation-name: fade;
animation-name: fade;
}
.ui.fade.transition.out {
-webkit-animation-name: fadeOut;
-moz-animation-name: fadeOut;
-o-animation-name: fadeOut;
animation-name: fadeOut;
}
.ui.fade.up.transition.in {
-webkit-animation-name: fadeUp;
-moz-animation-name: fadeUp;
-o-animation-name: fadeUp;
animation-name: fadeUp;
}
.ui.fade.up.transition.out {
-webkit-animation-name: fadeUpOut;
-moz-animation-name: fadeUpOut;
-o-animation-name: fadeUpOut;
animation-name: fadeUpOut;
}
.ui.fade.down.transition.in {
-webkit-animation-name: fadeDown;
-moz-animation-name: fadeDown;
-o-animation-name: fadeDown;
animation-name: fadeDown;
}
.ui.fade.down.transition.out {
-webkit-animation-name: fadeDownOut;
-moz-animation-name: fadeDownOut;
-o-animation-name: fadeDownOut;
animation-name: fadeDownOut;
}
/*--------------
Scale
---------------*/
.ui.scale.transition.in {
-webkit-animation-name: scale;
-moz-animation-name: scale;
-o-animation-name: scale;
animation-name: scale;
}
.ui.scale.transition.out {
-webkit-animation-name: scaleOut;
-moz-animation-name: scaleOut;
-o-animation-name: scaleOut;
animation-name: scaleOut;
}
/*--------------
Slide
---------------*/
.ui.slide.down.transition.in {
-webkit-animation-name: slide;
-moz-animation-name: slide;
-o-animation-name: slide;
animation-name: slide;
transform-origin: 50% 0%;
-ms-transform-origin: 50% 0%;
-webkit-transform-origin: 50% 0%;
}
.ui.slide.down.transition.out {
-webkit-animation-name: slideOut;
-moz-animation-name: slideOut;
-o-animation-name: slideOut;
animation-name: slideOut;
transform-origin: 50% 0%;
-ms-transform-origin: 50% 0%;
-webkit-transform-origin: 50% 0%;
}
.ui.slide.up.transition.in {
-webkit-animation-name: slide;
-moz-animation-name: slide;
-o-animation-name: slide;
animation-name: slide;
transform-origin: 50% 100%;
-ms-transform-origin: 50% 100%;
-webkit-transform-origin: 50% 100%;
}
.ui.slide.up.transition.out {
-webkit-animation-name: slideOut;
-moz-animation-name: slideOut;
-o-animation-name: slideOut;
animation-name: slideOut;
transform-origin: 50% 100%;
-ms-transform-origin: 50% 100%;
-webkit-transform-origin: 50% 100%;
}
@-moz-keyframes slide {
0% {
opacity: 0;
-moz-transform: scaleY(0);
}
100% {
opacity: 1;
-moz-transform: scaleY(1);
}
}
@-webkit-keyframes slide {
0% {
opacity: 0;
-webkit-transform: scaleY(0);
}
100% {
opacity: 1;
-webkit-transform: scaleY(1);
}
}
@keyframes slide {
0% {
opacity: 0;
transform: scaleY(0);
}
100% {
opacity: 1;
transform: scaleY(1);
}
}
@-moz-keyframes slideOut {
0% {
opacity: 1;
-moz-transform: scaleY(1);
}
100% {
opacity: 0;
-moz-transform: scaleY(0);
}
}
@-webkit-keyframes slideOut {
0% {
opacity: 1;
-webkit-transform: scaleY(1);
}
100% {
opacity: 0;
-webkit-transform: scaleY(0);
}
}
@keyframes slideOut {
0% {
opacity: 1;
transform: scaleY(1);
}
100% {
opacity: 0;
transform: scaleY(0);
}
}
/*******************************
Animations
*******************************/
/*--------------
Emphasis
---------------*/
/* Flash */
@-webkit-keyframes flash {
0%,
50%,
100% {
opacity: 1;
}
25%,
75% {
opacity: 0;
}
}
@-moz-keyframes flash {
0%,
50%,
100% {
opacity: 1;
}
25%,
75% {
opacity: 0;
}
}
@-o-keyframes flash {
0%,
50%,
100% {
opacity: 1;
}
25%,
75% {
opacity: 0;
}
}
@keyframes flash {
0%,
50%,
100% {
opacity: 1;
}
25%,
75% {
opacity: 0;
}
}
/* Shake */
@-webkit-keyframes shake {
0%,
100% {
-webkit-transform: translateX(0);
}
10%,
30%,
50%,
70%,
90% {
-webkit-transform: translateX(-10px);
}
20%,
40%,
60%,
80% {
-webkit-transform: translateX(10px);
}
}
@-moz-keyframes shake {
0%,
100% {
-moz-transform: translateX(0);
}
10%,
30%,
50%,
70%,
90% {
-moz-transform: translateX(-10px);
}
20%,
40%,
60%,
80% {
-moz-transform: translateX(10px);
}
}
@-o-keyframes shake {
0%,
100% {
-o-transform: translateX(0);
}
10%,
30%,
50%,
70%,
90% {
-o-transform: translateX(-10px);
}
20%,
40%,
60%,
80% {
-o-transform: translateX(10px);
}
}
@keyframes shake {
0%,
100% {
transform: translateX(0);
}
10%,
30%,
50%,
70%,
90% {
transform: translateX(-10px);
}
20%,
40%,
60%,
80% {
transform: translateX(10px);
}
}
/* Bounce */
@-webkit-keyframes bounce {
0%,
20%,
50%,
80%,
100% {
-webkit-transform: translateY(0);
}
40% {
-webkit-transform: translateY(-30px);
}
60% {
-webkit-transform: translateY(-15px);
}
}
@-moz-keyframes bounce {
0%,
20%,
50%,
80%,
100% {
-moz-transform: translateY(0);
}
40% {
-moz-transform: translateY(-30px);
}
60% {
-moz-transform: translateY(-15px);
}
}
@-o-keyframes bounce {
0%,
20%,
50%,
80%,
100% {
-o-transform: translateY(0);
}
40% {
-o-transform: translateY(-30px);
}
60% {
-o-transform: translateY(-15px);
}
}
@keyframes bounce {
0%,
20%,
50%,
80%,
100% {
transform: translateY(0);
}
40% {
transform: translateY(-30px);
}
60% {
transform: translateY(-15px);
}
}
/* Tada */
@-webkit-keyframes tada {
0% {
-webkit-transform: scale(1);
}
10%,
20% {
-webkit-transform: scale(0.9) rotate(-3deg);
}
30%,
50%,
70%,
90% {
-webkit-transform: scale(1.1) rotate(3deg);
}
40%,
60%,
80% {
-webkit-transform: scale(1.1) rotate(-3deg);
}
100% {
-webkit-transform: scale(1) rotate(0);
}
}
@-moz-keyframes tada {
0% {
-moz-transform: scale(1);
}
10%,
20% {
-moz-transform: scale(0.9) rotate(-3deg);
}
30%,
50%,
70%,
90% {
-moz-transform: scale(1.1) rotate(3deg);
}
40%,
60%,
80% {
-moz-transform: scale(1.1) rotate(-3deg);
}
100% {
-moz-transform: scale(1) rotate(0);
}
}
@-o-keyframes tada {
0% {
-o-transform: scale(1);
}
10%,
20% {
-o-transform: scale(0.9) rotate(-3deg);
}
30%,
50%,
70%,
90% {
-o-transform: scale(1.1) rotate(3deg);
}
40%,
60%,
80% {
-o-transform: scale(1.1) rotate(-3deg);
}
100% {
-o-transform: scale(1) rotate(0);
}
}
@keyframes tada {
0% {
transform: scale(1);
}
10%,
20% {
transform: scale(0.9) rotate(-3deg);
}
30%,
50%,
70%,
90% {
transform: scale(1.1) rotate(3deg);
}
40%,
60%,
80% {
transform: scale(1.1) rotate(-3deg);
}
100% {
transform: scale(1) rotate(0);
}
}
@-webkit-keyframes pulse {
0% {
-webkit-transform: scale(1);
opacity: 1;
}
50% {
-webkit-transform: scale(0.9);
opacity: 0.7;
}
100% {
-webkit-transform: scale(1);
opacity: 1;
}
}
@-o-keyframes pulse {
0% {
-o-transform: scale(1);
opacity: 1;
}
50% {
-o-transform: scale(0.9);
opacity: 0.7;
}
100% {
-o-transform: scale(1);
opacity: 1;
}
}
@-moz-keyframes pulse {
0% {
-moz-transform: scale(1);
opacity: 1;
}
50% {
-moz-transform: scale(0.9);
opacity: 0.7;
}
100% {
-moz-transform: scale(1);
opacity: 1;
}
}
@keyframes pulse {
0% {
transform: scale(1);
opacity: 1;
}
50% {
transform: scale(0.9);
opacity: 0.7;
}
100% {
transform: scale(1);
opacity: 1;
}
}
/*--------------
Flips
---------------*/
/* Horizontal */
@-webkit-keyframes horizontalFlip {
0% {
-webkit-transform: rotateY(-90deg);
opacity: 0;
}
100% {
-webkit-transform: rotateY(0deg);
opacity: 1;
}
}
@-moz-keyframes horizontalFlip {
0% {
-moz-transform: rotateY(-90deg);
opacity: 0;
}
100% {
-moz-transform: rotateY(0deg);
opacity: 1;
}
}
@-o-keyframes horizontalFlip {
0% {
-o-transform: rotateY(-90deg);
opacity: 0;
}
100% {
-o-transform: rotateY(0deg);
opacity: 1;
}
}
@keyframes horizontalFlip {
0% {
transform: rotateY(-90deg);
opacity: 0;
}
100% {
transform: rotateY(0deg);
opacity: 1;
}
}
/* Horizontal */
@-webkit-keyframes horizontalFlipOut {
0% {
-webkit-transform: rotateY(0deg);
opacity: 0;
}
100% {
-webkit-transform: rotateY(90deg);
opacity: 1;
}
}
@-moz-keyframes horizontalFlipOut {
0% {
-moz-transform: rotateY(0deg);
opacity: 0;
}
100% {
-moz-transform: rotateY(90deg);
opacity: 1;
}
}
@-o-keyframes horizontalFlipOut {
0% {
-o-transform: rotateY(0deg);
opacity: 0;
}
100% {
-o-transform: rotateY(90deg);
opacity: 1;
}
}
@keyframes horizontalFlipOut {
0% {
transform: rotateY(0deg);
opacity: 0;
}
100% {
transform: rotateY(90deg);
opacity: 1;
}
}
/* Vertical */
@-webkit-keyframes verticalFlip {
0% {
-webkit-transform: rotateX(-90deg);
opacity: 0;
}
100% {
-webkit-transform: rotateX(0deg);
opacity: 1;
}
}
@-moz-keyframes verticalFlip {
0% {
-moz-transform: rotateX(-90deg);
opacity: 0;
}
100% {
-moz-transform: rotateX(0deg);
opacity: 1;
}
}
@-o-keyframes verticalFlip {
0% {
-o-transform: rotateX(-90deg);
opacity: 0;
}
100% {
-o-transform: rotateX(0deg);
opacity: 1;
}
}
@keyframes verticalFlip {
0% {
transform: rotateX(-90deg);
opacity: 0;
}
100% {
transform: rotateX(0deg);
opacity: 1;
}
}
@-webkit-keyframes verticalFlipOut {
0% {
-webkit-transform: rotateX(0deg);
opacity: 1;
}
100% {
-webkit-transform: rotateX(-90deg);
opacity: 0;
}
}
@-moz-keyframes verticalFlipOut {
0% {
-moz-transform: rotateX(0deg);
opacity: 1;
}
100% {
-moz-transform: rotateX(-90deg);
opacity: 0;
}
}
@-o-keyframes verticalFlipOut {
0% {
-o-transform: rotateX(0deg);
opacity: 1;
}
100% {
-o-transform: rotateX(-90deg);
opacity: 0;
}
}
@keyframes verticalFlipOut {
0% {
transform: rotateX(0deg);
opacity: 1;
}
100% {
transform: rotateX(-90deg);
opacity: 0;
}
}
/*--------------
Fades
---------------*/
/* Fade */
@-webkit-keyframes fade {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
@-moz-keyframes fade {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
@-o-keyframes fade {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
@keyframes fade {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
@-webkit-keyframes fadeOut {
0% {
opacity: 1;
}
100% {
opacity: 0;
}
}
@-moz-keyframes fadeOut {
0% {
opacity: 1;
}
100% {
opacity: 0;
}
}
@-o-keyframes fadeOut {
0% {
opacity: 1;
}
100% {
opacity: 0;
}
}
@keyframes fadeOut {
0% {
opacity: 1;
}
100% {
opacity: 0;
}
}
/* Fade Up */
@-webkit-keyframes fadeUp {
0% {
opacity: 0;
-webkit-transform: translateY(20px);
}
100% {
opacity: 1;
-webkit-transform: translateY(0);
}
}
@-moz-keyframes fadeUp {
0% {
opacity: 0;
-moz-transform: translateY(20px);
}
100% {
opacity: 1;
-moz-transform: translateY(0);
}
}
@-o-keyframes fadeUp {
0% {
opacity: 0;
-o-transform: translateY(20px);
}
100% {
opacity: 1;
-o-transform: translateY(0);
}
}
@keyframes fadeUp {
0% {
opacity: 0;
transform: translateY(20px);
}
100% {
opacity: 1;
transform: translateY(0);
}
}
@-webkit-keyframes fadeUpOut {
0% {
opacity: 1;
-webkit-transform: translateY(0);
}
100% {
opacity: 0;
-webkit-transform: translateY(20px);
}
}
@-moz-keyframes fadeUpOut {
0% {
opacity: 1;
-moz-transform: translateY(0);
}
100% {
opacity: 0;
-moz-transform: translateY(20px);
}
}
@-o-keyframes fadeUpOut {
0% {
opacity: 1;
-o-transform: translateY(0);
}
100% {
opacity: 0;
-o-transform: translateY(20px);
}
}
@keyframes fadeUpOut {
0% {
opacity: 1;
transform: translateY(0);
}
100% {
opacity: 0;
transform: translateY(20px);
}
}
/* Fade Down */
@-webkit-keyframes fadeDown {
0% {
opacity: 0;
-webkit-transform: translateY(-20px);
}
100% {
opacity: 1;
-webkit-transform: translateY(0);
}
}
@-moz-keyframes fadeDown {
0% {
opacity: 0;
-moz-transform: translateY(-20px);
}
100% {
opacity: 1;
-moz-transform: translateY(0);
}
}
@-o-keyframes fadeDown {
0% {
opacity: 0;
-o-transform: translateY(-20px);
}
100% {
opacity: 1;
-o-transform: translateY(0);
}
}
@keyframes fadeDown {
0% {
opacity: 0;
transform: translateY(-20px);
}
100% {
opacity: 1;
transform: translateY(0);
}
}
@-webkit-keyframes fadeDownOut {
0% {
opacity: 1;
-webkit-transform: translateY(0);
}
100% {
opacity: 0;
-webkit-transform: translateY(-20px);
}
}
@-moz-keyframes fadeDownOut {
0% {
opacity: 1;
-moz-transform: translateY(0);
}
100% {
opacity: 0;
-moz-transform: translateY(-20px);
}
}
@-o-keyframes fadeDownOut {
0% {
opacity: 1;
-o-transform: translateY(0);
}
100% {
opacity: 0;
-o-transform: translateY(-20px);
}
}
@keyframes fadeDownOut {
0% {
opacity: 1;
transform: translateY(0);
}
100% {
opacity: 0;
transform: translateY(-20px);
}
}
/*--------------
Scale
---------------*/
/* Scale */
@-webkit-keyframes scale {
0% {
opacity: 0;
-webkit-transform: scale(0.7);
}
100% {
opacity: 1;
-webkit-transform: scale(1);
}
}
@-moz-keyframes scale {
0% {
opacity: 0;
-moz-transform: scale(0.7);
}
100% {
opacity: 1;
-moz-transform: scale(1);
}
}
@-o-keyframes scale {
0% {
opacity: 0;
-o-transform: scale(0.7);
}
100% {
opacity: 1;
-o-transform: scale(1);
}
}
@keyframes scale {
0% {
opacity: 0;
transform: scale(0.7);
}
100% {
opacity: 1;
transform: scale(1);
}
}
@-webkit-keyframes scaleOut {
0% {
opacity: 1;
-webkit-transform: scale(1);
}
100% {
opacity: 0;
-webkit-transform: scale(0.7);
}
}
@-moz-keyframes scaleOut {
0% {
opacity: 1;
-moz-transform: scale(1);
}
100% {
opacity: 0;
-moz-transform: scale(0.7);
}
}
@-o-keyframes scaleOut {
0% {
opacity: 1;
-o-transform: scale(1);
}
100% {
opacity: 0;
-o-transform: scale(0.7);
}
}
@keyframes scaleOut {
0% {
opacity: 1;
transform: scale(1);
}
100% {
opacity: 0;
transform: scale(0.7);
}
}
/*
* # Semantic - Video
* http://github.com/jlukic/semantic-ui/
*
*
* Copyright 2013 Contributors
* Released under the MIT license
* http://opensource.org/licenses/MIT
*
*/
/*******************************
Video
*******************************/
.ui.video {
position: relative;
max-width: 100%;
}
/*--------------
Content
---------------*/
/* Placeholder Image */
.ui.video .placeholder {
background-color: #333333;
}
/* Play Icon Overlay */
.ui.video .play {
cursor: pointer;
position: absolute;
top: 0px;
left: 0px;
z-index: 10;
width: 100%;
height: 100%;
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=60)";
filter: alpha(opacity=60);
opacity: 0.6;
-webkit-transition: opacity 0.3s;
-moz-transition: opacity 0.3s;
-o-transition: opacity 0.3s;
-ms-transition: opacity 0.3s;
transition: opacity 0.3s;
}
.ui.video .play.icon:before {
position: absolute;
top: 50%;
left: 50%;
z-index: 11;
font-size: 6rem;
margin: -3rem 0em 0em -3rem;
color: #FFFFFF;
text-shadow: 0px 3px 3px rgba(0, 0, 0, 0.4);
}
.ui.video .placeholder {
display: block;
width: 100%;
height: 100%;
}
/* IFrame Embed */
.ui.video .embed {
display: none;
}
/*******************************
States
*******************************/
/*--------------
Hover
---------------*/
.ui.video .play:hover {
opacity: 1;
}
/*--------------
Active
---------------*/
.ui.video.active .play,
.ui.video.active .placeholder {
display: none;
}
.ui.video.active .embed {
display: block;
}
/*
* # Semantic Comment View
* http://github.com/jlukic/semantic-ui/
*
*
* Copyright 2013 Contributors
* Released under the MIT license
* http://opensource.org/licenses/MIT
*
* Released: April 17 2013
*/
/*******************************
Standard
*******************************/
/*--------------
Comments
---------------*/
.ui.comments a {
cursor: pointer;
}
/*--------------
Comment
---------------*/
.ui.comments .comment {
position: relative;
margin-top: 0.5em;
padding-top: 0.5em;
}
.ui.comments .comment:first-child {
margin-top: 0em;
padding-top: 0em;
}
/*--------------------
Avatar (Optional)
---------------------*/
.ui.comments .comment .avatar {
display: block;
float: left;
width: 4em;
}
.ui.comments .comment .avatar img {
display: block;
margin: 0em auto;
width: 3em;
height: 3em;
border-radius: 500px;
}
/*--------------
Content
---------------*/
.ui.comments .comment > .content,
.ui.comments .comment > .avatar {
display: block;
}
.ui.comments .comment .avatar ~ .content {
padding: 0em 1em;
}
/* If there is an avatar move content over */
.ui.comments .comment > .avatar ~ .content {
padding-top: 0.25em;
margin-left: 3.5em;
}
.ui.comments .comment .metadata {
display: inline-block;
margin-left: 0.3em;
color: rgba(0, 0, 0, 0.4);
}
.ui.comments .comment .metadata > * {
display: inline-block;
margin: 0em 0.3em 0em 0em;
}
/*--------------------
Comment Text
---------------------*/
.ui.comments .comment .text {
margin: 0.25em 0em 0.5em;
word-wrap: break-word;
}
/*--------------------
User Actions
---------------------*/
.ui.comments .comment .actions {
font-size: 0.9em;
}
.ui.comments .comment .actions a {
display: inline-block;
margin: 0em 0.3em 0em 0em;
color: rgba(0, 0, 0, 0.3);
}
.ui.comments .comment .actions a.active,
.ui.comments .comment .actions a:hover {
color: rgba(0, 0, 0, 0.6);
}
/*--------------------
Reply Form
---------------------*/
.ui.comments .reply.form {
margin-top: 0.75em;
width: 100%;
max-width: 30em;
}
.ui.comments .comment .reply.form {
margin-left: 2em;
}
.ui.comments > .reply.form {
margin-top: 1.5em;
max-width: 40em;
}
.ui.comments .reply.form textarea {
height: 12em;
}
/*--------------------
Nested Comments
---------------------*/
.ui.comments .comment .comments {
margin-top: 0.5em;
padding-top: 0.5em;
padding-bottom: 1em;
}
.ui.comments .comment .comments:before {
position: absolute;
top: 0px;
left: 0px;
}
/* One Deep */
.ui.comments > .comment .comments {
margin-left: 2em;
}
/* Two Deep */
.ui.comments > .comment > .comments > .comment > .comments {
margin-left: 1.75em;
}
/* Three Deep */
.ui.comments > .comment > .comments > .comment > .comments > .comment > .comments {
margin-left: 1.5em;
}
/* Four Deep or more */
.ui.comments > .comment > .comments > .comment > .comments > .comment > .comments > .comment .comments {
margin-left: 0.5em;
}
/*******************************
Variations
*******************************/
/*--------------------
Threaded
---------------------*/
.ui.threaded.comments .comment .comments {
margin-left: 2em !important;
padding-left: 2em !important;
-webkit-box-shadow: -1px 0px 0px rgba(0, 0, 0, 0.05);
-moz-box-shadow: -1px 0px 0px rgba(0, 0, 0, 0.05);
box-shadow: -1px 0px 0px rgba(0, 0, 0, 0.05);
}
/*--------------------
Minimal
---------------------*/
.ui.minimal.comments .comment .actions {
opacity: 0;
-webkit-transition: opacity 0.1s ease-out;
-moz-transition: opacity 0.1s ease-out;
-o-transition: opacity 0.1s ease-out;
-ms-transition: opacity 0.1s ease-out;
transition: opacity 0.1s ease-out;
-webkit-transition-delay: 0.1s;
-moz-transition-delay: 0.1s;
-o-transition-delay: 0.1s;
-ms-transition-delay: 0.1s;
transition-delay: 0.1s;
}
.ui.minimal.comments .comment > .content:hover > .actions {
opacity: 1;
}
/*--------------------
Sizes
---------------------*/
.ui.small.comments {
font-size: 0.875em;
}
/*
* # Activity Feed View
* http://github.com/jlukic/semantic-ui/
*
*
* Copyright 2013 Contributors
* Released under the MIT license
* http://opensource.org/licenses/MIT
*
* Released: May 22, 2013
*/
/*******************************
Activity Feed
*******************************/
.ui.feed a {
cursor: pointer;
}
.ui.feed,
.ui.feed .event,
.ui.feed .label,
.ui.feed .content,
.ui.feed .extra {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
-ms-box-sizing: border-box;
box-sizing: border-box;
}
/*******************************
Content
*******************************/
/* Event */
.ui.feed .event {
width: 100%;
display: table;
padding: 1em;
}
.ui.feed .event:first-child {
border-top: 0px;
}
.ui.feed .event:last-child {
margin-bottom: 1em;
}
/* Event Label */
.ui.feed .label {
width: 3em;
display: table-cell;
vertical-align: top;
text-align: left;
}
.ui.feed .label .icon {
font-size: 1.5em;
padding: 0.5em;
margin: 0em;
}
.ui.feed .label img {
width: 3em;
margin: 0em;
border-radius: 50em;
}
.ui.feed .label + .content {
padding: 0.75em 1em 0em;
}
/* Content */
.ui.feed .content {
display: table-cell;
vertical-align: top;
text-align: left;
word-wrap: break-word;
}
/* Date */
.ui.feed .content .date {
float: right;
padding-left: 1em;
color: rgba(0, 0, 0, 0.4);
}
/* Summary */
.ui.feed .content .summary {
color: rgba(0, 0, 0, 0.75);
}
.ui.feed .content .summary img {
display: inline-block;
margin-right: 0.25em;
width: 4em;
border-radius: 500px;
}
/* Additional Information */
.ui.feed .content .extra {
margin: 1em 0em 0em;
padding: 0.5em 0em 0em;
color: rgba(0, 0, 0, 0.5);
}
.ui.feed .content .extra.images img {
display: inline-block;
margin-right: 0.25em;
width: 6em;
}
.ui.feed .content .extra.text {
padding: 0.5em 1em;
border-left: 0.2em solid rgba(0, 0, 0, 0.1);
}
/*******************************
Variations
*******************************/
.ui.small.feed {
font-size: 0.875em;
}
.ui.small.feed .label img {
width: 2.5em;
}
.ui.small.feed .label .icon {
font-size: 1.25em;
}
.ui.feed .event {
padding: 0.75em 0em;
}
.ui.small.feed .label + .content {
padding: 0.5em 0.5em 0;
}
.ui.small.feed .content .extra.images img {
width: 5em;
}
.ui.small.feed .content .extra {
margin: 0.5em 0em 0em;
}
.ui.small.feed .content .extra.text {
padding: 0.25em 0.5em;
}
/*
* # Semantic Item View
* http://github.com/jlukic/semantic-ui/
*
*
* Copyright 2013 Contributors
* Released under the MIT license
* http://opensource.org/licenses/MIT
*
* Released: April 17 2013
*/
/*******************************
Standard
*******************************/
/*--------------
Items
---------------*/
.ui.items {
margin: 1em 0em 0em;
}
.ui.items:first-child {
margin-top: 0em;
}
.ui.items:last-child {
margin-bottom: -1em;
}
/* Force Clearing */
.ui.items:after {
display: block;
content: ' ';
height: 0px;
clear: both;
overflow: hidden;
visibility: hidden;
}
/*--------------
Item
---------------*/
.ui.items > .row > .item,
.ui.items > .item {
display: block;
float: left;
position: relative;
top: 0px;
width: 316px;
min-height: 375px;
margin: 0em 0.5em 2.5em;
padding: 0em;
background-color: #FFFFFF;
line-height: 1.2;
font-size: 1em;
-moz-box-shadow: 0px 0px 0px 1px rgba(0, 0, 0, 0.1);
-webkit-box-shadow: 0px 0px 0px 1px rgba(0, 0, 0, 0.1);
box-shadow: 0px 0px 0px 1px rgba(0, 0, 0, 0.1);
border-bottom: 0.2em solid rgba(0, 0, 0, 0.2);
-moz-border-radius: 0.33em;
-webkit-border-radius: 0.33em;
border-radius: 0.33em;
-webkit-transition: box-shadow 0.2s ease;
-moz-transition: box-shadow 0.2s ease;
-o-transition: box-shadow 0.2s ease;
-ms-transition: box-shadow 0.2s ease;
transition: box-shadow 0.2s ease;
padding: 0.5em;
}
.ui.items a.item,
.ui.items .item a {
cursor: pointer;
}
.ui.items .item,
.ui.items .item > .image,
.ui.items .item > .image .overlay,
.ui.items .item > .content,
.ui.items .item > .content > .meta,
.ui.items .item > .content > .extra {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
-ms-box-sizing: border-box;
box-sizing: border-box;
}
/*--------------
Images
---------------*/
.ui.items .item > .image {
display: block;
position: relative;
background-color: rgba(0, 0, 0, 0.05);
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
-ms-box-sizing: border-box;
box-sizing: border-box;
-webkit-border-radius: 0.2em;
-moz-border-radius: 0.2em;
border-radius: 0.2em;
}
.ui.items .item > .image > img {
display: block;
width: 100%;
}
/*--------------
Content
---------------*/
.ui.items .item > .content {
padding: 0.75em 0.5em;
}
.ui.items .item > .content > .name {
display: block;
font-size: 1.25em;
font-weight: bold;
margin-bottom: 0.2em;
color: rgba(0, 0, 0, 0.7);
}
.ui.items .item > .content > .description {
clear: both;
margin: 0em 0em;
color: rgba(0, 0, 0, 0.45);
}
.ui.items .item > .content > .description p {
margin: 0em 0em 0.2em;
}
.ui.items .item > .content > .description p:last-child {
margin-bottom: 0em;
}
/*--------------
Meta
---------------*/
.ui.items .item .meta {
float: right;
color: rgba(0, 0, 0, 0.35);
}
.ui.items .item > .content > .meta + .name {
float: left;
}
/*--------------
Labels
---------------*/
/*-----star----- */
/* hover */
.ui.items .item .star.label:hover::after {
border-right-color: #F6EFC3;
}
.ui.items .item .star.label:hover::after {
border-top-color: #F6EFC3;
}
.ui.items .item .star.label:hover .icon {
color: #ac9400;
}
/* active */
.ui.items .item .star.label.active::after {
border-right-color: #F6EFC3;
}
.ui.items .item .star.label.active::after {
border-top-color: #F6EFC3;
}
.ui.items .item .star.label.active .icon {
color: #ac9400;
}
/*-----like----- */
/* hover */
.ui.items .item .like.label:hover::after {
border-right-color: #F5E1E2;
}
.ui.items .item .like.label.active::after {
border-top-color: #F5E1E2;
}
.ui.items .item .like.label:hover .icon {
color: #ef404a;
}
/* active */
.ui.items .item .like.label.active::after {
border-right-color: #F5E1E2;
}
.ui.items .item .like.label.active::after {
border-top-color: #F5E1E2;
}
.ui.items .item .like.label.active .icon {
color: #ef404a;
}
/*--------------
Extra
---------------*/
.ui.items .item .extra {
position: absolute;
width: 100%;
padding: 0em 0.5em;
bottom: -2em;
left: 0em;
height: 1.5em;
color: rgba(0, 0, 0, 0.25);
-webkit-transition: color 0.2s ease;
-moz-transition: color 0.2s ease;
-o-transition: color 0.2s ease;
-ms-transition: color 0.2s ease;
transition: color 0.2s ease;
}
.ui.items .item .extra > img {
display: inline-block;
border-radius: 500px 500px 500px 500px;
margin-right: 0.25em;
vertical-align: middle;
width: 2em;
}
.ui.items .item .extra .left {
float: left;
}
.ui.items .item .extra .right {
float: right;
}
/*******************************
States
*******************************/
.ui.items .item:hover {
cursor: pointer;
z-index: 5;
box-shadow: 0px 0px 0px 1px rgba(0, 0, 0, 0.2);
}
.ui.items .item:hover .extra {
color: rgba(0, 0, 0, 0.5);
}
.ui.items .item:nth-of-type(n+1):hover {
border-bottom-color: #6ECFF5 !important;
}
.ui.items .item:nth-of-type(n+2):hover {
border-bottom-color: #5C6166 !important;
}
.ui.items .item:nth-of-type(n+3):hover {
border-bottom-color: #A1CF64 !important;
}
.ui.items .item:nth-of-type(n+4):hover {
border-bottom-color: #D95C5C !important;
}
.ui.items .item:nth-of-type(n+5):hover {
border-bottom-color: #564F8A !important;
}
.ui.items .item:nth-of-type(n+6):hover {
border-bottom-color: #00B5AD !important;
}
/*******************************
Variations
*******************************/
/*--------------
Connected
---------------*/
.ui.connected.items {
display: table;
width: 100%;
margin-left: 0em !important;
margin-right: 0em !important;
}
.ui.connected.items > .row > .item,
.ui.connected.items > .item {
float: none;
display: table-cell;
vertical-align: top;
height: auto;
border-radius: 0px;
margin: 0em;
width: 33.33%;
}
.ui.connected.items > .row {
display: table;
margin: 0.5em 0em;
}
.ui.connected.items > .row:first-child {
margin-top: 0em;
}
/* Borders */
.ui.connected.items > .item,
.ui.connected.items > .row:last-child > .item {
border-bottom: 0.2em solid rgba(0, 0, 0, 0.2);
}
.ui.connected.items > .row:last-child > .item:first-child,
.ui.connected.items > .item:first-child {
border-radius: 0em 0em 0em 0.33em;
}
.ui.connected.items > .row:last-child > .item:last-child,
.ui.connected.items > .item:last-child {
border-radius: 0em 0em 0.33em 0em;
}
/* Hover */
.ui.connected.items .item:hover {
border-bottom-width: 0.2em;
}
/* Item Count */
.ui.one.connected.items > .row > .item,
.ui.one.connected.items > .item {
width: 50%;
padding-left: 2%;
padding-right: 2%;
}
.ui.two.connected.items > .row > .item,
.ui.two.connected.items > .item {
width: 50%;
padding-left: 1%;
padding-right: 1%;
}
.ui.three.connected.items > .row > .item,
.ui.three.connected.items > .item {
width: 33.333%;
padding-left: 1%;
padding-right: 1%;
}
.ui.four.connected.items > .row > .item,
.ui.four.connected.items > .item {
width: 25%;
padding-left: 0.5%;
padding-right: 0.5%;
}
.ui.five.connected.items > .row > .item,
.ui.five.connected.items > .item {
width: 20%;
padding-left: 0.5%;
padding-right: 0.5%;
}
.ui.six.connected.items > .row > .item,
.ui.six.connected.items > .item {
width: 16.66%;
padding-left: 0.5%;
padding-right: 0.5%;
}
.ui.seven.connected.items > .row > .item,
.ui.seven.connected.items > .item {
width: 14.28%;
padding-left: 0.5%;
padding-right: 0.5%;
}
.ui.eight.connected.items > .row > .item,
.ui.eight.connected.items > .item {
width: 12.5%;
padding-left: 0.25%;
padding-right: 0.25%;
}
.ui.nine.connected.items > .row > .item,
.ui.nine.connected.items > .item {
width: 11.11%;
padding-left: 0.25%;
padding-right: 0.25%;
}
.ui.ten.connected.items > .row > .item,
.ui.ten.connected.items > .item {
width: 10%;
padding-left: 0.2%;
padding-right: 0.2%;
}
.ui.eleven.connected.items > .row > .item,
.ui.eleven.connected.items > .item {
width: 9.09%;
padding-left: 0.2%;
padding-right: 0.2%;
}
.ui.twelve.connected.items > .row > .item,
.ui.twelve.connected.items > .item {
width: 8.3333%;
padding-left: 0.1%;
padding-right: 0.1%;
}
/*-------------------
Responsive
--------------------*/
@media only screen and (max-width: 768px) {
.ui.stackable.items {
display: block !important;
}
.ui.stackable.items > .item,
.ui.stackable.items > .row > .item {
display: block !important;
height: auto !important;
width: auto !important;
padding: 0% !important;
}
}
/*--------------------
Horizontal
---------------------*/
.ui.horizontal.items > .item,
.ui.items > .horizontal.item {
display: table;
}
.ui.horizontal.items > .item > .image .ui.items > .horizontal.item > .image {
display: table-cell;
width: 50%;
}
.ui.horizontal.items > .item > .image + .content,
.ui.items > .horizontal.item > .image + .content {
width: 50%;
display: table-cell;
}
.ui.horizontal.items > .item > .content,
.ui.items > .horizontal.item > .content {
padding: 1% 1.7% 11% 3%;
vertical-align: top;
}
.ui.horizontal.items > .item > .meta,
.ui.items > .horizontal.item > .meta {
position: absolute;
padding: 0%;
bottom: 7%;
left: 3%;
width: 94%;
}
.ui.horizontal.items > .item > .image + .content + .meta,
.ui.items > .horizontal.item > .image + .content + .meta {
bottom: 7%;
left: 53%;
width: 44%;
}
.ui.horizontal.items > .item .avatar,
.ui.items > .horizontal.item .avatar {
width: 11.5%;
}
.ui.items > .item .avatar {
max-width: 25px;
}
/*--------------
Item Count
---------------*/
.ui.one.items {
margin-left: -2%;
margin-right: -2%;
}
.ui.one.items > .item {
width: 100%;
margin-left: 2%;
margin-right: 2%;
}
.ui.two.items {
margin-left: -1%;
margin-right: -1%;
}
.ui.two.items > .item {
width: 48%;
margin-left: 1%;
margin-right: 1%;
}
.ui.two.items > .item:nth-child(2n+1) {
clear: left;
}
.ui.three.items {
margin-left: -1%;
margin-right: -1%;
}
.ui.three.items > .item {
width: 31.333%;
margin-left: 1%;
margin-right: 1%;
}
.ui.three.items > .item:nth-child(3n+1) {
clear: left;
}
.ui.four.items {
margin-left: -0.5%;
margin-right: -0.5%;
}
.ui.four.items > .item {
width: 24%;
margin-left: 0.5%;
margin-right: 0.5%;
}
.ui.four.items > .item:nth-child(4n+1) {
clear: left;
}
.ui.five.items {
margin-left: -0.5%;
margin-right: -0.5%;
}
.ui.five.items > .item {
width: 19%;
margin-left: 0.5%;
margin-right: 0.5%;
}
.ui.five.items > .item:nth-child(5n+1) {
clear: left;
}
.ui.six.items {
margin-left: -0.5%;
margin-right: -0.5%;
}
.ui.six.items > .item {
width: 15.66%;
margin-left: 0.5%;
margin-right: 0.5%;
}
.ui.six.items > .item:nth-child(6n+1) {
clear: left;
}
.ui.seven.items {
margin-left: -0.5%;
margin-right: -0.5%;
}
.ui.seven.items > .item {
width: 13.28%;
margin-left: 0.5%;
margin-right: 0.5%;
font-size: 11px;
}
.ui.seven.items > .item:nth-child(7n+1) {
clear: left;
}
.ui.eight.items {
margin-left: -0.25%;
margin-right: -0.25%;
}
.ui.eight.items > .item {
width: 12.0%;
margin-left: 0.25%;
margin-right: 0.25%;
font-size: 11px;
}
.ui.eight.items > .item:nth-child(8n+1) {
clear: left;
}
.ui.nine.items {
margin-left: -0.25%;
margin-right: -0.25%;
}
.ui.nine.items > .item {
width: 10.61%;
margin-left: 0.25%;
margin-right: 0.25%;
font-size: 10px;
}
.ui.nine.items > .item:nth-child(9n+1) {
clear: left;
}
.ui.ten.items {
margin-left: -0.2%;
margin-right: -0.2%;
}
.ui.ten.items > .item {
width: 9.6%;
margin-left: 0.2%;
margin-right: 0.2%;
font-size: 10px;
}
.ui.ten.items > .item:nth-child(10n+1) {
clear: left;
}
.ui.eleven.items {
margin-left: -0.2%;
margin-right: -0.2%;
}
.ui.eleven.items > .item {
width: 8.69%;
margin-left: 0.2%;
margin-right: 0.2%;
font-size: 9px;
}
.ui.eleven.items > .item:nth-child(11n+1) {
clear: left;
}
.ui.twelve.items {
margin-left: -0.1%;
margin-right: -0.1%;
}
.ui.twelve.items > .item {
width: 8.1333%;
margin-left: 0.1%;
margin-right: 0.1%;
font-size: 9px;
}
.ui.twelve.items > .item:nth-child(12n+1) {
clear: left;
}
/*
* # Semantic List - Flat
* http://github.com/jlukic/semantic-ui/
*
*
* Copyright 2013 Contributors
* Released under the MIT license
* http://opensource.org/licenses/MIT
*
* Released: April 26 2013
*/
/*******************************
List
*******************************/
ul.ui.list,
ol.ui.list,
.ui.list {
list-style-type: none;
margin: 1em 0em;
padding: 0em;
}
ul.ui.list ul,
ol.ui.list ol,
.ui.list .list {
margin: 0em;
padding: 0.5em 0em 0.5em 1em;
}
ul.ui.list:first-child,
ol.ui.list:first-child,
.ui.list:first-child {
margin-top: 0em;
}
ul.ui.list:last-child,
ol.ui.list:last-child,
.ui.list:last-child {
margin-bottom: 0em;
}
/*******************************
Content
*******************************/
/* List Item */
ul.ui.list li,
ol.ui.list li,
.ui.list .item {
display: list-item;
list-style-type: none;
list-style-position: inside;
padding: 0.3em 0em;
line-height: 1.2;
}
.ui.list .item:after {
content: '';
display: block;
height: 0;
clear: both;
visibility: hidden;
}
/* Icon */
.ui.list .item > .icon {
display: table-cell;
margin: 0em;
padding: 0.1em 0.5em 0em 0em;
vertical-align: top;
}
.ui.list .item > .icon:only-child {
display: inline-block;
}
.ui.horizontal.list .item > .icon {
padding: 0em 0.25em 0em 0em;
}
/* Image */
.ui.list .item > img {
display: inline-block;
width: 2em;
margin-right: 0.5em;
vertical-align: middle;
-webkit-border-radius: 0.2em;
-moz-border-radius: 0.2em;
border-radius: 0.2em;
}
/* Content */
.ui.list .item > .content {
display: inline-block;
vertical-align: middle;
line-height: 1.2;
}
.ui.list .item > .icon + .content {
display: table-cell;
vertical-align: top;
padding-left: 0.5em;
}
/* Link */
.ui.list a {
cursor: pointer;
}
.ui.list a .icon {
color: rgba(0, 0, 0, 0.6);
-webkit-transition: color 0.2s ease;
-moz-transition: color 0.2s ease;
-o-transition: color 0.2s ease;
-ms-transition: color 0.2s ease;
transition: color 0.2s ease;
}
/* Header */
.ui.list .header {
font-weight: bold;
}
.ui.list .description {
color: rgba(0, 0, 0, 0.5);
}
/* Floated Content */
.ui.list .item > .left.floated {
margin-right: 1em;
float: left;
}
.ui.list .item > .right.floated {
margin-left: 1em;
float: right;
}
/*******************************
Types
*******************************/
/*-------------------
Horizontal
--------------------*/
.ui.horizontal.list {
display: inline-block;
font-size: 0em;
}
.ui.horizontal.list .item {
display: inline-block;
margin-left: 1em;
font-size: 1rem;
}
.ui.horizontal.list .item:first-child {
margin-left: 0em;
}
/*******************************
States
*******************************/
/*-------------------
Hover
--------------------*/
.ui.list a:hover .icon {
color: rgba(0, 0, 0, 0.8);
}
/*******************************
Variations
*******************************/
/*-------------------
Link
--------------------*/
.ui.link.list .item {
color: rgba(0, 0, 0, 0.4);
}
.ui.link.list a.item,
.ui.link.list .item a {
color: rgba(0, 0, 0, 0.6);
}
.ui.link.list a.item:hover,
.ui.link.list .item a:hover {
color: rgba(0, 0, 0, 0.8);
}
.ui.link.list a.item:active,
.ui.link.list .item a:active {
color: rgba(0, 0, 0, 0.9);
}
.ui.link.list a.active.item,
.ui.link.list .active.item a {
color: rgba(0, 0, 0, 0.8);
}
/*-------------------
Selection
--------------------*/
.ui.selection.list .item {
cursor: pointer;
color: rgba(0, 0, 0, 0.4);
padding: 0.5em;
-webkit-transition: 0.2s color ease, 0.2s padding-left ease, 0.2s background-color ease;
-moz-transition: 0.2s color ease, 0.2s padding-left ease, 0.2s background-color ease;
-o-transition: 0.2s color ease, 0.2s padding-left ease, 0.2s background-color ease;
-ms-transition: 0.2s color ease, 0.2s padding-left ease, 0.2s background-color ease;
transition: 0.2s color ease, 0.2s padding-left ease, 0.2s background-color ease;
}
.ui.selection.list .item:hover {
background-color: rgba(0, 0, 0, 0.02);
color: rgba(0, 0, 0, 0.7);
}
.ui.selection.list:not(.horizontal, .ordered) .item:hover {
padding-left: 1em;
}
.ui.selection.list:not(.horizontal, .ordered) .item:hover .item:hover {
padding-left: 0.5em;
}
.ui.selection.list .item:active {
background-color: rgba(0, 0, 0, 0.05);
color: rgba(0, 0, 0, 0.7);
}
.ui.selection.list .item.active {
background-color: rgba(0, 0, 0, 0.04);
color: rgba(0, 0, 0, 0.7);
}
/*-------------------
Bulleted
--------------------*/
ul.ui.list,
.ui.bulleted.list {
margin-left: 1.5em;
}
ul.ui.list li,
.ui.bulleted.list .item {
position: relative;
}
ul.ui.list li:before,
.ui.bulleted.list .item:before {
position: absolute;
left: -1.5em;
content: '•';
line-height: 1.2rem;
vertical-align: top;
}
ul.ui.list ul,
.ui.bulleted.list .list {
padding-left: 1.5em;
}
/* Horizontal Bulleted */
ul.ui.horizontal.bulleted.list,
.ui.horizontal.bulleted.list {
margin-left: 0em;
}
ul.ui.horizontal.bulleted.list li,
.ui.horizontal.bulleted.list .item {
margin-left: 1.5em;
}
ul.ui.horizontal.bulleted.list li:before,
.ui.horizontal.bulleted.list .item:before {
left: -0.9em;
}
ul.ui.horizontal.bulleted.list li:first-child,
.ui.horizontal.bulleted.list .item:first-child {
margin-left: 0em;
}
ul.ui.horizontal.bulleted.list li:first-child::before,
.ui.horizontal.bulleted.list .item:first-child::before {
display: none;
}
/*-------------------
Ordered
--------------------*/
ol.ui.list,
.ui.ordered.list {
counter-reset: ordered;
margin-left: 2em;
list-style-type: none;
}
ol.ui.list li,
.ui.ordered.list .item {
list-style-type: none;
position: relative;
}
ol.ui.list li:before,
.ui.ordered.list .item:before {
position: absolute;
left: -2em;
counter-increment: ordered;
content: counters(ordered, ".");
text-align: right;
vertical-align: top;
opacity: 0.75;
}
ol.ui.list ol,
.ui.ordered.list .list {
counter-reset: ordered;
padding-left: 2.5em;
}
ol.ui.list ol li:before,
.ui.ordered.list .list .item:before {
left: -2.5em;
}
/* Horizontal Ordered */
ol.ui.horizontal.list,
.ui.ordered.horizontal.list {
margin-left: 0em;
}
ol.ui.horizontal.list li:before,
.ui.ordered.horizontal.list .item:before {
position: static;
margin: 0em 0.5em 0em 0em;
}
/*-------------------
Divided
--------------------*/
.ui.divided.list > .item,
.ui.divided.list > .list {
border-top: 1px solid rgba(0, 0, 0, 0.1);
padding-left: 0.5em;
padding-right: 0.5em;
}
.ui.divided.list .item .menu .item {
border-width: 0px;
}
.ui.divided.list .item:first-child {
border-top-width: 0px;
}
/* Sub Menu */
.ui.divided.list .list {
margin-left: -0.5em;
margin-right: -0.5em;
}
.ui.divided.list .list .item {
padding-left: 1em;
padding-right: 1em;
}
.ui.divided.list .list .item:first-child {
border-top-width: 1px;
}
/* Divided bulleted */
.ui.divided.bulleted.list {
margin-left: 0em;
}
.ui.divided.bulleted.list .item {
padding-left: 1.5em;
}
.ui.divided.bulleted.list .item:before {
left: 0.5em;
}
/* Divided ordered */
.ui.divided.ordered.list {
margin-left: 0em;
}
.ui.divided.ordered.list > .item {
padding-left: 2em;
padding-right: 2em;
}
.ui.divided.ordered.list > .item:before {
left: 0.5em;
}
.ui.divided.ordered.list .item .list {
margin-left: -2em;
margin-right: -2em;
}
/* Divided horizontal */
.ui.divided.horizontal.list {
margin-left: 0em;
}
.ui.divided.horizontal.list .item {
border-top: none;
border-left: 1px solid rgba(0, 0, 0, 0.1);
margin: 0em;
padding-left: 0.75em;
padding-right: 0.75em;
line-height: 0.6;
}
.ui.horizontal.divided.list .item:first-child {
border-left: none;
padding-left: 0em;
}
/*-------------------
Celled
--------------------*/
.ui.celled.list > .item,
.ui.celled.list > .list {
border-top: 1px solid rgba(0, 0, 0, 0.1);
padding-left: 0.5em;
padding-right: 0.5em;
}
.ui.celled.list > .item:last-child {
border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}
/* Sub Menu */
.ui.celled.list .item .list {
margin-left: -0.5em;
margin-right: -0.5em;
}
.ui.celled.list .item .list .item {
border-width: 0px;
}
.ui.celled.list .list .item:first-child {
border-top-width: 0px;
}
/* Celled Bulleted */
.ui.celled.bulleted.list {
margin-left: 0em;
}
.ui.celled.bulleted.list > .item {
padding-left: 1.5em;
}
.ui.celled.bulleted.list > .item:before {
left: 0.5em;
}
/* Celled Ordered */
.ui.celled.ordered.list {
margin-left: 0em;
}
.ui.celled.ordered.list .item {
padding-left: 2em;
padding-right: 2em;
}
.ui.celled.ordered.list .item:before {
left: 0.5em;
}
.ui.celled.ordered.list .item .list {
margin-left: -2em;
margin-right: -2em;
}
/* Celled Horizontal */
.ui.horizontal.celled.list {
margin-left: 0em;
}
.ui.horizontal.celled.list .item {
border-top: none;
border-left: 1px solid rgba(0, 0, 0, 0.1);
margin: 0em;
padding-left: 0.75em;
padding-right: 0.75em;
line-height: 0.6;
}
.ui.horizontal.celled.list .item:last-child {
border-bottom: none;
border-right: 1px solid rgba(0, 0, 0, 0.1);
}
/*-------------------
Relaxed
--------------------*/
.ui.relaxed.list:not(.horizontal) .item {
padding-top: 0.5em;
padding-bottom: 0.5em;
}
.ui.horizontal.relaxed.list .item {
padding-left: 1.25em;
padding-right: 1.25em;
}
.ui.very.relaxed.list:not(.horizontal) .item {
padding-top: 1em;
padding-bottom: 1em;
}
.ui.horizontal.very.relaxed.list .item {
padding-left: 2em;
padding-right: 2em;
}
/*-------------------
Sizes
--------------------*/
.ui.mini.list .item {
font-size: 0.7rem;
}
.ui.tiny.list .item {
font-size: 0.8125rem;
}
.ui.small.list .item {
font-size: 0.875rem;
}
.ui.list .item {
font-size: 1em;
}
.ui.large.list .item {
font-size: 1.125rem;
}
.ui.big.list .item {
font-size: 1.25rem;
}
.ui.huge.list .item {
font-size: 1.375rem;
}
.ui.massive.list .item {
font-size: 1.5rem;
}
/*
* # Statistic
*
*
* Copyright 2013 Contributors
* Released under the MIT license
* http://opensource.org/licenses/MIT
*
* Released: Aug 20, 2013
*/
/*******************************
Statistic
*******************************/
.ui.statistic {
text-align: center;
}
/*******************************
Content
*******************************/
.ui.statistic > .number {
font-size: 4em;
font-weight: bold;
color: rgba(0, 0, 0, 0.7);
}
.ui.statistic > .description {
opacity: 0.8;
}
|
"use strict";
const conversions = require("webidl-conversions");
const utils = require("./utils.js");
const HTMLElement = require("./HTMLElement.js");
const impl = utils.implSymbol;
const mixin = utils.mixin;
const WindowEventHandlers = require("./WindowEventHandlers.js");
function HTMLBodyElement() {
throw new TypeError("Illegal constructor");
}
HTMLBodyElement.prototype = Object.create(HTMLElement.interface.prototype);
HTMLBodyElement.prototype.constructor = HTMLBodyElement;
mixin(HTMLBodyElement.prototype, WindowEventHandlers.interface.prototype);
WindowEventHandlers.mixedInto.push(HTMLBodyElement);
HTMLBodyElement.prototype.toString = function () {
if (this === HTMLBodyElement.prototype) {
return "[object HTMLBodyElementPrototype]";
}
return HTMLElement.interface.prototype.toString.call(this);
};
Object.defineProperty(HTMLBodyElement.prototype, "text", {
get() {
const value = this.getAttribute("text");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V, { treatNullAsEmptyString: true });
this.setAttribute("text", V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLBodyElement.prototype, "link", {
get() {
const value = this.getAttribute("link");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V, { treatNullAsEmptyString: true });
this.setAttribute("link", V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLBodyElement.prototype, "vLink", {
get() {
const value = this.getAttribute("vLink");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V, { treatNullAsEmptyString: true });
this.setAttribute("vLink", V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLBodyElement.prototype, "aLink", {
get() {
const value = this.getAttribute("aLink");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V, { treatNullAsEmptyString: true });
this.setAttribute("aLink", V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLBodyElement.prototype, "bgColor", {
get() {
const value = this.getAttribute("bgColor");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V, { treatNullAsEmptyString: true });
this.setAttribute("bgColor", V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLBodyElement.prototype, "background", {
get() {
const value = this.getAttribute("background");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V);
this.setAttribute("background", V);
},
enumerable: true,
configurable: true
});
module.exports = {
mixedInto: [],
is(obj) {
if (obj) {
if (obj[impl] instanceof Impl.implementation) {
return true;
}
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (obj instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
isImpl(obj) {
if (obj) {
if (obj instanceof Impl.implementation) {
return true;
}
const wrapper = utils.wrapperForImpl(obj);
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (wrapper instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
create(constructorArgs, privateData) {
let obj = Object.create(HTMLBodyElement.prototype);
this.setup(obj, constructorArgs, privateData);
return obj;
},
createImpl(constructorArgs, privateData) {
let obj = Object.create(HTMLBodyElement.prototype);
this.setup(obj, constructorArgs, privateData);
return utils.implForWrapper(obj);
},
_internalSetup(obj) {
HTMLElement._internalSetup(obj);
},
setup(obj, constructorArgs, privateData) {
if (!privateData) privateData = {};
privateData.wrapper = obj;
this._internalSetup(obj);
obj[impl] = new Impl.implementation(constructorArgs, privateData);
obj[impl][utils.wrapperSymbol] = obj;
},
interface: HTMLBodyElement,
expose: {
Window: { HTMLBodyElement: HTMLBodyElement }
}
};
const Impl = require("../nodes/HTMLBodyElement-impl.js");
|
/*
* Copyright 2012 ZXing authors
*
* 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.
*/
package com.google.zxing.pdf417.decoder.ec;
import com.google.zxing.ChecksumException;
import org.junit.Ignore;
import org.junit.Test;
import java.util.Random;
/**
* @author Sean Owen
*/
public final class ErrorCorrectionTestCase extends AbstractErrorCorrectionTestCase {
private static final int[] PDF417_TEST = {
48, 901, 56, 141, 627, 856, 330, 69, 244, 900, 852, 169, 843, 895, 852, 895, 913, 154, 845, 778, 387, 89, 869,
901, 219, 474, 543, 650, 169, 201, 9, 160, 35, 70, 900, 900, 900, 900, 900, 900, 900, 900, 900, 900, 900, 900,
900, 900};
private static final int[] PDF417_TEST_WITH_EC = {
48, 901, 56, 141, 627, 856, 330, 69, 244, 900, 852, 169, 843, 895, 852, 895, 913, 154, 845, 778, 387, 89, 869,
901, 219, 474, 543, 650, 169, 201, 9, 160, 35, 70, 900, 900, 900, 900, 900, 900, 900, 900, 900, 900, 900, 900,
900, 900, 769, 843, 591, 910, 605, 206, 706, 917, 371, 469, 79, 718, 47, 777, 249, 262, 193, 620, 597, 477, 450,
806, 908, 309, 153, 871, 686, 838, 185, 674, 68, 679, 691, 794, 497, 479, 234, 250, 496, 43, 347, 582, 882, 536,
322, 317, 273, 194, 917, 237, 420, 859, 340, 115, 222, 808, 866, 836, 417, 121, 833, 459, 64, 159};
private static final int ECC_BYTES = PDF417_TEST_WITH_EC.length - PDF417_TEST.length;
private static final int ERROR_LIMIT = ECC_BYTES;
private static final int MAX_ERRORS = ERROR_LIMIT / 2;
private static final int MAX_ERASURES = ERROR_LIMIT;
private final ErrorCorrection ec = new ErrorCorrection();
@Test
public void testNoError() throws ChecksumException {
int[] received = PDF417_TEST_WITH_EC.clone();
// no errors
checkDecode(received);
}
@Test
public void testOneError() throws ChecksumException {
Random random = getRandom();
for (int i = 0; i < PDF417_TEST_WITH_EC.length; i++) {
int[] received = PDF417_TEST_WITH_EC.clone();
received[i] = random.nextInt(256);
checkDecode(received);
}
}
@Test
public void testMaxErrors() throws ChecksumException {
Random random = getRandom();
for (int testIterations = 0; testIterations < 100; testIterations++) { // # iterations is kind of arbitrary
int[] received = PDF417_TEST_WITH_EC.clone();
corrupt(received, MAX_ERRORS, random);
checkDecode(received);
}
}
@Test
public void testTooManyErrors() {
int[] received = PDF417_TEST_WITH_EC.clone();
Random random = getRandom();
corrupt(received, MAX_ERRORS + 1, random);
try {
checkDecode(received);
fail("Should not have decoded");
} catch (ChecksumException ce) {
// good
}
}
@Ignore("Erasures not implemented yet")
@Test
public void testMaxErasures() throws ChecksumException {
Random random = getRandom();
for (int test : PDF417_TEST) { // # iterations is kind of arbitrary
int[] received = PDF417_TEST_WITH_EC.clone();
int[] erasures = erase(received, MAX_ERASURES, random);
checkDecode(received, erasures);
}
}
@Ignore("Erasures not implemented yet")
@Test
public void testTooManyErasures() {
Random random = getRandom();
int[] received = PDF417_TEST_WITH_EC.clone();
int[] erasures = erase(received, MAX_ERASURES + 1, random);
try {
checkDecode(received, erasures);
fail("Should not have decoded");
} catch (ChecksumException ce) {
// good
}
}
private void checkDecode(int[] received) throws ChecksumException {
checkDecode(received, new int[0]);
}
private void checkDecode(int[] received, int[] erasures) throws ChecksumException {
ec.decode(received, ECC_BYTES, erasures);
for (int i = 0; i < PDF417_TEST.length; i++) {
assertEquals(received[i], PDF417_TEST[i]);
}
}
}
|
/*
* Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
* Copyright (C) IBM Corp. 2009 All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/**
* @extends {WebInspector.View}
* @constructor
*/
WebInspector.ResourceView = function(resource)
{
WebInspector.View.call(this);
this.registerRequiredCSS("resourceView.css");
this.element.addStyleClass("resource-view");
this.resource = resource;
}
WebInspector.ResourceView.prototype = {
hasContent: function()
{
return false;
},
__proto__: WebInspector.View.prototype
}
/**
* @param {WebInspector.Resource} resource
*/
WebInspector.ResourceView.hasTextContent = function(resource)
{
if (resource.type.isTextType())
return true;
if (resource.type === WebInspector.resourceTypes.Other)
return resource.content && !resource.contentEncoded;
return false;
}
/**
* @param {WebInspector.Resource} resource
*/
WebInspector.ResourceView.nonSourceViewForResource = function(resource)
{
switch (resource.type) {
case WebInspector.resourceTypes.Image:
return new WebInspector.ImageView(resource);
case WebInspector.resourceTypes.Font:
return new WebInspector.FontView(resource);
default:
return new WebInspector.ResourceView(resource);
}
}
/**
* @extends {WebInspector.SourceFrame}
* @constructor
* @param {WebInspector.Resource} resource
*/
WebInspector.ResourceSourceFrame = function(resource)
{
this._resource = resource;
WebInspector.SourceFrame.call(this, resource);
}
WebInspector.ResourceSourceFrame.prototype = {
get resource()
{
return this._resource;
},
populateTextAreaContextMenu: function(contextMenu, lineNumber)
{
contextMenu.appendApplicableItems(this._resource);
},
__proto__: WebInspector.SourceFrame.prototype
}
/**
* @constructor
* @extends {WebInspector.View}
* @param {WebInspector.Resource} resource
*/
WebInspector.ResourceSourceFrameFallback = function(resource)
{
WebInspector.View.call(this);
this._resource = resource;
this.element.addStyleClass("fill");
this.element.addStyleClass("script-view");
this._content = this.element.createChild("div", "script-view-fallback monospace");
}
WebInspector.ResourceSourceFrameFallback.prototype = {
wasShown: function()
{
if (!this._contentRequested) {
this._contentRequested = true;
this._resource.requestContent(this._contentLoaded.bind(this));
}
},
/**
* @param {?string} content
* @param {boolean} contentEncoded
* @param {string} mimeType
*/
_contentLoaded: function(content, contentEncoded, mimeType)
{
this._content.textContent = content;
},
__proto__: WebInspector.View.prototype
} |
require 'spec_helper_acceptance'
# These tests ensure that postgres can change itself to an alternative pgdata
# location properly.
# Allow postgresql to use /tmp/* as a datadir
if fact('osfamily') == 'RedHat'
shell("setenforce 0")
end
describe 'postgres::server', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) do
it 'on an alternative pgdata location' do
pp = <<-EOS
#file { '/var/lib/pgsql': ensure => directory, } ->
# needs_initdb will be true by default for all OS's except Debian
# in order to change the datadir we need to tell it explicitly to call initdb
class { 'postgresql::server': datadir => '/tmp/data', needs_initdb => true }
EOS
apply_manifest(pp, :catch_failures => true)
apply_manifest(pp, :catch_changes => true)
end
describe file('/tmp/data') do
it { should be_directory }
end
it 'can connect with psql' do
psql('--command="\l" postgres', 'postgres') do |r|
expect(r.stdout).to match(/List of databases/)
end
end
end
|
/*
* libata-sff.c - helper library for PCI IDE BMDMA
*
* Maintained by: Tejun Heo <tj@kernel.org>
* Please ALWAYS copy linux-ide@vger.kernel.org
* on emails.
*
* Copyright 2003-2006 Red Hat, Inc. All rights reserved.
* Copyright 2003-2006 Jeff Garzik
*
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*
*
* libata documentation is available via 'make {ps|pdf}docs',
* as Documentation/DocBook/libata.*
*
* Hardware documentation available from http://www.t13.org/ and
* http://www.sata-io.org/
*
*/
#include <linux/kernel.h>
#include <linux/gfp.h>
#include <linux/pci.h>
#include <linux/module.h>
#include <linux/libata.h>
#include <linux/highmem.h>
#include "libata.h"
static struct workqueue_struct *ata_sff_wq;
const struct ata_port_operations ata_sff_port_ops = {
.inherits = &ata_base_port_ops,
.qc_prep = ata_noop_qc_prep,
.qc_issue = ata_sff_qc_issue,
.qc_fill_rtf = ata_sff_qc_fill_rtf,
.freeze = ata_sff_freeze,
.thaw = ata_sff_thaw,
.prereset = ata_sff_prereset,
.softreset = ata_sff_softreset,
.hardreset = sata_sff_hardreset,
.postreset = ata_sff_postreset,
.error_handler = ata_sff_error_handler,
.sff_dev_select = ata_sff_dev_select,
.sff_check_status = ata_sff_check_status,
.sff_tf_load = ata_sff_tf_load,
.sff_tf_read = ata_sff_tf_read,
.sff_exec_command = ata_sff_exec_command,
.sff_data_xfer = ata_sff_data_xfer,
.sff_drain_fifo = ata_sff_drain_fifo,
.lost_interrupt = ata_sff_lost_interrupt,
};
EXPORT_SYMBOL_GPL(ata_sff_port_ops);
/**
* ata_sff_check_status - Read device status reg & clear interrupt
* @ap: port where the device is
*
* Reads ATA taskfile status register for currently-selected device
* and return its value. This also clears pending interrupts
* from this device
*
* LOCKING:
* Inherited from caller.
*/
u8 ata_sff_check_status(struct ata_port *ap)
{
return ioread8(ap->ioaddr.status_addr);
}
EXPORT_SYMBOL_GPL(ata_sff_check_status);
/**
* ata_sff_altstatus - Read device alternate status reg
* @ap: port where the device is
*
* Reads ATA taskfile alternate status register for
* currently-selected device and return its value.
*
* Note: may NOT be used as the check_altstatus() entry in
* ata_port_operations.
*
* LOCKING:
* Inherited from caller.
*/
static u8 ata_sff_altstatus(struct ata_port *ap)
{
if (ap->ops->sff_check_altstatus)
return ap->ops->sff_check_altstatus(ap);
return ioread8(ap->ioaddr.altstatus_addr);
}
/**
* ata_sff_irq_status - Check if the device is busy
* @ap: port where the device is
*
* Determine if the port is currently busy. Uses altstatus
* if available in order to avoid clearing shared IRQ status
* when finding an IRQ source. Non ctl capable devices don't
* share interrupt lines fortunately for us.
*
* LOCKING:
* Inherited from caller.
*/
static u8 ata_sff_irq_status(struct ata_port *ap)
{
u8 status;
if (ap->ops->sff_check_altstatus || ap->ioaddr.altstatus_addr) {
status = ata_sff_altstatus(ap);
/* Not us: We are busy */
if (status & ATA_BUSY)
return status;
}
/* Clear INTRQ latch */
status = ap->ops->sff_check_status(ap);
return status;
}
/**
* ata_sff_sync - Flush writes
* @ap: Port to wait for.
*
* CAUTION:
* If we have an mmio device with no ctl and no altstatus
* method this will fail. No such devices are known to exist.
*
* LOCKING:
* Inherited from caller.
*/
static void ata_sff_sync(struct ata_port *ap)
{
if (ap->ops->sff_check_altstatus)
ap->ops->sff_check_altstatus(ap);
else if (ap->ioaddr.altstatus_addr)
ioread8(ap->ioaddr.altstatus_addr);
}
/**
* ata_sff_pause - Flush writes and wait 400nS
* @ap: Port to pause for.
*
* CAUTION:
* If we have an mmio device with no ctl and no altstatus
* method this will fail. No such devices are known to exist.
*
* LOCKING:
* Inherited from caller.
*/
void ata_sff_pause(struct ata_port *ap)
{
ata_sff_sync(ap);
ndelay(400);
}
EXPORT_SYMBOL_GPL(ata_sff_pause);
/**
* ata_sff_dma_pause - Pause before commencing DMA
* @ap: Port to pause for.
*
* Perform I/O fencing and ensure sufficient cycle delays occur
* for the HDMA1:0 transition
*/
void ata_sff_dma_pause(struct ata_port *ap)
{
if (ap->ops->sff_check_altstatus || ap->ioaddr.altstatus_addr) {
/* An altstatus read will cause the needed delay without
messing up the IRQ status */
ata_sff_altstatus(ap);
return;
}
/* There are no DMA controllers without ctl. BUG here to ensure
we never violate the HDMA1:0 transition timing and risk
corruption. */
BUG();
}
EXPORT_SYMBOL_GPL(ata_sff_dma_pause);
/**
* ata_sff_busy_sleep - sleep until BSY clears, or timeout
* @ap: port containing status register to be polled
* @tmout_pat: impatience timeout in msecs
* @tmout: overall timeout in msecs
*
* Sleep until ATA Status register bit BSY clears,
* or a timeout occurs.
*
* LOCKING:
* Kernel thread context (may sleep).
*
* RETURNS:
* 0 on success, -errno otherwise.
*/
int ata_sff_busy_sleep(struct ata_port *ap,
unsigned long tmout_pat, unsigned long tmout)
{
unsigned long timer_start, timeout;
u8 status;
status = ata_sff_busy_wait(ap, ATA_BUSY, 300);
timer_start = jiffies;
timeout = ata_deadline(timer_start, tmout_pat);
while (status != 0xff && (status & ATA_BUSY) &&
time_before(jiffies, timeout)) {
ata_msleep(ap, 50);
status = ata_sff_busy_wait(ap, ATA_BUSY, 3);
}
if (status != 0xff && (status & ATA_BUSY))
ata_port_warn(ap,
"port is slow to respond, please be patient (Status 0x%x)\n",
status);
timeout = ata_deadline(timer_start, tmout);
while (status != 0xff && (status & ATA_BUSY) &&
time_before(jiffies, timeout)) {
ata_msleep(ap, 50);
status = ap->ops->sff_check_status(ap);
}
if (status == 0xff)
return -ENODEV;
if (status & ATA_BUSY) {
ata_port_err(ap,
"port failed to respond (%lu secs, Status 0x%x)\n",
DIV_ROUND_UP(tmout, 1000), status);
return -EBUSY;
}
return 0;
}
EXPORT_SYMBOL_GPL(ata_sff_busy_sleep);
static int ata_sff_check_ready(struct ata_link *link)
{
u8 status = link->ap->ops->sff_check_status(link->ap);
return ata_check_ready(status);
}
/**
* ata_sff_wait_ready - sleep until BSY clears, or timeout
* @link: SFF link to wait ready status for
* @deadline: deadline jiffies for the operation
*
* Sleep until ATA Status register bit BSY clears, or timeout
* occurs.
*
* LOCKING:
* Kernel thread context (may sleep).
*
* RETURNS:
* 0 on success, -errno otherwise.
*/
int ata_sff_wait_ready(struct ata_link *link, unsigned long deadline)
{
return ata_wait_ready(link, deadline, ata_sff_check_ready);
}
EXPORT_SYMBOL_GPL(ata_sff_wait_ready);
/**
* ata_sff_set_devctl - Write device control reg
* @ap: port where the device is
* @ctl: value to write
*
* Writes ATA taskfile device control register.
*
* Note: may NOT be used as the sff_set_devctl() entry in
* ata_port_operations.
*
* LOCKING:
* Inherited from caller.
*/
static void ata_sff_set_devctl(struct ata_port *ap, u8 ctl)
{
if (ap->ops->sff_set_devctl)
ap->ops->sff_set_devctl(ap, ctl);
else
iowrite8(ctl, ap->ioaddr.ctl_addr);
}
/**
* ata_sff_dev_select - Select device 0/1 on ATA bus
* @ap: ATA channel to manipulate
* @device: ATA device (numbered from zero) to select
*
* Use the method defined in the ATA specification to
* make either device 0, or device 1, active on the
* ATA channel. Works with both PIO and MMIO.
*
* May be used as the dev_select() entry in ata_port_operations.
*
* LOCKING:
* caller.
*/
void ata_sff_dev_select(struct ata_port *ap, unsigned int device)
{
u8 tmp;
if (device == 0)
tmp = ATA_DEVICE_OBS;
else
tmp = ATA_DEVICE_OBS | ATA_DEV1;
iowrite8(tmp, ap->ioaddr.device_addr);
ata_sff_pause(ap); /* needed; also flushes, for mmio */
}
EXPORT_SYMBOL_GPL(ata_sff_dev_select);
/**
* ata_dev_select - Select device 0/1 on ATA bus
* @ap: ATA channel to manipulate
* @device: ATA device (numbered from zero) to select
* @wait: non-zero to wait for Status register BSY bit to clear
* @can_sleep: non-zero if context allows sleeping
*
* Use the method defined in the ATA specification to
* make either device 0, or device 1, active on the
* ATA channel.
*
* This is a high-level version of ata_sff_dev_select(), which
* additionally provides the services of inserting the proper
* pauses and status polling, where needed.
*
* LOCKING:
* caller.
*/
static void ata_dev_select(struct ata_port *ap, unsigned int device,
unsigned int wait, unsigned int can_sleep)
{
if (ata_msg_probe(ap))
ata_port_info(ap, "ata_dev_select: ENTER, device %u, wait %u\n",
device, wait);
if (wait)
ata_wait_idle(ap);
ap->ops->sff_dev_select(ap, device);
if (wait) {
if (can_sleep && ap->link.device[device].class == ATA_DEV_ATAPI)
ata_msleep(ap, 150);
ata_wait_idle(ap);
}
}
/**
* ata_sff_irq_on - Enable interrupts on a port.
* @ap: Port on which interrupts are enabled.
*
* Enable interrupts on a legacy IDE device using MMIO or PIO,
* wait for idle, clear any pending interrupts.
*
* Note: may NOT be used as the sff_irq_on() entry in
* ata_port_operations.
*
* LOCKING:
* Inherited from caller.
*/
void ata_sff_irq_on(struct ata_port *ap)
{
struct ata_ioports *ioaddr = &ap->ioaddr;
if (ap->ops->sff_irq_on) {
ap->ops->sff_irq_on(ap);
return;
}
ap->ctl &= ~ATA_NIEN;
ap->last_ctl = ap->ctl;
if (ap->ops->sff_set_devctl || ioaddr->ctl_addr)
ata_sff_set_devctl(ap, ap->ctl);
ata_wait_idle(ap);
if (ap->ops->sff_irq_clear)
ap->ops->sff_irq_clear(ap);
}
EXPORT_SYMBOL_GPL(ata_sff_irq_on);
/**
* ata_sff_tf_load - send taskfile registers to host controller
* @ap: Port to which output is sent
* @tf: ATA taskfile register set
*
* Outputs ATA taskfile to standard ATA host controller.
*
* LOCKING:
* Inherited from caller.
*/
void ata_sff_tf_load(struct ata_port *ap, const struct ata_taskfile *tf)
{
struct ata_ioports *ioaddr = &ap->ioaddr;
unsigned int is_addr = tf->flags & ATA_TFLAG_ISADDR;
if (tf->ctl != ap->last_ctl) {
if (ioaddr->ctl_addr)
iowrite8(tf->ctl, ioaddr->ctl_addr);
ap->last_ctl = tf->ctl;
ata_wait_idle(ap);
}
if (is_addr && (tf->flags & ATA_TFLAG_LBA48)) {
WARN_ON_ONCE(!ioaddr->ctl_addr);
iowrite8(tf->hob_feature, ioaddr->feature_addr);
iowrite8(tf->hob_nsect, ioaddr->nsect_addr);
iowrite8(tf->hob_lbal, ioaddr->lbal_addr);
iowrite8(tf->hob_lbam, ioaddr->lbam_addr);
iowrite8(tf->hob_lbah, ioaddr->lbah_addr);
VPRINTK("hob: feat 0x%X nsect 0x%X, lba 0x%X 0x%X 0x%X\n",
tf->hob_feature,
tf->hob_nsect,
tf->hob_lbal,
tf->hob_lbam,
tf->hob_lbah);
}
if (is_addr) {
iowrite8(tf->feature, ioaddr->feature_addr);
iowrite8(tf->nsect, ioaddr->nsect_addr);
iowrite8(tf->lbal, ioaddr->lbal_addr);
iowrite8(tf->lbam, ioaddr->lbam_addr);
iowrite8(tf->lbah, ioaddr->lbah_addr);
VPRINTK("feat 0x%X nsect 0x%X lba 0x%X 0x%X 0x%X\n",
tf->feature,
tf->nsect,
tf->lbal,
tf->lbam,
tf->lbah);
}
if (tf->flags & ATA_TFLAG_DEVICE) {
iowrite8(tf->device, ioaddr->device_addr);
VPRINTK("device 0x%X\n", tf->device);
}
ata_wait_idle(ap);
}
EXPORT_SYMBOL_GPL(ata_sff_tf_load);
/**
* ata_sff_tf_read - input device's ATA taskfile shadow registers
* @ap: Port from which input is read
* @tf: ATA taskfile register set for storing input
*
* Reads ATA taskfile registers for currently-selected device
* into @tf. Assumes the device has a fully SFF compliant task file
* layout and behaviour. If you device does not (eg has a different
* status method) then you will need to provide a replacement tf_read
*
* LOCKING:
* Inherited from caller.
*/
void ata_sff_tf_read(struct ata_port *ap, struct ata_taskfile *tf)
{
struct ata_ioports *ioaddr = &ap->ioaddr;
tf->command = ata_sff_check_status(ap);
tf->feature = ioread8(ioaddr->error_addr);
tf->nsect = ioread8(ioaddr->nsect_addr);
tf->lbal = ioread8(ioaddr->lbal_addr);
tf->lbam = ioread8(ioaddr->lbam_addr);
tf->lbah = ioread8(ioaddr->lbah_addr);
tf->device = ioread8(ioaddr->device_addr);
if (tf->flags & ATA_TFLAG_LBA48) {
if (likely(ioaddr->ctl_addr)) {
iowrite8(tf->ctl | ATA_HOB, ioaddr->ctl_addr);
tf->hob_feature = ioread8(ioaddr->error_addr);
tf->hob_nsect = ioread8(ioaddr->nsect_addr);
tf->hob_lbal = ioread8(ioaddr->lbal_addr);
tf->hob_lbam = ioread8(ioaddr->lbam_addr);
tf->hob_lbah = ioread8(ioaddr->lbah_addr);
iowrite8(tf->ctl, ioaddr->ctl_addr);
ap->last_ctl = tf->ctl;
} else
WARN_ON_ONCE(1);
}
}
EXPORT_SYMBOL_GPL(ata_sff_tf_read);
/**
* ata_sff_exec_command - issue ATA command to host controller
* @ap: port to which command is being issued
* @tf: ATA taskfile register set
*
* Issues ATA command, with proper synchronization with interrupt
* handler / other threads.
*
* LOCKING:
* spin_lock_irqsave(host lock)
*/
void ata_sff_exec_command(struct ata_port *ap, const struct ata_taskfile *tf)
{
DPRINTK("ata%u: cmd 0x%X\n", ap->print_id, tf->command);
iowrite8(tf->command, ap->ioaddr.command_addr);
ata_sff_pause(ap);
}
EXPORT_SYMBOL_GPL(ata_sff_exec_command);
/**
* ata_tf_to_host - issue ATA taskfile to host controller
* @ap: port to which command is being issued
* @tf: ATA taskfile register set
*
* Issues ATA taskfile register set to ATA host controller,
* with proper synchronization with interrupt handler and
* other threads.
*
* LOCKING:
* spin_lock_irqsave(host lock)
*/
static inline void ata_tf_to_host(struct ata_port *ap,
const struct ata_taskfile *tf)
{
ap->ops->sff_tf_load(ap, tf);
ap->ops->sff_exec_command(ap, tf);
}
/**
* ata_sff_data_xfer - Transfer data by PIO
* @dev: device to target
* @buf: data buffer
* @buflen: buffer length
* @rw: read/write
*
* Transfer data from/to the device data register by PIO.
*
* LOCKING:
* Inherited from caller.
*
* RETURNS:
* Bytes consumed.
*/
unsigned int ata_sff_data_xfer(struct ata_device *dev, unsigned char *buf,
unsigned int buflen, int rw)
{
struct ata_port *ap = dev->link->ap;
void __iomem *data_addr = ap->ioaddr.data_addr;
unsigned int words = buflen >> 1;
/* Transfer multiple of 2 bytes */
if (rw == READ)
ioread16_rep(data_addr, buf, words);
else
iowrite16_rep(data_addr, buf, words);
/* Transfer trailing byte, if any. */
if (unlikely(buflen & 0x01)) {
unsigned char pad[2] = { };
/* Point buf to the tail of buffer */
buf += buflen - 1;
/*
* Use io*16_rep() accessors here as well to avoid pointlessly
* swapping bytes to and from on the big endian machines...
*/
if (rw == READ) {
ioread16_rep(data_addr, pad, 1);
*buf = pad[0];
} else {
pad[0] = *buf;
iowrite16_rep(data_addr, pad, 1);
}
words++;
}
return words << 1;
}
EXPORT_SYMBOL_GPL(ata_sff_data_xfer);
/**
* ata_sff_data_xfer32 - Transfer data by PIO
* @dev: device to target
* @buf: data buffer
* @buflen: buffer length
* @rw: read/write
*
* Transfer data from/to the device data register by PIO using 32bit
* I/O operations.
*
* LOCKING:
* Inherited from caller.
*
* RETURNS:
* Bytes consumed.
*/
unsigned int ata_sff_data_xfer32(struct ata_device *dev, unsigned char *buf,
unsigned int buflen, int rw)
{
struct ata_port *ap = dev->link->ap;
void __iomem *data_addr = ap->ioaddr.data_addr;
unsigned int words = buflen >> 2;
int slop = buflen & 3;
if (!(ap->pflags & ATA_PFLAG_PIO32))
return ata_sff_data_xfer(dev, buf, buflen, rw);
/* Transfer multiple of 4 bytes */
if (rw == READ)
ioread32_rep(data_addr, buf, words);
else
iowrite32_rep(data_addr, buf, words);
/* Transfer trailing bytes, if any */
if (unlikely(slop)) {
unsigned char pad[4] = { };
/* Point buf to the tail of buffer */
buf += buflen - slop;
/*
* Use io*_rep() accessors here as well to avoid pointlessly
* swapping bytes to and from on the big endian machines...
*/
if (rw == READ) {
if (slop < 3)
ioread16_rep(data_addr, pad, 1);
else
ioread32_rep(data_addr, pad, 1);
memcpy(buf, pad, slop);
} else {
memcpy(pad, buf, slop);
if (slop < 3)
iowrite16_rep(data_addr, pad, 1);
else
iowrite32_rep(data_addr, pad, 1);
}
}
return (buflen + 1) & ~1;
}
EXPORT_SYMBOL_GPL(ata_sff_data_xfer32);
/**
* ata_sff_data_xfer_noirq - Transfer data by PIO
* @dev: device to target
* @buf: data buffer
* @buflen: buffer length
* @rw: read/write
*
* Transfer data from/to the device data register by PIO. Do the
* transfer with interrupts disabled.
*
* LOCKING:
* Inherited from caller.
*
* RETURNS:
* Bytes consumed.
*/
unsigned int ata_sff_data_xfer_noirq(struct ata_device *dev, unsigned char *buf,
unsigned int buflen, int rw)
{
unsigned long flags;
unsigned int consumed;
local_irq_save(flags);
consumed = ata_sff_data_xfer32(dev, buf, buflen, rw);
local_irq_restore(flags);
return consumed;
}
EXPORT_SYMBOL_GPL(ata_sff_data_xfer_noirq);
/**
* ata_pio_sector - Transfer a sector of data.
* @qc: Command on going
*
* Transfer qc->sect_size bytes of data from/to the ATA device.
*
* LOCKING:
* Inherited from caller.
*/
static void ata_pio_sector(struct ata_queued_cmd *qc)
{
int do_write = (qc->tf.flags & ATA_TFLAG_WRITE);
struct ata_port *ap = qc->ap;
struct page *page;
unsigned int offset;
unsigned char *buf;
if (qc->curbytes == qc->nbytes - qc->sect_size)
ap->hsm_task_state = HSM_ST_LAST;
page = sg_page(qc->cursg);
offset = qc->cursg->offset + qc->cursg_ofs;
/* get the current page and offset */
page = nth_page(page, (offset >> PAGE_SHIFT));
offset %= PAGE_SIZE;
DPRINTK("data %s\n", qc->tf.flags & ATA_TFLAG_WRITE ? "write" : "read");
if (PageHighMem(page)) {
unsigned long flags;
/* FIXME: use a bounce buffer */
local_irq_save(flags);
buf = kmap_atomic(page);
/* do the actual data transfer */
ap->ops->sff_data_xfer(qc->dev, buf + offset, qc->sect_size,
do_write);
kunmap_atomic(buf);
local_irq_restore(flags);
} else {
buf = page_address(page);
ap->ops->sff_data_xfer(qc->dev, buf + offset, qc->sect_size,
do_write);
}
if (!do_write && !PageSlab(page))
flush_dcache_page(page);
qc->curbytes += qc->sect_size;
qc->cursg_ofs += qc->sect_size;
if (qc->cursg_ofs == qc->cursg->length) {
qc->cursg = sg_next(qc->cursg);
qc->cursg_ofs = 0;
}
}
/**
* ata_pio_sectors - Transfer one or many sectors.
* @qc: Command on going
*
* Transfer one or many sectors of data from/to the
* ATA device for the DRQ request.
*
* LOCKING:
* Inherited from caller.
*/
static void ata_pio_sectors(struct ata_queued_cmd *qc)
{
if (is_multi_taskfile(&qc->tf)) {
/* READ/WRITE MULTIPLE */
unsigned int nsect;
WARN_ON_ONCE(qc->dev->multi_count == 0);
nsect = min((qc->nbytes - qc->curbytes) / qc->sect_size,
qc->dev->multi_count);
while (nsect--)
ata_pio_sector(qc);
} else
ata_pio_sector(qc);
ata_sff_sync(qc->ap); /* flush */
}
/**
* atapi_send_cdb - Write CDB bytes to hardware
* @ap: Port to which ATAPI device is attached.
* @qc: Taskfile currently active
*
* When device has indicated its readiness to accept
* a CDB, this function is called. Send the CDB.
*
* LOCKING:
* caller.
*/
static void atapi_send_cdb(struct ata_port *ap, struct ata_queued_cmd *qc)
{
/* send SCSI cdb */
DPRINTK("send cdb\n");
WARN_ON_ONCE(qc->dev->cdb_len < 12);
ap->ops->sff_data_xfer(qc->dev, qc->cdb, qc->dev->cdb_len, 1);
ata_sff_sync(ap);
/* FIXME: If the CDB is for DMA do we need to do the transition delay
or is bmdma_start guaranteed to do it ? */
switch (qc->tf.protocol) {
case ATAPI_PROT_PIO:
ap->hsm_task_state = HSM_ST;
break;
case ATAPI_PROT_NODATA:
ap->hsm_task_state = HSM_ST_LAST;
break;
#ifdef CONFIG_ATA_BMDMA
case ATAPI_PROT_DMA:
ap->hsm_task_state = HSM_ST_LAST;
/* initiate bmdma */
ap->ops->bmdma_start(qc);
break;
#endif /* CONFIG_ATA_BMDMA */
default:
BUG();
}
}
/**
* __atapi_pio_bytes - Transfer data from/to the ATAPI device.
* @qc: Command on going
* @bytes: number of bytes
*
* Transfer Transfer data from/to the ATAPI device.
*
* LOCKING:
* Inherited from caller.
*
*/
static int __atapi_pio_bytes(struct ata_queued_cmd *qc, unsigned int bytes)
{
int rw = (qc->tf.flags & ATA_TFLAG_WRITE) ? WRITE : READ;
struct ata_port *ap = qc->ap;
struct ata_device *dev = qc->dev;
struct ata_eh_info *ehi = &dev->link->eh_info;
struct scatterlist *sg;
struct page *page;
unsigned char *buf;
unsigned int offset, count, consumed;
next_sg:
sg = qc->cursg;
if (unlikely(!sg)) {
ata_ehi_push_desc(ehi, "unexpected or too much trailing data "
"buf=%u cur=%u bytes=%u",
qc->nbytes, qc->curbytes, bytes);
return -1;
}
page = sg_page(sg);
offset = sg->offset + qc->cursg_ofs;
/* get the current page and offset */
page = nth_page(page, (offset >> PAGE_SHIFT));
offset %= PAGE_SIZE;
/* don't overrun current sg */
count = min(sg->length - qc->cursg_ofs, bytes);
/* don't cross page boundaries */
count = min(count, (unsigned int)PAGE_SIZE - offset);
DPRINTK("data %s\n", qc->tf.flags & ATA_TFLAG_WRITE ? "write" : "read");
if (PageHighMem(page)) {
unsigned long flags;
/* FIXME: use bounce buffer */
local_irq_save(flags);
buf = kmap_atomic(page);
/* do the actual data transfer */
consumed = ap->ops->sff_data_xfer(dev, buf + offset,
count, rw);
kunmap_atomic(buf);
local_irq_restore(flags);
} else {
buf = page_address(page);
consumed = ap->ops->sff_data_xfer(dev, buf + offset,
count, rw);
}
bytes -= min(bytes, consumed);
qc->curbytes += count;
qc->cursg_ofs += count;
if (qc->cursg_ofs == sg->length) {
qc->cursg = sg_next(qc->cursg);
qc->cursg_ofs = 0;
}
/*
* There used to be a WARN_ON_ONCE(qc->cursg && count != consumed);
* Unfortunately __atapi_pio_bytes doesn't know enough to do the WARN
* check correctly as it doesn't know if it is the last request being
* made. Somebody should implement a proper sanity check.
*/
if (bytes)
goto next_sg;
return 0;
}
/**
* atapi_pio_bytes - Transfer data from/to the ATAPI device.
* @qc: Command on going
*
* Transfer Transfer data from/to the ATAPI device.
*
* LOCKING:
* Inherited from caller.
*/
static void atapi_pio_bytes(struct ata_queued_cmd *qc)
{
struct ata_port *ap = qc->ap;
struct ata_device *dev = qc->dev;
struct ata_eh_info *ehi = &dev->link->eh_info;
unsigned int ireason, bc_lo, bc_hi, bytes;
int i_write, do_write = (qc->tf.flags & ATA_TFLAG_WRITE) ? 1 : 0;
/* Abuse qc->result_tf for temp storage of intermediate TF
* here to save some kernel stack usage.
* For normal completion, qc->result_tf is not relevant. For
* error, qc->result_tf is later overwritten by ata_qc_complete().
* So, the correctness of qc->result_tf is not affected.
*/
ap->ops->sff_tf_read(ap, &qc->result_tf);
ireason = qc->result_tf.nsect;
bc_lo = qc->result_tf.lbam;
bc_hi = qc->result_tf.lbah;
bytes = (bc_hi << 8) | bc_lo;
/* shall be cleared to zero, indicating xfer of data */
if (unlikely(ireason & ATAPI_COD))
goto atapi_check;
/* make sure transfer direction matches expected */
i_write = ((ireason & ATAPI_IO) == 0) ? 1 : 0;
if (unlikely(do_write != i_write))
goto atapi_check;
if (unlikely(!bytes))
goto atapi_check;
VPRINTK("ata%u: xfering %d bytes\n", ap->print_id, bytes);
if (unlikely(__atapi_pio_bytes(qc, bytes)))
goto err_out;
ata_sff_sync(ap); /* flush */
return;
atapi_check:
ata_ehi_push_desc(ehi, "ATAPI check failed (ireason=0x%x bytes=%u)",
ireason, bytes);
err_out:
qc->err_mask |= AC_ERR_HSM;
ap->hsm_task_state = HSM_ST_ERR;
}
/**
* ata_hsm_ok_in_wq - Check if the qc can be handled in the workqueue.
* @ap: the target ata_port
* @qc: qc on going
*
* RETURNS:
* 1 if ok in workqueue, 0 otherwise.
*/
static inline int ata_hsm_ok_in_wq(struct ata_port *ap,
struct ata_queued_cmd *qc)
{
if (qc->tf.flags & ATA_TFLAG_POLLING)
return 1;
if (ap->hsm_task_state == HSM_ST_FIRST) {
if (qc->tf.protocol == ATA_PROT_PIO &&
(qc->tf.flags & ATA_TFLAG_WRITE))
return 1;
if (ata_is_atapi(qc->tf.protocol) &&
!(qc->dev->flags & ATA_DFLAG_CDB_INTR))
return 1;
}
return 0;
}
/**
* ata_hsm_qc_complete - finish a qc running on standard HSM
* @qc: Command to complete
* @in_wq: 1 if called from workqueue, 0 otherwise
*
* Finish @qc which is running on standard HSM.
*
* LOCKING:
* If @in_wq is zero, spin_lock_irqsave(host lock).
* Otherwise, none on entry and grabs host lock.
*/
static void ata_hsm_qc_complete(struct ata_queued_cmd *qc, int in_wq)
{
struct ata_port *ap = qc->ap;
unsigned long flags;
if (ap->ops->error_handler) {
if (in_wq) {
spin_lock_irqsave(ap->lock, flags);
/* EH might have kicked in while host lock is
* released.
*/
qc = ata_qc_from_tag(ap, qc->tag);
if (qc) {
if (likely(!(qc->err_mask & AC_ERR_HSM))) {
ata_sff_irq_on(ap);
ata_qc_complete(qc);
} else
ata_port_freeze(ap);
}
spin_unlock_irqrestore(ap->lock, flags);
} else {
if (likely(!(qc->err_mask & AC_ERR_HSM)))
ata_qc_complete(qc);
else
ata_port_freeze(ap);
}
} else {
if (in_wq) {
spin_lock_irqsave(ap->lock, flags);
ata_sff_irq_on(ap);
ata_qc_complete(qc);
spin_unlock_irqrestore(ap->lock, flags);
} else
ata_qc_complete(qc);
}
}
/**
* ata_sff_hsm_move - move the HSM to the next state.
* @ap: the target ata_port
* @qc: qc on going
* @status: current device status
* @in_wq: 1 if called from workqueue, 0 otherwise
*
* RETURNS:
* 1 when poll next status needed, 0 otherwise.
*/
int ata_sff_hsm_move(struct ata_port *ap, struct ata_queued_cmd *qc,
u8 status, int in_wq)
{
struct ata_link *link = qc->dev->link;
struct ata_eh_info *ehi = &link->eh_info;
unsigned long flags = 0;
int poll_next;
WARN_ON_ONCE((qc->flags & ATA_QCFLAG_ACTIVE) == 0);
/* Make sure ata_sff_qc_issue() does not throw things
* like DMA polling into the workqueue. Notice that
* in_wq is not equivalent to (qc->tf.flags & ATA_TFLAG_POLLING).
*/
WARN_ON_ONCE(in_wq != ata_hsm_ok_in_wq(ap, qc));
fsm_start:
DPRINTK("ata%u: protocol %d task_state %d (dev_stat 0x%X)\n",
ap->print_id, qc->tf.protocol, ap->hsm_task_state, status);
switch (ap->hsm_task_state) {
case HSM_ST_FIRST:
/* Send first data block or PACKET CDB */
/* If polling, we will stay in the work queue after
* sending the data. Otherwise, interrupt handler
* takes over after sending the data.
*/
poll_next = (qc->tf.flags & ATA_TFLAG_POLLING);
/* check device status */
if (unlikely((status & ATA_DRQ) == 0)) {
/* handle BSY=0, DRQ=0 as error */
if (likely(status & (ATA_ERR | ATA_DF)))
/* device stops HSM for abort/error */
qc->err_mask |= AC_ERR_DEV;
else {
/* HSM violation. Let EH handle this */
ata_ehi_push_desc(ehi,
"ST_FIRST: !(DRQ|ERR|DF)");
qc->err_mask |= AC_ERR_HSM;
}
ap->hsm_task_state = HSM_ST_ERR;
goto fsm_start;
}
/* Device should not ask for data transfer (DRQ=1)
* when it finds something wrong.
* We ignore DRQ here and stop the HSM by
* changing hsm_task_state to HSM_ST_ERR and
* let the EH abort the command or reset the device.
*/
if (unlikely(status & (ATA_ERR | ATA_DF))) {
/* Some ATAPI tape drives forget to clear the ERR bit
* when doing the next command (mostly request sense).
* We ignore ERR here to workaround and proceed sending
* the CDB.
*/
if (!(qc->dev->horkage & ATA_HORKAGE_STUCK_ERR)) {
ata_ehi_push_desc(ehi, "ST_FIRST: "
"DRQ=1 with device error, "
"dev_stat 0x%X", status);
qc->err_mask |= AC_ERR_HSM;
ap->hsm_task_state = HSM_ST_ERR;
goto fsm_start;
}
}
/* Send the CDB (atapi) or the first data block (ata pio out).
* During the state transition, interrupt handler shouldn't
* be invoked before the data transfer is complete and
* hsm_task_state is changed. Hence, the following locking.
*/
if (in_wq)
spin_lock_irqsave(ap->lock, flags);
if (qc->tf.protocol == ATA_PROT_PIO) {
/* PIO data out protocol.
* send first data block.
*/
/* ata_pio_sectors() might change the state
* to HSM_ST_LAST. so, the state is changed here
* before ata_pio_sectors().
*/
ap->hsm_task_state = HSM_ST;
ata_pio_sectors(qc);
} else
/* send CDB */
atapi_send_cdb(ap, qc);
if (in_wq)
spin_unlock_irqrestore(ap->lock, flags);
/* if polling, ata_sff_pio_task() handles the rest.
* otherwise, interrupt handler takes over from here.
*/
break;
case HSM_ST:
/* complete command or read/write the data register */
if (qc->tf.protocol == ATAPI_PROT_PIO) {
/* ATAPI PIO protocol */
if ((status & ATA_DRQ) == 0) {
/* No more data to transfer or device error.
* Device error will be tagged in HSM_ST_LAST.
*/
ap->hsm_task_state = HSM_ST_LAST;
goto fsm_start;
}
/* Device should not ask for data transfer (DRQ=1)
* when it finds something wrong.
* We ignore DRQ here and stop the HSM by
* changing hsm_task_state to HSM_ST_ERR and
* let the EH abort the command or reset the device.
*/
if (unlikely(status & (ATA_ERR | ATA_DF))) {
ata_ehi_push_desc(ehi, "ST-ATAPI: "
"DRQ=1 with device error, "
"dev_stat 0x%X", status);
qc->err_mask |= AC_ERR_HSM;
ap->hsm_task_state = HSM_ST_ERR;
goto fsm_start;
}
atapi_pio_bytes(qc);
if (unlikely(ap->hsm_task_state == HSM_ST_ERR))
/* bad ireason reported by device */
goto fsm_start;
} else {
/* ATA PIO protocol */
if (unlikely((status & ATA_DRQ) == 0)) {
/* handle BSY=0, DRQ=0 as error */
if (likely(status & (ATA_ERR | ATA_DF))) {
/* device stops HSM for abort/error */
qc->err_mask |= AC_ERR_DEV;
/* If diagnostic failed and this is
* IDENTIFY, it's likely a phantom
* device. Mark hint.
*/
if (qc->dev->horkage &
ATA_HORKAGE_DIAGNOSTIC)
qc->err_mask |=
AC_ERR_NODEV_HINT;
} else {
/* HSM violation. Let EH handle this.
* Phantom devices also trigger this
* condition. Mark hint.
*/
ata_ehi_push_desc(ehi, "ST-ATA: "
"DRQ=0 without device error, "
"dev_stat 0x%X", status);
qc->err_mask |= AC_ERR_HSM |
AC_ERR_NODEV_HINT;
}
ap->hsm_task_state = HSM_ST_ERR;
goto fsm_start;
}
/* For PIO reads, some devices may ask for
* data transfer (DRQ=1) alone with ERR=1.
* We respect DRQ here and transfer one
* block of junk data before changing the
* hsm_task_state to HSM_ST_ERR.
*
* For PIO writes, ERR=1 DRQ=1 doesn't make
* sense since the data block has been
* transferred to the device.
*/
if (unlikely(status & (ATA_ERR | ATA_DF))) {
/* data might be corrputed */
qc->err_mask |= AC_ERR_DEV;
if (!(qc->tf.flags & ATA_TFLAG_WRITE)) {
ata_pio_sectors(qc);
status = ata_wait_idle(ap);
}
if (status & (ATA_BUSY | ATA_DRQ)) {
ata_ehi_push_desc(ehi, "ST-ATA: "
"BUSY|DRQ persists on ERR|DF, "
"dev_stat 0x%X", status);
qc->err_mask |= AC_ERR_HSM;
}
/* There are oddball controllers with
* status register stuck at 0x7f and
* lbal/m/h at zero which makes it
* pass all other presence detection
* mechanisms we have. Set NODEV_HINT
* for it. Kernel bz#7241.
*/
if (status == 0x7f)
qc->err_mask |= AC_ERR_NODEV_HINT;
/* ata_pio_sectors() might change the
* state to HSM_ST_LAST. so, the state
* is changed after ata_pio_sectors().
*/
ap->hsm_task_state = HSM_ST_ERR;
goto fsm_start;
}
ata_pio_sectors(qc);
if (ap->hsm_task_state == HSM_ST_LAST &&
(!(qc->tf.flags & ATA_TFLAG_WRITE))) {
/* all data read */
status = ata_wait_idle(ap);
goto fsm_start;
}
}
poll_next = 1;
break;
case HSM_ST_LAST:
if (unlikely(!ata_ok(status))) {
qc->err_mask |= __ac_err_mask(status);
ap->hsm_task_state = HSM_ST_ERR;
goto fsm_start;
}
/* no more data to transfer */
DPRINTK("ata%u: dev %u command complete, drv_stat 0x%x\n",
ap->print_id, qc->dev->devno, status);
WARN_ON_ONCE(qc->err_mask & (AC_ERR_DEV | AC_ERR_HSM));
ap->hsm_task_state = HSM_ST_IDLE;
/* complete taskfile transaction */
ata_hsm_qc_complete(qc, in_wq);
poll_next = 0;
break;
case HSM_ST_ERR:
ap->hsm_task_state = HSM_ST_IDLE;
/* complete taskfile transaction */
ata_hsm_qc_complete(qc, in_wq);
poll_next = 0;
break;
default:
poll_next = 0;
BUG();
}
return poll_next;
}
EXPORT_SYMBOL_GPL(ata_sff_hsm_move);
void ata_sff_queue_work(struct work_struct *work)
{
queue_work(ata_sff_wq, work);
}
EXPORT_SYMBOL_GPL(ata_sff_queue_work);
void ata_sff_queue_delayed_work(struct delayed_work *dwork, unsigned long delay)
{
queue_delayed_work(ata_sff_wq, dwork, delay);
}
EXPORT_SYMBOL_GPL(ata_sff_queue_delayed_work);
void ata_sff_queue_pio_task(struct ata_link *link, unsigned long delay)
{
struct ata_port *ap = link->ap;
WARN_ON((ap->sff_pio_task_link != NULL) &&
(ap->sff_pio_task_link != link));
ap->sff_pio_task_link = link;
/* may fail if ata_sff_flush_pio_task() in progress */
ata_sff_queue_delayed_work(&ap->sff_pio_task, msecs_to_jiffies(delay));
}
EXPORT_SYMBOL_GPL(ata_sff_queue_pio_task);
void ata_sff_flush_pio_task(struct ata_port *ap)
{
DPRINTK("ENTER\n");
cancel_delayed_work_sync(&ap->sff_pio_task);
ap->hsm_task_state = HSM_ST_IDLE;
ap->sff_pio_task_link = NULL;
if (ata_msg_ctl(ap))
ata_port_dbg(ap, "%s: EXIT\n", __func__);
}
static void ata_sff_pio_task(struct work_struct *work)
{
struct ata_port *ap =
container_of(work, struct ata_port, sff_pio_task.work);
struct ata_link *link = ap->sff_pio_task_link;
struct ata_queued_cmd *qc;
u8 status;
int poll_next;
BUG_ON(ap->sff_pio_task_link == NULL);
/* qc can be NULL if timeout occurred */
qc = ata_qc_from_tag(ap, link->active_tag);
if (!qc) {
ap->sff_pio_task_link = NULL;
return;
}
fsm_start:
WARN_ON_ONCE(ap->hsm_task_state == HSM_ST_IDLE);
/*
* This is purely heuristic. This is a fast path.
* Sometimes when we enter, BSY will be cleared in
* a chk-status or two. If not, the drive is probably seeking
* or something. Snooze for a couple msecs, then
* chk-status again. If still busy, queue delayed work.
*/
status = ata_sff_busy_wait(ap, ATA_BUSY, 5);
if (status & ATA_BUSY) {
ata_msleep(ap, 2);
status = ata_sff_busy_wait(ap, ATA_BUSY, 10);
if (status & ATA_BUSY) {
ata_sff_queue_pio_task(link, ATA_SHORT_PAUSE);
return;
}
}
/*
* hsm_move() may trigger another command to be processed.
* clean the link beforehand.
*/
ap->sff_pio_task_link = NULL;
/* move the HSM */
poll_next = ata_sff_hsm_move(ap, qc, status, 1);
/* another command or interrupt handler
* may be running at this point.
*/
if (poll_next)
goto fsm_start;
}
/**
* ata_sff_qc_issue - issue taskfile to a SFF controller
* @qc: command to issue to device
*
* This function issues a PIO or NODATA command to a SFF
* controller.
*
* LOCKING:
* spin_lock_irqsave(host lock)
*
* RETURNS:
* Zero on success, AC_ERR_* mask on failure
*/
unsigned int ata_sff_qc_issue(struct ata_queued_cmd *qc)
{
struct ata_port *ap = qc->ap;
struct ata_link *link = qc->dev->link;
/* Use polling pio if the LLD doesn't handle
* interrupt driven pio and atapi CDB interrupt.
*/
if (ap->flags & ATA_FLAG_PIO_POLLING)
qc->tf.flags |= ATA_TFLAG_POLLING;
/* select the device */
ata_dev_select(ap, qc->dev->devno, 1, 0);
/* start the command */
switch (qc->tf.protocol) {
case ATA_PROT_NODATA:
if (qc->tf.flags & ATA_TFLAG_POLLING)
ata_qc_set_polling(qc);
ata_tf_to_host(ap, &qc->tf);
ap->hsm_task_state = HSM_ST_LAST;
if (qc->tf.flags & ATA_TFLAG_POLLING)
ata_sff_queue_pio_task(link, 0);
break;
case ATA_PROT_PIO:
if (qc->tf.flags & ATA_TFLAG_POLLING)
ata_qc_set_polling(qc);
ata_tf_to_host(ap, &qc->tf);
if (qc->tf.flags & ATA_TFLAG_WRITE) {
/* PIO data out protocol */
ap->hsm_task_state = HSM_ST_FIRST;
ata_sff_queue_pio_task(link, 0);
/* always send first data block using the
* ata_sff_pio_task() codepath.
*/
} else {
/* PIO data in protocol */
ap->hsm_task_state = HSM_ST;
if (qc->tf.flags & ATA_TFLAG_POLLING)
ata_sff_queue_pio_task(link, 0);
/* if polling, ata_sff_pio_task() handles the
* rest. otherwise, interrupt handler takes
* over from here.
*/
}
break;
case ATAPI_PROT_PIO:
case ATAPI_PROT_NODATA:
if (qc->tf.flags & ATA_TFLAG_POLLING)
ata_qc_set_polling(qc);
ata_tf_to_host(ap, &qc->tf);
ap->hsm_task_state = HSM_ST_FIRST;
/* send cdb by polling if no cdb interrupt */
if ((!(qc->dev->flags & ATA_DFLAG_CDB_INTR)) ||
(qc->tf.flags & ATA_TFLAG_POLLING))
ata_sff_queue_pio_task(link, 0);
break;
default:
WARN_ON_ONCE(1);
return AC_ERR_SYSTEM;
}
return 0;
}
EXPORT_SYMBOL_GPL(ata_sff_qc_issue);
/**
* ata_sff_qc_fill_rtf - fill result TF using ->sff_tf_read
* @qc: qc to fill result TF for
*
* @qc is finished and result TF needs to be filled. Fill it
* using ->sff_tf_read.
*
* LOCKING:
* spin_lock_irqsave(host lock)
*
* RETURNS:
* true indicating that result TF is successfully filled.
*/
bool ata_sff_qc_fill_rtf(struct ata_queued_cmd *qc)
{
qc->ap->ops->sff_tf_read(qc->ap, &qc->result_tf);
return true;
}
EXPORT_SYMBOL_GPL(ata_sff_qc_fill_rtf);
static unsigned int ata_sff_idle_irq(struct ata_port *ap)
{
ap->stats.idle_irq++;
#ifdef ATA_IRQ_TRAP
if ((ap->stats.idle_irq % 1000) == 0) {
ap->ops->sff_check_status(ap);
if (ap->ops->sff_irq_clear)
ap->ops->sff_irq_clear(ap);
ata_port_warn(ap, "irq trap\n");
return 1;
}
#endif
return 0; /* irq not handled */
}
static unsigned int __ata_sff_port_intr(struct ata_port *ap,
struct ata_queued_cmd *qc,
bool hsmv_on_idle)
{
u8 status;
VPRINTK("ata%u: protocol %d task_state %d\n",
ap->print_id, qc->tf.protocol, ap->hsm_task_state);
/* Check whether we are expecting interrupt in this state */
switch (ap->hsm_task_state) {
case HSM_ST_FIRST:
/* Some pre-ATAPI-4 devices assert INTRQ
* at this state when ready to receive CDB.
*/
/* Check the ATA_DFLAG_CDB_INTR flag is enough here.
* The flag was turned on only for atapi devices. No
* need to check ata_is_atapi(qc->tf.protocol) again.
*/
if (!(qc->dev->flags & ATA_DFLAG_CDB_INTR))
return ata_sff_idle_irq(ap);
break;
case HSM_ST_IDLE:
return ata_sff_idle_irq(ap);
default:
break;
}
/* check main status, clearing INTRQ if needed */
status = ata_sff_irq_status(ap);
if (status & ATA_BUSY) {
if (hsmv_on_idle) {
/* BMDMA engine is already stopped, we're screwed */
qc->err_mask |= AC_ERR_HSM;
ap->hsm_task_state = HSM_ST_ERR;
} else
return ata_sff_idle_irq(ap);
}
/* clear irq events */
if (ap->ops->sff_irq_clear)
ap->ops->sff_irq_clear(ap);
ata_sff_hsm_move(ap, qc, status, 0);
return 1; /* irq handled */
}
/**
* ata_sff_port_intr - Handle SFF port interrupt
* @ap: Port on which interrupt arrived (possibly...)
* @qc: Taskfile currently active in engine
*
* Handle port interrupt for given queued command.
*
* LOCKING:
* spin_lock_irqsave(host lock)
*
* RETURNS:
* One if interrupt was handled, zero if not (shared irq).
*/
unsigned int ata_sff_port_intr(struct ata_port *ap, struct ata_queued_cmd *qc)
{
return __ata_sff_port_intr(ap, qc, false);
}
EXPORT_SYMBOL_GPL(ata_sff_port_intr);
static inline irqreturn_t __ata_sff_interrupt(int irq, void *dev_instance,
unsigned int (*port_intr)(struct ata_port *, struct ata_queued_cmd *))
{
struct ata_host *host = dev_instance;
bool retried = false;
unsigned int i;
unsigned int handled, idle, polling;
unsigned long flags;
/* TODO: make _irqsave conditional on x86 PCI IDE legacy mode */
spin_lock_irqsave(&host->lock, flags);
retry:
handled = idle = polling = 0;
for (i = 0; i < host->n_ports; i++) {
struct ata_port *ap = host->ports[i];
struct ata_queued_cmd *qc;
qc = ata_qc_from_tag(ap, ap->link.active_tag);
if (qc) {
if (!(qc->tf.flags & ATA_TFLAG_POLLING))
handled |= port_intr(ap, qc);
else
polling |= 1 << i;
} else
idle |= 1 << i;
}
/*
* If no port was expecting IRQ but the controller is actually
* asserting IRQ line, nobody cared will ensue. Check IRQ
* pending status if available and clear spurious IRQ.
*/
if (!handled && !retried) {
bool retry = false;
for (i = 0; i < host->n_ports; i++) {
struct ata_port *ap = host->ports[i];
if (polling & (1 << i))
continue;
if (!ap->ops->sff_irq_check ||
!ap->ops->sff_irq_check(ap))
continue;
if (idle & (1 << i)) {
ap->ops->sff_check_status(ap);
if (ap->ops->sff_irq_clear)
ap->ops->sff_irq_clear(ap);
} else {
/* clear INTRQ and check if BUSY cleared */
if (!(ap->ops->sff_check_status(ap) & ATA_BUSY))
retry |= true;
/*
* With command in flight, we can't do
* sff_irq_clear() w/o racing with completion.
*/
}
}
if (retry) {
retried = true;
goto retry;
}
}
spin_unlock_irqrestore(&host->lock, flags);
return IRQ_RETVAL(handled);
}
/**
* ata_sff_interrupt - Default SFF ATA host interrupt handler
* @irq: irq line (unused)
* @dev_instance: pointer to our ata_host information structure
*
* Default interrupt handler for PCI IDE devices. Calls
* ata_sff_port_intr() for each port that is not disabled.
*
* LOCKING:
* Obtains host lock during operation.
*
* RETURNS:
* IRQ_NONE or IRQ_HANDLED.
*/
irqreturn_t ata_sff_interrupt(int irq, void *dev_instance)
{
return __ata_sff_interrupt(irq, dev_instance, ata_sff_port_intr);
}
EXPORT_SYMBOL_GPL(ata_sff_interrupt);
/**
* ata_sff_lost_interrupt - Check for an apparent lost interrupt
* @ap: port that appears to have timed out
*
* Called from the libata error handlers when the core code suspects
* an interrupt has been lost. If it has complete anything we can and
* then return. Interface must support altstatus for this faster
* recovery to occur.
*
* Locking:
* Caller holds host lock
*/
void ata_sff_lost_interrupt(struct ata_port *ap)
{
u8 status;
struct ata_queued_cmd *qc;
/* Only one outstanding command per SFF channel */
qc = ata_qc_from_tag(ap, ap->link.active_tag);
/* We cannot lose an interrupt on a non-existent or polled command */
if (!qc || qc->tf.flags & ATA_TFLAG_POLLING)
return;
/* See if the controller thinks it is still busy - if so the command
isn't a lost IRQ but is still in progress */
status = ata_sff_altstatus(ap);
if (status & ATA_BUSY)
return;
/* There was a command running, we are no longer busy and we have
no interrupt. */
ata_port_warn(ap, "lost interrupt (Status 0x%x)\n",
status);
/* Run the host interrupt logic as if the interrupt had not been
lost */
ata_sff_port_intr(ap, qc);
}
EXPORT_SYMBOL_GPL(ata_sff_lost_interrupt);
/**
* ata_sff_freeze - Freeze SFF controller port
* @ap: port to freeze
*
* Freeze SFF controller port.
*
* LOCKING:
* Inherited from caller.
*/
void ata_sff_freeze(struct ata_port *ap)
{
ap->ctl |= ATA_NIEN;
ap->last_ctl = ap->ctl;
if (ap->ops->sff_set_devctl || ap->ioaddr.ctl_addr)
ata_sff_set_devctl(ap, ap->ctl);
/* Under certain circumstances, some controllers raise IRQ on
* ATA_NIEN manipulation. Also, many controllers fail to mask
* previously pending IRQ on ATA_NIEN assertion. Clear it.
*/
ap->ops->sff_check_status(ap);
if (ap->ops->sff_irq_clear)
ap->ops->sff_irq_clear(ap);
}
EXPORT_SYMBOL_GPL(ata_sff_freeze);
/**
* ata_sff_thaw - Thaw SFF controller port
* @ap: port to thaw
*
* Thaw SFF controller port.
*
* LOCKING:
* Inherited from caller.
*/
void ata_sff_thaw(struct ata_port *ap)
{
/* clear & re-enable interrupts */
ap->ops->sff_check_status(ap);
if (ap->ops->sff_irq_clear)
ap->ops->sff_irq_clear(ap);
ata_sff_irq_on(ap);
}
EXPORT_SYMBOL_GPL(ata_sff_thaw);
/**
* ata_sff_prereset - prepare SFF link for reset
* @link: SFF link to be reset
* @deadline: deadline jiffies for the operation
*
* SFF link @link is about to be reset. Initialize it. It first
* calls ata_std_prereset() and wait for !BSY if the port is
* being softreset.
*
* LOCKING:
* Kernel thread context (may sleep)
*
* RETURNS:
* 0 on success, -errno otherwise.
*/
int ata_sff_prereset(struct ata_link *link, unsigned long deadline)
{
struct ata_eh_context *ehc = &link->eh_context;
int rc;
rc = ata_std_prereset(link, deadline);
if (rc)
return rc;
/* if we're about to do hardreset, nothing more to do */
if (ehc->i.action & ATA_EH_HARDRESET)
return 0;
/* wait for !BSY if we don't know that no device is attached */
if (!ata_link_offline(link)) {
rc = ata_sff_wait_ready(link, deadline);
if (rc && rc != -ENODEV) {
ata_link_warn(link,
"device not ready (errno=%d), forcing hardreset\n",
rc);
ehc->i.action |= ATA_EH_HARDRESET;
}
}
return 0;
}
EXPORT_SYMBOL_GPL(ata_sff_prereset);
/**
* ata_devchk - PATA device presence detection
* @ap: ATA channel to examine
* @device: Device to examine (starting at zero)
*
* This technique was originally described in
* Hale Landis's ATADRVR (www.ata-atapi.com), and
* later found its way into the ATA/ATAPI spec.
*
* Write a pattern to the ATA shadow registers,
* and if a device is present, it will respond by
* correctly storing and echoing back the
* ATA shadow register contents.
*
* LOCKING:
* caller.
*/
static unsigned int ata_devchk(struct ata_port *ap, unsigned int device)
{
struct ata_ioports *ioaddr = &ap->ioaddr;
u8 nsect, lbal;
ap->ops->sff_dev_select(ap, device);
iowrite8(0x55, ioaddr->nsect_addr);
iowrite8(0xaa, ioaddr->lbal_addr);
iowrite8(0xaa, ioaddr->nsect_addr);
iowrite8(0x55, ioaddr->lbal_addr);
iowrite8(0x55, ioaddr->nsect_addr);
iowrite8(0xaa, ioaddr->lbal_addr);
nsect = ioread8(ioaddr->nsect_addr);
lbal = ioread8(ioaddr->lbal_addr);
if ((nsect == 0x55) && (lbal == 0xaa))
return 1; /* we found a device */
return 0; /* nothing found */
}
/**
* ata_sff_dev_classify - Parse returned ATA device signature
* @dev: ATA device to classify (starting at zero)
* @present: device seems present
* @r_err: Value of error register on completion
*
* After an event -- SRST, E.D.D., or SATA COMRESET -- occurs,
* an ATA/ATAPI-defined set of values is placed in the ATA
* shadow registers, indicating the results of device detection
* and diagnostics.
*
* Select the ATA device, and read the values from the ATA shadow
* registers. Then parse according to the Error register value,
* and the spec-defined values examined by ata_dev_classify().
*
* LOCKING:
* caller.
*
* RETURNS:
* Device type - %ATA_DEV_ATA, %ATA_DEV_ATAPI or %ATA_DEV_NONE.
*/
unsigned int ata_sff_dev_classify(struct ata_device *dev, int present,
u8 *r_err)
{
struct ata_port *ap = dev->link->ap;
struct ata_taskfile tf;
unsigned int class;
u8 err;
ap->ops->sff_dev_select(ap, dev->devno);
memset(&tf, 0, sizeof(tf));
ap->ops->sff_tf_read(ap, &tf);
err = tf.feature;
if (r_err)
*r_err = err;
/* see if device passed diags: continue and warn later */
if (err == 0)
/* diagnostic fail : do nothing _YET_ */
dev->horkage |= ATA_HORKAGE_DIAGNOSTIC;
else if (err == 1)
/* do nothing */ ;
else if ((dev->devno == 0) && (err == 0x81))
/* do nothing */ ;
else
return ATA_DEV_NONE;
/* determine if device is ATA or ATAPI */
class = ata_dev_classify(&tf);
if (class == ATA_DEV_UNKNOWN) {
/* If the device failed diagnostic, it's likely to
* have reported incorrect device signature too.
* Assume ATA device if the device seems present but
* device signature is invalid with diagnostic
* failure.
*/
if (present && (dev->horkage & ATA_HORKAGE_DIAGNOSTIC))
class = ATA_DEV_ATA;
else
class = ATA_DEV_NONE;
} else if ((class == ATA_DEV_ATA) &&
(ap->ops->sff_check_status(ap) == 0))
class = ATA_DEV_NONE;
return class;
}
EXPORT_SYMBOL_GPL(ata_sff_dev_classify);
/**
* ata_sff_wait_after_reset - wait for devices to become ready after reset
* @link: SFF link which is just reset
* @devmask: mask of present devices
* @deadline: deadline jiffies for the operation
*
* Wait devices attached to SFF @link to become ready after
* reset. It contains preceding 150ms wait to avoid accessing TF
* status register too early.
*
* LOCKING:
* Kernel thread context (may sleep).
*
* RETURNS:
* 0 on success, -ENODEV if some or all of devices in @devmask
* don't seem to exist. -errno on other errors.
*/
int ata_sff_wait_after_reset(struct ata_link *link, unsigned int devmask,
unsigned long deadline)
{
struct ata_port *ap = link->ap;
struct ata_ioports *ioaddr = &ap->ioaddr;
unsigned int dev0 = devmask & (1 << 0);
unsigned int dev1 = devmask & (1 << 1);
int rc, ret = 0;
ata_msleep(ap, ATA_WAIT_AFTER_RESET);
/* always check readiness of the master device */
rc = ata_sff_wait_ready(link, deadline);
/* -ENODEV means the odd clown forgot the D7 pulldown resistor
* and TF status is 0xff, bail out on it too.
*/
if (rc)
return rc;
/* if device 1 was found in ata_devchk, wait for register
* access briefly, then wait for BSY to clear.
*/
if (dev1) {
int i;
ap->ops->sff_dev_select(ap, 1);
/* Wait for register access. Some ATAPI devices fail
* to set nsect/lbal after reset, so don't waste too
* much time on it. We're gonna wait for !BSY anyway.
*/
for (i = 0; i < 2; i++) {
u8 nsect, lbal;
nsect = ioread8(ioaddr->nsect_addr);
lbal = ioread8(ioaddr->lbal_addr);
if ((nsect == 1) && (lbal == 1))
break;
ata_msleep(ap, 50); /* give drive a breather */
}
rc = ata_sff_wait_ready(link, deadline);
if (rc) {
if (rc != -ENODEV)
return rc;
ret = rc;
}
}
/* is all this really necessary? */
ap->ops->sff_dev_select(ap, 0);
if (dev1)
ap->ops->sff_dev_select(ap, 1);
if (dev0)
ap->ops->sff_dev_select(ap, 0);
return ret;
}
EXPORT_SYMBOL_GPL(ata_sff_wait_after_reset);
static int ata_bus_softreset(struct ata_port *ap, unsigned int devmask,
unsigned long deadline)
{
struct ata_ioports *ioaddr = &ap->ioaddr;
DPRINTK("ata%u: bus reset via SRST\n", ap->print_id);
/* software reset. causes dev0 to be selected */
iowrite8(ap->ctl, ioaddr->ctl_addr);
udelay(20); /* FIXME: flush */
iowrite8(ap->ctl | ATA_SRST, ioaddr->ctl_addr);
udelay(20); /* FIXME: flush */
iowrite8(ap->ctl, ioaddr->ctl_addr);
ap->last_ctl = ap->ctl;
/* wait the port to become ready */
return ata_sff_wait_after_reset(&ap->link, devmask, deadline);
}
/**
* ata_sff_softreset - reset host port via ATA SRST
* @link: ATA link to reset
* @classes: resulting classes of attached devices
* @deadline: deadline jiffies for the operation
*
* Reset host port using ATA SRST.
*
* LOCKING:
* Kernel thread context (may sleep)
*
* RETURNS:
* 0 on success, -errno otherwise.
*/
int ata_sff_softreset(struct ata_link *link, unsigned int *classes,
unsigned long deadline)
{
struct ata_port *ap = link->ap;
unsigned int slave_possible = ap->flags & ATA_FLAG_SLAVE_POSS;
unsigned int devmask = 0;
int rc;
u8 err;
DPRINTK("ENTER\n");
/* determine if device 0/1 are present */
if (ata_devchk(ap, 0))
devmask |= (1 << 0);
if (slave_possible && ata_devchk(ap, 1))
devmask |= (1 << 1);
/* select device 0 again */
ap->ops->sff_dev_select(ap, 0);
/* issue bus reset */
DPRINTK("about to softreset, devmask=%x\n", devmask);
rc = ata_bus_softreset(ap, devmask, deadline);
/* if link is occupied, -ENODEV too is an error */
if (rc && (rc != -ENODEV || sata_scr_valid(link))) {
ata_link_err(link, "SRST failed (errno=%d)\n", rc);
return rc;
}
/* determine by signature whether we have ATA or ATAPI devices */
classes[0] = ata_sff_dev_classify(&link->device[0],
devmask & (1 << 0), &err);
if (slave_possible && err != 0x81)
classes[1] = ata_sff_dev_classify(&link->device[1],
devmask & (1 << 1), &err);
DPRINTK("EXIT, classes[0]=%u [1]=%u\n", classes[0], classes[1]);
return 0;
}
EXPORT_SYMBOL_GPL(ata_sff_softreset);
/**
* sata_sff_hardreset - reset host port via SATA phy reset
* @link: link to reset
* @class: resulting class of attached device
* @deadline: deadline jiffies for the operation
*
* SATA phy-reset host port using DET bits of SControl register,
* wait for !BSY and classify the attached device.
*
* LOCKING:
* Kernel thread context (may sleep)
*
* RETURNS:
* 0 on success, -errno otherwise.
*/
int sata_sff_hardreset(struct ata_link *link, unsigned int *class,
unsigned long deadline)
{
struct ata_eh_context *ehc = &link->eh_context;
const unsigned long *timing = sata_ehc_deb_timing(ehc);
bool online;
int rc;
rc = sata_link_hardreset(link, timing, deadline, &online,
ata_sff_check_ready);
if (online)
*class = ata_sff_dev_classify(link->device, 1, NULL);
DPRINTK("EXIT, class=%u\n", *class);
return rc;
}
EXPORT_SYMBOL_GPL(sata_sff_hardreset);
/**
* ata_sff_postreset - SFF postreset callback
* @link: the target SFF ata_link
* @classes: classes of attached devices
*
* This function is invoked after a successful reset. It first
* calls ata_std_postreset() and performs SFF specific postreset
* processing.
*
* LOCKING:
* Kernel thread context (may sleep)
*/
void ata_sff_postreset(struct ata_link *link, unsigned int *classes)
{
struct ata_port *ap = link->ap;
ata_std_postreset(link, classes);
/* is double-select really necessary? */
if (classes[0] != ATA_DEV_NONE)
ap->ops->sff_dev_select(ap, 1);
if (classes[1] != ATA_DEV_NONE)
ap->ops->sff_dev_select(ap, 0);
/* bail out if no device is present */
if (classes[0] == ATA_DEV_NONE && classes[1] == ATA_DEV_NONE) {
DPRINTK("EXIT, no device\n");
return;
}
/* set up device control */
if (ap->ops->sff_set_devctl || ap->ioaddr.ctl_addr) {
ata_sff_set_devctl(ap, ap->ctl);
ap->last_ctl = ap->ctl;
}
}
EXPORT_SYMBOL_GPL(ata_sff_postreset);
/**
* ata_sff_drain_fifo - Stock FIFO drain logic for SFF controllers
* @qc: command
*
* Drain the FIFO and device of any stuck data following a command
* failing to complete. In some cases this is necessary before a
* reset will recover the device.
*
*/
void ata_sff_drain_fifo(struct ata_queued_cmd *qc)
{
int count;
struct ata_port *ap;
/* We only need to flush incoming data when a command was running */
if (qc == NULL || qc->dma_dir == DMA_TO_DEVICE)
return;
ap = qc->ap;
/* Drain up to 64K of data before we give up this recovery method */
for (count = 0; (ap->ops->sff_check_status(ap) & ATA_DRQ)
&& count < 65536; count += 2)
ioread16(ap->ioaddr.data_addr);
/* Can become DEBUG later */
if (count)
ata_port_dbg(ap, "drained %d bytes to clear DRQ\n", count);
}
EXPORT_SYMBOL_GPL(ata_sff_drain_fifo);
/**
* ata_sff_error_handler - Stock error handler for SFF controller
* @ap: port to handle error for
*
* Stock error handler for SFF controller. It can handle both
* PATA and SATA controllers. Many controllers should be able to
* use this EH as-is or with some added handling before and
* after.
*
* LOCKING:
* Kernel thread context (may sleep)
*/
void ata_sff_error_handler(struct ata_port *ap)
{
ata_reset_fn_t softreset = ap->ops->softreset;
ata_reset_fn_t hardreset = ap->ops->hardreset;
struct ata_queued_cmd *qc;
unsigned long flags;
qc = __ata_qc_from_tag(ap, ap->link.active_tag);
if (qc && !(qc->flags & ATA_QCFLAG_FAILED))
qc = NULL;
spin_lock_irqsave(ap->lock, flags);
/*
* We *MUST* do FIFO draining before we issue a reset as
* several devices helpfully clear their internal state and
* will lock solid if we touch the data port post reset. Pass
* qc in case anyone wants to do different PIO/DMA recovery or
* has per command fixups
*/
if (ap->ops->sff_drain_fifo)
ap->ops->sff_drain_fifo(qc);
spin_unlock_irqrestore(ap->lock, flags);
/* ignore ata_sff_softreset if ctl isn't accessible */
if (softreset == ata_sff_softreset && !ap->ioaddr.ctl_addr)
softreset = NULL;
/* ignore built-in hardresets if SCR access is not available */
if ((hardreset == sata_std_hardreset ||
hardreset == sata_sff_hardreset) && !sata_scr_valid(&ap->link))
hardreset = NULL;
ata_do_eh(ap, ap->ops->prereset, softreset, hardreset,
ap->ops->postreset);
}
EXPORT_SYMBOL_GPL(ata_sff_error_handler);
/**
* ata_sff_std_ports - initialize ioaddr with standard port offsets.
* @ioaddr: IO address structure to be initialized
*
* Utility function which initializes data_addr, error_addr,
* feature_addr, nsect_addr, lbal_addr, lbam_addr, lbah_addr,
* device_addr, status_addr, and command_addr to standard offsets
* relative to cmd_addr.
*
* Does not set ctl_addr, altstatus_addr, bmdma_addr, or scr_addr.
*/
void ata_sff_std_ports(struct ata_ioports *ioaddr)
{
ioaddr->data_addr = ioaddr->cmd_addr + ATA_REG_DATA;
ioaddr->error_addr = ioaddr->cmd_addr + ATA_REG_ERR;
ioaddr->feature_addr = ioaddr->cmd_addr + ATA_REG_FEATURE;
ioaddr->nsect_addr = ioaddr->cmd_addr + ATA_REG_NSECT;
ioaddr->lbal_addr = ioaddr->cmd_addr + ATA_REG_LBAL;
ioaddr->lbam_addr = ioaddr->cmd_addr + ATA_REG_LBAM;
ioaddr->lbah_addr = ioaddr->cmd_addr + ATA_REG_LBAH;
ioaddr->device_addr = ioaddr->cmd_addr + ATA_REG_DEVICE;
ioaddr->status_addr = ioaddr->cmd_addr + ATA_REG_STATUS;
ioaddr->command_addr = ioaddr->cmd_addr + ATA_REG_CMD;
}
EXPORT_SYMBOL_GPL(ata_sff_std_ports);
#ifdef CONFIG_PCI
static int ata_resources_present(struct pci_dev *pdev, int port)
{
int i;
/* Check the PCI resources for this channel are enabled */
port = port * 2;
for (i = 0; i < 2; i++) {
if (pci_resource_start(pdev, port + i) == 0 ||
pci_resource_len(pdev, port + i) == 0)
return 0;
}
return 1;
}
/**
* ata_pci_sff_init_host - acquire native PCI ATA resources and init host
* @host: target ATA host
*
* Acquire native PCI ATA resources for @host and initialize the
* first two ports of @host accordingly. Ports marked dummy are
* skipped and allocation failure makes the port dummy.
*
* Note that native PCI resources are valid even for legacy hosts
* as we fix up pdev resources array early in boot, so this
* function can be used for both native and legacy SFF hosts.
*
* LOCKING:
* Inherited from calling layer (may sleep).
*
* RETURNS:
* 0 if at least one port is initialized, -ENODEV if no port is
* available.
*/
int ata_pci_sff_init_host(struct ata_host *host)
{
struct device *gdev = host->dev;
struct pci_dev *pdev = to_pci_dev(gdev);
unsigned int mask = 0;
int i, rc;
/* request, iomap BARs and init port addresses accordingly */
for (i = 0; i < 2; i++) {
struct ata_port *ap = host->ports[i];
int base = i * 2;
void __iomem * const *iomap;
if (ata_port_is_dummy(ap))
continue;
/* Discard disabled ports. Some controllers show
* their unused channels this way. Disabled ports are
* made dummy.
*/
if (!ata_resources_present(pdev, i)) {
ap->ops = &ata_dummy_port_ops;
continue;
}
rc = pcim_iomap_regions(pdev, 0x3 << base,
dev_driver_string(gdev));
if (rc) {
dev_warn(gdev,
"failed to request/iomap BARs for port %d (errno=%d)\n",
i, rc);
if (rc == -EBUSY)
pcim_pin_device(pdev);
ap->ops = &ata_dummy_port_ops;
continue;
}
host->iomap = iomap = pcim_iomap_table(pdev);
ap->ioaddr.cmd_addr = iomap[base];
ap->ioaddr.altstatus_addr =
ap->ioaddr.ctl_addr = (void __iomem *)
((unsigned long)iomap[base + 1] | ATA_PCI_CTL_OFS);
ata_sff_std_ports(&ap->ioaddr);
ata_port_desc(ap, "cmd 0x%llx ctl 0x%llx",
(unsigned long long)pci_resource_start(pdev, base),
(unsigned long long)pci_resource_start(pdev, base + 1));
mask |= 1 << i;
}
if (!mask) {
dev_err(gdev, "no available native port\n");
return -ENODEV;
}
return 0;
}
EXPORT_SYMBOL_GPL(ata_pci_sff_init_host);
/**
* ata_pci_sff_prepare_host - helper to prepare PCI PIO-only SFF ATA host
* @pdev: target PCI device
* @ppi: array of port_info, must be enough for two ports
* @r_host: out argument for the initialized ATA host
*
* Helper to allocate PIO-only SFF ATA host for @pdev, acquire
* all PCI resources and initialize it accordingly in one go.
*
* LOCKING:
* Inherited from calling layer (may sleep).
*
* RETURNS:
* 0 on success, -errno otherwise.
*/
int ata_pci_sff_prepare_host(struct pci_dev *pdev,
const struct ata_port_info * const *ppi,
struct ata_host **r_host)
{
struct ata_host *host;
int rc;
if (!devres_open_group(&pdev->dev, NULL, GFP_KERNEL))
return -ENOMEM;
host = ata_host_alloc_pinfo(&pdev->dev, ppi, 2);
if (!host) {
dev_err(&pdev->dev, "failed to allocate ATA host\n");
rc = -ENOMEM;
goto err_out;
}
rc = ata_pci_sff_init_host(host);
if (rc)
goto err_out;
devres_remove_group(&pdev->dev, NULL);
*r_host = host;
return 0;
err_out:
devres_release_group(&pdev->dev, NULL);
return rc;
}
EXPORT_SYMBOL_GPL(ata_pci_sff_prepare_host);
/**
* ata_pci_sff_activate_host - start SFF host, request IRQ and register it
* @host: target SFF ATA host
* @irq_handler: irq_handler used when requesting IRQ(s)
* @sht: scsi_host_template to use when registering the host
*
* This is the counterpart of ata_host_activate() for SFF ATA
* hosts. This separate helper is necessary because SFF hosts
* use two separate interrupts in legacy mode.
*
* LOCKING:
* Inherited from calling layer (may sleep).
*
* RETURNS:
* 0 on success, -errno otherwise.
*/
int ata_pci_sff_activate_host(struct ata_host *host,
irq_handler_t irq_handler,
struct scsi_host_template *sht)
{
struct device *dev = host->dev;
struct pci_dev *pdev = to_pci_dev(dev);
const char *drv_name = dev_driver_string(host->dev);
int legacy_mode = 0, rc;
rc = ata_host_start(host);
if (rc)
return rc;
if ((pdev->class >> 8) == PCI_CLASS_STORAGE_IDE) {
u8 tmp8, mask;
/* TODO: What if one channel is in native mode ... */
pci_read_config_byte(pdev, PCI_CLASS_PROG, &tmp8);
mask = (1 << 2) | (1 << 0);
if ((tmp8 & mask) != mask)
legacy_mode = 1;
}
if (!devres_open_group(dev, NULL, GFP_KERNEL))
return -ENOMEM;
if (!legacy_mode && pdev->irq) {
int i;
rc = devm_request_irq(dev, pdev->irq, irq_handler,
IRQF_SHARED, drv_name, host);
if (rc)
goto out;
for (i = 0; i < 2; i++) {
if (ata_port_is_dummy(host->ports[i]))
continue;
ata_port_desc(host->ports[i], "irq %d", pdev->irq);
}
} else if (legacy_mode) {
if (!ata_port_is_dummy(host->ports[0])) {
rc = devm_request_irq(dev, ATA_PRIMARY_IRQ(pdev),
irq_handler, IRQF_SHARED,
drv_name, host);
if (rc)
goto out;
ata_port_desc(host->ports[0], "irq %d",
ATA_PRIMARY_IRQ(pdev));
}
if (!ata_port_is_dummy(host->ports[1])) {
rc = devm_request_irq(dev, ATA_SECONDARY_IRQ(pdev),
irq_handler, IRQF_SHARED,
drv_name, host);
if (rc)
goto out;
ata_port_desc(host->ports[1], "irq %d",
ATA_SECONDARY_IRQ(pdev));
}
}
rc = ata_host_register(host, sht);
out:
if (rc == 0)
devres_remove_group(dev, NULL);
else
devres_release_group(dev, NULL);
return rc;
}
EXPORT_SYMBOL_GPL(ata_pci_sff_activate_host);
static const struct ata_port_info *ata_sff_find_valid_pi(
const struct ata_port_info * const *ppi)
{
int i;
/* look up the first valid port_info */
for (i = 0; i < 2 && ppi[i]; i++)
if (ppi[i]->port_ops != &ata_dummy_port_ops)
return ppi[i];
return NULL;
}
static int ata_pci_init_one(struct pci_dev *pdev,
const struct ata_port_info * const *ppi,
struct scsi_host_template *sht, void *host_priv,
int hflags, bool bmdma)
{
struct device *dev = &pdev->dev;
const struct ata_port_info *pi;
struct ata_host *host = NULL;
int rc;
DPRINTK("ENTER\n");
pi = ata_sff_find_valid_pi(ppi);
if (!pi) {
dev_err(&pdev->dev, "no valid port_info specified\n");
return -EINVAL;
}
if (!devres_open_group(dev, NULL, GFP_KERNEL))
return -ENOMEM;
rc = pcim_enable_device(pdev);
if (rc)
goto out;
#ifdef CONFIG_ATA_BMDMA
if (bmdma)
/* prepare and activate BMDMA host */
rc = ata_pci_bmdma_prepare_host(pdev, ppi, &host);
else
#endif
/* prepare and activate SFF host */
rc = ata_pci_sff_prepare_host(pdev, ppi, &host);
if (rc)
goto out;
host->private_data = host_priv;
host->flags |= hflags;
#ifdef CONFIG_ATA_BMDMA
if (bmdma) {
pci_set_master(pdev);
rc = ata_pci_sff_activate_host(host, ata_bmdma_interrupt, sht);
} else
#endif
rc = ata_pci_sff_activate_host(host, ata_sff_interrupt, sht);
out:
if (rc == 0)
devres_remove_group(&pdev->dev, NULL);
else
devres_release_group(&pdev->dev, NULL);
return rc;
}
/**
* ata_pci_sff_init_one - Initialize/register PIO-only PCI IDE controller
* @pdev: Controller to be initialized
* @ppi: array of port_info, must be enough for two ports
* @sht: scsi_host_template to use when registering the host
* @host_priv: host private_data
* @hflag: host flags
*
* This is a helper function which can be called from a driver's
* xxx_init_one() probe function if the hardware uses traditional
* IDE taskfile registers and is PIO only.
*
* ASSUMPTION:
* Nobody makes a single channel controller that appears solely as
* the secondary legacy port on PCI.
*
* LOCKING:
* Inherited from PCI layer (may sleep).
*
* RETURNS:
* Zero on success, negative on errno-based value on error.
*/
int ata_pci_sff_init_one(struct pci_dev *pdev,
const struct ata_port_info * const *ppi,
struct scsi_host_template *sht, void *host_priv, int hflag)
{
return ata_pci_init_one(pdev, ppi, sht, host_priv, hflag, 0);
}
EXPORT_SYMBOL_GPL(ata_pci_sff_init_one);
#endif /* CONFIG_PCI */
/*
* BMDMA support
*/
#ifdef CONFIG_ATA_BMDMA
const struct ata_port_operations ata_bmdma_port_ops = {
.inherits = &ata_sff_port_ops,
.error_handler = ata_bmdma_error_handler,
.post_internal_cmd = ata_bmdma_post_internal_cmd,
.qc_prep = ata_bmdma_qc_prep,
.qc_issue = ata_bmdma_qc_issue,
.sff_irq_clear = ata_bmdma_irq_clear,
.bmdma_setup = ata_bmdma_setup,
.bmdma_start = ata_bmdma_start,
.bmdma_stop = ata_bmdma_stop,
.bmdma_status = ata_bmdma_status,
.port_start = ata_bmdma_port_start,
};
EXPORT_SYMBOL_GPL(ata_bmdma_port_ops);
const struct ata_port_operations ata_bmdma32_port_ops = {
.inherits = &ata_bmdma_port_ops,
.sff_data_xfer = ata_sff_data_xfer32,
.port_start = ata_bmdma_port_start32,
};
EXPORT_SYMBOL_GPL(ata_bmdma32_port_ops);
/**
* ata_bmdma_fill_sg - Fill PCI IDE PRD table
* @qc: Metadata associated with taskfile to be transferred
*
* Fill PCI IDE PRD (scatter-gather) table with segments
* associated with the current disk command.
*
* LOCKING:
* spin_lock_irqsave(host lock)
*
*/
static void ata_bmdma_fill_sg(struct ata_queued_cmd *qc)
{
struct ata_port *ap = qc->ap;
struct ata_bmdma_prd *prd = ap->bmdma_prd;
struct scatterlist *sg;
unsigned int si, pi;
pi = 0;
for_each_sg(qc->sg, sg, qc->n_elem, si) {
u32 addr, offset;
u32 sg_len, len;
/* determine if physical DMA addr spans 64K boundary.
* Note h/w doesn't support 64-bit, so we unconditionally
* truncate dma_addr_t to u32.
*/
addr = (u32) sg_dma_address(sg);
sg_len = sg_dma_len(sg);
while (sg_len) {
offset = addr & 0xffff;
len = sg_len;
if ((offset + sg_len) > 0x10000)
len = 0x10000 - offset;
prd[pi].addr = cpu_to_le32(addr);
prd[pi].flags_len = cpu_to_le32(len & 0xffff);
VPRINTK("PRD[%u] = (0x%X, 0x%X)\n", pi, addr, len);
pi++;
sg_len -= len;
addr += len;
}
}
prd[pi - 1].flags_len |= cpu_to_le32(ATA_PRD_EOT);
}
/**
* ata_bmdma_fill_sg_dumb - Fill PCI IDE PRD table
* @qc: Metadata associated with taskfile to be transferred
*
* Fill PCI IDE PRD (scatter-gather) table with segments
* associated with the current disk command. Perform the fill
* so that we avoid writing any length 64K records for
* controllers that don't follow the spec.
*
* LOCKING:
* spin_lock_irqsave(host lock)
*
*/
static void ata_bmdma_fill_sg_dumb(struct ata_queued_cmd *qc)
{
struct ata_port *ap = qc->ap;
struct ata_bmdma_prd *prd = ap->bmdma_prd;
struct scatterlist *sg;
unsigned int si, pi;
pi = 0;
for_each_sg(qc->sg, sg, qc->n_elem, si) {
u32 addr, offset;
u32 sg_len, len, blen;
/* determine if physical DMA addr spans 64K boundary.
* Note h/w doesn't support 64-bit, so we unconditionally
* truncate dma_addr_t to u32.
*/
addr = (u32) sg_dma_address(sg);
sg_len = sg_dma_len(sg);
while (sg_len) {
offset = addr & 0xffff;
len = sg_len;
if ((offset + sg_len) > 0x10000)
len = 0x10000 - offset;
blen = len & 0xffff;
prd[pi].addr = cpu_to_le32(addr);
if (blen == 0) {
/* Some PATA chipsets like the CS5530 can't
cope with 0x0000 meaning 64K as the spec
says */
prd[pi].flags_len = cpu_to_le32(0x8000);
blen = 0x8000;
prd[++pi].addr = cpu_to_le32(addr + 0x8000);
}
prd[pi].flags_len = cpu_to_le32(blen);
VPRINTK("PRD[%u] = (0x%X, 0x%X)\n", pi, addr, len);
pi++;
sg_len -= len;
addr += len;
}
}
prd[pi - 1].flags_len |= cpu_to_le32(ATA_PRD_EOT);
}
/**
* ata_bmdma_qc_prep - Prepare taskfile for submission
* @qc: Metadata associated with taskfile to be prepared
*
* Prepare ATA taskfile for submission.
*
* LOCKING:
* spin_lock_irqsave(host lock)
*/
void ata_bmdma_qc_prep(struct ata_queued_cmd *qc)
{
if (!(qc->flags & ATA_QCFLAG_DMAMAP))
return;
ata_bmdma_fill_sg(qc);
}
EXPORT_SYMBOL_GPL(ata_bmdma_qc_prep);
/**
* ata_bmdma_dumb_qc_prep - Prepare taskfile for submission
* @qc: Metadata associated with taskfile to be prepared
*
* Prepare ATA taskfile for submission.
*
* LOCKING:
* spin_lock_irqsave(host lock)
*/
void ata_bmdma_dumb_qc_prep(struct ata_queued_cmd *qc)
{
if (!(qc->flags & ATA_QCFLAG_DMAMAP))
return;
ata_bmdma_fill_sg_dumb(qc);
}
EXPORT_SYMBOL_GPL(ata_bmdma_dumb_qc_prep);
/**
* ata_bmdma_qc_issue - issue taskfile to a BMDMA controller
* @qc: command to issue to device
*
* This function issues a PIO, NODATA or DMA command to a
* SFF/BMDMA controller. PIO and NODATA are handled by
* ata_sff_qc_issue().
*
* LOCKING:
* spin_lock_irqsave(host lock)
*
* RETURNS:
* Zero on success, AC_ERR_* mask on failure
*/
unsigned int ata_bmdma_qc_issue(struct ata_queued_cmd *qc)
{
struct ata_port *ap = qc->ap;
struct ata_link *link = qc->dev->link;
/* defer PIO handling to sff_qc_issue */
if (!ata_is_dma(qc->tf.protocol))
return ata_sff_qc_issue(qc);
/* select the device */
ata_dev_select(ap, qc->dev->devno, 1, 0);
/* start the command */
switch (qc->tf.protocol) {
case ATA_PROT_DMA:
WARN_ON_ONCE(qc->tf.flags & ATA_TFLAG_POLLING);
ap->ops->sff_tf_load(ap, &qc->tf); /* load tf registers */
ap->ops->bmdma_setup(qc); /* set up bmdma */
ap->ops->bmdma_start(qc); /* initiate bmdma */
ap->hsm_task_state = HSM_ST_LAST;
break;
case ATAPI_PROT_DMA:
WARN_ON_ONCE(qc->tf.flags & ATA_TFLAG_POLLING);
ap->ops->sff_tf_load(ap, &qc->tf); /* load tf registers */
ap->ops->bmdma_setup(qc); /* set up bmdma */
ap->hsm_task_state = HSM_ST_FIRST;
/* send cdb by polling if no cdb interrupt */
if (!(qc->dev->flags & ATA_DFLAG_CDB_INTR))
ata_sff_queue_pio_task(link, 0);
break;
default:
WARN_ON(1);
return AC_ERR_SYSTEM;
}
return 0;
}
EXPORT_SYMBOL_GPL(ata_bmdma_qc_issue);
/**
* ata_bmdma_port_intr - Handle BMDMA port interrupt
* @ap: Port on which interrupt arrived (possibly...)
* @qc: Taskfile currently active in engine
*
* Handle port interrupt for given queued command.
*
* LOCKING:
* spin_lock_irqsave(host lock)
*
* RETURNS:
* One if interrupt was handled, zero if not (shared irq).
*/
unsigned int ata_bmdma_port_intr(struct ata_port *ap, struct ata_queued_cmd *qc)
{
struct ata_eh_info *ehi = &ap->link.eh_info;
u8 host_stat = 0;
bool bmdma_stopped = false;
unsigned int handled;
if (ap->hsm_task_state == HSM_ST_LAST && ata_is_dma(qc->tf.protocol)) {
/* check status of DMA engine */
host_stat = ap->ops->bmdma_status(ap);
VPRINTK("ata%u: host_stat 0x%X\n", ap->print_id, host_stat);
/* if it's not our irq... */
if (!(host_stat & ATA_DMA_INTR))
return ata_sff_idle_irq(ap);
/* before we do anything else, clear DMA-Start bit */
ap->ops->bmdma_stop(qc);
bmdma_stopped = true;
if (unlikely(host_stat & ATA_DMA_ERR)) {
/* error when transferring data to/from memory */
qc->err_mask |= AC_ERR_HOST_BUS;
ap->hsm_task_state = HSM_ST_ERR;
}
}
handled = __ata_sff_port_intr(ap, qc, bmdma_stopped);
if (unlikely(qc->err_mask) && ata_is_dma(qc->tf.protocol))
ata_ehi_push_desc(ehi, "BMDMA stat 0x%x", host_stat);
return handled;
}
EXPORT_SYMBOL_GPL(ata_bmdma_port_intr);
/**
* ata_bmdma_interrupt - Default BMDMA ATA host interrupt handler
* @irq: irq line (unused)
* @dev_instance: pointer to our ata_host information structure
*
* Default interrupt handler for PCI IDE devices. Calls
* ata_bmdma_port_intr() for each port that is not disabled.
*
* LOCKING:
* Obtains host lock during operation.
*
* RETURNS:
* IRQ_NONE or IRQ_HANDLED.
*/
irqreturn_t ata_bmdma_interrupt(int irq, void *dev_instance)
{
return __ata_sff_interrupt(irq, dev_instance, ata_bmdma_port_intr);
}
EXPORT_SYMBOL_GPL(ata_bmdma_interrupt);
/**
* ata_bmdma_error_handler - Stock error handler for BMDMA controller
* @ap: port to handle error for
*
* Stock error handler for BMDMA controller. It can handle both
* PATA and SATA controllers. Most BMDMA controllers should be
* able to use this EH as-is or with some added handling before
* and after.
*
* LOCKING:
* Kernel thread context (may sleep)
*/
void ata_bmdma_error_handler(struct ata_port *ap)
{
struct ata_queued_cmd *qc;
unsigned long flags;
bool thaw = false;
qc = __ata_qc_from_tag(ap, ap->link.active_tag);
if (qc && !(qc->flags & ATA_QCFLAG_FAILED))
qc = NULL;
/* reset PIO HSM and stop DMA engine */
spin_lock_irqsave(ap->lock, flags);
if (qc && ata_is_dma(qc->tf.protocol)) {
u8 host_stat;
host_stat = ap->ops->bmdma_status(ap);
/* BMDMA controllers indicate host bus error by
* setting DMA_ERR bit and timing out. As it wasn't
* really a timeout event, adjust error mask and
* cancel frozen state.
*/
if (qc->err_mask == AC_ERR_TIMEOUT && (host_stat & ATA_DMA_ERR)) {
qc->err_mask = AC_ERR_HOST_BUS;
thaw = true;
}
ap->ops->bmdma_stop(qc);
/* if we're gonna thaw, make sure IRQ is clear */
if (thaw) {
ap->ops->sff_check_status(ap);
if (ap->ops->sff_irq_clear)
ap->ops->sff_irq_clear(ap);
}
}
spin_unlock_irqrestore(ap->lock, flags);
if (thaw)
ata_eh_thaw_port(ap);
ata_sff_error_handler(ap);
}
EXPORT_SYMBOL_GPL(ata_bmdma_error_handler);
/**
* ata_bmdma_post_internal_cmd - Stock post_internal_cmd for BMDMA
* @qc: internal command to clean up
*
* LOCKING:
* Kernel thread context (may sleep)
*/
void ata_bmdma_post_internal_cmd(struct ata_queued_cmd *qc)
{
struct ata_port *ap = qc->ap;
unsigned long flags;
if (ata_is_dma(qc->tf.protocol)) {
spin_lock_irqsave(ap->lock, flags);
ap->ops->bmdma_stop(qc);
spin_unlock_irqrestore(ap->lock, flags);
}
}
EXPORT_SYMBOL_GPL(ata_bmdma_post_internal_cmd);
/**
* ata_bmdma_irq_clear - Clear PCI IDE BMDMA interrupt.
* @ap: Port associated with this ATA transaction.
*
* Clear interrupt and error flags in DMA status register.
*
* May be used as the irq_clear() entry in ata_port_operations.
*
* LOCKING:
* spin_lock_irqsave(host lock)
*/
void ata_bmdma_irq_clear(struct ata_port *ap)
{
void __iomem *mmio = ap->ioaddr.bmdma_addr;
if (!mmio)
return;
iowrite8(ioread8(mmio + ATA_DMA_STATUS), mmio + ATA_DMA_STATUS);
}
EXPORT_SYMBOL_GPL(ata_bmdma_irq_clear);
/**
* ata_bmdma_setup - Set up PCI IDE BMDMA transaction
* @qc: Info associated with this ATA transaction.
*
* LOCKING:
* spin_lock_irqsave(host lock)
*/
void ata_bmdma_setup(struct ata_queued_cmd *qc)
{
struct ata_port *ap = qc->ap;
unsigned int rw = (qc->tf.flags & ATA_TFLAG_WRITE);
u8 dmactl;
/* load PRD table addr. */
mb(); /* make sure PRD table writes are visible to controller */
iowrite32(ap->bmdma_prd_dma, ap->ioaddr.bmdma_addr + ATA_DMA_TABLE_OFS);
/* specify data direction, triple-check start bit is clear */
dmactl = ioread8(ap->ioaddr.bmdma_addr + ATA_DMA_CMD);
dmactl &= ~(ATA_DMA_WR | ATA_DMA_START);
if (!rw)
dmactl |= ATA_DMA_WR;
iowrite8(dmactl, ap->ioaddr.bmdma_addr + ATA_DMA_CMD);
/* issue r/w command */
ap->ops->sff_exec_command(ap, &qc->tf);
}
EXPORT_SYMBOL_GPL(ata_bmdma_setup);
/**
* ata_bmdma_start - Start a PCI IDE BMDMA transaction
* @qc: Info associated with this ATA transaction.
*
* LOCKING:
* spin_lock_irqsave(host lock)
*/
void ata_bmdma_start(struct ata_queued_cmd *qc)
{
struct ata_port *ap = qc->ap;
u8 dmactl;
/* start host DMA transaction */
dmactl = ioread8(ap->ioaddr.bmdma_addr + ATA_DMA_CMD);
iowrite8(dmactl | ATA_DMA_START, ap->ioaddr.bmdma_addr + ATA_DMA_CMD);
/* Strictly, one may wish to issue an ioread8() here, to
* flush the mmio write. However, control also passes
* to the hardware at this point, and it will interrupt
* us when we are to resume control. So, in effect,
* we don't care when the mmio write flushes.
* Further, a read of the DMA status register _immediately_
* following the write may not be what certain flaky hardware
* is expected, so I think it is best to not add a readb()
* without first all the MMIO ATA cards/mobos.
* Or maybe I'm just being paranoid.
*
* FIXME: The posting of this write means I/O starts are
* unnecessarily delayed for MMIO
*/
}
EXPORT_SYMBOL_GPL(ata_bmdma_start);
/**
* ata_bmdma_stop - Stop PCI IDE BMDMA transfer
* @qc: Command we are ending DMA for
*
* Clears the ATA_DMA_START flag in the dma control register
*
* May be used as the bmdma_stop() entry in ata_port_operations.
*
* LOCKING:
* spin_lock_irqsave(host lock)
*/
void ata_bmdma_stop(struct ata_queued_cmd *qc)
{
struct ata_port *ap = qc->ap;
void __iomem *mmio = ap->ioaddr.bmdma_addr;
/* clear start/stop bit */
iowrite8(ioread8(mmio + ATA_DMA_CMD) & ~ATA_DMA_START,
mmio + ATA_DMA_CMD);
/* one-PIO-cycle guaranteed wait, per spec, for HDMA1:0 transition */
ata_sff_dma_pause(ap);
}
EXPORT_SYMBOL_GPL(ata_bmdma_stop);
/**
* ata_bmdma_status - Read PCI IDE BMDMA status
* @ap: Port associated with this ATA transaction.
*
* Read and return BMDMA status register.
*
* May be used as the bmdma_status() entry in ata_port_operations.
*
* LOCKING:
* spin_lock_irqsave(host lock)
*/
u8 ata_bmdma_status(struct ata_port *ap)
{
return ioread8(ap->ioaddr.bmdma_addr + ATA_DMA_STATUS);
}
EXPORT_SYMBOL_GPL(ata_bmdma_status);
/**
* ata_bmdma_port_start - Set port up for bmdma.
* @ap: Port to initialize
*
* Called just after data structures for each port are
* initialized. Allocates space for PRD table.
*
* May be used as the port_start() entry in ata_port_operations.
*
* LOCKING:
* Inherited from caller.
*/
int ata_bmdma_port_start(struct ata_port *ap)
{
if (ap->mwdma_mask || ap->udma_mask) {
ap->bmdma_prd =
dmam_alloc_coherent(ap->host->dev, ATA_PRD_TBL_SZ,
&ap->bmdma_prd_dma, GFP_KERNEL);
if (!ap->bmdma_prd)
return -ENOMEM;
}
return 0;
}
EXPORT_SYMBOL_GPL(ata_bmdma_port_start);
/**
* ata_bmdma_port_start32 - Set port up for dma.
* @ap: Port to initialize
*
* Called just after data structures for each port are
* initialized. Enables 32bit PIO and allocates space for PRD
* table.
*
* May be used as the port_start() entry in ata_port_operations for
* devices that are capable of 32bit PIO.
*
* LOCKING:
* Inherited from caller.
*/
int ata_bmdma_port_start32(struct ata_port *ap)
{
ap->pflags |= ATA_PFLAG_PIO32 | ATA_PFLAG_PIO32CHANGE;
return ata_bmdma_port_start(ap);
}
EXPORT_SYMBOL_GPL(ata_bmdma_port_start32);
#ifdef CONFIG_PCI
/**
* ata_pci_bmdma_clear_simplex - attempt to kick device out of simplex
* @pdev: PCI device
*
* Some PCI ATA devices report simplex mode but in fact can be told to
* enter non simplex mode. This implements the necessary logic to
* perform the task on such devices. Calling it on other devices will
* have -undefined- behaviour.
*/
int ata_pci_bmdma_clear_simplex(struct pci_dev *pdev)
{
unsigned long bmdma = pci_resource_start(pdev, 4);
u8 simplex;
if (bmdma == 0)
return -ENOENT;
simplex = inb(bmdma + 0x02);
outb(simplex & 0x60, bmdma + 0x02);
simplex = inb(bmdma + 0x02);
if (simplex & 0x80)
return -EOPNOTSUPP;
return 0;
}
EXPORT_SYMBOL_GPL(ata_pci_bmdma_clear_simplex);
static void ata_bmdma_nodma(struct ata_host *host, const char *reason)
{
int i;
dev_err(host->dev, "BMDMA: %s, falling back to PIO\n", reason);
for (i = 0; i < 2; i++) {
host->ports[i]->mwdma_mask = 0;
host->ports[i]->udma_mask = 0;
}
}
/**
* ata_pci_bmdma_init - acquire PCI BMDMA resources and init ATA host
* @host: target ATA host
*
* Acquire PCI BMDMA resources and initialize @host accordingly.
*
* LOCKING:
* Inherited from calling layer (may sleep).
*/
void ata_pci_bmdma_init(struct ata_host *host)
{
struct device *gdev = host->dev;
struct pci_dev *pdev = to_pci_dev(gdev);
int i, rc;
/* No BAR4 allocation: No DMA */
if (pci_resource_start(pdev, 4) == 0) {
ata_bmdma_nodma(host, "BAR4 is zero");
return;
}
/*
* Some controllers require BMDMA region to be initialized
* even if DMA is not in use to clear IRQ status via
* ->sff_irq_clear method. Try to initialize bmdma_addr
* regardless of dma masks.
*/
rc = pci_set_dma_mask(pdev, ATA_DMA_MASK);
if (rc)
ata_bmdma_nodma(host, "failed to set dma mask");
if (!rc) {
rc = pci_set_consistent_dma_mask(pdev, ATA_DMA_MASK);
if (rc)
ata_bmdma_nodma(host,
"failed to set consistent dma mask");
}
/* request and iomap DMA region */
rc = pcim_iomap_regions(pdev, 1 << 4, dev_driver_string(gdev));
if (rc) {
ata_bmdma_nodma(host, "failed to request/iomap BAR4");
return;
}
host->iomap = pcim_iomap_table(pdev);
for (i = 0; i < 2; i++) {
struct ata_port *ap = host->ports[i];
void __iomem *bmdma = host->iomap[4] + 8 * i;
if (ata_port_is_dummy(ap))
continue;
ap->ioaddr.bmdma_addr = bmdma;
if ((!(ap->flags & ATA_FLAG_IGN_SIMPLEX)) &&
(ioread8(bmdma + 2) & 0x80))
host->flags |= ATA_HOST_SIMPLEX;
ata_port_desc(ap, "bmdma 0x%llx",
(unsigned long long)pci_resource_start(pdev, 4) + 8 * i);
}
}
EXPORT_SYMBOL_GPL(ata_pci_bmdma_init);
/**
* ata_pci_bmdma_prepare_host - helper to prepare PCI BMDMA ATA host
* @pdev: target PCI device
* @ppi: array of port_info, must be enough for two ports
* @r_host: out argument for the initialized ATA host
*
* Helper to allocate BMDMA ATA host for @pdev, acquire all PCI
* resources and initialize it accordingly in one go.
*
* LOCKING:
* Inherited from calling layer (may sleep).
*
* RETURNS:
* 0 on success, -errno otherwise.
*/
int ata_pci_bmdma_prepare_host(struct pci_dev *pdev,
const struct ata_port_info * const * ppi,
struct ata_host **r_host)
{
int rc;
rc = ata_pci_sff_prepare_host(pdev, ppi, r_host);
if (rc)
return rc;
ata_pci_bmdma_init(*r_host);
return 0;
}
EXPORT_SYMBOL_GPL(ata_pci_bmdma_prepare_host);
/**
* ata_pci_bmdma_init_one - Initialize/register BMDMA PCI IDE controller
* @pdev: Controller to be initialized
* @ppi: array of port_info, must be enough for two ports
* @sht: scsi_host_template to use when registering the host
* @host_priv: host private_data
* @hflags: host flags
*
* This function is similar to ata_pci_sff_init_one() but also
* takes care of BMDMA initialization.
*
* LOCKING:
* Inherited from PCI layer (may sleep).
*
* RETURNS:
* Zero on success, negative on errno-based value on error.
*/
int ata_pci_bmdma_init_one(struct pci_dev *pdev,
const struct ata_port_info * const * ppi,
struct scsi_host_template *sht, void *host_priv,
int hflags)
{
return ata_pci_init_one(pdev, ppi, sht, host_priv, hflags, 1);
}
EXPORT_SYMBOL_GPL(ata_pci_bmdma_init_one);
#endif /* CONFIG_PCI */
#endif /* CONFIG_ATA_BMDMA */
/**
* ata_sff_port_init - Initialize SFF/BMDMA ATA port
* @ap: Port to initialize
*
* Called on port allocation to initialize SFF/BMDMA specific
* fields.
*
* LOCKING:
* None.
*/
void ata_sff_port_init(struct ata_port *ap)
{
INIT_DELAYED_WORK(&ap->sff_pio_task, ata_sff_pio_task);
ap->ctl = ATA_DEVCTL_OBS;
ap->last_ctl = 0xFF;
}
int __init ata_sff_init(void)
{
ata_sff_wq = alloc_workqueue("ata_sff", WQ_MEM_RECLAIM, WQ_MAX_ACTIVE);
if (!ata_sff_wq)
return -ENOMEM;
return 0;
}
void ata_sff_exit(void)
{
destroy_workqueue(ata_sff_wq);
}
|
require 'formula'
class Ngrep < Formula
desc "network grep"
homepage 'http://ngrep.sourceforge.net/'
url 'https://downloads.sourceforge.net/project/ngrep/ngrep/1.45/ngrep-1.45.tar.bz2'
sha1 'f26090a6ac607db66df99c6fa9aef74968f3330f'
revision 1
bottle do
cellar :any
sha1 "8d06dc84b5e22b309dbf3b2eb1c6933b45478b9c" => :mavericks
sha1 "a03e65a486e3bd285ad2dd18ce8b6dc7faa04802" => :mountain_lion
sha1 "03fb46935a159ef96a5905b0f8c39900113a024d" => :lion
end
# http://sourceforge.net/p/ngrep/bugs/27/
patch do
url 'https://launchpadlibrarian.net/44952147/ngrep-fix-ipv6-support.patch'
sha1 '84ff02f59b4fab8692a3ff2a61b45a4b9d067177'
end
def install
system "./configure", "--disable-debug",
"--disable-dependency-tracking",
"--enable-ipv6",
"--prefix=#{prefix}",
# this line required to make configure succeed
"--with-pcap-includes=#{MacOS.sdk_path}/usr/include",
# this line required to avoid segfaults
# see https://github.com/jpr5/ngrep/commit/e29fc29
# https://github.com/Homebrew/homebrew/issues/27171
"--disable-pcap-restart"
system "make install"
end
end
|
package logrus
import (
"bytes"
"fmt"
"sort"
"strings"
"sync"
"time"
)
const (
nocolor = 0
red = 31
green = 32
yellow = 33
blue = 36
gray = 37
)
var (
baseTimestamp time.Time
)
func init() {
baseTimestamp = time.Now()
}
// TextFormatter formats logs into text
type TextFormatter struct {
// Set to true to bypass checking for a TTY before outputting colors.
ForceColors bool
// Force disabling colors.
DisableColors bool
// Disable timestamp logging. useful when output is redirected to logging
// system that already adds timestamps.
DisableTimestamp bool
// Enable logging the full timestamp when a TTY is attached instead of just
// the time passed since beginning of execution.
FullTimestamp bool
// TimestampFormat to use for display when a full timestamp is printed
TimestampFormat string
// The fields are sorted by default for a consistent output. For applications
// that log extremely frequently and don't use the JSON formatter this may not
// be desired.
DisableSorting bool
// QuoteEmptyFields will wrap empty fields in quotes if true
QuoteEmptyFields bool
// Whether the logger's out is to a terminal
isTerminal bool
sync.Once
}
func (f *TextFormatter) init(entry *Entry) {
if entry.Logger != nil {
f.isTerminal = checkIfTerminal(entry.Logger.Out)
}
}
// Format renders a single log entry
func (f *TextFormatter) Format(entry *Entry) ([]byte, error) {
var b *bytes.Buffer
keys := make([]string, 0, len(entry.Data))
for k := range entry.Data {
keys = append(keys, k)
}
if !f.DisableSorting {
sort.Strings(keys)
}
if entry.Buffer != nil {
b = entry.Buffer
} else {
b = &bytes.Buffer{}
}
prefixFieldClashes(entry.Data)
f.Do(func() { f.init(entry) })
isColored := (f.ForceColors || f.isTerminal) && !f.DisableColors
timestampFormat := f.TimestampFormat
if timestampFormat == "" {
timestampFormat = defaultTimestampFormat
}
if isColored {
f.printColored(b, entry, keys, timestampFormat)
} else {
if !f.DisableTimestamp {
f.appendKeyValue(b, "time", entry.Time.Format(timestampFormat))
}
f.appendKeyValue(b, "level", entry.Level.String())
if entry.Message != "" {
f.appendKeyValue(b, "msg", entry.Message)
}
for _, key := range keys {
f.appendKeyValue(b, key, entry.Data[key])
}
}
b.WriteByte('\n')
return b.Bytes(), nil
}
func (f *TextFormatter) printColored(b *bytes.Buffer, entry *Entry, keys []string, timestampFormat string) {
var levelColor int
switch entry.Level {
case DebugLevel:
levelColor = gray
case WarnLevel:
levelColor = yellow
case ErrorLevel, FatalLevel, PanicLevel:
levelColor = red
default:
levelColor = blue
}
levelText := strings.ToUpper(entry.Level.String())[0:4]
if f.DisableTimestamp {
fmt.Fprintf(b, "\x1b[%dm%s\x1b[0m %-44s ", levelColor, levelText, entry.Message)
} else if !f.FullTimestamp {
fmt.Fprintf(b, "\x1b[%dm%s\x1b[0m[%04d] %-44s ", levelColor, levelText, int(entry.Time.Sub(baseTimestamp)/time.Second), entry.Message)
} else {
fmt.Fprintf(b, "\x1b[%dm%s\x1b[0m[%s] %-44s ", levelColor, levelText, entry.Time.Format(timestampFormat), entry.Message)
}
for _, k := range keys {
v := entry.Data[k]
fmt.Fprintf(b, " \x1b[%dm%s\x1b[0m=", levelColor, k)
f.appendValue(b, v)
}
}
func (f *TextFormatter) needsQuoting(text string) bool {
if f.QuoteEmptyFields && len(text) == 0 {
return true
}
for _, ch := range text {
if !((ch >= 'a' && ch <= 'z') ||
(ch >= 'A' && ch <= 'Z') ||
(ch >= '0' && ch <= '9') ||
ch == '-' || ch == '.' || ch == '_' || ch == '/' || ch == '@' || ch == '^' || ch == '+') {
return true
}
}
return false
}
func (f *TextFormatter) appendKeyValue(b *bytes.Buffer, key string, value interface{}) {
if b.Len() > 0 {
b.WriteByte(' ')
}
b.WriteString(key)
b.WriteByte('=')
f.appendValue(b, value)
}
func (f *TextFormatter) appendValue(b *bytes.Buffer, value interface{}) {
stringVal, ok := value.(string)
if !ok {
stringVal = fmt.Sprint(value)
}
if !f.needsQuoting(stringVal) {
b.WriteString(stringVal)
} else {
b.WriteString(fmt.Sprintf("%q", stringVal))
}
}
|
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactMultiChild
* @typechecks static-only
*/
'use strict';
var ReactComponentEnvironment = require("./ReactComponentEnvironment");
var ReactMultiChildUpdateTypes = require("./ReactMultiChildUpdateTypes");
var ReactReconciler = require("./ReactReconciler");
var ReactChildReconciler = require("./ReactChildReconciler");
/**
* Updating children of a component may trigger recursive updates. The depth is
* used to batch recursive updates to render markup more efficiently.
*
* @type {number}
* @private
*/
var updateDepth = 0;
/**
* Queue of update configuration objects.
*
* Each object has a `type` property that is in `ReactMultiChildUpdateTypes`.
*
* @type {array<object>}
* @private
*/
var updateQueue = [];
/**
* Queue of markup to be rendered.
*
* @type {array<string>}
* @private
*/
var markupQueue = [];
/**
* Enqueues markup to be rendered and inserted at a supplied index.
*
* @param {string} parentID ID of the parent component.
* @param {string} markup Markup that renders into an element.
* @param {number} toIndex Destination index.
* @private
*/
function enqueueMarkup(parentID, markup, toIndex) {
// NOTE: Null values reduce hidden classes.
updateQueue.push({
parentID: parentID,
parentNode: null,
type: ReactMultiChildUpdateTypes.INSERT_MARKUP,
markupIndex: markupQueue.push(markup) - 1,
textContent: null,
fromIndex: null,
toIndex: toIndex
});
}
/**
* Enqueues moving an existing element to another index.
*
* @param {string} parentID ID of the parent component.
* @param {number} fromIndex Source index of the existing element.
* @param {number} toIndex Destination index of the element.
* @private
*/
function enqueueMove(parentID, fromIndex, toIndex) {
// NOTE: Null values reduce hidden classes.
updateQueue.push({
parentID: parentID,
parentNode: null,
type: ReactMultiChildUpdateTypes.MOVE_EXISTING,
markupIndex: null,
textContent: null,
fromIndex: fromIndex,
toIndex: toIndex
});
}
/**
* Enqueues removing an element at an index.
*
* @param {string} parentID ID of the parent component.
* @param {number} fromIndex Index of the element to remove.
* @private
*/
function enqueueRemove(parentID, fromIndex) {
// NOTE: Null values reduce hidden classes.
updateQueue.push({
parentID: parentID,
parentNode: null,
type: ReactMultiChildUpdateTypes.REMOVE_NODE,
markupIndex: null,
textContent: null,
fromIndex: fromIndex,
toIndex: null
});
}
/**
* Enqueues setting the text content.
*
* @param {string} parentID ID of the parent component.
* @param {string} textContent Text content to set.
* @private
*/
function enqueueTextContent(parentID, textContent) {
// NOTE: Null values reduce hidden classes.
updateQueue.push({
parentID: parentID,
parentNode: null,
type: ReactMultiChildUpdateTypes.TEXT_CONTENT,
markupIndex: null,
textContent: textContent,
fromIndex: null,
toIndex: null
});
}
/**
* Processes any enqueued updates.
*
* @private
*/
function processQueue() {
if (updateQueue.length) {
ReactComponentEnvironment.processChildrenUpdates(
updateQueue,
markupQueue
);
clearQueue();
}
}
/**
* Clears any enqueued updates.
*
* @private
*/
function clearQueue() {
updateQueue.length = 0;
markupQueue.length = 0;
}
/**
* ReactMultiChild are capable of reconciling multiple children.
*
* @class ReactMultiChild
* @internal
*/
var ReactMultiChild = {
/**
* Provides common functionality for components that must reconcile multiple
* children. This is used by `ReactDOMComponent` to mount, update, and
* unmount child components.
*
* @lends {ReactMultiChild.prototype}
*/
Mixin: {
/**
* Generates a "mount image" for each of the supplied children. In the case
* of `ReactDOMComponent`, a mount image is a string of markup.
*
* @param {?object} nestedChildren Nested child maps.
* @return {array} An array of mounted representations.
* @internal
*/
mountChildren: function(nestedChildren, transaction, context) {
var children = ReactChildReconciler.instantiateChildren(
nestedChildren, transaction, context
);
this._renderedChildren = children;
var mountImages = [];
var index = 0;
for (var name in children) {
if (children.hasOwnProperty(name)) {
var child = children[name];
// Inlined for performance, see `ReactInstanceHandles.createReactID`.
var rootID = this._rootNodeID + name;
var mountImage = ReactReconciler.mountComponent(
child,
rootID,
transaction,
context
);
child._mountIndex = index;
mountImages.push(mountImage);
index++;
}
}
return mountImages;
},
/**
* Replaces any rendered children with a text content string.
*
* @param {string} nextContent String of content.
* @internal
*/
updateTextContent: function(nextContent) {
updateDepth++;
var errorThrown = true;
try {
var prevChildren = this._renderedChildren;
// Remove any rendered children.
ReactChildReconciler.unmountChildren(prevChildren);
// TODO: The setTextContent operation should be enough
for (var name in prevChildren) {
if (prevChildren.hasOwnProperty(name)) {
this._unmountChildByName(prevChildren[name], name);
}
}
// Set new text content.
this.setTextContent(nextContent);
errorThrown = false;
} finally {
updateDepth--;
if (!updateDepth) {
if (errorThrown) {
clearQueue();
} else {
processQueue();
}
}
}
},
/**
* Updates the rendered children with new children.
*
* @param {?object} nextNestedChildren Nested child maps.
* @param {ReactReconcileTransaction} transaction
* @internal
*/
updateChildren: function(nextNestedChildren, transaction, context) {
updateDepth++;
var errorThrown = true;
try {
this._updateChildren(nextNestedChildren, transaction, context);
errorThrown = false;
} finally {
updateDepth--;
if (!updateDepth) {
if (errorThrown) {
clearQueue();
} else {
processQueue();
}
}
}
},
/**
* Improve performance by isolating this hot code path from the try/catch
* block in `updateChildren`.
*
* @param {?object} nextNestedChildren Nested child maps.
* @param {ReactReconcileTransaction} transaction
* @final
* @protected
*/
_updateChildren: function(nextNestedChildren, transaction, context) {
var prevChildren = this._renderedChildren;
var nextChildren = ReactChildReconciler.updateChildren(
prevChildren, nextNestedChildren, transaction, context
);
this._renderedChildren = nextChildren;
if (!nextChildren && !prevChildren) {
return;
}
var name;
// `nextIndex` will increment for each child in `nextChildren`, but
// `lastIndex` will be the last index visited in `prevChildren`.
var lastIndex = 0;
var nextIndex = 0;
for (name in nextChildren) {
if (!nextChildren.hasOwnProperty(name)) {
continue;
}
var prevChild = prevChildren && prevChildren[name];
var nextChild = nextChildren[name];
if (prevChild === nextChild) {
this.moveChild(prevChild, nextIndex, lastIndex);
lastIndex = Math.max(prevChild._mountIndex, lastIndex);
prevChild._mountIndex = nextIndex;
} else {
if (prevChild) {
// Update `lastIndex` before `_mountIndex` gets unset by unmounting.
lastIndex = Math.max(prevChild._mountIndex, lastIndex);
this._unmountChildByName(prevChild, name);
}
// The child must be instantiated before it's mounted.
this._mountChildByNameAtIndex(
nextChild, name, nextIndex, transaction, context
);
}
nextIndex++;
}
// Remove children that are no longer present.
for (name in prevChildren) {
if (prevChildren.hasOwnProperty(name) &&
!(nextChildren && nextChildren.hasOwnProperty(name))) {
this._unmountChildByName(prevChildren[name], name);
}
}
},
/**
* Unmounts all rendered children. This should be used to clean up children
* when this component is unmounted.
*
* @internal
*/
unmountChildren: function() {
var renderedChildren = this._renderedChildren;
ReactChildReconciler.unmountChildren(renderedChildren);
this._renderedChildren = null;
},
/**
* Moves a child component to the supplied index.
*
* @param {ReactComponent} child Component to move.
* @param {number} toIndex Destination index of the element.
* @param {number} lastIndex Last index visited of the siblings of `child`.
* @protected
*/
moveChild: function(child, toIndex, lastIndex) {
// If the index of `child` is less than `lastIndex`, then it needs to
// be moved. Otherwise, we do not need to move it because a child will be
// inserted or moved before `child`.
if (child._mountIndex < lastIndex) {
enqueueMove(this._rootNodeID, child._mountIndex, toIndex);
}
},
/**
* Creates a child component.
*
* @param {ReactComponent} child Component to create.
* @param {string} mountImage Markup to insert.
* @protected
*/
createChild: function(child, mountImage) {
enqueueMarkup(this._rootNodeID, mountImage, child._mountIndex);
},
/**
* Removes a child component.
*
* @param {ReactComponent} child Child to remove.
* @protected
*/
removeChild: function(child) {
enqueueRemove(this._rootNodeID, child._mountIndex);
},
/**
* Sets this text content string.
*
* @param {string} textContent Text content to set.
* @protected
*/
setTextContent: function(textContent) {
enqueueTextContent(this._rootNodeID, textContent);
},
/**
* Mounts a child with the supplied name.
*
* NOTE: This is part of `updateChildren` and is here for readability.
*
* @param {ReactComponent} child Component to mount.
* @param {string} name Name of the child.
* @param {number} index Index at which to insert the child.
* @param {ReactReconcileTransaction} transaction
* @private
*/
_mountChildByNameAtIndex: function(
child,
name,
index,
transaction,
context) {
// Inlined for performance, see `ReactInstanceHandles.createReactID`.
var rootID = this._rootNodeID + name;
var mountImage = ReactReconciler.mountComponent(
child,
rootID,
transaction,
context
);
child._mountIndex = index;
this.createChild(child, mountImage);
},
/**
* Unmounts a rendered child by name.
*
* NOTE: This is part of `updateChildren` and is here for readability.
*
* @param {ReactComponent} child Component to unmount.
* @param {string} name Name of the child in `this._renderedChildren`.
* @private
*/
_unmountChildByName: function(child, name) {
this.removeChild(child);
child._mountIndex = null;
}
}
};
module.exports = ReactMultiChild;
|
/* skelJS v0.4 | (c) n33 | skeljs.org | MIT licensed */
skel.registerPlugin("panels",function(){var b={config:{baseZIndex:1E4,useTransform:!0,transformBreakpoints:null,speed:250,panels:{},overlays:{}},cache:{panels:{},overlays:{},body:null,window:null,pageWrapper:null,defaultWrapper:null,fixedWrapper:null,activePanel:null},eventType:"click",positions:{panels:{top:["top","left"],right:["top","right"],bottom:["bottom","left"],left:["top","left"]},overlays:{"top-left":{top:0,left:0},"top-right":{top:0,right:0},top:{top:0,left:"50%"},"top-center":{top:0,left:"50%"},
"bottom-left":{bottom:0,left:0},"bottom-right":{bottom:0,right:0},bottom:{bottom:0,left:"50%"},"bottom-center":{bottom:0,left:"50%"},left:{top:"50%",left:0},"middle-left":{top:"50%",left:0},right:{top:"50%",right:0},"middle-right":{top:"50%",right:0}}},presets:{standard:{panels:{navPanel:{breakpoints:"mobile",position:"left",style:"push",size:"80%",html:'<div data-action="navList" data-args="nav"></div>'}},overlays:{titleBar:{breakpoints:"mobile",position:"top-left",width:"100%",height:44,html:'<span class="toggle" data-action="togglePanel" data-args="navPanel"></span><span class="title" data-action="copyHTML" data-args="logo"></span>'}}}},
defaults:{config:{panel:{breakpoints:"",position:null,style:null,size:"80%",html:"",resetScroll:!0,resetForms:!0,swipeToClose:!0},overlay:{breakpoints:"",position:null,width:0,height:0,html:""}}},recalcW:function(b){var c=parseInt(b);"string"==typeof b&&"%"==b.charAt(b.length-1)&&(c=Math.floor(jQuery(window).width()*(c/100)));return c},recalcH:function(b){var c=parseInt(b);"string"==typeof b&&"%"==b.charAt(b.length-1)&&(c=Math.floor(jQuery(window).height()*(c/100)));return c},getHalf:function(b){var c=
parseInt(b);return"string"==typeof b&&"%"==b.charAt(b.length-1)?Math.floor(c/2)+"%":Math.floor(c/2)+"px"},parseSuspend:function(b){b=b.get(0);b._skel_panels_suspend&&b._skel_panels_suspend()},parseResume:function(b){b=b.get(0);b._skel_panels_resume&&b._skel_panels_resume()},parseInit:function(e){var c,d;c=e.get(0);var h=e.attr("data-action"),f=e.attr("data-args"),g,l;h&&f&&(f=f.split(","));switch(h){case "togglePanel":case "panelToggle":e.css("-webkit-tap-highlight-color","rgba(0,0,0,0)").css("cursor",
"pointer");c=function(c){c.preventDefault();c.stopPropagation();if(b.cache.activePanel)return b.cache.activePanel._skel_panels_close(),!1;jQuery(this);c=b.cache.panels[f[0]];c.is(":visible")?c._skel_panels_close():c._skel_panels_open()};"android"==b._.vars.deviceType?e.bind("click",c):e.bind(b.eventType,c);break;case "navList":g=jQuery("#"+f[0]);c=g.find("a");d=[];c.each(function(){var b=jQuery(this),c;c=Math.max(0,b.parents("li").length-1);d.push('<a class="link depth-'+c+'" href="'+b.attr("href")+
'"><span class="indent-'+c+'"></span>'+b.text()+"</a>")});0<d.length&&e.html("<nav>"+d.join("")+"</nav>");e.find(".link").css("cursor","pointer").css("display","block");break;case "copyText":g=jQuery("#"+f[0]);e.html(g.text());break;case "copyHTML":g=jQuery("#"+f[0]);e.html(g.html());break;case "moveElementContents":g=jQuery("#"+f[0]);c._skel_panels_resume=function(){g.children().each(function(){e.append(jQuery(this))})};c._skel_panels_suspend=function(){e.children().each(function(){g.append(jQuery(this))})};
c._skel_panels_resume();break;case "moveElement":g=jQuery("#"+f[0]);c._skel_panels_resume=function(){jQuery('<div id="skel-panels-tmp-'+g.attr("id")+'" />').insertBefore(g);e.append(g)};c._skel_panels_suspend=function(){jQuery("#skel-panels-tmp-"+g.attr("id")).replaceWith(g)};c._skel_panels_resume();break;case "moveCell":g=jQuery("#"+f[0]),l=jQuery("#"+f[1]),c._skel_panels_resume=function(){jQuery('<div id="skel-panels-tmp-'+g.attr("id")+'" />').insertBefore(g);e.append(g);g.css("width","auto");l&&
l._skel_panels_expandCell()},c._skel_panels_suspend=function(){jQuery("#skel-panels-tmp-"+g.attr("id")).replaceWith(g);g.css("width","");l&&l.css("width","")},c._skel_panels_resume()}},lockView:function(e){b.cache.window._skel_panels_scrollPos=b.cache.window.scrollTop();b._.vars.isTouch&&b.cache.body.css("overflow-"+e,"hidden");b.cache.pageWrapper.bind("touchstart.lock",function(c){c.preventDefault();c.stopPropagation();b.cache.activePanel&&b.cache.activePanel._skel_panels_close()});b.cache.pageWrapper.bind("click.lock",
function(c){c.preventDefault();c.stopPropagation();b.cache.activePanel&&b.cache.activePanel._skel_panels_close()});b.cache.pageWrapper.bind("scroll.lock",function(c){c.preventDefault();c.stopPropagation();b.cache.activePanel&&b.cache.activePanel._skel_panels_close()});b.cache.window.bind("orientationchange.lock",function(c){b.cache.activePanel&&b.cache.activePanel._skel_panels_close()});b._.vars.isTouch||(b.cache.window.bind("resize.lock",function(c){b.cache.activePanel&&b.cache.activePanel._skel_panels_close()}),
b.cache.window.bind("scroll.lock",function(c){b.cache.activePanel&&b.cache.activePanel._skel_panels_close()}))},unlockView:function(e){b._.vars.isTouch&&b.cache.body.css("overflow-"+e,"visible");b.cache.pageWrapper.unbind("touchstart.lock");b.cache.pageWrapper.unbind("click.lock");b.cache.pageWrapper.unbind("scroll.lock");b.cache.window.unbind("orientationchange.lock");b._.vars.isTouch||(b.cache.window.unbind("resize.lock"),b.cache.window.unbind("scroll.lock"))},resumeElement:function(e){b.cache[e.type+
"s"][e.id].find("*").each(function(){b.parseResume(jQuery(this))})},suspendElement:function(e){e=b.cache[e.type+"s"][e.id];e._skel_panels_translateOrigin();e.find("*").each(function(){b.parseSuspend(jQuery(this))})},initElement:function(e){var c=e.config,d=jQuery(e.object),h;b.cache[e.type+"s"][e.id]=d;d._skel_panels_init();d.find("*").each(function(){b.parseInit(jQuery(this))});switch(e.type){case "panel":d.addClass("skel-panels-panel").css("z-index",b.config.baseZIndex).css("position","fixed").hide();
d.find("a").css("-webkit-tap-highlight-color","rgba(0,0,0,0)").bind("click.skel-panels",function(c){if(b.cache.activePanel){c.preventDefault();c.stopPropagation();c=jQuery(this);var d=c.attr("href");b.cache.activePanel._skel_panels_close();c.hasClass("skel-panels-ignoreHref")||window.setTimeout(function(){window.location.href=d},b.config.speed+10)}});"ios"==b._.vars.deviceType&&d.find("input,select,textarea").focus(function(c){var d=jQuery(this);c.preventDefault();c.stopPropagation();window.setTimeout(function(){var c=
b.cache.window._skel_panels_scrollPos,g=b.cache.window.scrollTop()-c;b.cache.window.scrollTop(c);b.cache.activePanel.scrollTop(b.cache.activePanel.scrollTop()+g);d.hide();window.setTimeout(function(){d.show()},0)},100)});switch(c.position){case "top":case "bottom":var f="bottom"==c.position?"-":"";d.addClass("skel-panels-panel-"+c.position).data("skel-panels-panel-position",c.position).css("height",b.recalcH(c.size)).scrollTop(0);b._.vars.isTouch?d.css("overflow-y","scroll").css("-webkit-overflow-scrolling",
"touch").bind("touchstart",function(b){d._posY=b.originalEvent.touches[0].pageY;d._posX=b.originalEvent.touches[0].pageX}).bind("touchmove",function(b){b=d._posY-b.originalEvent.touches[0].pageY;var c=d.outerHeight(),e=d.get(0).scrollHeight-d.scrollTop();if(0==d.scrollTop()&&0>b||e>c-2&&e<c+2&&0<b)return!1}):d.css("overflow-y","auto");switch(c.style){default:d._skel_panels_open=function(){d._skel_panels_promote().scrollTop(0).css("left","0px").css(c.position,"-"+b.recalcH(c.size)+"px").css("height",
b.recalcH(c.size)).css("width","100%").show();c.resetScroll&&d.scrollTop(0);c.resetForms&&d._skel_panels_resetForms();b.lockView("y");window.setTimeout(function(){d.add(b.cache.fixedWrapper.children()).add(b.cache.pageWrapper)._skel_panels_translate(0,f+b.recalcH(c.size));b.cache.activePanel=d},100)},d._skel_panels_close=function(){d.find("*").blur();d.add(b.cache.pageWrapper).add(b.cache.fixedWrapper.children())._skel_panels_translateOrigin();window.setTimeout(function(){b.unlockView("y");d._skel_panels_demote().hide();
b.cache.activePanel=null},b.config.speed+50)}}break;case "left":case "right":switch(f="right"==c.position?"-":"",d.addClass("skel-panels-panel-"+c.position).data("skel-panels-panel-position",c.position).css("width",b.recalcW(c.size)).scrollTop(0),b._.vars.isTouch?d.css("overflow-y","scroll").css("-webkit-overflow-scrolling","touch").bind("touchstart",function(b){d._posY=b.originalEvent.touches[0].pageY;d._posX=b.originalEvent.touches[0].pageX}).bind("touchmove",function(b){var e=d._posX-b.originalEvent.touches[0].pageX;
b=d._posY-b.originalEvent.touches[0].pageY;var f=d.outerHeight(),h=d.get(0).scrollHeight-d.scrollTop();if(c.swipeToClose&&20>b&&-20<b&&("left"==c.position&&50<e||"right"==c.position&&-50>e))return d._skel_panels_close(),!1;if(0==d.scrollTop()&&0>b||h>f-2&&h<f+2&&0<b)return!1}):d.css("overflow-y","auto"),c.style){default:d._skel_panels_open=function(){d._skel_panels_promote().scrollTop(0).css("top","0px").css(c.position,"-"+b.recalcW(c.size)+"px").css("width",b.recalcW(c.size)).css("height","100%").show();
c.resetScroll&&d.scrollTop(0);c.resetForms&&d._skel_panels_resetForms();b.lockView("x");window.setTimeout(function(){d.add(b.cache.fixedWrapper.children()).add(b.cache.pageWrapper)._skel_panels_translate(f+b.recalcW(c.size),0);b.cache.activePanel=d},100)};d._skel_panels_close=function(){d.find("*").blur();d.add(b.cache.fixedWrapper.children()).add(b.cache.pageWrapper)._skel_panels_translateOrigin();window.setTimeout(function(){b.unlockView("x");d._skel_panels_demote().hide();b.cache.activePanel=null},
b.config.speed+50)};break;case "reveal":d._skel_panels_open=function(){b.cache.fixedWrapper._skel_panels_promote(2);b.cache.pageWrapper._skel_panels_promote(1);d.scrollTop(0).css("top","0px").css(c.position,"0px").css("width",b.recalcW(c.size)).css("height","100%").show();c.resetScroll&&d.scrollTop(0);c.resetForms&&d._skel_panels_resetForms();b.lockView("x");window.setTimeout(function(){b.cache.pageWrapper.add(b.cache.fixedWrapper.children())._skel_panels_translate(f+b.recalcW(c.size),0);b.cache.activePanel=
d},100)},d._skel_panels_close=function(){d.find("*").blur();b.cache.pageWrapper.add(b.cache.fixedWrapper.children())._skel_panels_translateOrigin();window.setTimeout(function(){b.unlockView("x");d.hide();b.cache.pageWrapper._skel_panels_demote();b.cache.pageWrapper._skel_panels_demote();b.cache.activePanel=null},b.config.speed+50)}}}break;case "overlay":d.css("z-index",b.config.baseZIndex).css("position","fixed").addClass("skel-panels-overlay"),d.css("width",c.width).css("height",c.height),(h=b.positions.overlays[c.position])||
(c.position="top-left",h=b.positions.overlays[c.position]),d.addClass("skel-panels-overlay-"+c.position).data("skel-panels-overlay-position",c.position),b._.iterate(h,function(e){d.css(e,h[e]);"50%"==h[e]&&("top"==e?d.css("margin-top","-"+b.getHalf(c.height)):"left"==e&&d.css("margin-left","-"+b.getHalf(c.width)))})}},initElements:function(e){var c,d,h,f=[];b._.iterate(b.config[e+"s"],function(g){c={};b._.extend(c,b.defaults.config[e]);b._.extend(c,b.config[e+"s"][g]);b.config[e+"s"][g]=c;d=b._.newDiv(c.html);
d.id=g;d.className="skel-panels-"+e;c.html||(f[g]=d);h=c.breakpoints?c.breakpoints.split(","):b._.breakpointList;b._.iterate(h,function(f){f=b._.cacheBreakpointElement(h[f],g,d,"overlay"==e?"skel_panels_fixedWrapper":"skel_panels_defaultWrapper",2);f.config=c;f.initialized=!1;f.type=e;f.onAttach=function(){this.initialized?b.resumeElement(this):(b.initElement(this),this.initialized=!0)};f.onDetach=function(){b.suspendElement(this)}})});b._.DOMReady(function(){var c,d;b._.iterate(f,function(b){c=jQuery("#"+
b);d=jQuery(f[b]);c.children().appendTo(d);c.remove()})})},initJQueryUtilityFuncs:function(){jQuery.fn._skel_panels_promote=function(c){this._zIndex=this.css("z-index");this.css("z-index",b.config.baseZIndex+(c?c:1));return this};jQuery.fn._skel_panels_demote=function(){this._zIndex&&(this.css("z-index",this._zIndex),this._zIndex=null);return this};jQuery.fn._skel_panels_xcssValue=function(b,d){return jQuery(this).css(b,"-moz-"+d).css(b,"-webkit-"+d).css(b,"-o-"+d).css(b,"-ms-"+d).css(b,d)};jQuery.fn._skel_panels_xcssProperty=
function(b,d){return jQuery(this).css("-moz-"+b,d).css("-webkit-"+b,d).css("-o-"+b,d).css("-ms-"+b,d).css(b,d)};jQuery.fn._skel_panels_xcss=function(b,d){return jQuery(this).css("-moz-"+b,"-moz-"+d).css("-webkit-"+b,"-webkit-"+d).css("-o-"+b,"-o-"+d).css("-ms-"+b,"-ms-"+d).css(b,d)};jQuery.fn._skel_panels_resetForms=function(){var b=jQuery(this);jQuery(this).find("form").each(function(){this.reset()});return b};jQuery.fn._skel_panels_initializeCell=function(){var b=jQuery(this);b.attr("class").match(/(\s+|^)([0-9]+)u(\s+|$)/)&&
b.data("cell-size",parseInt(RegExp.$2))};jQuery.fn._skel_panels_expandCell=function(){var b=jQuery(this),d=12;b.parent().children().each(function(){var b=jQuery(this).attr("class");b&&b.match(/(\s+|^)([0-9]+)u(\s+|$)/)&&(d-=parseInt(RegExp.$2))});0<d&&(b._skel_panels_initializeCell(),b.css("width",100*((b.data("cell-size")+d)/12)+"%"))};if(b.config.useTransform&&10<=b._.vars.IEVersion&&(!b.config.transformBreakpoints||b._.hasActive(b.config.transformBreakpoints.split(","))))jQuery.fn._skel_panels_translateOrigin=
function(){return jQuery(this)._skel_panels_translate(0,0)},jQuery.fn._skel_panels_translate=function(b,d){return jQuery(this).css("transform","translate("+b+"px, "+d+"px)")},jQuery.fn._skel_panels_init=function(){return jQuery(this).css("backface-visibility","hidden").css("perspective","500")._skel_panels_xcss("transition","transform "+b.config.speed/1E3+"s ease-in-out")};else{var e=[];b.cache.window.resize(function(){if(0!=b.config.speed){var c=b.config.speed;b.config.speed=0;window.setTimeout(function(){b.config.speed=
c;e=[]},c)}});jQuery.fn._skel_panels_translateOrigin=function(){for(var c=0;c<this.length;c++){var d=this[c],h=jQuery(d);e[d.id]&&h.animate(e[d.id],b.config.speed,"swing",function(){b._.iterate(e[d.id],function(b){h.css(b,e[d.id][b])});b.cache.body.css("overflow-x","visible");b.cache.pageWrapper.css("width","auto").css("padding-bottom",0)})}return jQuery(this)};jQuery.fn._skel_panels_translate=function(c,d){var h,f,g,l;c=parseInt(c);d=parseInt(d);0!=c?(b.cache.body.css("overflow-x","hidden"),b.cache.pageWrapper.css("width",
b.cache.window.width())):g=function(){b.cache.body.css("overflow-x","visible");b.cache.pageWrapper.css("width","auto")};0>d?b.cache.pageWrapper.css("padding-bottom",Math.abs(d)):l=function(){b.cache.pageWrapper.css("padding-bottom",0)};for(h=0;h<this.length;h++){var k=this[h],n=jQuery(k),m;if(!e[k.id])if(m=b.positions.overlays[n.data("skel-panels-overlay-position")])e[k.id]=m;else if(m=b.positions.panels[n.data("skel-panels-panel-position")])for(e[k.id]={},f=0;m[f];f++)e[k.id][m[f]]=parseInt(n.css(m[f]));
else m=n.position(),e[k.id]={top:m.top,left:m.left};a={};b._.iterate(e[k.id],function(f){var g;switch(f){case "top":g=b.recalcH(e[k.id][f])+d;break;case "bottom":g=b.recalcH(e[k.id][f])-d;break;case "left":g=b.recalcW(e[k.id][f])+c;break;case "right":g=b.recalcW(e[k.id][f])-c}a[f]=g});n.animate(a,b.config.speed,"swing",function(){g&&g();l&&l()})}return jQuery(this)};jQuery.fn._skel_panels_init=function(){return jQuery(this).css("position","absolute")}}},initObjects:function(){b.cache.window=jQuery(window);
b.cache.window.load(function(){0==b.cache.window.scrollTop()&&window.scrollTo(0,1)});b._.DOMReady(function(){b.cache.body=jQuery("body");b.cache.body.wrapInner('<div id="skel-panels-pageWrapper" />');b.cache.pageWrapper=jQuery("#skel-panels-pageWrapper");b.cache.pageWrapper.css("position","relative").css("left","0").css("right","0").css("top","0")._skel_panels_init();b.cache.defaultWrapper=jQuery('<div id="skel-panels-defaultWrapper" />').appendTo(b.cache.body);b.cache.defaultWrapper.css("height",
"100%");b.cache.fixedWrapper=jQuery('<div id="skel-panels-fixedWrapper" />').appendTo(b.cache.body);b.cache.fixedWrapper.css("position","relative");jQuery(".skel-panels-fixed").appendTo(b.cache.fixedWrapper);b._.registerLocation("skel_panels_defaultWrapper",b.cache.defaultWrapper[0]);b._.registerLocation("skel_panels_fixedWrapper",b.cache.fixedWrapper[0]);b._.registerLocation("skel_panels_pageWrapper",b.cache.pageWrapper[0])})},initIncludes:function(){b._.DOMReady(function(){jQuery(".skel-panels-include").each(function(){b.parseInit(jQuery(this))})})},
init:function(){b.eventType=b._.vars.isTouch?"touchend":"click";b.initObjects();b.initJQueryUtilityFuncs();b.initElements("overlay");b.initElements("panel");b.initIncludes();b._.updateState()}};return b}());
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Globalization;
using System.ComponentModel;
namespace System.Configuration
{
public sealed class InfiniteTimeSpanConverter : ConfigurationConverterBase
{
private static readonly TypeConverter s_timeSpanConverter = TypeDescriptor.GetConverter(typeof(TimeSpan));
public override object ConvertTo(ITypeDescriptorContext ctx, CultureInfo ci, object value, Type type)
{
ValidateType(value, typeof(TimeSpan));
return (TimeSpan)value == TimeSpan.MaxValue
? "Infinite"
: s_timeSpanConverter.ConvertToInvariantString(value);
}
public override object ConvertFrom(ITypeDescriptorContext ctx, CultureInfo ci, object data)
{
return (string)data == "Infinite"
? TimeSpan.MaxValue
: s_timeSpanConverter.ConvertFromInvariantString((string)data);
}
}
} |
/* linux/arch/arm/mach-exynos/mach-smdk4x12.c
*
* Copyright (c) 2011 Samsung Electronics Co., Ltd.
* http://www.samsung.com
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#include <linux/platform_device.h>
#include <linux/serial_core.h>
#include <linux/spi/spi.h>
#include <linux/spi/spi_gpio.h>
#include <linux/clk.h>
#include <linux/lcd.h>
#include <linux/gpio.h>
#include <linux/gpio_event.h>
#include <linux/i2c.h>
#include <linux/pwm_backlight.h>
#include <linux/input.h>
#include <linux/mmc/host.h>
#include <linux/regulator/machine.h>
#include <linux/regulator/max8649.h>
#include <linux/regulator/fixed.h>
#include <linux/mfd/wm8994/pdata.h>
#include <linux/mfd/max8997.h>
#include <linux/mfd/max77686.h>
#include <linux/v4l2-mediabus.h>
#include <linux/memblock.h>
#include <linux/delay.h>
#include <linux/smsc911x.h>
#include <linux/notifier.h>
#include <linux/reboot.h>
#include <asm/mach/arch.h>
#include <asm/mach-types.h>
#include <plat/regs-serial.h>
#include <plat/exynos4.h>
#include <plat/cpu.h>
#include <plat/clock.h>
#include <plat/keypad.h>
#include <plat/devs.h>
#include <plat/fb.h>
#include <plat/fb-s5p.h>
#include <plat/fb-core.h>
#include <plat/regs-fb-v4.h>
#include <plat/backlight.h>
#include <plat/gpio-cfg.h>
#include <plat/regs-adc.h>
#include <plat/adc.h>
#include <plat/iic.h>
#include <plat/pd.h>
#include <plat/sdhci.h>
#include <plat/mshci.h>
#include <plat/ehci.h>
#include <plat/usbgadget.h>
#include <plat/usb-switch.h>
#include <plat/s3c64xx-spi.h>
#if defined(CONFIG_VIDEO_FIMC)
#include <plat/fimc.h>
#elif defined(CONFIG_VIDEO_SAMSUNG_S5P_FIMC)
#include <plat/fimc-core.h>
#include <media/s5p_fimc.h>
#endif
#if defined(CONFIG_VIDEO_FIMC_MIPI)
#include <plat/csis.h>
#elif defined(CONFIG_VIDEO_S5P_MIPI_CSIS)
#include <plat/mipi_csis.h>
#endif
#include <plat/tvout.h>
#include <plat/media.h>
#include <plat/regs-srom.h>
#include <plat/s5p-sysmmu.h>
#include <plat/tv-core.h>
#if defined(CONFIG_VIDEO_SAMSUNG_S5P_MFC) || defined(CONFIG_VIDEO_MFC5X)
#include <plat/s5p-mfc.h>
#endif
#include <media/s5k4ba_platform.h>
#include <media/s5k4ea_platform.h>
#include <media/exynos_flite.h>
#include <media/exynos_fimc_is.h>
#include <video/platform_lcd.h>
#include <media/m5mo_platform.h>
#include <media/m5mols.h>
#include <mach/board_rev.h>
#include <mach/map.h>
#include <mach/spi-clocks.h>
#include <mach/exynos-ion.h>
#include <mach/regs-pmu.h>
#ifdef CONFIG_EXYNOS4_DEV_DWMCI
#include <mach/dwmci.h>
#endif
#ifdef CONFIG_EXYNOS_CONTENT_PATH_PROTECTION
#include <mach/secmem.h>
#endif
#include <mach/dev.h>
#include <mach/ppmu.h>
#ifdef CONFIG_EXYNOS_C2C
#include <mach/c2c.h>
#endif
#ifdef CONFIG_FB_S5P_MIPI_DSIM
#include <mach/mipi_ddi.h>
#include <mach/dsim.h>
#endif
#include <plat/fb-s5p.h>
#ifdef CONFIG_FB_S5P_EXTDSP
struct s3cfb_extdsp_lcd {
int width;
int height;
int bpp;
};
#endif
#include <plat/fimg2d.h>
#include <mach/dev-sysmmu.h>
#ifdef CONFIG_VIDEO_SAMSUNG_S5P_FIMC
#include <plat/fimc-core.h>
#include <media/s5p_fimc.h>
#endif
#ifdef CONFIG_VIDEO_JPEG_V2X
#include <plat/jpeg.h>
#endif
#ifdef CONFIG_REGULATOR_S5M8767
#include <linux/mfd/s5m87xx/s5m-core.h>
#include <linux/mfd/s5m87xx/s5m-pmic.h>
#endif
#if defined(CONFIG_EXYNOS_SETUP_THERMAL)
#include <plat/s5p-tmu.h>
#endif
#define REG_INFORM4 (S5P_INFORM4)
/* Following are default values for UCON, ULCON and UFCON UART registers */
#define SMDK4X12_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
S3C2410_UCON_RXILEVEL | \
S3C2410_UCON_TXIRQMODE | \
S3C2410_UCON_RXIRQMODE | \
S3C2410_UCON_RXFIFO_TOI | \
S3C2443_UCON_RXERR_IRQEN)
#define SMDK4X12_ULCON_DEFAULT S3C2410_LCON_CS8
#define SMDK4X12_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \
S5PV210_UFCON_TXTRIG4 | \
S5PV210_UFCON_RXTRIG4)
static struct s3c2410_uartcfg smdk4x12_uartcfgs[] __initdata = {
[0] = {
.hwport = 0,
.flags = 0,
.ucon = SMDK4X12_UCON_DEFAULT,
.ulcon = SMDK4X12_ULCON_DEFAULT,
.ufcon = SMDK4X12_UFCON_DEFAULT,
},
[1] = {
.hwport = 1,
.flags = 0,
.ucon = SMDK4X12_UCON_DEFAULT,
.ulcon = SMDK4X12_ULCON_DEFAULT,
.ufcon = SMDK4X12_UFCON_DEFAULT,
},
[2] = {
.hwport = 2,
.flags = 0,
.ucon = SMDK4X12_UCON_DEFAULT,
.ulcon = SMDK4X12_ULCON_DEFAULT,
.ufcon = SMDK4X12_UFCON_DEFAULT,
},
[3] = {
.hwport = 3,
.flags = 0,
.ucon = SMDK4X12_UCON_DEFAULT,
.ulcon = SMDK4X12_ULCON_DEFAULT,
.ufcon = SMDK4X12_UFCON_DEFAULT,
},
};
static struct resource smdk4x12_smsc911x_resources[] = {
[0] = {
.start = EXYNOS4_PA_SROM_BANK(1),
.end = EXYNOS4_PA_SROM_BANK(1) + SZ_64K - 1,
.flags = IORESOURCE_MEM,
},
[1] = {
.start = IRQ_EINT(5),
.end = IRQ_EINT(5),
.flags = IORESOURCE_IRQ | IRQF_TRIGGER_LOW,
},
};
static struct smsc911x_platform_config smsc9215_config = {
.irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
.irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
.flags = SMSC911X_USE_16BIT | SMSC911X_FORCE_INTERNAL_PHY,
.phy_interface = PHY_INTERFACE_MODE_MII,
.mac = {0x00, 0x80, 0x00, 0x23, 0x45, 0x67},
};
static struct platform_device smdk4x12_smsc911x = {
.name = "smsc911x",
.id = -1,
.num_resources = ARRAY_SIZE(smdk4x12_smsc911x_resources),
.resource = smdk4x12_smsc911x_resources,
.dev = {
.platform_data = &smsc9215_config,
},
};
#ifdef CONFIG_EXYNOS_MEDIA_DEVICE
struct platform_device exynos_device_md0 = {
.name = "exynos-mdev",
.id = -1,
};
#endif
#define WRITEBACK_ENABLED
#if defined(CONFIG_VIDEO_FIMC) || defined(CONFIG_VIDEO_SAMSUNG_S5P_FIMC)
/*
* External camera reset
* Because the most of cameras take i2c bus signal, so that
* you have to reset at the boot time for other i2c slave devices.
* This function also called at fimc_init_camera()
* Do optimization for cameras on your platform.
*/
#if defined(CONFIG_ITU_A) || defined(CONFIG_CSI_C) \
|| defined(CONFIG_S5K3H2_CSI_C) || defined(CONFIG_S5K3H7_CSI_C) \
|| defined(CONFIG_S5K4E5_CSI_C) || defined(CONFIG_S5K6A3_CSI_C)
static int smdk4x12_cam0_reset(int dummy)
{
int err;
/* Camera A */
err = gpio_request(EXYNOS4_GPX1(2), "GPX1");
if (err)
printk(KERN_ERR "#### failed to request GPX1_2 ####\n");
s3c_gpio_setpull(EXYNOS4_GPX1(2), S3C_GPIO_PULL_NONE);
gpio_direction_output(EXYNOS4_GPX1(2), 0);
gpio_direction_output(EXYNOS4_GPX1(2), 1);
gpio_free(EXYNOS4_GPX1(2));
return 0;
}
#endif
#if defined(CONFIG_ITU_B) || defined(CONFIG_CSI_D) \
|| defined(CONFIG_S5K3H2_CSI_D) || defined(CONFIG_S5K3H7_CSI_D) \
|| defined(CONFIG_S5K4E5_CSI_D) || defined(CONFIG_S5K6A3_CSI_D)
static int smdk4x12_cam1_reset(int dummy)
{
int err;
/* Camera B */
err = gpio_request(EXYNOS4_GPX1(0), "GPX1");
if (err)
printk(KERN_ERR "#### failed to request GPX1_0 ####\n");
s3c_gpio_setpull(EXYNOS4_GPX1(0), S3C_GPIO_PULL_NONE);
gpio_direction_output(EXYNOS4_GPX1(0), 0);
gpio_direction_output(EXYNOS4_GPX1(0), 1);
gpio_free(EXYNOS4_GPX1(0));
return 0;
}
#endif
#endif
#ifdef CONFIG_VIDEO_FIMC
#ifdef CONFIG_VIDEO_S5K4BA
static struct s5k4ba_platform_data s5k4ba_plat = {
.default_width = 800,
.default_height = 600,
.pixelformat = V4L2_PIX_FMT_YUYV,
.freq = 24000000,
.is_mipi = 0,
};
static struct i2c_board_info s5k4ba_i2c_info = {
I2C_BOARD_INFO("S5K4BA", 0x2d),
.platform_data = &s5k4ba_plat,
};
static struct s3c_platform_camera s5k4ba = {
#ifdef CONFIG_ITU_A
.id = CAMERA_PAR_A,
.clk_name = "sclk_cam0",
.i2c_busnum = 4,
.cam_power = smdk4x12_cam0_reset,
#endif
#ifdef CONFIG_ITU_B
.id = CAMERA_PAR_B,
.clk_name = "sclk_cam1",
.i2c_busnum = 5,
.cam_power = smdk4x12_cam1_reset,
#endif
.type = CAM_TYPE_ITU,
.fmt = ITU_601_YCBCR422_8BIT,
.order422 = CAM_ORDER422_8BIT_CBYCRY,
.info = &s5k4ba_i2c_info,
.pixelformat = V4L2_PIX_FMT_YUYV,
.srclk_name = "xusbxti",
.clk_rate = 24000000,
.line_length = 1920,
.width = 1600,
.height = 1200,
.window = {
.left = 0,
.top = 0,
.width = 1600,
.height = 1200,
},
/* Polarity */
.inv_pclk = 0,
.inv_vsync = 1,
.inv_href = 0,
.inv_hsync = 0,
.reset_camera = 1,
.initialized = 0,
};
#endif
/* 2 MIPI Cameras */
#ifdef CONFIG_VIDEO_S5K4EA
static struct s5k4ea_platform_data s5k4ea_plat = {
.default_width = 1920,
.default_height = 1080,
.pixelformat = V4L2_PIX_FMT_UYVY,
.freq = 24000000,
.is_mipi = 1,
};
static struct i2c_board_info s5k4ea_i2c_info = {
I2C_BOARD_INFO("S5K4EA", 0x2d),
.platform_data = &s5k4ea_plat,
};
static struct s3c_platform_camera s5k4ea = {
#ifdef CONFIG_CSI_C
.id = CAMERA_CSI_C,
.clk_name = "sclk_cam0",
.i2c_busnum = 4,
.cam_power = smdk4x12_cam0_reset,
#endif
#ifdef CONFIG_CSI_D
.id = CAMERA_CSI_D,
.clk_name = "sclk_cam1",
.i2c_busnum = 5,
.cam_power = smdk4x12_cam1_reset,
#endif
.type = CAM_TYPE_MIPI,
.fmt = MIPI_CSI_YCBCR422_8BIT,
.order422 = CAM_ORDER422_8BIT_YCBYCR,
.info = &s5k4ea_i2c_info,
.pixelformat = V4L2_PIX_FMT_UYVY,
.srclk_name = "xusbxti",
.clk_rate = 24000000,
.line_length = 1920,
.width = 1920,
.height = 1080,
.window = {
.left = 0,
.top = 0,
.width = 1920,
.height = 1080,
},
.mipi_lanes = 2,
.mipi_settle = 12,
.mipi_align = 32,
/* Polarity */
.inv_pclk = 0,
.inv_vsync = 1,
.inv_href = 0,
.inv_hsync = 0,
.initialized = 0,
};
#endif
#ifdef WRITEBACK_ENABLED
static struct i2c_board_info writeback_i2c_info = {
I2C_BOARD_INFO("WriteBack", 0x0),
};
static struct s3c_platform_camera writeback = {
.id = CAMERA_WB,
.fmt = ITU_601_YCBCR422_8BIT,
.order422 = CAM_ORDER422_8BIT_CBYCRY,
.i2c_busnum = 0,
.info = &writeback_i2c_info,
.pixelformat = V4L2_PIX_FMT_YUV444,
.line_length = 800,
.width = 480,
.height = 800,
.window = {
.left = 0,
.top = 0,
.width = 480,
.height = 800,
},
.initialized = 0,
};
#endif
#ifdef CONFIG_VIDEO_EXYNOS_FIMC_IS
#ifdef CONFIG_VIDEO_S5K3H2
static struct i2c_board_info s5k3h2_sensor_info = {
.type = "S5K3H2",
};
static struct s3c_platform_camera s5k3h2 = {
#ifdef CONFIG_S5K3H2_CSI_C
.id = CAMERA_CSI_C,
.clk_name = "sclk_cam0",
.cam_power = smdk4x12_cam0_reset,
#endif
#ifdef CONFIG_S5K3H2_CSI_D
.id = CAMERA_CSI_D,
.clk_name = "sclk_cam1",
.cam_power = smdk4x12_cam1_reset,
#endif
.type = CAM_TYPE_MIPI,
.fmt = MIPI_CSI_RAW10,
.info = &s5k3h2_sensor_info,
.order422 = CAM_ORDER422_8BIT_YCBYCR,
.pixelformat = V4L2_PIX_FMT_UYVY,
.line_length = 1920,
.width = 1920,
.height = 1080,
.window = {
.left = 0,
.top = 0,
.width = 1920,
.height = 1080,
},
.srclk_name = "xusbxti",
.clk_rate = 24000000,
.mipi_lanes = 2,
.mipi_settle = 12,
.mipi_align = 24,
.initialized = 0,
#ifdef CONFIG_S5K3H2_CSI_C
.flite_id = FLITE_IDX_A,
#endif
#ifdef CONFIG_S5K3H2_CSI_D
.flite_id = FLITE_IDX_B,
#endif
.use_isp = true,
#ifdef CONFIG_S5K3H2_CSI_C
.sensor_index = 1,
#endif
#ifdef CONFIG_S5K3H2_CSI_D
.sensor_index = 101,
#endif
};
#endif
#ifdef CONFIG_VIDEO_S5K3H7
static struct i2c_board_info s5k3h7_sensor_info = {
.type = "S5K3H7",
};
static struct s3c_platform_camera s5k3h7 = {
#ifdef CONFIG_S5K3H7_CSI_C
.id = CAMERA_CSI_C,
.clk_name = "sclk_cam0",
.cam_power = smdk4x12_cam0_reset,
#endif
#ifdef CONFIG_S5K3H7_CSI_D
.id = CAMERA_CSI_D,
.clk_name = "sclk_cam1",
.cam_power = smdk4x12_cam1_reset,
#endif
.type = CAM_TYPE_MIPI,
.fmt = MIPI_CSI_RAW10,
.info = &s5k3h7_sensor_info,
.order422 = CAM_ORDER422_8BIT_YCBYCR,
.pixelformat = V4L2_PIX_FMT_UYVY,
.line_length = 1920,
.width = 1920,
.height = 1080,
.window = {
.left = 0,
.top = 0,
.width = 1920,
.height = 1080,
},
.srclk_name = "xusbxti",
.clk_rate = 24000000,
.mipi_lanes = 2,
.mipi_settle = 12,
.mipi_align = 24,
.initialized = 0,
#ifdef CONFIG_S5K3H7_CSI_C
.flite_id = FLITE_IDX_A,
#endif
#ifdef CONFIG_S5K3H7_CSI_D
.flite_id = FLITE_IDX_B,
#endif
.use_isp = true,
#ifdef CONFIG_S5K3H7_CSI_C
.sensor_index = 4,
#endif
#ifdef CONFIG_S5K3H7_CSI_D
.sensor_index = 104,
#endif
};
#endif
#ifdef CONFIG_VIDEO_S5K4E5
static struct i2c_board_info s5k4e5_sensor_info = {
.type = "S5K4E5",
};
static struct s3c_platform_camera s5k4e5 = {
#ifdef CONFIG_S5K4E5_CSI_C
.id = CAMERA_CSI_C,
.clk_name = "sclk_cam0",
.cam_power = smdk4x12_cam0_reset,
#endif
#ifdef CONFIG_S5K4E5_CSI_D
.id = CAMERA_CSI_D,
.clk_name = "sclk_cam1",
.cam_power = smdk4x12_cam1_reset,
#endif
.type = CAM_TYPE_MIPI,
.fmt = MIPI_CSI_RAW10,
.info = &s5k4e5_sensor_info,
.order422 = CAM_ORDER422_8BIT_YCBYCR,
.pixelformat = V4L2_PIX_FMT_UYVY,
.line_length = 1920,
.width = 1920,
.height = 1080,
.window = {
.left = 0,
.top = 0,
.width = 1920,
.height = 1080,
},
.srclk_name = "xusbxti",
.clk_rate = 24000000,
.mipi_lanes = 2,
.mipi_settle = 12,
.mipi_align = 24,
.initialized = 0,
#ifdef CONFIG_S5K4E5_CSI_C
.flite_id = FLITE_IDX_A,
#endif
#ifdef CONFIG_S5K4E5_CSI_D
.flite_id = FLITE_IDX_B,
#endif
.use_isp = true,
#ifdef CONFIG_S5K4E5_CSI_C
.sensor_index = 3,
#endif
#ifdef CONFIG_S5K4E5_CSI_D
.sensor_index = 103,
#endif
};
#endif
#ifdef CONFIG_VIDEO_S5K6A3
static struct i2c_board_info s5k6a3_sensor_info = {
.type = "S5K6A3",
};
static struct s3c_platform_camera s5k6a3 = {
#ifdef CONFIG_S5K6A3_CSI_C
.id = CAMERA_CSI_C,
.clk_name = "sclk_cam0",
.cam_power = smdk4x12_cam0_reset,
#endif
#ifdef CONFIG_S5K6A3_CSI_D
.id = CAMERA_CSI_D,
.clk_name = "sclk_cam1",
.cam_power = smdk4x12_cam1_reset,
#endif
.type = CAM_TYPE_MIPI,
.fmt = MIPI_CSI_RAW10,
.info = &s5k6a3_sensor_info,
.order422 = CAM_ORDER422_8BIT_YCBYCR,
.pixelformat = V4L2_PIX_FMT_UYVY,
.line_length = 1920,
.width = 1920,
.height = 1080,
.window = {
.left = 0,
.top = 0,
.width = 1920,
.height = 1080,
},
.srclk_name = "xusbxti",
.clk_rate = 24000000,
.mipi_lanes = 1,
.mipi_settle = 18,
.mipi_align = 24,
.initialized = 0,
#ifdef CONFIG_S5K6A3_CSI_C
.flite_id = FLITE_IDX_A,
#endif
#ifdef CONFIG_S5K6A3_CSI_D
.flite_id = FLITE_IDX_B,
#endif
.use_isp = true,
#ifdef CONFIG_S5K6A3_CSI_C
.sensor_index = 2,
#endif
#ifdef CONFIG_S5K6A3_CSI_D
.sensor_index = 102,
#endif
};
#endif
#if defined(CONFIG_VIDEO_S5K6A3) && defined(CONFIG_S5K6A3_CSI_D)
static struct i2c_board_info s5k6a3_fd_sensor_info = {
.type = "S5K6A3_FD",
};
static struct s3c_platform_camera s5k6a3_fd = {
.id = CAMERA_CSI_D,
.clk_name = "sclk_cam1",
.cam_power = smdk4x12_cam1_reset,
.type = CAM_TYPE_MIPI,
.fmt = MIPI_CSI_RAW10,
.info = &s5k6a3_fd_sensor_info,
.order422 = CAM_ORDER422_8BIT_YCBYCR,
.pixelformat = V4L2_PIX_FMT_UYVY,
.line_length = 1920,
.width = 1920,
.height = 1080,
.window = {
.left = 0,
.top = 0,
.width = 1920,
.height = 1080,
},
.srclk_name = "xusbxti",
.clk_rate = 24000000,
.mipi_lanes = 1,
.mipi_settle = 18,
.mipi_align = 24,
.initialized = 0,
.flite_id = FLITE_IDX_B,
.use_isp = true,
.sensor_index = 200
};
#endif
#endif
/* legacy M5MOLS Camera driver configuration */
#ifdef CONFIG_VIDEO_M5MO
#define CAM_CHECK_ERR_RET(x, msg) \
if (unlikely((x) < 0)) { \
printk(KERN_ERR "\nfail to %s: err = %d\n", msg, x); \
return x; \
}
#define CAM_CHECK_ERR(x, msg) \
if (unlikely((x) < 0)) { \
printk(KERN_ERR "\nfail to %s: err = %d\n", msg, x); \
}
static int m5mo_config_isp_irq(void)
{
s3c_gpio_cfgpin(EXYNOS4_GPX3(3), S3C_GPIO_SFN(0xF));
s3c_gpio_setpull(EXYNOS4_GPX3(3), S3C_GPIO_PULL_NONE);
return 0;
}
static struct m5mo_platform_data m5mo_plat = {
.default_width = 640, /* 1920 */
.default_height = 480, /* 1080 */
.pixelformat = V4L2_PIX_FMT_UYVY,
.freq = 24000000,
.is_mipi = 1,
.config_isp_irq = m5mo_config_isp_irq,
.irq = IRQ_EINT(27),
};
static struct i2c_board_info m5mo_i2c_info = {
I2C_BOARD_INFO("M5MO", 0x1F),
.platform_data = &m5mo_plat,
.irq = IRQ_EINT(27),
};
static struct s3c_platform_camera m5mo = {
#ifdef CONFIG_CSI_C
.id = CAMERA_CSI_C,
.clk_name = "sclk_cam0",
.i2c_busnum = 4,
.cam_power = smdk4x12_cam0_reset,
#endif
#ifdef CONFIG_CSI_D
.id = CAMERA_CSI_D,
.clk_name = "sclk_cam1",
.i2c_busnum = 5,
.cam_power = smdk4x12_cam1_reset,
#endif
.type = CAM_TYPE_MIPI,
.fmt = MIPI_CSI_YCBCR422_8BIT,
.order422 = CAM_ORDER422_8BIT_YCBYCR,
.info = &m5mo_i2c_info,
.pixelformat = V4L2_PIX_FMT_UYVY,
.srclk_name = "xusbxti", /* "mout_mpll" */
.clk_rate = 24000000, /* 48000000 */
.line_length = 1920,
.width = 640,
.height = 480,
.window = {
.left = 0,
.top = 0,
.width = 640,
.height = 480,
},
.mipi_lanes = 2,
.mipi_settle = 12,
.mipi_align = 32,
/* Polarity */
.inv_pclk = 1,
.inv_vsync = 1,
.inv_href = 0,
.inv_hsync = 0,
.reset_camera = 0,
.initialized = 0,
};
#endif
/* Interface setting */
static struct s3c_platform_fimc fimc_plat = {
#ifdef CONFIG_ITU_A
.default_cam = CAMERA_PAR_A,
#endif
#ifdef CONFIG_ITU_B
.default_cam = CAMERA_PAR_B,
#endif
#ifdef CONFIG_CSI_C
.default_cam = CAMERA_CSI_C,
#endif
#ifdef CONFIG_CSI_D
.default_cam = CAMERA_CSI_D,
#endif
#ifdef WRITEBACK_ENABLED
.default_cam = CAMERA_WB,
#endif
.camera = {
#ifdef CONFIG_VIDEO_S5K4BA
&s5k4ba,
#endif
#ifdef CONFIG_VIDEO_S5K4EA
&s5k4ea,
#endif
#ifdef CONFIG_VIDEO_M5MO
&m5mo,
#endif
#ifdef CONFIG_VIDEO_S5K3H2
&s5k3h2,
#endif
#ifdef CONFIG_VIDEO_S5K3H7
&s5k3h7,
#endif
#ifdef CONFIG_VIDEO_S5K4E5
&s5k4e5,
#endif
#ifdef CONFIG_VIDEO_S5K6A3
&s5k6a3,
#endif
#ifdef WRITEBACK_ENABLED
&writeback,
#endif
#if defined(CONFIG_VIDEO_S5K6A3) && defined(CONFIG_S5K6A3_CSI_D)
&s5k6a3_fd,
#endif
},
.hw_ver = 0x51,
};
#endif /* CONFIG_VIDEO_FIMC */
/* for mainline fimc interface */
#ifdef CONFIG_VIDEO_SAMSUNG_S5P_FIMC
#ifdef WRITEBACK_ENABLED
struct writeback_mbus_platform_data {
int id;
struct v4l2_mbus_framefmt fmt;
};
static struct i2c_board_info __initdata writeback_info = {
I2C_BOARD_INFO("writeback", 0x0),
};
#endif
#ifdef CONFIG_VIDEO_S5K4BA
static struct s5k4ba_mbus_platform_data s5k4ba_mbus_plat = {
.id = 0,
.fmt = {
.width = 1600,
.height = 1200,
/*.code = V4L2_MBUS_FMT_UYVY8_2X8, */
.code = V4L2_MBUS_FMT_VYUY8_2X8,
},
.clk_rate = 24000000UL,
#ifdef CONFIG_ITU_A
.set_power = smdk4x12_cam0_reset,
#endif
#ifdef CONFIG_ITU_B
.set_power = smdk4x12_cam1_reset,
#endif
};
static struct i2c_board_info s5k4ba_info = {
I2C_BOARD_INFO("S5K4BA", 0x2d),
.platform_data = &s5k4ba_mbus_plat,
};
#endif
/* 2 MIPI Cameras */
#ifdef CONFIG_VIDEO_S5K4EA
static struct s5k4ea_mbus_platform_data s5k4ea_mbus_plat = {
#ifdef CONFIG_CSI_C
.id = 0,
.set_power = smdk4x12_cam0_reset,
#endif
#ifdef CONFIG_CSI_D
.id = 1,
.set_power = smdk4x12_cam1_reset,
#endif
.fmt = {
.width = 1920,
.height = 1080,
.code = V4L2_MBUS_FMT_VYUY8_2X8,
},
.clk_rate = 24000000UL,
};
static struct i2c_board_info s5k4ea_info = {
I2C_BOARD_INFO("S5K4EA", 0x2d),
.platform_data = &s5k4ea_mbus_plat,
};
#endif
#ifdef CONFIG_VIDEO_M5MOLS
static struct m5mols_platform_data m5mols_platdata = {
#ifdef CONFIG_CSI_C
.gpio_rst = EXYNOS4_GPX1(2), /* ISP_RESET */
#endif
#ifdef CONFIG_CSI_D
.gpio_rst = EXYNOS4_GPX1(0), /* ISP_RESET */
#endif
.enable_rst = true, /* positive reset */
.irq = IRQ_EINT(27),
};
static struct i2c_board_info m5mols_board_info = {
I2C_BOARD_INFO("M5MOLS", 0x1F),
.platform_data = &m5mols_platdata,
};
#endif
#ifdef CONFIG_VIDEO_EXYNOS_FIMC_IS
#ifdef CONFIG_VIDEO_S5K3H2
static struct i2c_board_info s5k3h2_sensor_info = {
.type = "S5K3H2",
};
#endif
#ifdef CONFIG_VIDEO_S5K3H7
static struct i2c_board_info s5k3h7_sensor_info = {
.type = "S5K3H7",
};
#endif
#ifdef CONFIG_VIDEO_S5K4E5
static struct i2c_board_info s5k4e5_sensor_info = {
.type = "S5K4E5",
};
#endif
#ifdef CONFIG_VIDEO_S5K6A3
static struct i2c_board_info s5k6a3_sensor_info = {
.type = "S5K6A3",
};
#endif
#endif
#ifdef CONFIG_VIDEO_EXYNOS_FIMC_LITE
/* This is for platdata of fimc-lite */
#ifdef CONFIG_VIDEO_S5K3H2
static struct s3c_platform_camera s5k3h2 = {
.type = CAM_TYPE_MIPI,
.use_isp = true,
.inv_pclk = 0,
.inv_vsync = 0,
.inv_href = 0,
.inv_hsync = 0,
};
#endif
#ifdef CONFIG_VIDEO_S5K3H7
static struct s3c_platform_camera s5k3h7 = {
.type = CAM_TYPE_MIPI,
.use_isp = true,
.inv_pclk = 0,
.inv_vsync = 0,
.inv_href = 0,
.inv_hsync = 0,
};
#endif
#ifdef CONFIG_VIDEO_S5K4E5
static struct s3c_platform_camera s5k4e5 = {
.type = CAM_TYPE_MIPI,
.use_isp = true,
.inv_pclk = 0,
.inv_vsync = 0,
.inv_href = 0,
.inv_hsync = 0,
};
#endif
#ifdef CONFIG_VIDEO_S5K6A3
static struct s3c_platform_camera s5k6a3 = {
.type = CAM_TYPE_MIPI,
.use_isp = true,
.inv_pclk = 0,
.inv_vsync = 0,
.inv_href = 0,
.inv_hsync = 0,
};
#endif
#endif
#endif /* CONFIG_VIDEO_SAMSUNG_S5P_FIMC */
#ifdef CONFIG_S3C64XX_DEV_SPI
static struct s3c64xx_spi_csinfo spi0_csi[] = {
[0] = {
.line = EXYNOS4_GPB(1),
.set_level = gpio_set_value,
.fb_delay = 0x2,
},
};
static struct spi_board_info spi0_board_info[] __initdata = {
{
.modalias = "spidev",
.platform_data = NULL,
.max_speed_hz = 10*1000*1000,
.bus_num = 0,
.chip_select = 0,
.mode = SPI_MODE_0,
.controller_data = &spi0_csi[0],
}
};
#ifndef CONFIG_FB_S5P_LMS501KF03
static struct s3c64xx_spi_csinfo spi1_csi[] = {
[0] = {
.line = EXYNOS4_GPB(5),
.set_level = gpio_set_value,
.fb_delay = 0x2,
},
};
static struct spi_board_info spi1_board_info[] __initdata = {
{
.modalias = "spidev",
.platform_data = NULL,
.max_speed_hz = 10*1000*1000,
.bus_num = 1,
.chip_select = 0,
.mode = SPI_MODE_3,
.controller_data = &spi1_csi[0],
}
};
#endif
static struct s3c64xx_spi_csinfo spi2_csi[] = {
[0] = {
.line = EXYNOS4_GPC1(2),
.set_level = gpio_set_value,
.fb_delay = 0x2,
},
};
static struct spi_board_info spi2_board_info[] __initdata = {
{
.modalias = "spidev",
.platform_data = NULL,
.max_speed_hz = 10*1000*1000,
.bus_num = 2,
.chip_select = 0,
.mode = SPI_MODE_0,
.controller_data = &spi2_csi[0],
}
};
#endif
#ifdef CONFIG_FB_S3C
#if defined(CONFIG_LCD_AMS369FG06)
static int lcd_power_on(struct lcd_device *ld, int enable)
{
return 1;
}
static int reset_lcd(struct lcd_device *ld)
{
int err = 0;
err = gpio_request_one(EXYNOS4_GPX0(6), GPIOF_OUT_INIT_HIGH, "GPX0");
if (err) {
printk(KERN_ERR "failed to request GPX0 for "
"lcd reset control\n");
return err;
}
gpio_set_value(EXYNOS4_GPX0(6), 0);
mdelay(1);
gpio_set_value(EXYNOS4_GPX0(6), 1);
gpio_free(EXYNOS4_GPX0(6));
return 1;
}
static struct lcd_platform_data ams369fg06_platform_data = {
.reset = reset_lcd,
.power_on = lcd_power_on,
.lcd_enabled = 0,
.reset_delay = 100, /* 100ms */
};
#define LCD_BUS_NUM 3
#define DISPLAY_CS EXYNOS4_GPB(5)
#define DISPLAY_CLK EXYNOS4_GPB(4)
#define DISPLAY_SI EXYNOS4_GPB(7)
static struct spi_board_info spi_board_info[] __initdata = {
{
.modalias = "ams369fg06",
.platform_data = (void *)&ams369fg06_platform_data,
.max_speed_hz = 1200000,
.bus_num = LCD_BUS_NUM,
.chip_select = 0,
.mode = SPI_MODE_3,
.controller_data = (void *)DISPLAY_CS,
}
};
static struct spi_gpio_platform_data ams369fg06_spi_gpio_data = {
.sck = DISPLAY_CLK,
.mosi = DISPLAY_SI,
.miso = -1,
.num_chipselect = 1,
};
static struct platform_device s3c_device_spi_gpio = {
.name = "spi_gpio",
.id = LCD_BUS_NUM,
.dev = {
.parent = &s5p_device_fimd0.dev,
.platform_data = &ams369fg06_spi_gpio_data,
},
};
static struct s3c_fb_pd_win smdk4x12_fb_win0 = {
.win_mode = {
.left_margin = 9,
.right_margin = 9,
.upper_margin = 5,
.lower_margin = 5,
.hsync_len = 2,
.vsync_len = 2,
.xres = 480,
.yres = 800,
},
.virtual_x = 480,
.virtual_y = 1600,
.width = 48,
.height = 80,
.max_bpp = 32,
.default_bpp = 24,
};
static struct s3c_fb_pd_win smdk4x12_fb_win1 = {
.win_mode = {
.left_margin = 9,
.right_margin = 9,
.upper_margin = 5,
.lower_margin = 5,
.hsync_len = 2,
.vsync_len = 2,
.xres = 480,
.yres = 800,
},
.virtual_x = 480,
.virtual_y = 1600,
.width = 48,
.height = 80,
.max_bpp = 32,
.default_bpp = 24,
};
static struct s3c_fb_pd_win smdk4x12_fb_win2 = {
.win_mode = {
.left_margin = 9,
.right_margin = 9,
.upper_margin = 5,
.lower_margin = 5,
.hsync_len = 2,
.vsync_len = 2,
.xres = 480,
.yres = 800,
},
.virtual_x = 480,
.virtual_y = 1600,
.width = 48,
.height = 80,
.max_bpp = 32,
.default_bpp = 24,
};
#elif defined(CONFIG_LCD_LMS501KF03)
static int lcd_power_on(struct lcd_device *ld, int enable)
{
return 1;
}
static int reset_lcd(struct lcd_device *ld)
{
int err = 0;
if (samsung_board_rev_is_0_1()) {
err = gpio_request_one(EXYNOS4212_GPM3(6),
GPIOF_OUT_INIT_HIGH, "GPM3");
if (err) {
printk(KERN_ERR "failed to request GPM3 for "
"lcd reset control\n");
return err;
}
gpio_set_value(EXYNOS4212_GPM3(6), 0);
mdelay(1);
gpio_set_value(EXYNOS4212_GPM3(6), 1);
gpio_free(EXYNOS4212_GPM3(6));
} else {
err = gpio_request_one(EXYNOS4_GPX1(5),
GPIOF_OUT_INIT_HIGH, "GPX1");
if (err) {
printk(KERN_ERR "failed to request GPX1 for "
"lcd reset control\n");
return err;
}
gpio_set_value(EXYNOS4_GPX1(5), 0);
mdelay(1);
gpio_set_value(EXYNOS4_GPX1(5), 1);
gpio_free(EXYNOS4_GPX1(5));
}
return 1;
}
static struct lcd_platform_data lms501kf03_platform_data = {
.reset = reset_lcd,
.power_on = lcd_power_on,
.lcd_enabled = 0,
.reset_delay = 100, /* 100ms */
};
#define LCD_BUS_NUM 3
#define DISPLAY_CS EXYNOS4_GPB(5)
#define DISPLAY_CLK EXYNOS4_GPB(4)
#define DISPLAY_SI EXYNOS4_GPB(7)
static struct spi_board_info spi_board_info[] __initdata = {
{
.modalias = "lms501kf03",
.platform_data = (void *)&lms501kf03_platform_data,
.max_speed_hz = 1200000,
.bus_num = LCD_BUS_NUM,
.chip_select = 0,
.mode = SPI_MODE_3,
.controller_data = (void *)DISPLAY_CS,
}
};
static struct spi_gpio_platform_data lms501kf03_spi_gpio_data = {
.sck = DISPLAY_CLK,
.mosi = DISPLAY_SI,
.miso = -1,
.num_chipselect = 1,
};
static struct platform_device s3c_device_spi_gpio = {
.name = "spi_gpio",
.id = LCD_BUS_NUM,
.dev = {
.parent = &s5p_device_fimd0.dev,
.platform_data = &lms501kf03_spi_gpio_data,
},
};
static struct s3c_fb_pd_win smdk4x12_fb_win0 = {
.win_mode = {
.left_margin = 8, /* HBPD */
.right_margin = 8, /* HFPD */
.upper_margin = 6, /* VBPD */
.lower_margin = 6, /* VFPD */
.hsync_len = 6, /* HSPW */
.vsync_len = 4, /* VSPW */
.xres = 480,
.yres = 800,
},
.virtual_x = 480,
.virtual_y = 1600,
.width = 48,
.height = 80,
.max_bpp = 32,
.default_bpp = 24,
};
static struct s3c_fb_pd_win smdk4x12_fb_win1 = {
.win_mode = {
.left_margin = 8, /* HBPD */
.right_margin = 8, /* HFPD */
.upper_margin = 6, /* VBPD */
.lower_margin = 6, /* VFPD */
.hsync_len = 6, /* HSPW */
.vsync_len = 4, /* VSPW */
.xres = 480,
.yres = 800,
},
.virtual_x = 480,
.virtual_y = 1600,
.width = 48,
.height = 80,
.max_bpp = 32,
.default_bpp = 24,
};
static struct s3c_fb_pd_win smdk4x12_fb_win2 = {
.win_mode = {
.left_margin = 8, /* HBPD */
.right_margin = 8, /* HFPD */
.upper_margin = 6, /* VBPD */
.lower_margin = 6, /* VFPD */
.hsync_len = 6, /* HSPW */
.vsync_len = 4, /* VSPW */
.xres = 480,
.yres = 800,
},
.virtual_x = 480,
.virtual_y = 1600,
.width = 48,
.height = 80,
.max_bpp = 32,
.default_bpp = 24,
};
#elif defined(CONFIG_LCD_WA101S)
static void lcd_wa101s_set_power(struct plat_lcd_data *pd,
unsigned int power)
{
if (power) {
#if !defined(CONFIG_BACKLIGHT_PWM)
gpio_request_one(EXYNOS4_GPD0(1), GPIOF_OUT_INIT_HIGH, "GPD0");
gpio_free(EXYNOS4_GPD0(1));
#endif
} else {
#if !defined(CONFIG_BACKLIGHT_PWM)
gpio_request_one(EXYNOS4_GPD0(1), GPIOF_OUT_INIT_LOW, "GPD0");
gpio_free(EXYNOS4_GPD0(1));
#endif
}
}
static struct plat_lcd_data smdk4x12_lcd_wa101s_data = {
.set_power = lcd_wa101s_set_power,
};
static struct platform_device smdk4x12_lcd_wa101s = {
.name = "platform-lcd",
.dev.parent = &s5p_device_fimd0.dev,
.dev.platform_data = &smdk4x12_lcd_wa101s_data,
};
static struct s3c_fb_pd_win smdk4x12_fb_win0 = {
.win_mode = {
.left_margin = 80,
.right_margin = 48,
.upper_margin = 14,
.lower_margin = 3,
.hsync_len = 32,
.vsync_len = 5,
.xres = 1360, /* real size : 1366 */
.yres = 768,
},
.virtual_x = 1360, /* real size : 1366 */
.virtual_y = 768 * 2,
.width = 223,
.height = 125,
.max_bpp = 32,
.default_bpp = 24,
};
static struct s3c_fb_pd_win smdk4x12_fb_win1 = {
.win_mode = {
.left_margin = 80,
.right_margin = 48,
.upper_margin = 14,
.lower_margin = 3,
.hsync_len = 32,
.vsync_len = 5,
.xres = 1360, /* real size : 1366 */
.yres = 768,
},
.virtual_x = 1360, /* real size : 1366 */
.virtual_y = 768 * 2,
.width = 223,
.height = 125,
.max_bpp = 32,
.default_bpp = 24,
};
static struct s3c_fb_pd_win smdk4x12_fb_win2 = {
.win_mode = {
.left_margin = 80,
.right_margin = 48,
.upper_margin = 14,
.lower_margin = 3,
.hsync_len = 32,
.vsync_len = 5,
.xres = 1360, /* real size : 1366 */
.yres = 768,
},
.virtual_x = 1360, /* real size : 1366 */
.virtual_y = 768 * 2,
.width = 223,
.height = 125,
.max_bpp = 32,
.default_bpp = 24,
};
#elif defined(CONFIG_LCD_LTE480WV)
static void lcd_lte480wv_set_power(struct plat_lcd_data *pd,
unsigned int power)
{
if (power) {
#if !defined(CONFIG_BACKLIGHT_PWM)
gpio_request_one(EXYNOS4_GPD0(1), GPIOF_OUT_INIT_HIGH, "GPD0");
gpio_free(EXYNOS4_GPD0(1));
#endif
/* fire nRESET on power up */
gpio_request_one(EXYNOS4_GPX0(6), GPIOF_OUT_INIT_HIGH, "GPX0");
mdelay(100);
gpio_set_value(EXYNOS4_GPX0(6), 0);
mdelay(10);
gpio_set_value(EXYNOS4_GPX0(6), 1);
mdelay(10);
gpio_free(EXYNOS4_GPX0(6));
} else {
#if !defined(CONFIG_BACKLIGHT_PWM)
gpio_request_one(EXYNOS4_GPD0(1), GPIOF_OUT_INIT_LOW, "GPD0");
gpio_free(EXYNOS4_GPD0(1));
#endif
}
}
static struct plat_lcd_data smdk4x12_lcd_lte480wv_data = {
.set_power = lcd_lte480wv_set_power,
};
static struct platform_device smdk4x12_lcd_lte480wv = {
.name = "platform-lcd",
.dev.parent = &s5p_device_fimd0.dev,
.dev.platform_data = &smdk4x12_lcd_lte480wv_data,
};
static struct s3c_fb_pd_win smdk4x12_fb_win0 = {
.win_mode = {
.left_margin = 13,
.right_margin = 8,
.upper_margin = 7,
.lower_margin = 5,
.hsync_len = 3,
.vsync_len = 1,
.xres = 800,
.yres = 480,
},
.virtual_x = 800,
.virtual_y = 960,
.width = 104,
.height = 62,
.max_bpp = 32,
.default_bpp = 24,
};
static struct s3c_fb_pd_win smdk4x12_fb_win1 = {
.win_mode = {
.left_margin = 13,
.right_margin = 8,
.upper_margin = 7,
.lower_margin = 5,
.hsync_len = 3,
.vsync_len = 1,
.xres = 800,
.yres = 480,
},
.virtual_x = 800,
.virtual_y = 960,
.width = 104,
.height = 62,
.max_bpp = 32,
.default_bpp = 24,
};
static struct s3c_fb_pd_win smdk4x12_fb_win2 = {
.win_mode = {
.left_margin = 13,
.right_margin = 8,
.upper_margin = 7,
.lower_margin = 5,
.hsync_len = 3,
.vsync_len = 1,
.xres = 800,
.yres = 480,
},
.virtual_x = 800,
.virtual_y = 960,
.width = 104,
.height = 62,
.max_bpp = 32,
.default_bpp = 24,
};
#elif defined(CONFIG_LCD_MIPI_S6E63M0)
static void mipi_lcd_set_power(struct plat_lcd_data *pd,
unsigned int power)
{
gpio_request_one(EXYNOS4_GPX2(7), GPIOF_OUT_INIT_HIGH, "GPX2");
mdelay(100);
if (power) {
/* fire nRESET on power up */
gpio_set_value(EXYNOS4_GPX2(7), 0);
mdelay(100);
gpio_set_value(EXYNOS4_GPX2(7), 1);
mdelay(100);
gpio_free(EXYNOS4_GPX2(7));
} else {
/* fire nRESET on power off */
gpio_set_value(EXYNOS4_GPX2(7), 0);
mdelay(100);
gpio_set_value(EXYNOS4_GPX2(7), 1);
mdelay(100);
gpio_free(EXYNOS4_GPX2(7));
}
}
static struct plat_lcd_data smdk4x12_mipi_lcd_data = {
.set_power = mipi_lcd_set_power,
};
static struct platform_device smdk4x12_mipi_lcd = {
.name = "platform-lcd",
.dev.parent = &s5p_device_fimd0.dev,
.dev.platform_data = &smdk4x12_mipi_lcd_data,
};
static struct s3c_fb_pd_win smdk4x12_fb_win0 = {
.win_mode = {
.left_margin = 0x16,
.right_margin = 0x16,
.upper_margin = 0x1,
.lower_margin = 0x28,
.hsync_len = 0x2,
.vsync_len = 0x3,
.xres = 480,
.yres = 800,
},
.virtual_x = 480,
.virtual_y = 1600,
.width = 48,
.height = 80,
.max_bpp = 32,
.default_bpp = 24,
};
static struct s3c_fb_pd_win smdk4x12_fb_win1 = {
.win_mode = {
.left_margin = 0x16,
.right_margin = 0x16,
.upper_margin = 0x1,
.lower_margin = 0x28,
.hsync_len = 0x2,
.vsync_len = 0x3,
.xres = 480,
.yres = 800,
},
.virtual_x = 480,
.virtual_y = 1600,
.width = 48,
.height = 80,
.max_bpp = 32,
.default_bpp = 24,
};
static struct s3c_fb_pd_win smdk4x12_fb_win2 = {
.win_mode = {
.left_margin = 0x16,
.right_margin = 0x16,
.upper_margin = 0x1,
.lower_margin = 0x28,
.hsync_len = 0x2,
.vsync_len = 0x3,
.xres = 480,
.yres = 800,
},
.virtual_x = 480,
.virtual_y = 1600,
.width = 48,
.height = 80,
.max_bpp = 32,
.default_bpp = 24,
};
#endif
static struct s3c_fb_platdata smdk4x12_lcd0_pdata __initdata = {
#if defined(CONFIG_LCD_AMS369FG06) || defined(CONFIG_LCD_WA101S) || \
defined(CONFIG_LCD_LTE480WV) || defined(CONFIG_LCD_LMS501KF03) || \
defined(CONFIG_LCD_MIPI_S6E63M0)
.win[0] = &smdk4x12_fb_win0,
.win[1] = &smdk4x12_fb_win1,
.win[2] = &smdk4x12_fb_win2,
#endif
.default_win = 2,
.vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
#if defined(CONFIG_LCD_AMS369FG06)
.vidcon1 = VIDCON1_INV_VCLK | VIDCON1_INV_VDEN |
VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
#elif defined(CONFIG_LCD_LMS501KF03)
.vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
#elif defined(CONFIG_LCD_WA101S)
.vidcon1 = VIDCON1_INV_VCLK | VIDCON1_INV_HSYNC |
VIDCON1_INV_VSYNC,
#elif defined(CONFIG_LCD_LTE480WV)
.vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
#endif
.setup_gpio = exynos4_fimd0_gpio_setup_24bpp,
};
#endif
#ifdef CONFIG_FB_S5P
#ifdef CONFIG_FB_S5P_LMS501KF03
static struct s3c_platform_fb lms501kf03_data __initdata = {
.hw_ver = 0x70,
.clk_name = "sclk_lcd",
.nr_wins = 5,
.default_win = CONFIG_FB_S5P_DEFAULT_WINDOW,
.swap = FB_SWAP_HWORD | FB_SWAP_WORD,
};
#define LCD_BUS_NUM 3
#define DISPLAY_CS EXYNOS4_GPB(5)
#define DISPLAY_CLK EXYNOS4_GPB(4)
#define DISPLAY_SI EXYNOS4_GPB(7)
static struct spi_board_info spi_board_info[] __initdata = {
{
.modalias = "lms501kf03",
.platform_data = NULL,
.max_speed_hz = 1200000,
.bus_num = LCD_BUS_NUM,
.chip_select = 0,
.mode = SPI_MODE_3,
.controller_data = (void *)DISPLAY_CS,
}
};
static struct spi_gpio_platform_data lms501kf03_spi_gpio_data = {
.sck = DISPLAY_CLK,
.mosi = DISPLAY_SI,
.miso = -1,
.num_chipselect = 1,
};
static struct platform_device s3c_device_spi_gpio = {
.name = "spi_gpio",
.id = LCD_BUS_NUM,
.dev = {
.parent = &s3c_device_fb.dev,
.platform_data = &lms501kf03_spi_gpio_data,
},
};
#elif defined(CONFIG_FB_S5P_DUMMY_MIPI_LCD)
#define LCD_BUS_NUM 3
#define DISPLAY_CS EXYNOS4_GPB(5)
#define DISPLAY_CLK EXYNOS4_GPB(4)
#define DISPLAY_SI EXYNOS4_GPB(7)
static struct s3cfb_lcd dummy_mipi_lcd = {
.width = 480,
.height = 800,
.bpp = 24,
.freq = 60,
.timing = {
.h_fp = 0x16,
.h_bp = 0x16,
.h_sw = 0x2,
.v_fp = 0x28,
.v_fpe = 2,
.v_bp = 0x1,
.v_bpe = 1,
.v_sw = 3,
.cmd_allow_len = 0x4,
},
.polarity = {
.rise_vclk = 0,
.inv_hsync = 0,
.inv_vsync = 0,
.inv_vden = 0,
},
};
static struct s3c_platform_fb fb_platform_data __initdata = {
.hw_ver = 0x70,
.clk_name = "sclk_lcd",
.nr_wins = 5,
.default_win = CONFIG_FB_S5P_DEFAULT_WINDOW,
.swap = FB_SWAP_HWORD | FB_SWAP_WORD,
};
static void lcd_cfg_gpio(void)
{
return;
}
static int reset_lcd(void)
{
int err = 0;
/* fire nRESET on power off */
err = gpio_request(EXYNOS4_GPX3(1), "GPX3");
if (err) {
printk(KERN_ERR "failed to request GPX0 for lcd reset control\n");
return err;
}
#ifdef CONFIG_CPU_EXYNOS4212
gpio_direction_output(EXYNOS4_GPX2(7), 1);
mdelay(100);
gpio_set_value(EXYNOS4_GPX2(7), 0);
mdelay(100);
gpio_set_value(EXYNOS4_GPX2(7), 1);
mdelay(100);
gpio_free(EXYNOS4_GPX2(7));
#else
gpio_direction_output(EXYNOS4_GPX3(1), 1);
mdelay(100);
gpio_set_value(EXYNOS4_GPX3(1), 0);
mdelay(100);
gpio_set_value(EXYNOS4_GPX3(1), 1);
mdelay(100);
gpio_free(EXYNOS4_GPX3(1));
#endif
return 0;
}
static int lcd_power_on(void *pdev, int enable)
{
return 1;
}
static void __init mipi_fb_init(void)
{
struct s5p_platform_dsim *dsim_pd = NULL;
struct mipi_ddi_platform_data *mipi_ddi_pd = NULL;
struct dsim_lcd_config *dsim_lcd_info = NULL;
/* gpio pad configuration for rgb and spi interface. */
lcd_cfg_gpio();
/*
* register lcd panel data.
*/
dsim_pd = (struct s5p_platform_dsim *)
s5p_device_dsim.dev.platform_data;
strcpy(dsim_pd->lcd_panel_name, "dummy_mipi_lcd");
dsim_lcd_info = dsim_pd->dsim_lcd_info;
dsim_lcd_info->lcd_panel_info = (void *)&dummy_mipi_lcd;
mipi_ddi_pd = (struct mipi_ddi_platform_data *)
dsim_lcd_info->mipi_ddi_pd;
mipi_ddi_pd->lcd_reset = reset_lcd;
mipi_ddi_pd->lcd_power_on = lcd_power_on;
platform_device_register(&s5p_device_dsim);
s3cfb_set_platdata(&fb_platform_data);
printk(KERN_INFO "platform data of %s lcd panel has been registered.\n",
dsim_pd->lcd_panel_name);
}
#endif
#endif
static int exynos4_notifier_call(struct notifier_block *this,
unsigned long code, void *_cmd)
{
int mode = 0;
if ((code == SYS_RESTART) && _cmd)
if (!strcmp((char *)_cmd, "recovery"))
mode = 0xf;
__raw_writel(mode, REG_INFORM4);
return NOTIFY_DONE;
}
static struct notifier_block exynos4_reboot_notifier = {
.notifier_call = exynos4_notifier_call,
};
#ifdef CONFIG_EXYNOS4_DEV_DWMCI
static void exynos_dwmci_cfg_gpio(int width)
{
unsigned int gpio;
for (gpio = EXYNOS4_GPK0(0); gpio < EXYNOS4_GPK0(2); gpio++) {
s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(3));
s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
s5p_gpio_set_drvstr(gpio, S5P_GPIO_DRVSTR_LV2);
}
switch (width) {
case MMC_BUS_WIDTH_8:
for (gpio = EXYNOS4_GPK1(3); gpio <= EXYNOS4_GPK1(6); gpio++) {
s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(4));
s3c_gpio_setpull(gpio, S3C_GPIO_PULL_UP);
s5p_gpio_set_drvstr(gpio, S5P_GPIO_DRVSTR_LV2);
}
case MMC_BUS_WIDTH_4:
for (gpio = EXYNOS4_GPK0(3); gpio <= EXYNOS4_GPK0(6); gpio++) {
s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(3));
s3c_gpio_setpull(gpio, S3C_GPIO_PULL_UP);
s5p_gpio_set_drvstr(gpio, S5P_GPIO_DRVSTR_LV2);
}
break;
case MMC_BUS_WIDTH_1:
gpio = EXYNOS4_GPK0(3);
s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(3));
s3c_gpio_setpull(gpio, S3C_GPIO_PULL_UP);
s5p_gpio_set_drvstr(gpio, S5P_GPIO_DRVSTR_LV2);
default:
break;
}
}
static struct dw_mci_board exynos_dwmci_pdata __initdata = {
.num_slots = 1,
.quirks = DW_MCI_QUIRK_BROKEN_CARD_DETECTION | DW_MCI_QUIRK_HIGHSPEED,
.bus_hz = 100 * 1000 * 1000,
.caps = MMC_CAP_UHS_DDR50 | MMC_CAP_1_8V_DDR |
MMC_CAP_8_BIT_DATA | MMC_CAP_CMD23,
.fifo_depth = 0x80,
.detect_delay_ms = 200,
.hclk_name = "dwmci",
.cclk_name = "sclk_dwmci",
.cfg_gpio = exynos_dwmci_cfg_gpio,
};
#endif
#ifdef CONFIG_S3C_DEV_HSMMC
static struct s3c_sdhci_platdata smdk4x12_hsmmc0_pdata __initdata = {
.cd_type = S3C_SDHCI_CD_INTERNAL,
.clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL,
#ifdef CONFIG_EXYNOS4_SDHCI_CH0_8BIT
.max_width = 8,
.host_caps = MMC_CAP_8_BIT_DATA,
#endif
};
#endif
#ifdef CONFIG_S3C_DEV_HSMMC1
static struct s3c_sdhci_platdata smdk4x12_hsmmc1_pdata __initdata = {
.cd_type = S3C_SDHCI_CD_INTERNAL,
.clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL,
};
#endif
#ifdef CONFIG_S3C_DEV_HSMMC2
static struct s3c_sdhci_platdata smdk4x12_hsmmc2_pdata __initdata = {
.cd_type = S3C_SDHCI_CD_INTERNAL,
.clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL,
#ifdef CONFIG_EXYNOS4_SDHCI_CH2_8BIT
.max_width = 8,
.host_caps = MMC_CAP_8_BIT_DATA,
#endif
};
#endif
#ifdef CONFIG_S3C_DEV_HSMMC3
static struct s3c_sdhci_platdata smdk4x12_hsmmc3_pdata __initdata = {
.cd_type = S3C_SDHCI_CD_INTERNAL,
.clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL,
};
#endif
#ifdef CONFIG_S5P_DEV_MSHC
static struct s3c_mshci_platdata exynos4_mshc_pdata __initdata = {
.cd_type = S3C_MSHCI_CD_PERMANENT,
.has_wp_gpio = true,
.wp_gpio = 0xffffffff,
#if defined(CONFIG_EXYNOS4_MSHC_8BIT) && \
defined(CONFIG_EXYNOS4_MSHC_DDR)
.max_width = 8,
.host_caps = MMC_CAP_8_BIT_DATA | MMC_CAP_1_8V_DDR |
MMC_CAP_UHS_DDR50,
#elif defined(CONFIG_EXYNOS4_MSHC_8BIT)
.max_width = 8,
.host_caps = MMC_CAP_8_BIT_DATA,
#elif defined(CONFIG_EXYNOS4_MSHC_DDR)
.host_caps = MMC_CAP_1_8V_DDR | MMC_CAP_UHS_DDR50,
#endif
};
#endif
#ifdef CONFIG_USB_EHCI_S5P
static struct s5p_ehci_platdata smdk4x12_ehci_pdata;
static void __init smdk4x12_ehci_init(void)
{
struct s5p_ehci_platdata *pdata = &smdk4x12_ehci_pdata;
s5p_ehci_set_platdata(pdata);
}
#endif
#ifdef CONFIG_USB_OHCI_S5P
static struct s5p_ohci_platdata smdk4x12_ohci_pdata;
static void __init smdk4x12_ohci_init(void)
{
struct s5p_ohci_platdata *pdata = &smdk4x12_ohci_pdata;
s5p_ohci_set_platdata(pdata);
}
#endif
/* USB GADGET */
#ifdef CONFIG_USB_GADGET
static struct s5p_usbgadget_platdata smdk4x12_usbgadget_pdata;
static void __init smdk4x12_usbgadget_init(void)
{
struct s5p_usbgadget_platdata *pdata = &smdk4x12_usbgadget_pdata;
s5p_usbgadget_set_platdata(pdata);
}
#endif
static struct regulator_consumer_supply max8952_supply =
REGULATOR_SUPPLY("vdd_mif", NULL);
static struct regulator_init_data max8952_init_data = {
.constraints = {
.name = "vdd_mif range",
.min_uV = 800000,
.max_uV = 1100000,
.always_on = 1,
.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
.state_mem = {
.uV = 1100000,
.disabled = 1,
},
},
.num_consumer_supplies = 1,
.consumer_supplies = &max8952_supply,
};
static struct max8649_platform_data exynos4_max8952_info = {
.mode = 1, /* VID1 = 0, VID0 = 1 */
.extclk = 0,
.ramp_timing = MAX8649_RAMP_32MV,
.regulator = &max8952_init_data,
};
/* max8997 */
static struct regulator_consumer_supply max8997_buck1 =
REGULATOR_SUPPLY("vdd_arm", NULL);
static struct regulator_consumer_supply max8997_buck2 =
REGULATOR_SUPPLY("vdd_int", NULL);
static struct regulator_consumer_supply max8997_buck3 =
REGULATOR_SUPPLY("vdd_g3d", NULL);
static struct regulator_consumer_supply __initdata ldo2_consumer =
REGULATOR_SUPPLY("vdd_ldo2", NULL);
static struct regulator_consumer_supply __initdata ldo3_consumer =
REGULATOR_SUPPLY("vdd_ldo3", NULL);
static struct regulator_consumer_supply __initdata ldo4_consumer =
REGULATOR_SUPPLY("vdd_ldo4", NULL);
static struct regulator_consumer_supply __initdata ldo5_consumer =
REGULATOR_SUPPLY("vdd_ldo5", NULL);
static struct regulator_consumer_supply __initdata ldo6_consumer =
REGULATOR_SUPPLY("vdd_ldo6", NULL);
static struct regulator_consumer_supply __initdata ldo7_consumer =
REGULATOR_SUPPLY("vdd_ldo7", NULL);
static struct regulator_consumer_supply __initdata ldo8_consumer =
REGULATOR_SUPPLY("vdd_ldo8", NULL);
static struct regulator_consumer_supply __initdata ldo9_consumer =
REGULATOR_SUPPLY("vdd_ldo9", NULL);
static struct regulator_consumer_supply __initdata ldo10_consumer =
REGULATOR_SUPPLY("vdd_ldo10", NULL);
static struct regulator_consumer_supply __initdata ldo11_consumer =
REGULATOR_SUPPLY("vdd_ldo11", NULL);
static struct regulator_consumer_supply __initdata ldo12_consumer =
REGULATOR_SUPPLY("vdd_adc", NULL);
static struct regulator_consumer_supply __initdata ldo14_consumer =
REGULATOR_SUPPLY("vdd_ldo14", NULL);
static struct regulator_consumer_supply __initdata ldo21_consumer =
REGULATOR_SUPPLY("vdd_ldo21", NULL);
static struct regulator_init_data __initdata max8997_ldo2_data = {
.constraints = {
.name = "vdd_ldo2 range",
.min_uV = 1000000,
.max_uV = 1000000,
.apply_uV = 1,
.always_on = 1,
.state_mem = {
.enabled = 1,
},
},
.num_consumer_supplies = 1,
.consumer_supplies = &ldo2_consumer,
};
static struct regulator_init_data __initdata max8997_ldo3_data = {
.constraints = {
.name = "vdd_ldo3 range",
.min_uV = 1000000,
.max_uV = 1000000,
.apply_uV = 1,
.always_on = 1,
.valid_ops_mask = REGULATOR_CHANGE_STATUS,
.state_mem = {
.disabled = 1,
},
},
.num_consumer_supplies = 1,
.consumer_supplies = &ldo3_consumer,
};
static struct regulator_init_data __initdata max8997_ldo4_data = {
.constraints = {
.name = "vdd_ldo4 range",
.min_uV = 1800000,
.max_uV = 1800000,
.apply_uV = 1,
.always_on = 1,
.valid_ops_mask = REGULATOR_CHANGE_STATUS,
.state_mem = {
.disabled = 1,
},
},
.num_consumer_supplies = 1,
.consumer_supplies = &ldo4_consumer,
};
static struct regulator_init_data __initdata max8997_ldo5_data = {
.constraints = {
.name = "vdd_ldo5 range",
.min_uV = 1000000,
.max_uV = 1000000,
.apply_uV = 1,
.always_on = 1,
.state_mem = {
.enabled = 1,
},
},
.num_consumer_supplies = 1,
.consumer_supplies = &ldo5_consumer,
};
static struct regulator_init_data __initdata max8997_ldo6_data = {
.constraints = {
.name = "vdd_ldo6 range",
.min_uV = 1800000,
.max_uV = 1800000,
.apply_uV = 1,
.always_on = 1,
.state_mem = {
.enabled = 1,
},
},
.num_consumer_supplies = 1,
.consumer_supplies = &ldo6_consumer,
};
static struct regulator_init_data __initdata max8997_ldo7_data = {
.constraints = {
.name = "vdd_ldo7 range",
.min_uV = 1800000,
.max_uV = 1800000,
.apply_uV = 1,
.always_on = 1,
.state_mem = {
.enabled = 1,
},
},
.num_consumer_supplies = 1,
.consumer_supplies = &ldo7_consumer,
};
static struct regulator_init_data __initdata max8997_ldo8_data = {
.constraints = {
.name = "vdd_ldo8 range",
.min_uV = 3300000,
.max_uV = 3300000,
.apply_uV = 1,
.always_on = 1,
.valid_ops_mask = REGULATOR_CHANGE_STATUS,
.state_mem = {
.disabled = 1,
},
},
.num_consumer_supplies = 1,
.consumer_supplies = &ldo8_consumer,
};
static struct regulator_init_data __initdata max8997_ldo9_data = {
.constraints = {
.name = "vdd_ldo9 range",
.min_uV = 2800000,
.max_uV = 2800000,
.apply_uV = 1,
.always_on = 1,
.state_mem = {
.enabled = 1,
},
},
.num_consumer_supplies = 1,
.consumer_supplies = &ldo9_consumer,
};
static struct regulator_init_data __initdata max8997_ldo10_data = {
.constraints = {
.name = "vdd_ldo10 range",
.min_uV = 1000000,
.max_uV = 1000000,
.apply_uV = 1,
.always_on = 1,
.valid_ops_mask = REGULATOR_CHANGE_STATUS,
.state_mem = {
.disabled = 1,
},
},
.num_consumer_supplies = 1,
.consumer_supplies = &ldo10_consumer,
};
static struct regulator_init_data __initdata max8997_ldo11_data = {
.constraints = {
.name = "vdd_ldo11 range",
.min_uV = 2800000,
.max_uV = 2800000,
.apply_uV = 1,
.always_on = 1,
.state_mem = {
.enabled = 1,
},
},
.num_consumer_supplies = 1,
.consumer_supplies = &ldo11_consumer,
};
static struct regulator_init_data __initdata max8997_ldo12_data = {
.constraints = {
.name = "vdd_adc range",
.min_uV = 1800000,
.max_uV = 1800000,
.apply_uV = 1,
.always_on = 1,
.state_mem = {
.enabled = 1,
},
},
.num_consumer_supplies = 1,
.consumer_supplies = &ldo12_consumer,
};
static struct regulator_init_data __initdata max8997_ldo14_data = {
.constraints = {
.name = "vdd_ldo14 range",
.min_uV = 1800000,
.max_uV = 1800000,
.apply_uV = 1,
.always_on = 1,
.state_mem = {
.enabled = 1,
},
},
.num_consumer_supplies = 1,
.consumer_supplies = &ldo14_consumer,
};
static struct regulator_init_data __initdata max8997_ldo21_data = {
.constraints = {
.name = "vdd_ldo21 range",
.min_uV = 1200000,
.max_uV = 1200000,
.apply_uV = 1,
.always_on = 1,
.state_mem = {
.enabled = 1,
},
},
.num_consumer_supplies = 1,
.consumer_supplies = &ldo21_consumer,
};
static struct regulator_init_data __initdata max8997_buck1_data = {
.constraints = {
.name = "vdd_arm range",
.min_uV = 800000,
.max_uV = 1500000,
.always_on = 1,
.boot_on = 1,
.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
.state_mem = {
.disabled = 1,
},
},
.num_consumer_supplies = 1,
.consumer_supplies = &max8997_buck1,
};
static struct regulator_init_data __initdata max8997_buck2_data = {
.constraints = {
.name = "vdd_int range",
.min_uV = 800000,
.max_uV = 1150000,
.always_on = 1,
.boot_on = 1,
.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
.state_mem = {
.disabled = 1,
},
},
.num_consumer_supplies = 1,
.consumer_supplies = &max8997_buck2,
};
static struct regulator_init_data __initdata max8997_buck3_data = {
.constraints = {
.name = "vdd_g3d range",
.min_uV = 800000,
.max_uV = 1200000,
.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
REGULATOR_CHANGE_STATUS,
.state_mem = {
.disabled = 1,
},
},
.num_consumer_supplies = 1,
.consumer_supplies = &max8997_buck3,
};
static struct max8997_regulator_data __initdata max8997_regulators[] = {
{ MAX8997_LDO2, &max8997_ldo2_data, },
{ MAX8997_LDO3, &max8997_ldo3_data, },
{ MAX8997_LDO4, &max8997_ldo4_data, },
{ MAX8997_LDO5, &max8997_ldo5_data, },
{ MAX8997_LDO6, &max8997_ldo6_data, },
{ MAX8997_LDO7, &max8997_ldo7_data, },
{ MAX8997_LDO8, &max8997_ldo8_data, },
{ MAX8997_LDO9, &max8997_ldo9_data, },
{ MAX8997_LDO10, &max8997_ldo10_data, },
{ MAX8997_LDO11, &max8997_ldo11_data, },
{ MAX8997_LDO12, &max8997_ldo12_data, },
{ MAX8997_LDO14, &max8997_ldo14_data, },
{ MAX8997_LDO21, &max8997_ldo21_data, },
{ MAX8997_BUCK1, &max8997_buck1_data, },
{ MAX8997_BUCK2, &max8997_buck2_data, },
{ MAX8997_BUCK3, &max8997_buck3_data, },
};
static struct max8997_platform_data __initdata exynos4_max8997_info = {
.num_regulators = ARRAY_SIZE(max8997_regulators),
.regulators = max8997_regulators,
.buck1_voltage[0] = 1300000, /* 1.25V */
.buck1_voltage[1] = 1100000, /* 1.1V */
.buck1_voltage[2] = 1100000, /* 1.1V */
.buck1_voltage[3] = 1100000, /* 1.1V */
.buck1_voltage[4] = 1100000, /* 1.1V */
.buck1_voltage[5] = 1100000, /* 1.1V */
.buck1_voltage[6] = 1000000, /* 1.0V */
.buck1_voltage[7] = 950000, /* 0.95V */
.buck2_voltage[0] = 1037500, /* 1.0375V */
.buck2_voltage[1] = 1000000, /* 1.0V */
.buck2_voltage[2] = 950000, /* 0.95V */
.buck2_voltage[3] = 900000, /* 0.9V */
.buck2_voltage[4] = 1000000, /* 1.0V */
.buck2_voltage[5] = 1000000, /* 1.0V */
.buck2_voltage[6] = 950000, /* 0.95V */
.buck2_voltage[7] = 900000, /* 0.9V */
.buck5_voltage[0] = 1100000, /* 1.1V */
.buck5_voltage[1] = 1100000, /* 1.1V */
.buck5_voltage[2] = 1100000, /* 1.1V */
.buck5_voltage[3] = 1100000, /* 1.1V */
.buck5_voltage[4] = 1100000, /* 1.1V */
.buck5_voltage[5] = 1100000, /* 1.1V */
.buck5_voltage[6] = 1100000, /* 1.1V */
.buck5_voltage[7] = 1100000, /* 1.1V */
};
/* max77686 */
static struct regulator_consumer_supply max77686_buck1 =
REGULATOR_SUPPLY("vdd_mif", NULL);
static struct regulator_consumer_supply max77686_buck2 =
REGULATOR_SUPPLY("vdd_arm", NULL);
static struct regulator_consumer_supply max77686_buck3 =
REGULATOR_SUPPLY("vdd_int", NULL);
static struct regulator_consumer_supply max77686_buck4 =
REGULATOR_SUPPLY("vdd_g3d", NULL);
static struct regulator_consumer_supply max77686_ldo11_consumer =
REGULATOR_SUPPLY("vdd_ldo11", NULL);
static struct regulator_consumer_supply max77686_ldo14_consumer =
REGULATOR_SUPPLY("vdd_ldo14", NULL);
static struct regulator_init_data max77686_buck1_data = {
.constraints = {
.name = "vdd_mif range",
.min_uV = 800000,
.max_uV = 1050000,
.always_on = 1,
.boot_on = 1,
.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
REGULATOR_CHANGE_STATUS,
},
.num_consumer_supplies = 1,
.consumer_supplies = &max77686_buck1,
};
static struct regulator_init_data max77686_buck2_data = {
.constraints = {
.name = "vdd_arm range",
.min_uV = 800000,
.max_uV = 1350000,
.always_on = 1,
.boot_on = 1,
.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
},
.num_consumer_supplies = 1,
.consumer_supplies = &max77686_buck2,
};
static struct regulator_init_data max77686_buck3_data = {
.constraints = {
.name = "vdd_int range",
.min_uV = 800000,
.max_uV = 1150000,
.always_on = 1,
.boot_on = 1,
.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
},
.num_consumer_supplies = 1,
.consumer_supplies = &max77686_buck3,
};
static struct regulator_init_data max77686_buck4_data = {
.constraints = {
.name = "vdd_g3d range",
.min_uV = 850000,
.max_uV = 1200000,
.boot_on = 1,
.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
REGULATOR_CHANGE_STATUS,
.state_mem = {
.disabled = 1,
},
},
.num_consumer_supplies = 1,
.consumer_supplies = &max77686_buck4,
};
static struct regulator_init_data max77686_ldo11_data = {
.constraints = {
.name = "vdd_ldo11 range",
.min_uV = 1900000,
.max_uV = 1900000,
.apply_uV = 1,
.always_on = 1,
.state_mem = {
.enabled = 1,
},
},
.num_consumer_supplies = 1,
.consumer_supplies = &max77686_ldo11_consumer,
};
static struct regulator_init_data max77686_ldo14_data = {
.constraints = {
.name = "vdd_ldo14 range",
.min_uV = 1900000,
.max_uV = 1900000,
.apply_uV = 1,
.always_on = 1,
.state_mem = {
.enabled = 1,
},
},
.num_consumer_supplies = 1,
.consumer_supplies = &max77686_ldo14_consumer,
};
static struct max77686_regulator_data max77686_regulators[] = {
{MAX77686_BUCK1, &max77686_buck1_data,},
{MAX77686_BUCK2, &max77686_buck2_data,},
{MAX77686_BUCK3, &max77686_buck3_data,},
{MAX77686_BUCK4, &max77686_buck4_data,},
{MAX77686_LDO11, &max77686_ldo11_data,},
{MAX77686_LDO14, &max77686_ldo14_data,},
};
struct max77686_opmode_data max77686_opmode_data[MAX77686_REG_MAX] = {
[MAX77686_LDO11] = {MAX77686_LDO11, MAX77686_OPMODE_STANDBY},
[MAX77686_LDO14] = {MAX77686_LDO14, MAX77686_OPMODE_STANDBY},
[MAX77686_BUCK1] = {MAX77686_BUCK1, MAX77686_OPMODE_STANDBY},
[MAX77686_BUCK2] = {MAX77686_BUCK2, MAX77686_OPMODE_STANDBY},
[MAX77686_BUCK3] = {MAX77686_BUCK3, MAX77686_OPMODE_STANDBY},
[MAX77686_BUCK4] = {MAX77686_BUCK4, MAX77686_OPMODE_STANDBY},
};
static struct max77686_platform_data exynos4_max77686_info = {
.num_regulators = ARRAY_SIZE(max77686_regulators),
.regulators = max77686_regulators,
.irq_gpio = 0,
.irq_base = 0,
.wakeup = 0,
.opmode_data = max77686_opmode_data,
.ramp_rate = MAX77686_RAMP_RATE_27MV,
.buck2_voltage[0] = 1300000, /* 1.3V */
.buck2_voltage[1] = 1000000, /* 1.0V */
.buck2_voltage[2] = 950000, /* 0.95V */
.buck2_voltage[3] = 900000, /* 0.9V */
.buck2_voltage[4] = 1000000, /* 1.0V */
.buck2_voltage[5] = 1000000, /* 1.0V */
.buck2_voltage[6] = 950000, /* 0.95V */
.buck2_voltage[7] = 900000, /* 0.9V */
.buck3_voltage[0] = 1037500, /* 1.0375V */
.buck3_voltage[1] = 1000000, /* 1.0V */
.buck3_voltage[2] = 950000, /* 0.95V */
.buck3_voltage[3] = 900000, /* 0.9V */
.buck3_voltage[4] = 1000000, /* 1.0V */
.buck3_voltage[5] = 1000000, /* 1.0V */
.buck3_voltage[6] = 950000, /* 0.95V */
.buck3_voltage[7] = 900000, /* 0.9V */
.buck4_voltage[0] = 1100000, /* 1.1V */
.buck4_voltage[1] = 1000000, /* 1.0V */
.buck4_voltage[2] = 950000, /* 0.95V */
.buck4_voltage[3] = 900000, /* 0.9V */
.buck4_voltage[4] = 1000000, /* 1.0V */
.buck4_voltage[5] = 1000000, /* 1.0V */
.buck4_voltage[6] = 950000, /* 0.95V */
.buck4_voltage[7] = 900000, /* 0.9V */
};
#ifdef CONFIG_REGULATOR_S5M8767
/* S5M8767 Regulator */
static int s5m_cfg_irq(void)
{
/* AP_PMIC_IRQ: EINT26 */
s3c_gpio_cfgpin(EXYNOS4_GPX3(2), S3C_GPIO_SFN(0xF));
s3c_gpio_setpull(EXYNOS4_GPX3(2), S3C_GPIO_PULL_UP);
return 0;
}
static struct regulator_consumer_supply s5m8767_buck1_consumer =
REGULATOR_SUPPLY("vdd_mif", NULL);
static struct regulator_consumer_supply s5m8767_buck2_consumer =
REGULATOR_SUPPLY("vdd_arm", NULL);
static struct regulator_consumer_supply s5m8767_buck3_consumer =
REGULATOR_SUPPLY("vdd_int", NULL);
static struct regulator_consumer_supply s5m8767_buck4_consumer =
REGULATOR_SUPPLY("vdd_g3d", NULL);
static struct regulator_init_data s5m8767_buck1_data = {
.constraints = {
.name = "vdd_mif range",
.min_uV = 800000,
.max_uV = 1100000,
.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
REGULATOR_CHANGE_STATUS,
.state_mem = {
.disabled = 1,
},
},
.num_consumer_supplies = 1,
.consumer_supplies = &s5m8767_buck1_consumer,
};
static struct regulator_init_data s5m8767_buck2_data = {
.constraints = {
.name = "vdd_arm range",
.min_uV = 800000,
.max_uV = 1350000,
.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
REGULATOR_CHANGE_STATUS,
.state_mem = {
.disabled = 1,
},
},
.num_consumer_supplies = 1,
.consumer_supplies = &s5m8767_buck2_consumer,
};
static struct regulator_init_data s5m8767_buck3_data = {
.constraints = {
.name = "vdd_int range",
.min_uV = 800000,
.max_uV = 1150000,
.apply_uV = 1,
.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
REGULATOR_CHANGE_STATUS,
.state_mem = {
.uV = 1100000,
.mode = REGULATOR_MODE_NORMAL,
.disabled = 1,
},
},
.num_consumer_supplies = 1,
.consumer_supplies = &s5m8767_buck3_consumer,
};
static struct regulator_init_data s5m8767_buck4_data = {
.constraints = {
.name = "vdd_g3d range",
.min_uV = 850000,
.max_uV = 1200000,
.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
REGULATOR_CHANGE_STATUS,
.state_mem = {
.disabled = 1,
},
},
.num_consumer_supplies = 1,
.consumer_supplies = &s5m8767_buck4_consumer,
};
static struct s5m_regulator_data pegasus_regulators[] = {
{ S5M8767_BUCK1, &s5m8767_buck1_data },
{ S5M8767_BUCK2, &s5m8767_buck2_data },
{ S5M8767_BUCK3, &s5m8767_buck3_data },
{ S5M8767_BUCK4, &s5m8767_buck4_data },
};
static struct s5m_platform_data exynos4_s5m8767_pdata = {
.device_type = S5M8767X,
.irq_base = IRQ_BOARD_START,
.num_regulators = ARRAY_SIZE(pegasus_regulators),
.regulators = pegasus_regulators,
.cfg_pmic_irq = s5m_cfg_irq,
.wakeup = 1,
.opmode_data = s5m8767_opmode_data,
.wtsr_smpl = 1,
.buck2_voltage[0] = 1250000,
.buck2_voltage[1] = 1200000,
.buck2_voltage[2] = 1150000,
.buck2_voltage[3] = 1100000,
.buck2_voltage[4] = 1050000,
.buck2_voltage[5] = 1000000,
.buck2_voltage[6] = 950000,
.buck2_voltage[7] = 900000,
.buck3_voltage[0] = 1100000,
.buck3_voltage[1] = 1000000,
.buck3_voltage[2] = 950000,
.buck3_voltage[3] = 900000,
.buck3_voltage[4] = 1100000,
.buck3_voltage[5] = 1000000,
.buck3_voltage[6] = 950000,
.buck3_voltage[7] = 900000,
.buck4_voltage[0] = 1200000,
.buck4_voltage[1] = 1150000,
.buck4_voltage[2] = 1200000,
.buck4_voltage[3] = 1100000,
.buck4_voltage[4] = 1100000,
.buck4_voltage[5] = 1100000,
.buck4_voltage[6] = 1100000,
.buck4_voltage[7] = 1100000,
.buck_default_idx = 3,
.buck_gpios[0] = EXYNOS4_GPX2(3),
.buck_gpios[1] = EXYNOS4_GPX2(4),
.buck_gpios[2] = EXYNOS4_GPX2(5),
.buck_ramp_delay = 25,
.buck2_ramp_enable = true,
.buck3_ramp_enable = true,
.buck4_ramp_enable = true,
};
/* End of S5M8767 */
#endif
#ifdef CONFIG_VIDEO_S5P_MIPI_CSIS
static struct regulator_consumer_supply mipi_csi_fixed_voltage_supplies[] = {
REGULATOR_SUPPLY("mipi_csi", "s5p-mipi-csis.0"),
REGULATOR_SUPPLY("mipi_csi", "s5p-mipi-csis.1"),
};
static struct regulator_init_data mipi_csi_fixed_voltage_init_data = {
.constraints = {
.always_on = 1,
},
.num_consumer_supplies = ARRAY_SIZE(mipi_csi_fixed_voltage_supplies),
.consumer_supplies = mipi_csi_fixed_voltage_supplies,
};
static struct fixed_voltage_config mipi_csi_fixed_voltage_config = {
.supply_name = "DC_5V",
.microvolts = 5000000,
.gpio = -EINVAL,
.init_data = &mipi_csi_fixed_voltage_init_data,
};
static struct platform_device mipi_csi_fixed_voltage = {
.name = "reg-fixed-voltage",
.id = 3,
.dev = {
.platform_data = &mipi_csi_fixed_voltage_config,
},
};
#endif
#ifdef CONFIG_VIDEO_M5MOLS
static struct regulator_consumer_supply m5mols_fixed_voltage_supplies[] = {
REGULATOR_SUPPLY("core", NULL),
REGULATOR_SUPPLY("dig_18", NULL),
REGULATOR_SUPPLY("d_sensor", NULL),
REGULATOR_SUPPLY("dig_28", NULL),
REGULATOR_SUPPLY("a_sensor", NULL),
REGULATOR_SUPPLY("dig_12", NULL),
};
static struct regulator_init_data m5mols_fixed_voltage_init_data = {
.constraints = {
.always_on = 1,
},
.num_consumer_supplies = ARRAY_SIZE(m5mols_fixed_voltage_supplies),
.consumer_supplies = m5mols_fixed_voltage_supplies,
};
static struct fixed_voltage_config m5mols_fixed_voltage_config = {
.supply_name = "CAM_SENSOR",
.microvolts = 1800000,
.gpio = -EINVAL,
.init_data = &m5mols_fixed_voltage_init_data,
};
static struct platform_device m5mols_fixed_voltage = {
.name = "reg-fixed-voltage",
.id = 4,
.dev = {
.platform_data = &m5mols_fixed_voltage_config,
},
};
#endif
static struct regulator_consumer_supply wm8994_fixed_voltage0_supplies[] = {
REGULATOR_SUPPLY("AVDD2", "1-001a"),
REGULATOR_SUPPLY("CPVDD", "1-001a"),
};
static struct regulator_consumer_supply wm8994_fixed_voltage1_supplies[] = {
REGULATOR_SUPPLY("SPKVDD1", "1-001a"),
REGULATOR_SUPPLY("SPKVDD2", "1-001a"),
};
static struct regulator_consumer_supply wm8994_fixed_voltage2_supplies =
REGULATOR_SUPPLY("DBVDD", "1-001a");
static struct regulator_init_data wm8994_fixed_voltage0_init_data = {
.constraints = {
.always_on = 1,
},
.num_consumer_supplies = ARRAY_SIZE(wm8994_fixed_voltage0_supplies),
.consumer_supplies = wm8994_fixed_voltage0_supplies,
};
static struct regulator_init_data wm8994_fixed_voltage1_init_data = {
.constraints = {
.always_on = 1,
},
.num_consumer_supplies = ARRAY_SIZE(wm8994_fixed_voltage1_supplies),
.consumer_supplies = wm8994_fixed_voltage1_supplies,
};
static struct regulator_init_data wm8994_fixed_voltage2_init_data = {
.constraints = {
.always_on = 1,
},
.num_consumer_supplies = 1,
.consumer_supplies = &wm8994_fixed_voltage2_supplies,
};
static struct fixed_voltage_config wm8994_fixed_voltage0_config = {
.supply_name = "VDD_1.8V",
.microvolts = 1800000,
.gpio = -EINVAL,
.init_data = &wm8994_fixed_voltage0_init_data,
};
static struct fixed_voltage_config wm8994_fixed_voltage1_config = {
.supply_name = "DC_5V",
.microvolts = 5000000,
.gpio = -EINVAL,
.init_data = &wm8994_fixed_voltage1_init_data,
};
static struct fixed_voltage_config wm8994_fixed_voltage2_config = {
.supply_name = "VDD_3.3V",
.microvolts = 3300000,
.gpio = -EINVAL,
.init_data = &wm8994_fixed_voltage2_init_data,
};
static struct platform_device wm8994_fixed_voltage0 = {
.name = "reg-fixed-voltage",
.id = 0,
.dev = {
.platform_data = &wm8994_fixed_voltage0_config,
},
};
static struct platform_device wm8994_fixed_voltage1 = {
.name = "reg-fixed-voltage",
.id = 1,
.dev = {
.platform_data = &wm8994_fixed_voltage1_config,
},
};
static struct platform_device wm8994_fixed_voltage2 = {
.name = "reg-fixed-voltage",
.id = 2,
.dev = {
.platform_data = &wm8994_fixed_voltage2_config,
},
};
static struct regulator_consumer_supply wm8994_avdd1_supply =
REGULATOR_SUPPLY("AVDD1", "1-001a");
static struct regulator_consumer_supply wm8994_dcvdd_supply =
REGULATOR_SUPPLY("DCVDD", "1-001a");
static struct regulator_init_data wm8994_ldo1_data = {
.constraints = {
.name = "AVDD1",
},
.num_consumer_supplies = 1,
.consumer_supplies = &wm8994_avdd1_supply,
};
static struct regulator_init_data wm8994_ldo2_data = {
.constraints = {
.name = "DCVDD",
},
.num_consumer_supplies = 1,
.consumer_supplies = &wm8994_dcvdd_supply,
};
static struct wm8994_pdata wm8994_platform_data = {
/* configure gpio1 function: 0x0001(Logic level input/output) */
.gpio_defaults[0] = 0x0001,
/* If the i2s0 and i2s2 is enabled simultaneously */
.gpio_defaults[7] = 0x8100, /* GPIO8 DACDAT3 in */
.gpio_defaults[8] = 0x0100, /* GPIO9 ADCDAT3 out */
.gpio_defaults[9] = 0x0100, /* GPIO10 LRCLK3 out */
.gpio_defaults[10] = 0x0100,/* GPIO11 BCLK3 out */
.ldo[0] = { 0, NULL, &wm8994_ldo1_data },
.ldo[1] = { 0, NULL, &wm8994_ldo2_data },
};
static struct i2c_board_info i2c_devs0[] __initdata = {
#ifdef CONFIG_REGULATOR_S5M8767
{
I2C_BOARD_INFO("s5m87xx", 0xCC >> 1),
.platform_data = &exynos4_s5m8767_pdata,
.irq = IRQ_EINT(26),
},
#else
{
I2C_BOARD_INFO("max8997", 0x66),
.platform_data = &exynos4_max8997_info,
}, {
I2C_BOARD_INFO("max77686", (0x12 >> 1)),
.platform_data = &exynos4_max77686_info,
},
#endif
};
static struct i2c_board_info i2c_devs1[] __initdata = {
{
I2C_BOARD_INFO("wm8994", 0x1a),
.platform_data = &wm8994_platform_data,
},
};
static struct i2c_board_info i2c_devs2[] __initdata = {
#ifdef CONFIG_VIDEO_TVOUT
{
I2C_BOARD_INFO("s5p_ddc", (0x74 >> 1)),
},
#endif
};
static struct i2c_board_info i2c_devs3[] __initdata = {
{
I2C_BOARD_INFO("max8952", 0x60),
.platform_data = &exynos4_max8952_info,
},
};
static struct i2c_board_info i2c_devs7[] __initdata = {
{
I2C_BOARD_INFO("pixcir-ts", 0x5C),
},
};
#ifdef CONFIG_BATTERY_SAMSUNG
static struct platform_device samsung_device_battery = {
.name = "samsung-fake-battery",
.id = -1,
};
#endif
static struct gpio_event_direct_entry smdk4x12_keypad_key_map[] = {
{
.gpio = EXYNOS4_GPX0(0),
.code = KEY_POWER,
}
};
static struct gpio_event_input_info smdk4x12_keypad_key_info = {
.info.func = gpio_event_input_func,
.info.no_suspend = true,
.debounce_time.tv64 = 5 * NSEC_PER_MSEC,
.type = EV_KEY,
.keymap = smdk4x12_keypad_key_map,
.keymap_size = ARRAY_SIZE(smdk4x12_keypad_key_map)
};
static struct gpio_event_info *smdk4x12_input_info[] = {
&smdk4x12_keypad_key_info.info,
};
static struct gpio_event_platform_data smdk4x12_input_data = {
.names = {
"smdk4x12-keypad",
NULL,
},
.info = smdk4x12_input_info,
.info_count = ARRAY_SIZE(smdk4x12_input_info),
};
static struct platform_device smdk4x12_input_device = {
.name = GPIO_EVENT_DEV_NAME,
.id = 0,
.dev = {
.platform_data = &smdk4x12_input_data,
},
};
static void __init smdk4x12_gpio_power_init(void)
{
int err = 0;
err = gpio_request_one(EXYNOS4_GPX0(0), 0, "GPX0");
if (err) {
printk(KERN_ERR "failed to request GPX0 for "
"suspend/resume control\n");
return;
}
s3c_gpio_setpull(EXYNOS4_GPX0(0), S3C_GPIO_PULL_NONE);
gpio_free(EXYNOS4_GPX0(0));
}
static uint32_t smdk4x12_keymap0[] __initdata = {
/* KEY(row, col, keycode) */
KEY(1, 0, KEY_D), KEY(1, 1, KEY_A), KEY(1, 2, KEY_B),
KEY(1, 3, KEY_E), KEY(1, 4, KEY_C)
};
static struct matrix_keymap_data smdk4x12_keymap_data0 __initdata = {
.keymap = smdk4x12_keymap0,
.keymap_size = ARRAY_SIZE(smdk4x12_keymap0),
};
static struct samsung_keypad_platdata smdk4x12_keypad_data0 __initdata = {
.keymap_data = &smdk4x12_keymap_data0,
.rows = 2,
.cols = 5,
};
static uint32_t smdk4x12_keymap1[] __initdata = {
/* KEY(row, col, keycode) */
KEY(1, 3, KEY_1), KEY(1, 4, KEY_2), KEY(1, 5, KEY_3),
KEY(1, 6, KEY_4), KEY(1, 7, KEY_5),
KEY(2, 5, KEY_D), KEY(2, 6, KEY_A), KEY(2, 7, KEY_B),
KEY(0, 7, KEY_E), KEY(0, 5, KEY_C)
};
static struct matrix_keymap_data smdk4x12_keymap_data1 __initdata = {
.keymap = smdk4x12_keymap1,
.keymap_size = ARRAY_SIZE(smdk4x12_keymap1),
};
static struct samsung_keypad_platdata smdk4x12_keypad_data1 __initdata = {
.keymap_data = &smdk4x12_keymap_data1,
.rows = 3,
.cols = 8,
};
#ifdef CONFIG_WAKEUP_ASSIST
static struct platform_device wakeup_assist_device = {
.name = "wakeup_assist",
};
#endif
#ifdef CONFIG_VIDEO_FIMG2D
static struct fimg2d_platdata fimg2d_data __initdata = {
.hw_ver = 0x41,
.parent_clkname = "mout_g2d0",
.clkname = "sclk_fimg2d",
.gate_clkname = "fimg2d",
.clkrate = 201 * 1000000, /* 200 Mhz */
};
#endif
#ifdef CONFIG_USB_EXYNOS_SWITCH
static struct s5p_usbswitch_platdata smdk4x12_usbswitch_pdata;
static void __init smdk4x12_usbswitch_init(void)
{
struct s5p_usbswitch_platdata *pdata = &smdk4x12_usbswitch_pdata;
int err;
pdata->gpio_host_detect = EXYNOS4_GPX3(5); /* low active */
err = gpio_request_one(pdata->gpio_host_detect, GPIOF_IN, "HOST_DETECT");
if (err) {
printk(KERN_ERR "failed to request gpio_host_detect\n");
return;
}
s3c_gpio_cfgpin(pdata->gpio_host_detect, S3C_GPIO_SFN(0xF));
s3c_gpio_setpull(pdata->gpio_host_detect, S3C_GPIO_PULL_NONE);
gpio_free(pdata->gpio_host_detect);
pdata->gpio_device_detect = EXYNOS4_GPX3(4); /* high active */
err = gpio_request_one(pdata->gpio_device_detect, GPIOF_IN, "DEVICE_DETECT");
if (err) {
printk(KERN_ERR "failed to request gpio_host_detect for\n");
return;
}
s3c_gpio_cfgpin(pdata->gpio_device_detect, S3C_GPIO_SFN(0xF));
s3c_gpio_setpull(pdata->gpio_device_detect, S3C_GPIO_PULL_NONE);
gpio_free(pdata->gpio_device_detect);
if (samsung_board_rev_is_0_0())
pdata->gpio_host_vbus = 0;
else {
pdata->gpio_host_vbus = EXYNOS4_GPL2(0);
err = gpio_request_one(pdata->gpio_host_vbus, GPIOF_OUT_INIT_LOW, "HOST_VBUS_CONTROL");
if (err) {
printk(KERN_ERR "failed to request gpio_host_vbus\n");
return;
}
s3c_gpio_setpull(pdata->gpio_host_vbus, S3C_GPIO_PULL_NONE);
gpio_free(pdata->gpio_host_vbus);
}
s5p_usbswitch_set_platdata(pdata);
}
#endif
#ifdef CONFIG_BUSFREQ_OPP
/* BUSFREQ to control memory/bus*/
static struct device_domain busfreq;
#endif
static struct platform_device exynos4_busfreq = {
.id = -1,
.name = "exynos-busfreq",
};
static struct platform_device *smdk4412_devices[] __initdata = {
&s3c_device_adc,
};
static struct platform_device *smdk4x12_devices[] __initdata = {
/* Samsung Power Domain */
&exynos4_device_pd[PD_MFC],
&exynos4_device_pd[PD_G3D],
&exynos4_device_pd[PD_LCD0],
&exynos4_device_pd[PD_CAM],
&exynos4_device_pd[PD_TV],
&exynos4_device_pd[PD_GPS],
&exynos4_device_pd[PD_GPS_ALIVE],
#ifdef CONFIG_VIDEO_EXYNOS_FIMC_IS
&exynos4_device_pd[PD_ISP],
#endif
#ifdef CONFIG_FB_MIPI_DSIM
&s5p_device_mipi_dsim,
#endif
/* mainline fimd */
#ifdef CONFIG_FB_S3C
&s5p_device_fimd0,
#if defined(CONFIG_LCD_AMS369FG06) || defined(CONFIG_LCD_LMS501KF03)
&s3c_device_spi_gpio,
#elif defined(CONFIG_LCD_WA101S)
&smdk4x12_lcd_wa101s,
#elif defined(CONFIG_LCD_LTE480WV)
&smdk4x12_lcd_lte480wv,
#elif defined(CONFIG_LCD_MIPI_S6E63M0)
&smdk4x12_mipi_lcd,
#endif
#endif
/* legacy fimd */
#ifdef CONFIG_FB_S5P
&s3c_device_fb,
#ifdef CONFIG_FB_S5P_LMS501KF03
&s3c_device_spi_gpio,
#endif
#endif
&s3c_device_wdt,
&s3c_device_rtc,
&s3c_device_i2c0,
&s3c_device_i2c1,
&s3c_device_i2c2,
&s3c_device_i2c3,
&s3c_device_i2c4,
&s3c_device_i2c5,
&s3c_device_i2c7,
#ifdef CONFIG_USB_EHCI_S5P
&s5p_device_ehci,
#endif
#ifdef CONFIG_USB_OHCI_S5P
&s5p_device_ohci,
#endif
#ifdef CONFIG_USB_GADGET
&s3c_device_usbgadget,
#endif
#ifdef CONFIG_USB_ANDROID_RNDIS
&s3c_device_rndis,
#endif
#ifdef CONFIG_USB_ANDROID
&s3c_device_android_usb,
&s3c_device_usb_mass_storage,
#endif
#ifdef CONFIG_S3C_DEV_HSMMC
&s3c_device_hsmmc0,
#endif
#ifdef CONFIG_S3C_DEV_HSMMC1
&s3c_device_hsmmc1,
#endif
#ifdef CONFIG_S3C_DEV_HSMMC2
&s3c_device_hsmmc2,
#endif
#ifdef CONFIG_S3C_DEV_HSMMC3
&s3c_device_hsmmc3,
#endif
#ifdef CONFIG_S5P_DEV_MSHC
&s3c_device_mshci,
#endif
#ifdef CONFIG_EXYNOS4_DEV_DWMCI
&exynos_device_dwmci,
#endif
#ifdef CONFIG_SND_SAMSUNG_AC97
&exynos_device_ac97,
#endif
#ifdef CONFIG_SND_SAMSUNG_I2S
&exynos_device_i2s0,
#endif
#ifdef CONFIG_SND_SAMSUNG_PCM
&exynos_device_pcm0,
#endif
#ifdef CONFIG_SND_SAMSUNG_SPDIF
&exynos_device_spdif,
#endif
#if defined(CONFIG_SND_SAMSUNG_RP) || defined(CONFIG_SND_SAMSUNG_ALP)
&exynos_device_srp,
#endif
#ifdef CONFIG_VIDEO_EXYNOS_FIMC_IS
&exynos4_device_fimc_is,
#endif
#ifdef CONFIG_VIDEO_TVOUT
&s5p_device_tvout,
&s5p_device_cec,
&s5p_device_hpd,
#endif
#ifdef CONFIG_FB_S5P_EXTDSP
&s3c_device_extdsp,
#endif
#ifdef CONFIG_VIDEO_EXYNOS_TV
&s5p_device_i2c_hdmiphy,
&s5p_device_hdmi,
&s5p_device_sdo,
&s5p_device_mixer,
&s5p_device_cec,
#endif
#if defined(CONFIG_VIDEO_FIMC)
&s3c_device_fimc0,
&s3c_device_fimc1,
&s3c_device_fimc2,
&s3c_device_fimc3,
/* CONFIG_VIDEO_SAMSUNG_S5P_FIMC is the feature for mainline */
#elif defined(CONFIG_VIDEO_SAMSUNG_S5P_FIMC)
&s5p_device_fimc0,
&s5p_device_fimc1,
&s5p_device_fimc2,
&s5p_device_fimc3,
#endif
#if defined(CONFIG_VIDEO_FIMC_MIPI)
&s3c_device_csis0,
&s3c_device_csis1,
#elif defined(CONFIG_VIDEO_S5P_MIPI_CSIS)
&s5p_device_mipi_csis0,
&s5p_device_mipi_csis1,
#endif
#ifdef CONFIG_VIDEO_S5P_MIPI_CSIS
&mipi_csi_fixed_voltage,
#endif
#ifdef CONFIG_VIDEO_M5MOLS
&m5mols_fixed_voltage,
#endif
#if defined(CONFIG_VIDEO_MFC5X) || defined(CONFIG_VIDEO_SAMSUNG_S5P_MFC)
&s5p_device_mfc,
#endif
#ifdef CONFIG_S5P_SYSTEM_MMU
&SYSMMU_PLATDEV(g2d_acp),
&SYSMMU_PLATDEV(fimc0),
&SYSMMU_PLATDEV(fimc1),
&SYSMMU_PLATDEV(fimc2),
&SYSMMU_PLATDEV(fimc3),
&SYSMMU_PLATDEV(jpeg),
&SYSMMU_PLATDEV(mfc_l),
&SYSMMU_PLATDEV(mfc_r),
&SYSMMU_PLATDEV(tv),
#ifdef CONFIG_VIDEO_EXYNOS_FIMC_IS
&SYSMMU_PLATDEV(is_isp),
&SYSMMU_PLATDEV(is_drc),
&SYSMMU_PLATDEV(is_fd),
&SYSMMU_PLATDEV(is_cpu),
#endif
#endif /* CONFIG_S5P_SYSTEM_MMU */
#ifdef CONFIG_ION_EXYNOS
&exynos_device_ion,
#endif
#ifdef CONFIG_VIDEO_EXYNOS_FIMC_LITE
&exynos_device_flite0,
&exynos_device_flite1,
#endif
#ifdef CONFIG_VIDEO_FIMG2D
&s5p_device_fimg2d,
#endif
#ifdef CONFIG_EXYNOS_MEDIA_DEVICE
&exynos_device_md0,
#endif
#ifdef CONFIG_VIDEO_JPEG_V2X
&s5p_device_jpeg,
#endif
&wm8994_fixed_voltage0,
&wm8994_fixed_voltage1,
&wm8994_fixed_voltage2,
&samsung_asoc_dma,
&samsung_asoc_idma,
#ifdef CONFIG_BATTERY_SAMSUNG
&samsung_device_battery,
#endif
&samsung_device_keypad,
#ifdef CONFIG_WAKEUP_ASSIST
&wakeup_assist_device,
#endif
&smdk4x12_input_device,
&smdk4x12_smsc911x,
#ifdef CONFIG_S3C64XX_DEV_SPI
&exynos_device_spi0,
#ifndef CONFIG_FB_S5P_LMS501KF03
&exynos_device_spi1,
#endif
&exynos_device_spi2,
#endif
#ifdef CONFIG_EXYNOS_SETUP_THERMAL
&exynos_device_tmu,
#endif
#ifdef CONFIG_S5P_DEV_ACE
&s5p_device_ace,
#endif
&exynos4_busfreq,
};
#ifdef CONFIG_EXYNOS_SETUP_THERMAL
/* below temperature base on the celcius degree */
struct tmu_data exynos_tmu_data __initdata = {
.ts = {
.stop_throttle = 82,
.start_throttle = 85,
.stop_warning = 95,
.start_warning = 103,
.start_tripping = 110, /* temp to do tripping */
},
.efuse_value = 55,
.slope = 0x10008802,
.mode = 0,
};
#endif
#if defined(CONFIG_VIDEO_TVOUT)
static struct s5p_platform_hpd hdmi_hpd_data __initdata = {
};
static struct s5p_platform_cec hdmi_cec_data __initdata = {
};
#endif
#ifdef CONFIG_VIDEO_EXYNOS_HDMI_CEC
static struct s5p_platform_cec hdmi_cec_data __initdata = {
};
#endif
#ifdef CONFIG_VIDEO_SAMSUNG_S5P_FIMC
static struct s5p_fimc_isp_info isp_info[] = {
#if defined(CONFIG_VIDEO_S5K4BA)
{
.board_info = &s5k4ba_info,
.clk_frequency = 24000000UL,
.bus_type = FIMC_ITU_601,
#ifdef CONFIG_ITU_A
.i2c_bus_num = 0,
.mux_id = 0, /* A-Port : 0, B-Port : 1 */
#endif
#ifdef CONFIG_ITU_B
.i2c_bus_num = 1,
.mux_id = 1, /* A-Port : 0, B-Port : 1 */
#endif
.flags = FIMC_CLK_INV_VSYNC,
},
#endif
#if defined(CONFIG_VIDEO_S5K4EA)
{
.board_info = &s5k4ea_info,
.clk_frequency = 24000000UL,
.bus_type = FIMC_MIPI_CSI2,
#ifdef CONFIG_CSI_C
.i2c_bus_num = 0,
.mux_id = 0, /* A-Port : 0, B-Port : 1 */
#endif
#ifdef CONFIG_CSI_D
.i2c_bus_num = 1,
.mux_id = 1, /* A-Port : 0, B-Port : 1 */
#endif
.flags = FIMC_CLK_INV_VSYNC,
.csi_data_align = 32,
},
#endif
#if defined(CONFIG_VIDEO_M5MOLS)
{
.board_info = &m5mols_board_info,
.clk_frequency = 24000000UL,
.bus_type = FIMC_MIPI_CSI2,
#ifdef CONFIG_CSI_C
.i2c_bus_num = 4,
.mux_id = 0, /* A-Port : 0, B-Port : 1 */
#endif
#ifdef CONFIG_CSI_D
.i2c_bus_num = 5,
.mux_id = 1, /* A-Port : 0, B-Port : 1 */
#endif
.flags = FIMC_CLK_INV_PCLK | FIMC_CLK_INV_VSYNC,
.csi_data_align = 32,
},
#endif
#ifdef CONFIG_VIDEO_EXYNOS_FIMC_IS
#if defined(CONFIG_VIDEO_S5K3H2)
{
.board_info = &s5k3h2_sensor_info,
.clk_frequency = 24000000UL,
.bus_type = FIMC_MIPI_CSI2,
#ifdef CONFIG_S5K3H2_CSI_C
.i2c_bus_num = 0,
.mux_id = 0, /* A-Port : 0, B-Port : 1 */
.flite_id = FLITE_IDX_A,
.cam_power = smdk4x12_cam0_reset,
#endif
#ifdef CONFIG_S5K3H2_CSI_D
.i2c_bus_num = 1,
.mux_id = 1, /* A-Port : 0, B-Port : 1 */
.flite_id = FLITE_IDX_B,
.cam_power = smdk4x12_cam1_reset,
#endif
.flags = 0,
.csi_data_align = 24,
.use_isp = true,
},
#endif
#if defined(CONFIG_VIDEO_S5K3H7)
{
.board_info = &s5k3h7_sensor_info,
.clk_frequency = 24000000UL,
.bus_type = FIMC_MIPI_CSI2,
#ifdef CONFIG_S5K3H7_CSI_C
.i2c_bus_num = 0,
.mux_id = 0, /* A-Port : 0, B-Port : 1 */
.flite_id = FLITE_IDX_A,
.cam_power = smdk4x12_cam0_reset,
#endif
#ifdef CONFIG_S5K3H7_CSI_D
.i2c_bus_num = 1,
.mux_id = 1, /* A-Port : 0, B-Port : 1 */
.flite_id = FLITE_IDX_B,
.cam_power = smdk4x12_cam1_reset,
#endif
.csi_data_align = 24,
.use_isp = true,
},
#endif
#if defined(CONFIG_VIDEO_S5K4E5)
{
.board_info = &s5k4e5_sensor_info,
.clk_frequency = 24000000UL,
.bus_type = FIMC_MIPI_CSI2,
#ifdef CONFIG_S5K4E5_CSI_C
.i2c_bus_num = 0,
.mux_id = 0, /* A-Port : 0, B-Port : 1 */
.flite_id = FLITE_IDX_A,
.cam_power = smdk4x12_cam0_reset,
#endif
#ifdef CONFIG_S5K4E5_CSI_D
.i2c_bus_num = 1,
.mux_id = 1, /* A-Port : 0, B-Port : 1 */
.flite_id = FLITE_IDX_B,
.cam_power = smdk4x12_cam1_reset,
#endif
.csi_data_align = 24,
.use_isp = true,
},
#endif
#if defined(CONFIG_VIDEO_S5K6A3)
{
.board_info = &s5k6a3_sensor_info,
.clk_frequency = 12000000UL,
.bus_type = FIMC_MIPI_CSI2,
#ifdef CONFIG_S5K6A3_CSI_C
.i2c_bus_num = 0,
.mux_id = 0, /* A-Port : 0, B-Port : 1 */
.flite_id = FLITE_IDX_A,
.cam_power = smdk4x12_cam0_reset,
#endif
#ifdef CONFIG_S5K6A3_CSI_D
.i2c_bus_num = 1,
.mux_id = 1, /* A-Port : 0, B-Port : 1 */
.flite_id = FLITE_IDX_B,
.cam_power = smdk4x12_cam1_reset,
#endif
.flags = 0,
.csi_data_align = 12,
.use_isp = true,
},
#endif
#endif
#if defined(WRITEBACK_ENABLED)
{
.board_info = &writeback_info,
.bus_type = FIMC_LCD_WB,
.i2c_bus_num = 0,
.mux_id = 0, /* A-Port : 0, B-Port : 1 */
.flags = FIMC_CLK_INV_VSYNC,
},
#endif
};
static void __init smdk4x12_subdev_config(void)
{
s3c_fimc0_default_data.isp_info[0] = &isp_info[0];
s3c_fimc0_default_data.isp_info[0]->use_cam = true;
s3c_fimc0_default_data.isp_info[1] = &isp_info[1];
s3c_fimc0_default_data.isp_info[1]->use_cam = true;
/* support using two fimc as one sensore */
{
static struct s5p_fimc_isp_info camcording1;
static struct s5p_fimc_isp_info camcording2;
memcpy(&camcording1, &isp_info[0], sizeof(struct s5p_fimc_isp_info));
memcpy(&camcording2, &isp_info[1], sizeof(struct s5p_fimc_isp_info));
s3c_fimc1_default_data.isp_info[0] = &camcording1;
s3c_fimc1_default_data.isp_info[0]->use_cam = false;
s3c_fimc1_default_data.isp_info[1] = &camcording2;
s3c_fimc1_default_data.isp_info[1]->use_cam = false;
}
#ifdef CONFIG_VIDEO_EXYNOS_FIMC_IS
#ifdef CONFIG_VIDEO_S5K3H2
#ifdef CONFIG_S5K3H2_CSI_C
s5p_mipi_csis0_default_data.clk_rate = 160000000;
s5p_mipi_csis0_default_data.lanes = 2;
s5p_mipi_csis0_default_data.alignment = 24;
s5p_mipi_csis0_default_data.hs_settle = 12;
#endif
#ifdef CONFIG_S5K3H2_CSI_D
s5p_mipi_csis1_default_data.clk_rate = 160000000;
s5p_mipi_csis1_default_data.lanes = 2;
s5p_mipi_csis1_default_data.alignment = 24;
s5p_mipi_csis1_default_data.hs_settle = 12;
#endif
#endif
#ifdef CONFIG_VIDEO_S5K3H7
#ifdef CONFIG_S5K3H7_CSI_C
s5p_mipi_csis0_default_data.clk_rate = 160000000;
s5p_mipi_csis0_default_data.lanes = 2;
s5p_mipi_csis0_default_data.alignment = 24;
s5p_mipi_csis0_default_data.hs_settle = 12;
#endif
#ifdef CONFIG_S5K3H7_CSI_D
s5p_mipi_csis1_default_data.clk_rate = 160000000;
s5p_mipi_csis1_default_data.lanes = 2;
s5p_mipi_csis1_default_data.alignment = 24;
s5p_mipi_csis1_default_data.hs_settle = 12;
#endif
#endif
#ifdef CONFIG_VIDEO_S5K4E5
#ifdef CONFIG_S5K4E5_CSI_C
s5p_mipi_csis0_default_data.clk_rate = 160000000;
s5p_mipi_csis0_default_data.lanes = 2;
s5p_mipi_csis0_default_data.alignment = 24;
s5p_mipi_csis0_default_data.hs_settle = 12;
#endif
#ifdef CONFIG_S5K4E5_CSI_D
s5p_mipi_csis1_default_data.clk_rate = 160000000;
s5p_mipi_csis1_default_data.lanes = 2;
s5p_mipi_csis1_default_data.alignment = 24;
s5p_mipi_csis1_default_data.hs_settle = 12;
#endif
#endif
#ifdef CONFIG_VIDEO_S5K6A3
#ifdef CONFIG_S5K6A3_CSI_C
s5p_mipi_csis0_default_data.clk_rate = 160000000;
s5p_mipi_csis0_default_data.lanes = 1;
s5p_mipi_csis0_default_data.alignment = 24;
s5p_mipi_csis0_default_data.hs_settle = 12;
#endif
#ifdef CONFIG_S5K6A3_CSI_D
s5p_mipi_csis1_default_data.clk_rate = 160000000;
s5p_mipi_csis1_default_data.lanes = 1;
s5p_mipi_csis1_default_data.alignment = 24;
s5p_mipi_csis1_default_data.hs_settle = 12;
#endif
#endif
#endif
}
static void __init smdk4x12_camera_config(void)
{
/* CAM A port(b0010) : PCLK, VSYNC, HREF, DATA[0-4] */
s3c_gpio_cfgrange_nopull(EXYNOS4212_GPJ0(0), 8, S3C_GPIO_SFN(2));
/* CAM A port(b0010) : DATA[5-7], CLKOUT(MIPI CAM also), FIELD */
s3c_gpio_cfgrange_nopull(EXYNOS4212_GPJ1(0), 5, S3C_GPIO_SFN(2));
/* CAM B port(b0011) : PCLK, DATA[0-6] */
s3c_gpio_cfgrange_nopull(EXYNOS4212_GPM0(0), 8, S3C_GPIO_SFN(3));
/* CAM B port(b0011) : FIELD, DATA[7]*/
s3c_gpio_cfgrange_nopull(EXYNOS4212_GPM1(0), 2, S3C_GPIO_SFN(3));
/* CAM B port(b0011) : VSYNC, HREF, CLKOUT*/
s3c_gpio_cfgrange_nopull(EXYNOS4212_GPM2(0), 3, S3C_GPIO_SFN(3));
/* note : driver strength to max is unnecessary */
#ifdef CONFIG_VIDEO_M5MOLS
s3c_gpio_cfgpin(EXYNOS4_GPX2(6), S3C_GPIO_SFN(0xF));
s3c_gpio_setpull(EXYNOS4_GPX2(6), S3C_GPIO_PULL_NONE);
#endif
}
#endif /* CONFIG_VIDEO_SAMSUNG_S5P_FIMC */
#ifdef CONFIG_VIDEO_EXYNOS_FIMC_LITE
static void __set_flite_camera_config(struct exynos_platform_flite *data,
u32 active_index, u32 max_cam)
{
data->active_cam_index = active_index;
data->num_clients = max_cam;
}
static void __init smdk4x12_set_camera_flite_platdata(void)
{
int flite0_cam_index = 0;
int flite1_cam_index = 0;
#ifdef CONFIG_VIDEO_S5K3H2
#ifdef CONFIG_S5K3H2_CSI_C
exynos_flite0_default_data.cam[flite0_cam_index++] = &s5k3h2;
#endif
#ifdef CONFIG_S5K3H2_CSI_D
exynos_flite1_default_data.cam[flite1_cam_index++] = &s5k3h2;
#endif
#endif
#ifdef CONFIG_VIDEO_S5K3H7
#ifdef CONFIG_S5K3H7_CSI_C
exynos_flite0_default_data.cam[flite0_cam_index++] = &s5k3h7;
#endif
#ifdef CONFIG_S5K3H7_CSI_D
exynos_flite1_default_data.cam[flite1_cam_index++] = &s5k3h7;
#endif
#endif
#ifdef CONFIG_VIDEO_S5K4E5
#ifdef CONFIG_S5K4E5_CSI_C
exynos_flite0_default_data.cam[flite0_cam_index++] = &s5k4e5;
#endif
#ifdef CONFIG_S5K4E5_CSI_D
exynos_flite1_default_data.cam[flite1_cam_index++] = &s5k4e5;
#endif
#endif
#ifdef CONFIG_VIDEO_S5K6A3
#ifdef CONFIG_S5K6A3_CSI_C
exynos_flite0_default_data.cam[flite0_cam_index++] = &s5k6a3;
#endif
#ifdef CONFIG_S5K6A3_CSI_D
exynos_flite1_default_data.cam[flite1_cam_index++] = &s5k6a3;
#endif
#endif
__set_flite_camera_config(&exynos_flite0_default_data, 0, flite0_cam_index);
__set_flite_camera_config(&exynos_flite1_default_data, 0, flite1_cam_index);
}
#endif
#if defined(CONFIG_CMA)
static void __init exynos4_reserve_mem(void)
{
static struct cma_region regions[] = {
#ifdef CONFIG_EXYNOS_C2C
{
.name = "c2c_shdmem",
.size = C2C_SHAREDMEM_SIZE,
{
.alignment = C2C_SHAREDMEM_SIZE,
},
.start = 0
},
#endif
#ifndef CONFIG_VIDEOBUF2_ION
#ifdef CONFIG_VIDEO_SAMSUNG_MEMSIZE_TV
{
.name = "tv",
.size = CONFIG_VIDEO_SAMSUNG_MEMSIZE_TV * SZ_1K,
.start = 0
},
#endif
#ifdef CONFIG_VIDEO_SAMSUNG_MEMSIZE_JPEG
{
.name = "jpeg",
.size = CONFIG_VIDEO_SAMSUNG_MEMSIZE_JPEG * SZ_1K,
.start = 0
},
#endif
#ifdef CONFIG_AUDIO_SAMSUNG_MEMSIZE_SRP
{
.name = "srp",
.size = CONFIG_AUDIO_SAMSUNG_MEMSIZE_SRP * SZ_1K,
.start = 0,
},
#endif
#ifdef CONFIG_VIDEO_SAMSUNG_MEMSIZE_FIMG2D
{
.name = "fimg2d",
.size = CONFIG_VIDEO_SAMSUNG_MEMSIZE_FIMG2D * SZ_1K,
.start = 0
},
#endif
#ifdef CONFIG_VIDEO_SAMSUNG_MEMSIZE_FIMD
{
.name = "fimd",
.size = CONFIG_VIDEO_SAMSUNG_MEMSIZE_FIMD * SZ_1K,
.start = 0
},
#endif
#ifdef CONFIG_VIDEO_SAMSUNG_MEMSIZE_FIMC0
{
.name = "fimc0",
.size = CONFIG_VIDEO_SAMSUNG_MEMSIZE_FIMC0 * SZ_1K,
.start = 0
},
#endif
#ifdef CONFIG_VIDEO_SAMSUNG_MEMSIZE_FIMC2
{
.name = "fimc2",
.size = CONFIG_VIDEO_SAMSUNG_MEMSIZE_FIMC2 * SZ_1K,
.start = 0
},
#endif
#if !defined(CONFIG_EXYNOS_CONTENT_PATH_PROTECTION) && \
defined(CONFIG_VIDEO_SAMSUNG_MEMSIZE_FIMC3)
{
.name = "fimc3",
.size = CONFIG_VIDEO_SAMSUNG_MEMSIZE_FIMC3 * SZ_1K,
},
#endif
#ifdef CONFIG_VIDEO_SAMSUNG_MEMSIZE_FIMC1
{
.name = "fimc1",
.size = CONFIG_VIDEO_SAMSUNG_MEMSIZE_FIMC1 * SZ_1K,
.start = 0
},
#endif
#ifdef CONFIG_VIDEO_SAMSUNG_MEMSIZE_MFC_NORMAL
{
.name = "mfc-normal",
.size = CONFIG_VIDEO_SAMSUNG_MEMSIZE_MFC_NORMAL * SZ_1K,
{ .alignment = 1 << 17 },
},
#endif
#ifdef CONFIG_VIDEO_SAMSUNG_MEMSIZE_MFC1
{
.name = "mfc1",
.size = CONFIG_VIDEO_SAMSUNG_MEMSIZE_MFC1 * SZ_1K,
{
.alignment = 1 << 17,
},
.start = 0,
},
#endif
#ifdef CONFIG_VIDEO_SAMSUNG_MEMSIZE_MFC0
{
.name = "mfc0",
.size = CONFIG_VIDEO_SAMSUNG_MEMSIZE_MFC0 * SZ_1K,
{
.alignment = 1 << 17,
}
},
#endif
#ifdef CONFIG_VIDEO_SAMSUNG_MEMSIZE_MFC
{
.name = "mfc",
.size = CONFIG_VIDEO_SAMSUNG_MEMSIZE_MFC * SZ_1K,
{
.alignment = 1 << 17,
},
.start = 0
},
#endif
#ifdef CONFIG_VIDEO_EXYNOS_FIMC_IS
{
.name = "fimc_is",
.size = CONFIG_VIDEO_EXYNOS_MEMSIZE_FIMC_IS * SZ_1K,
{
.alignment = 1 << 26,
},
.start = 0
},
#ifdef CONFIG_VIDEO_EXYNOS_FIMC_IS_BAYER
{
.name = "fimc_is_isp",
.size = CONFIG_VIDEO_EXYNOS_MEMSIZE_FIMC_IS_ISP * SZ_1K,
.start = 0
},
#endif
#endif
#if !defined(CONFIG_EXYNOS_CONTENT_PATH_PROTECTION) && \
defined(CONFIG_VIDEO_SAMSUNG_S5P_MFC)
{
.name = "b2",
.size = 32 << 20,
{ .alignment = 128 << 10 },
},
{
.name = "b1",
.size = 32 << 20,
{ .alignment = 128 << 10 },
},
{
.name = "fw",
.size = 1 << 20,
{ .alignment = 128 << 10 },
},
#endif
#else /* !CONFIG_VIDEOBUF2_ION */
#ifdef CONFIG_FB_S5P
#error CONFIG_FB_S5P is defined. Select CONFIG_FB_S3C, instead
#endif
{
.name = "ion",
.size = CONFIG_ION_EXYNOS_CONTIGHEAP_SIZE * SZ_1K,
},
#endif /* !CONFIG_VIDEOBUF2_ION */
{
.size = 0
},
};
#ifdef CONFIG_EXYNOS_CONTENT_PATH_PROTECTION
static struct cma_region regions_secure[] = {
#ifdef CONFIG_VIDEO_SAMSUNG_MEMSIZE_FIMC3
{
.name = "fimc3",
.size = CONFIG_VIDEO_SAMSUNG_MEMSIZE_FIMC3 * SZ_1K,
},
#endif
#ifdef CONFIG_VIDEO_SAMSUNG_MEMSIZE_FIMD_VIDEO
{
.name = "video",
.size = CONFIG_VIDEO_SAMSUNG_MEMSIZE_FIMD_VIDEO * SZ_1K,
},
#endif
#ifdef CONFIG_VIDEO_SAMSUNG_MEMSIZE_MFC_SECURE
{
.name = "mfc-secure",
.size = CONFIG_VIDEO_SAMSUNG_MEMSIZE_MFC_SECURE * SZ_1K,
},
#endif
{
.name = "sectbl",
.size = SZ_1M,
},
{
.size = 0
},
};
#else /* !CONFIG_EXYNOS_CONTENT_PATH_PROTECTION */
struct cma_region *regions_secure = NULL;
#endif
static const char map[] __initconst =
#ifdef CONFIG_EXYNOS_C2C
"samsung-c2c=c2c_shdmem;"
#endif
"s3cfb.0/fimd=fimd;exynos4-fb.0/fimd=fimd;samsung-pd.1=fimd;"
#ifdef CONFIG_EXYNOS_CONTENT_PATH_PROTECTION
"s3cfb.0/video=video;exynos4-fb.0/video=video;"
#endif
"s3c-fimc.0=fimc0;s3c-fimc.1=fimc1;s3c-fimc.2=fimc2;s3c-fimc.3=fimc3;"
"exynos4210-fimc.0=fimc0;exynos4210-fimc.1=fimc1;exynos4210-fimc.2=fimc2;exynos4210-fimc.3=fimc3;"
#ifdef CONFIG_VIDEO_MFC5X
"s3c-mfc=mfc,mfc0,mfc1;"
#endif
#ifdef CONFIG_VIDEO_SAMSUNG_S5P_MFC
"s5p-mfc/f=fw;"
"s5p-mfc/a=b1;"
"s5p-mfc/b=b2;"
#endif
"samsung-rp=srp;"
"s5p-jpeg=jpeg;"
"exynos4-fimc-is/f=fimc_is;"
#ifdef CONFIG_VIDEO_EXYNOS_FIMC_IS_BAYER
"exynos4-fimc-is/i=fimc_is_isp;"
#endif
"s5p-mixer=tv;"
"s5p-fimg2d=fimg2d;"
"ion-exynos=ion,fimd,fimc0,fimc1,fimc2,fimc3,mfc,mfc0,mfc1,fw,b1,b2;"
#ifdef CONFIG_EXYNOS_CONTENT_PATH_PROTECTION
"s5p-smem/video=video;"
"s5p-smem/sectbl=sectbl;"
#endif
"s5p-smem/mfc=mfc0;"
"s5p-smem/fimc=fimc3;"
"s5p-smem/mfc-shm=mfc1,mfc-normal;"
"s5p-smem/fimd=fimd;";
s5p_cma_region_reserve(regions, regions_secure, 0, map);
}
#else
static inline void exynos4_reserve_mem(void)
{
}
#endif /* CONFIG_CMA */
/* LCD Backlight data */
static struct samsung_bl_gpio_info smdk4x12_bl_gpio_info = {
.no = EXYNOS4_GPD0(1),
.func = S3C_GPIO_SFN(2),
};
static struct platform_pwm_backlight_data smdk4x12_bl_data = {
.pwm_id = 1,
#ifdef CONFIG_FB_S5P_LMS501KF03
.pwm_period_ns = 1000,
#endif
};
static void __init smdk4x12_map_io(void)
{
clk_xusbxti.rate = 24000000;
s5p_init_io(NULL, 0, S5P_VA_CHIPID);
s3c24xx_init_clocks(24000000);
s3c24xx_init_uarts(smdk4x12_uartcfgs, ARRAY_SIZE(smdk4x12_uartcfgs));
exynos4_reserve_mem();
}
static void __init smdk4x12_smsc911x_init(void)
{
u32 cs1;
/* configure nCS1 width to 16 bits */
cs1 = __raw_readl(S5P_SROM_BW) &
~(S5P_SROM_BW__CS_MASK << S5P_SROM_BW__NCS1__SHIFT);
cs1 |= ((1 << S5P_SROM_BW__DATAWIDTH__SHIFT) |
(1 << S5P_SROM_BW__WAITENABLE__SHIFT) |
(1 << S5P_SROM_BW__BYTEENABLE__SHIFT)) <<
S5P_SROM_BW__NCS1__SHIFT;
__raw_writel(cs1, S5P_SROM_BW);
/* set timing for nCS1 suitable for ethernet chip */
__raw_writel((0x1 << S5P_SROM_BCX__PMC__SHIFT) |
(0x9 << S5P_SROM_BCX__TACP__SHIFT) |
(0xc << S5P_SROM_BCX__TCAH__SHIFT) |
(0x1 << S5P_SROM_BCX__TCOH__SHIFT) |
(0x6 << S5P_SROM_BCX__TACC__SHIFT) |
(0x1 << S5P_SROM_BCX__TCOS__SHIFT) |
(0x1 << S5P_SROM_BCX__TACS__SHIFT), S5P_SROM_BC1);
}
static void __init exynos_sysmmu_init(void)
{
ASSIGN_SYSMMU_POWERDOMAIN(fimc0, &exynos4_device_pd[PD_CAM].dev);
ASSIGN_SYSMMU_POWERDOMAIN(fimc1, &exynos4_device_pd[PD_CAM].dev);
ASSIGN_SYSMMU_POWERDOMAIN(fimc2, &exynos4_device_pd[PD_CAM].dev);
ASSIGN_SYSMMU_POWERDOMAIN(fimc3, &exynos4_device_pd[PD_CAM].dev);
ASSIGN_SYSMMU_POWERDOMAIN(jpeg, &exynos4_device_pd[PD_CAM].dev);
ASSIGN_SYSMMU_POWERDOMAIN(mfc_l, &exynos4_device_pd[PD_MFC].dev);
ASSIGN_SYSMMU_POWERDOMAIN(mfc_r, &exynos4_device_pd[PD_MFC].dev);
ASSIGN_SYSMMU_POWERDOMAIN(tv, &exynos4_device_pd[PD_TV].dev);
#ifdef CONFIG_VIDEO_FIMG2D
sysmmu_set_owner(&SYSMMU_PLATDEV(g2d_acp).dev, &s5p_device_fimg2d.dev);
#endif
#if defined(CONFIG_VIDEO_SAMSUNG_S5P_MFC) || defined(CONFIG_VIDEO_MFC5X)
sysmmu_set_owner(&SYSMMU_PLATDEV(mfc_l).dev, &s5p_device_mfc.dev);
sysmmu_set_owner(&SYSMMU_PLATDEV(mfc_r).dev, &s5p_device_mfc.dev);
#endif
#if defined(CONFIG_VIDEO_FIMC)
sysmmu_set_owner(&SYSMMU_PLATDEV(fimc0).dev, &s3c_device_fimc0.dev);
sysmmu_set_owner(&SYSMMU_PLATDEV(fimc1).dev, &s3c_device_fimc1.dev);
sysmmu_set_owner(&SYSMMU_PLATDEV(fimc2).dev, &s3c_device_fimc2.dev);
sysmmu_set_owner(&SYSMMU_PLATDEV(fimc3).dev, &s3c_device_fimc3.dev);
#elif defined(CONFIG_VIDEO_SAMSUNG_S5P_FIMC)
sysmmu_set_owner(&SYSMMU_PLATDEV(fimc0).dev, &s5p_device_fimc0.dev);
sysmmu_set_owner(&SYSMMU_PLATDEV(fimc1).dev, &s5p_device_fimc1.dev);
sysmmu_set_owner(&SYSMMU_PLATDEV(fimc2).dev, &s5p_device_fimc2.dev);
sysmmu_set_owner(&SYSMMU_PLATDEV(fimc3).dev, &s5p_device_fimc3.dev);
#endif
#ifdef CONFIG_VIDEO_EXYNOS_TV
sysmmu_set_owner(&SYSMMU_PLATDEV(tv).dev, &s5p_device_mixer.dev);
#endif
#ifdef CONFIG_VIDEO_TVOUT
sysmmu_set_owner(&SYSMMU_PLATDEV(tv).dev, &s5p_device_tvout.dev);
#endif
#ifdef CONFIG_VIDEO_JPEG_V2X
sysmmu_set_owner(&SYSMMU_PLATDEV(jpeg).dev, &s5p_device_jpeg.dev);
#endif
#ifdef CONFIG_VIDEO_EXYNOS_FIMC_IS
ASSIGN_SYSMMU_POWERDOMAIN(is_isp, &exynos4_device_pd[PD_ISP].dev);
ASSIGN_SYSMMU_POWERDOMAIN(is_drc, &exynos4_device_pd[PD_ISP].dev);
ASSIGN_SYSMMU_POWERDOMAIN(is_fd, &exynos4_device_pd[PD_ISP].dev);
ASSIGN_SYSMMU_POWERDOMAIN(is_cpu, &exynos4_device_pd[PD_ISP].dev);
sysmmu_set_owner(&SYSMMU_PLATDEV(is_isp).dev,
&exynos4_device_fimc_is.dev);
sysmmu_set_owner(&SYSMMU_PLATDEV(is_drc).dev,
&exynos4_device_fimc_is.dev);
sysmmu_set_owner(&SYSMMU_PLATDEV(is_fd).dev,
&exynos4_device_fimc_is.dev);
sysmmu_set_owner(&SYSMMU_PLATDEV(is_cpu).dev,
&exynos4_device_fimc_is.dev);
#endif
}
#ifdef CONFIG_FB_S5P_EXTDSP
struct platform_device s3c_device_extdsp = {
.name = "s3cfb_extdsp",
.id = 0,
};
static struct s3cfb_extdsp_lcd dummy_buffer = {
.width = 1280,
.height = 720,
.bpp = 16,
};
static struct s3c_platform_fb default_extdsp_data __initdata = {
.hw_ver = 0x70,
.nr_wins = 1,
.default_win = 0,
.swap = FB_SWAP_WORD | FB_SWAP_HWORD,
.lcd = &dummy_buffer
};
void __init s3cfb_extdsp_set_platdata(struct s3c_platform_fb *pd)
{
struct s3c_platform_fb *npd;
int i;
if (!pd)
pd = &default_extdsp_data;
npd = kmemdup(pd, sizeof(struct s3c_platform_fb), GFP_KERNEL);
if (!npd)
printk(KERN_ERR "%s: no memory for platform data\n", __func__);
else {
for (i = 0; i < npd->nr_wins; i++)
npd->nr_buffers[i] = 1;
s3c_device_extdsp.dev.platform_data = npd;
}
}
#endif
#define SMDK4412_REV_0_0_ADC_VALUE 0
#define SMDK4412_REV_0_1_ADC_VALUE 443
int samsung_board_rev;
static int get_samsung_board_rev(void)
{
int adc_val = 0;
struct clk *adc_clk;
struct resource *res;
void __iomem *adc_regs;
unsigned int con;
int ret;
if ((soc_is_exynos4412() && samsung_rev() < EXYNOS4412_REV_1_0) ||
(soc_is_exynos4212() && samsung_rev() < EXYNOS4212_REV_1_0))
return SAMSUNG_BOARD_REV_0_0;
adc_clk = clk_get(NULL, "adc");
if (unlikely(IS_ERR(adc_clk)))
return SAMSUNG_BOARD_REV_0_0;
clk_enable(adc_clk);
res = platform_get_resource(&s3c_device_adc, IORESOURCE_MEM, 0);
if (unlikely(!res))
goto err_clk;
adc_regs = ioremap(res->start, resource_size(res));
if (unlikely(!adc_regs))
goto err_clk;
writel(S5PV210_ADCCON_SELMUX(3), adc_regs + S5P_ADCMUX);
con = readl(adc_regs + S3C2410_ADCCON);
con &= ~S3C2410_ADCCON_MUXMASK;
con &= ~S3C2410_ADCCON_STDBM;
con &= ~S3C2410_ADCCON_STARTMASK;
con |= S3C2410_ADCCON_PRSCEN;
con |= S3C2410_ADCCON_ENABLE_START;
writel(con, adc_regs + S3C2410_ADCCON);
udelay (50);
adc_val = readl(adc_regs + S3C2410_ADCDAT0) & 0xFFF;
writel(0, adc_regs + S3C64XX_ADCCLRINT);
iounmap(adc_regs);
err_clk:
clk_disable(adc_clk);
clk_put(adc_clk);
ret = (adc_val < SMDK4412_REV_0_1_ADC_VALUE/2) ?
SAMSUNG_BOARD_REV_0_0 : SAMSUNG_BOARD_REV_0_1;
pr_info ("SMDK MAIN Board Rev 0.%d (ADC value:%d)\n", ret, adc_val);
return ret;
}
static void __init smdk4x12_machine_init(void)
{
#ifdef CONFIG_S3C64XX_DEV_SPI
struct clk *sclk = NULL;
struct clk *prnt = NULL;
struct device *spi0_dev = &exynos_device_spi0.dev;
#ifndef CONFIG_FB_S5P_LMS501KF03
struct device *spi1_dev = &exynos_device_spi1.dev;
#endif
struct device *spi2_dev = &exynos_device_spi2.dev;
#endif
samsung_board_rev = get_samsung_board_rev();
#if defined(CONFIG_EXYNOS_DEV_PD) && defined(CONFIG_PM_RUNTIME)
exynos_pd_disable(&exynos4_device_pd[PD_MFC].dev);
exynos_pd_disable(&exynos4_device_pd[PD_G3D].dev);
exynos_pd_disable(&exynos4_device_pd[PD_LCD0].dev);
exynos_pd_disable(&exynos4_device_pd[PD_CAM].dev);
exynos_pd_disable(&exynos4_device_pd[PD_TV].dev);
exynos_pd_disable(&exynos4_device_pd[PD_GPS].dev);
exynos_pd_disable(&exynos4_device_pd[PD_GPS_ALIVE].dev);
exynos_pd_disable(&exynos4_device_pd[PD_ISP].dev);
#elif defined(CONFIG_EXYNOS_DEV_PD)
/*
* These power domains should be always on
* without runtime pm support.
*/
exynos_pd_enable(&exynos4_device_pd[PD_MFC].dev);
exynos_pd_enable(&exynos4_device_pd[PD_G3D].dev);
exynos_pd_enable(&exynos4_device_pd[PD_LCD0].dev);
exynos_pd_enable(&exynos4_device_pd[PD_CAM].dev);
exynos_pd_enable(&exynos4_device_pd[PD_TV].dev);
exynos_pd_enable(&exynos4_device_pd[PD_GPS].dev);
exynos_pd_enable(&exynos4_device_pd[PD_GPS_ALIVE].dev);
exynos_pd_enable(&exynos4_device_pd[PD_ISP].dev);
#endif
s3c_i2c0_set_platdata(NULL);
i2c_register_board_info(0, i2c_devs0, ARRAY_SIZE(i2c_devs0));
s3c_i2c1_set_platdata(NULL);
i2c_register_board_info(1, i2c_devs1, ARRAY_SIZE(i2c_devs1));
s3c_i2c2_set_platdata(NULL);
i2c_register_board_info(2, i2c_devs2, ARRAY_SIZE(i2c_devs2));
s3c_i2c3_set_platdata(NULL);
i2c_register_board_info(3, i2c_devs3, ARRAY_SIZE(i2c_devs3));
s3c_i2c4_set_platdata(NULL);
s3c_i2c5_set_platdata(NULL);
s3c_i2c7_set_platdata(NULL);
i2c_devs7[0].irq = samsung_board_rev_is_0_0() ? IRQ_EINT(15) : IRQ_EINT(22);
i2c_register_board_info(7, i2c_devs7, ARRAY_SIZE(i2c_devs7));
#if defined(CONFIG_FB_S5P_MIPI_DSIM)
mipi_fb_init();
#endif
#ifdef CONFIG_FB_S3C
dev_set_name(&s5p_device_fimd0.dev, "s3cfb.0");
clk_add_alias("lcd", "exynos4-fb.0", "lcd", &s5p_device_fimd0.dev);
clk_add_alias("sclk_fimd", "exynos4-fb.0", "sclk_fimd", &s5p_device_fimd0.dev);
s5p_fb_setname(0, "exynos4-fb");
#if defined(CONFIG_LCD_AMS369FG06) || defined(CONFIG_LCD_LMS501KF03)
spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
#endif
s5p_fimd0_set_platdata(&smdk4x12_lcd0_pdata);
#ifdef CONFIG_FB_MIPI_DSIM
s5p_device_mipi_dsim.dev.parent = &exynos4_device_pd[PD_LCD0].dev;
#endif
#ifdef CONFIG_EXYNOS_DEV_PD
s5p_device_fimd0.dev.parent = &exynos4_device_pd[PD_LCD0].dev;
#endif
#endif
#ifdef CONFIG_FB_S5P
#ifdef CONFIG_FB_S5P_LMS501KF03
spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
s3cfb_set_platdata(&lms501kf03_data);
#else
s3cfb_set_platdata(NULL);
#endif
#ifdef CONFIG_FB_S5P_MIPI_DSIM
s5p_device_dsim.dev.parent = &exynos4_device_pd[PD_LCD0].dev;
#endif
#ifdef CONFIG_EXYNOS_DEV_PD
s3c_device_fb.dev.parent = &exynos4_device_pd[PD_LCD0].dev;
#endif
#endif
#ifdef CONFIG_USB_EHCI_S5P
smdk4x12_ehci_init();
#endif
#ifdef CONFIG_USB_OHCI_S5P
smdk4x12_ohci_init();
#endif
#ifdef CONFIG_USB_GADGET
smdk4x12_usbgadget_init();
#endif
#ifdef CONFIG_USB_EXYNOS_SWITCH
smdk4x12_usbswitch_init();
#endif
samsung_bl_set(&smdk4x12_bl_gpio_info, &smdk4x12_bl_data);
#ifdef CONFIG_EXYNOS4_DEV_DWMCI
exynos_dwmci_set_platdata(&exynos_dwmci_pdata, 0);
#endif
#ifdef CONFIG_VIDEO_EXYNOS_FIMC_IS
exynos4_fimc_is_set_platdata(NULL);
#ifdef CONFIG_EXYNOS_DEV_PD
exynos4_device_fimc_is.dev.parent = &exynos4_device_pd[PD_ISP].dev;
#endif
#endif
#ifdef CONFIG_S3C_DEV_HSMMC
s3c_sdhci0_set_platdata(&smdk4x12_hsmmc0_pdata);
#endif
#ifdef CONFIG_S3C_DEV_HSMMC1
s3c_sdhci1_set_platdata(&smdk4x12_hsmmc1_pdata);
#endif
#ifdef CONFIG_S3C_DEV_HSMMC2
s3c_sdhci2_set_platdata(&smdk4x12_hsmmc2_pdata);
#endif
#ifdef CONFIG_S3C_DEV_HSMMC3
s3c_sdhci3_set_platdata(&smdk4x12_hsmmc3_pdata);
#endif
#ifdef CONFIG_S5P_DEV_MSHC
s3c_mshci_set_platdata(&exynos4_mshc_pdata);
#endif
#if defined(CONFIG_VIDEO_EXYNOS_TV) && defined(CONFIG_VIDEO_EXYNOS_HDMI)
dev_set_name(&s5p_device_hdmi.dev, "exynos4-hdmi");
clk_add_alias("hdmi", "s5p-hdmi", "hdmi", &s5p_device_hdmi.dev);
clk_add_alias("hdmiphy", "s5p-hdmi", "hdmiphy", &s5p_device_hdmi.dev);
s5p_tv_setup();
/* setup dependencies between TV devices */
s5p_device_hdmi.dev.parent = &exynos4_device_pd[PD_TV].dev;
s5p_device_mixer.dev.parent = &exynos4_device_pd[PD_TV].dev;
s5p_i2c_hdmiphy_set_platdata(NULL);
#ifdef CONFIG_VIDEO_EXYNOS_HDMI_CEC
s5p_hdmi_cec_set_platdata(&hdmi_cec_data);
#endif
#endif
#ifdef CONFIG_VIDEO_EXYNOS_FIMC_LITE
smdk4x12_set_camera_flite_platdata();
s3c_set_platdata(&exynos_flite0_default_data,
sizeof(exynos_flite0_default_data), &exynos_device_flite0);
s3c_set_platdata(&exynos_flite1_default_data,
sizeof(exynos_flite1_default_data), &exynos_device_flite1);
#ifdef CONFIG_EXYNOS_DEV_PD
exynos_device_flite0.dev.parent = &exynos4_device_pd[PD_ISP].dev;
exynos_device_flite1.dev.parent = &exynos4_device_pd[PD_ISP].dev;
#endif
#endif
#ifdef CONFIG_EXYNOS_SETUP_THERMAL
s5p_tmu_set_platdata(&exynos_tmu_data);
#endif
#ifdef CONFIG_VIDEO_FIMC
s3c_fimc0_set_platdata(&fimc_plat);
s3c_fimc1_set_platdata(&fimc_plat);
s3c_fimc2_set_platdata(&fimc_plat);
s3c_fimc3_set_platdata(NULL);
#ifdef CONFIG_EXYNOS_DEV_PD
s3c_device_fimc0.dev.parent = &exynos4_device_pd[PD_CAM].dev;
s3c_device_fimc1.dev.parent = &exynos4_device_pd[PD_CAM].dev;
s3c_device_fimc2.dev.parent = &exynos4_device_pd[PD_CAM].dev;
s3c_device_fimc3.dev.parent = &exynos4_device_pd[PD_CAM].dev;
#ifdef CONFIG_EXYNOS_CONTENT_PATH_PROTECTION
secmem.parent = &exynos4_device_pd[PD_CAM].dev;
#endif
#endif
#ifdef CONFIG_VIDEO_FIMC_MIPI
s3c_csis0_set_platdata(NULL);
s3c_csis1_set_platdata(NULL);
#ifdef CONFIG_EXYNOS_DEV_PD
s3c_device_csis0.dev.parent = &exynos4_device_pd[PD_CAM].dev;
s3c_device_csis1.dev.parent = &exynos4_device_pd[PD_CAM].dev;
#endif
#endif
#if defined(CONFIG_ITU_A) || defined(CONFIG_CSI_C) \
|| defined(CONFIG_S5K3H1_CSI_C) || defined(CONFIG_S5K3H2_CSI_C) \
|| defined(CONFIG_S5K6A3_CSI_C)
smdk4x12_cam0_reset(1);
#endif
#if defined(CONFIG_ITU_B) || defined(CONFIG_CSI_D) \
|| defined(CONFIG_S5K3H1_CSI_D) || defined(CONFIG_S5K3H2_CSI_D) \
|| defined(CONFIG_S5K6A3_CSI_D)
smdk4x12_cam1_reset(1);
#endif
#endif /* CONFIG_VIDEO_FIMC */
#ifdef CONFIG_FB_S5P_EXTDSP
s3cfb_extdsp_set_platdata(&default_extdsp_data);
#endif
#ifdef CONFIG_VIDEO_SAMSUNG_S5P_FIMC
smdk4x12_camera_config();
smdk4x12_subdev_config();
dev_set_name(&s5p_device_fimc0.dev, "s3c-fimc.0");
dev_set_name(&s5p_device_fimc1.dev, "s3c-fimc.1");
dev_set_name(&s5p_device_fimc2.dev, "s3c-fimc.2");
dev_set_name(&s5p_device_fimc3.dev, "s3c-fimc.3");
clk_add_alias("fimc", "exynos4210-fimc.0", "fimc", &s5p_device_fimc0.dev);
clk_add_alias("sclk_fimc", "exynos4210-fimc.0", "sclk_fimc",
&s5p_device_fimc0.dev);
clk_add_alias("fimc", "exynos4210-fimc.1", "fimc", &s5p_device_fimc1.dev);
clk_add_alias("sclk_fimc", "exynos4210-fimc.1", "sclk_fimc",
&s5p_device_fimc1.dev);
clk_add_alias("fimc", "exynos4210-fimc.2", "fimc", &s5p_device_fimc2.dev);
clk_add_alias("sclk_fimc", "exynos4210-fimc.2", "sclk_fimc",
&s5p_device_fimc2.dev);
clk_add_alias("fimc", "exynos4210-fimc.3", "fimc", &s5p_device_fimc3.dev);
clk_add_alias("sclk_fimc", "exynos4210-fimc.3", "sclk_fimc",
&s5p_device_fimc3.dev);
s3c_fimc_setname(0, "exynos4210-fimc");
s3c_fimc_setname(1, "exynos4210-fimc");
s3c_fimc_setname(2, "exynos4210-fimc");
s3c_fimc_setname(3, "exynos4210-fimc");
/* FIMC */
s3c_set_platdata(&s3c_fimc0_default_data,
sizeof(s3c_fimc0_default_data), &s5p_device_fimc0);
s3c_set_platdata(&s3c_fimc1_default_data,
sizeof(s3c_fimc1_default_data), &s5p_device_fimc1);
s3c_set_platdata(&s3c_fimc2_default_data,
sizeof(s3c_fimc2_default_data), &s5p_device_fimc2);
s3c_set_platdata(&s3c_fimc3_default_data,
sizeof(s3c_fimc3_default_data), &s5p_device_fimc3);
#ifdef CONFIG_EXYNOS_DEV_PD
s5p_device_fimc0.dev.parent = &exynos4_device_pd[PD_CAM].dev;
s5p_device_fimc1.dev.parent = &exynos4_device_pd[PD_CAM].dev;
s5p_device_fimc2.dev.parent = &exynos4_device_pd[PD_CAM].dev;
s5p_device_fimc3.dev.parent = &exynos4_device_pd[PD_CAM].dev;
#endif
#ifdef CONFIG_VIDEO_S5P_MIPI_CSIS
dev_set_name(&s5p_device_mipi_csis0.dev, "s3c-csis.0");
dev_set_name(&s5p_device_mipi_csis1.dev, "s3c-csis.1");
clk_add_alias("csis", "s5p-mipi-csis.0", "csis",
&s5p_device_mipi_csis0.dev);
clk_add_alias("sclk_csis", "s5p-mipi-csis.0", "sclk_csis",
&s5p_device_mipi_csis0.dev);
clk_add_alias("csis", "s5p-mipi-csis.1", "csis",
&s5p_device_mipi_csis1.dev);
clk_add_alias("sclk_csis", "s5p-mipi-csis.1", "sclk_csis",
&s5p_device_mipi_csis1.dev);
dev_set_name(&s5p_device_mipi_csis0.dev, "s5p-mipi-csis.0");
dev_set_name(&s5p_device_mipi_csis1.dev, "s5p-mipi-csis.1");
s3c_set_platdata(&s5p_mipi_csis0_default_data,
sizeof(s5p_mipi_csis0_default_data), &s5p_device_mipi_csis0);
s3c_set_platdata(&s5p_mipi_csis1_default_data,
sizeof(s5p_mipi_csis1_default_data), &s5p_device_mipi_csis1);
#ifdef CONFIG_EXYNOS_DEV_PD
s5p_device_mipi_csis0.dev.parent = &exynos4_device_pd[PD_CAM].dev;
s5p_device_mipi_csis1.dev.parent = &exynos4_device_pd[PD_CAM].dev;
#endif
#endif
#if defined(CONFIG_ITU_A) || defined(CONFIG_CSI_C) \
|| defined(CONFIG_S5K3H1_CSI_C) || defined(CONFIG_S5K3H2_CSI_C) \
|| defined(CONFIG_S5K6A3_CSI_C)
smdk4x12_cam0_reset(1);
#endif
#if defined(CONFIG_ITU_B) || defined(CONFIG_CSI_D) \
|| defined(CONFIG_S5K3H1_CSI_D) || defined(CONFIG_S5K3H2_CSI_D) \
|| defined(CONFIG_S5K6A3_CSI_D)
smdk4x12_cam1_reset(1);
#endif
#endif
#if defined(CONFIG_VIDEO_TVOUT)
s5p_hdmi_hpd_set_platdata(&hdmi_hpd_data);
s5p_hdmi_cec_set_platdata(&hdmi_cec_data);
#ifdef CONFIG_EXYNOS_DEV_PD
s5p_device_tvout.dev.parent = &exynos4_device_pd[PD_TV].dev;
exynos4_device_pd[PD_TV].dev.parent = &exynos4_device_pd[PD_LCD0].dev;
#endif
#endif
#ifdef CONFIG_VIDEO_JPEG_V2X
#ifdef CONFIG_EXYNOS_DEV_PD
s5p_device_jpeg.dev.parent = &exynos4_device_pd[PD_CAM].dev;
exynos4_jpeg_setup_clock(&s5p_device_jpeg.dev, 160000000);
#endif
#endif
#ifdef CONFIG_ION_EXYNOS
exynos_ion_set_platdata();
#endif
#if defined(CONFIG_VIDEO_MFC5X) || defined(CONFIG_VIDEO_SAMSUNG_S5P_MFC)
#ifdef CONFIG_EXYNOS_DEV_PD
s5p_device_mfc.dev.parent = &exynos4_device_pd[PD_MFC].dev;
#endif
if (soc_is_exynos4412() && samsung_rev() >= EXYNOS4412_REV_1_0)
exynos4_mfc_setup_clock(&s5p_device_mfc.dev, 200 * MHZ);
else
exynos4_mfc_setup_clock(&s5p_device_mfc.dev, 267 * MHZ);
#endif
#if defined(CONFIG_VIDEO_SAMSUNG_S5P_MFC)
dev_set_name(&s5p_device_mfc.dev, "s3c-mfc");
clk_add_alias("mfc", "s5p-mfc", "mfc", &s5p_device_mfc.dev);
s5p_mfc_setname(&s5p_device_mfc, "s5p-mfc");
#endif
#ifdef CONFIG_VIDEO_FIMG2D
s5p_fimg2d_set_platdata(&fimg2d_data);
#endif
if (samsung_board_rev_is_0_0())
samsung_keypad_set_platdata(&smdk4x12_keypad_data0);
else
samsung_keypad_set_platdata(&smdk4x12_keypad_data1);
smdk4x12_smsc911x_init();
exynos_sysmmu_init();
smdk4x12_gpio_power_init();
platform_add_devices(smdk4x12_devices, ARRAY_SIZE(smdk4x12_devices));
if (soc_is_exynos4412())
platform_add_devices(smdk4412_devices, ARRAY_SIZE(smdk4412_devices));
#ifdef CONFIG_FB_S3C
exynos4_fimd0_setup_clock(&s5p_device_fimd0.dev, "mout_mpll_user",
800 * MHZ);
#endif
#ifdef CONFIG_S3C64XX_DEV_SPI
sclk = clk_get(spi0_dev, "dout_spi0");
if (IS_ERR(sclk))
dev_err(spi0_dev, "failed to get sclk for SPI-0\n");
prnt = clk_get(spi0_dev, "mout_mpll_user");
if (IS_ERR(prnt))
dev_err(spi0_dev, "failed to get prnt\n");
if (clk_set_parent(sclk, prnt))
printk(KERN_ERR "Unable to set parent %s of clock %s.\n",
prnt->name, sclk->name);
clk_set_rate(sclk, 800 * 1000 * 1000);
clk_put(sclk);
clk_put(prnt);
if (!gpio_request(EXYNOS4_GPB(1), "SPI_CS0")) {
gpio_direction_output(EXYNOS4_GPB(1), 1);
s3c_gpio_cfgpin(EXYNOS4_GPB(1), S3C_GPIO_SFN(1));
s3c_gpio_setpull(EXYNOS4_GPB(1), S3C_GPIO_PULL_UP);
exynos_spi_set_info(0, EXYNOS_SPI_SRCCLK_SCLK,
ARRAY_SIZE(spi0_csi));
}
spi_register_board_info(spi0_board_info, ARRAY_SIZE(spi0_board_info));
#ifndef CONFIG_FB_S5P_LMS501KF03
sclk = clk_get(spi1_dev, "dout_spi1");
if (IS_ERR(sclk))
dev_err(spi1_dev, "failed to get sclk for SPI-1\n");
prnt = clk_get(spi1_dev, "mout_mpll_user");
if (IS_ERR(prnt))
dev_err(spi1_dev, "failed to get prnt\n");
if (clk_set_parent(sclk, prnt))
printk(KERN_ERR "Unable to set parent %s of clock %s.\n",
prnt->name, sclk->name);
clk_set_rate(sclk, 800 * 1000 * 1000);
clk_put(sclk);
clk_put(prnt);
if (!gpio_request(EXYNOS4_GPB(5), "SPI_CS1")) {
gpio_direction_output(EXYNOS4_GPB(5), 1);
s3c_gpio_cfgpin(EXYNOS4_GPB(5), S3C_GPIO_SFN(1));
s3c_gpio_setpull(EXYNOS4_GPB(5), S3C_GPIO_PULL_UP);
exynos_spi_set_info(1, EXYNOS_SPI_SRCCLK_SCLK,
ARRAY_SIZE(spi1_csi));
}
spi_register_board_info(spi1_board_info, ARRAY_SIZE(spi1_board_info));
#endif
sclk = clk_get(spi2_dev, "dout_spi2");
if (IS_ERR(sclk))
dev_err(spi2_dev, "failed to get sclk for SPI-2\n");
prnt = clk_get(spi2_dev, "mout_mpll_user");
if (IS_ERR(prnt))
dev_err(spi2_dev, "failed to get prnt\n");
if (clk_set_parent(sclk, prnt))
printk(KERN_ERR "Unable to set parent %s of clock %s.\n",
prnt->name, sclk->name);
clk_set_rate(sclk, 800 * 1000 * 1000);
clk_put(sclk);
clk_put(prnt);
if (!gpio_request(EXYNOS4_GPC1(2), "SPI_CS2")) {
gpio_direction_output(EXYNOS4_GPC1(2), 1);
s3c_gpio_cfgpin(EXYNOS4_GPC1(2), S3C_GPIO_SFN(1));
s3c_gpio_setpull(EXYNOS4_GPC1(2), S3C_GPIO_PULL_UP);
exynos_spi_set_info(2, EXYNOS_SPI_SRCCLK_SCLK,
ARRAY_SIZE(spi2_csi));
}
spi_register_board_info(spi2_board_info, ARRAY_SIZE(spi2_board_info));
#endif
#ifdef CONFIG_BUSFREQ_OPP
dev_add(&busfreq, &exynos4_busfreq.dev);
ppmu_init(&exynos_ppmu[PPMU_DMC0], &exynos4_busfreq.dev);
ppmu_init(&exynos_ppmu[PPMU_DMC1], &exynos4_busfreq.dev);
ppmu_init(&exynos_ppmu[PPMU_CPU], &exynos4_busfreq.dev);
#endif
register_reboot_notifier(&exynos4_reboot_notifier);
}
MACHINE_START(SMDK4212, "SMDK4X12")
.boot_params = S5P_PA_SDRAM + 0x100,
.init_irq = exynos4_init_irq,
.map_io = smdk4x12_map_io,
.init_machine = smdk4x12_machine_init,
.timer = &exynos4_timer,
MACHINE_END
MACHINE_START(SMDK4412, "SMDK4X12")
.boot_params = S5P_PA_SDRAM + 0x100,
.init_irq = exynos4_init_irq,
.map_io = smdk4x12_map_io,
.init_machine = smdk4x12_machine_init,
.timer = &exynos4_timer,
MACHINE_END
|
class Riak < Formula
desc "Distributed database"
homepage "http://basho.com/riak/"
url "https://s3.amazonaws.com/downloads.basho.com/riak/2.1/2.1.3/osx/10.8/riak-2.1.3-OSX-x86_64.tar.gz"
version "2.1.3"
sha256 "a0408d83c89504ef987bd8b34e7b3bb14459c35359ebf1adfb2a1634306c2e80"
bottle :unneeded
depends_on :macos => :mountain_lion
depends_on :arch => :x86_64
def install
logdir = var + "log/riak"
datadir = var + "lib/riak"
libexec.install Dir["*"]
logdir.mkpath
datadir.mkpath
(datadir + "ring").mkpath
inreplace "#{libexec}/lib/env.sh" do |s|
s.change_make_var! "RUNNER_BASE_DIR", libexec
s.change_make_var! "RUNNER_LOG_DIR", logdir
end
inreplace "#{libexec}/etc/riak.conf" do |c|
c.gsub! /(platform_data_dir *=).*$/, "\\1 #{datadir}"
c.gsub! /(platform_log_dir *=).*$/, "\\1 #{logdir}"
end
bin.write_exec_script libexec/"bin/riak"
bin.write_exec_script libexec/"bin/riak-admin"
bin.write_exec_script libexec/"bin/riak-debug"
bin.write_exec_script libexec/"bin/search-cmd"
end
end
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<!--
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
* Copyright (C) 2003-2010 Frederico Caldeira Knabben
*
* == BEGIN LICENSE ==
*
* Licensed under the terms of any of the following licenses at your
* choice:
*
* - GNU General Public License Version 2 or later (the "GPL")
* http://www.gnu.org/licenses/gpl.html
*
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
* http://www.gnu.org/licenses/lgpl.html
*
* - Mozilla Public License Version 1.1 or later (the "MPL")
* http://www.mozilla.org/MPL/MPL-1.1.html
*
* == END LICENSE ==
*
* Anchor dialog window.
-->
<html>
<head>
<title>Anchor Properties</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta content="noindex, nofollow" name="robots">
<script src="common/fck_dialog_common.js" type="text/javascript"></script>
<script type="text/javascript">
var dialog = window.parent ;
var oEditor = dialog.InnerDialogLoaded() ;
var FCK = oEditor.FCK ;
var FCKBrowserInfo = oEditor.FCKBrowserInfo ;
var FCKTools = oEditor.FCKTools ;
var FCKRegexLib = oEditor.FCKRegexLib ;
var oDOM = FCK.EditorDocument ;
var oFakeImage = dialog.Selection.GetSelectedElement() ;
var oAnchor ;
if ( oFakeImage )
{
if ( oFakeImage.tagName == 'IMG' && oFakeImage.getAttribute('_fckanchor') )
oAnchor = FCK.GetRealElement( oFakeImage ) ;
else
oFakeImage = null ;
}
//Search for a real anchor
if ( !oFakeImage )
{
oAnchor = FCK.Selection.MoveToAncestorNode( 'A' ) ;
if ( oAnchor )
FCK.Selection.SelectNode( oAnchor ) ;
}
window.onload = function()
{
// First of all, translate the dialog box texts
oEditor.FCKLanguageManager.TranslatePage(document) ;
if ( oAnchor )
GetE('txtName').value = oAnchor.name ;
else
oAnchor = null ;
window.parent.SetOkButton( true ) ;
window.parent.SetAutoSize( true ) ;
SelectField( 'txtName' ) ;
}
function Ok()
{
var sNewName = GetE('txtName').value ;
// Remove any illegal character in a name attribute:
// A name should start with a letter, but the validator passes anyway.
sNewName = sNewName.replace( /[^\w-_\.:]/g, '_' ) ;
if ( sNewName.length == 0 )
{
// Remove the anchor if the user leaves the name blank
if ( oAnchor )
{
// Removes the current anchor from the document using the new command
FCK.Commands.GetCommand( 'AnchorDelete' ).Execute() ;
return true ;
}
alert( oEditor.FCKLang.DlgAnchorErrorName ) ;
return false ;
}
oEditor.FCKUndo.SaveUndoStep() ;
if ( oAnchor ) // Modifying an existent anchor.
{
ReadjustLinksToAnchor( oAnchor.name, sNewName );
// Buggy explorer, bad bad browser. http://alt-tag.com/blog/archives/2006/02/ie-dom-bugs/
// Instead of just replacing the .name for the existing anchor (in order to preserve the content), we must remove the .name
// and assign .name, although it won't appear until it's specially processed in fckxhtml.js
// We remove the previous name
oAnchor.removeAttribute( 'name' ) ;
// Now we set it, but later we must process it specially
oAnchor.name = sNewName ;
return true ;
}
// Create a new anchor preserving the current selection
var aNewAnchors = oEditor.FCK.CreateLink( '#' ) ;
if ( aNewAnchors.length == 0 )
aNewAnchors.push( oEditor.FCK.InsertElement( 'a' ) ) ;
else
{
// Remove the fake href
for ( var i = 0 ; i < aNewAnchors.length ; i++ )
aNewAnchors[i].removeAttribute( 'href' ) ;
}
// More than one anchors may have been created, so interact through all of them (see #220).
for ( var i = 0 ; i < aNewAnchors.length ; i++ )
{
oAnchor = aNewAnchors[i] ;
// Set the name
if ( FCKBrowserInfo.IsIE )
{
// Setting anchor names directly in IE will trash the HTML code stored
// in FCKTempBin after undos. See #2263.
var replaceAnchor = oEditor.FCK.EditorDocument.createElement( '<a name="' +
FCKTools.HTMLEncode( sNewName ).replace( '"', '"' ) + '">' ) ;
oEditor.FCKDomTools.MoveChildren( oAnchor, replaceAnchor ) ;
oAnchor.parentNode.replaceChild( replaceAnchor, oAnchor ) ;
oAnchor = replaceAnchor ;
}
else
oAnchor.name = sNewName ;
// IE does require special processing to show the Anchor's image
// Opera doesn't allow to select empty anchors
if ( FCKBrowserInfo.IsIE || FCKBrowserInfo.IsOpera )
{
if ( oAnchor.innerHTML != '' )
{
if ( FCKBrowserInfo.IsIE )
oAnchor.className += ' FCK__AnchorC' ;
}
else
{
// Create a fake image for both IE and Opera
var oImg = oEditor.FCKDocumentProcessor_CreateFakeImage( 'FCK__Anchor', oAnchor.cloneNode(true) ) ;
oImg.setAttribute( '_fckanchor', 'true', 0 ) ;
oAnchor.parentNode.insertBefore( oImg, oAnchor ) ;
oAnchor.parentNode.removeChild( oAnchor ) ;
}
}
}
return true ;
}
// Checks all the links in the current page pointing to the current name and changes them to the new name
function ReadjustLinksToAnchor( sCurrent, sNew )
{
var oDoc = FCK.EditorDocument ;
var aLinks = oDoc.getElementsByTagName( 'A' ) ;
var sReference = '#' + sCurrent ;
// The url of the document, so we check absolute and partial references.
var sFullReference = oDoc.location.href.replace( /(#.*$)/, '') ;
sFullReference += sReference ;
var oLink ;
var i = aLinks.length - 1 ;
while ( i >= 0 && ( oLink = aLinks[i--] ) )
{
var sHRef = oLink.getAttribute( '_fcksavedurl' ) ;
if ( sHRef == null )
sHRef = oLink.getAttribute( 'href' , 2 ) || '' ;
if ( sHRef == sReference || sHRef == sFullReference )
{
oLink.href = '#' + sNew ;
SetAttribute( oLink, '_fcksavedurl', '#' + sNew ) ;
}
}
}
</script>
</head>
<body style="overflow: hidden">
<table height="100%" width="100%">
<tr>
<td align="center">
<table border="0" cellpadding="0" cellspacing="0" width="80%">
<tr>
<td>
<span fckLang="DlgAnchorName">Anchor Name</span><BR>
<input id="txtName" style="WIDTH: 100%" type="text">
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
|
/**
* Provides live preview facilities for the event date format fields, akin
* to (and using the same ajax mechanism as) the date format preview in WP's
* general settings screen.
*/
jQuery( document ).ready( function( $ ) {
// Whenever the input field for a date format changes, update the matching
// live preview area
$( ".live-date-preview" ).siblings( "input" ).change( function() {
var $format_field = $( this );
var new_format = $format_field.val();
var $preview_field = $format_field.siblings( ".live-date-preview" );
/**
* Update the preview field when we get our response back from WP.
*/
var show_update = function( preview_text ) {
preview_text = $( "<div/>" ).html( preview_text ).text(); // Escaping!
$preview_field.html( preview_text );
}
// Before making the request, show the spinner (this should naturally be "wiped"
// when the response is rendered)
$preview_field.append( "<span class='spinner'></span>" );
$preview_field.find( ".spinner" ).css( "visibility", "visible" );
var request = {
action: "date_format",
date: new_format
}
$.post( ajaxurl, request, show_update, "text" );
} );
} ); |
/* Copyright 2016 The TensorFlow Authors. All Rights Reserved.
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.
==============================================================================*/
#ifndef THIRD_PARTY_TENSORFLOW_CORE_PLATFORM_FILE_STATISTICS_H_
#define THIRD_PARTY_TENSORFLOW_CORE_PLATFORM_FILE_STATISTICS_H_
#include "tensorflow/core/platform/types.h"
namespace tensorflow {
struct FileStatistics {
// The length of the file or -1 if finding file length is not supported.
int64 length = -1;
// The last modified time in nanoseconds.
int64 mtime_nsec = 0;
// True if the file is a directory, otherwise false.
bool is_directory = false;
FileStatistics() {}
FileStatistics(int64 length, int64 mtime_nsec, bool is_directory)
: length(length), mtime_nsec(mtime_nsec), is_directory(is_directory) {}
~FileStatistics() {}
};
} // namespace tensorflow
#endif // THIRD_PARTY_TENSORFLOW_CORE_PLATFORM_FILE_STATISTICS_H_
|
<?php
/**
* Validates a host according to the IPv4, IPv6 and DNS (future) specifications.
*/
class HTMLPurifier_AttrDef_URI_Host extends HTMLPurifier_AttrDef
{
/**
* IPv4 sub-validator.
* @type HTMLPurifier_AttrDef_URI_IPv4
*/
protected $ipv4;
/**
* IPv6 sub-validator.
* @type HTMLPurifier_AttrDef_URI_IPv6
*/
protected $ipv6;
public function __construct()
{
$this->ipv4 = new HTMLPurifier_AttrDef_URI_IPv4();
$this->ipv6 = new HTMLPurifier_AttrDef_URI_IPv6();
}
/**
* @param string $string
* @param HTMLPurifier_Config $config
* @param HTMLPurifier_Context $context
* @return bool|string
*/
public function validate($string, $config, $context)
{
$length = strlen($string);
// empty hostname is OK; it's usually semantically equivalent:
// the default host as defined by a URI scheme is used:
//
// If the URI scheme defines a default for host, then that
// default applies when the host subcomponent is undefined
// or when the registered name is empty (zero length).
if ($string === '') {
return '';
}
if ($length > 1 && $string[0] === '[' && $string[$length - 1] === ']') {
//IPv6
$ip = substr($string, 1, $length - 2);
$valid = $this->ipv6->validate($ip, $config, $context);
if ($valid === false) {
return false;
}
return '[' . $valid . ']';
}
// need to do checks on unusual encodings too
$ipv4 = $this->ipv4->validate($string, $config, $context);
if ($ipv4 !== false) {
return $ipv4;
}
// A regular domain name.
// This doesn't match I18N domain names, but we don't have proper IRI support,
// so force users to insert Punycode.
// There is not a good sense in which underscores should be
// allowed, since it's technically not! (And if you go as
// far to allow everything as specified by the DNS spec...
// well, that's literally everything, modulo some space limits
// for the components and the overall name (which, by the way,
// we are NOT checking!). So we (arbitrarily) decide this:
// let's allow underscores wherever we would have allowed
// hyphens, if they are enabled. This is a pretty good match
// for browser behavior, for example, a large number of browsers
// cannot handle foo_.example.com, but foo_bar.example.com is
// fairly well supported.
$underscore = $config->get('Core.AllowHostnameUnderscore') ? '_' : '';
// The productions describing this are:
$a = '[a-z]'; // alpha
$an = '[a-z0-9]'; // alphanum
$and = "[a-z0-9-$underscore]"; // alphanum | "-"
// domainlabel = alphanum | alphanum *( alphanum | "-" ) alphanum
$domainlabel = "$an($and*$an)?";
// toplabel = alpha | alpha *( alphanum | "-" ) alphanum
$toplabel = "$a($and*$an)?";
// hostname = *( domainlabel "." ) toplabel [ "." ]
if (preg_match("/^($domainlabel\.)*$toplabel\.?$/i", $string)) {
return $string;
}
// If we have Net_IDNA2 support, we can support IRIs by
// punycoding them. (This is the most portable thing to do,
// since otherwise we have to assume browsers support
if ($config->get('Core.EnableIDNA')) {
$idna = new Net_IDNA2(array('encoding' => 'utf8', 'overlong' => false, 'strict' => true));
// we need to encode each period separately
$parts = explode('.', $string);
try {
$new_parts = array();
foreach ($parts as $part) {
$encodable = false;
for ($i = 0, $c = strlen($part); $i < $c; $i++) {
if (ord($part[$i]) > 0x7a) {
$encodable = true;
break;
}
}
if (!$encodable) {
$new_parts[] = $part;
} else {
$new_parts[] = $idna->encode($part);
}
}
$string = implode('.', $new_parts);
if (preg_match("/^($domainlabel\.)*$toplabel\.?$/i", $string)) {
return $string;
}
} catch (Exception $e) {
// XXX error reporting
}
}
return false;
}
}
// vim: et sw=4 sts=4
|
/*
* Hauppauge HD PVR USB driver - video 4 linux 2 interface
*
* Copyright (C) 2008 Janne Grunau (j@jannau.net)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, version 2.
*
*/
#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/module.h>
#include <linux/usb.h>
#include <linux/mutex.h>
#include <linux/videodev2.h>
#include <media/v4l2-common.h>
#include "hdpvr.h"
int hdpvr_config_call(struct hdpvr_device *dev, uint value, u8 valbuf)
{
int ret;
char request_type = 0x38, snd_request = 0x01;
mutex_lock(&dev->usbc_mutex);
dev->usbc_buf[0] = valbuf;
ret = usb_control_msg(dev->udev,
usb_sndctrlpipe(dev->udev, 0),
snd_request, 0x00 | request_type,
value, CTRL_DEFAULT_INDEX,
dev->usbc_buf, 1, 10000);
mutex_unlock(&dev->usbc_mutex);
v4l2_dbg(MSG_INFO, hdpvr_debug, &dev->v4l2_dev,
"config call request for value 0x%x returned %d\n", value,
ret);
return ret < 0 ? ret : 0;
}
int get_video_info(struct hdpvr_device *dev, struct hdpvr_video_info *vidinf)
{
int ret;
vidinf->valid = false;
mutex_lock(&dev->usbc_mutex);
ret = usb_control_msg(dev->udev,
usb_rcvctrlpipe(dev->udev, 0),
0x81, 0x80 | 0x38,
0x1400, 0x0003,
dev->usbc_buf, 5,
1000);
#ifdef HDPVR_DEBUG
if (hdpvr_debug & MSG_INFO)
v4l2_dbg(MSG_INFO, hdpvr_debug, &dev->v4l2_dev,
"get video info returned: %d, %5ph\n", ret,
dev->usbc_buf);
#endif
mutex_unlock(&dev->usbc_mutex);
if (ret < 0)
return ret;
vidinf->width = dev->usbc_buf[1] << 8 | dev->usbc_buf[0];
vidinf->height = dev->usbc_buf[3] << 8 | dev->usbc_buf[2];
vidinf->fps = dev->usbc_buf[4];
vidinf->valid = vidinf->width && vidinf->height && vidinf->fps;
return 0;
}
int get_input_lines_info(struct hdpvr_device *dev)
{
int ret, lines;
mutex_lock(&dev->usbc_mutex);
ret = usb_control_msg(dev->udev,
usb_rcvctrlpipe(dev->udev, 0),
0x81, 0x80 | 0x38,
0x1800, 0x0003,
dev->usbc_buf, 3,
1000);
#ifdef HDPVR_DEBUG
if (hdpvr_debug & MSG_INFO)
v4l2_dbg(MSG_INFO, hdpvr_debug, &dev->v4l2_dev,
"get input lines info returned: %d, %3ph\n", ret,
dev->usbc_buf);
#else
(void)ret; /* suppress compiler warning */
#endif
lines = dev->usbc_buf[1] << 8 | dev->usbc_buf[0];
mutex_unlock(&dev->usbc_mutex);
return lines;
}
int hdpvr_set_bitrate(struct hdpvr_device *dev)
{
int ret;
mutex_lock(&dev->usbc_mutex);
memset(dev->usbc_buf, 0, 4);
dev->usbc_buf[0] = dev->options.bitrate;
dev->usbc_buf[2] = dev->options.peak_bitrate;
ret = usb_control_msg(dev->udev,
usb_sndctrlpipe(dev->udev, 0),
0x01, 0x38, CTRL_BITRATE_VALUE,
CTRL_DEFAULT_INDEX, dev->usbc_buf, 4, 1000);
mutex_unlock(&dev->usbc_mutex);
return ret;
}
int hdpvr_set_audio(struct hdpvr_device *dev, u8 input,
enum v4l2_mpeg_audio_encoding codec)
{
int ret = 0;
if (dev->flags & HDPVR_FLAG_AC3_CAP) {
mutex_lock(&dev->usbc_mutex);
memset(dev->usbc_buf, 0, 2);
dev->usbc_buf[0] = input;
if (codec == V4L2_MPEG_AUDIO_ENCODING_AAC)
dev->usbc_buf[1] = 0;
else if (codec == V4L2_MPEG_AUDIO_ENCODING_AC3)
dev->usbc_buf[1] = 1;
else {
mutex_unlock(&dev->usbc_mutex);
v4l2_err(&dev->v4l2_dev, "invalid audio codec %d\n",
codec);
ret = -EINVAL;
goto error;
}
ret = usb_control_msg(dev->udev,
usb_sndctrlpipe(dev->udev, 0),
0x01, 0x38, CTRL_AUDIO_INPUT_VALUE,
CTRL_DEFAULT_INDEX, dev->usbc_buf, 2,
1000);
mutex_unlock(&dev->usbc_mutex);
if (ret == 2)
ret = 0;
} else
ret = hdpvr_config_call(dev, CTRL_AUDIO_INPUT_VALUE, input);
error:
return ret;
}
int hdpvr_set_options(struct hdpvr_device *dev)
{
hdpvr_config_call(dev, CTRL_VIDEO_STD_TYPE, dev->options.video_std);
hdpvr_config_call(dev, CTRL_VIDEO_INPUT_VALUE,
dev->options.video_input+1);
hdpvr_set_audio(dev, dev->options.audio_input+1,
dev->options.audio_codec);
hdpvr_set_bitrate(dev);
hdpvr_config_call(dev, CTRL_BITRATE_MODE_VALUE,
dev->options.bitrate_mode);
hdpvr_config_call(dev, CTRL_GOP_MODE_VALUE, dev->options.gop_mode);
hdpvr_config_call(dev, CTRL_BRIGHTNESS, dev->options.brightness);
hdpvr_config_call(dev, CTRL_CONTRAST, dev->options.contrast);
hdpvr_config_call(dev, CTRL_HUE, dev->options.hue);
hdpvr_config_call(dev, CTRL_SATURATION, dev->options.saturation);
hdpvr_config_call(dev, CTRL_SHARPNESS, dev->options.sharpness);
return 0;
}
|
div.dt-button-info {
position: fixed;
top: 50%;
left: 50%;
width: 400px;
margin-top: -100px;
margin-left: -200px;
background-color: white;
border: 2px solid #111;
box-shadow: 3px 3px 8px rgba(0, 0, 0, 0.3);
border-radius: 3px;
text-align: center;
z-index: 21;
}
div.dt-button-info h2 {
padding: 0.5em;
margin: 0;
font-weight: normal;
border-bottom: 1px solid #ddd;
background-color: #f3f3f3;
}
div.dt-button-info > div {
padding: 1em;
}
ul.dt-button-collection.dropdown-menu {
display: block;
z-index: 2002;
-webkit-column-gap: 8px;
-moz-column-gap: 8px;
-ms-column-gap: 8px;
-o-column-gap: 8px;
column-gap: 8px;
}
ul.dt-button-collection.dropdown-menu.fixed {
position: fixed;
top: 50%;
left: 50%;
margin-left: -75px;
}
ul.dt-button-collection.dropdown-menu.fixed.two-column {
margin-left: -150px;
}
ul.dt-button-collection.dropdown-menu.fixed.three-column {
margin-left: -225px;
}
ul.dt-button-collection.dropdown-menu.fixed.four-column {
margin-left: -300px;
}
ul.dt-button-collection.dropdown-menu > * {
-webkit-column-break-inside: avoid;
break-inside: avoid;
}
ul.dt-button-collection.dropdown-menu.two-column {
width: 300px;
padding-bottom: 1px;
-webkit-column-count: 2;
-moz-column-count: 2;
-ms-column-count: 2;
-o-column-count: 2;
column-count: 2;
}
ul.dt-button-collection.dropdown-menu.three-column {
width: 450px;
padding-bottom: 1px;
-webkit-column-count: 3;
-moz-column-count: 3;
-ms-column-count: 3;
-o-column-count: 3;
column-count: 3;
}
ul.dt-button-collection.dropdown-menu.four-column {
width: 600px;
padding-bottom: 1px;
-webkit-column-count: 4;
-moz-column-count: 4;
-ms-column-count: 4;
-o-column-count: 4;
column-count: 4;
}
div.dt-button-background {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 2001;
}
|
// SPDX-License-Identifier: GPL-2.0-only
/*
* hid-sensor-custom.c
* Copyright (c) 2015, Intel Corporation.
*/
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/miscdevice.h>
#include <linux/kfifo.h>
#include <linux/sched.h>
#include <linux/wait.h>
#include <linux/poll.h>
#include <linux/bsearch.h>
#include <linux/platform_device.h>
#include <linux/hid-sensor-hub.h>
#define HID_CUSTOM_NAME_LENGTH 64
#define HID_CUSTOM_MAX_CORE_ATTRS 10
#define HID_CUSTOM_TOTAL_ATTRS (HID_CUSTOM_MAX_CORE_ATTRS + 1)
#define HID_CUSTOM_FIFO_SIZE 4096
#define HID_CUSTOM_MAX_FEATURE_BYTES 64
struct hid_sensor_custom_field {
int report_id;
char group_name[HID_CUSTOM_NAME_LENGTH];
struct hid_sensor_hub_attribute_info attribute;
struct device_attribute sd_attrs[HID_CUSTOM_MAX_CORE_ATTRS];
char attr_name[HID_CUSTOM_TOTAL_ATTRS][HID_CUSTOM_NAME_LENGTH];
struct attribute *attrs[HID_CUSTOM_TOTAL_ATTRS];
struct attribute_group hid_custom_attribute_group;
};
struct hid_sensor_custom {
struct mutex mutex;
struct platform_device *pdev;
struct hid_sensor_hub_device *hsdev;
struct hid_sensor_hub_callbacks callbacks;
int sensor_field_count;
struct hid_sensor_custom_field *fields;
int input_field_count;
int input_report_size;
int input_report_recd_size;
bool input_skip_sample;
bool enable;
struct hid_sensor_custom_field *power_state;
struct hid_sensor_custom_field *report_state;
struct miscdevice custom_dev;
struct kfifo data_fifo;
unsigned long misc_opened;
wait_queue_head_t wait;
};
/* Header for each sample to user space via dev interface */
struct hid_sensor_sample {
u32 usage_id;
u64 timestamp;
u32 raw_len;
} __packed;
static struct attribute hid_custom_attrs[] = {
{.name = "name", .mode = S_IRUGO},
{.name = "units", .mode = S_IRUGO},
{.name = "unit-expo", .mode = S_IRUGO},
{.name = "minimum", .mode = S_IRUGO},
{.name = "maximum", .mode = S_IRUGO},
{.name = "size", .mode = S_IRUGO},
{.name = "value", .mode = S_IWUSR | S_IRUGO},
{.name = NULL}
};
static const struct hid_custom_usage_desc {
int usage_id;
char *desc;
} hid_custom_usage_desc_table[] = {
{0x200201, "event-sensor-state"},
{0x200202, "event-sensor-event"},
{0x200301, "property-friendly-name"},
{0x200302, "property-persistent-unique-id"},
{0x200303, "property-sensor-status"},
{0x200304, "property-min-report-interval"},
{0x200305, "property-sensor-manufacturer"},
{0x200306, "property-sensor-model"},
{0x200307, "property-sensor-serial-number"},
{0x200308, "property-sensor-description"},
{0x200309, "property-sensor-connection-type"},
{0x20030A, "property-sensor-device-path"},
{0x20030B, "property-hardware-revision"},
{0x20030C, "property-firmware-version"},
{0x20030D, "property-release-date"},
{0x20030E, "property-report-interval"},
{0x20030F, "property-change-sensitivity-absolute"},
{0x200310, "property-change-sensitivity-percent-range"},
{0x200311, "property-change-sensitivity-percent-relative"},
{0x200312, "property-accuracy"},
{0x200313, "property-resolution"},
{0x200314, "property-maximum"},
{0x200315, "property-minimum"},
{0x200316, "property-reporting-state"},
{0x200317, "property-sampling-rate"},
{0x200318, "property-response-curve"},
{0x200319, "property-power-state"},
{0x200540, "data-field-custom"},
{0x200541, "data-field-custom-usage"},
{0x200542, "data-field-custom-boolean-array"},
{0x200543, "data-field-custom-value"},
{0x200544, "data-field-custom-value_1"},
{0x200545, "data-field-custom-value_2"},
{0x200546, "data-field-custom-value_3"},
{0x200547, "data-field-custom-value_4"},
{0x200548, "data-field-custom-value_5"},
{0x200549, "data-field-custom-value_6"},
{0x20054A, "data-field-custom-value_7"},
{0x20054B, "data-field-custom-value_8"},
{0x20054C, "data-field-custom-value_9"},
{0x20054D, "data-field-custom-value_10"},
{0x20054E, "data-field-custom-value_11"},
{0x20054F, "data-field-custom-value_12"},
{0x200550, "data-field-custom-value_13"},
{0x200551, "data-field-custom-value_14"},
{0x200552, "data-field-custom-value_15"},
{0x200553, "data-field-custom-value_16"},
{0x200554, "data-field-custom-value_17"},
{0x200555, "data-field-custom-value_18"},
{0x200556, "data-field-custom-value_19"},
{0x200557, "data-field-custom-value_20"},
{0x200558, "data-field-custom-value_21"},
{0x200559, "data-field-custom-value_22"},
{0x20055A, "data-field-custom-value_23"},
{0x20055B, "data-field-custom-value_24"},
{0x20055C, "data-field-custom-value_25"},
{0x20055D, "data-field-custom-value_26"},
{0x20055E, "data-field-custom-value_27"},
{0x20055F, "data-field-custom-value_28"},
};
static int usage_id_cmp(const void *p1, const void *p2)
{
if (*(int *)p1 < *(int *)p2)
return -1;
if (*(int *)p1 > *(int *)p2)
return 1;
return 0;
}
static ssize_t enable_sensor_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct hid_sensor_custom *sensor_inst = dev_get_drvdata(dev);
return sprintf(buf, "%d\n", sensor_inst->enable);
}
static int set_power_report_state(struct hid_sensor_custom *sensor_inst,
bool state)
{
int power_val = -1;
int report_val = -1;
u32 power_state_usage_id;
u32 report_state_usage_id;
int ret;
/*
* It is possible that the power/report state ids are not present.
* In this case this function will return success. But if the
* ids are present, then it will return error if set fails.
*/
if (state) {
power_state_usage_id =
HID_USAGE_SENSOR_PROP_POWER_STATE_D0_FULL_POWER_ENUM;
report_state_usage_id =
HID_USAGE_SENSOR_PROP_REPORTING_STATE_ALL_EVENTS_ENUM;
} else {
power_state_usage_id =
HID_USAGE_SENSOR_PROP_POWER_STATE_D4_POWER_OFF_ENUM;
report_state_usage_id =
HID_USAGE_SENSOR_PROP_REPORTING_STATE_NO_EVENTS_ENUM;
}
if (sensor_inst->power_state)
power_val = hid_sensor_get_usage_index(sensor_inst->hsdev,
sensor_inst->power_state->attribute.report_id,
sensor_inst->power_state->attribute.index,
power_state_usage_id);
if (sensor_inst->report_state)
report_val = hid_sensor_get_usage_index(sensor_inst->hsdev,
sensor_inst->report_state->attribute.report_id,
sensor_inst->report_state->attribute.index,
report_state_usage_id);
if (power_val >= 0) {
power_val +=
sensor_inst->power_state->attribute.logical_minimum;
ret = sensor_hub_set_feature(sensor_inst->hsdev,
sensor_inst->power_state->attribute.report_id,
sensor_inst->power_state->attribute.index,
sizeof(power_val),
&power_val);
if (ret) {
hid_err(sensor_inst->hsdev->hdev,
"Set power state failed\n");
return ret;
}
}
if (report_val >= 0) {
report_val +=
sensor_inst->report_state->attribute.logical_minimum;
ret = sensor_hub_set_feature(sensor_inst->hsdev,
sensor_inst->report_state->attribute.report_id,
sensor_inst->report_state->attribute.index,
sizeof(report_val),
&report_val);
if (ret) {
hid_err(sensor_inst->hsdev->hdev,
"Set report state failed\n");
return ret;
}
}
return 0;
}
static ssize_t enable_sensor_store(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{
struct hid_sensor_custom *sensor_inst = dev_get_drvdata(dev);
int value;
int ret = -EINVAL;
if (kstrtoint(buf, 0, &value) != 0)
return -EINVAL;
mutex_lock(&sensor_inst->mutex);
if (value && !sensor_inst->enable) {
ret = sensor_hub_device_open(sensor_inst->hsdev);
if (ret)
goto unlock_state;
ret = set_power_report_state(sensor_inst, true);
if (ret) {
sensor_hub_device_close(sensor_inst->hsdev);
goto unlock_state;
}
sensor_inst->enable = true;
} else if (!value && sensor_inst->enable) {
ret = set_power_report_state(sensor_inst, false);
sensor_hub_device_close(sensor_inst->hsdev);
sensor_inst->enable = false;
}
unlock_state:
mutex_unlock(&sensor_inst->mutex);
if (ret < 0)
return ret;
return count;
}
static DEVICE_ATTR_RW(enable_sensor);
static struct attribute *enable_sensor_attrs[] = {
&dev_attr_enable_sensor.attr,
NULL,
};
static const struct attribute_group enable_sensor_attr_group = {
.attrs = enable_sensor_attrs,
};
static ssize_t show_value(struct device *dev, struct device_attribute *attr,
char *buf)
{
struct hid_sensor_custom *sensor_inst = dev_get_drvdata(dev);
struct hid_sensor_hub_attribute_info *attribute;
int index, usage, field_index;
char name[HID_CUSTOM_NAME_LENGTH];
bool feature = false;
bool input = false;
int value = 0;
if (sscanf(attr->attr.name, "feature-%x-%x-%s", &index, &usage,
name) == 3) {
feature = true;
field_index = index + sensor_inst->input_field_count;
} else if (sscanf(attr->attr.name, "input-%x-%x-%s", &index, &usage,
name) == 3) {
input = true;
field_index = index;
} else
return -EINVAL;
if (!strncmp(name, "value", strlen("value"))) {
u32 report_id;
int ret;
attribute = &sensor_inst->fields[field_index].attribute;
report_id = attribute->report_id;
if (feature) {
u8 values[HID_CUSTOM_MAX_FEATURE_BYTES];
int len = 0;
u64 value = 0;
int i = 0;
ret = sensor_hub_get_feature(sensor_inst->hsdev,
report_id,
index,
sizeof(values), values);
if (ret < 0)
return ret;
while (i < ret) {
if (i + attribute->size > ret) {
len += scnprintf(&buf[len],
PAGE_SIZE - len,
"%d ", values[i]);
break;
}
switch (attribute->size) {
case 2:
value = (u64) *(u16 *)&values[i];
i += attribute->size;
break;
case 4:
value = (u64) *(u32 *)&values[i];
i += attribute->size;
break;
case 8:
value = *(u64 *)&values[i];
i += attribute->size;
break;
default:
value = (u64) values[i];
++i;
break;
}
len += scnprintf(&buf[len], PAGE_SIZE - len,
"%lld ", value);
}
len += scnprintf(&buf[len], PAGE_SIZE - len, "\n");
return len;
} else if (input)
value = sensor_hub_input_attr_get_raw_value(
sensor_inst->hsdev,
sensor_inst->hsdev->usage,
usage, report_id,
SENSOR_HUB_SYNC, false);
} else if (!strncmp(name, "units", strlen("units")))
value = sensor_inst->fields[field_index].attribute.units;
else if (!strncmp(name, "unit-expo", strlen("unit-expo")))
value = sensor_inst->fields[field_index].attribute.unit_expo;
else if (!strncmp(name, "size", strlen("size")))
value = sensor_inst->fields[field_index].attribute.size;
else if (!strncmp(name, "minimum", strlen("minimum")))
value = sensor_inst->fields[field_index].attribute.
logical_minimum;
else if (!strncmp(name, "maximum", strlen("maximum")))
value = sensor_inst->fields[field_index].attribute.
logical_maximum;
else if (!strncmp(name, "name", strlen("name"))) {
struct hid_custom_usage_desc *usage_desc;
usage_desc = bsearch(&usage, hid_custom_usage_desc_table,
ARRAY_SIZE(hid_custom_usage_desc_table),
sizeof(struct hid_custom_usage_desc),
usage_id_cmp);
if (usage_desc)
return snprintf(buf, PAGE_SIZE, "%s\n",
usage_desc->desc);
else
return sprintf(buf, "not-specified\n");
} else
return -EINVAL;
return sprintf(buf, "%d\n", value);
}
static ssize_t store_value(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
{
struct hid_sensor_custom *sensor_inst = dev_get_drvdata(dev);
int index, field_index, usage;
char name[HID_CUSTOM_NAME_LENGTH];
int value;
if (sscanf(attr->attr.name, "feature-%x-%x-%s", &index, &usage,
name) == 3) {
field_index = index + sensor_inst->input_field_count;
} else
return -EINVAL;
if (!strncmp(name, "value", strlen("value"))) {
u32 report_id;
int ret;
if (kstrtoint(buf, 0, &value) != 0)
return -EINVAL;
report_id = sensor_inst->fields[field_index].attribute.
report_id;
ret = sensor_hub_set_feature(sensor_inst->hsdev, report_id,
index, sizeof(value), &value);
} else
return -EINVAL;
return count;
}
static int hid_sensor_capture_sample(struct hid_sensor_hub_device *hsdev,
unsigned usage_id, size_t raw_len,
char *raw_data, void *priv)
{
struct hid_sensor_custom *sensor_inst = platform_get_drvdata(priv);
struct hid_sensor_sample header;
/* If any error occurs in a sample, rest of the fields are ignored */
if (sensor_inst->input_skip_sample) {
hid_err(sensor_inst->hsdev->hdev, "Skipped remaining data\n");
return 0;
}
hid_dbg(sensor_inst->hsdev->hdev, "%s received %d of %d\n", __func__,
(int) (sensor_inst->input_report_recd_size + raw_len),
sensor_inst->input_report_size);
if (!test_bit(0, &sensor_inst->misc_opened))
return 0;
if (!sensor_inst->input_report_recd_size) {
int required_size = sizeof(struct hid_sensor_sample) +
sensor_inst->input_report_size;
header.usage_id = hsdev->usage;
header.raw_len = sensor_inst->input_report_size;
header.timestamp = ktime_get_real_ns();
if (kfifo_avail(&sensor_inst->data_fifo) >= required_size) {
kfifo_in(&sensor_inst->data_fifo,
(unsigned char *)&header,
sizeof(header));
} else
sensor_inst->input_skip_sample = true;
}
if (kfifo_avail(&sensor_inst->data_fifo) >= raw_len)
kfifo_in(&sensor_inst->data_fifo, (unsigned char *)raw_data,
raw_len);
sensor_inst->input_report_recd_size += raw_len;
return 0;
}
static int hid_sensor_send_event(struct hid_sensor_hub_device *hsdev,
unsigned usage_id, void *priv)
{
struct hid_sensor_custom *sensor_inst = platform_get_drvdata(priv);
if (!test_bit(0, &sensor_inst->misc_opened))
return 0;
sensor_inst->input_report_recd_size = 0;
sensor_inst->input_skip_sample = false;
wake_up(&sensor_inst->wait);
return 0;
}
static int hid_sensor_custom_add_field(struct hid_sensor_custom *sensor_inst,
int index, int report_type,
struct hid_report *report,
struct hid_field *field)
{
struct hid_sensor_custom_field *sensor_field;
void *fields;
fields = krealloc(sensor_inst->fields,
(sensor_inst->sensor_field_count + 1) *
sizeof(struct hid_sensor_custom_field), GFP_KERNEL);
if (!fields) {
kfree(sensor_inst->fields);
return -ENOMEM;
}
sensor_inst->fields = fields;
sensor_field = &sensor_inst->fields[sensor_inst->sensor_field_count];
sensor_field->attribute.usage_id = sensor_inst->hsdev->usage;
if (field->logical)
sensor_field->attribute.attrib_id = field->logical;
else
sensor_field->attribute.attrib_id = field->usage[0].hid;
sensor_field->attribute.index = index;
sensor_field->attribute.report_id = report->id;
sensor_field->attribute.units = field->unit;
sensor_field->attribute.unit_expo = field->unit_exponent;
sensor_field->attribute.size = (field->report_size / 8);
sensor_field->attribute.logical_minimum = field->logical_minimum;
sensor_field->attribute.logical_maximum = field->logical_maximum;
if (report_type == HID_FEATURE_REPORT)
snprintf(sensor_field->group_name,
sizeof(sensor_field->group_name), "feature-%x-%x",
sensor_field->attribute.index,
sensor_field->attribute.attrib_id);
else if (report_type == HID_INPUT_REPORT) {
snprintf(sensor_field->group_name,
sizeof(sensor_field->group_name),
"input-%x-%x", sensor_field->attribute.index,
sensor_field->attribute.attrib_id);
sensor_inst->input_field_count++;
sensor_inst->input_report_size += (field->report_size *
field->report_count) / 8;
}
memset(&sensor_field->hid_custom_attribute_group, 0,
sizeof(struct attribute_group));
sensor_inst->sensor_field_count++;
return 0;
}
static int hid_sensor_custom_add_fields(struct hid_sensor_custom *sensor_inst,
struct hid_report_enum *report_enum,
int report_type)
{
int i;
int ret;
struct hid_report *report;
struct hid_field *field;
struct hid_sensor_hub_device *hsdev = sensor_inst->hsdev;
list_for_each_entry(report, &report_enum->report_list, list) {
for (i = 0; i < report->maxfield; ++i) {
field = report->field[i];
if (field->maxusage &&
((field->usage[0].collection_index >=
hsdev->start_collection_index) &&
(field->usage[0].collection_index <
hsdev->end_collection_index))) {
ret = hid_sensor_custom_add_field(sensor_inst,
i,
report_type,
report,
field);
if (ret)
return ret;
}
}
}
return 0;
}
static int hid_sensor_custom_add_attributes(struct hid_sensor_custom
*sensor_inst)
{
struct hid_sensor_hub_device *hsdev = sensor_inst->hsdev;
struct hid_device *hdev = hsdev->hdev;
int ret = -1;
int i, j;
for (j = 0; j < HID_REPORT_TYPES; ++j) {
if (j == HID_OUTPUT_REPORT)
continue;
ret = hid_sensor_custom_add_fields(sensor_inst,
&hdev->report_enum[j], j);
if (ret)
return ret;
}
/* Create sysfs attributes */
for (i = 0; i < sensor_inst->sensor_field_count; ++i) {
j = 0;
while (j < HID_CUSTOM_TOTAL_ATTRS &&
hid_custom_attrs[j].name) {
struct device_attribute *device_attr;
device_attr = &sensor_inst->fields[i].sd_attrs[j];
snprintf((char *)&sensor_inst->fields[i].attr_name[j],
HID_CUSTOM_NAME_LENGTH, "%s-%s",
sensor_inst->fields[i].group_name,
hid_custom_attrs[j].name);
sysfs_attr_init(&device_attr->attr);
device_attr->attr.name =
(char *)&sensor_inst->fields[i].attr_name[j];
device_attr->attr.mode = hid_custom_attrs[j].mode;
device_attr->show = show_value;
if (hid_custom_attrs[j].mode & S_IWUSR)
device_attr->store = store_value;
sensor_inst->fields[i].attrs[j] = &device_attr->attr;
++j;
}
sensor_inst->fields[i].attrs[j] = NULL;
sensor_inst->fields[i].hid_custom_attribute_group.attrs =
sensor_inst->fields[i].attrs;
sensor_inst->fields[i].hid_custom_attribute_group.name =
sensor_inst->fields[i].group_name;
ret = sysfs_create_group(&sensor_inst->pdev->dev.kobj,
&sensor_inst->fields[i].
hid_custom_attribute_group);
if (ret)
break;
/* For power or report field store indexes */
if (sensor_inst->fields[i].attribute.attrib_id ==
HID_USAGE_SENSOR_PROY_POWER_STATE)
sensor_inst->power_state = &sensor_inst->fields[i];
else if (sensor_inst->fields[i].attribute.attrib_id ==
HID_USAGE_SENSOR_PROP_REPORT_STATE)
sensor_inst->report_state = &sensor_inst->fields[i];
}
return ret;
}
static void hid_sensor_custom_remove_attributes(struct hid_sensor_custom *
sensor_inst)
{
int i;
for (i = 0; i < sensor_inst->sensor_field_count; ++i)
sysfs_remove_group(&sensor_inst->pdev->dev.kobj,
&sensor_inst->fields[i].
hid_custom_attribute_group);
kfree(sensor_inst->fields);
}
static ssize_t hid_sensor_custom_read(struct file *file, char __user *buf,
size_t count, loff_t *f_ps)
{
struct hid_sensor_custom *sensor_inst;
unsigned int copied;
int ret;
sensor_inst = container_of(file->private_data,
struct hid_sensor_custom, custom_dev);
if (count < sizeof(struct hid_sensor_sample))
return -EINVAL;
do {
if (kfifo_is_empty(&sensor_inst->data_fifo)) {
if (file->f_flags & O_NONBLOCK)
return -EAGAIN;
ret = wait_event_interruptible(sensor_inst->wait,
!kfifo_is_empty(&sensor_inst->data_fifo));
if (ret)
return ret;
}
ret = kfifo_to_user(&sensor_inst->data_fifo, buf, count,
&copied);
if (ret)
return ret;
} while (copied == 0);
return copied;
}
static int hid_sensor_custom_release(struct inode *inode, struct file *file)
{
struct hid_sensor_custom *sensor_inst;
sensor_inst = container_of(file->private_data,
struct hid_sensor_custom, custom_dev);
clear_bit(0, &sensor_inst->misc_opened);
return 0;
}
static int hid_sensor_custom_open(struct inode *inode, struct file *file)
{
struct hid_sensor_custom *sensor_inst;
sensor_inst = container_of(file->private_data,
struct hid_sensor_custom, custom_dev);
/* We essentially have single reader and writer */
if (test_and_set_bit(0, &sensor_inst->misc_opened))
return -EBUSY;
return stream_open(inode, file);
}
static __poll_t hid_sensor_custom_poll(struct file *file,
struct poll_table_struct *wait)
{
struct hid_sensor_custom *sensor_inst;
__poll_t mask = 0;
sensor_inst = container_of(file->private_data,
struct hid_sensor_custom, custom_dev);
poll_wait(file, &sensor_inst->wait, wait);
if (!kfifo_is_empty(&sensor_inst->data_fifo))
mask = EPOLLIN | EPOLLRDNORM;
return mask;
}
static const struct file_operations hid_sensor_custom_fops = {
.open = hid_sensor_custom_open,
.read = hid_sensor_custom_read,
.release = hid_sensor_custom_release,
.poll = hid_sensor_custom_poll,
.llseek = noop_llseek,
};
static int hid_sensor_custom_dev_if_add(struct hid_sensor_custom *sensor_inst)
{
int ret;
ret = kfifo_alloc(&sensor_inst->data_fifo, HID_CUSTOM_FIFO_SIZE,
GFP_KERNEL);
if (ret)
return ret;
init_waitqueue_head(&sensor_inst->wait);
sensor_inst->custom_dev.minor = MISC_DYNAMIC_MINOR;
sensor_inst->custom_dev.name = dev_name(&sensor_inst->pdev->dev);
sensor_inst->custom_dev.fops = &hid_sensor_custom_fops,
ret = misc_register(&sensor_inst->custom_dev);
if (ret) {
kfifo_free(&sensor_inst->data_fifo);
return ret;
}
return 0;
}
static void hid_sensor_custom_dev_if_remove(struct hid_sensor_custom
*sensor_inst)
{
wake_up(&sensor_inst->wait);
misc_deregister(&sensor_inst->custom_dev);
kfifo_free(&sensor_inst->data_fifo);
}
static int hid_sensor_custom_probe(struct platform_device *pdev)
{
struct hid_sensor_custom *sensor_inst;
struct hid_sensor_hub_device *hsdev = pdev->dev.platform_data;
int ret;
sensor_inst = devm_kzalloc(&pdev->dev, sizeof(*sensor_inst),
GFP_KERNEL);
if (!sensor_inst)
return -ENOMEM;
sensor_inst->callbacks.capture_sample = hid_sensor_capture_sample;
sensor_inst->callbacks.send_event = hid_sensor_send_event;
sensor_inst->callbacks.pdev = pdev;
sensor_inst->hsdev = hsdev;
sensor_inst->pdev = pdev;
mutex_init(&sensor_inst->mutex);
platform_set_drvdata(pdev, sensor_inst);
ret = sensor_hub_register_callback(hsdev, hsdev->usage,
&sensor_inst->callbacks);
if (ret < 0) {
dev_err(&pdev->dev, "callback reg failed\n");
return ret;
}
ret = sysfs_create_group(&sensor_inst->pdev->dev.kobj,
&enable_sensor_attr_group);
if (ret)
goto err_remove_callback;
ret = hid_sensor_custom_add_attributes(sensor_inst);
if (ret)
goto err_remove_group;
ret = hid_sensor_custom_dev_if_add(sensor_inst);
if (ret)
goto err_remove_attributes;
return 0;
err_remove_attributes:
hid_sensor_custom_remove_attributes(sensor_inst);
err_remove_group:
sysfs_remove_group(&sensor_inst->pdev->dev.kobj,
&enable_sensor_attr_group);
err_remove_callback:
sensor_hub_remove_callback(hsdev, hsdev->usage);
return ret;
}
static int hid_sensor_custom_remove(struct platform_device *pdev)
{
struct hid_sensor_custom *sensor_inst = platform_get_drvdata(pdev);
struct hid_sensor_hub_device *hsdev = pdev->dev.platform_data;
hid_sensor_custom_dev_if_remove(sensor_inst);
hid_sensor_custom_remove_attributes(sensor_inst);
sysfs_remove_group(&sensor_inst->pdev->dev.kobj,
&enable_sensor_attr_group);
sensor_hub_remove_callback(hsdev, hsdev->usage);
return 0;
}
static const struct platform_device_id hid_sensor_custom_ids[] = {
{
.name = "HID-SENSOR-2000e1",
},
{
.name = "HID-SENSOR-2000e2",
},
{ /* sentinel */ }
};
MODULE_DEVICE_TABLE(platform, hid_sensor_custom_ids);
static struct platform_driver hid_sensor_custom_platform_driver = {
.id_table = hid_sensor_custom_ids,
.driver = {
.name = KBUILD_MODNAME,
},
.probe = hid_sensor_custom_probe,
.remove = hid_sensor_custom_remove,
};
module_platform_driver(hid_sensor_custom_platform_driver);
MODULE_DESCRIPTION("HID Sensor Custom and Generic sensor Driver");
MODULE_AUTHOR("Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>");
MODULE_LICENSE("GPL");
|
/* { dg-do compile } */
/* { dg-options "-O1 -fdump-tree-optimized" } */
void link_error();
struct State {
int p0, p1, p2;
inline State(){p0=0;p1=0;p2=0;}
inline State(const State &s) {
p0 = s.p0;
p1 = s.p1;
p2 = s.p2;
}
inline void operator =(const State &s) {
p0 = s.p0;
p1 = s.p1;
p2 = s.p2;
}
inline void step(void) {
p0 = p1+p2;
p1 = p0*p1+p2;
p2 = p0-p2;
}
};
inline void iterate_ok(State &inS1, State &inS2, unsigned int n)
{
State s1 = inS1;
for (unsigned int i = 0; i < n; i++) {
s1.step();
}
inS1 = s1;
}
void temp()
{
State s1;
s1.p0 = 0;
s1.p1 = 0;
s1.p2 = 0;
State s2;
s2.p0 = 0;
s2.p1 = 0;
s2.p2 = 0;
iterate_ok (s1, s2, 1);
if (s1.p0)
link_error();
if (s1.p0)
link_error();
if (s1.p0)
link_error();
}
/* We should have removed the casts from pointers to references and caused SRA to happen. */
/* { dg-final { scan-tree-dump-times "link_error" 0 "optimized"} } */
/* { dg-final { cleanup-tree-dump "optimized" } } */
|
/*
* rx1950.c -- ALSA Soc Audio Layer
*
* Copyright (c) 2010 Vasily Khoruzhick <anarsoul@gmail.com>
*
* Based on smdk2440.c and magician.c
*
* Authors: Graeme Gregory graeme.gregory@wolfsonmicro.com
* Philipp Zabel <philipp.zabel@gmail.com>
* Denis Grigoriev <dgreenday@gmail.com>
* Vasily Khoruzhick <anarsoul@gmail.com>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
*/
#include <linux/types.h>
#include <linux/gpio.h>
#include <linux/module.h>
#include <sound/soc.h>
#include <sound/jack.h>
#include <mach/gpio-samsung.h>
#include "regs-iis.h"
#include <asm/mach-types.h>
#include "s3c24xx-i2s.h"
static int rx1950_uda1380_init(struct snd_soc_pcm_runtime *rtd);
static int rx1950_uda1380_card_remove(struct snd_soc_card *card);
static int rx1950_startup(struct snd_pcm_substream *substream);
static int rx1950_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params);
static int rx1950_spk_power(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event);
static unsigned int rates[] = {
16000,
44100,
48000,
};
static struct snd_pcm_hw_constraint_list hw_rates = {
.count = ARRAY_SIZE(rates),
.list = rates,
.mask = 0,
};
static struct snd_soc_jack hp_jack;
static struct snd_soc_jack_pin hp_jack_pins[] = {
{
.pin = "Headphone Jack",
.mask = SND_JACK_HEADPHONE,
},
{
.pin = "Speaker",
.mask = SND_JACK_HEADPHONE,
.invert = 1,
},
};
static struct snd_soc_jack_gpio hp_jack_gpios[] = {
[0] = {
.gpio = S3C2410_GPG(12),
.name = "hp-gpio",
.report = SND_JACK_HEADPHONE,
.invert = 1,
.debounce_time = 200,
},
};
static struct snd_soc_ops rx1950_ops = {
.startup = rx1950_startup,
.hw_params = rx1950_hw_params,
};
/* s3c24xx digital audio interface glue - connects codec <--> CPU */
static struct snd_soc_dai_link rx1950_uda1380_dai[] = {
{
.name = "uda1380",
.stream_name = "UDA1380 Duplex",
.cpu_dai_name = "s3c24xx-iis",
.codec_dai_name = "uda1380-hifi",
.init = rx1950_uda1380_init,
.platform_name = "s3c24xx-iis",
.codec_name = "uda1380-codec.0-001a",
.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
SND_SOC_DAIFMT_CBS_CFS,
.ops = &rx1950_ops,
},
};
/* rx1950 machine dapm widgets */
static const struct snd_soc_dapm_widget uda1380_dapm_widgets[] = {
SND_SOC_DAPM_HP("Headphone Jack", NULL),
SND_SOC_DAPM_MIC("Mic Jack", NULL),
SND_SOC_DAPM_SPK("Speaker", rx1950_spk_power),
};
/* rx1950 machine audio_map */
static const struct snd_soc_dapm_route audio_map[] = {
/* headphone connected to VOUTLHP, VOUTRHP */
{"Headphone Jack", NULL, "VOUTLHP"},
{"Headphone Jack", NULL, "VOUTRHP"},
/* ext speaker connected to VOUTL, VOUTR */
{"Speaker", NULL, "VOUTL"},
{"Speaker", NULL, "VOUTR"},
/* mic is connected to VINM */
{"VINM", NULL, "Mic Jack"},
};
static struct snd_soc_card rx1950_asoc = {
.name = "rx1950",
.owner = THIS_MODULE,
.remove = rx1950_uda1380_card_remove,
.dai_link = rx1950_uda1380_dai,
.num_links = ARRAY_SIZE(rx1950_uda1380_dai),
.dapm_widgets = uda1380_dapm_widgets,
.num_dapm_widgets = ARRAY_SIZE(uda1380_dapm_widgets),
.dapm_routes = audio_map,
.num_dapm_routes = ARRAY_SIZE(audio_map),
};
static struct platform_device *s3c24xx_snd_device;
static int rx1950_startup(struct snd_pcm_substream *substream)
{
struct snd_pcm_runtime *runtime = substream->runtime;
return snd_pcm_hw_constraint_list(runtime, 0,
SNDRV_PCM_HW_PARAM_RATE,
&hw_rates);
}
static int rx1950_spk_power(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{
if (SND_SOC_DAPM_EVENT_ON(event))
gpio_set_value(S3C2410_GPA(1), 1);
else
gpio_set_value(S3C2410_GPA(1), 0);
return 0;
}
static int rx1950_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params)
{
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
int div;
int ret;
unsigned int rate = params_rate(params);
int clk_source, fs_mode;
switch (rate) {
case 16000:
case 48000:
clk_source = S3C24XX_CLKSRC_PCLK;
fs_mode = S3C2410_IISMOD_256FS;
div = s3c24xx_i2s_get_clockrate() / (256 * rate);
if (s3c24xx_i2s_get_clockrate() % (256 * rate) > (128 * rate))
div++;
break;
case 44100:
case 88200:
clk_source = S3C24XX_CLKSRC_MPLL;
fs_mode = S3C2410_IISMOD_384FS;
div = 1;
break;
default:
printk(KERN_ERR "%s: rate %d is not supported\n",
__func__, rate);
return -EINVAL;
}
/* select clock source */
ret = snd_soc_dai_set_sysclk(cpu_dai, clk_source, rate,
SND_SOC_CLOCK_OUT);
if (ret < 0)
return ret;
/* set MCLK division for sample rate */
ret = snd_soc_dai_set_clkdiv(cpu_dai, S3C24XX_DIV_MCLK,
fs_mode);
if (ret < 0)
return ret;
/* set BCLK division for sample rate */
ret = snd_soc_dai_set_clkdiv(cpu_dai, S3C24XX_DIV_BCLK,
S3C2410_IISMOD_32FS);
if (ret < 0)
return ret;
/* set prescaler division for sample rate */
ret = snd_soc_dai_set_clkdiv(cpu_dai, S3C24XX_DIV_PRESCALER,
S3C24XX_PRESCALE(div, div));
if (ret < 0)
return ret;
return 0;
}
static int rx1950_uda1380_init(struct snd_soc_pcm_runtime *rtd)
{
struct snd_soc_codec *codec = rtd->codec;
snd_soc_jack_new(codec, "Headphone Jack", SND_JACK_HEADPHONE,
&hp_jack);
snd_soc_jack_add_pins(&hp_jack, ARRAY_SIZE(hp_jack_pins),
hp_jack_pins);
snd_soc_jack_add_gpios(&hp_jack, ARRAY_SIZE(hp_jack_gpios),
hp_jack_gpios);
return 0;
}
static int rx1950_uda1380_card_remove(struct snd_soc_card *card)
{
snd_soc_jack_free_gpios(&hp_jack, ARRAY_SIZE(hp_jack_gpios),
hp_jack_gpios);
return 0;
}
static int __init rx1950_init(void)
{
int ret;
if (!machine_is_rx1950())
return -ENODEV;
/* configure some gpios */
ret = gpio_request(S3C2410_GPA(1), "speaker-power");
if (ret)
goto err_gpio;
ret = gpio_direction_output(S3C2410_GPA(1), 0);
if (ret)
goto err_gpio_conf;
s3c24xx_snd_device = platform_device_alloc("soc-audio", -1);
if (!s3c24xx_snd_device) {
ret = -ENOMEM;
goto err_plat_alloc;
}
platform_set_drvdata(s3c24xx_snd_device, &rx1950_asoc);
ret = platform_device_add(s3c24xx_snd_device);
if (ret) {
platform_device_put(s3c24xx_snd_device);
goto err_plat_add;
}
return 0;
err_plat_add:
err_plat_alloc:
err_gpio_conf:
gpio_free(S3C2410_GPA(1));
err_gpio:
return ret;
}
static void __exit rx1950_exit(void)
{
platform_device_unregister(s3c24xx_snd_device);
gpio_free(S3C2410_GPA(1));
}
module_init(rx1950_init);
module_exit(rx1950_exit);
/* Module information */
MODULE_AUTHOR("Vasily Khoruzhick");
MODULE_DESCRIPTION("ALSA SoC RX1950");
MODULE_LICENSE("GPL");
|
/* tslint:disable:no-unused-variable */
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { By } from '@angular/platform-browser';
import { DebugElement } from '@angular/core';
import { LoginComponent } from './login.component';
describe('LoginComponent', () => {
let component: LoginComponent;
let fixture: ComponentFixture<LoginComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ LoginComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(LoginComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
|
/*
* Pinctrl Driver for ADI GPIO2 controller
*
* Copyright 2007-2013 Analog Devices Inc.
*
* Licensed under the GPLv2 or later
*/
#include <linux/bitops.h>
#include <linux/delay.h>
#include <linux/module.h>
#include <linux/err.h>
#include <linux/debugfs.h>
#include <linux/seq_file.h>
#include <linux/irq.h>
#include <linux/platform_data/pinctrl-adi2.h>
#include <linux/irqdomain.h>
#include <linux/irqchip/chained_irq.h>
#include <linux/pinctrl/pinctrl.h>
#include <linux/pinctrl/pinmux.h>
#include <linux/pinctrl/consumer.h>
#include <linux/pinctrl/machine.h>
#include <linux/syscore_ops.h>
#include <linux/gpio.h>
#include <asm/portmux.h>
#include "pinctrl-adi2.h"
#include "core.h"
/*
According to the BF54x HRM, pint means "pin interrupt".
http://www.analog.com/static/imported-files/processor_manuals/ADSP-BF54x_hwr_rev1.2.pdf
ADSP-BF54x processor Blackfin processors have four SIC interrupt chan-
nels dedicated to pin interrupt purposes. These channels are managed by
four hardware blocks, called PINT0, PINT1, PINT2, and PINT3. Every PINTx
block can sense to up to 32 pins. While PINT0 and PINT1 can sense the
pins of port A and port B, PINT2 and PINT3 manage all the pins from port
C to port J as shown in Figure 9-2.
n BF54x HRM:
The ten GPIO ports are subdivided into 8-bit half ports, resulting in lower and
upper half 8-bit units. The PINTx_ASSIGN registers control the 8-bit multi-
plexers shown in Figure 9-3. Lower half units of eight pins can be
forwarded to either byte 0 or byte 2 of either associated PINTx block.
Upper half units can be forwarded to either byte 1 or byte 3 of the pin
interrupt blocks, without further restrictions.
All MMR registers in the pin interrupt module are 32 bits wide. To simply the
mapping logic, this driver only maps a 16-bit gpio port to the upper or lower
16 bits of a PINTx block. You can find the Figure 9-3 on page 583.
Each IRQ domain is binding to a GPIO bank device. 2 GPIO bank devices can map
to one PINT device. Two in "struct gpio_pint" are used to ease the PINT
interrupt handler.
The GPIO bank mapping to the lower 16 bits of the PINT device set its IRQ
domain pointer in domain[0]. The IRQ domain pointer of the other bank is set
to domain[1]. PINT interrupt handler adi_gpio_handle_pint_irq() finds out
the current domain pointer according to whether the interrupt request mask
is in lower 16 bits (domain[0]) or upper 16bits (domain[1]).
A PINT device is not part of a GPIO port device in Blackfin. Multiple GPIO
port devices can be mapped to the same PINT device.
*/
static LIST_HEAD(adi_pint_list);
static LIST_HEAD(adi_gpio_port_list);
#define DRIVER_NAME "pinctrl-adi2"
#define PINT_HI_OFFSET 16
/**
* struct gpio_port_saved - GPIO port registers that should be saved between
* power suspend and resume operations.
*
* @fer: PORTx_FER register
* @data: PORTx_DATA register
* @dir: PORTx_DIR register
* @inen: PORTx_INEN register
* @mux: PORTx_MUX register
*/
struct gpio_port_saved {
u16 fer;
u16 data;
u16 dir;
u16 inen;
u32 mux;
};
/*
* struct gpio_pint_saved - PINT registers saved in PM operations
*
* @assign: ASSIGN register
* @edge_set: EDGE_SET register
* @invert_set: INVERT_SET register
*/
struct gpio_pint_saved {
u32 assign;
u32 edge_set;
u32 invert_set;
};
/**
* struct gpio_pint - Pin interrupt controller device. Multiple ADI GPIO
* banks can be mapped into one Pin interrupt controller.
*
* @node: All gpio_pint instances are added to a global list.
* @base: PINT device register base address
* @irq: IRQ of the PINT device, it is the parent IRQ of all
* GPIO IRQs mapping to this device.
* @domain: [0] irq domain of the gpio port, whose hardware interrupts are
* mapping to the low 16-bit of the pint registers.
* [1] irq domain of the gpio port, whose hardware interrupts are
* mapping to the high 16-bit of the pint registers.
* @regs: address pointer to the PINT device
* @map_count: No more than 2 GPIO banks can be mapped to this PINT device.
* @lock: This lock make sure the irq_chip operations to one PINT device
* for different GPIO interrrupts are atomic.
* @pint_map_port: Set up the mapping between one PINT device and
* multiple GPIO banks.
*/
struct gpio_pint {
struct list_head node;
void __iomem *base;
int irq;
struct irq_domain *domain[2];
struct gpio_pint_regs *regs;
struct gpio_pint_saved saved_data;
int map_count;
spinlock_t lock;
int (*pint_map_port)(struct gpio_pint *pint, bool assign,
u8 map, struct irq_domain *domain);
};
/**
* ADI pin controller
*
* @dev: a pointer back to containing device
* @pctl: the pinctrl device
* @soc: SoC data for this specific chip
*/
struct adi_pinctrl {
struct device *dev;
struct pinctrl_dev *pctl;
const struct adi_pinctrl_soc_data *soc;
};
/**
* struct gpio_port - GPIO bank device. Multiple ADI GPIO banks can be mapped
* into one pin interrupt controller.
*
* @node: All gpio_port instances are added to a list.
* @base: GPIO bank device register base address
* @irq_base: base IRQ of the GPIO bank device
* @width: PIN number of the GPIO bank device
* @regs: address pointer to the GPIO bank device
* @saved_data: registers that should be saved between PM operations.
* @dev: device structure of this GPIO bank
* @pint: GPIO PINT device that this GPIO bank mapped to
* @pint_map: GIOP bank mapping code in PINT device
* @pint_assign: The 32-bit PINT registers can be divided into 2 parts. A
* GPIO bank can be mapped into either low 16 bits[0] or high 16
* bits[1] of each PINT register.
* @lock: This lock make sure the irq_chip operations to one PINT device
* for different GPIO interrrupts are atomic.
* @chip: abstract a GPIO controller
* @domain: The irq domain owned by the GPIO port.
* @rsvmap: Reservation map array for each pin in the GPIO bank
*/
struct gpio_port {
struct list_head node;
void __iomem *base;
int irq_base;
unsigned int width;
struct gpio_port_t *regs;
struct gpio_port_saved saved_data;
struct device *dev;
struct gpio_pint *pint;
u8 pint_map;
bool pint_assign;
spinlock_t lock;
struct gpio_chip chip;
struct irq_domain *domain;
};
static inline u8 pin_to_offset(struct pinctrl_gpio_range *range, unsigned pin)
{
return pin - range->pin_base;
}
static inline u32 hwirq_to_pintbit(struct gpio_port *port, int hwirq)
{
return port->pint_assign ? BIT(hwirq) << PINT_HI_OFFSET : BIT(hwirq);
}
static struct gpio_pint *find_gpio_pint(unsigned id)
{
struct gpio_pint *pint;
int i = 0;
list_for_each_entry(pint, &adi_pint_list, node) {
if (id == i)
return pint;
i++;
}
return NULL;
}
static inline void port_setup(struct gpio_port *port, unsigned offset,
bool use_for_gpio)
{
struct gpio_port_t *regs = port->regs;
if (use_for_gpio)
writew(readw(®s->port_fer) & ~BIT(offset),
®s->port_fer);
else
writew(readw(®s->port_fer) | BIT(offset), ®s->port_fer);
}
static inline void portmux_setup(struct gpio_port *port, unsigned offset,
unsigned short function)
{
struct gpio_port_t *regs = port->regs;
u32 pmux;
pmux = readl(®s->port_mux);
/* The function field of each pin has 2 consecutive bits in
* the mux register.
*/
pmux &= ~(0x3 << (2 * offset));
pmux |= (function & 0x3) << (2 * offset);
writel(pmux, ®s->port_mux);
}
static inline u16 get_portmux(struct gpio_port *port, unsigned offset)
{
struct gpio_port_t *regs = port->regs;
u32 pmux = readl(®s->port_mux);
/* The function field of each pin has 2 consecutive bits in
* the mux register.
*/
return pmux >> (2 * offset) & 0x3;
}
static void adi_gpio_ack_irq(struct irq_data *d)
{
unsigned long flags;
struct gpio_port *port = irq_data_get_irq_chip_data(d);
struct gpio_pint_regs *regs = port->pint->regs;
unsigned pintbit = hwirq_to_pintbit(port, d->hwirq);
spin_lock_irqsave(&port->lock, flags);
spin_lock(&port->pint->lock);
if (irqd_get_trigger_type(d) == IRQ_TYPE_EDGE_BOTH) {
if (readl(®s->invert_set) & pintbit)
writel(pintbit, ®s->invert_clear);
else
writel(pintbit, ®s->invert_set);
}
writel(pintbit, ®s->request);
spin_unlock(&port->pint->lock);
spin_unlock_irqrestore(&port->lock, flags);
}
static void adi_gpio_mask_ack_irq(struct irq_data *d)
{
unsigned long flags;
struct gpio_port *port = irq_data_get_irq_chip_data(d);
struct gpio_pint_regs *regs = port->pint->regs;
unsigned pintbit = hwirq_to_pintbit(port, d->hwirq);
spin_lock_irqsave(&port->lock, flags);
spin_lock(&port->pint->lock);
if (irqd_get_trigger_type(d) == IRQ_TYPE_EDGE_BOTH) {
if (readl(®s->invert_set) & pintbit)
writel(pintbit, ®s->invert_clear);
else
writel(pintbit, ®s->invert_set);
}
writel(pintbit, ®s->request);
writel(pintbit, ®s->mask_clear);
spin_unlock(&port->pint->lock);
spin_unlock_irqrestore(&port->lock, flags);
}
static void adi_gpio_mask_irq(struct irq_data *d)
{
unsigned long flags;
struct gpio_port *port = irq_data_get_irq_chip_data(d);
struct gpio_pint_regs *regs = port->pint->regs;
spin_lock_irqsave(&port->lock, flags);
spin_lock(&port->pint->lock);
writel(hwirq_to_pintbit(port, d->hwirq), ®s->mask_clear);
spin_unlock(&port->pint->lock);
spin_unlock_irqrestore(&port->lock, flags);
}
static void adi_gpio_unmask_irq(struct irq_data *d)
{
unsigned long flags;
struct gpio_port *port = irq_data_get_irq_chip_data(d);
struct gpio_pint_regs *regs = port->pint->regs;
spin_lock_irqsave(&port->lock, flags);
spin_lock(&port->pint->lock);
writel(hwirq_to_pintbit(port, d->hwirq), ®s->mask_set);
spin_unlock(&port->pint->lock);
spin_unlock_irqrestore(&port->lock, flags);
}
static unsigned int adi_gpio_irq_startup(struct irq_data *d)
{
unsigned long flags;
struct gpio_port *port = irq_data_get_irq_chip_data(d);
struct gpio_pint_regs *regs;
if (!port) {
pr_err("GPIO IRQ %d :Not exist\n", d->irq);
/* FIXME: negative return code will be ignored */
return -ENODEV;
}
regs = port->pint->regs;
spin_lock_irqsave(&port->lock, flags);
spin_lock(&port->pint->lock);
port_setup(port, d->hwirq, true);
writew(BIT(d->hwirq), &port->regs->dir_clear);
writew(readw(&port->regs->inen) | BIT(d->hwirq), &port->regs->inen);
writel(hwirq_to_pintbit(port, d->hwirq), ®s->mask_set);
spin_unlock(&port->pint->lock);
spin_unlock_irqrestore(&port->lock, flags);
return 0;
}
static void adi_gpio_irq_shutdown(struct irq_data *d)
{
unsigned long flags;
struct gpio_port *port = irq_data_get_irq_chip_data(d);
struct gpio_pint_regs *regs = port->pint->regs;
spin_lock_irqsave(&port->lock, flags);
spin_lock(&port->pint->lock);
writel(hwirq_to_pintbit(port, d->hwirq), ®s->mask_clear);
spin_unlock(&port->pint->lock);
spin_unlock_irqrestore(&port->lock, flags);
}
static int adi_gpio_irq_type(struct irq_data *d, unsigned int type)
{
unsigned long flags;
struct gpio_port *port = irq_data_get_irq_chip_data(d);
struct gpio_pint_regs *pint_regs;
unsigned pintmask;
unsigned int irq = d->irq;
int ret = 0;
char buf[16];
if (!port) {
pr_err("GPIO IRQ %d :Not exist\n", d->irq);
return -ENODEV;
}
pint_regs = port->pint->regs;
pintmask = hwirq_to_pintbit(port, d->hwirq);
spin_lock_irqsave(&port->lock, flags);
spin_lock(&port->pint->lock);
/* In case of interrupt autodetect, set irq type to edge sensitive. */
if (type == IRQ_TYPE_PROBE)
type = IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING;
if (type & (IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING |
IRQ_TYPE_LEVEL_HIGH | IRQ_TYPE_LEVEL_LOW)) {
snprintf(buf, 16, "gpio-irq%u", irq);
port_setup(port, d->hwirq, true);
} else
goto out;
/* The GPIO interrupt is triggered only when its input value
* transfer from 0 to 1. So, invert the input value if the
* irq type is low or falling
*/
if ((type & (IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_LEVEL_LOW)))
writel(pintmask, &pint_regs->invert_set);
else
writel(pintmask, &pint_regs->invert_clear);
/* In edge sensitive case, if the input value of the requested irq
* is already 1, invert it.
*/
if ((type & IRQ_TYPE_EDGE_BOTH) == IRQ_TYPE_EDGE_BOTH) {
if (gpio_get_value(port->chip.base + d->hwirq))
writel(pintmask, &pint_regs->invert_set);
else
writel(pintmask, &pint_regs->invert_clear);
}
if (type & (IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING)) {
writel(pintmask, &pint_regs->edge_set);
irq_set_handler_locked(d, handle_edge_irq);
} else {
writel(pintmask, &pint_regs->edge_clear);
irq_set_handler_locked(d, handle_level_irq);
}
out:
spin_unlock(&port->pint->lock);
spin_unlock_irqrestore(&port->lock, flags);
return ret;
}
#ifdef CONFIG_PM
static int adi_gpio_set_wake(struct irq_data *d, unsigned int state)
{
struct gpio_port *port = irq_data_get_irq_chip_data(d);
if (!port || !port->pint || port->pint->irq != d->irq)
return -EINVAL;
#ifndef SEC_GCTL
adi_internal_set_wake(port->pint->irq, state);
#endif
return 0;
}
static int adi_pint_suspend(void)
{
struct gpio_pint *pint;
list_for_each_entry(pint, &adi_pint_list, node) {
writel(0xffffffff, &pint->regs->mask_clear);
pint->saved_data.assign = readl(&pint->regs->assign);
pint->saved_data.edge_set = readl(&pint->regs->edge_set);
pint->saved_data.invert_set = readl(&pint->regs->invert_set);
}
return 0;
}
static void adi_pint_resume(void)
{
struct gpio_pint *pint;
list_for_each_entry(pint, &adi_pint_list, node) {
writel(pint->saved_data.assign, &pint->regs->assign);
writel(pint->saved_data.edge_set, &pint->regs->edge_set);
writel(pint->saved_data.invert_set, &pint->regs->invert_set);
}
}
static int adi_gpio_suspend(void)
{
struct gpio_port *port;
list_for_each_entry(port, &adi_gpio_port_list, node) {
port->saved_data.fer = readw(&port->regs->port_fer);
port->saved_data.mux = readl(&port->regs->port_mux);
port->saved_data.data = readw(&port->regs->data);
port->saved_data.inen = readw(&port->regs->inen);
port->saved_data.dir = readw(&port->regs->dir_set);
}
return adi_pint_suspend();
}
static void adi_gpio_resume(void)
{
struct gpio_port *port;
adi_pint_resume();
list_for_each_entry(port, &adi_gpio_port_list, node) {
writel(port->saved_data.mux, &port->regs->port_mux);
writew(port->saved_data.fer, &port->regs->port_fer);
writew(port->saved_data.inen, &port->regs->inen);
writew(port->saved_data.data & port->saved_data.dir,
&port->regs->data_set);
writew(port->saved_data.dir, &port->regs->dir_set);
}
}
static struct syscore_ops gpio_pm_syscore_ops = {
.suspend = adi_gpio_suspend,
.resume = adi_gpio_resume,
};
#else /* CONFIG_PM */
#define adi_gpio_set_wake NULL
#endif /* CONFIG_PM */
#ifdef CONFIG_IRQ_PREFLOW_FASTEOI
static inline void preflow_handler(struct irq_desc *desc)
{
if (desc->preflow_handler)
desc->preflow_handler(&desc->irq_data);
}
#else
static inline void preflow_handler(struct irq_desc *desc) { }
#endif
static void adi_gpio_handle_pint_irq(struct irq_desc *desc)
{
u32 request;
u32 level_mask, hwirq;
bool umask = false;
struct gpio_pint *pint = irq_desc_get_handler_data(desc);
struct irq_chip *chip = irq_desc_get_chip(desc);
struct gpio_pint_regs *regs = pint->regs;
struct irq_domain *domain;
preflow_handler(desc);
chained_irq_enter(chip, desc);
request = readl(®s->request);
level_mask = readl(®s->edge_set) & request;
hwirq = 0;
domain = pint->domain[0];
while (request) {
/* domain pointer need to be changed only once at IRQ 16 when
* we go through IRQ requests from bit 0 to bit 31.
*/
if (hwirq == PINT_HI_OFFSET)
domain = pint->domain[1];
if (request & 1) {
if (level_mask & BIT(hwirq)) {
umask = true;
chained_irq_exit(chip, desc);
}
generic_handle_irq(irq_find_mapping(domain,
hwirq % PINT_HI_OFFSET));
}
hwirq++;
request >>= 1;
}
if (!umask)
chained_irq_exit(chip, desc);
}
static struct irq_chip adi_gpio_irqchip = {
.name = "GPIO",
.irq_ack = adi_gpio_ack_irq,
.irq_mask = adi_gpio_mask_irq,
.irq_mask_ack = adi_gpio_mask_ack_irq,
.irq_unmask = adi_gpio_unmask_irq,
.irq_disable = adi_gpio_mask_irq,
.irq_enable = adi_gpio_unmask_irq,
.irq_set_type = adi_gpio_irq_type,
.irq_startup = adi_gpio_irq_startup,
.irq_shutdown = adi_gpio_irq_shutdown,
.irq_set_wake = adi_gpio_set_wake,
};
static int adi_get_groups_count(struct pinctrl_dev *pctldev)
{
struct adi_pinctrl *pinctrl = pinctrl_dev_get_drvdata(pctldev);
return pinctrl->soc->ngroups;
}
static const char *adi_get_group_name(struct pinctrl_dev *pctldev,
unsigned selector)
{
struct adi_pinctrl *pinctrl = pinctrl_dev_get_drvdata(pctldev);
return pinctrl->soc->groups[selector].name;
}
static int adi_get_group_pins(struct pinctrl_dev *pctldev, unsigned selector,
const unsigned **pins,
unsigned *num_pins)
{
struct adi_pinctrl *pinctrl = pinctrl_dev_get_drvdata(pctldev);
*pins = pinctrl->soc->groups[selector].pins;
*num_pins = pinctrl->soc->groups[selector].num;
return 0;
}
static struct pinctrl_ops adi_pctrl_ops = {
.get_groups_count = adi_get_groups_count,
.get_group_name = adi_get_group_name,
.get_group_pins = adi_get_group_pins,
};
static int adi_pinmux_set(struct pinctrl_dev *pctldev, unsigned func_id,
unsigned group_id)
{
struct adi_pinctrl *pinctrl = pinctrl_dev_get_drvdata(pctldev);
struct gpio_port *port;
struct pinctrl_gpio_range *range;
unsigned long flags;
unsigned short *mux, pin;
mux = (unsigned short *)pinctrl->soc->groups[group_id].mux;
while (*mux) {
pin = P_IDENT(*mux);
range = pinctrl_find_gpio_range_from_pin(pctldev, pin);
if (range == NULL) /* should not happen */
return -ENODEV;
port = container_of(range->gc, struct gpio_port, chip);
spin_lock_irqsave(&port->lock, flags);
portmux_setup(port, pin_to_offset(range, pin),
P_FUNCT2MUX(*mux));
port_setup(port, pin_to_offset(range, pin), false);
mux++;
spin_unlock_irqrestore(&port->lock, flags);
}
return 0;
}
static int adi_pinmux_get_funcs_count(struct pinctrl_dev *pctldev)
{
struct adi_pinctrl *pinctrl = pinctrl_dev_get_drvdata(pctldev);
return pinctrl->soc->nfunctions;
}
static const char *adi_pinmux_get_func_name(struct pinctrl_dev *pctldev,
unsigned selector)
{
struct adi_pinctrl *pinctrl = pinctrl_dev_get_drvdata(pctldev);
return pinctrl->soc->functions[selector].name;
}
static int adi_pinmux_get_groups(struct pinctrl_dev *pctldev, unsigned selector,
const char * const **groups,
unsigned * const num_groups)
{
struct adi_pinctrl *pinctrl = pinctrl_dev_get_drvdata(pctldev);
*groups = pinctrl->soc->functions[selector].groups;
*num_groups = pinctrl->soc->functions[selector].num_groups;
return 0;
}
static int adi_pinmux_request_gpio(struct pinctrl_dev *pctldev,
struct pinctrl_gpio_range *range, unsigned pin)
{
struct gpio_port *port;
unsigned long flags;
u8 offset;
port = container_of(range->gc, struct gpio_port, chip);
offset = pin_to_offset(range, pin);
spin_lock_irqsave(&port->lock, flags);
port_setup(port, offset, true);
spin_unlock_irqrestore(&port->lock, flags);
return 0;
}
static struct pinmux_ops adi_pinmux_ops = {
.set_mux = adi_pinmux_set,
.get_functions_count = adi_pinmux_get_funcs_count,
.get_function_name = adi_pinmux_get_func_name,
.get_function_groups = adi_pinmux_get_groups,
.gpio_request_enable = adi_pinmux_request_gpio,
.strict = true,
};
static struct pinctrl_desc adi_pinmux_desc = {
.name = DRIVER_NAME,
.pctlops = &adi_pctrl_ops,
.pmxops = &adi_pinmux_ops,
.owner = THIS_MODULE,
};
static int adi_gpio_request(struct gpio_chip *chip, unsigned offset)
{
return pinctrl_request_gpio(chip->base + offset);
}
static void adi_gpio_free(struct gpio_chip *chip, unsigned offset)
{
pinctrl_free_gpio(chip->base + offset);
}
static int adi_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
{
struct gpio_port *port;
unsigned long flags;
port = container_of(chip, struct gpio_port, chip);
spin_lock_irqsave(&port->lock, flags);
writew(BIT(offset), &port->regs->dir_clear);
writew(readw(&port->regs->inen) | BIT(offset), &port->regs->inen);
spin_unlock_irqrestore(&port->lock, flags);
return 0;
}
static void adi_gpio_set_value(struct gpio_chip *chip, unsigned offset,
int value)
{
struct gpio_port *port = container_of(chip, struct gpio_port, chip);
struct gpio_port_t *regs = port->regs;
unsigned long flags;
spin_lock_irqsave(&port->lock, flags);
if (value)
writew(BIT(offset), ®s->data_set);
else
writew(BIT(offset), ®s->data_clear);
spin_unlock_irqrestore(&port->lock, flags);
}
static int adi_gpio_direction_output(struct gpio_chip *chip, unsigned offset,
int value)
{
struct gpio_port *port = container_of(chip, struct gpio_port, chip);
struct gpio_port_t *regs = port->regs;
unsigned long flags;
spin_lock_irqsave(&port->lock, flags);
writew(readw(®s->inen) & ~BIT(offset), ®s->inen);
if (value)
writew(BIT(offset), ®s->data_set);
else
writew(BIT(offset), ®s->data_clear);
writew(BIT(offset), ®s->dir_set);
spin_unlock_irqrestore(&port->lock, flags);
return 0;
}
static int adi_gpio_get_value(struct gpio_chip *chip, unsigned offset)
{
struct gpio_port *port = container_of(chip, struct gpio_port, chip);
struct gpio_port_t *regs = port->regs;
unsigned long flags;
int ret;
spin_lock_irqsave(&port->lock, flags);
ret = !!(readw(®s->data) & BIT(offset));
spin_unlock_irqrestore(&port->lock, flags);
return ret;
}
static int adi_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
{
struct gpio_port *port = container_of(chip, struct gpio_port, chip);
if (port->irq_base >= 0)
return irq_find_mapping(port->domain, offset);
else
return irq_create_mapping(port->domain, offset);
}
static int adi_pint_map_port(struct gpio_pint *pint, bool assign, u8 map,
struct irq_domain *domain)
{
struct gpio_pint_regs *regs = pint->regs;
u32 map_mask;
if (pint->map_count > 1)
return -EINVAL;
pint->map_count++;
/* The map_mask of each gpio port is a 16-bit duplicate
* of the 8-bit map. It can be set to either high 16 bits or low
* 16 bits of the pint assignment register.
*/
map_mask = (map << 8) | map;
if (assign) {
map_mask <<= PINT_HI_OFFSET;
writel((readl(®s->assign) & 0xFFFF) | map_mask,
®s->assign);
} else
writel((readl(®s->assign) & 0xFFFF0000) | map_mask,
®s->assign);
pint->domain[assign] = domain;
return 0;
}
static int adi_gpio_pint_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
struct resource *res;
struct gpio_pint *pint;
pint = devm_kzalloc(dev, sizeof(struct gpio_pint), GFP_KERNEL);
if (!pint) {
dev_err(dev, "Memory alloc failed\n");
return -ENOMEM;
}
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
pint->base = devm_ioremap_resource(dev, res);
if (IS_ERR(pint->base))
return PTR_ERR(pint->base);
pint->regs = (struct gpio_pint_regs *)pint->base;
res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
if (!res) {
dev_err(dev, "Invalid IRQ resource\n");
return -ENODEV;
}
spin_lock_init(&pint->lock);
pint->irq = res->start;
pint->pint_map_port = adi_pint_map_port;
platform_set_drvdata(pdev, pint);
irq_set_chained_handler_and_data(pint->irq, adi_gpio_handle_pint_irq,
pint);
list_add_tail(&pint->node, &adi_pint_list);
return 0;
}
static int adi_gpio_pint_remove(struct platform_device *pdev)
{
struct gpio_pint *pint = platform_get_drvdata(pdev);
list_del(&pint->node);
irq_set_handler(pint->irq, handle_simple_irq);
return 0;
}
static int adi_gpio_irq_map(struct irq_domain *d, unsigned int irq,
irq_hw_number_t hwirq)
{
struct gpio_port *port = d->host_data;
if (!port)
return -EINVAL;
irq_set_chip_data(irq, port);
irq_set_chip_and_handler(irq, &adi_gpio_irqchip,
handle_level_irq);
return 0;
}
static const struct irq_domain_ops adi_gpio_irq_domain_ops = {
.map = adi_gpio_irq_map,
.xlate = irq_domain_xlate_onecell,
};
static int adi_gpio_init_int(struct gpio_port *port)
{
struct device_node *node = port->dev->of_node;
struct gpio_pint *pint = port->pint;
int ret;
port->domain = irq_domain_add_linear(node, port->width,
&adi_gpio_irq_domain_ops, port);
if (!port->domain) {
dev_err(port->dev, "Failed to create irqdomain\n");
return -ENOSYS;
}
/* According to BF54x and BF60x HRM, pin interrupt devices are not
* part of the GPIO port device. in GPIO interrupt mode, the GPIO
* pins of multiple port devices can be routed into one pin interrupt
* device. The mapping can be configured by setting pint assignment
* register with the mapping value of different GPIO port. This is
* done via function pint_map_port().
*/
ret = pint->pint_map_port(port->pint, port->pint_assign,
port->pint_map, port->domain);
if (ret)
return ret;
if (port->irq_base >= 0) {
ret = irq_create_strict_mappings(port->domain, port->irq_base,
0, port->width);
if (ret) {
dev_err(port->dev, "Couldn't associate to domain\n");
return ret;
}
}
return 0;
}
#define DEVNAME_SIZE 16
static int adi_gpio_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
const struct adi_pinctrl_gpio_platform_data *pdata;
struct resource *res;
struct gpio_port *port;
char pinctrl_devname[DEVNAME_SIZE];
static int gpio;
int ret = 0;
pdata = dev->platform_data;
if (!pdata)
return -EINVAL;
port = devm_kzalloc(dev, sizeof(struct gpio_port), GFP_KERNEL);
if (!port) {
dev_err(dev, "Memory alloc failed\n");
return -ENOMEM;
}
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
port->base = devm_ioremap_resource(dev, res);
if (IS_ERR(port->base))
return PTR_ERR(port->base);
res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
if (!res)
port->irq_base = -1;
else
port->irq_base = res->start;
port->width = pdata->port_width;
port->dev = dev;
port->regs = (struct gpio_port_t *)port->base;
port->pint_assign = pdata->pint_assign;
port->pint_map = pdata->pint_map;
port->pint = find_gpio_pint(pdata->pint_id);
if (port->pint) {
ret = adi_gpio_init_int(port);
if (ret)
return ret;
}
spin_lock_init(&port->lock);
platform_set_drvdata(pdev, port);
port->chip.label = "adi-gpio";
port->chip.direction_input = adi_gpio_direction_input;
port->chip.get = adi_gpio_get_value;
port->chip.direction_output = adi_gpio_direction_output;
port->chip.set = adi_gpio_set_value;
port->chip.request = adi_gpio_request;
port->chip.free = adi_gpio_free;
port->chip.to_irq = adi_gpio_to_irq;
if (pdata->port_gpio_base > 0)
port->chip.base = pdata->port_gpio_base;
else
port->chip.base = gpio;
port->chip.ngpio = port->width;
gpio = port->chip.base + port->width;
ret = gpiochip_add(&port->chip);
if (ret) {
dev_err(&pdev->dev, "Fail to add GPIO chip.\n");
goto out_remove_domain;
}
/* Add gpio pin range */
snprintf(pinctrl_devname, DEVNAME_SIZE, "pinctrl-adi2.%d",
pdata->pinctrl_id);
pinctrl_devname[DEVNAME_SIZE - 1] = 0;
ret = gpiochip_add_pin_range(&port->chip, pinctrl_devname,
0, pdata->port_pin_base, port->width);
if (ret) {
dev_err(&pdev->dev, "Fail to add pin range to %s.\n",
pinctrl_devname);
goto out_remove_gpiochip;
}
list_add_tail(&port->node, &adi_gpio_port_list);
return 0;
out_remove_gpiochip:
gpiochip_remove(&port->chip);
out_remove_domain:
if (port->pint)
irq_domain_remove(port->domain);
return ret;
}
static int adi_gpio_remove(struct platform_device *pdev)
{
struct gpio_port *port = platform_get_drvdata(pdev);
u8 offset;
list_del(&port->node);
gpiochip_remove(&port->chip);
if (port->pint) {
for (offset = 0; offset < port->width; offset++)
irq_dispose_mapping(irq_find_mapping(port->domain,
offset));
irq_domain_remove(port->domain);
}
return 0;
}
static int adi_pinctrl_probe(struct platform_device *pdev)
{
struct adi_pinctrl *pinctrl;
pinctrl = devm_kzalloc(&pdev->dev, sizeof(*pinctrl), GFP_KERNEL);
if (!pinctrl)
return -ENOMEM;
pinctrl->dev = &pdev->dev;
adi_pinctrl_soc_init(&pinctrl->soc);
adi_pinmux_desc.pins = pinctrl->soc->pins;
adi_pinmux_desc.npins = pinctrl->soc->npins;
/* Now register the pin controller and all pins it handles */
pinctrl->pctl = pinctrl_register(&adi_pinmux_desc, &pdev->dev, pinctrl);
if (IS_ERR(pinctrl->pctl)) {
dev_err(&pdev->dev, "could not register pinctrl ADI2 driver\n");
return PTR_ERR(pinctrl->pctl);
}
platform_set_drvdata(pdev, pinctrl);
return 0;
}
static int adi_pinctrl_remove(struct platform_device *pdev)
{
struct adi_pinctrl *pinctrl = platform_get_drvdata(pdev);
pinctrl_unregister(pinctrl->pctl);
return 0;
}
static struct platform_driver adi_pinctrl_driver = {
.probe = adi_pinctrl_probe,
.remove = adi_pinctrl_remove,
.driver = {
.name = DRIVER_NAME,
},
};
static struct platform_driver adi_gpio_pint_driver = {
.probe = adi_gpio_pint_probe,
.remove = adi_gpio_pint_remove,
.driver = {
.name = "adi-gpio-pint",
},
};
static struct platform_driver adi_gpio_driver = {
.probe = adi_gpio_probe,
.remove = adi_gpio_remove,
.driver = {
.name = "adi-gpio",
},
};
static int __init adi_pinctrl_setup(void)
{
int ret;
ret = platform_driver_register(&adi_pinctrl_driver);
if (ret)
return ret;
ret = platform_driver_register(&adi_gpio_pint_driver);
if (ret)
goto pint_error;
ret = platform_driver_register(&adi_gpio_driver);
if (ret)
goto gpio_error;
#ifdef CONFIG_PM
register_syscore_ops(&gpio_pm_syscore_ops);
#endif
return ret;
gpio_error:
platform_driver_unregister(&adi_gpio_pint_driver);
pint_error:
platform_driver_unregister(&adi_pinctrl_driver);
return ret;
}
arch_initcall(adi_pinctrl_setup);
MODULE_AUTHOR("Sonic Zhang <sonic.zhang@analog.com>");
MODULE_DESCRIPTION("ADI gpio2 pin control driver");
MODULE_LICENSE("GPL");
|
// SPDX-License-Identifier: GPL-2.0-only
/*
* AMD CPU Microcode Update Driver for Linux
*
* This driver allows to upgrade microcode on F10h AMD
* CPUs and later.
*
* Copyright (C) 2008-2011 Advanced Micro Devices Inc.
* 2013-2018 Borislav Petkov <bp@alien8.de>
*
* Author: Peter Oruba <peter.oruba@amd.com>
*
* Based on work by:
* Tigran Aivazian <aivazian.tigran@gmail.com>
*
* early loader:
* Copyright (C) 2013 Advanced Micro Devices, Inc.
*
* Author: Jacob Shin <jacob.shin@amd.com>
* Fixes: Borislav Petkov <bp@suse.de>
*/
#define pr_fmt(fmt) "microcode: " fmt
#include <linux/earlycpio.h>
#include <linux/firmware.h>
#include <linux/uaccess.h>
#include <linux/vmalloc.h>
#include <linux/initrd.h>
#include <linux/kernel.h>
#include <linux/pci.h>
#include <asm/microcode_amd.h>
#include <asm/microcode.h>
#include <asm/processor.h>
#include <asm/setup.h>
#include <asm/cpu.h>
#include <asm/msr.h>
static struct equiv_cpu_table {
unsigned int num_entries;
struct equiv_cpu_entry *entry;
} equiv_table;
/*
* This points to the current valid container of microcode patches which we will
* save from the initrd/builtin before jettisoning its contents. @mc is the
* microcode patch we found to match.
*/
struct cont_desc {
struct microcode_amd *mc;
u32 cpuid_1_eax;
u32 psize;
u8 *data;
size_t size;
};
static u32 ucode_new_rev;
static u8 amd_ucode_patch[PATCH_MAX_SIZE];
/*
* Microcode patch container file is prepended to the initrd in cpio
* format. See Documentation/x86/microcode.rst
*/
static const char
ucode_path[] __maybe_unused = "kernel/x86/microcode/AuthenticAMD.bin";
static u16 find_equiv_id(struct equiv_cpu_table *et, u32 sig)
{
unsigned int i;
if (!et || !et->num_entries)
return 0;
for (i = 0; i < et->num_entries; i++) {
struct equiv_cpu_entry *e = &et->entry[i];
if (sig == e->installed_cpu)
return e->equiv_cpu;
e++;
}
return 0;
}
/*
* Check whether there is a valid microcode container file at the beginning
* of @buf of size @buf_size. Set @early to use this function in the early path.
*/
static bool verify_container(const u8 *buf, size_t buf_size, bool early)
{
u32 cont_magic;
if (buf_size <= CONTAINER_HDR_SZ) {
if (!early)
pr_debug("Truncated microcode container header.\n");
return false;
}
cont_magic = *(const u32 *)buf;
if (cont_magic != UCODE_MAGIC) {
if (!early)
pr_debug("Invalid magic value (0x%08x).\n", cont_magic);
return false;
}
return true;
}
/*
* Check whether there is a valid, non-truncated CPU equivalence table at the
* beginning of @buf of size @buf_size. Set @early to use this function in the
* early path.
*/
static bool verify_equivalence_table(const u8 *buf, size_t buf_size, bool early)
{
const u32 *hdr = (const u32 *)buf;
u32 cont_type, equiv_tbl_len;
if (!verify_container(buf, buf_size, early))
return false;
cont_type = hdr[1];
if (cont_type != UCODE_EQUIV_CPU_TABLE_TYPE) {
if (!early)
pr_debug("Wrong microcode container equivalence table type: %u.\n",
cont_type);
return false;
}
buf_size -= CONTAINER_HDR_SZ;
equiv_tbl_len = hdr[2];
if (equiv_tbl_len < sizeof(struct equiv_cpu_entry) ||
buf_size < equiv_tbl_len) {
if (!early)
pr_debug("Truncated equivalence table.\n");
return false;
}
return true;
}
/*
* Check whether there is a valid, non-truncated microcode patch section at the
* beginning of @buf of size @buf_size. Set @early to use this function in the
* early path.
*
* On success, @sh_psize returns the patch size according to the section header,
* to the caller.
*/
static bool
__verify_patch_section(const u8 *buf, size_t buf_size, u32 *sh_psize, bool early)
{
u32 p_type, p_size;
const u32 *hdr;
if (buf_size < SECTION_HDR_SIZE) {
if (!early)
pr_debug("Truncated patch section.\n");
return false;
}
hdr = (const u32 *)buf;
p_type = hdr[0];
p_size = hdr[1];
if (p_type != UCODE_UCODE_TYPE) {
if (!early)
pr_debug("Invalid type field (0x%x) in container file section header.\n",
p_type);
return false;
}
if (p_size < sizeof(struct microcode_header_amd)) {
if (!early)
pr_debug("Patch of size %u too short.\n", p_size);
return false;
}
*sh_psize = p_size;
return true;
}
/*
* Check whether the passed remaining file @buf_size is large enough to contain
* a patch of the indicated @sh_psize (and also whether this size does not
* exceed the per-family maximum). @sh_psize is the size read from the section
* header.
*/
static unsigned int __verify_patch_size(u8 family, u32 sh_psize, size_t buf_size)
{
u32 max_size;
if (family >= 0x15)
return min_t(u32, sh_psize, buf_size);
#define F1XH_MPB_MAX_SIZE 2048
#define F14H_MPB_MAX_SIZE 1824
switch (family) {
case 0x10 ... 0x12:
max_size = F1XH_MPB_MAX_SIZE;
break;
case 0x14:
max_size = F14H_MPB_MAX_SIZE;
break;
default:
WARN(1, "%s: WTF family: 0x%x\n", __func__, family);
return 0;
break;
}
if (sh_psize > min_t(u32, buf_size, max_size))
return 0;
return sh_psize;
}
/*
* Verify the patch in @buf.
*
* Returns:
* negative: on error
* positive: patch is not for this family, skip it
* 0: success
*/
static int
verify_patch(u8 family, const u8 *buf, size_t buf_size, u32 *patch_size, bool early)
{
struct microcode_header_amd *mc_hdr;
unsigned int ret;
u32 sh_psize;
u16 proc_id;
u8 patch_fam;
if (!__verify_patch_section(buf, buf_size, &sh_psize, early))
return -1;
/*
* The section header length is not included in this indicated size
* but is present in the leftover file length so we need to subtract
* it before passing this value to the function below.
*/
buf_size -= SECTION_HDR_SIZE;
/*
* Check if the remaining buffer is big enough to contain a patch of
* size sh_psize, as the section claims.
*/
if (buf_size < sh_psize) {
if (!early)
pr_debug("Patch of size %u truncated.\n", sh_psize);
return -1;
}
ret = __verify_patch_size(family, sh_psize, buf_size);
if (!ret) {
if (!early)
pr_debug("Per-family patch size mismatch.\n");
return -1;
}
*patch_size = sh_psize;
mc_hdr = (struct microcode_header_amd *)(buf + SECTION_HDR_SIZE);
if (mc_hdr->nb_dev_id || mc_hdr->sb_dev_id) {
if (!early)
pr_err("Patch-ID 0x%08x: chipset-specific code unsupported.\n", mc_hdr->patch_id);
return -1;
}
proc_id = mc_hdr->processor_rev_id;
patch_fam = 0xf + (proc_id >> 12);
if (patch_fam != family)
return 1;
return 0;
}
/*
* This scans the ucode blob for the proper container as we can have multiple
* containers glued together. Returns the equivalence ID from the equivalence
* table or 0 if none found.
* Returns the amount of bytes consumed while scanning. @desc contains all the
* data we're going to use in later stages of the application.
*/
static size_t parse_container(u8 *ucode, size_t size, struct cont_desc *desc)
{
struct equiv_cpu_table table;
size_t orig_size = size;
u32 *hdr = (u32 *)ucode;
u16 eq_id;
u8 *buf;
if (!verify_equivalence_table(ucode, size, true))
return 0;
buf = ucode;
table.entry = (struct equiv_cpu_entry *)(buf + CONTAINER_HDR_SZ);
table.num_entries = hdr[2] / sizeof(struct equiv_cpu_entry);
/*
* Find the equivalence ID of our CPU in this table. Even if this table
* doesn't contain a patch for the CPU, scan through the whole container
* so that it can be skipped in case there are other containers appended.
*/
eq_id = find_equiv_id(&table, desc->cpuid_1_eax);
buf += hdr[2] + CONTAINER_HDR_SZ;
size -= hdr[2] + CONTAINER_HDR_SZ;
/*
* Scan through the rest of the container to find where it ends. We do
* some basic sanity-checking too.
*/
while (size > 0) {
struct microcode_amd *mc;
u32 patch_size;
int ret;
ret = verify_patch(x86_family(desc->cpuid_1_eax), buf, size, &patch_size, true);
if (ret < 0) {
/*
* Patch verification failed, skip to the next
* container, if there's one:
*/
goto out;
} else if (ret > 0) {
goto skip;
}
mc = (struct microcode_amd *)(buf + SECTION_HDR_SIZE);
if (eq_id == mc->hdr.processor_rev_id) {
desc->psize = patch_size;
desc->mc = mc;
}
skip:
/* Skip patch section header too: */
buf += patch_size + SECTION_HDR_SIZE;
size -= patch_size + SECTION_HDR_SIZE;
}
/*
* If we have found a patch (desc->mc), it means we're looking at the
* container which has a patch for this CPU so return 0 to mean, @ucode
* already points to the proper container. Otherwise, we return the size
* we scanned so that we can advance to the next container in the
* buffer.
*/
if (desc->mc) {
desc->data = ucode;
desc->size = orig_size - size;
return 0;
}
out:
return orig_size - size;
}
/*
* Scan the ucode blob for the proper container as we can have multiple
* containers glued together.
*/
static void scan_containers(u8 *ucode, size_t size, struct cont_desc *desc)
{
while (size) {
size_t s = parse_container(ucode, size, desc);
if (!s)
return;
/* catch wraparound */
if (size >= s) {
ucode += s;
size -= s;
} else {
return;
}
}
}
static int __apply_microcode_amd(struct microcode_amd *mc)
{
u32 rev, dummy;
native_wrmsrl(MSR_AMD64_PATCH_LOADER, (u64)(long)&mc->hdr.data_code);
/* verify patch application was successful */
native_rdmsr(MSR_AMD64_PATCH_LEVEL, rev, dummy);
if (rev != mc->hdr.patch_id)
return -1;
return 0;
}
/*
* Early load occurs before we can vmalloc(). So we look for the microcode
* patch container file in initrd, traverse equivalent cpu table, look for a
* matching microcode patch, and update, all in initrd memory in place.
* When vmalloc() is available for use later -- on 64-bit during first AP load,
* and on 32-bit during save_microcode_in_initrd_amd() -- we can call
* load_microcode_amd() to save equivalent cpu table and microcode patches in
* kernel heap memory.
*
* Returns true if container found (sets @desc), false otherwise.
*/
static bool
apply_microcode_early_amd(u32 cpuid_1_eax, void *ucode, size_t size, bool save_patch)
{
struct cont_desc desc = { 0 };
u8 (*patch)[PATCH_MAX_SIZE];
struct microcode_amd *mc;
u32 rev, dummy, *new_rev;
bool ret = false;
#ifdef CONFIG_X86_32
new_rev = (u32 *)__pa_nodebug(&ucode_new_rev);
patch = (u8 (*)[PATCH_MAX_SIZE])__pa_nodebug(&amd_ucode_patch);
#else
new_rev = &ucode_new_rev;
patch = &amd_ucode_patch;
#endif
desc.cpuid_1_eax = cpuid_1_eax;
scan_containers(ucode, size, &desc);
mc = desc.mc;
if (!mc)
return ret;
native_rdmsr(MSR_AMD64_PATCH_LEVEL, rev, dummy);
if (rev >= mc->hdr.patch_id)
return ret;
if (!__apply_microcode_amd(mc)) {
*new_rev = mc->hdr.patch_id;
ret = true;
if (save_patch)
memcpy(patch, mc, min_t(u32, desc.psize, PATCH_MAX_SIZE));
}
return ret;
}
static bool get_builtin_microcode(struct cpio_data *cp, unsigned int family)
{
#ifdef CONFIG_X86_64
char fw_name[36] = "amd-ucode/microcode_amd.bin";
if (family >= 0x15)
snprintf(fw_name, sizeof(fw_name),
"amd-ucode/microcode_amd_fam%.2xh.bin", family);
return get_builtin_firmware(cp, fw_name);
#else
return false;
#endif
}
static void __load_ucode_amd(unsigned int cpuid_1_eax, struct cpio_data *ret)
{
struct ucode_cpu_info *uci;
struct cpio_data cp;
const char *path;
bool use_pa;
if (IS_ENABLED(CONFIG_X86_32)) {
uci = (struct ucode_cpu_info *)__pa_nodebug(ucode_cpu_info);
path = (const char *)__pa_nodebug(ucode_path);
use_pa = true;
} else {
uci = ucode_cpu_info;
path = ucode_path;
use_pa = false;
}
if (!get_builtin_microcode(&cp, x86_family(cpuid_1_eax)))
cp = find_microcode_in_initrd(path, use_pa);
/* Needed in load_microcode_amd() */
uci->cpu_sig.sig = cpuid_1_eax;
*ret = cp;
}
void __init load_ucode_amd_bsp(unsigned int cpuid_1_eax)
{
struct cpio_data cp = { };
__load_ucode_amd(cpuid_1_eax, &cp);
if (!(cp.data && cp.size))
return;
apply_microcode_early_amd(cpuid_1_eax, cp.data, cp.size, true);
}
void load_ucode_amd_ap(unsigned int cpuid_1_eax)
{
struct microcode_amd *mc;
struct cpio_data cp;
u32 *new_rev, rev, dummy;
if (IS_ENABLED(CONFIG_X86_32)) {
mc = (struct microcode_amd *)__pa_nodebug(amd_ucode_patch);
new_rev = (u32 *)__pa_nodebug(&ucode_new_rev);
} else {
mc = (struct microcode_amd *)amd_ucode_patch;
new_rev = &ucode_new_rev;
}
native_rdmsr(MSR_AMD64_PATCH_LEVEL, rev, dummy);
/* Check whether we have saved a new patch already: */
if (*new_rev && rev < mc->hdr.patch_id) {
if (!__apply_microcode_amd(mc)) {
*new_rev = mc->hdr.patch_id;
return;
}
}
__load_ucode_amd(cpuid_1_eax, &cp);
if (!(cp.data && cp.size))
return;
apply_microcode_early_amd(cpuid_1_eax, cp.data, cp.size, false);
}
static enum ucode_state
load_microcode_amd(bool save, u8 family, const u8 *data, size_t size);
int __init save_microcode_in_initrd_amd(unsigned int cpuid_1_eax)
{
struct cont_desc desc = { 0 };
enum ucode_state ret;
struct cpio_data cp;
cp = find_microcode_in_initrd(ucode_path, false);
if (!(cp.data && cp.size))
return -EINVAL;
desc.cpuid_1_eax = cpuid_1_eax;
scan_containers(cp.data, cp.size, &desc);
if (!desc.mc)
return -EINVAL;
ret = load_microcode_amd(true, x86_family(cpuid_1_eax), desc.data, desc.size);
if (ret > UCODE_UPDATED)
return -EINVAL;
return 0;
}
void reload_ucode_amd(void)
{
struct microcode_amd *mc;
u32 rev, dummy __always_unused;
mc = (struct microcode_amd *)amd_ucode_patch;
rdmsr(MSR_AMD64_PATCH_LEVEL, rev, dummy);
if (rev < mc->hdr.patch_id) {
if (!__apply_microcode_amd(mc)) {
ucode_new_rev = mc->hdr.patch_id;
pr_info("reload patch_level=0x%08x\n", ucode_new_rev);
}
}
}
static u16 __find_equiv_id(unsigned int cpu)
{
struct ucode_cpu_info *uci = ucode_cpu_info + cpu;
return find_equiv_id(&equiv_table, uci->cpu_sig.sig);
}
/*
* a small, trivial cache of per-family ucode patches
*/
static struct ucode_patch *cache_find_patch(u16 equiv_cpu)
{
struct ucode_patch *p;
list_for_each_entry(p, µcode_cache, plist)
if (p->equiv_cpu == equiv_cpu)
return p;
return NULL;
}
static void update_cache(struct ucode_patch *new_patch)
{
struct ucode_patch *p;
list_for_each_entry(p, µcode_cache, plist) {
if (p->equiv_cpu == new_patch->equiv_cpu) {
if (p->patch_id >= new_patch->patch_id) {
/* we already have the latest patch */
kfree(new_patch->data);
kfree(new_patch);
return;
}
list_replace(&p->plist, &new_patch->plist);
kfree(p->data);
kfree(p);
return;
}
}
/* no patch found, add it */
list_add_tail(&new_patch->plist, µcode_cache);
}
static void free_cache(void)
{
struct ucode_patch *p, *tmp;
list_for_each_entry_safe(p, tmp, µcode_cache, plist) {
__list_del(p->plist.prev, p->plist.next);
kfree(p->data);
kfree(p);
}
}
static struct ucode_patch *find_patch(unsigned int cpu)
{
u16 equiv_id;
equiv_id = __find_equiv_id(cpu);
if (!equiv_id)
return NULL;
return cache_find_patch(equiv_id);
}
static int collect_cpu_info_amd(int cpu, struct cpu_signature *csig)
{
struct cpuinfo_x86 *c = &cpu_data(cpu);
struct ucode_cpu_info *uci = ucode_cpu_info + cpu;
struct ucode_patch *p;
csig->sig = cpuid_eax(0x00000001);
csig->rev = c->microcode;
/*
* a patch could have been loaded early, set uci->mc so that
* mc_bp_resume() can call apply_microcode()
*/
p = find_patch(cpu);
if (p && (p->patch_id == csig->rev))
uci->mc = p->data;
pr_info("CPU%d: patch_level=0x%08x\n", cpu, csig->rev);
return 0;
}
static enum ucode_state apply_microcode_amd(int cpu)
{
struct cpuinfo_x86 *c = &cpu_data(cpu);
struct microcode_amd *mc_amd;
struct ucode_cpu_info *uci;
struct ucode_patch *p;
enum ucode_state ret;
u32 rev, dummy __always_unused;
BUG_ON(raw_smp_processor_id() != cpu);
uci = ucode_cpu_info + cpu;
p = find_patch(cpu);
if (!p)
return UCODE_NFOUND;
mc_amd = p->data;
uci->mc = p->data;
rdmsr(MSR_AMD64_PATCH_LEVEL, rev, dummy);
/* need to apply patch? */
if (rev >= mc_amd->hdr.patch_id) {
ret = UCODE_OK;
goto out;
}
if (__apply_microcode_amd(mc_amd)) {
pr_err("CPU%d: update failed for patch_level=0x%08x\n",
cpu, mc_amd->hdr.patch_id);
return UCODE_ERROR;
}
rev = mc_amd->hdr.patch_id;
ret = UCODE_UPDATED;
pr_info("CPU%d: new patch_level=0x%08x\n", cpu, rev);
out:
uci->cpu_sig.rev = rev;
c->microcode = rev;
/* Update boot_cpu_data's revision too, if we're on the BSP: */
if (c->cpu_index == boot_cpu_data.cpu_index)
boot_cpu_data.microcode = rev;
return ret;
}
static size_t install_equiv_cpu_table(const u8 *buf, size_t buf_size)
{
u32 equiv_tbl_len;
const u32 *hdr;
if (!verify_equivalence_table(buf, buf_size, false))
return 0;
hdr = (const u32 *)buf;
equiv_tbl_len = hdr[2];
equiv_table.entry = vmalloc(equiv_tbl_len);
if (!equiv_table.entry) {
pr_err("failed to allocate equivalent CPU table\n");
return 0;
}
memcpy(equiv_table.entry, buf + CONTAINER_HDR_SZ, equiv_tbl_len);
equiv_table.num_entries = equiv_tbl_len / sizeof(struct equiv_cpu_entry);
/* add header length */
return equiv_tbl_len + CONTAINER_HDR_SZ;
}
static void free_equiv_cpu_table(void)
{
vfree(equiv_table.entry);
memset(&equiv_table, 0, sizeof(equiv_table));
}
static void cleanup(void)
{
free_equiv_cpu_table();
free_cache();
}
/*
* Return a non-negative value even if some of the checks failed so that
* we can skip over the next patch. If we return a negative value, we
* signal a grave error like a memory allocation has failed and the
* driver cannot continue functioning normally. In such cases, we tear
* down everything we've used up so far and exit.
*/
static int verify_and_add_patch(u8 family, u8 *fw, unsigned int leftover,
unsigned int *patch_size)
{
struct microcode_header_amd *mc_hdr;
struct ucode_patch *patch;
u16 proc_id;
int ret;
ret = verify_patch(family, fw, leftover, patch_size, false);
if (ret)
return ret;
patch = kzalloc(sizeof(*patch), GFP_KERNEL);
if (!patch) {
pr_err("Patch allocation failure.\n");
return -EINVAL;
}
patch->data = kmemdup(fw + SECTION_HDR_SIZE, *patch_size, GFP_KERNEL);
if (!patch->data) {
pr_err("Patch data allocation failure.\n");
kfree(patch);
return -EINVAL;
}
mc_hdr = (struct microcode_header_amd *)(fw + SECTION_HDR_SIZE);
proc_id = mc_hdr->processor_rev_id;
INIT_LIST_HEAD(&patch->plist);
patch->patch_id = mc_hdr->patch_id;
patch->equiv_cpu = proc_id;
pr_debug("%s: Added patch_id: 0x%08x, proc_id: 0x%04x\n",
__func__, patch->patch_id, proc_id);
/* ... and add to cache. */
update_cache(patch);
return 0;
}
static enum ucode_state __load_microcode_amd(u8 family, const u8 *data,
size_t size)
{
u8 *fw = (u8 *)data;
size_t offset;
offset = install_equiv_cpu_table(data, size);
if (!offset)
return UCODE_ERROR;
fw += offset;
size -= offset;
if (*(u32 *)fw != UCODE_UCODE_TYPE) {
pr_err("invalid type field in container file section header\n");
free_equiv_cpu_table();
return UCODE_ERROR;
}
while (size > 0) {
unsigned int crnt_size = 0;
int ret;
ret = verify_and_add_patch(family, fw, size, &crnt_size);
if (ret < 0)
return UCODE_ERROR;
fw += crnt_size + SECTION_HDR_SIZE;
size -= (crnt_size + SECTION_HDR_SIZE);
}
return UCODE_OK;
}
static enum ucode_state
load_microcode_amd(bool save, u8 family, const u8 *data, size_t size)
{
struct ucode_patch *p;
enum ucode_state ret;
/* free old equiv table */
free_equiv_cpu_table();
ret = __load_microcode_amd(family, data, size);
if (ret != UCODE_OK) {
cleanup();
return ret;
}
p = find_patch(0);
if (!p) {
return ret;
} else {
if (boot_cpu_data.microcode >= p->patch_id)
return ret;
ret = UCODE_NEW;
}
/* save BSP's matching patch for early load */
if (!save)
return ret;
memset(amd_ucode_patch, 0, PATCH_MAX_SIZE);
memcpy(amd_ucode_patch, p->data, min_t(u32, ksize(p->data), PATCH_MAX_SIZE));
return ret;
}
/*
* AMD microcode firmware naming convention, up to family 15h they are in
* the legacy file:
*
* amd-ucode/microcode_amd.bin
*
* This legacy file is always smaller than 2K in size.
*
* Beginning with family 15h, they are in family-specific firmware files:
*
* amd-ucode/microcode_amd_fam15h.bin
* amd-ucode/microcode_amd_fam16h.bin
* ...
*
* These might be larger than 2K.
*/
static enum ucode_state request_microcode_amd(int cpu, struct device *device,
bool refresh_fw)
{
char fw_name[36] = "amd-ucode/microcode_amd.bin";
struct cpuinfo_x86 *c = &cpu_data(cpu);
bool bsp = c->cpu_index == boot_cpu_data.cpu_index;
enum ucode_state ret = UCODE_NFOUND;
const struct firmware *fw;
/* reload ucode container only on the boot cpu */
if (!refresh_fw || !bsp)
return UCODE_OK;
if (c->x86 >= 0x15)
snprintf(fw_name, sizeof(fw_name), "amd-ucode/microcode_amd_fam%.2xh.bin", c->x86);
if (request_firmware_direct(&fw, (const char *)fw_name, device)) {
pr_debug("failed to load file %s\n", fw_name);
goto out;
}
ret = UCODE_ERROR;
if (!verify_container(fw->data, fw->size, false))
goto fw_release;
ret = load_microcode_amd(bsp, c->x86, fw->data, fw->size);
fw_release:
release_firmware(fw);
out:
return ret;
}
static enum ucode_state
request_microcode_user(int cpu, const void __user *buf, size_t size)
{
return UCODE_ERROR;
}
static void microcode_fini_cpu_amd(int cpu)
{
struct ucode_cpu_info *uci = ucode_cpu_info + cpu;
uci->mc = NULL;
}
static struct microcode_ops microcode_amd_ops = {
.request_microcode_user = request_microcode_user,
.request_microcode_fw = request_microcode_amd,
.collect_cpu_info = collect_cpu_info_amd,
.apply_microcode = apply_microcode_amd,
.microcode_fini_cpu = microcode_fini_cpu_amd,
};
struct microcode_ops * __init init_amd_microcode(void)
{
struct cpuinfo_x86 *c = &boot_cpu_data;
if (c->x86_vendor != X86_VENDOR_AMD || c->x86 < 0x10) {
pr_warn("AMD CPU family 0x%x not supported\n", c->x86);
return NULL;
}
if (ucode_new_rev)
pr_info_once("microcode updated early to new patch_level=0x%08x\n",
ucode_new_rev);
return µcode_amd_ops;
}
void __exit exit_amd_microcode(void)
{
cleanup();
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
//
using System;
public class P
{
public static int Main()
{
// This bug is caused by a broken flowgraph due to a return from
// a try inside a catch block
TestCatchReturn();
// Successfully jitted a return from a try inside a catch block
return 100;
}
public static void TestCatchReturn()
{
try
{
}
catch (Exception)
{
try
{
try
{
return;
}
catch
{
return;
}
finally
{
}
}
catch (Exception)
{
}
}
}
}
|
var which = require('which');
var spawnSync = require('child_process').spawnSync;
module.exports.detect = function(gulp) {
var DART_SDK = false;
try {
which.sync('dart');
if (process.platform === 'win32') {
DART_SDK = {
ANALYZER: 'dartanalyzer.bat',
DARTDOCGEN: 'dartdoc.bat',
DARTFMT: 'dartfmt.bat',
PUB: 'pub.bat',
VM: 'dart.exe'
};
} else {
DART_SDK = {
ANALYZER: 'dartanalyzer',
DARTDOCGEN: 'dartdoc',
DARTFMT: 'dartfmt',
PUB: 'pub',
VM: 'dart'
};
}
console.log('Dart SDK detected:');
} catch (e) {
console.log('Dart SDK is not available, Dart tasks will be skipped.');
var gulpTaskFn = gulp.task.bind(gulp);
gulp.task = function (name, deps, fn) {
if (name.indexOf('.dart') === -1) {
return gulpTaskFn(name, deps, fn);
} else {
return gulpTaskFn(name, function() {
console.log('Dart SDK is not available. Skipping task: ' + name);
});
}
};
}
return DART_SDK;
}
module.exports.logVersion = function(dartSdk) {
console.log('DART SDK:') ;
console.log('- dart: ' + spawnSync(dartSdk.VM, ['--version']).stderr.toString().replace(/\n/g, ''));
console.log('- pub: ' + spawnSync(dartSdk.PUB, ['--version']).stdout.toString().replace(/\n/g, ''));
}
|
/**
* \file
*
* \brief Instance description for PAC1
*
* Copyright (c) 2014-2015 Atmel Corporation. All rights reserved.
*
* \asf_license_start
*
* \page License
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3. The name of Atmel may not be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* 4. This software may only be redistributed and used in connection with an
* Atmel microcontroller product.
*
* THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* \asf_license_stop
*
*/
/*
* Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a>
*/
#ifndef _SAMD21_PAC1_INSTANCE_
#define _SAMD21_PAC1_INSTANCE_
/* ========== Register definition for PAC1 peripheral ========== */
#if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
#define REG_PAC1_WPCLR (0x41000000U) /**< \brief (PAC1) Write Protection Clear */
#define REG_PAC1_WPSET (0x41000004U) /**< \brief (PAC1) Write Protection Set */
#else
#define REG_PAC1_WPCLR (*(RwReg *)0x41000000U) /**< \brief (PAC1) Write Protection Clear */
#define REG_PAC1_WPSET (*(RwReg *)0x41000004U) /**< \brief (PAC1) Write Protection Set */
#endif /* (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
/* ========== Instance parameters for PAC1 peripheral ========== */
#define PAC1_WPROT_DEFAULT_VAL 0x00000002 // PAC protection mask at reset
#endif /* _SAMD21_PAC1_INSTANCE_ */
|
/*******************************************************************************
*
* Intel Ethernet Controller XL710 Family Linux Virtual Function Driver
* Copyright(c) 2013 - 2014 Intel Corporation.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*
* The full GNU General Public License is included in this distribution in
* the file called "COPYING".
*
* Contact Information:
* e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
* Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
*
******************************************************************************/
#include "i40evf.h"
#include "i40e_prototype.h"
/* busy wait delay in msec */
#define I40EVF_BUSY_WAIT_DELAY 10
#define I40EVF_BUSY_WAIT_COUNT 50
/**
* i40evf_send_pf_msg
* @adapter: adapter structure
* @op: virtual channel opcode
* @msg: pointer to message buffer
* @len: message length
*
* Send message to PF and print status if failure.
**/
static int i40evf_send_pf_msg(struct i40evf_adapter *adapter,
enum i40e_virtchnl_ops op, u8 *msg, u16 len)
{
struct i40e_hw *hw = &adapter->hw;
i40e_status err;
if (adapter->flags & I40EVF_FLAG_PF_COMMS_FAILED)
return 0; /* nothing to see here, move along */
err = i40e_aq_send_msg_to_pf(hw, op, 0, msg, len, NULL);
if (err)
dev_err(&adapter->pdev->dev, "Unable to send opcode %d to PF, error %d, aq status %d\n",
op, err, hw->aq.asq_last_status);
return err;
}
/**
* i40evf_send_api_ver
* @adapter: adapter structure
*
* Send API version admin queue message to the PF. The reply is not checked
* in this function. Returns 0 if the message was successfully
* sent, or one of the I40E_ADMIN_QUEUE_ERROR_ statuses if not.
**/
int i40evf_send_api_ver(struct i40evf_adapter *adapter)
{
struct i40e_virtchnl_version_info vvi;
vvi.major = I40E_VIRTCHNL_VERSION_MAJOR;
vvi.minor = I40E_VIRTCHNL_VERSION_MINOR;
return i40evf_send_pf_msg(adapter, I40E_VIRTCHNL_OP_VERSION, (u8 *)&vvi,
sizeof(vvi));
}
/**
* i40evf_verify_api_ver
* @adapter: adapter structure
*
* Compare API versions with the PF. Must be called after admin queue is
* initialized. Returns 0 if API versions match, -EIO if they do not,
* I40E_ERR_ADMIN_QUEUE_NO_WORK if the admin queue is empty, and any errors
* from the firmware are propagated.
**/
int i40evf_verify_api_ver(struct i40evf_adapter *adapter)
{
struct i40e_virtchnl_version_info *pf_vvi;
struct i40e_hw *hw = &adapter->hw;
struct i40e_arq_event_info event;
enum i40e_virtchnl_ops op;
i40e_status err;
event.buf_len = I40EVF_MAX_AQ_BUF_SIZE;
event.msg_buf = kzalloc(event.buf_len, GFP_KERNEL);
if (!event.msg_buf) {
err = -ENOMEM;
goto out;
}
while (1) {
err = i40evf_clean_arq_element(hw, &event, NULL);
/* When the AQ is empty, i40evf_clean_arq_element will return
* nonzero and this loop will terminate.
*/
if (err)
goto out_alloc;
op =
(enum i40e_virtchnl_ops)le32_to_cpu(event.desc.cookie_high);
if (op == I40E_VIRTCHNL_OP_VERSION)
break;
}
err = (i40e_status)le32_to_cpu(event.desc.cookie_low);
if (err)
goto out_alloc;
if (op != I40E_VIRTCHNL_OP_VERSION) {
dev_info(&adapter->pdev->dev, "Invalid reply type %d from PF\n",
op);
err = -EIO;
goto out_alloc;
}
pf_vvi = (struct i40e_virtchnl_version_info *)event.msg_buf;
if ((pf_vvi->major != I40E_VIRTCHNL_VERSION_MAJOR) ||
(pf_vvi->minor != I40E_VIRTCHNL_VERSION_MINOR))
err = -EIO;
out_alloc:
kfree(event.msg_buf);
out:
return err;
}
/**
* i40evf_send_vf_config_msg
* @adapter: adapter structure
*
* Send VF configuration request admin queue message to the PF. The reply
* is not checked in this function. Returns 0 if the message was
* successfully sent, or one of the I40E_ADMIN_QUEUE_ERROR_ statuses if not.
**/
int i40evf_send_vf_config_msg(struct i40evf_adapter *adapter)
{
return i40evf_send_pf_msg(adapter, I40E_VIRTCHNL_OP_GET_VF_RESOURCES,
NULL, 0);
}
/**
* i40evf_get_vf_config
* @hw: pointer to the hardware structure
* @len: length of buffer
*
* Get VF configuration from PF and populate hw structure. Must be called after
* admin queue is initialized. Busy waits until response is received from PF,
* with maximum timeout. Response from PF is returned in the buffer for further
* processing by the caller.
**/
int i40evf_get_vf_config(struct i40evf_adapter *adapter)
{
struct i40e_hw *hw = &adapter->hw;
struct i40e_arq_event_info event;
enum i40e_virtchnl_ops op;
i40e_status err;
u16 len;
len = sizeof(struct i40e_virtchnl_vf_resource) +
I40E_MAX_VF_VSI * sizeof(struct i40e_virtchnl_vsi_resource);
event.buf_len = len;
event.msg_buf = kzalloc(event.buf_len, GFP_KERNEL);
if (!event.msg_buf) {
err = -ENOMEM;
goto out;
}
while (1) {
/* When the AQ is empty, i40evf_clean_arq_element will return
* nonzero and this loop will terminate.
*/
err = i40evf_clean_arq_element(hw, &event, NULL);
if (err)
goto out_alloc;
op =
(enum i40e_virtchnl_ops)le32_to_cpu(event.desc.cookie_high);
if (op == I40E_VIRTCHNL_OP_GET_VF_RESOURCES)
break;
}
err = (i40e_status)le32_to_cpu(event.desc.cookie_low);
memcpy(adapter->vf_res, event.msg_buf, min(event.msg_len, len));
i40e_vf_parse_hw_config(hw, adapter->vf_res);
out_alloc:
kfree(event.msg_buf);
out:
return err;
}
/**
* i40evf_configure_queues
* @adapter: adapter structure
*
* Request that the PF set up our (previously allocated) queues.
**/
void i40evf_configure_queues(struct i40evf_adapter *adapter)
{
struct i40e_virtchnl_vsi_queue_config_info *vqci;
struct i40e_virtchnl_queue_pair_info *vqpi;
int pairs = adapter->num_active_queues;
int i, len;
if (adapter->current_op != I40E_VIRTCHNL_OP_UNKNOWN) {
/* bail because we already have a command pending */
dev_err(&adapter->pdev->dev, "%s: command %d pending\n",
__func__, adapter->current_op);
return;
}
adapter->current_op = I40E_VIRTCHNL_OP_CONFIG_VSI_QUEUES;
len = sizeof(struct i40e_virtchnl_vsi_queue_config_info) +
(sizeof(struct i40e_virtchnl_queue_pair_info) * pairs);
vqci = kzalloc(len, GFP_ATOMIC);
if (!vqci)
return;
vqci->vsi_id = adapter->vsi_res->vsi_id;
vqci->num_queue_pairs = pairs;
vqpi = vqci->qpair;
/* Size check is not needed here - HW max is 16 queue pairs, and we
* can fit info for 31 of them into the AQ buffer before it overflows.
*/
for (i = 0; i < pairs; i++) {
vqpi->txq.vsi_id = vqci->vsi_id;
vqpi->txq.queue_id = i;
vqpi->txq.ring_len = adapter->tx_rings[i]->count;
vqpi->txq.dma_ring_addr = adapter->tx_rings[i]->dma;
vqpi->txq.headwb_enabled = 1;
vqpi->txq.dma_headwb_addr = vqpi->txq.dma_ring_addr +
(vqpi->txq.ring_len * sizeof(struct i40e_tx_desc));
vqpi->rxq.vsi_id = vqci->vsi_id;
vqpi->rxq.queue_id = i;
vqpi->rxq.ring_len = adapter->rx_rings[i]->count;
vqpi->rxq.dma_ring_addr = adapter->rx_rings[i]->dma;
vqpi->rxq.max_pkt_size = adapter->netdev->mtu
+ ETH_HLEN + VLAN_HLEN + ETH_FCS_LEN;
vqpi->rxq.databuffer_size = adapter->rx_rings[i]->rx_buf_len;
vqpi++;
}
adapter->aq_pending |= I40EVF_FLAG_AQ_CONFIGURE_QUEUES;
adapter->aq_required &= ~I40EVF_FLAG_AQ_CONFIGURE_QUEUES;
i40evf_send_pf_msg(adapter, I40E_VIRTCHNL_OP_CONFIG_VSI_QUEUES,
(u8 *)vqci, len);
kfree(vqci);
}
/**
* i40evf_enable_queues
* @adapter: adapter structure
*
* Request that the PF enable all of our queues.
**/
void i40evf_enable_queues(struct i40evf_adapter *adapter)
{
struct i40e_virtchnl_queue_select vqs;
if (adapter->current_op != I40E_VIRTCHNL_OP_UNKNOWN) {
/* bail because we already have a command pending */
dev_err(&adapter->pdev->dev, "%s: command %d pending\n",
__func__, adapter->current_op);
return;
}
adapter->current_op = I40E_VIRTCHNL_OP_ENABLE_QUEUES;
vqs.vsi_id = adapter->vsi_res->vsi_id;
vqs.tx_queues = (1 << adapter->num_active_queues) - 1;
vqs.rx_queues = vqs.tx_queues;
adapter->aq_pending |= I40EVF_FLAG_AQ_ENABLE_QUEUES;
adapter->aq_required &= ~I40EVF_FLAG_AQ_ENABLE_QUEUES;
i40evf_send_pf_msg(adapter, I40E_VIRTCHNL_OP_ENABLE_QUEUES,
(u8 *)&vqs, sizeof(vqs));
}
/**
* i40evf_disable_queues
* @adapter: adapter structure
*
* Request that the PF disable all of our queues.
**/
void i40evf_disable_queues(struct i40evf_adapter *adapter)
{
struct i40e_virtchnl_queue_select vqs;
if (adapter->current_op != I40E_VIRTCHNL_OP_UNKNOWN) {
/* bail because we already have a command pending */
dev_err(&adapter->pdev->dev, "%s: command %d pending\n",
__func__, adapter->current_op);
return;
}
adapter->current_op = I40E_VIRTCHNL_OP_DISABLE_QUEUES;
vqs.vsi_id = adapter->vsi_res->vsi_id;
vqs.tx_queues = (1 << adapter->num_active_queues) - 1;
vqs.rx_queues = vqs.tx_queues;
adapter->aq_pending |= I40EVF_FLAG_AQ_DISABLE_QUEUES;
adapter->aq_required &= ~I40EVF_FLAG_AQ_DISABLE_QUEUES;
i40evf_send_pf_msg(adapter, I40E_VIRTCHNL_OP_DISABLE_QUEUES,
(u8 *)&vqs, sizeof(vqs));
}
/**
* i40evf_map_queues
* @adapter: adapter structure
*
* Request that the PF map queues to interrupt vectors. Misc causes, including
* admin queue, are always mapped to vector 0.
**/
void i40evf_map_queues(struct i40evf_adapter *adapter)
{
struct i40e_virtchnl_irq_map_info *vimi;
int v_idx, q_vectors, len;
struct i40e_q_vector *q_vector;
if (adapter->current_op != I40E_VIRTCHNL_OP_UNKNOWN) {
/* bail because we already have a command pending */
dev_err(&adapter->pdev->dev, "%s: command %d pending\n",
__func__, adapter->current_op);
return;
}
adapter->current_op = I40E_VIRTCHNL_OP_CONFIG_IRQ_MAP;
q_vectors = adapter->num_msix_vectors - NONQ_VECS;
len = sizeof(struct i40e_virtchnl_irq_map_info) +
(adapter->num_msix_vectors *
sizeof(struct i40e_virtchnl_vector_map));
vimi = kzalloc(len, GFP_ATOMIC);
if (!vimi)
return;
vimi->num_vectors = adapter->num_msix_vectors;
/* Queue vectors first */
for (v_idx = 0; v_idx < q_vectors; v_idx++) {
q_vector = adapter->q_vector[v_idx];
vimi->vecmap[v_idx].vsi_id = adapter->vsi_res->vsi_id;
vimi->vecmap[v_idx].vector_id = v_idx + NONQ_VECS;
vimi->vecmap[v_idx].txq_map = q_vector->ring_mask;
vimi->vecmap[v_idx].rxq_map = q_vector->ring_mask;
}
/* Misc vector last - this is only for AdminQ messages */
vimi->vecmap[v_idx].vsi_id = adapter->vsi_res->vsi_id;
vimi->vecmap[v_idx].vector_id = 0;
vimi->vecmap[v_idx].txq_map = 0;
vimi->vecmap[v_idx].rxq_map = 0;
adapter->aq_pending |= I40EVF_FLAG_AQ_MAP_VECTORS;
adapter->aq_required &= ~I40EVF_FLAG_AQ_MAP_VECTORS;
i40evf_send_pf_msg(adapter, I40E_VIRTCHNL_OP_CONFIG_IRQ_MAP,
(u8 *)vimi, len);
kfree(vimi);
}
/**
* i40evf_add_ether_addrs
* @adapter: adapter structure
* @addrs: the MAC address filters to add (contiguous)
* @count: number of filters
*
* Request that the PF add one or more addresses to our filters.
**/
void i40evf_add_ether_addrs(struct i40evf_adapter *adapter)
{
struct i40e_virtchnl_ether_addr_list *veal;
int len, i = 0, count = 0;
struct i40evf_mac_filter *f;
if (adapter->current_op != I40E_VIRTCHNL_OP_UNKNOWN) {
/* bail because we already have a command pending */
dev_err(&adapter->pdev->dev, "%s: command %d pending\n",
__func__, adapter->current_op);
return;
}
list_for_each_entry(f, &adapter->mac_filter_list, list) {
if (f->add)
count++;
}
if (!count) {
adapter->aq_required &= ~I40EVF_FLAG_AQ_ADD_MAC_FILTER;
return;
}
adapter->current_op = I40E_VIRTCHNL_OP_ADD_ETHER_ADDRESS;
len = sizeof(struct i40e_virtchnl_ether_addr_list) +
(count * sizeof(struct i40e_virtchnl_ether_addr));
if (len > I40EVF_MAX_AQ_BUF_SIZE) {
dev_warn(&adapter->pdev->dev, "%s: Too many MAC address changes in one request\n",
__func__);
count = (I40EVF_MAX_AQ_BUF_SIZE -
sizeof(struct i40e_virtchnl_ether_addr_list)) /
sizeof(struct i40e_virtchnl_ether_addr);
len = I40EVF_MAX_AQ_BUF_SIZE;
}
veal = kzalloc(len, GFP_ATOMIC);
if (!veal)
return;
veal->vsi_id = adapter->vsi_res->vsi_id;
veal->num_elements = count;
list_for_each_entry(f, &adapter->mac_filter_list, list) {
if (f->add) {
ether_addr_copy(veal->list[i].addr, f->macaddr);
i++;
f->add = false;
}
}
adapter->aq_pending |= I40EVF_FLAG_AQ_ADD_MAC_FILTER;
adapter->aq_required &= ~I40EVF_FLAG_AQ_ADD_MAC_FILTER;
i40evf_send_pf_msg(adapter, I40E_VIRTCHNL_OP_ADD_ETHER_ADDRESS,
(u8 *)veal, len);
kfree(veal);
}
/**
* i40evf_del_ether_addrs
* @adapter: adapter structure
* @addrs: the MAC address filters to remove (contiguous)
* @count: number of filtes
*
* Request that the PF remove one or more addresses from our filters.
**/
void i40evf_del_ether_addrs(struct i40evf_adapter *adapter)
{
struct i40e_virtchnl_ether_addr_list *veal;
struct i40evf_mac_filter *f, *ftmp;
int len, i = 0, count = 0;
if (adapter->current_op != I40E_VIRTCHNL_OP_UNKNOWN) {
/* bail because we already have a command pending */
dev_err(&adapter->pdev->dev, "%s: command %d pending\n",
__func__, adapter->current_op);
return;
}
list_for_each_entry(f, &adapter->mac_filter_list, list) {
if (f->remove)
count++;
}
if (!count) {
adapter->aq_required &= ~I40EVF_FLAG_AQ_DEL_MAC_FILTER;
return;
}
adapter->current_op = I40E_VIRTCHNL_OP_DEL_ETHER_ADDRESS;
len = sizeof(struct i40e_virtchnl_ether_addr_list) +
(count * sizeof(struct i40e_virtchnl_ether_addr));
if (len > I40EVF_MAX_AQ_BUF_SIZE) {
dev_warn(&adapter->pdev->dev, "%s: Too many MAC address changes in one request\n",
__func__);
count = (I40EVF_MAX_AQ_BUF_SIZE -
sizeof(struct i40e_virtchnl_ether_addr_list)) /
sizeof(struct i40e_virtchnl_ether_addr);
len = I40EVF_MAX_AQ_BUF_SIZE;
}
veal = kzalloc(len, GFP_ATOMIC);
if (!veal)
return;
veal->vsi_id = adapter->vsi_res->vsi_id;
veal->num_elements = count;
list_for_each_entry_safe(f, ftmp, &adapter->mac_filter_list, list) {
if (f->remove) {
ether_addr_copy(veal->list[i].addr, f->macaddr);
i++;
list_del(&f->list);
kfree(f);
}
}
adapter->aq_pending |= I40EVF_FLAG_AQ_DEL_MAC_FILTER;
adapter->aq_required &= ~I40EVF_FLAG_AQ_DEL_MAC_FILTER;
i40evf_send_pf_msg(adapter, I40E_VIRTCHNL_OP_DEL_ETHER_ADDRESS,
(u8 *)veal, len);
kfree(veal);
}
/**
* i40evf_add_vlans
* @adapter: adapter structure
* @vlans: the VLANs to add
* @count: number of VLANs
*
* Request that the PF add one or more VLAN filters to our VSI.
**/
void i40evf_add_vlans(struct i40evf_adapter *adapter)
{
struct i40e_virtchnl_vlan_filter_list *vvfl;
int len, i = 0, count = 0;
struct i40evf_vlan_filter *f;
if (adapter->current_op != I40E_VIRTCHNL_OP_UNKNOWN) {
/* bail because we already have a command pending */
dev_err(&adapter->pdev->dev, "%s: command %d pending\n",
__func__, adapter->current_op);
return;
}
list_for_each_entry(f, &adapter->vlan_filter_list, list) {
if (f->add)
count++;
}
if (!count) {
adapter->aq_required &= ~I40EVF_FLAG_AQ_ADD_VLAN_FILTER;
return;
}
adapter->current_op = I40E_VIRTCHNL_OP_ADD_VLAN;
len = sizeof(struct i40e_virtchnl_vlan_filter_list) +
(count * sizeof(u16));
if (len > I40EVF_MAX_AQ_BUF_SIZE) {
dev_warn(&adapter->pdev->dev, "%s: Too many VLAN changes in one request\n",
__func__);
count = (I40EVF_MAX_AQ_BUF_SIZE -
sizeof(struct i40e_virtchnl_vlan_filter_list)) /
sizeof(u16);
len = I40EVF_MAX_AQ_BUF_SIZE;
}
vvfl = kzalloc(len, GFP_ATOMIC);
if (!vvfl)
return;
vvfl->vsi_id = adapter->vsi_res->vsi_id;
vvfl->num_elements = count;
list_for_each_entry(f, &adapter->vlan_filter_list, list) {
if (f->add) {
vvfl->vlan_id[i] = f->vlan;
i++;
f->add = false;
}
}
adapter->aq_pending |= I40EVF_FLAG_AQ_ADD_VLAN_FILTER;
adapter->aq_required &= ~I40EVF_FLAG_AQ_ADD_VLAN_FILTER;
i40evf_send_pf_msg(adapter, I40E_VIRTCHNL_OP_ADD_VLAN, (u8 *)vvfl, len);
kfree(vvfl);
}
/**
* i40evf_del_vlans
* @adapter: adapter structure
* @vlans: the VLANs to remove
* @count: number of VLANs
*
* Request that the PF remove one or more VLAN filters from our VSI.
**/
void i40evf_del_vlans(struct i40evf_adapter *adapter)
{
struct i40e_virtchnl_vlan_filter_list *vvfl;
struct i40evf_vlan_filter *f, *ftmp;
int len, i = 0, count = 0;
if (adapter->current_op != I40E_VIRTCHNL_OP_UNKNOWN) {
/* bail because we already have a command pending */
dev_err(&adapter->pdev->dev, "%s: command %d pending\n",
__func__, adapter->current_op);
return;
}
list_for_each_entry(f, &adapter->vlan_filter_list, list) {
if (f->remove)
count++;
}
if (!count) {
adapter->aq_required &= ~I40EVF_FLAG_AQ_DEL_VLAN_FILTER;
return;
}
adapter->current_op = I40E_VIRTCHNL_OP_DEL_VLAN;
len = sizeof(struct i40e_virtchnl_vlan_filter_list) +
(count * sizeof(u16));
if (len > I40EVF_MAX_AQ_BUF_SIZE) {
dev_warn(&adapter->pdev->dev, "%s: Too many VLAN changes in one request\n",
__func__);
count = (I40EVF_MAX_AQ_BUF_SIZE -
sizeof(struct i40e_virtchnl_vlan_filter_list)) /
sizeof(u16);
len = I40EVF_MAX_AQ_BUF_SIZE;
}
vvfl = kzalloc(len, GFP_ATOMIC);
if (!vvfl)
return;
vvfl->vsi_id = adapter->vsi_res->vsi_id;
vvfl->num_elements = count;
list_for_each_entry_safe(f, ftmp, &adapter->vlan_filter_list, list) {
if (f->remove) {
vvfl->vlan_id[i] = f->vlan;
i++;
list_del(&f->list);
kfree(f);
}
}
adapter->aq_pending |= I40EVF_FLAG_AQ_DEL_VLAN_FILTER;
adapter->aq_required &= ~I40EVF_FLAG_AQ_DEL_VLAN_FILTER;
i40evf_send_pf_msg(adapter, I40E_VIRTCHNL_OP_DEL_VLAN, (u8 *)vvfl, len);
kfree(vvfl);
}
/**
* i40evf_set_promiscuous
* @adapter: adapter structure
* @flags: bitmask to control unicast/multicast promiscuous.
*
* Request that the PF enable promiscuous mode for our VSI.
**/
void i40evf_set_promiscuous(struct i40evf_adapter *adapter, int flags)
{
struct i40e_virtchnl_promisc_info vpi;
if (adapter->current_op != I40E_VIRTCHNL_OP_UNKNOWN) {
/* bail because we already have a command pending */
dev_err(&adapter->pdev->dev, "%s: command %d pending\n",
__func__, adapter->current_op);
return;
}
adapter->current_op = I40E_VIRTCHNL_OP_CONFIG_PROMISCUOUS_MODE;
vpi.vsi_id = adapter->vsi_res->vsi_id;
vpi.flags = flags;
i40evf_send_pf_msg(adapter, I40E_VIRTCHNL_OP_CONFIG_PROMISCUOUS_MODE,
(u8 *)&vpi, sizeof(vpi));
}
/**
* i40evf_request_stats
* @adapter: adapter structure
*
* Request VSI statistics from PF.
**/
void i40evf_request_stats(struct i40evf_adapter *adapter)
{
struct i40e_virtchnl_queue_select vqs;
if (adapter->current_op != I40E_VIRTCHNL_OP_UNKNOWN) {
/* no error message, this isn't crucial */
return;
}
adapter->current_op = I40E_VIRTCHNL_OP_GET_STATS;
vqs.vsi_id = adapter->vsi_res->vsi_id;
/* queue maps are ignored for this message - only the vsi is used */
if (i40evf_send_pf_msg(adapter, I40E_VIRTCHNL_OP_GET_STATS,
(u8 *)&vqs, sizeof(vqs)))
/* if the request failed, don't lock out others */
adapter->current_op = I40E_VIRTCHNL_OP_UNKNOWN;
}
/**
* i40evf_request_reset
* @adapter: adapter structure
*
* Request that the PF reset this VF. No response is expected.
**/
void i40evf_request_reset(struct i40evf_adapter *adapter)
{
/* Don't check CURRENT_OP - this is always higher priority */
i40evf_send_pf_msg(adapter, I40E_VIRTCHNL_OP_RESET_VF, NULL, 0);
adapter->current_op = I40E_VIRTCHNL_OP_UNKNOWN;
}
/**
* i40evf_virtchnl_completion
* @adapter: adapter structure
* @v_opcode: opcode sent by PF
* @v_retval: retval sent by PF
* @msg: message sent by PF
* @msglen: message length
*
* Asynchronous completion function for admin queue messages. Rather than busy
* wait, we fire off our requests and assume that no errors will be returned.
* This function handles the reply messages.
**/
void i40evf_virtchnl_completion(struct i40evf_adapter *adapter,
enum i40e_virtchnl_ops v_opcode,
i40e_status v_retval,
u8 *msg, u16 msglen)
{
struct net_device *netdev = adapter->netdev;
if (v_opcode == I40E_VIRTCHNL_OP_EVENT) {
struct i40e_virtchnl_pf_event *vpe =
(struct i40e_virtchnl_pf_event *)msg;
switch (vpe->event) {
case I40E_VIRTCHNL_EVENT_LINK_CHANGE:
adapter->link_up =
vpe->event_data.link_event.link_status;
if (adapter->link_up && !netif_carrier_ok(netdev)) {
dev_info(&adapter->pdev->dev, "NIC Link is Up\n");
netif_carrier_on(netdev);
netif_tx_wake_all_queues(netdev);
} else if (!adapter->link_up) {
dev_info(&adapter->pdev->dev, "NIC Link is Down\n");
netif_carrier_off(netdev);
netif_tx_stop_all_queues(netdev);
}
break;
case I40E_VIRTCHNL_EVENT_RESET_IMPENDING:
dev_info(&adapter->pdev->dev, "PF reset warning received\n");
if (!(adapter->flags & I40EVF_FLAG_RESET_PENDING)) {
adapter->flags |= I40EVF_FLAG_RESET_PENDING;
dev_info(&adapter->pdev->dev, "Scheduling reset task\n");
schedule_work(&adapter->reset_task);
}
break;
default:
dev_err(&adapter->pdev->dev,
"%s: Unknown event %d from pf\n",
__func__, vpe->event);
break;
}
return;
}
if (v_retval) {
dev_err(&adapter->pdev->dev, "%s: PF returned error %d to our request %d\n",
__func__, v_retval, v_opcode);
}
switch (v_opcode) {
case I40E_VIRTCHNL_OP_VERSION:
/* no action, but also not an error */
break;
case I40E_VIRTCHNL_OP_GET_STATS: {
struct i40e_eth_stats *stats =
(struct i40e_eth_stats *)msg;
adapter->net_stats.rx_packets = stats->rx_unicast +
stats->rx_multicast +
stats->rx_broadcast;
adapter->net_stats.tx_packets = stats->tx_unicast +
stats->tx_multicast +
stats->tx_broadcast;
adapter->net_stats.rx_bytes = stats->rx_bytes;
adapter->net_stats.tx_bytes = stats->tx_bytes;
adapter->net_stats.tx_errors = stats->tx_errors;
adapter->net_stats.rx_dropped = stats->rx_discards;
adapter->net_stats.tx_dropped = stats->tx_discards;
adapter->current_stats = *stats;
}
break;
case I40E_VIRTCHNL_OP_ADD_ETHER_ADDRESS:
adapter->aq_pending &= ~(I40EVF_FLAG_AQ_ADD_MAC_FILTER);
break;
case I40E_VIRTCHNL_OP_DEL_ETHER_ADDRESS:
adapter->aq_pending &= ~(I40EVF_FLAG_AQ_DEL_MAC_FILTER);
break;
case I40E_VIRTCHNL_OP_ADD_VLAN:
adapter->aq_pending &= ~(I40EVF_FLAG_AQ_ADD_VLAN_FILTER);
break;
case I40E_VIRTCHNL_OP_DEL_VLAN:
adapter->aq_pending &= ~(I40EVF_FLAG_AQ_DEL_VLAN_FILTER);
break;
case I40E_VIRTCHNL_OP_ENABLE_QUEUES:
adapter->aq_pending &= ~(I40EVF_FLAG_AQ_ENABLE_QUEUES);
/* enable transmits */
i40evf_irq_enable(adapter, true);
netif_tx_start_all_queues(adapter->netdev);
netif_carrier_on(adapter->netdev);
break;
case I40E_VIRTCHNL_OP_DISABLE_QUEUES:
adapter->aq_pending &= ~(I40EVF_FLAG_AQ_DISABLE_QUEUES);
break;
case I40E_VIRTCHNL_OP_CONFIG_VSI_QUEUES:
adapter->aq_pending &= ~(I40EVF_FLAG_AQ_CONFIGURE_QUEUES);
break;
case I40E_VIRTCHNL_OP_CONFIG_IRQ_MAP:
adapter->aq_pending &= ~(I40EVF_FLAG_AQ_MAP_VECTORS);
break;
default:
dev_info(&adapter->pdev->dev, "Received unexpected message %d from PF\n",
v_opcode);
break;
} /* switch v_opcode */
adapter->current_op = I40E_VIRTCHNL_OP_UNKNOWN;
}
|
# coding: utf8
{
'!langcode!': 'fr',
'!langname!': 'Français',
'"update" is an optional expression like "field1=\'newvalue\'". You cannot update or delete the results of a JOIN': '"update" est une expression optionnelle comme "champ1=\'nouvellevaleur\'". Vous ne pouvez mettre à jour ou supprimer les résultats d\'un JOIN',
'%s %%{row} deleted': '%s lignes supprimées',
'%s %%{row} updated': '%s lignes mises à jour',
'%s selected': '%s sélectionné',
'%Y-%m-%d': '%Y-%m-%d',
'%Y-%m-%d %H:%M:%S': '%Y-%m-%d %H:%M:%S',
'About': 'À propos',
'Access Control': "Contrôle d'accès",
'Administrative Interface': "Interface d'administration",
'Administrative interface': "Interface d'administration",
'Ajax Recipes': 'Recettes Ajax',
'appadmin is disabled because insecure channel': "appadmin est désactivée parce que le canal n'est pas sécurisé",
'Are you sure you want to delete this object?': 'Êtes-vous sûr de vouloir supprimer cet objet?',
'Authentication': 'Authentification',
'Available Databases and Tables': 'Bases de données et tables disponibles',
'Buy this book': 'Acheter ce livre',
'cache': 'cache',
'Cache': 'Cache',
'Cache Keys': 'Clés de cache',
'Cannot be empty': 'Ne peut pas être vide',
'change password': 'changer le mot de passe',
'Check to delete': 'Cliquez pour supprimer',
'Check to delete:': 'Cliquez pour supprimer:',
'Clear CACHE?': 'Vider le CACHE?',
'Clear DISK': 'Vider le DISQUE',
'Clear RAM': 'Vider la RAM',
'Client IP': 'IP client',
'Community': 'Communauté',
'Components and Plugins': 'Composants et Plugins',
'Controller': 'Contrôleur',
'Copyright': 'Copyright',
'Created By': 'Créé par',
'Created On': 'Créé le',
'Current request': 'Demande actuelle',
'Current response': 'Réponse actuelle',
'Current session': 'Session en cours',
'customize me!': 'personnalisez-moi!',
'data uploaded': 'données téléchargées',
'Database': 'base de données',
'Database %s select': 'base de données %s selectionnée',
'db': 'bdd',
'DB Model': 'Modèle BDD',
'Delete:': 'Supprimer:',
'Demo': 'Démo',
'Deployment Recipes': 'Recettes de déploiement',
'Description': 'Description',
'design': 'design',
'DISK': 'DISQUE',
'Disk Cache Keys': 'Clés de cache du disque',
'Disk Cleared': 'Disque vidé',
'Documentation': 'Documentation',
"Don't know what to do?": 'Vous ne savez pas quoi faire?',
'done!': 'fait!',
'Download': 'Téléchargement',
'E-mail': 'E-mail',
'Edit': 'Éditer',
'Edit current record': "Modifier l'enregistrement courant",
'edit profile': 'modifier le profil',
'Edit This App': 'Modifier cette application',
'Email and SMS': 'Email et SMS',
'enter an integer between %(min)g and %(max)g': 'entrez un entier entre %(min)g et %(max)g',
'Errors': 'Erreurs',
'export as csv file': 'exporter sous forme de fichier csv',
'FAQ': 'FAQ',
'First name': 'Prénom',
'Forms and Validators': 'Formulaires et Validateurs',
'Free Applications': 'Applications gratuites',
'Function disabled': 'Fonction désactivée',
'Group ID': 'Groupe ID',
'Groups': 'Groupes',
'Hello World': 'Bonjour le monde',
'Home': 'Accueil',
'How did you get here?': 'Comment êtes-vous arrivé ici?',
'import': 'import',
'Import/Export': 'Importer/Exporter',
'Index': 'Index',
'insert new': 'insérer un nouveau',
'insert new %s': 'insérer un nouveau %s',
'Internal State': 'État interne',
'Introduction': 'Introduction',
'Invalid email': 'E-mail invalide',
'Invalid Query': 'Requête Invalide',
'invalid request': 'requête invalide',
'Is Active': 'Est actif',
'Key': 'Clé',
'Last name': 'Nom',
'Layout': 'Mise en page',
'Layout Plugins': 'Plugins de mise en page',
'Layouts': 'Mises en page',
'Live chat': 'Chat en direct',
'Live Chat': 'Chat en direct',
'login': 'connectez-vous',
'Login': 'Connectez-vous',
'logout': 'déconnectez-vous',
'lost password': 'mot de passe perdu',
'Lost Password': 'Mot de passe perdu',
'Lost password?': 'Mot de passe perdu?',
'lost password?': 'mot de passe perdu?',
'Main Menu': 'Menu principal',
'Manage Cache': 'Gérer le Cache',
'Menu Model': 'Menu modèle',
'Modified By': 'Modifié par',
'Modified On': 'Modifié le',
'My Sites': 'Mes sites',
'Name': 'Nom',
'New Record': 'Nouvel enregistrement',
'new record inserted': 'nouvel enregistrement inséré',
'next 100 rows': '100 prochaines lignes',
'No databases in this application': "Cette application n'a pas de bases de données",
'Object or table name': 'Objet ou nom de table',
'Online examples': 'Exemples en ligne',
'or import from csv file': "ou importer d'un fichier CSV",
'Origin': 'Origine',
'Other Plugins': 'Autres Plugins',
'Other Recipes': 'Autres recettes',
'Overview': 'Présentation',
'Password': 'Mot de passe',
"Password fields don't match": 'Les mots de passe ne correspondent pas',
'Plugins': 'Plugins',
'Powered by': 'Alimenté par',
'Preface': 'Préface',
'previous 100 rows': '100 lignes précédentes',
'Python': 'Python',
'Query:': 'Requête:',
'Quick Examples': 'Exemples Rapides',
'RAM': 'RAM',
'RAM Cache Keys': 'Clés de cache de la RAM',
'Ram Cleared': 'Ram vidée',
'Readme': 'Lisez-moi',
'Recipes': 'Recettes',
'Record': 'enregistrement',
'record does not exist': "l'archive n'existe pas",
'Record ID': "ID d'enregistrement",
'Record id': "id d'enregistrement",
'Register': "S'inscrire",
'register': "s'inscrire",
'Registration identifier': "Identifiant d'enregistrement",
'Registration key': "Clé d'enregistrement",
'Remember me (for 30 days)': 'Se souvenir de moi (pendant 30 jours)',
'Request reset password': 'Demande de réinitialiser le mot clé',
'Reset Password key': 'Réinitialiser le mot clé',
'Resources': 'Ressources',
'Role': 'Rôle',
'Rows in Table': 'Lignes du tableau',
'Rows selected': 'Lignes sélectionnées',
'Semantic': 'Sémantique',
'Services': 'Services',
'Size of cache:': 'Taille du cache:',
'state': 'état',
'Statistics': 'Statistiques',
'Stylesheet': 'Feuille de style',
'submit': 'soumettre',
'Submit': 'Soumettre',
'Support': 'Support',
'Sure you want to delete this object?': 'Êtes-vous sûr de vouloir supprimer cet objet?',
'Table': 'tableau',
'Table name': 'Nom du tableau',
'The "query" is a condition like "db.table1.field1==\'value\'". Something like "db.table1.field1==db.table2.field2" results in a SQL JOIN.': 'La "requête" est une condition comme "db.table1.champ1==\'valeur\'". Quelque chose comme "db.table1.champ1==db.table2.champ2" résulte en un JOIN SQL.',
'The Core': 'Le noyau',
'The output of the file is a dictionary that was rendered by the view %s': 'La sortie de ce fichier est un dictionnaire qui été restitué par la vue %s',
'The Views': 'Les Vues',
'This App': 'Cette Appli',
'This is a copy of the scaffolding application': "Ceci est une copie de l'application échafaudage",
'Time in Cache (h:m:s)': 'Temps en Cache (h:m:s)',
'Timestamp': 'Horodatage',
'Twitter': 'Twitter',
'unable to parse csv file': "incapable d'analyser le fichier cvs",
'Update:': 'Mise à jour:',
'Use (...)&(...) for AND, (...)|(...) for OR, and ~(...) for NOT to build more complex queries.': 'Employez (...)&(...) pour AND, (...)|(...) pour OR, and ~(...) pour NOT afin de construire des requêtes plus complexes.',
'User %(id)s Logged-in': 'Utilisateur %(id)s connecté',
'User %(id)s Registered': 'Utilisateur %(id)s enregistré',
'User ID': 'ID utilisateur',
'User Voice': "Voix de l'utilisateur",
'Verify Password': 'Vérifiez le mot de passe',
'Videos': 'Vidéos',
'View': 'Présentation',
'Web2py': 'Web2py',
'Welcome': 'Bienvenue',
'Welcome %s': 'Bienvenue %s',
'Welcome to web2py': 'Bienvenue à web2py',
'Welcome to web2py!': 'Bienvenue à web2py!',
'Which called the function %s located in the file %s': 'Qui a appelé la fonction %s se trouvant dans le fichier %s',
'You are successfully running web2py': 'Vous exécutez avec succès web2py',
'You can modify this application and adapt it to your needs': "Vous pouvez modifier cette application et l'adapter à vos besoins",
'You visited the url %s': "Vous avez visité l'URL %s",
}
|
package jsoniter
import (
"io"
)
// Stream is a io.Writer like object, with JSON specific write functions.
// Error is not returned as return value, but stored as Error member on this stream instance.
type Stream struct {
cfg *frozenConfig
out io.Writer
buf []byte
n int
Error error
indention int
}
// NewStream create new stream instance.
// cfg can be jsoniter.ConfigDefault.
// out can be nil if write to internal buffer.
// bufSize is the initial size for the internal buffer in bytes.
func NewStream(cfg API, out io.Writer, bufSize int) *Stream {
return &Stream{
cfg: cfg.(*frozenConfig),
out: out,
buf: make([]byte, bufSize),
n: 0,
Error: nil,
indention: 0,
}
}
// Pool returns a pool can provide more stream with same configuration
func (stream *Stream) Pool() StreamPool {
return stream.cfg
}
// Reset reuse this stream instance by assign a new writer
func (stream *Stream) Reset(out io.Writer) {
stream.out = out
stream.n = 0
}
// Available returns how many bytes are unused in the buffer.
func (stream *Stream) Available() int {
return len(stream.buf) - stream.n
}
// Buffered returns the number of bytes that have been written into the current buffer.
func (stream *Stream) Buffered() int {
return stream.n
}
// Buffer if writer is nil, use this method to take the result
func (stream *Stream) Buffer() []byte {
return stream.buf[:stream.n]
}
// Write writes the contents of p into the buffer.
// It returns the number of bytes written.
// If nn < len(p), it also returns an error explaining
// why the write is short.
func (stream *Stream) Write(p []byte) (nn int, err error) {
for len(p) > stream.Available() && stream.Error == nil {
if stream.out == nil {
stream.growAtLeast(len(p))
} else {
var n int
if stream.Buffered() == 0 {
// Large write, empty buffer.
// Write directly from p to avoid copy.
n, stream.Error = stream.out.Write(p)
} else {
n = copy(stream.buf[stream.n:], p)
stream.n += n
stream.Flush()
}
nn += n
p = p[n:]
}
}
if stream.Error != nil {
return nn, stream.Error
}
n := copy(stream.buf[stream.n:], p)
stream.n += n
nn += n
return nn, nil
}
// WriteByte writes a single byte.
func (stream *Stream) writeByte(c byte) {
if stream.Error != nil {
return
}
if stream.Available() < 1 {
stream.growAtLeast(1)
}
stream.buf[stream.n] = c
stream.n++
}
func (stream *Stream) writeTwoBytes(c1 byte, c2 byte) {
if stream.Error != nil {
return
}
if stream.Available() < 2 {
stream.growAtLeast(2)
}
stream.buf[stream.n] = c1
stream.buf[stream.n+1] = c2
stream.n += 2
}
func (stream *Stream) writeThreeBytes(c1 byte, c2 byte, c3 byte) {
if stream.Error != nil {
return
}
if stream.Available() < 3 {
stream.growAtLeast(3)
}
stream.buf[stream.n] = c1
stream.buf[stream.n+1] = c2
stream.buf[stream.n+2] = c3
stream.n += 3
}
func (stream *Stream) writeFourBytes(c1 byte, c2 byte, c3 byte, c4 byte) {
if stream.Error != nil {
return
}
if stream.Available() < 4 {
stream.growAtLeast(4)
}
stream.buf[stream.n] = c1
stream.buf[stream.n+1] = c2
stream.buf[stream.n+2] = c3
stream.buf[stream.n+3] = c4
stream.n += 4
}
func (stream *Stream) writeFiveBytes(c1 byte, c2 byte, c3 byte, c4 byte, c5 byte) {
if stream.Error != nil {
return
}
if stream.Available() < 5 {
stream.growAtLeast(5)
}
stream.buf[stream.n] = c1
stream.buf[stream.n+1] = c2
stream.buf[stream.n+2] = c3
stream.buf[stream.n+3] = c4
stream.buf[stream.n+4] = c5
stream.n += 5
}
// Flush writes any buffered data to the underlying io.Writer.
func (stream *Stream) Flush() error {
if stream.out == nil {
return nil
}
if stream.Error != nil {
return stream.Error
}
if stream.n == 0 {
return nil
}
n, err := stream.out.Write(stream.buf[0:stream.n])
if n < stream.n && err == nil {
err = io.ErrShortWrite
}
if err != nil {
if n > 0 && n < stream.n {
copy(stream.buf[0:stream.n-n], stream.buf[n:stream.n])
}
stream.n -= n
stream.Error = err
return err
}
stream.n = 0
return nil
}
func (stream *Stream) ensure(minimal int) {
available := stream.Available()
if available < minimal {
stream.growAtLeast(minimal)
}
}
func (stream *Stream) growAtLeast(minimal int) {
if stream.out != nil {
stream.Flush()
}
toGrow := len(stream.buf)
if toGrow < minimal {
toGrow = minimal
}
newBuf := make([]byte, len(stream.buf)+toGrow)
copy(newBuf, stream.Buffer())
stream.buf = newBuf
}
// WriteRaw write string out without quotes, just like []byte
func (stream *Stream) WriteRaw(s string) {
stream.ensure(len(s))
if stream.Error != nil {
return
}
n := copy(stream.buf[stream.n:], s)
stream.n += n
}
// WriteNil write null to stream
func (stream *Stream) WriteNil() {
stream.writeFourBytes('n', 'u', 'l', 'l')
}
// WriteTrue write true to stream
func (stream *Stream) WriteTrue() {
stream.writeFourBytes('t', 'r', 'u', 'e')
}
// WriteFalse write false to stream
func (stream *Stream) WriteFalse() {
stream.writeFiveBytes('f', 'a', 'l', 's', 'e')
}
// WriteBool write true or false into stream
func (stream *Stream) WriteBool(val bool) {
if val {
stream.WriteTrue()
} else {
stream.WriteFalse()
}
}
// WriteObjectStart write { with possible indention
func (stream *Stream) WriteObjectStart() {
stream.indention += stream.cfg.indentionStep
stream.writeByte('{')
stream.writeIndention(0)
}
// WriteObjectField write "field": with possible indention
func (stream *Stream) WriteObjectField(field string) {
stream.WriteString(field)
if stream.indention > 0 {
stream.writeTwoBytes(':', ' ')
} else {
stream.writeByte(':')
}
}
// WriteObjectEnd write } with possible indention
func (stream *Stream) WriteObjectEnd() {
stream.writeIndention(stream.cfg.indentionStep)
stream.indention -= stream.cfg.indentionStep
stream.writeByte('}')
}
// WriteEmptyObject write {}
func (stream *Stream) WriteEmptyObject() {
stream.writeByte('{')
stream.writeByte('}')
}
// WriteMore write , with possible indention
func (stream *Stream) WriteMore() {
stream.writeByte(',')
stream.writeIndention(0)
}
// WriteArrayStart write [ with possible indention
func (stream *Stream) WriteArrayStart() {
stream.indention += stream.cfg.indentionStep
stream.writeByte('[')
stream.writeIndention(0)
}
// WriteEmptyArray write []
func (stream *Stream) WriteEmptyArray() {
stream.writeByte('[')
stream.writeByte(']')
}
// WriteArrayEnd write ] with possible indention
func (stream *Stream) WriteArrayEnd() {
stream.writeIndention(stream.cfg.indentionStep)
stream.indention -= stream.cfg.indentionStep
stream.writeByte(']')
}
func (stream *Stream) writeIndention(delta int) {
if stream.indention == 0 {
return
}
stream.writeByte('\n')
toWrite := stream.indention - delta
stream.ensure(toWrite)
for i := 0; i < toWrite && stream.n < len(stream.buf); i++ {
stream.buf[stream.n] = ' '
stream.n++
}
}
|
package dbus
import (
"sync"
)
// NewSequentialSignalHandler returns an instance of a new
// signal handler that guarantees sequential processing of signals. It is a
// guarantee of this signal handler that signals will be written to
// channels in the order they are received on the DBus connection.
func NewSequentialSignalHandler() SignalHandler {
return &sequentialSignalHandler{}
}
type sequentialSignalHandler struct {
mu sync.RWMutex
closed bool
signals []*sequentialSignalChannelData
}
func (sh *sequentialSignalHandler) DeliverSignal(intf, name string, signal *Signal) {
sh.mu.RLock()
defer sh.mu.RUnlock()
if sh.closed {
return
}
for _, scd := range sh.signals {
scd.deliver(signal)
}
}
func (sh *sequentialSignalHandler) Terminate() {
sh.mu.Lock()
defer sh.mu.Unlock()
if sh.closed {
return
}
for _, scd := range sh.signals {
scd.close()
close(scd.ch)
}
sh.closed = true
sh.signals = nil
}
func (sh *sequentialSignalHandler) AddSignal(ch chan<- *Signal) {
sh.mu.Lock()
defer sh.mu.Unlock()
if sh.closed {
return
}
sh.signals = append(sh.signals, newSequentialSignalChannelData(ch))
}
func (sh *sequentialSignalHandler) RemoveSignal(ch chan<- *Signal) {
sh.mu.Lock()
defer sh.mu.Unlock()
if sh.closed {
return
}
for i := len(sh.signals) - 1; i >= 0; i-- {
if ch == sh.signals[i].ch {
sh.signals[i].close()
copy(sh.signals[i:], sh.signals[i+1:])
sh.signals[len(sh.signals)-1] = nil
sh.signals = sh.signals[:len(sh.signals)-1]
}
}
}
type sequentialSignalChannelData struct {
ch chan<- *Signal
in chan *Signal
done chan struct{}
}
func newSequentialSignalChannelData(ch chan<- *Signal) *sequentialSignalChannelData {
scd := &sequentialSignalChannelData{
ch: ch,
in: make(chan *Signal),
done: make(chan struct{}),
}
go scd.bufferSignals()
return scd
}
func (scd *sequentialSignalChannelData) bufferSignals() {
defer close(scd.done)
// Ensure that signals are delivered to scd.ch in the same
// order they are received from scd.in.
var queue []*Signal
for {
if len(queue) == 0 {
signal, ok := <- scd.in
if !ok {
return
}
queue = append(queue, signal)
}
select {
case scd.ch <- queue[0]:
copy(queue, queue[1:])
queue[len(queue)-1] = nil
queue = queue[:len(queue)-1]
case signal, ok := <-scd.in:
if !ok {
return
}
queue = append(queue, signal)
}
}
}
func (scd *sequentialSignalChannelData) deliver(signal *Signal) {
scd.in <- signal
}
func (scd *sequentialSignalChannelData) close() {
close(scd.in)
// Ensure that bufferSignals() has exited and won't attempt
// any future sends on scd.ch
<-scd.done
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.