text
stringlengths 3
1.04M
|
---|
# Valsa germanica Nitschke, 1870 SPECIES
#### Status
ACCEPTED
#### According to
The Catalogue of Life, 3rd January 2011
#### Published in
Pyrenomycetes Germanici 2: 215 (1870)
#### Original name
Valsa germanica Nitschke, 1870
### Remarks
null |
Calling Dr. Laura by Nicole J. Georges is a graphic memoir that explores the author learning, from a psychic no less, that her father has not passed away from colon cancer like her mother and sisters have always told her, and follows the subsequent reordering of her understanding of her family. It yokes together the aspects of Alison Bechdel’s Fun Home and David Small’s Stitches that made them so notable – a careful detailing of the author’s childhood and resulting affect on their future lives as relayed by a loose frame narrative set in a sort-of-present.
The title – Calling Dr. Laura – comes from Georges calling Dr. Laura Schlessinger’s conservative radio advice show (and one of the most hilarious images in the entire book is Georges representation of Schlessinger as the sister in Dinosaurs) as she tries to come to terms with the fact that her mother and sisters lied to her. She includes the transcript of the phone call, having recorded it as it took place. As a character in her memoir, Georges illustrates herself tucking the tape recording of the phone call away and hiding it from her girlfriend Radar.
Georges begins the book in Portland, OR, where she lives with a handful of dogs, chickens, and a new rescue chicken named Mabel. Her artistic style changes as the book jumps back and forth from past to present, and her depiction of her childhood is rendered in a less descriptive and more iconic way, which suits her younger age and the material presented. Georges depicts a series of boyfriends and husbands that her mother was attached to while she grew up, many of them distant and one abusive. Each of these men gives the young Georges a present – a stuffed animal by at least two and a dog from another – and her mother insists that Georges name the gift after the boyfriend/husband who gave it to her. I thought it was hilarious to see Georges’ collection of animals growing, each one named after a man who had quickly been inched out of her mother’s life.
Relationships are at the heart of Georges’ memoir: with her mother, her two half-sisters who are ten and twelve years older than she is, her girlfriend Radar, her close friends, her dogs, and her amorphous, unknowable father. Georges is stuck up in the middle, trying to make sense of how she stands in relation to the people she loves, and how she can carve out her own identity when there are so many different ones that others want her to subscribe to.
It is an intriguing story and beautifully illustrated book. I really loved Georges’ artistic style and the times that she illustrates scenes set in Portland were some of my favorite. Although Dr. Laura is integral to the title, she only occupies a small series of pages near the end of the book (where the transcript of their phone call conversation is included), but her importance to Georges as an outlet for advice at a difficult time is notable. Likewise, the psychic who gets so much wrong about Georges gets one very important thing right – her father is still alive. The ending is almost heartbreaking, and the story as a whole is well worth the read. |
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "third_party/blink/renderer/core/url/url_search_params.h"
#include <algorithm>
#include <utility>
#include "third_party/blink/renderer/bindings/core/v8/v8_union_usvstring_usvstringsequencesequence_usvstringusvstringrecord.h"
#include "third_party/blink/renderer/core/url/dom_url.h"
#include "third_party/blink/renderer/platform/bindings/exception_messages.h"
#include "third_party/blink/renderer/platform/network/form_data_encoder.h"
#include "third_party/blink/renderer/platform/weborigin/kurl.h"
#include "third_party/blink/renderer/platform/wtf/text/text_encoding.h"
namespace blink {
namespace {
class URLSearchParamsIterationSource final
: public PairIterable<String, IDLString, String, IDLString>::
IterationSource {
public:
explicit URLSearchParamsIterationSource(URLSearchParams* params)
: params_(params), current_(0) {}
bool Next(ScriptState*,
String& key,
String& value,
ExceptionState&) override {
if (current_ >= params_->Params().size())
return false;
key = params_->Params()[current_].first;
value = params_->Params()[current_].second;
current_++;
return true;
}
void Trace(Visitor* visitor) const override {
visitor->Trace(params_);
PairIterable<String, IDLString, String, IDLString>::IterationSource::Trace(
visitor);
}
private:
Member<URLSearchParams> params_;
wtf_size_t current_;
};
bool CompareParams(const std::pair<String, String>& a,
const std::pair<String, String>& b) {
return WTF::CodeUnitCompareLessThan(a.first, b.first);
}
} // namespace
URLSearchParams* URLSearchParams::Create(const URLSearchParamsInit* init,
ExceptionState& exception_state) {
DCHECK(init);
switch (init->GetContentType()) {
case URLSearchParamsInit::ContentType::kUSVString: {
const String& query_string = init->GetAsUSVString();
if (query_string.StartsWith('?'))
return MakeGarbageCollected<URLSearchParams>(query_string.Substring(1));
return MakeGarbageCollected<URLSearchParams>(query_string);
}
case URLSearchParamsInit::ContentType::kUSVStringSequenceSequence:
return URLSearchParams::Create(init->GetAsUSVStringSequenceSequence(),
exception_state);
case URLSearchParamsInit::ContentType::kUSVStringUSVStringRecord:
return URLSearchParams::Create(init->GetAsUSVStringUSVStringRecord(),
exception_state);
}
NOTREACHED();
return nullptr;
}
URLSearchParams* URLSearchParams::Create(const Vector<Vector<String>>& init,
ExceptionState& exception_state) {
URLSearchParams* instance = MakeGarbageCollected<URLSearchParams>(String());
if (!init.size())
return instance;
for (unsigned i = 0; i < init.size(); ++i) {
const Vector<String>& pair = init[i];
if (pair.size() != 2) {
exception_state.ThrowTypeError(ExceptionMessages::FailedToConstruct(
"URLSearchParams",
"Sequence initializer must only contain pair elements"));
return nullptr;
}
instance->AppendWithoutUpdate(pair[0], pair[1]);
}
return instance;
}
URLSearchParams::URLSearchParams(const String& query_string, DOMURL* url_object)
: url_object_(url_object) {
if (!query_string.IsEmpty())
SetInputWithoutUpdate(query_string);
}
URLSearchParams* URLSearchParams::Create(
const Vector<std::pair<String, String>>& init,
ExceptionState& exception_state) {
URLSearchParams* instance = MakeGarbageCollected<URLSearchParams>(String());
if (init.IsEmpty())
return instance;
for (const auto& item : init)
instance->AppendWithoutUpdate(item.first, item.second);
return instance;
}
URLSearchParams::~URLSearchParams() = default;
void URLSearchParams::Trace(Visitor* visitor) const {
visitor->Trace(url_object_);
ScriptWrappable::Trace(visitor);
}
#if DCHECK_IS_ON()
DOMURL* URLSearchParams::UrlObject() const {
return url_object_;
}
#endif
void URLSearchParams::RunUpdateSteps() {
if (!url_object_)
return;
if (url_object_->IsInUpdate())
return;
url_object_->SetSearchInternal(toString());
}
static String DecodeString(String input) {
// |DecodeURLMode::kUTF8| is used because "UTF-8 decode without BOM" should
// be performed (see https://url.spec.whatwg.org/#concept-urlencoded-parser).
return DecodeURLEscapeSequences(input.Replace('+', ' '),
DecodeURLMode::kUTF8);
}
void URLSearchParams::SetInputWithoutUpdate(const String& query_string) {
params_.clear();
wtf_size_t start = 0;
wtf_size_t query_string_length = query_string.length();
while (start < query_string_length) {
wtf_size_t name_start = start;
wtf_size_t name_value_end = query_string.find('&', start);
if (name_value_end == kNotFound)
name_value_end = query_string_length;
if (name_value_end > start) {
wtf_size_t end_of_name = query_string.find('=', start);
if (end_of_name == kNotFound || end_of_name > name_value_end)
end_of_name = name_value_end;
String name = DecodeString(
query_string.Substring(name_start, end_of_name - name_start));
String value;
if (end_of_name != name_value_end)
value = DecodeString(query_string.Substring(
end_of_name + 1, name_value_end - end_of_name - 1));
if (value.IsNull())
value = "";
AppendWithoutUpdate(name, value);
}
start = name_value_end + 1;
}
}
String URLSearchParams::toString() const {
Vector<char> encoded_data;
EncodeAsFormData(encoded_data);
return String(encoded_data.data(), encoded_data.size());
}
void URLSearchParams::AppendWithoutUpdate(const String& name,
const String& value) {
params_.push_back(std::make_pair(name, value));
}
void URLSearchParams::append(const String& name, const String& value) {
AppendWithoutUpdate(name, value);
RunUpdateSteps();
}
void URLSearchParams::deleteAllWithName(const String& name) {
for (wtf_size_t i = 0; i < params_.size();) {
if (params_[i].first == name)
params_.EraseAt(i);
else
i++;
}
RunUpdateSteps();
}
String URLSearchParams::get(const String& name) const {
for (const auto& param : params_) {
if (param.first == name)
return param.second;
}
return String();
}
Vector<String> URLSearchParams::getAll(const String& name) const {
Vector<String> result;
for (const auto& param : params_) {
if (param.first == name)
result.push_back(param.second);
}
return result;
}
bool URLSearchParams::has(const String& name) const {
for (const auto& param : params_) {
if (param.first == name)
return true;
}
return false;
}
void URLSearchParams::set(const String& name, const String& value) {
bool found_match = false;
for (wtf_size_t i = 0; i < params_.size();) {
// If there are any name-value whose name is 'name', set
// the value of the first such name-value pair to 'value'
// and remove the others.
if (params_[i].first == name) {
if (!found_match) {
params_[i++].second = value;
found_match = true;
} else {
params_.EraseAt(i);
}
} else {
i++;
}
}
// Otherwise, append a new name-value pair to the list.
if (!found_match)
append(name, value);
else
RunUpdateSteps();
}
void URLSearchParams::sort() {
std::stable_sort(params_.begin(), params_.end(), CompareParams);
RunUpdateSteps();
}
void URLSearchParams::EncodeAsFormData(Vector<char>& encoded_data) const {
for (const auto& param : params_)
FormDataEncoder::AddKeyValuePairAsFormData(
encoded_data, param.first.Utf8(), param.second.Utf8(),
EncodedFormData::kFormURLEncoded, FormDataEncoder::kDoNotNormalizeCRLF);
}
scoped_refptr<EncodedFormData> URLSearchParams::ToEncodedFormData() const {
Vector<char> encoded_data;
EncodeAsFormData(encoded_data);
return EncodedFormData::Create(encoded_data.data(), encoded_data.size());
}
PairIterable<String, IDLString, String, IDLString>::IterationSource*
URLSearchParams::StartIteration(ScriptState*, ExceptionState&) {
return MakeGarbageCollected<URLSearchParamsIterationSource>(this);
}
} // namespace blink
|
<!DOCTYPE html>
<!--[if IE]><![endif]-->
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Class Memory
</title>
<meta name="viewport" content="width=device-width">
<meta name="title" content="Class Memory
">
<meta name="generator" content="docfx 2.59.0.0">
<link rel="shortcut icon" href="../favicon.ico">
<link rel="stylesheet" href="../styles/docfx.vendor.css">
<link rel="stylesheet" href="../styles/docfx.css">
<link rel="stylesheet" href="../styles/main.css">
<meta property="docfx:navrel" content="../toc.html">
<meta property="docfx:tocrel" content="toc.html">
</head>
<body data-spy="scroll" data-target="#affix" data-offset="120">
<div id="wrapper">
<header>
<nav id="autocollapse" class="navbar navbar-inverse ng-scope" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="../index.html">
<img id="logo" class="svg" src="../logo.svg" alt="">
</a>
</div>
<div class="collapse navbar-collapse" id="navbar">
<form class="navbar-form navbar-right" role="search" id="search">
<div class="form-group">
<input type="text" class="form-control" id="search-query" placeholder="Search" autocomplete="off">
</div>
</form>
</div>
</div>
</nav>
<div class="subnav navbar navbar-default">
<div class="container hide-when-search" id="breadcrumb">
<ul class="breadcrumb">
<li></li>
</ul>
</div>
</div>
</header>
<div role="main" class="container body-content hide-when-search">
<div class="sidenav hide-when-search">
<a class="btn toc-toggle collapse" data-toggle="collapse" href="#sidetoggle" aria-expanded="false" aria-controls="sidetoggle">Show / Hide Table of Contents</a>
<div class="sidetoggle collapse" id="sidetoggle">
<div id="sidetoc"></div>
</div>
</div>
<div class="article row grid-right">
<div class="col-md-10">
<article class="content wrap" id="_content" data-uid="HarmonyLib.Memory">
<h1 id="HarmonyLib_Memory" data-uid="HarmonyLib.Memory" class="text-break">Class Memory
</h1>
<div class="markdown level0 summary"><p>A low level memory helper</p>
</div>
<div class="markdown level0 conceptual"></div>
<div class="inheritance">
<h5>Inheritance</h5>
<div class="level0"><span class="xref">System.Object</span></div>
<div class="level1"><span class="xref">Memory</span></div>
</div>
<div class="inheritedMembers">
<h5>Inherited Members</h5>
<div>
<span class="xref">System.Object.ToString()</span>
</div>
<div>
<span class="xref">System.Object.Equals(System.Object)</span>
</div>
<div>
<span class="xref">System.Object.Equals(System.Object, System.Object)</span>
</div>
<div>
<span class="xref">System.Object.ReferenceEquals(System.Object, System.Object)</span>
</div>
<div>
<span class="xref">System.Object.GetHashCode()</span>
</div>
<div>
<span class="xref">System.Object.GetType()</span>
</div>
<div>
<span class="xref">System.Object.MemberwiseClone()</span>
</div>
</div>
<h6><strong>Namespace</strong>: <a class="xref" href="HarmonyLib.html">HarmonyLib</a></h6>
<h6><strong>Assembly</strong>: 0Harmony.dll</h6>
<h5 id="HarmonyLib_Memory_syntax">Syntax</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static class Memory</code></pre>
</div>
<h3 id="methods">Methods
</h3>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/pardeike/Harmony/new/master/apiSpec/new?filename=HarmonyLib_Memory_DetourMethod_System_Reflection_MethodBase_System_Reflection_MethodBase_.md&value=---%0Auid%3A%20HarmonyLib.Memory.DetourMethod(System.Reflection.MethodBase%2CSystem.Reflection.MethodBase)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/pardeike/Harmony/blob/master/Harmony/Internal/Memory.cs/#L34">View Source</a>
</span>
<a id="HarmonyLib_Memory_DetourMethod_" data-uid="HarmonyLib.Memory.DetourMethod*"></a>
<h4 id="HarmonyLib_Memory_DetourMethod_System_Reflection_MethodBase_System_Reflection_MethodBase_" data-uid="HarmonyLib.Memory.DetourMethod(System.Reflection.MethodBase,System.Reflection.MethodBase)">DetourMethod(MethodBase, MethodBase)</h4>
<div class="markdown level1 summary"><p>Detours a method</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static string DetourMethod(MethodBase original, MethodBase replacement)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Reflection.MethodBase</span></td>
<td><span class="parametername">original</span></td>
<td><p>The original method/constructor</p>
</td>
</tr>
<tr>
<td><span class="xref">System.Reflection.MethodBase</span></td>
<td><span class="parametername">replacement</span></td>
<td><p>The replacement method/constructor</p>
</td>
</tr>
</tbody>
</table>
<h5 class="returns">Returns</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.String</span></td>
<td><p>An error string</p>
</td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/pardeike/Harmony/new/master/apiSpec/new?filename=HarmonyLib_Memory_GetMethodStart_System_Reflection_MethodBase_System_Exception__.md&value=---%0Auid%3A%20HarmonyLib.Memory.GetMethodStart(System.Reflection.MethodBase%2CSystem.Exception%40)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/pardeike/Harmony/blob/master/Harmony/Internal/Memory.cs/#L129">View Source</a>
</span>
<a id="HarmonyLib_Memory_GetMethodStart_" data-uid="HarmonyLib.Memory.GetMethodStart*"></a>
<h4 id="HarmonyLib_Memory_GetMethodStart_System_Reflection_MethodBase_System_Exception__" data-uid="HarmonyLib.Memory.GetMethodStart(System.Reflection.MethodBase,System.Exception@)">GetMethodStart(MethodBase, out Exception)</h4>
<div class="markdown level1 summary"><p>Gets the start of a method in memory</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static long GetMethodStart(MethodBase method, out Exception exception)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Reflection.MethodBase</span></td>
<td><span class="parametername">method</span></td>
<td><p>The method/constructor</p>
</td>
</tr>
<tr>
<td><span class="xref">System.Exception</span></td>
<td><span class="parametername">exception</span></td>
<td><p>[out] Details of the exception</p>
</td>
</tr>
</tbody>
</table>
<h5 class="returns">Returns</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int64</span></td>
<td><p>The method start address</p>
</td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/pardeike/Harmony/new/master/apiSpec/new?filename=HarmonyLib_Memory_MarkForNoInlining_System_Reflection_MethodBase_.md&value=---%0Auid%3A%20HarmonyLib.Memory.MarkForNoInlining(System.Reflection.MethodBase)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/pardeike/Harmony/blob/master/Harmony/Internal/Memory.cs/#L19">View Source</a>
</span>
<a id="HarmonyLib_Memory_MarkForNoInlining_" data-uid="HarmonyLib.Memory.MarkForNoInlining*"></a>
<h4 id="HarmonyLib_Memory_MarkForNoInlining_System_Reflection_MethodBase_" data-uid="HarmonyLib.Memory.MarkForNoInlining(System.Reflection.MethodBase)">MarkForNoInlining(MethodBase)</h4>
<div class="markdown level1 summary"><p>Mark method for no inlining (currently only works on Mono)</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static void MarkForNoInlining(MethodBase method)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Reflection.MethodBase</span></td>
<td><span class="parametername">method</span></td>
<td><p>The method/constructor to change</p>
</td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/pardeike/Harmony/new/master/apiSpec/new?filename=HarmonyLib_Memory_WriteJump_System_Int64_System_Int64_.md&value=---%0Auid%3A%20HarmonyLib.Memory.WriteJump(System.Int64%2CSystem.Int64)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/pardeike/Harmony/blob/master/Harmony/Internal/Memory.cs/#L113">View Source</a>
</span>
<a id="HarmonyLib_Memory_WriteJump_" data-uid="HarmonyLib.Memory.WriteJump*"></a>
<h4 id="HarmonyLib_Memory_WriteJump_System_Int64_System_Int64_" data-uid="HarmonyLib.Memory.WriteJump(System.Int64,System.Int64)">WriteJump(Int64, Int64)</h4>
<div class="markdown level1 summary"><p>Writes a jump to memory</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static string WriteJump(long memory, long destination)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int64</span></td>
<td><span class="parametername">memory</span></td>
<td><p>The memory address</p>
</td>
</tr>
<tr>
<td><span class="xref">System.Int64</span></td>
<td><span class="parametername">destination</span></td>
<td><p>Jump destination</p>
</td>
</tr>
</tbody>
</table>
<h5 class="returns">Returns</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.String</span></td>
<td><p>An error string</p>
</td>
</tr>
</tbody>
</table>
</article>
</div>
<div class="hidden-sm col-md-2" role="complementary">
<div class="sideaffix">
<div class="contribution">
<ul class="nav">
<li>
<a href="https://github.com/pardeike/Harmony/new/master/apiSpec/new?filename=HarmonyLib_Memory.md&value=---%0Auid%3A%20HarmonyLib.Memory%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A" class="contribution-link">Improve this Doc</a>
</li>
<li>
<a href="https://github.com/pardeike/Harmony/blob/master/Harmony/Internal/Memory.cs/#L12" class="contribution-link">View Source</a>
</li>
</ul>
</div>
<nav class="bs-docs-sidebar hidden-print hidden-xs hidden-sm affix" id="affix">
<h5>In This Article</h5>
<div></div>
</nav>
</div>
</div>
</div>
</div>
<footer>
<div class="grad-bottom"></div>
<div class="footer">
<div class="container">
<span class="pull-right">
<a href="#top">Back to top</a>
</span>
<span>Generated by <strong>DocFX</strong></span>
</div>
</div>
</footer>
</div>
<script type="text/javascript" src="../styles/docfx.vendor.js"></script>
<script type="text/javascript" src="../styles/docfx.js"></script>
<script type="text/javascript" src="../styles/main.js"></script>
</body>
</html>
|
Minnesota State University, Mankato and Wells Fargo have teamed up to offer you optional banking convenience with your linked MavCARD. Use it as your official student ID, for campus privileges, and for your day-to-day financial needs on and off campus when it’s linked to a Wells Fargo Everyday Checking account. Enjoy no-fee access to Wells Fargo ATMs nationwide, including the Wells Fargo ATM on campus. Make purchases using your Personal Identification Number (PIN) with your linked MavCARD. Take advantage of this optional benefit today.
Monthly service fee waived when linked to your MavCARD.
Get access to Wells Fargo ATMs when you don’t have your MavCARD by requesting an ATM Access Code in the Wells Fargo Mobile® app.
Visit the MavCARD Office at 117 Centennial Student Union to begin the MavCARD process.
Your linked MavCARD also comes with Zero Liability protection at no extra cost which means you will be reimbursed for any promptly reported unauthorized card transactions.
You must notify Minnesota State University by visiting or calling the MavCARD Office where you can obtain a replacement card.
For more information about a lost or stolen MavCARD and your MavCASH account please visit www.mnsu.edu/mavcard/loststolen/.
Your Everyday Checking account will receive a monthly service fee waiver within 45 days of linking your MavCARD to that account. See a Wells Fargo banker for more information about other fees that may apply.
Wells Fargo may provide financial support to Minnesota State University, Mankato for services associated with the MavCARD. |
Free Member - Hubei Aoks Trade co.,ltd.
HUBEI AOKS TRADE CO.,LTD is located in Hubei province of China.We specialized in Active pharmaceutical ingredient,pharmaceutical intermediates,veterinary drug intermediates and dyes intermediates,such as phenylacetamide, dimethylamine hcl, benzyl chloride etc. We have strong professional research and development team, talented personnel and completely equipped laboratory for the quality controlling.We offer OEM service,if you have a good plan in new product production but lack of laboratory device and human resource, we are glad to sovle this problem for you. “Quality Best,Customer First” is what we adhering all the time,we have enjoyed a high reputation in the world market,mainly North America,Eastern Europe,Western Europe,South America and Southeast Asia. Our business is based on honesty and mutual-trust.Sincerely looking forward to establish long-term and mutual beneficial business relationship with worldwide customers. |
Partnering with Sopar International means choosing incomparable brands and unique expertise.
You have questions or comments about our products and services? Please fill out the following form and we will contact you very soon. |
The Coca-Cola Company (NYSE:KO) is scheduled to announce its first quarter results on April 24, and even though the core performance might remain solid, the top line is expected to take a hit due to the refranchising of bottling operations across geographies. This factor negatively impacted its fourth quarter 2017 results as well, when net revenue fell 20%, driven by a 26-point headwind from refranchising. Meanwhile, the margins continued their upward trajectory as a result of the divestiture from the bottling business. The comparable operating margin came in 530 points higher than the prior-year quarter. The performance in the quarter is expected to be similar to the ones reported by the company in the recent past, with revenue growth (excluding the impact of refranchising) being driven by price increases and product mix, with a diversified portfolio trying to make up for the loss in sales from traditional carbonated drinks. The revenue growth is expected to be driven by products such as Coca-Cola Zero Sugar, FUZE Tea, AdeS plant-based beverages, and smartwater, while earnings growth will be spurred by increasing sales, a reduced tax rate, share buybacks, and operating margin expansion as a result of its refranchising efforts.
We have a $49 price estimate for Coca-Cola, which is higher than the current market price. The charts have been made using our new, interactive platform. The various driver assumptions can be modified by clicking here, to gauge their impact on the earnings and price per share metric.
Coca-Cola Zero Sugar, as of February 2018, has been launched in 20 markets, with a reformulated product, evolved marketing, and new packaging. The brand witnessed positive results, reflected in the double-digit revenue growth. The company reported that the relaunch of the product drove almost 10 points of growth in the fourth quarter of FY 2017. This brand along with others, such as its water portfolio, ready-to-drink-tea and coffee, etc. are expected to help Coca-Cola deliver 4% organic revenue growth in FY 2018.
Seeing the success of Coca-Cola Zero Sugar, the company intends to reformulate a number of other brands, as it clambers to keep up with changing consumer preferences. One such brand has been Diet Coke, which has been plagued with declining volumes recently. Increasing concerns about the dangers of artificial sweeteners, such as increased risk of stroke for daily drinkers of diet beverages, have resulted in a substantial fall in the sales of such drinks, including Diet Coke. Moreover, according to Nielsen, while diet soda volumes were down 4% for the 12 weeks to 30 December 2017, those for Diet Coke fell 6% in the same period. To arrest this decline, Coca-Cola decided to revamp Diet Coke. While the original Diet Coke remains, four new flavors of it – Ginger Lime, Feisty Cherry, Zesty Blood Orange, and Twisted Mango – have been introduced, keeping the millennial generation in mind. While it is not for certain if the new flavors will halt the decline, it is definitely a step in the right direction.
2. The company has been undertaking certain productivity initiatives, such as a restructuring of the global supply chain, incorporating zero-based budgeting, and streamlining the operating model, that drove operating margin expansion in FY 2017. Last year, Coke also announced plans to expand its productivity and reinvestment program to eke out an additional $800 million in annualized savings over the next two years.
3. Coca-Cola is focusing on high-margin products to drive profitability. For example, in FY 2017, the company de-emphasized low-margin water in China, which had a negative impact on volumes, but didn’t affect the profitability. |
The Australian and New Zealand Children’s Haematology and Oncology Group (ANZCHOG) is our regional multidisciplinary professional paediatric oncology society and includes all SIOP Oceania members. ANZCHOG has a diverse and multifaceted role within the region. As our principal professional organisation, ANZCHOG acts to coordinate sponsors for clinical trials and has close working relationships with the COG and several European clinical trials groups. ANZCHOG also organises our regional annual scientific meeting, supports professional development and training of paediatric oncologists and nurses and supports research activities. Within our region, all our Australian and New Zealand children’s cancer centres are members of the Children’s Oncology Group and many centres participate in European based clinical trials. However, like other high-income countries, we face the challenges with ensuring access to the new and emerging therapeutics.
Many SIOP members in our region are active in practical and professional outreach, including programs enhancing indigenous access to health care, and telemedicine to remote and rural regions in Australia and New Zealand ensuring equity of access to major paediatric hospitals for children with suspected cancer, regardless of distance or location. However, with the exception of Australia and New Zealand that are high income countries with state funded comprehensive cancer care in all regions, most children in Oceania live in low and middle income countries with limited or modest resources. Oceania is a sparsely populated region with many Pacific Island States and Territories. As the health and healthcare of children in these countries improves, cancer is emerging as a significant health problem. Many SIOP members are involved in supporting colleagues across our region. Children with cancer from New Caledonia and surrounding areas are transferred to Sydney for comprehensive care funded by an insurance program supported by the French government. The New Zealand-Pacific Islands Program has well established twinning relationships with Fiji, Tonga and Samoa. New initiatives have recently commenced in Papua New Guinea and East Timor, although there are ongoing issues with the practical issues with access and supply of chemotherapy and treatment support. A regional childhood cancer training workshop for medical and nursing staff from around Oceania is being planned for 2016 as part of the Pacific Medical Association meeting.
The theme of the 2015 ASM held in Fremantle in mid June was ‘Difficult Diseases, Difficult Situations’, exploring the challenges of providing high quality care and meeting expectations of patients and families. Invited international faculty included Dr Amar Gajjar (USA), Professor Brenda Gibson (UK), Dr Eugene Hwang (USA), Mr Lee Jeys (UK), Dr Carlos Rodriguez-Galindo (USA), Dr Robert Wechsler-Reya (USA), Dr Kristina hardy (USA) and Professor Tannishtha Reya (USA). More than 250 delegates attended and were privileged to enjoy a divers program from a distinguished faculty. |
%!TEX encoding = UTF-8 Unicode
% $Id: snmp.tex,v 1.8 2009/06/19 06:33:11 binghe Exp binghe $
% SNMP for Common Lisp
% ILC 2009 Paper by Chun Tian (binghe)
%%% Comments:
% Nice to see a detailed application of Lisp to networking/services. A
% bit heavy on the operational detail - would have been good to see more
% on the design side (constraints, choices, rationales) - but otherwise
% a useful contribution.
% ---
% This project covers some very important issues for the future of
% Common Lisp, but unfortunately the paper is rather badly written. There
% are good aspects of the presentation, but so many bad ones that the
% author should seek out the help of a Lisp-literate person who has never
% heard of ASN.1, MIB, and may other terms (which he uses for several pages
% before providing even an informal definition, or providing enough context
% for a more Net-naive reader to grasp the essence.
% I strongly suggest a second review after the author has had time to grok
% the enormity of the disconnect of his presentation style with the ability
% to hold the attention of an audience that is not a SNMP geek.
% ---
% very dense about a particular topic, Simple Network Management
% Protocol, with more detail than I care to read. But it seems well
% written, and evidently there's a big user community, so it a paper
% with narrow appeal is appropriate
% Typos and grammatical errors abound (several to a dozen per page.) e.g. :
% Page 1.,
% First, rewrite the two paragraphs beginning "As a Linux System
% administrator ..." and "About two years later .." but remove all first-
% person references and viewpoints (i.e., the pronoun "I") There is a good
% problem to be stated here, and the author is allowed to offer a solution;
% but it should not be merely an informal, first-person story.
% * The sentence beginning "It's a pure lisp implementation ..." should
% rewritten the remainder to be more like this "... but is not being
% maintained, and doesn't support the new protocol SNMPv3."
% * ".. SYSMAN under active developments" -> " ... SYSMAN was under
% active development."
% * "... SNMP package supports the following Common LIsp ..." ->
% "... SNMP package runs on the following Common LIsp ..."
% Page 3, footnote "The actually ...) -> "The actual ..."
% . . .
% Other help with English diction may be necessary.
%\documentclass[preprint,nocopyrightspace,natbib,9pt]{sigplanconf}
\documentclass[reprint,9pt]{sigplanconf}
\usepackage{amsmath}
\begin{document}
\conferenceinfo{ILC'09}{March 22--25, 2009, Cambridge, Massachusetts, USA}
\copyrightyear{2009}
\copyrightdata{}
\proceedings{Proceedings of the International Lisp Conference}
\toappear{}
% These are ignored unless 'preprint' option specified.
\titlebanner{DRAFT---Do not distribute}
\preprintfooter{Chun Tian (binghe)'s paper for ILC 2009}
\title{SNMP for Common Lisp}
\authorinfo{Chun Tian (binghe)}
{Hangzhou Research Center, P. R. China\\NetEase.com, Inc.}
{[email protected]}
\maketitle
\begin{abstract}
Simple Network Management Protocol (SNMP) is widely used for management of
Internet-based network today. In Lisp community, there're large Lisp-based
applications which may need be monitored, and there're Lispers who may need
to monitor other remote systems which are either Lisp-based or not.
However, the relationship between Lisp and SNMP haven't been studied enough
during past 20 years.
The
\textsc{cl-net-snmp}\footnote{\texttt{http://common-lisp.net/project/cl-net-snmp}}
project has developed a new Common Lisp package which implemented the
SNMP protocol. On client side, it can be used to query remote SNMP peers,
and on server side, it brings SNMP capability into Common Lisp based applications,
which could be monitored from remote through any SNMP-based management system.
It's also a flexible platform for researches on network management and SNMP itself.
But the most important, this project tries to prove: \textbf{Common Lisp is the most
fit language to implement SNMP}.
Different from other exist SNMP projects on Common Lisp,
\textsc{cl-net-snmp} is clearly targeted on full SNMP
protocol support include \textsl{SNMPv3} and server-side work (agent). During
the development, an general ASN.1 compiler and runtime package and
an portable UDP networking
package are also implemented, which would be useful for other related
projects.
In this paper, the author first introduces the SNMP protocol and
a quick tutorial of \textsc{cl-net-snmp}
on both client and server sides, and then the Lisp native design
and the implementation details of the ASN.1 and SNMP package,
especially the ``code generation'' approach on compiling SNMP MIB
definitions from ASN.1 into Common Lisp.
\end{abstract}
\category{C.2.2}{Computer-Communication Networks}{Network Protocols}[Applications]
\category{C.2.3}{Computer-Communication Networks}{Network Operations}[Network monitoring]
\category{C.2.6}{Computer-Communication Networks}{Internetworking}[Standards]
\category{D.3.4}{Programming Languages}{Processors}[Code generation]
\terms
Languages, Network Management
\keywords
Lisp, SNMP, ASN.1
\section{SNMP Overview}
Simple Network Management Protocol (SNMP) is the \textit{de facto}
standard for network management and service monitoring. Using SNMP,
people can monitor the status of remote UNIX servers and network
equipment.
Though there're other protocols defined before and after
SNMP, it has several advantages which lead it become popular. First,
from the view of implementation costs, SNMP is the most lightweight and
can be easily implemented by hardware. Second, it's really simple to
do the actual management job: all information are defined as variables
which are either scalars or conceptually organized into tables. All of
these variables are formally defined by using a definition language
called the Structure of Management Information (SMI) \cite{RFC:2578},
which is a subset
of Abstract Syntax Notation One (ASN.1) \cite{ISO:ASN.1}.
Data definitions written
in the SMI are called Management Information Base (MIB) \cite{RFC:3418}.
Third, SNMP has minimum resource requirements.
By using User Datagram Protocol (UDP) \cite{RFC:768},
most SNMP operations only need one pair of UDP packets: a request and
a response.
SNMP has three major versions: \textsl{SNMPv1} \cite{RFC:1157},
\textsl{SNMPv2c} \cite{RFC:1901} and
\textsl{SNMPv3} \cite{RFC:3411}. The differences between \textsl{SNMPv1} and
\textsl{SNMPv2c} is mainly on SMI and MIB side, no packet format changes.
The \textsl{SNMPv3} is a big step towards security: it supports authentication
and encryption based on standard algorithms, and the packet format
changed a lot.
The relationship between SNMP and ASN.1 is very important because
any implementation of SNMP must first implement ASN.1, at least a subset of it.
As we already mentioned above, the MIB are defined by a subset of ASN.1,
the SMI. Actually, the SNMP message format are just defined through
ASN.1: The whole SNMP message is type of ASN.1 \texttt{SEQUENCE}, and
all SNMP protocol data units (PDU) are defined in framework of ASN.1 type
system. ASN.1 data is just abstract objects, it need to be translated
into octet bytes and then back. This translation is generally called encoding and
decoding.
The encoding/decoding method chosen by SNMP is the
Basic Encoding Rule (BER) \cite{ISO:BER},
which use a Type-Length-Value (TLV) combination in representation of any
ASN.1 data as octet bytes in networking packets.
There're many SNMP-related open source and commercial software in the
world. On \textsl{SourceForge.net}, there're almost 300 projects
matching the keyword ``SNMP'', which can be classified into three
types:
\begin{itemize}
\item SNMP library or extension for specific programming language.
\item SNMP agent which acts as a standalone agent or agent extension.
\item SNMP manager which is used for managing SNMP-enabled servers or
equipment, either GUI or Web-based.
\end{itemize}
From the view of programming languages, almost every in-use language
has a well implemented SNMP library/package. For popular languages
like Java, Python or C\#, there're often several similar projects
existing in competition. And there's at least one language, Erlang,
which ships full SNMP support (more than 60,000 lines of code) with
the language itself \footnote{\texttt{http://erlang.org/}}.
J. Schonwalder wrote a good summary \cite{Schonwalder2002}
which mentioned various open source SNMP library/tools for different languages.
On the other side, the relationship between Common Lisp and ASN.1/SNMP
haven't been studied enough before. There're some similarities between
ASN.1 and Common Lisp. First, the most important ASN.1 aggregate
type \texttt{SEQUENCE} can be directly mapped to Common Lisp lists,
the both are generalized lists which could contain any object. Second,
ASN.1 lexical tokens like multi-line strings, comments, and the number
representation are almost the same as those in Common Lisp. Later will show,
by making some necessary changes to CL readtables, the Lisp reader
could directly read ASN.1 definitions into Lisp tokens. For SNMP itself,
there're also some connection between its design and Lisp, especially the
design of ``GetNextRequestPDU'' \cite{RFC:3416},
it's just like the Common Lisp function
\texttt{cdr} and later will show that the implementation of this PDU has
almost just used the function \texttt{cdr}.
For Common Lisp, before 2007, two SNMP projects have been in
existence. Simon Leinen's
\textsc{sysman}\footnote{\texttt{http://www.switch.ch/misc/leinen/snmp/sysman.html}}
is the first Lisp-SNMP solution which supports client side
\textsl{SNMPv1}/\textsl{SNMPv2c} and server side agent on
Symbolics Lisp Machine. It's a pure lisp implementation, but
is not being maintained anymore, and doesn't support the new protocol \textsl{SNMPv3}.
During 2006, Larry Valkama wrote two SNMP client packages
\footnote{\texttt{http://www.valkama.se/article/lisp/snmp}},
both of which are not pure lisp:
one is a FFI wrapper to Net-SNMP library, and the other works
by capturing outputs of Net-SNMP's common-line utilities.
Unfortunately neither of above projects had showed the advantages of using
Common Lisp to implement SNMP. There're two ways to implement the SNMP protocol:
with and without MIB support, one is hard and the other is simple. The simple
way to implement SNMP is just use number lists as ASN.1 \texttt{OBJECT IDENTIFIER} (OID)
such as ``1.3.6.1.4.1.1.1.0'', and doesn't care their additional type information
beside ASN.1 itself, the
\textsc{snmp1}\footnote{\texttt{http://common-lisp.net/projects/snmp1}} is
a example, it just implement the BER encoding and SNMP packets
generation, no matter what the OID numbers mean.
The ``hard'' way to implement SNMP, the relation between OID number lists
and their names must be kept, and these information should be retrieve from the
original MIB definitions. To achieve this, an ASN.1 syntax parser would be needed,
and the structure of a MIB storage system should be designed well.
The \textsc{cl-net-snmp} project solved all above issues well and went
``a hardest way'' to implement SNMP. 1) It have an ASN.1 to Common Lisp
compiler which compiles MIB definitions into Common Lisp source code which
then defines almost all information used by SNMP package. 2) The CLOS-based BER
encoding/decoding system in ASN.1 package is extensible: user can define their
own new ASN.1 types, and all SNMP PDUs are defined in this way. 3) The SNMP
package support full MIB, that means all information defined in
MIB are being used when doing SNMP work. 4) Object-orient SNMP query facility.
\textsc{cl-net-snmp} runs on the following Common Lisp
implementations: CMUCL, SBCL, Clozure CL, LispWorks, Allegro CL and
Scieneer CL; and runs under Linux, Solaris, Mac OS X and Windows.
Following sections will first introduce the SNMP package from user view
and then show the design idea and implementation details behind
the express and convenient API.
\section{\textsc{cl-net-snmp} Tutorial}
\subsection{Client-side SNMP}
The client-side API of SNMP package is quite straight-forward. The
central object which operated by almost all client functions is the
``SNMP session''. To query a remote SNMP peer, a session object should
be created first.
As SNMP protocol has three versions (\textsl{SNMPv1}, \textsl{SNMPv2c}
and \textsl{SNMPv3}), correspondingly, we have three session classes:
\texttt{v1-session}, \texttt{v2c-session} and \texttt{v3-session}. The
entry API of client-side SNMP is the function
\texttt{snmp:open-session}, which creates a new SNMP session:
%
\begin{verbatim}
snmp:open-session (host &key port version community
user auth priv)
\end{verbatim}
\subsubsection{SNMPv1 and SNMPv2c}
To create a \texttt{SNMPv1} or \texttt{SNMPv2c} session, only keywords \texttt{port},
\texttt{version} and \texttt{community} are needed. Suppose we have a
SNMP server whose host name is \texttt{"binghe-debian.local"},
which is running a Net-SNMP agent on default port 161, its SNMP
community is \texttt{"public"}, and the SNMP protocol is
\textsl{SNMPv2c}, then the following form will create a new session
and assign it to a variable \texttt{s1}:
%
\begin{verbatim}
> (setf s1 (snmp:open-session "binghe-debian.local"
:port 161
:version :v2c
:community "public"))
#<SNMP::V2C-SESSION 223CF317>
\end{verbatim}
In current version of SNMP package, when a session is being created, a
new socket will be opened at the same time. You can use
\texttt{snmp:close-session} to close the session:
%
\begin{verbatim}
snmp:close-session (session)
\end{verbatim}
All SNMP PDUs \cite{RFC:3416} are supported. When a session is opened, functions which
can be used on it are listed below:
\begin{itemize}
\item \texttt{snmp:snmp-get}
\item \texttt{snmp:snmp-get-next}
\item \texttt{snmp:snmp-walk}\footnote{\texttt{snmp:snmp-walk} is a compound operation,
it may calls \texttt{snmp:snmp-get} and \texttt{snmp:snmp-get-next} to do
the actual work.}
\item \texttt{snmp:snmp-set}
\item \texttt{snmp:snmp-trap}\footnote{\texttt{snmp:snmp-trap} only defined in \textsl{SNMPv1}}
\item \texttt{snmp:snmp-inform}
\item \texttt{snmp:snmp-bulk}
\end{itemize}
For normal lisp applications, \texttt{snmp:snmp-get} is the most
useful function. Users can retrieve multiple variables in one query as
the SNMP protocol supported:
%
\begin{verbatim}
> (snmp:snmp-get s1 '("sysDescr.0" "sysName.0"))
("Linux binghe-debian.local 2.6.26-1-amd64 #1
SMP Thu Oct 9 14:16:53 UTC 2008 x86_64"
"binghe-debian.local")
\end{verbatim}
%
While only one variable is queried, \texttt{snmp:snmp-get} can be used
just like this:
%
\begin{verbatim}
> (snmp:snmp-get s1 "sysName.0")
"binghe-debian.local"
\end{verbatim}
The string \texttt{"sysDescr.0"} here will be translated to a
ASN.1 OID instance. When the SNMP client operated on
multiple servers, preparing all OID instances before the actual query work
would increase the performance. The function \texttt{asn.1:oid} is used for
this translation:
%
\begin{verbatim}
> (asn.1:oid "sysName.0")
#<ASN.1:OBJECT-ID SNMPv2-MIB::sysName.0>
> (snmp:snmp-get s1 *)
"binghe-debian.local"
\end{verbatim}
The \texttt{snmp:with-open-session} macro can be used to establish a
temporary session:
\begin{verbatim}
with-open-session ((session &rest args) &body body)
\end{verbatim}
Following is a sample query:
\begin{verbatim}
> (snmp:with-open-session (s "binghe-debian.local"
:port 161
:version :v2c
:community "public")
(snmp:snmp-get s '("sysName.0")))
("binghe-debian.local")
\end{verbatim}
Actually, the SNMP port as 161, community as ``public'' and version as
\textsl{SNMPv2c} are default settings, which have been held by three
Lisp variables:
%
\begin{verbatim}
(in-package :snmp)
(defvar *default-snmp-version* +snmp-version-2c+)
(defvar *default-snmp-port* 161)
(defvar *default-snmp-community* "public")
\end{verbatim}
When operating on default settings, the query syntax can also be
simplified into a hostname string instead of SNMP session instance:
%
\begin{verbatim}
> (snmp:snmp-get "binghe-debian.local" "sysName.0")
"binghe-debian.local"
\end{verbatim}
\subsubsection{SNMPv3}
The major visibility changes of \textsl{SNMPv3} \cite{RFC:3411} are authenticate
and encryption support.
Opening an \textsl{SNMPv3} session needs more different keywords
besides \texttt{host} and \texttt{port}:
\begin{itemize}
\item \texttt{version}, possible values for \textsl{SNMPv3} are
keyword \texttt{:v3}, \texttt{:version-3} and constant
\texttt{snmp:+snmp-version-3+}.
\item \texttt{user}: A string as the SNMP security name \cite{RFC:3414}.
\item \texttt{auth}: Authenticate protocol and key, valid arguments:
$\langle\mathrm{string}\rangle$,
\texttt{($\langle\mathrm{string}\rangle$
$\langle\mathrm{protocol}\rangle$)} or
\texttt{($\langle\mathrm{string}\rangle$
. $\langle\mathrm{protocol}\rangle$)}, which the
\texttt{$\langle\mathrm{protocol}\rangle$} can be \texttt{:md5}
(default) or \texttt{:sha1}.
\item \texttt{priv}: Encryption/privacy protocol and key, valid
arguments: $\langle\mathrm{string}\rangle$,
\texttt{($\langle\mathrm{string}\rangle$
$\langle\mathrm{protocol}\rangle$)} or
\texttt{($\langle\mathrm{string}\rangle$
. $\langle\mathrm{protocol}\rangle$)}, which the
\texttt{$\langle\mathrm{protocol}\rangle$} can only be \texttt{:des}
at this time.
\end{itemize}
When both \texttt{auth} and \texttt{priv} are \texttt{nil},
\textsl{SNMPv3} operates at security level ``noAuthNoPriv''; when only
\texttt{auth} is set up, the security level is ``authNoPriv''; and
when both are set up, the strongest method ``authPriv'' is used. When
\textsl{SNMPv3} is being used, all arguments must be set explicitly by
\texttt{snmp:open-session} or \texttt{snmp:with-open-session}. There's
no express way as those in earlier SNMP protocol versions.
For example, assume we have a remote SNMP peer which works through the
following specification:
%
\begin{itemize}
\item \texttt{(user "readonly")} (Security name is ``readonly'')
\item \texttt{(auth (:md5 "ABCDEFGHABCDEFGH"))} (Authenticate protocol
is MD5, followed by the authenticate key)
\end{itemize}
Then a quick query on ``sysDescr.0'' would be:
\begin{verbatim}
> (snmp:with-open-session
(s "binghe-debian.local"
:version :v3 :user "readonly"
:auth '(:md5 "ABCDEFGHABCDEFGH"))
(snmp:snmp-get s "sysDescr.0"))
"Linux binghe-debian.local 2.6.26-1-amd64 #1
SMP Thu Oct 9 14:16:53 UTC 2008 x86_64"
\end{verbatim}
Here the \texttt{auth} argument \texttt{(:md5 "ABCDEFGHABCDEFGH")} can
also use just \texttt{"ABCDEFGHABCDEFGH"} instead. That's because
MD5\footnote{The actual authenticate protocol used by SNMP is
\textsl{HMAC-MD5-96} and \textsl{HMAC-SHA1-96}.} is the default
authenticate protocol.
\subsubsection{High-level SNMP Query}
Recently a new feature has been added to \textsc{cl-net-snmp}: object-oriented
and SQL-like SNMP query. The idea of using SQL-like syntax on query SNMP
variables can be traced back to Wengyik Yeong's paper \cite{SNMPql} in 1990.
However, in near 20 years, there's no other implementation on this idea.
By using Common Lisp, the most dynamic programming language, \textsc{cl-net-snmp}
goes even further.
Query technologies is mainly used on \textsl{selective} or
\textsl{fast} information retrieval from MIB tables.
In \textsc{cl-net-snmp}, the ASN.1 compiler can compile MIB definitions
into Common Lisp code. During this process, not only OID name to numbers
information are saved, but also the structure of MIB tables. For example,
the MIB table ``ifTable'' which contains network interface information,
it's mainly defined by following MIB:
\begin{verbatim}
ifTable OBJECT-TYPE
SYNTAX SEQUENCE OF IfEntry
MAX-ACCESS not-accessible
STATUS current
DESCRIPTION
"A list of interface entries. The number of
entries is given by the value of ifNumber."
::= { interfaces 2 }
\end{verbatim}
And the ``IfEntry'' is a ASN.1 type of \texttt{SEQUENCE}:
\begin{verbatim}
IfEntry ::=
SEQUENCE {
ifIndex InterfaceIndex,
ifDescr DisplayString,
ifType IANAifType,
ifMtu Integer32,
ifSpeed Gauge32,
ifPhysAddress PhysAddress,
ifAdminStatus INTEGER,
ifOperStatus INTEGER,
ifLastChange TimeTicks,
...
ifSpecific OBJECT IDENTIFIER
}
\end{verbatim}
The ASN.1 compiler can compile above ``IfEntry'' type into a CLOS class definition:
\begin{verbatim}
(defclass |IfEntry| (sequence-type)
((|ifIndex| :type |InterfaceIndex|)
(|ifDescr| :type |DisplayString|)
(|ifType| :type |IANAifType|)
(|ifMtu| :type |Integer32|)
(|ifSpeed| :type |Gauge32|)
(|ifPhysAddress| :type |PhysAddress|)
(|ifAdminStatus| :type integer)
(|ifOperStatus| :type integer)
(|ifLastChange| :type |TimeTicks|)
...
(|ifSpecific| :type object-id)))
\end{verbatim}
These code could be compiled and loaded with SNMP package, and
dynamic loading MIB files should be possible: most Common Lisp platform
supports defining new CLOS classes even after delivery.
Once the structure of MIB tables are known, rest work will be quite easy.
A query on all interfaces information is like this:
\begin{verbatim}
> (snmp:snmp-select "ifTable"
:from "binghe-debian.local")
(#<ASN.1/IF-MIB::|IfEntry| 200E8A43>
#<ASN.1/IF-MIB::|IfEntry| 200A5DDF>)
\end{verbatim}
\texttt{snmp:snmp-select} is a high-level API. It could return CLOS instances
instead of lists, and a simple query like above may involve various low-level
SNMP operations. The OO idea is learnt from LispWorks
\textsl{CommonSQL}.
The internal operations of above query will first use
\texttt{snmp:snmp-get-next} to test how many ``lines'' does the table have.
In this example, it has just two lines. Once the number of lines is known,
then just using \texttt{snmp:snmp-get} to get each line will be OK. In above
query example on \texttt{SNMPv2c}, there're only \textbf{4} UDP packets sent
to get the whole table. Compare to that, the tradition way
by using \texttt{snmp:snmp-walk} will costs 44 UDP packets (the column length
of this table times its lines).
There're two ways to get the actual data in returning instances. Assumes
the first instance has been stored in a variable \texttt{interface}. One
way is using \texttt{asn.1:plain-value} to convert the instance into lists
of values:
\begin{verbatim}
> interface
#<ASN.1/IF-MIB::|IfEntry| 200A170B>
> (asn.1:plain-value interface)
((#<ASN.1:OBJECT-ID IF-MIB::ifIndex (1) [0]> 2)
(#<ASN.1:OBJECT-ID IF-MIB::ifDescr (2) [0]> "eth0")
(#<ASN.1:OBJECT-ID IF-MIB::ifType (3) [0]> 6)
(#<ASN.1:OBJECT-ID IF-MIB::ifMtu (4) [0]> 1500)
(#<ASN.1:OBJECT-ID IF-MIB::ifSpeed (5) [0]>
#<ASN.1:GAUGE 10000000>)
...
(#<ASN.1:OBJECT-ID IF-MIB::ifSpecific (22) [0]>
#<ASN.1:OBJECT-ID SNMPv2-SMI::zeroDotZero (0) [0]>))
\end{verbatim}
To retrieve specific item, the funtion \texttt{asn.1:slot-value-using-oid}
can be used:
\begin{verbatim}
> (asn.1:slot-value-using-oid interface "ifDescr")
"eth0"
\end{verbatim}
Conditional query is still under research. The most native way to
represent SQL \texttt{WHERE} clause in \texttt{snmp:snmp-select}
haven't determined.
\subsection{Server-side SNMP}
Server-side SNMP is mainly used for Lisp image being queried from
outside. The entry API is how to start and stop the SNMP server, this
can be done by \texttt{snmp:enable-snmp-service} and
\texttt{snmp:disable-snmp-service}:
\begin{verbatim}
> (snmp:enable-snmp-service)
#<SNMP:SNMP-SERVER SNMP Server at 0.0.0.0:8161>
\end{verbatim}
Above function will open a new Lisp thread which acts as a SNMP
server. By default, the SNMP server listens on port 8161 and
wild-cast (\texttt{0.0.0.0}) address. At current stage, no access
control\footnote{The access control protocol used by SNMP is called View-based Access Control Model (VACM) \cite{RFC:3415}.}
is implemented and only \textsl{SNMPv1/SNMPv2c} are
supported. We can use the SNMP client API to query it:
\begin{verbatim}
> (setf snmp:*default-snmp-port* 8161)
8161
> (snmp:snmp-get "localhost" "sysDescr.0")
"LispWorks Personal Edition 5.1.1 on
binghe-mac.people.163.org"
\end{verbatim}
Here we changed the default SNMP port to make things easier. Or we can
use command-line utilities from Net-SNMP project:
\begin{verbatim}
$ snmpget -v 2c -c public localhost:8161 sysDescr.0
SNMPv2-MIB::sysDescr.0 = STRING: LispWorks Personal\
Edition 5.1.1 on binghe-mac.people.163.org
\end{verbatim}
This time we do a ``SNMP walk'' on MIB ``system'' node:
\begin{verbatim}
> (snmp:snmp-walk "localhost" "system")
((#<ASN.1:OBJECT-ID SNMPv2-MIB::sysDescr.0>
"LispWorks Personal Edition 5.1.1 on
binghe-mac.people.163.org")
(#<ASN.1:OBJECT-ID SNMPv2-MIB::sysObjectID.0>
#<ASN.1:OBJECT-ID
LISP-MIB::clNetSnmpAgentLispWorks (5) [0]>)
(#<ASN.1:OBJECT-ID
DISMAN-EVENT-MIB::sysUpTimeInstance.0>
#<ASN.1:TIMETICKS (69652) 0:11:36.52>)
(#<ASN.1:OBJECT-ID SNMPv2-MIB::sysContact.0>
"Chun Tian (binghe) <[email protected]>")
(#<ASN.1:OBJECT-ID SNMPv2-MIB::sysName.0>
"binghe-mac.local (binghe-mac)")
(#<ASN.1:OBJECT-ID SNMPv2-MIB::sysLocation.0>
"binghe-mac.people.163.org")
...)
\end{verbatim}
An SNMP server is only useful when there is useful information in it.
It's extensible: new SNMP scalar variables or tables can be defined on the
fly. There're two high-level API macros which can be used:
\texttt{snmp:def-scalar-variable} and \texttt{snmp:def-listy-mib-table}.
\begin{verbatim}
def-scalar-variable (name (agent) &body body)
def-listy-mib-table (name (agent ids) &body body)
\end{verbatim}
And a low-level API function \texttt{snmp:register-variable}:
\begin{verbatim}
register-variable (oid function &key dispatch-table
walk-table walk-list)
\end{verbatim}
For example, the variable ``sysDescr.0'' is defined by the following
form:
\begin{verbatim}
(def-scalar-variable "sysDescr" (agent)
(format nil "~A ~A on ~A"
(lisp-implementation-type)
(lisp-implementation-version)
(machine-instance)))
\end{verbatim}
When the SNMP server running in LispWorks being queried from outside
by Net-SNMP utilities, the query to ``sysDescr.0'' may shows:
\begin{verbatim}
$ snmpget -v 2c -c public binghe-debian.local:8161\
sysDescr.0
SNMPv2-MIB::sysDescr.0 = STRING:\
LispWorks 5.1.1 on binghe-debian.local
\end{verbatim}
The \texttt{agent} parameter in above
\texttt{snmp:def-scalar-variable} form is used to refer to current
SNMP agent instance, which can be used to access the status of current
agent. For example:
\begin{verbatim}
(def-scalar-variable "snmpInPkts" (agent)
(counter32 (slot-value agent 'in-pkts)))
\end{verbatim}
When ``snmpInPkts.0'' is queried, the slot value \texttt{in-pkts} of current
agent instance will be coerced into ASN.1 \texttt{Counter32} type and
returned.\footnote{This variable has't been actually used in current version.}
A MIB Table can be defined as per column. For example, to define a
column from ``sysORUpTime.1'' to ``sysORUpTime.9'', we have three
ways:
%
\begin{verbatim}
(def-listy-mib-table "sysORUpTime" (agent ids)
(if (null ids)
'((1) (2) (3) (4) (5) (6) (7) (8) (9))
(timeticks 0)))
(def-listy-mib-table "sysORUpTime" (agent ids)
(if (null ids)
'(1 2 3 4 5 6 7 8 9)
(timeticks 0)))
(def-listy-mib-table "sysORUpTime" (agent ids)
(if (null ids)
9
(timeticks 0)))
\end{verbatim}
The \texttt{ids} parameter means the \textbf{rest} OID components
when a query gets to current \textbf{base} OID (``sysORUpTime'' here).
You can treat the \texttt{snmp:def-listy-mib-table} body as an ordinary
function body. When
it's called by an \texttt{ids} argument as \texttt{nil}, it should
return all its valid children to the SNMP agent. A list \texttt{'((1)
(2) (3) (4) (5) (6) (7) (8) (9))} means each valid rest OID
has only one element. For the first child, it's just the number
``1''. When a child has rest OID as only one element, the
long list can be simplified into \texttt{'(1 2 3 4 5 6 7 8 9)}, which
just means ``sysORUpTime.1'', ``sysORUpTime.2'',
... ``sysORUpTime.9''. And, when all the children have a single number
and they are consistent (from 1 to N), the list can be again simplified
into just one number ``9'' which also means from 1 to 9, then
\texttt{(1)} to \texttt{(9)}.
For dynamic MIB tables, just let the form (as a function) returns an
dynamic list when \texttt{ids} given \texttt{nil} will work, like this
one:
%
\begin{verbatim}
(def-listy-mib-table "lispFeatureName" (agent ids)
(let* ((features *features*)
(number-of-features
(list-length features)))
(if (null ids)
number-of-features
(when (plusp (car ids))
(->string (nth (mod (1- (car ids))
number-of-features)
features))))))
\end{verbatim}
Above ``lispFeatureName'' can return all elements of
\texttt{*features*} in current Lisp system as ASN.1 \texttt{OCTET
STRING}. Every time it's called, the \texttt{number-of-features}
will be calculated. It's not quite optimized here. If you want faster
reply, the list count progress should be defined outside of the
function and as a cache to the actual value, and a separate thread may
be used to update all these parameter values on schedule.
To use above two macros for user-defined MIB nodes, named OID nodes
must be defined first, like above ``sysDescr'' or
``sysORUpTime''. There are two ways to achieve the goal: define a
MIB file in ASN.1 syntax and use the ASN.1 compiler from ASN.1 package to
translate it into LISP source code, or
directly write the Lisp version of the MIB definition:
\begin{verbatim}
(defoid |lispFeatureName| (|lispFeatureEntry| 2)
(:type 'object-type)
(:syntax '|DisplayString|)
(:max-access '|read-only|)
(:status '|current|)
(:description
"The string name of each element in *features*."))
\end{verbatim}
At compile-time, above definitions then will be translated into following form:
\begin{verbatim}
(IN-PACKAGE "ASN.1/LISP-MIB")
(PROGN
(DEFVAR |lispFeatureName|
(OR (ENSURE-OID |lispFeatureEntry| 2)
(MAKE-INSTANCE 'OBJECT-ID
:NAME '|lispFeatureName|
:VALUE 2
:PARENT |lispFeatureEntry|
:MODULE *CURRENT-MODULE*
:TYPE 'OBJECT-TYPE
:SYNTAX '|DisplayString|
:MAX-ACCESS '|read-only|
:STATUS '|current|
:DESCRIPTION
"The string name of each element in *features*.")))
(EVAL-WHEN (:LOAD-TOPLEVEL :EXECUTE)
(ASN.1::REGISTER-OID
(SYMBOL-NAME '|lispFeatureName|)
'|lispFeatureName|)))
\end{verbatim}
The low-level function \texttt{snmp:register-variable} is used by
\texttt{snmp:def-scalar-variable} and
\texttt{snmp:def-listy-mib-table}. Above definitions for ``sysDescr''
will be macro-expanded into:
%
\begin{verbatim}
(IN-PACKAGE "SNMP")
(PROGN
(DEFUN |ASN.1/SNMPv2-MIB|::|sysDescr|
(AGENT &OPTIONAL #:G1290)
(DECLARE (IGNORABLE AGENT))
(IF (NULL #:G1290)
0
(FORMAT NIL
"~A ~A on ~A"
(LISP-IMPLEMENTATION-TYPE)
(LISP-IMPLEMENTATION-VERSION)
(MACHINE-INSTANCE))))
(EVAL-WHEN (:LOAD-TOPLEVEL :EXECUTE)
(REGISTER-VARIABLE
(OID "sysDescr")
#'|ASN.1/SNMPv2-MIB|::|sysDescr|)))
\end{verbatim}
Besides, \texttt{snmp:register-variable} has some additional keywords, which
can be used explicitly to define MIB nodes in SNMP agent other than
the default. It's possible to run multiple different SNMP agents
simultaneously, but more codes are needed. You even cannot use
\texttt{snmp:enable-snmp-service} here.
\section{LISP-MIB}
Though just registering an OID node or sub-tree in SNMP server will
fit the goal for querying information from remote SNMP peers, if there's
no coordination on places, conflict would happen and information
defined by different SNMP vendors would be impossible to live
together. SNMP community spend so much time on how to define a common
framework to hold all variables from SNMP
vendors, that is the MIB (Management Information Base)\cite{RFC:3418}.
Another side: a SNMP server running in Lisp image should be possible
to reply the status of Lisp system itself, for example, the most
basically, implementation type and version, which can be returned by
standard functions. ANSI Common Lisp has also defined some status
functions of the Lisp system itself (i.e. the internal run time and
real time), useful constants
(i.e. \texttt{internal\-time-\-units-\-per\--second}), and special variables
(\texttt{*read-\-eval*}, \texttt{*print-\-circle*}, ...) All these
information plus implementation-specific data maybe useful to monitor
and just query from outside world. For popular Lisp packages and some
small applications which have their own status and parameters, the
requirement for MIB sub-tree should also be considered.
There's one place in MIB tree which just is left for SNMP vendors: the
``enterprises''
node\footnote{\textsl{iso.org.dod.internet.private.enterprises} (OID:
1.3.6.1.4.1)}. Since there's no Lisp-related MIB registered before,
A new enterprise number from IANA
\footnote{\texttt{http://www.iana.org/assignments/enterprise-numbers}}
has been registered: \textbf{31609 (lisp)},
which allocated to the \textbf{LISP-MIB}.
The root of LISP-MIB is ``enterprises.lisp'' (31609). Its two children
are ``common-lisp'' and ``scheme''.
In ``common-lisp'' node, there're four common children at present:
\begin{itemize}
\item \texttt{lispSystem}, the summary information of current Lisp
system.
\item \texttt{lispConstants}, constants of limits of number-types.
\item \texttt{lispPackages}, information store for lisp packages
(utilities).
\item \texttt{lispApplications}, information store for lisp
applications.
\end{itemize}
Other children of ``common-lisp'' node are reserved for Common Lisp
implementations. Implementation-specific variables should be put
there.
The framework of LISP-MIB\footnote{The MIB definition of
LISP-MIB and other LISP-*-MIBs in ASN.1 can be found in \textsc{cl-net-snmp}'s
Subversion repository:
\texttt{https://cl-net-snmp.svn.sourceforge.net/svnroot/cl-net\-snmp/snmp/trunk/asn1/lisp}}
is shown in Figure \ref{fig:lisp-mib}.
\begin{figure}
\begin{verbatim}
lisp (31609)
common-lisp (1)
lispSystem (1)
lispImplementationType (1)
lispImplementationVersion (2)
lispLongSiteName (3)
lispShortSiteName (4)
lispMachineInstance (5)
lispMachineType (6)
lispMachineVersion (7)
lispSoftwareType (8)
lispSoftwareVersion (9)
lispInternalRealTime (10)
lispInternalRunTime (11)
lispInternalTimeUnitsPerSecond (12)
lispUniversalTime (13)
lispFeatureTable (14)
lispPackageTable (15)
lispModuleTable (16)
lispConstants (2)
lispMostPositiveShortFloat (1)
lispLeastPositiveShortFloat (2)
lispLeastPositiveNormalizedShortFloat (3)
...
lispPackages (3)
cl-net-snmp (1)
clNetSnmpObjects (1)
clNetSnmpEnumerations (2)
clNetSnmpAgentOIDs (1)
clNetSnmpAgent (1)
clNetSnmpAgentLispWorks (5)
clNetSnmpAgentCMUCL (6)
...
cl-http (2)
...
lispApplications (4)
lispworks (5)
cmucl (6)
sbcl (7)
clozure (8)
allegro (9)
scl (10)
...
scheme (2)
\end{verbatim}
\caption{LISP-MIB}
\label{fig:lisp-mib}
\end{figure}
\section{Implementation details}
%\subsection{History of cl-net-snmp Project}
%The \textsc{cl-net-snmp} project started from March 2007. Its first
%several versions are CFFI-based API wrappers on Net-SNMP as
%its name (\textsc{cl-\textbf{net-snmp}}) indicates. There're some restrictions
%when based on Net-SNMP. To support MIB, the corresponding
%MIB definition files must be shipped, so it's impossible to deliver a
%single Lisp image to hold all things together. Soon after the
%``0.1.0'' release on April 8, 2007, the author turned to pure-lisp
%implementation which support the OID name resolution.
%On September 28, 2007, the \textsc{cl-net-snmp} 1.0 was released,
%which support client protocol of SNMPv1 and SNMPv2c. In this version,
%a LALR parser called ZEBU\footnote{\texttt{http://www.cliki.net/Zebu}}
%was used to parse MIB files, but only
%OID definitions are actually processed. In this version all OID information
%are read into a single list called ``MIB tree''.
%The correspond tree maintenance API and tree structure are learnt from Simon
%Leinen's \textsc{sysman} project.
%In \textsc{sysman}, MIB definition files are first translated
%into a plain text format by a script outside Lisp, then easily loaded by Lisp
%to build the MIB tree. So there's no ASN.1 parsing work in \textsc{sysman}.
%Different from \textsc{sysman}, \textsc{cl-net-snmp} tries to
%implement the SNMP protocol in a ``nature Lisp way'', even more
%naturally than the C-based Net-SNMP project. ZEBU is hard to use
%for parsing ASN.1, partly because of its built-in
%regex-based lexer, which cannot be used to read multi-line strings
%(just like the Lisp strings).
%Starting from version 1.2, a simple ``ASN.1 compiler'' had been introduced
%to compile MIB definition file directly into Common Lisp source code.
%ASN.1 syntax is very hard to parse, especially when it contains obsolete
%\texttt{MACRO} definitions. And there're many ambiguities when parsing
%ASN.1 by LALR(1). For a detailed discussion on the difficulty
%of parsing ASN.1, see chapter 22.3 in O. Dubuisson's ASN.1 Book \cite{Book:ASN.1}.
%The ASN.1 parser defined in \textsc{cl-net-snmp} is based on
%LispWorks' \textsc{parsergen} package. It still needed
%a lexer to work together. Due to the similarity between ASN.1 token and
%Lisp token, the author found that just use a modified CL readtable
%will be fit all the need. Hacking on CL readtables is a bit crazy but it does work
%and it's very fast. Since then, the ASN.1 part of code had been separated from
%SNMP package to make a new standalone ASN.1 package. The new ASN.1
%package has two parts, one is the runtime, which runs on all
%support CL implementations and is depended by the main SNMP package;
%the other part, a compiler, which only works on LispWorks, and is only
%needed when people want to load new MIB files which isn't shipped with the SNMP
%package.
%More than half a year later, on Jul 13, 2008, the long-awaited
%\textsc{cl-net-snmp} 2.0 was out. All above ideas were well
%implemented. Starting from that release, the project has been divided
%into several sub-projects and each of them has its own version
%numbers. The author tried to manage the version policy as softwares on old
%Symbolics Lisp machine \cite{Symbolics:Patch}: each software has a major version
%number and a minor version number; if the software can be updated by
%loadable lisp patch, only minor version is increased, and if the
%structure of lisp code is changed much or any refactoring happens, the
%major version must be increased to start a fresh new version. One such
%example is the \textsl{CL-HTTP}\footnote{\texttt{http://www.cl-http.org:8001}}
%project. At a early stage, it's hard to keep source code stable, so after
%fixed some bugs the version 3.0 just been released on Jul 21, 2008, which is
%the first public release of new design. Following features are supported at that time:
%\begin{itemize}
%\item Full SNMP protocol version support (\textsl{SNMPv1}, \textsl{SNMPv2c}, \textsl{SNMPv3}).
%\item Support MIB and ASN.1 OID names.
%\item Fast BER encode/decode based on CLOS.
%\item UDP auto-retransmit support.
%\item Simple SNMP Server on LispWorks.
%\end{itemize}
%The simple SNMP server is a very early support on server side
%SNMP: no \textsl{SNMPv3}, no access control (VACM), even ``SNMP walk''
%is not supported yet. All that use can do on client side is to \textsl{get}
%values of MIB variables.
%The next big step is the 5.0 release on Sep 8, 2008. Start from this version,
%the SNMP server can run on every support CLs. It's based on
%\textsc{usocket}\footnote{\texttt{http://common-lisp.net/project/usocket}}
%project and portable-threads package from
%\textsl{GBBopen}\footnote{\texttt{http://gbbopen.org}}
%project. \textsc{cl-net-snmp} 5.5, released on Sep 24, 2008, adds full
%``SNMP walk'' support for the SNMP server, and start from this
%version, a LISP-MIB has been defined to standardize the server-side
%variables in SNMP server, but the server side is still lacking in VACM
%support. \textsc{cl-net-snmp} 5.19 is the latest release when writing
%this paper. It fixed many bugs, and its API is explained in this
%paper.
%Recently, more new features are added into \textsc{cl-net-snmp}, during
%draft versions and final version of this ILC paper. Some of them
%will also explained.
\subsection{Portable UDP Networking}
There's few portable UDP networking packages in Common Lisp community,
partly because UDP applications is rare. One UNIX derived systems, the
\textsl{IOlib}\footnote{\texttt{http://common-lisp.net/project/iolib}}
package is a good choice for portable networking: it exports the POSIX
compatibility layer through
\textsl{CFFI}\footnote{\texttt{http://common-lisp.net/project/cffi}}
and has a high-level networking package (net.sockets) and a I/O
multiplex package (io.multiplex). However, due to its heavily dependence
on foreign function interface (FFI) and C code, it will be a bit hard
to deliver applications into single standalone executions on commercial
Common Lisp platforms such as LispWorks. After some investigation,
the \textsc{usocket}\footnote{\texttt{http://common-lisp.net/project/usocket}}
project was been chosen to extend the support on UDP/IP, because \textsc{usocket}
already has a very nice networking API framework.
\textsc{usocket} is much simpler than \textsl{IOlib}. It tries to use
networking APIs which each supported CL implementations already have, and
add foreign functions (as Lisp code) through FFI interface of their own when
necessary. So there's no dependency on \textsl{CFFI} and any other C
code (except on ECL, its FFI interface need C code as embeddable). The
\textsc{usocket} project also has a high-level \texttt{wait-for-input}
function which work in front of UNIX system call \texttt{select()}
or other similar funtions, so users can use \texttt{wait-for-input)}
to swap multiple UDP messages from multiple sockets simultaneously
in one thread.
An \textsc{usocket-udp}
\footnote{\texttt{http://common-lisp.net/projects/cl-net-snmp/usocket.html}} sub-project has been written for the SNMP package,
it implements additional API which is suggested by Erik Huelsmann,
the \textsc{usocket} maintainer. The new functions \texttt{socket-send} and
\texttt{socket-receive} can be used to operate on a new class of
socket called \texttt{datagram-usocket}. \textsc{usocket-udp} depends
on \textsc{usocket} 0.4.x, with the first 0.4.0 released on Oct 28,
2008. Erik also accepted me to the \textsc{usocket} team, which the
next major release will contain the UDP support.
Another issue in UDP network programming is that user code may deal
with packet loss, because UDP is not reliable. A simple way to handle
it is used by Net-SNMP project: define a maximum retry time
and a timeout value, and resend messages on timeout. \textsc{cl-net-snmp}
adopted a more complicated model, it used an ``auto retransmit''
approach \cite{Jacobson:RTT} which usually used in TCP networking: the
timeout value is not fixed but calculated by actual message round-trip
time (RTT). The maximum retry time is still a fix number, as the
timeout value being a range (default is 2~60 seconds). A new
high-level \texttt{socket-sync} function has been defined to do this
automatically.
\subsection{ASN.1 to Common Lisp language mapping}
ASN.1 (Abstract Syntax Notation One) \cite{ISO:ASN.1} is an
international standard which aims at specifying data used in
telecommunication protocols. For more details on ASN.1 and its
history, see Olivier Dubuisson's famous book \cite{Book:ASN.1}.
SNMP highly depends on ASN.1: SNMP MIB (Management Information Base)
\cite{RFC:3418} is full defined in SMI (Structure Management Information)
language, a subset of ASN.1; The most basic data type in SNMP, object identifier (OID),
is just a standard ASN.1 type; all data in SNMP message are enclosed as an ASN.1 \texttt{SEQUENCE} which is then
encoded by BER (Basic Encode Rule) as one of
encoding/decoding methods for ASN.1.
In ASN.1 package, the ASN.1 \texttt{SEQUENCE} type is generally mapped
to Common Lisp \texttt{sequence}, which has two subtypes: \texttt{vector}
and \texttt{list}.
There's only one exception: the empty ASN.1 \texttt{SEQUENCE} is
mapped into empty vector \texttt{\#()} instead of \texttt{nil}, the empty
list. That's because \texttt{nil} is already mapped to ASN.1 type \texttt{NULL},
which is also the only valid element of this type.
There're other ASN.1 primitive types such as all kinds of strings and numbers
which are used by SNMP and they're mapped into correspond Common Lisp types.
Table \ref{table:asn.1-type-mapping} shows most of these type mapping
the ASN.1 package currently supports. Some ASN.1 types are mapped
into CLOS classes.\footnote{In \textsc{cl-net-snmp} 5.x, strings and integers
are just mapped into CL types \texttt{string} and \texttt{integer}. To support
SMI textual conventions (TC, see \cite{RFC:2579}), more complex mapping is needed.
This will be done in next major \textsc{cl-net-snmp} version.}
\begin{table}
\centering
\caption{ASN.1 to Common Lisp Type Mapping}
\label{table:asn.1-type-mapping}
\begin{tabular}{|l|l|}
\hline
\textbf{ASN.1 Type} & \textbf{Common Lisp Type}\\
\hline
\texttt{OBJECT IDENTIFIER} & \texttt{ASN.1:OBJECT-ID}\\
\texttt{INTEGER} & \texttt{CL:INTEGER}\\
\texttt{NULL} & \texttt{CL:NULL}\\
\texttt{SEQUENCE} & \texttt{CL:SEQUENCE}\\
\texttt{OCTET STRING} & \texttt{CL:STRING}\\
\texttt{IPADDRESS} & \texttt{ASN.1:IPADDRESS}\\
\texttt{COUNTER32} & \texttt{ASN.1:COUNTER32}\\
\texttt{COUNTER64} & \texttt{ASN.1:COUNTER64}\\
\texttt{GAUGE} & \texttt{ASN.1:GAUGE}\\
\texttt{TIMETICKS} & \texttt{ASN.1:TIMETICKS}\\
\texttt{OPAQUE} & \texttt{ASN.1:OPAQUE}\\
\hline
\end{tabular}
\end{table}
In current released \textsc{cl-net-snmp} versions, ASN.1 module is not
supported. That is: all MIB definitions are compiled into Common Lisp
code in package \texttt{ASN.1}. This may cause symbol clash. Recently this
issue has been solved, now ASN.1 modules are directly mapped into
Common Lisp packages as their original module names.
\subsubsection{BER support}
The BER (Basic Encoding Rule) \cite{ISO:BER} is
essential to implement SNMP because it makes the connection between
ASN.1 object and actual networking packets. BER encodes
every ASN.1 object into three parts: type, length and value (TLV).
The corresponding API funtions for
BER support in ASN.1 package are \texttt{asn.1:ber-encode} and
\texttt{asn.1:ber-decode}. The function \texttt{asn.1:ber-encode} accepts
any Lisp object and try to encode it into a vector of octets
according to BER, and \texttt{asn.1:ber-decode} accepts
a sequence of octets or any octet stream and try to decode into
correspond Lisp object. For example, an integer 10000 can be
encoded into four bytes: 2, 2, 39 and 16, of which the first ``2''
means ASN.1 type \texttt{INTEGER}, the second ``2'' means following
part has \textsl{two} bytes, and 39 and 16 mean the actual value
is 10000 ($39*256+16 = 10000$):
\begin{verbatim}
> (asn.1:ber-encode 10000)
#(2 2 39 16)
> (asn.1:ber-decode #(2 2 39 16))
10000
\end{verbatim}
Another typical example is the encoding of an ASN.1 \texttt{SEQUENCE}.
This type is usually used to implement structure in other languages.
The elements of an ASN.1 \texttt{SEQUENCE} can be anything include
\texttt{SEQUENCE}. For example, a sequence which contains another
sequence which contains an integer 100, a string ``abc'', and a
\texttt{NULL} data can be expressed into \texttt{\#(\#(100 "abc"
nil))} in Common Lisp according to our language mapping design. It
can be encoded and decoded correctly:
%
\begin{verbatim}
> (asn.1:ber-encode #(#(100 "abc" nil)))
#(48 12 48 10 2 1 100 4 3 97 98 99 5 0)
> (asn.1:ber-decode *)
#(#(100 "abc" NIL))
\end{verbatim}
The type byte of sequence is 48. Three elements in inner sequence can
be seen as encoded bytes: \texttt{\#(2 1 100)} (integer 100),
\texttt{\#(4 3 97 98 99)} (string \texttt{"abc"}), and \texttt{\#(5 0)}
(\texttt{nil}).
Both \texttt{ASN.1:BER-ENCODE} and \texttt{ASN.1:BER-DECODE} are
CLOS-based generic functions. \texttt{ASN.1:BER-ENCODE} dispatches on
Common Lisp types, for example the \texttt{INTEGER}:
\begin{verbatim}
(defmethod ber-encode ((value integer))
(multiple-value-bind (v l)
(ber-encode-integer value)
(concatenate 'vector
(ber-encode-type 0 0 +asn-integer+)
(ber-encode-length l)
v)))
\end{verbatim}
The method \texttt{(METHOD ASN.1:BER-ENCODE (INTEGER))} generates a
vector containing type bytes, length bytes and encoding bytes of the
integer. When decoding on integers, generic function
\texttt{ASN.1:BER-DECODE} accepts sequences or streams which contain
data, and then call \texttt{ASN.1:BER-DECODE-VALUE} which dispatches
on keywords (\texttt{:integer} here):
\begin{verbatim}
(defmethod ber-decode ((value sequence))
(let ((stream (make-instance 'ber-stream
:sequence value)))
(ber-decode stream)))
(defmethod ber-decode ((stream stream))
(multiple-value-bind (type type-bytes)
(ber-decode-type stream)
(multiple-value-bind (length length-bytes)
(ber-decode-length stream)
(if type
(ber-decode-value stream type length)
;; When unknown type detected, recover the
;; whole data into an ASN.1 RAW object.
(ber-decode-value
stream type
(cons length
(append type-bytes length-bytes)))))))
(defmethod ber-decode-value ((stream stream)
(type (eql :integer))
length)
(declare (type fixnum length) (ignore type))
(ber-decode-integer-value stream length))
\end{verbatim}
This BER engine in ASN.1 packages is extensible. That's the biggest
difference from other existing BER engines for Common Lisp which can be
found in \textsc{sysman} and \textsc{trivial-ldap}. The first
value returned by \texttt{asn.1:ber-decode-type} comes from a
hash-table \texttt{asn.1::*ber-dispatch-table*}, and all ASN.1 types
are registered into this hash-table:
\begin{verbatim}
(defun install-asn.1-type (type class p/c tags)
(setf (gethash (list class p/c tags)
*ber-dispatch-table*)
type))
(install-asn.1-type :integer 0 0 +asn-integer+)
\end{verbatim}
\subsubsection{MIB support}
The ASN.1 \texttt{OBJECT IDENTIFIER} (OID) type is the most important
type in ASN.1.
The way to handle the structure of OID instances
consist the biggest differences between ASN.1 implementations.
Most implementations store full OID number list in each OID
instance.
In \textsc{cl-net-snmp}, ASN.1 OID type in defined by
\texttt{asn.1:object-id} class. Different with most ASN.1 implementations,
\texttt{asn.1:object-id} instances doesn't hold the full OID number list
but only the last one. To construct
a complete OID number list, the rest information is accessed through
the ``parent'' OID instance of the current one. The definition of the
class \texttt{asn.1:object-id} is shown in figure \ref{defclass:object-id}.
\begin{figure}
\begin{verbatim}
(defclass object-id (asn.1-type)
((name :type symbol
:reader oid-name
:initarg :name)
(value :type integer
:reader oid-value
:initarg :value)
(type :type oid-type
:reader oid-type
:initarg :type)
(syntax :type oid-syntax
:reader oid-syntax
:initarg :syntax)
(max-access :type access
:reader oid-max-access
:initarg :max-access)
(status :type status
:reader oid-status
:initarg :status)
(description :type string
:reader oid-description
:initarg :description)
(module :type symbol
:reader oid-module
:initarg :module)
(parent :type object-id
:reader oid-parent
:initarg :parent)
(children :type hash-table
:accessor oid-children
:initform (make-hash-table)))
(:documentation "OBJECT IDENTIFIER"))
\end{verbatim}
\caption{The definition of \texttt{asn.1:object-id} class}
\label{defclass:object-id}
\end{figure}
The only necessary slots are \texttt{parent} and \texttt{value}.
The \texttt{name} slot is only used by named OID instances (OIDs defined in MIB).
The interface function to build or access an OID instance is
\texttt{ASN.1:OID}. For example, the OID ``sysDescr.0''
(1.3.6.1.2.1.1.1.0) may be accessed through many ways, which is shown
in Table \ref{table:oid}.
\begin{table}
\centering
\caption{Different ways to represent OID ``sysDescr.0''}
\label{table:oid}
\begin{tabular}{|l|}
\hline
\texttt{(asn.1:oid "sysDescr.0")}\\\hline
\texttt{(asn.1:oid "SNMPv2-MIB::sysDescr.0")}\\\hline
\texttt{(asn.1:oid "system.sysDescr.0")}\\\hline
\texttt{(asn.1:oid "1.3.6.1.2.1.1.1.0")}\\\hline
\texttt{(asn.1:oid ".1.3.6.1.2.1.1.1.0")}\\\hline
\texttt{(asn.1:oid "0.1.3.6.1.2.1.1.1.0")}\\\hline
\texttt{(asn.1:oid \#(1 3 6 1 2 1 1 1 0))}\\\hline
\texttt{(asn.1:oid '(1 3 6 1 2 1 1 1 0))}\\\hline
\texttt{(asn.1:oid (list (asn.1:oid "sysDescr") 0))}\\\hline
\texttt{(asn.1:oid (list |SNMPv2-MIB|::|sysDescr| 0))}\\
\hline
\end{tabular}
\end{table}
The MIB node name ``sysDescr'' is pre-defined in Lisp code which is
generated from its MIB definitions by the ASN.1 compiler. Almost all MIB
files shipped with Net-SNMP are provided by the SNMP package.
In recent \textsc{cl-net-snmp}, ASN.1 modules has been mapped
into Common Lisp packages. Each named OID is actually a Lisp variable
in their correspond package, the ``sysDescr'' OID instance is stored
in \texttt{|SNMPv2-MIB|::|sysDescr|}:
\begin{verbatim}
> |SNMPv2-MIB|::|sysDescr|
#<ASN.1:OBJECT-ID SNMPv2-MIB::sysDescr (1) [0]>
\end{verbatim}
The internal structure of this OID instance is shown in Table
\ref{table:object-id}.
\begin{table}
\centering
\caption{Internal structure of \texttt{OBJECT-ID} instance}
\label{table:object-id}
\begin{tabular}{|l|l|}
\hline
\textbf{Slot} & \textbf{Value}\\
\hline
\texttt{children} & \texttt{\#<EQL Hash Table\{0\} 21B1550B>}\\
\texttt{description} & \texttt{"A textual description of the entity."}\\
\texttt{max-access} & \texttt{ASN.1::|read-only|}\\
\texttt{module} & \texttt{ASN.1::|SNMPv2-MIB|}\\
\texttt{name} & \texttt{|ASN.1/SNMPv2-MIB|::|sysDescr|}\\
\texttt{parent} & \texttt{\#<ASN.1:OBJECT-ID}\\
& \texttt{\ \ SNMPv2-MIB::system (1) [9]>}\\
\texttt{status} & \texttt{ASN.1::|current|}\\
\texttt{syntax} & \texttt{T}\\
\texttt{type} & \texttt{ASN.1::OBJECT-TYPE}\\
\texttt{value} & \texttt{1}\\
\hline
\end{tabular}
\end{table}
Compared with its original definition in ``SNMPv2-MIB.txt'', almost
all information except the SYNTAX part is saved:
\begin{verbatim}
sysDescr OBJECT-TYPE
SYNTAX DisplayString (SIZE (0..255))
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"A textual description of the entity.
This value should include the full
name and version identification of
the system's hardware type, software
operating-system,
and networking software."
::= { system 1 }
\end{verbatim}
In Table \ref{table:object-id}, the value of slot \texttt{parent}
is another OID instance, which is stored in variable
\texttt{|SNMPv2-MIB|::|system|}:
\begin{verbatim}
> (asn.1:oid-parent |SNMPv2-MIB|::|sysDescr|)
#<ASN.1:OBJECT-ID SNMPv2-MIB::system (1) [9]>
> |SNMPv2-MIB|::|system|
#<ASN.1:OBJECT-ID SNMPv2-MIB::system (1) [9]>
> (eq * **)
T
> (asn.1:oid-name-list |SNMPv2-MIB|::|system|)
("iso" "org" "dod" "internet" "mgmt" "mib-2"
"system")
> (asn.1:oid-number-list |SNMPv2-MIB|::|system|)
(1 3 6 1 2 1 1)
\end{verbatim}
Actually all named OID instances have another
named OID instances as their parent or children which can be
accessed from their corresponding slots; all and only these named
OID instances are stored as one conceptual ``MIB tree''.
OID instances which doesn't have a name (like
``sysDescr.0'') are created by \texttt{ASN.1:OID} function when it's been called every time. For these unnamed OID instances, the \texttt{parent} slot are
used for them to track back full OID number list when being used by SNMP operations.
The ``root'' node of the MIB tree is \texttt{(OID "zero")}, which
is also assigned in Lisp variable \texttt{ASN.1::*ROOT-OBJECT-ID*}.
Its the entry to all named MIB nodes:
\begin{verbatim}
> asn.1::*root-object-id*
#<ASN.1:OBJECT-ID zero (0) [2]>
> (asn.1::list-children *)
(#<ASN.1:OBJECT-ID iso (1) [1]>
#<ASN.1:OBJECT-ID SNMPv2-SMI::zeroDotZero (0) [0]>)
\end{verbatim}
\subsection{SNMP internal}
Encryption and authentication support in \textsl{SNMPv3} need HMAC,
DES, MD5 and SHA1 algorithms. This is already done by Nathan Froyd's \textsc{ironclad}%
\footnote{\texttt{http://method-combination.net/lisp/ironclad/}}
project, which supplies almost all authenticate and encryption
algorithms written in pure Common Lisp.
The internal work of SNMP interface functions is rather
straightforward, following steps will happen:
\begin{enumerate}
\item Prepare a variable bindings list according to SNMP operation type and arguments.
\item Create a \texttt{pdu} instance using above variable bindings list.
\item Create a \texttt{message} instance and put above \texttt{pdu} instance in it.
\item Encode the \texttt{message} to get the sending packet data.
\item Send it, then get a response packet.
\item Decode the response packet and create a new \texttt{message} instance from the decode result and the old \texttt{message} instance.
\item Retrieve the variable bindings list from the \texttt{pdu} slot in above \texttt{message} instances.
\item Generate return values from above variable bindings list.
\end{enumerate}
Though there're many steps on processing SNMP operations
\cite{RFC:3412}, the core function,
\texttt{snmp::snmp-request}, which do most steps in above and it's quite simple.
The source code is shown in Figure \ref{func:snmp-request}.
\begin{figure*}
\begin{verbatim}
(defmethod snmp-request ((session session) (request symbol) (bindings list)
&key context)
(when bindings
(let ((vb (mapcar #'(lambda (x) (if (consp x)
(list (oid (first x)) (second x))
(list (oid x) nil)))
bindings)))
;; Get a report first if the session is new created.
(when (and (= (version-of session) +snmp-version-3+)
(need-report-p session))
(snmp-report session :context context))
(let ((message (make-instance (gethash (type-of session) *session->message*)
:session session
:context (or context *default-context*)
:pdu (make-instance request
:variable-bindings vb))))
(let ((reply (send-snmp-message session message)))
(when reply
(map 'list #'(lambda (x) (coerce x 'list))
(variable-bindings-of (pdu-of reply)))))))))
(defun snmp-get (session bindings &key context)
(let ((result (mapcar #'second
(snmp-request session 'get-request-pdu bindings
:context context))))
(if (consp bindings) result (car result))))
\end{verbatim}
\caption{The core SNMP function: \texttt{snmp-request}}
\label{func:snmp-request}
\end{figure*}
\section{Future Work}
There's still lots of work to do. On ASN.1 side, the SMIv2
Textual Convention (TC) \cite{RFC:2579} haven't been implemented.
This part of work
will give a better representation on strings and numbers used in
SNMP.
On client side SNMP, to fulfill the high performance requirements
of enterprise applications, the SNMP client must be able to do
multiple SNMP operations at the same
time in a single thread, and even using sockets less than the number
of remote SNMP peers. This feature has been asked by some customers,
and there's already a MSI project\footnote{
\texttt{http://www.msi.co.jp/\~{}fremlin/projects/snmp-async/}} which try
to implement this feature on top of \textsc{cl-net-snmp}.
On server side SNMP, the VACM (View-based Access
Control Model) \cite{RFC:3415} is on the top of the TODO
list, and it will be implemented in next \textsc{cl-net-snmp} version.
There're also plans on improving GUI and Web interface of the SNMP package.
Currently the GUI interface has only a graphical MIB browser based on
LispWorks CAPI toolkit\footnote{
\texttt{http://www.lispworks.com/products/capi.html}}, and it will be
extend to a full featured SNMP GUI client tool and maybe turn to
support the Common Lisp Interface Manager (CLIM). The Web interface
will be based on CL-HTTP and try to provide a HTTP interface for client and
server side SNMP work.
Obviously SNMP is not the only networking protocol which is based on
ASN.1 and UDP. The existing work of \textsc{cl-net-snmp} could be
used to develop Common Lisp packages of other related networking
protocols.
Lightweight Directory Access Protocol (LDAP) \cite{RFC:4510}
is just another important
protocol which is completely based on ASN.1. LDAP is widely used for
management in large busyness and there're many ``directory server''
productions. Currently the LDAP support in Common Lisp is still in its
early stage, only a few of small packages being developed. A new LDAP
package based on ASN.1 package is on the plan list of
\textsc{cl-net-snmp} project.
Intelligent Platform Management Interface (IPMI) \footnote{
\texttt{http://www.intel.com/design/servers/ipmi/}} is also
another network management protocol beside SNMP. It's a UDP-based
protocol which is slightly easier than SNMP and usually implemented
directly by server hardware. Through IPMI, system administrators can
power off a remote server, query its hardware log, or logging to the
server console through the Serial-On-LAN (SOL) interface. An IPMI
package based on existing portable UDP networking package is in
progress.
\acks
This project is part of a research project on network management platform
which supported by NetEase.com, Inc.
Thanks will go to the following Common Lisp packages and
implementations which are depended on by \textsc{cl-net-snmp} project
and their major author:
%
\begin{itemize}
\item \textsc{sysman} Project (Simon Leinen),
\item \textsc{usocket} Project (Erik Huelsmann),
\item GBBopen Project\footnote{\texttt{http://gbbopen.org}} (Daniel D. Corkill),
\item \textsc{ironclad} Project (Nathan Froyd),
\item LispWorks\footnote{\texttt{http://www.lispworks.com}}.
\end{itemize}
Special thanks to Mathematical Systems Inc. (MSI) \footnote{
\texttt{http://www.msi.co.jp}} for the adoption of
\textsc{cl-net-snmp} in their enterprise projects,
with bugfix and new feature suggestion.
\bibliographystyle{plainnat}
\begin{thebibliography}{10}
\bibitem[J. Schonwalder (2002)]{Schonwalder2002}
J.~Schonwalder.
\newblock \textsl{Evolution of Open Source SNMP Tools.}
\newblock In Proc. SANE 2002 Conference, April 29 2002.
\bibitem[W. Yeong (1990)]{SNMPql}
W. Yeong.
\newblock \textsl{SNMP Query Language.}
\newblock Technical Report 90-03-31-1, Performance Systems International, March 1990.
\bibitem{Book:ASN.1}
O.~Dubuisson.
\newblock \textsl{ASN.1---Communication between heterogeneous systems.}
\newblock Morgan Kaufmann, 2000.
\bibitem{ISO:ASN.1}
\textsl{Abstract Syntax Notation One (ASN.1) Specification of Basic
Notation.}
\newblock {ITU-T Rec. X.680 (2002) | ISO/IEC 8824-1:2002}.
\bibitem{ISO:BER}
\textsl{ASN.1 encoding rules: Specification of Basic Encoding Rules
(BER), Canonical Encoding Rules (CER) and Distinguished Encoding Rules
(DER).}
\newblock {ITU-T Rec. X.690 (2002) | ISO/IEC 8825-1:2002}.
\bibitem{Jacobson:RTT}
V.~Jacobson.
\newblock \textsl{Congestion avoidance and control.}
\newblock In Proceedings of SIGCOMM '88, 1988.
%\bibitem{Symbolics:Patch}
%Symbolics.
%\newblock {\em Program Development Utilities}, chapter Patch Facility, page~65.
%\newblock Symbolics, Inc., 1986.
\bibitem{RFC:768}
J.~Postel.
\newblock \textsl{User Datagram Protocol.}
\newblock RFC 768, 28 August 1980.
\bibitem{RFC:1157}
J.~Case, M.~Fedor, M.~Schoffstall and J.~Davin.
\newblock \textsl{A Simple Network Management Protocol (SNMP).}
\newblock RFC 1157, May 1990.
\bibitem{RFC:1901}
J.~Case, K.~McCloghrie, M.~Rose, and S.~Waldbusser.
\newblock \textsl{Introduction to Community-based SNMPv2.}
\newblock RFC 1901, January 1996.
\bibitem{RFC:2578}
K.~McCloghrie, D.~Perkins, J.~Schonwalder, et al.
\newblock \textsl{Structure of Management Information Version 2 (SMIv2).}
\newblock RFC 2578, April 1999.
\bibitem{RFC:2579}
K.~McCloghrie, D.~Perkins, J.~Schonwalder, et al.
\newblock \textsl{Textual Conventions for SMIv2}.
\newblock RFC 2579, April 1999.
\bibitem{RFC:3411}
D.~Harrington, R.~Presuhn and B.~Wijnen.
\newblock \textsl{An Architecture for Describing
Simple Network Management Protocol (SNMP) Management Frameworks}.
\newblock RFC 3411, December 2002.
\bibitem{RFC:3412}
J.~Case, D.~Harrington, R.~Presuhn and B.~Wijnen.
\newblock \textsl{Message Processing and Dispatching for the
Simple Network Management Protocol (SNMP)}
\newblock RFC 3412, December 2002.
\bibitem{RFC:3414}
U.~Blumenthal and B.~Wijnen.
\newblock \textsl{User-based Security Model (USM) for version 3 of the
Simple Network Management Protocol (SNMPv3)}.
\newblock RFC 3414, December 2002.
\bibitem{RFC:3415}
B.~Wijnen, R.~Presuhn, and K.~McCloghrie.
\newblock \textsl{View-based Access Control Model (VACM) for the
Simple Network Management Protocol (SNMP).}
\newblock RFC 3415, December 2002.
\bibitem{RFC:3416}
R.~Presuhn, J.~Case, K.~McCloghrie, M~.Rose and S.~Waldbusser.
\newblock \textsl{Version 2 of the Protocol Operations for
the Simple Network Management Protocol (SNMP)}.
\newblock RFC 3416, December 2002.
\bibitem{RFC:3418}
R.~Presuhn, J.~Case, K.~McCloghrie, M.~Rose, and S.~Waldbusser.
\newblock \textsl{Management Information Base (MIB) for the Simple
Network Management Protocol (SNMP).}
\newblock RFC 3418, December 2002.
\bibitem{RFC:4510}
K.~Zeilenga,~Ed.
\newblock \textsl{Lightweight Directory Access Protocol (LDAP):
Technical Specification Road Map}
\newblock RFC 4510, June 2006.
\end{thebibliography}
\end{document}
%%% Local Variables:
%%% coding: utf-8
%%% mode: latex
%%% TeX-master: t
%%% End:
|
---
layout: article
title: Unity 锦囊
tags: unity cookbook
date: 2019-12-28
category: unity
---
# Shader
## 获取屏幕坐标
```c
o.screenPos = ComputeScreenPos(o.vertex);
```
注意这个坐标:
z 无效,一般可以用 COMPUTE_EYEDEPTH 来存深度
是投影之前的坐标值,没有除以 w 分量,在 ps 中使用时需要除以w分量才是真正的屏幕坐标
{:.success}
## 获取深度
### 获取当前像素的深度:
`define COMPUTE_EYEDEPTH(o) o = -UnityObjectToViewPos( v.vertex ).z`
### 获取深度图里的深度:
1. 在 C# 侧设置相机
`Camera.main.depthTextureMode = DepthTextureMode.Depth;`
2. 在 Shader 里声明变量
`sampler2D _CameraDepthTexture;`
3. 注意所使用的 uv
`LinearEyeDepth(tex2Dproj(_CameraDepthTexture,UNITY_PROJ_COORD(i.screenPos)).r);`
## Shader 支持阴影
### 投影物体
加 shadowcaster 的 Pass,或者直接 _Fallback "VertexLit"_
```c
Pass {
Tags { "LightMode"="ShadowCaster" }
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma multi_compile_shadowcaster
#include "UnityCG.cginc"
sampler2D _Shadow;
struct v2f{
V2F_SHADOW_CASTER;
// float2 uv:TEXCOORD2;
};
v2f vert(appdata_base v){
v2f o;
// o.uv = v.texcoord.xy;
TRANSFER_SHADOW_CASTER_NORMALOFFSET(o);
return o;
}
float4 frag( v2f i ) : SV_Target
{
// fixed alpha = tex2D(_Shadow, i.uv).a;
// clip(alpha - 0.5);
SHADOW_CASTER_FRAGMENT(i)
}
ENDCG
}
```
### 接受阴影的物体:
```c
#include "AutoLight.cginc"
...
stuct v2f {
LIGHTING_COORDS(0,1) // replace 0 and 1 with the next available TEXCOORDs in your shader, don't put a semicolon at the end of this line.
}
...
void vert(){
// in vert shader;
TRANSFER_VERTEX_TO_FRAGMENT(o); // Calculates shadow and light attenuation and passes it to the frag shader.
}
...
void frag(){
UNITY_LIGHT_ATTENUATION(attenuation,i,i.worldPosition.xyz);
}
```
### TBN
```c
o.worldPosition = mul(unity_ObjectToWorld,v.vertex);
o.worldNormal = UnityObjectToWorldNormal(v.normal);
o.tangent = UnityObjectToWorldDir(v.tangent.xyz);
o.binormal = cross(o.worldNormal.xyz,o.tangent.xyz)* v.tangent.w * unity_WorldTransformParams.w;
...
half3 normal = TangentNormal(xz);
normal = normalize(
normal.x * v.tangent +
normal.y * v.binormal +
normal.z * v.worldNormal
);
```
## 获取相机透视参数
_ZBufferParams
```c
float4 _ZBufferParams;// (0-1 range)
// x is 1.0 - (camera's far plane) / (camera's near plane)
// y is (camera's far plane) / (camera's near plane)
// z is x / (camera's far plane)
// w is y / (camera's far plane)
```
## 纹理太多sampler超标了怎么办
### 1. 合并 sampler
```c
#pragma target 4.0 // 前提:4.0 以上
// 替换 sampler2d _Tex;
UNITY_DECLARE_TEX2D(_Tex); (占用 sampler 的图)
UNITY_DECLARE_TEX2D_NOSAMPLER(_NoSampleTex); (不占用 sampler 的图)
// 替换 tex2d(_Tex,i.uv);
UNITY_SAMPLE_TEX2D(_Tex, i.uv);(占用 sampler 的图)
UNITY_SAMPLE_TEX2D_SAMPLER(_NoSampleTex,_Tex, i.uv);(不占用 sampler 的图)
```
### 2. 使用 Texture2DArray
```c
_Tex ("Texture", 2DArray) = "white" {}
#pragma target 3.0
#pragma require 2darray
UNITY_DECLARE_TEX2DARRAY(_Tex);
_Tex.Sample(sampler_Tex,float3(i.uv, texID));
```
## whiteout 法线混合
[解释看这里](http://www.jackcaron.com/techart/2014/11/14/ue4-normal-blending)
`n = UnpackNormal(normalize(a.x + b.x, a.y + b.y, a.z * b.z))`
## 神秘海域 ToneMapping
```c
float3 ACESFilm( float3 x )
{
float a = 2.51f;
float b = 0.03f;
float c = 2.43f;
float d = 0.59f;
float e = 0.14f;
return saturate((x*(a*x+b))/(x*(c*x+d)+e));
}
```
## 用 RGBA 编码 float
```c
inline float4 EncodeFloatRGBA( float v ) {
float4 enc = float4(1.0, 255.0, 65025.0, 16581375.0) * v;
enc = frac(enc);
enc -= enc.yzww * float4(1.0/255.0,1.0/255.0,1.0/255.0,0.0);
return enc;
}
inline float DecodeFloatRGBA( float4 rgba ) {
return dot( rgba, float4(1.0, 1/255.0, 1/65025.0, 1/16581375.0) );
}
```
## gpu instancing shader 格式速查
(待补)
## 求亮度
```
float rgb2luma(vec3 rgb) {
return rgb.g; // Nvidia官方版本
// return dot(rgb, vec3(0.2126, 0.7152, 0.0722)); // 最流行的亮度计算
// return dot(rgb, vec3(0.299, 0.587, 0.114)); // 曾经最流行的方法
// return sqrt(0.299 * rgb.r * rgb.r + 0.587 * rgb.g * rgb.g + 0.114 * rgb.b * rgb.b); // 更精确的计算
// return sqrt(dot(rgb, vec3(0.299, 0.587, 0.114))); // 添加了 gamma 校正的计算
}
```
UnityCG.cginc 中有 LinearRgbToLuminance 方法,用的是上面第二种
# Editor
## 鼠标点击获取屏幕坐标
`Input.mousePosition`
## 修改鼠标样式
在编辑器内:
```
private void OnSceneGUI(){
EditorGUIUtility.AddCursorRect (...)
}
```
运行状态:
`Cursor.SetCursor()`
## CustomEditor 多选物体
```c#
[CustomEditor(typeof(MyPlayer))]
[CanEditMultipleObjects]
// 这时只能用 SerializedProperty
OnInspectorGUI(){
serializedObject.Update();
....
serializedObject.ApplyModifiedProperties();
}
```
## 编辑器编译结束事件
```c#
[UnityEditor.Callbacks.DidReloadScripts]
```
## 监听Unity 资源变动
```c#
public class CAssetPostprocessor : AssetPostprocessor
```
## 烘焙相关隐藏变量
可以参考代码通过序列化的方式修改属性,这些属性没有暴露出来。
```c#
UnityEditor.SerializedObject Sob = new UnityEditor.SerializedObject(r);
UnityEditor.SerializedProperty Sprop = Sob.FindProperty("m_LightmapParameters");
Sprop.objectReferenceValue = yourLightmapParameters;
Sob.ApplyModifiedProperties();
```
Lightmap Parameters 的属性名为 m_LightmapParameters
Optimize Realtime UVs 的属性名为 m_PreserveUVs,注意值为 false 表示 Optimize Realtime UVs 开启
Max Distance 的属性名为 m_AutoUVMaxDistance
Max Angle 的属性名为 m_AutoUVMaxAngle Ignore Normals 的属性名为 m_IgnoreNormalsForChartDetection
Min Chart Size 的属性名为 m_MinimumChartSize,类型为 int,值为 0 或 1
scale in lightmap 的属性名为 m_ScaleInLightmap
{:.success}
## 如何连接 Android Profiler
[知乎](https://zhuanlan.zhihu.com/p/30247546)
adb forward tcp:55000 localabstract:Unity-com.pwrd.terraindemo
{:.success}
## 编辑器中用程序启动播放模式
`EditorApplication.ExecuteMenuItem("Edit/Play"); //(2018)`
`EditorApplication.EnterPlayMode() (2019)`
## 编辑器下修改代码之后触发事件
`UnityEditor.Callbacks.DidReloadScripts`
## 编译dll
`UnityEditor.Compilation.AssemblyBuilder`
## 代码驱动清理 Console
```c#
private void ClearConsole () {
// This simply does "LogEntries.Clear()" the long way:
var logEntries = System.Type.GetType("UnityEditor.LogEntries,UnityEditor.dll");
var clearMethod = logEntries.GetMethod("Clear", System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.Public);
clearMethod.Invoke(null,null);
Debug.Log("清理Console");
}
```
## 去掉Mat 上无效的引用
```c#
public static void CleanUnusedTextures(string materialPath)
{
var mat = AssetDatabase.LoadAssetAtPath<Material>(materialPath);
var so = new SerializedObject(mat);
var shader = mat.shader;
var activeTextureNames = Enumerable
.Range(0, ShaderUtil.GetPropertyCount(shader))
.Where(
index =>
ShaderUtil.GetPropertyType(shader, index)
== ShaderUtil.ShaderPropertyType.TexEnv)
.Select(index => ShaderUtil.GetPropertyName(shader, index));
var activeTextureNameSet = new HashSet<string>(activeTextureNames);
var texEnvsSp = so.FindProperty("m_SavedProperties.m_TexEnvs");
for (var i = texEnvsSp.arraySize - 1; i >= 0; i--)
{
var texSp = texEnvsSp.GetArrayElementAtIndex(i);
var texName = texSp.FindPropertyRelative("first").stringValue;
if (!string.IsNullOrEmpty(texName))
{
if (!activeTextureNameSet.Contains(texName))
{
texEnvsSp.DeleteArrayElementAtIndex(i);
}
}
}
so.ApplyModifiedProperties();
}
```
## 怎么注册回调函数在BUILD PLAYER之前触发
继承 IPreProcessBuildWithReport 并且重写函数 OnPreProcessBuild()
## 在 Project/Hierarchy 面板的每个条目上显示额外信息
EditorApplication.projectWindowItemOnGUI
EditorApplication.projectWindowItemOnGUI
本来显示的名字不能修改,可以在同一行右边显示一些信息,传入的 selectionRect 参数表示此行最右边宽度为 0 的一小条区域
## Texture2D 导出文件
```c#
Texture2D t;
// ...
var bytes = ImageConversion.EncodeToPNG(t);
var file = File.Open(Application.dataPath + "/robot.png", FileMode.Create);
var binary = new BinaryWriter(file);
binary.Write(bytes);
file.Close();
```
## 转换 ASTC 格式
(待补)
# 常用算法
## 经纬度和欧拉角转换
```c#
private Vector2 DirToLLCoord(Vector3 dir){
var longitude /* 经度,以正前方为0 */ = Mathf.Atan2(dir.x,dir.z);
var latitude /* 纬度 */ = Mathf.Acos(dir.y);
return new Vector2(longitude,latitude);
}
private Vector3 LLCoordToDir(Vector2 llCoord){
return new Vector3(
Mathf.Sin(llCoord.y) * Mathf.Sin(llCoord.x),
Mathf.Cos(llCoord.y),
Mathf.Sin(llCoord.y) * Mathf.Cos(llCoord.x)
);
}
```
## 平面上一点是否在三角形内
```c#
bool PointinTriangle(Vector3 A, Vector3 B, Vector3 C, Vector3 P)
{
Vector3 v0 = C - A ;
Vector3 v1 = B - A ;
Vector3 v2 = P - A ;
float dot00 = v0.Dot(v0) ;
float dot01 = v0.Dot(v1) ;
float dot02 = v0.Dot(v2) ;
float dot11 = v1.Dot(v1) ;
float dot12 = v1.Dot(v2) ;
float inverDeno = 1 / (dot00 * dot11 - dot01 * dot01) ;
float u = (dot11 * dot02 - dot01 * dot12) * inverDeno ;
if (u < 0 || u > 1) // if u out of range, return directly
{
return false ;
}
float v = (dot00 * dot12 - dot01 * dot02) * inverDeno ;
if (v < 0 || v > 1) // if v out of range, return directly
{
return false ;
}
return u + v <= 1 ;
}
```
## mesh 导出 obj 文件
```c#
public string MeshToString(MeshFilter mf) {
Mesh m = mf.sharedMesh;
Material[] mats = mf.GetComponent<Renderer>().sharedMaterials;
StringBuilder sb = new StringBuilder();
sb.Append("g ").Append(mf.name).Append("\n");
foreach(Vector3 v in m.vertices) {
//x取负是为了调换坐标系手性,乘100是用于导入max
sb.Append(string.Format("v {0} {1} {2}\n",100*(-v.x+Center.x),100*(v.y-Center.y),100*(v.z-Center.z)));
}
sb.Append("\n");
foreach(Vector3 v in m.normals) {
sb.Append(string.Format("vn {0} {1} {2}\n",-v.x,v.y,v.z));
}
sb.Append("\n");
foreach(Vector3 v in m.uv) {
sb.Append(string.Format("vt {0} {1}\n",v.x,v.y));
}
for (int material=0; material < m.subMeshCount; material ++) {
sb.Append("\n");
sb.Append("usemtl ").Append(mats[material].name).Append(".mat\n");
sb.Append("usemap ").Append(mats[material].name).Append(".mat\n");
int[] triangles = m.GetTriangles(material);
for (int i=0;i<triangles.Length;i+=3) {
sb.Append(string.Format("f {0}/{0}/{0} {1}/{1}/{1} {2}/{2}/{2}\n",
triangles[i]+1, triangles[i+2]+1, triangles[i+1]+1));
}
}
return sb.ToString();
}
public void MeshToFile(MeshFilter mf, string filename) {
using (StreamWriter sw = new StreamWriter(filename))
{
sw.Write(MeshToString(mf));
}
}
```
## 如何读写Excel
```c#
IWorkbook workbook = new HSSFWorkbook ();
ISheet sheet = workbook.CreateSheet ();
```
## 为什么 Surface Shader 里要 atten * 2
[Aras 大神的解释](https://forum.unity.com/threads/why-atten-2.94711/#post-1134403)
Short answer to "why multiply by two?" - because in the EarlyDays, it was a cheap way to "fake" somewhat overbright light in fixed function shaders. And then it stuck, and it kind of dragged along.
We'd like to kill this concept. But that would mean breaking possibly a lot of existing shaders that all of you wrote (suddenly everything would become twice as bright). So yeah, a tough one... worth killing an old stupid concept or not?
{:.success}
# 技巧
## 地形 Terrain 不能旋转和缩放
所以地形 Shader 里获取的 normal 不需要 UnityObjectToWorldNormal,因为只是平移不会修改法线,Object 即 World
切线可以固定为 (1,0,0),简化 tbn 矩阵转换
```c
// 简化: half3 tangent = half3(1,0,0);
normal = half3(
tanNormal.x + worldNormal.x * tanNormal.z,
worldNormal.y * tanNormal.z - worldNormal.z * tanNormal.y,
dot(worldNormal.yz,tanNormal.yz)
);
```
|
The original Sorel Caribou™ boot is often imitated, yet never equaled. This classic women's boot features timeless styling with waterproof, seam-sealed construction and a nubuck leather upper. Other details of the Sorel Caribou™ outdoor boot include a removable, replaceable ThermoPlus® InnerBoot with a wool/acrylic snow cuff. The hand-crafted waterproof vulcanized rubber shell with a Sorel AeroTrac™ outsole provides protection, durability, and reliable traction. |
Outer Shell: 100% Polyester Jacquard. Lining: 100% BIZ COOL anti-snag diamond mesh. Grid mesh underarm panels for breathability. Stow-away hood with print feature. Unique sleeve print feature with adjustable velcro cuff. Two side zippered pockets. Contrast panels, piping and inside placket. UPF rating – Excellent. Modern Fit. Colours: Black/Ash, Black/Gold, Black/Red, Black/White, Grey/Fluro Lime, Maroon/White, Navy/Gold, Navy/Sky, Navy/White, Royal/White. |
#ifndef QT_NO_QT_INCLUDE_WARN
#if defined(__GNUC__)
#warning "Inclusion of header files from include/Qt is deprecated."
#elif defined(_MSC_VER)
#pragma message("WARNING: Inclusion of header files from include/Qt is deprecated.")
#endif
#endif
#include "../QtCore/qreadwritelock.h"
|
I understand the even everyday life can be stressful. Through life cycle changes you may lose your self of sense, develop insecurities or mood changes or lose the spark in your relationship. Therapy is a great mechanism to help you to regain your sense of self, become more balanced, and establish priorities in your life as well as improve relationships. I am currently seeking individuals, couples, children, and/or families with a desire to enhance their personal awareness, gain insight into their lives and decisions making processes, learn more adaptive communication skills and/or improve their current relationships with others and quality of life. |
Stylin' Dredz Spray Shampoo with Tea Tree 350 ml — dredfully clean! Clean up your act with . . . |
It was an eventful Christmas day for the People's Senator, Dr. Victor Umeh OFR (Ohamadike Ndigbo) as he opened wide his gates to receive an influx of over four thousand (4000) children and their parents who preferred to celebrate the Christmas in his premises.
The annual event organized by the Wife of the Senator, Chief Mrs Prisca Umeh (Osodieme) has continously grown to attract many children from all walks of life including very eminent personalities who thrung in to share the Christmas joy with the very overintelletual and proactive Igbotic Senator.
In his message of love and hope, Senator Victor Umeh commended the people for choosing to celebrate the Christmas with him against every other numerous events of the day which demonstrates their love for him and his family. He expressed concern about the increasing number of participants pointing out that soon his premises would no longer contain the growing capacity of the ceremony.
The Senator who sang and danced around with the children also spoke to them on the event of the birth of Christ and its significance, thereby wishing them God's love for the season, good health and a better future as they grow up to become the pride of their various families.
There were lots of entertaining moments with santa-claus, Christmas Carol renditions, eating and drinking, gift items and a token, and after-party to make the celebration worth the while. |
import {Template} from 'meteor/templating';
import {ReactiveVar} from 'meteor/reactive-var';
import './main.html';
//判断是否为客户端
if (Meteor.isClient) {
//注册全局helper
Template.registerHelper('isLogin', function () {
var flag = false;
//逻辑处理
return flag;
});
}
Template.outside.events({
'click button': function (event, template) {
alert('outside');
$('body').css('background-color', 'red');
}
});
Template.inside.events({
'click button': function (event, template) {
alert('inside');
//stopImmediatePropagation();
//event.stopImmediatePropagation();
$('body').css('background-color', 'green');
//stopImmediatePropagation();
}
}) |
/**
* Definition for a binary tree node.
* function TreeNode(val) {
* this.val = val;
* this.left = this.right = null;
* }
*/
/**
* @param {TreeNode} root
* @return {number[][]}
*/
var zigzagLevelOrder = function (root) {
if (!root) return [][];
while (root.next)
};
var divide = function (node, order) {
if (!node) return null;
if (order) {
return [node.left, node.right];
} else {
return [node.right, node.left];
}
}; |
Good afternoon, my name is Rosa Cohen-Cruz and I am a Padilla Supervisor in the Immigration Practice at The Bronx Defenders. In this role I oversee the practice of advising non-citizen defendants on the immigration consequences of their criminal cases. The Bronx Defenders pioneered the model of immigration services embedded in a public defender office over fifteen years ago. Today, our robust immigration practice is comprised of over forty attorneys, social workers, advocates and administrators. We provide deportation defense in both detained and non-detained court settings. Our Padilla practice provides advice and counsel to nearly 1,000 non-citizen clients each year throughout the pendency of their cases in both Criminal and Family Court to avoid or mitigate negative immigration consequences and we are sometimes able to improve our clients’ immigration statuses, and help them become lawful permanent residents or U.S. citizens. I am testifying today to voice our support for the resolution calling on the State Legislature to pass, and the Governor to sign, the “Protect Our Courts Act” (A.2176 / S.425), in order to protect the due process rights of all New Yorkers, regardless of immigration status.
Over the past two years, we have seen a disturbing trend of our clients being arrested by ICE in and around New York courts. In the Bronx we witness ICE agents using the court house as a venue to surveil New York’s immigrant residents. ICE agents sit in court rooms and listen to private attorney/client conversations in the hallways to identify targets. As defenders, we have watched, often helplessly, as ICE agents use scheduled court appearances to arrest and detain our clients who have come to court to defend themselves. The rampant arrests of New Yorkers who are responsibly attending court hearings damage the fair delivery of due process to our immigrant community members, creating an unwelcoming and indeed terrifying environment for non-citizens accused of crimes.
The practice of arresting non-citizens in court creates fear and distrust in the criminal justice system and inhibits public defenders ability to zealously represent their clients in criminal court. The resulting fear of courts undermines the legal system in the following ways: 1) clients accept unfavorable plea deals to avoid coming to court; 2) ICE uses excessive force and disregards due process and right to counsel; and 3) open cases create delay and disruption to the immigration court process. The Protect our Courts Act provides important measures to maintain courts as safe spaces for all New Yorkers, regardless of immigration status, thus equally protecting everyone’s right to fairly access the court system. |
Solid Maple through-out (No veneers or 5 ply) with a killer Bluegrass tone. Upgrade to a Flathead tone ring for a brighter punchier sound. Superb quality and tone: handcrafted in England. Fully customizable design. Left hander at no extra charge. Build time 6 to 8 weeks.
Choice of headstock and tuners: 'Old Time' solid headstock with Gotoh Japanese 4:1 planetary tuners or slotted headstock with Grover Sta-Tite 18:1 tuners (choose from drop down menu).
Left handed version. Please enquire.
19 fret four string tenor version. Please enquire.
Remo Frosted skin. Please enquire. |
Located just a hop, skip, and a jump from the U of M campus, this is definitely the place to go when you find yourself caught over in Northeast. Given the beautiful weather we’ve been having you might want to give the summer roll a try, which features tempura shrimp and gari, plus yellowtail marinated in spicy ponzu with daikon and carrots.
This has been a South Minneapolis staple with a solid fan base for quite some time, and while it often seems to go unnoticed by people outside its 'hood, this place serves some pretty decent plates of sushi. Your traditional list of standard items are all represented, but what’s nice is that the servers bring you a card and you mark down what types of sushi you want and how many pieces you require, which makes for a pretty simple ordering process, and you don’t have to feel ridiculous when listing off 20 different sushi items.
One of St. Paul’s premier sushi hotspots, this place has an entire portion of its menu dedicated to specialty rolls named after MN Wild players, including one called In Memory of Derek Boogaard, the former Wild star who died in 2011. The memorial roll features shrimp tempura and spicy mayo topped with crab meat, cream cheese, and a drizzle of Sriracha.
For a long time most people thought this place was the single best sushi restaurant in the Twin Cities, and while its sushi typically runs toward more traditional fare, it's the only sushi restaurant in town where, during the winter months, you can find fugu (the infamous and potentially lethal blowfish) on the menu (only at the Downtown location). Don’t worry though, it's also got the obligatory laundry list of rolls if that’s what you’re looking for.
Opened in a remodeled two-car garage back in 1959, this is the place that not only introduced the Twin Cities to sushi, but also to Japanese food in general. Its come a long way since then, but it still sling some of the best fish in town. Might we suggest a platter of various nigiri and a spicy tuna roll? If you’re going to nosh on the classics, you might as well do it at the place that’s been doing it the longest!
People have been digging on this place since its doors opened up just over a year ago. With a firm dedication to sustainably sourced seafood, it absolutely knows how to deliver. Also, as far as we know, it's the only place in town doing oshizushi (pressed sushi). Go for the sake oshizushi, which comes with salmon, a slice of lemon, and rice all compacted together with a fish egg garnish for a blast of delicious flavor!
Masu has been a fan favorite since it opened in the spring of 2011. With a great selection of quality rolls, nigiri, and various other Japanese-inspired goodies, along with a pretty rocking happy hour, it’s no surprise that it's one of the best spots in town. Consider ordering the namesake Masu Roll, which comes shrimp tempura, habanero masago, avocado, salmon, scallop, unagi, and green chili sauce. Don’t forget to order yourself a Big Man Japan to help wash it all down.
It’s almost impossible for us to wrap our heads around the fact that one of the best sushi restaurants in the Twin Cities (okay, Wayzata) started out as a sushi-slinging food truck, but it did. Now it's not only gone brick-and-mortar, but it also had to lease out a neighboring business so it could accommodate the droves of people looking for incredible sushi. Go for an assortment of nigiri because there’s no other place in town that prepares generous slices of incredible quality fish quite like it does. The rolls are equally as generous and if you’re going that route, we’d suggest the Silly Bill, which is named after owner and goofball extraordinaire, Billy Tserenbat. |
import { BrowserModule, Title } from '@angular/platform-browser';
import { NgModule, APP_INITIALIZER } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { HttpClientModule } from '@angular/common/http';
import './rxjs-extensions';
import { ServicesModule } from './services/services.module';
import { SharedModule } from './shared/shared.module';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { HomeComponent } from './home/home.component';
import { ErrorComponent } from './error/error.component';
import { NotFoundComponent } from './not-found/not-found.component';
@NgModule({
declarations: [
AppComponent,
HomeComponent,
ErrorComponent,
NotFoundComponent
],
imports: [
BrowserModule,
FormsModule,
HttpClientModule,
ServicesModule.forRoot(),
SharedModule.forRoot(),
AppRoutingModule
],
providers: [
Title
],
bootstrap: [AppComponent]
})
export class AppModule { }
|
Since I started running just under a year ago, I’ve come a long way (158 miles to be precise!).
I started running to become a healthier, fitter and stronger person. I wanted to lose weight for my wedding but I kept it up and the running bug has bitten! Now that’s something I never thought I’d hear myself say.
When I’m out running I have time to clear my head and I become more motivated and energised. I also have more time to be thankful of all the things I take for granted.
Yesterday, along with my best friend Nic , I took part in the Thames 10k at Beale Park and it was an awesome event.
Very hot, very sticky and some challenging terrain (I don’t like running in long grass and I especially didn’t like the midges!) … but I completed the 10k and beat my PB by 4 minutes which I was very pleased with. Here’s a piccy of us with our medals!
I didn’t “beat” many people to the finish line but I did beat that evil voice in my head telling to me stop half way through the race. Mind over matter and I will never give in! It is said that when you’re a runner your mind will give up before your legs do and that’s so true!
I'm stronger than I think – dream big, set goals and you WILL achieve them.
Enjoy your new challenge - instead of focussing on how difficult it is, focus on how lucky you are to have this new opportunity. I run because I can. When I get tired I remember those who can’t run, what they would give to have this simple gift I take for granted – and then I run harder for them!
Make sure you have all the skills/time/support/resources to tackle your challenge. Having all the right gear is just as vital in business!
When taking on a new challenge don't be afraid to ask for advice. And if the advice is useful, share it so others can benefit from your experience. I’ve been given many running tips and advice over the past year and now I find myself sharing that with new runners and that feels good!
Break your new challenge into small manageable chunks. I have an excellent business coach, Rob Pickering – and he’s always stressing the importance of setting a goal and taking bite size chucks to get there. It’s the key to success and I’ve taken that advice and adapted it to my personal life as well.
Track your progress so you can see how far you have come. If something doesn't go to plan look back at your progress see how far you have come and be spurred on to keep at it!
Tell people you’re going to do something and it’s much more likely that you will achieve it. People will then ask how you are progressing and this support can be really encouraging – and it holds you accountable of course! |
#/a Makefile for Modules
include ../make.inc
# location of needed modules
MODFLAGS=$(BASEMOD_FLAGS) \
$(MOD_FLAG)../ELPA/src
# list of modules
MODULES = \
additional_kpoints.o \
autopilot.o \
basic_algebra_routines.o \
becmod.o \
bfgs_module.o \
bspline.o \
bz_form.o \
cell_base.o \
check_stop.o \
command_line_options.o \
compute_dipole.o \
constants.o \
constraints_module.o \
control_flags.o \
coulomb_vcut.o \
dist.o \
electrons_base.o \
environment.o \
fd_gradient.o \
fft_base.o \
fft_rho.o \
fsockets.o \
funct.o \
generate_function.o \
gradutils.o \
gvecw.o \
input_parameters.o \
invmat.o \
io_files.o \
io_global.o \
ions_base.o \
kind.o \
lmdif.o \
mdiis.o \
mm_dispersion.o \
mp_bands.o \
mp_exx.o \
mp_global.o \
mp_images.o \
mp_pools.o \
mp_wave.o \
mp_world.o \
noncol.o \
open_close_input_file.o \
parameters.o \
parser.o \
plugin_flags.o \
plugin_arguments.o \
plugin_variables.o \
pw_dot.o \
qmmm.o \
random_numbers.o \
read_cards.o \
read_input.o \
read_namelists.o \
read_pseudo.o \
recvec.o \
recvec_subs.o \
run_info.o \
space_group.o \
set_para_diag.o \
set_signal.o \
set_vdw_corr.o \
setqf.o \
timestep.o\
tsvdw.o\
mbdlib.o\
version.o \
wannier_gw.o\
wannier_new.o \
wavefunctions.o \
ws_base.o \
xc_vdW_DF.o \
xc_rVV10.o \
io_base.o \
qes_types_module.o \
qes_libs_module.o \
qes_write_module.o \
qes_read_module.o \
qes_reset_module.o \
qes_init_module.o \
qes_read_module.o \
qes_bcast_module.o \
qexsd.o \
qexsd_copy.o \
qexsd_init.o \
qexsd_input.o \
hdf5_qe.o\
qeh5_module.o\
fox_init_module.o \
xsf.o \
wyckoff.o \
wypos.o \
zvscal.o
# list of subroutines and functions (not modules) previously found in flib/
OBJS = \
atom_weight.o \
capital.o \
cryst_to_car.o \
expint.o \
generate_k_along_lines.o \
has_xml.o \
inpfile.o \
int_to_char.o \
latgen.o \
linpack.o \
matches.o \
plot_io.o \
radial_gradients.o \
rgen.o \
recips.o \
remove_tot_torque.o \
set_hubbard_l.o \
set_hubbard_n.o \
sort.o \
trimcheck.o \
test_input_file.o \
date_and_tim.o \
volume.o \
wgauss.o \
w0gauss.o \
w1gauss.o \
deviatoric.o
# GPU versions of modules
MODULES += \
wavefunctions_gpu.o \
becmod_gpu.o \
becmod_subs_gpu.o \
cuda_subroutines.o \
random_numbers_gpu.o
TLDEPS= libfox libutil libla libfft librxc
all : libqemod.a
## The following is needed only for lapack compiled from sources
dlamch.o : dlamch.f
$(F77) $(FFLAGS_NOOPT) -c $<
libqemod.a: $(MODULES) $(OBJS)
$(AR) $(ARFLAGS) $@ $?
$(RANLIB) $@
tldeps :
if test -n "$(TLDEPS)" ; then \
( cd ../.. ; $(MAKE) $(TLDEPS) || exit 1 ) ; fi
clean :
- /bin/rm -f *.o *.a *.d *.i *~ *_tmp.f90 *.mod *.L
include make.depend
|
<html>
<head>
<title>Mozilla/5.0 (Linux; Android 5.1; MZ-m2 note Build/LMY47D) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/40.0.2214.114 Mobile Safari/537.36</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.3/css/materialize.min.css">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
</head>
<body>
<div class="container">
<div class="section">
<h1 class="header center orange-text">User agent detail</h1>
<div class="row center">
Mozilla/5.0 (Linux; Android 5.1; MZ-m2 note Build/LMY47D) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/40.0.2214.114 Mobile Safari/537.36
<p>
Detected by 8 of 8 providers<br />
As bot detected by 0 of 7
</p>
</div>
</div>
<div class="section">
<table class="striped"><tr><th></th><th colspan="3">General</th><th colspan="5">Device</th><th colspan="3">Bot</th><th></th></tr><tr><th>Provider</th><th>Browser</th><th>Engine</th><th>OS</th><th>Brand</th><th>Model</th><th>Type</th><th>Is mobile</th><th>Is touch</th><th>Is bot</th><th>Name</th><th>Type</th><th>Actions</th></tr><tr><td>BrowscapPhp<br /><small>6011</small></td><td>Android WebView 4.0</td><td>Blink </td><td>Android 5.1</td><td></td><td></td><td>Mobile Phone</td><td>yes</td><td>yes</td><td></td><td></td><td></td><td>
<!-- Modal Trigger -->
<a class="modal-trigger btn waves-effect waves-light" href="#modal-cbfe2df3-330b-4abd-b5df-0ca181549ca9">Detail</a>
<!-- Modal Structure -->
<div id="modal-cbfe2df3-330b-4abd-b5df-0ca181549ca9" class="modal modal-fixed-footer">
<div class="modal-content">
<h4>BrowscapPhp result detail</h4>
<p><pre><code class="php">stdClass Object
(
[browser_name_regex] => /^mozilla\/5\.0 \(.*linux.*android.5\.1.* build\/.*\) applewebkit\/.* \(khtml,.*like gecko.*\) version\/4\.0.*chrome.*safari.*$/
[browser_name_pattern] => mozilla/5.0 (*linux*android?5.1* build/*) applewebkit/* (khtml,*like gecko*) version/4.0*chrome*safari*
[parent] => Android WebView 4.0
[comment] => Android WebView 4.0
[browser] => Android WebView
[browser_type] => Browser
[browser_bits] => 32
[browser_maker] => Google Inc
[browser_modus] => unknown
[version] => 4.0
[majorver] => 4
[minorver] => 0
[platform] => Android
[platform_version] => 5.1
[platform_description] => Android OS
[platform_bits] => 32
[platform_maker] => Google Inc
[alpha] =>
[beta] =>
[win16] =>
[win32] =>
[win64] =>
[frames] => 1
[iframes] => 1
[tables] => 1
[cookies] => 1
[backgroundsounds] =>
[javascript] => 1
[vbscript] =>
[javaapplets] =>
[activexcontrols] =>
[ismobiledevice] => 1
[istablet] =>
[issyndicationreader] =>
[crawler] =>
[cssversion] => 3
[aolversion] => 0
[device_name] => general Mobile Phone
[device_maker] => unknown
[device_type] => Mobile Phone
[device_pointing_method] => touchscreen
[device_code_name] => general Mobile Phone
[device_brand_name] => unknown
[renderingengine_name] => Blink
[renderingengine_version] => unknown
[renderingengine_description] => a WebKit Fork by Google
[renderingengine_maker] => Google Inc
)
</code></pre></p>
</div>
<div class="modal-footer">
<a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a>
</div>
</div>
</td></tr><tr><td>DonatjUAParser<br /><small>v0.5.0</small></td><td>Chrome 40.0.2214.114</td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td>
<!-- Modal Trigger -->
<a class="modal-trigger btn waves-effect waves-light" href="#modal-6fae891b-b0d5-4415-b07d-355015c3af67">Detail</a>
<!-- Modal Structure -->
<div id="modal-6fae891b-b0d5-4415-b07d-355015c3af67" class="modal modal-fixed-footer">
<div class="modal-content">
<h4>DonatjUAParser result detail</h4>
<p><pre><code class="php">Array
(
[platform] => Android
[browser] => Chrome
[version] => 40.0.2214.114
)
</code></pre></p>
</div>
<div class="modal-footer">
<a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a>
</div>
</div>
</td></tr><tr><td>PiwikDeviceDetector<br /><small>3.5.1</small></td><td>Chrome Mobile 40.0</td><td>Blink </td><td>Android 5.1</td><td>Meizu</td><td>M2 Note</td><td>phablet</td><td>yes</td><td></td><td></td><td></td><td></td><td>
<!-- Modal Trigger -->
<a class="modal-trigger btn waves-effect waves-light" href="#modal-fc0f1b55-50d8-49c2-bb12-4cc1d8144ebf">Detail</a>
<!-- Modal Structure -->
<div id="modal-fc0f1b55-50d8-49c2-bb12-4cc1d8144ebf" class="modal modal-fixed-footer">
<div class="modal-content">
<h4>PiwikDeviceDetector result detail</h4>
<p><pre><code class="php">Array
(
[client] => Array
(
[type] => browser
[name] => Chrome Mobile
[short_name] => CM
[version] => 40.0
[engine] => Blink
)
[operatingSystem] => Array
(
[name] => Android
[short_name] => AND
[version] => 5.1
[platform] =>
)
[device] => Array
(
[brand] => M1
[brandName] => Meizu
[model] => M2 Note
[device] => 10
[deviceName] => phablet
)
[bot] =>
[extra] => Array
(
[isBot] =>
[isBrowser] => 1
[isFeedReader] =>
[isMobileApp] =>
[isPIM] =>
[isLibrary] =>
[isMediaPlayer] =>
[isCamera] =>
[isCarBrowser] =>
[isConsole] =>
[isFeaturePhone] =>
[isPhablet] => 1
[isPortableMediaPlayer] =>
[isSmartDisplay] =>
[isSmartphone] =>
[isTablet] =>
[isTV] =>
[isDesktop] =>
[isMobile] => 1
[isTouchEnabled] =>
)
)
</code></pre></p>
</div>
<div class="modal-footer">
<a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a>
</div>
</div>
</td></tr><tr><td>SinergiBrowserDetector<br /><small>6.0.0</small></td><td>Chrome 40.0.2214.114</td><td><i class="material-icons">close</i></td><td>Android 5.1</td><td><i class="material-icons">close</i></td><td></td><td><i class="material-icons">close</i></td><td>yes</td><td><i class="material-icons">close</i></td><td></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td>
<!-- Modal Trigger -->
<a class="modal-trigger btn waves-effect waves-light" href="#modal-8c08f104-4e61-421b-9405-291b09c383dc">Detail</a>
<!-- Modal Structure -->
<div id="modal-8c08f104-4e61-421b-9405-291b09c383dc" class="modal modal-fixed-footer">
<div class="modal-content">
<h4>SinergiBrowserDetector result detail</h4>
<p><pre><code class="php">Array
(
[browser] => Sinergi\BrowserDetector\Browser Object
(
[userAgent:Sinergi\BrowserDetector\Browser:private] => Sinergi\BrowserDetector\UserAgent Object
(
[userAgentString:Sinergi\BrowserDetector\UserAgent:private] => Mozilla/5.0 (Linux; Android 5.1; MZ-m2 note Build/LMY47D) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/40.0.2214.114 Mobile Safari/537.36
)
[name:Sinergi\BrowserDetector\Browser:private] => Chrome
[version:Sinergi\BrowserDetector\Browser:private] => 40.0.2214.114
[isRobot:Sinergi\BrowserDetector\Browser:private] =>
[isChromeFrame:Sinergi\BrowserDetector\Browser:private] =>
)
[operatingSystem] => Sinergi\BrowserDetector\Os Object
(
[name:Sinergi\BrowserDetector\Os:private] => Android
[version:Sinergi\BrowserDetector\Os:private] => 5.1
[isMobile:Sinergi\BrowserDetector\Os:private] => 1
[userAgent:Sinergi\BrowserDetector\Os:private] => Sinergi\BrowserDetector\UserAgent Object
(
[userAgentString:Sinergi\BrowserDetector\UserAgent:private] => Mozilla/5.0 (Linux; Android 5.1; MZ-m2 note Build/LMY47D) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/40.0.2214.114 Mobile Safari/537.36
)
)
[device] => Sinergi\BrowserDetector\Device Object
(
[name:Sinergi\BrowserDetector\Device:private] => unknown
[userAgent:Sinergi\BrowserDetector\Device:private] => Sinergi\BrowserDetector\UserAgent Object
(
[userAgentString:Sinergi\BrowserDetector\UserAgent:private] => Mozilla/5.0 (Linux; Android 5.1; MZ-m2 note Build/LMY47D) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/40.0.2214.114 Mobile Safari/537.36
)
)
)
</code></pre></p>
</div>
<div class="modal-footer">
<a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a>
</div>
</div>
</td></tr><tr><td>UAParser<br /><small>v3.4.5</small></td><td>Chrome Mobile 40.0.2214</td><td><i class="material-icons">close</i></td><td>Android 5.1</td><td></td><td>MZ-m2 note</td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td></td><td></td><td><i class="material-icons">close</i></td><td>
<!-- Modal Trigger -->
<a class="modal-trigger btn waves-effect waves-light" href="#modal-8f4c86c5-433e-4536-b799-ad26d77264e0">Detail</a>
<!-- Modal Structure -->
<div id="modal-8f4c86c5-433e-4536-b799-ad26d77264e0" class="modal modal-fixed-footer">
<div class="modal-content">
<h4>UAParser result detail</h4>
<p><pre><code class="php">UAParser\Result\Client Object
(
[ua] => UAParser\Result\UserAgent Object
(
[major] => 40
[minor] => 0
[patch] => 2214
[family] => Chrome Mobile
)
[os] => UAParser\Result\OperatingSystem Object
(
[major] => 5
[minor] => 1
[patch] =>
[patchMinor] =>
[family] => Android
)
[device] => UAParser\Result\Device Object
(
[brand] => Generic_Android
[model] => MZ-m2 note
[family] => MZ-m2 note
)
[originalUserAgent] => Mozilla/5.0 (Linux; Android 5.1; MZ-m2 note Build/LMY47D) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/40.0.2214.114 Mobile Safari/537.36
)
</code></pre></p>
</div>
<div class="modal-footer">
<a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a>
</div>
</div>
</td></tr><tr><td>WhichBrowser<br /><small>2.0.9</small></td><td>Chrome 40</td><td>Blink 537.36</td><td>Android 5.1</td><td>Meizu</td><td>M2 Note</td><td>mobile:smart</td><td>yes</td><td><i class="material-icons">close</i></td><td></td><td></td><td><i class="material-icons">close</i></td><td>
<!-- Modal Trigger -->
<a class="modal-trigger btn waves-effect waves-light" href="#modal-62f1f3a3-0c44-4ecb-9ee2-48145e35736b">Detail</a>
<!-- Modal Structure -->
<div id="modal-62f1f3a3-0c44-4ecb-9ee2-48145e35736b" class="modal modal-fixed-footer">
<div class="modal-content">
<h4>WhichBrowser result detail</h4>
<p><pre><code class="php">Array
(
[browser] => Array
(
[name] => Chrome
[version] => 40
[type] => browser
)
[engine] => Array
(
[name] => Blink
[version] => 537.36
)
[os] => Array
(
[name] => Android
[version] => 5.1
)
[device] => Array
(
[type] => mobile
[subtype] => smart
[manufacturer] => Meizu
[model] => M2 Note
)
)
</code></pre></p>
</div>
<div class="modal-footer">
<a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a>
</div>
</div>
</td></tr><tr><td>Woothee<br /><small>v1.2.0</small></td><td>Chrome 40.0.2214.114</td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td>smartphone</td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td></td><td></td><td><i class="material-icons">close</i></td><td>
<!-- Modal Trigger -->
<a class="modal-trigger btn waves-effect waves-light" href="#modal-bd437f52-91e9-4ce8-88f7-6e5206ed6635">Detail</a>
<!-- Modal Structure -->
<div id="modal-bd437f52-91e9-4ce8-88f7-6e5206ed6635" class="modal modal-fixed-footer">
<div class="modal-content">
<h4>Woothee result detail</h4>
<p><pre><code class="php">Array
(
[name] => Chrome
[vendor] => Google
[version] => 40.0.2214.114
[category] => smartphone
[os] => Android
[os_version] => 5.1
)
</code></pre></p>
</div>
<div class="modal-footer">
<a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a>
</div>
</div>
</td></tr><tr><td>Wurfl<br /><small>1.6.4</small></td><td>Chromium 40</td><td><i class="material-icons">close</i></td><td>Android 5.1</td><td>Meizu</td><td>M2 Note</td><td>Smartphone</td><td>yes</td><td>yes</td><td></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td>
<!-- Modal Trigger -->
<a class="modal-trigger btn waves-effect waves-light" href="#modal-3a72b31e-c3c1-4317-a357-7a6d5e3c7027">Detail</a>
<!-- Modal Structure -->
<div id="modal-3a72b31e-c3c1-4317-a357-7a6d5e3c7027" class="modal modal-fixed-footer">
<div class="modal-content">
<h4>Wurfl result detail</h4>
<p><pre><code class="php">Array
(
[virtual] => Array
(
[is_android] => true
[is_ios] => false
[is_windows_phone] => false
[is_app] => false
[is_full_desktop] => false
[is_largescreen] => true
[is_mobile] => true
[is_robot] => false
[is_smartphone] => true
[is_touchscreen] => true
[is_wml_preferred] => false
[is_xhtmlmp_preferred] => false
[is_html_preferred] => true
[advertised_device_os] => Android
[advertised_device_os_version] => 5.1
[advertised_browser] => Chromium
[advertised_browser_version] => 40
[complete_device_name] => Meizu M2 Note (M2 Note)
[form_factor] => Smartphone
[is_phone] => true
[is_app_webview] => false
)
[all] => Array
(
[brand_name] => Meizu
[model_name] => M2 Note
[unique] => true
[ununiqueness_handler] =>
[is_wireless_device] => true
[device_claims_web_support] => true
[has_qwerty_keyboard] => true
[can_skip_aligned_link_row] => true
[uaprof] =>
[uaprof2] =>
[uaprof3] =>
[nokia_series] => 0
[nokia_edition] => 0
[device_os] => Android
[mobile_browser] => Chrome Mobile
[mobile_browser_version] =>
[device_os_version] => 5.1
[pointing_method] => touchscreen
[release_date] => 2015_june
[marketing_name] => M2 Note
[model_extra_info] =>
[nokia_feature_pack] => 0
[can_assign_phone_number] => true
[is_tablet] => false
[manufacturer_name] =>
[is_bot] => false
[is_google_glass] => false
[proportional_font] => false
[built_in_back_button_support] => false
[card_title_support] => true
[softkey_support] => false
[table_support] => true
[numbered_menus] => false
[menu_with_select_element_recommended] => false
[menu_with_list_of_links_recommended] => true
[icons_on_menu_items_support] => false
[break_list_of_links_with_br_element_recommended] => true
[access_key_support] => false
[wrap_mode_support] => false
[times_square_mode_support] => false
[deck_prefetch_support] => false
[elective_forms_recommended] => true
[wizards_recommended] => false
[image_as_link_support] => false
[insert_br_element_after_widget_recommended] => false
[wml_can_display_images_and_text_on_same_line] => false
[wml_displays_image_in_center] => false
[opwv_wml_extensions_support] => false
[wml_make_phone_call_string] => wtai://wp/mc;
[chtml_display_accesskey] => false
[emoji] => false
[chtml_can_display_images_and_text_on_same_line] => false
[chtml_displays_image_in_center] => false
[imode_region] => none
[chtml_make_phone_call_string] => tel:
[chtml_table_support] => false
[xhtml_honors_bgcolor] => true
[xhtml_supports_forms_in_table] => true
[xhtml_support_wml2_namespace] => false
[xhtml_autoexpand_select] => false
[xhtml_select_as_dropdown] => false
[xhtml_select_as_radiobutton] => false
[xhtml_select_as_popup] => false
[xhtml_display_accesskey] => false
[xhtml_supports_invisible_text] => false
[xhtml_supports_inline_input] => false
[xhtml_supports_monospace_font] => false
[xhtml_supports_table_for_layout] => true
[xhtml_supports_css_cell_table_coloring] => true
[xhtml_format_as_css_property] => false
[xhtml_format_as_attribute] => false
[xhtml_nowrap_mode] => false
[xhtml_marquee_as_css_property] => false
[xhtml_readable_background_color1] => #FFFFFF
[xhtml_readable_background_color2] => #FFFFFF
[xhtml_allows_disabled_form_elements] => true
[xhtml_document_title_support] => true
[xhtml_preferred_charset] => iso-8859-1
[opwv_xhtml_extensions_support] => false
[xhtml_make_phone_call_string] => tel:
[xhtmlmp_preferred_mime_type] => text/html
[xhtml_table_support] => true
[xhtml_send_sms_string] => sms:
[xhtml_send_mms_string] => mms:
[xhtml_file_upload] => supported
[cookie_support] => true
[accept_third_party_cookie] => true
[xhtml_supports_iframe] => full
[xhtml_avoid_accesskeys] => true
[xhtml_can_embed_video] => none
[ajax_support_javascript] => true
[ajax_manipulate_css] => true
[ajax_support_getelementbyid] => true
[ajax_support_inner_html] => true
[ajax_xhr_type] => standard
[ajax_manipulate_dom] => true
[ajax_support_events] => true
[ajax_support_event_listener] => true
[ajax_preferred_geoloc_api] => w3c_api
[xhtml_support_level] => 4
[preferred_markup] => html_web_4_0
[wml_1_1] => false
[wml_1_2] => false
[wml_1_3] => false
[html_wi_w3_xhtmlbasic] => true
[html_wi_oma_xhtmlmp_1_0] => true
[html_wi_imode_html_1] => false
[html_wi_imode_html_2] => false
[html_wi_imode_html_3] => false
[html_wi_imode_html_4] => false
[html_wi_imode_html_5] => false
[html_wi_imode_htmlx_1] => false
[html_wi_imode_htmlx_1_1] => false
[html_wi_imode_compact_generic] => false
[html_web_3_2] => true
[html_web_4_0] => true
[voicexml] => false
[multipart_support] => false
[total_cache_disable_support] => false
[time_to_live_support] => false
[resolution_width] => 1080
[resolution_height] => 1920
[columns] => 60
[max_image_width] => 320
[max_image_height] => 640
[rows] => 40
[physical_screen_width] => 69
[physical_screen_height] => 122
[dual_orientation] => true
[density_class] => 1.0
[wbmp] => true
[bmp] => false
[epoc_bmp] => false
[gif_animated] => false
[jpg] => true
[png] => true
[tiff] => false
[transparent_png_alpha] => true
[transparent_png_index] => true
[svgt_1_1] => true
[svgt_1_1_plus] => false
[greyscale] => false
[gif] => true
[colors] => 65536
[webp_lossy_support] => true
[webp_lossless_support] => true
[post_method_support] => true
[basic_authentication_support] => true
[empty_option_value_support] => true
[emptyok] => false
[nokia_voice_call] => false
[wta_voice_call] => false
[wta_phonebook] => false
[wta_misc] => false
[wta_pdc] => false
[https_support] => true
[phone_id_provided] => false
[max_data_rate] => 3600
[wifi] => true
[sdio] => false
[vpn] => false
[has_cellular_radio] => true
[max_deck_size] => 2000000
[max_url_length_in_requests] => 256
[max_url_length_homepage] => 0
[max_url_length_bookmark] => 0
[max_url_length_cached_page] => 0
[max_no_of_connection_settings] => 0
[max_no_of_bookmarks] => 0
[max_length_of_username] => 0
[max_length_of_password] => 0
[max_object_size] => 0
[downloadfun_support] => false
[directdownload_support] => true
[inline_support] => false
[oma_support] => true
[ringtone] => false
[ringtone_3gpp] => false
[ringtone_midi_monophonic] => false
[ringtone_midi_polyphonic] => false
[ringtone_imelody] => false
[ringtone_digiplug] => false
[ringtone_compactmidi] => false
[ringtone_mmf] => false
[ringtone_rmf] => false
[ringtone_xmf] => false
[ringtone_amr] => false
[ringtone_awb] => false
[ringtone_aac] => false
[ringtone_wav] => false
[ringtone_mp3] => false
[ringtone_spmidi] => false
[ringtone_qcelp] => false
[ringtone_voices] => 1
[ringtone_df_size_limit] => 0
[ringtone_directdownload_size_limit] => 0
[ringtone_inline_size_limit] => 0
[ringtone_oma_size_limit] => 0
[wallpaper] => false
[wallpaper_max_width] => 0
[wallpaper_max_height] => 0
[wallpaper_preferred_width] => 0
[wallpaper_preferred_height] => 0
[wallpaper_resize] => none
[wallpaper_wbmp] => false
[wallpaper_bmp] => false
[wallpaper_gif] => false
[wallpaper_jpg] => false
[wallpaper_png] => false
[wallpaper_tiff] => false
[wallpaper_greyscale] => false
[wallpaper_colors] => 2
[wallpaper_df_size_limit] => 0
[wallpaper_directdownload_size_limit] => 0
[wallpaper_inline_size_limit] => 0
[wallpaper_oma_size_limit] => 0
[screensaver] => false
[screensaver_max_width] => 0
[screensaver_max_height] => 0
[screensaver_preferred_width] => 0
[screensaver_preferred_height] => 0
[screensaver_resize] => none
[screensaver_wbmp] => false
[screensaver_bmp] => false
[screensaver_gif] => false
[screensaver_jpg] => false
[screensaver_png] => false
[screensaver_greyscale] => false
[screensaver_colors] => 2
[screensaver_df_size_limit] => 0
[screensaver_directdownload_size_limit] => 0
[screensaver_inline_size_limit] => 0
[screensaver_oma_size_limit] => 0
[picture] => false
[picture_max_width] => 0
[picture_max_height] => 0
[picture_preferred_width] => 0
[picture_preferred_height] => 0
[picture_resize] => none
[picture_wbmp] => false
[picture_bmp] => false
[picture_gif] => false
[picture_jpg] => false
[picture_png] => false
[picture_greyscale] => false
[picture_colors] => 2
[picture_df_size_limit] => 0
[picture_directdownload_size_limit] => 0
[picture_inline_size_limit] => 0
[picture_oma_size_limit] => 0
[video] => false
[oma_v_1_0_forwardlock] => false
[oma_v_1_0_combined_delivery] => false
[oma_v_1_0_separate_delivery] => false
[streaming_video] => true
[streaming_3gpp] => true
[streaming_mp4] => true
[streaming_mov] => false
[streaming_video_size_limit] => 0
[streaming_real_media] => none
[streaming_flv] => false
[streaming_3g2] => false
[streaming_vcodec_h263_0] => 10
[streaming_vcodec_h263_3] => -1
[streaming_vcodec_mpeg4_sp] => 2
[streaming_vcodec_mpeg4_asp] => -1
[streaming_vcodec_h264_bp] => 3.0
[streaming_acodec_amr] => nb
[streaming_acodec_aac] => lc
[streaming_wmv] => none
[streaming_preferred_protocol] => http
[streaming_preferred_http_protocol] => apple_live_streaming
[wap_push_support] => false
[connectionless_service_indication] => false
[connectionless_service_load] => false
[connectionless_cache_operation] => false
[connectionoriented_unconfirmed_service_indication] => false
[connectionoriented_unconfirmed_service_load] => false
[connectionoriented_unconfirmed_cache_operation] => false
[connectionoriented_confirmed_service_indication] => false
[connectionoriented_confirmed_service_load] => false
[connectionoriented_confirmed_cache_operation] => false
[utf8_support] => true
[ascii_support] => false
[iso8859_support] => false
[expiration_date] => false
[j2me_cldc_1_0] => false
[j2me_cldc_1_1] => false
[j2me_midp_1_0] => false
[j2me_midp_2_0] => false
[doja_1_0] => false
[doja_1_5] => false
[doja_2_0] => false
[doja_2_1] => false
[doja_2_2] => false
[doja_3_0] => false
[doja_3_5] => false
[doja_4_0] => false
[j2me_jtwi] => false
[j2me_mmapi_1_0] => false
[j2me_mmapi_1_1] => false
[j2me_wmapi_1_0] => false
[j2me_wmapi_1_1] => false
[j2me_wmapi_2_0] => false
[j2me_btapi] => false
[j2me_3dapi] => false
[j2me_locapi] => false
[j2me_nokia_ui] => false
[j2me_motorola_lwt] => false
[j2me_siemens_color_game] => false
[j2me_siemens_extension] => false
[j2me_heap_size] => 0
[j2me_max_jar_size] => 0
[j2me_storage_size] => 0
[j2me_max_record_store_size] => 0
[j2me_screen_width] => 0
[j2me_screen_height] => 0
[j2me_canvas_width] => 0
[j2me_canvas_height] => 0
[j2me_bits_per_pixel] => 0
[j2me_audio_capture_enabled] => false
[j2me_video_capture_enabled] => false
[j2me_photo_capture_enabled] => false
[j2me_capture_image_formats] => none
[j2me_http] => false
[j2me_https] => false
[j2me_socket] => false
[j2me_udp] => false
[j2me_serial] => false
[j2me_gif] => false
[j2me_gif89a] => false
[j2me_jpg] => false
[j2me_png] => false
[j2me_bmp] => false
[j2me_bmp3] => false
[j2me_wbmp] => false
[j2me_midi] => false
[j2me_wav] => false
[j2me_amr] => false
[j2me_mp3] => false
[j2me_mp4] => false
[j2me_imelody] => false
[j2me_rmf] => false
[j2me_au] => false
[j2me_aac] => false
[j2me_realaudio] => false
[j2me_xmf] => false
[j2me_wma] => false
[j2me_3gpp] => false
[j2me_h263] => false
[j2me_svgt] => false
[j2me_mpeg4] => false
[j2me_realvideo] => false
[j2me_real8] => false
[j2me_realmedia] => false
[j2me_left_softkey_code] => 0
[j2me_right_softkey_code] => 0
[j2me_middle_softkey_code] => 0
[j2me_select_key_code] => 0
[j2me_return_key_code] => 0
[j2me_clear_key_code] => 0
[j2me_datefield_no_accepts_null_date] => false
[j2me_datefield_broken] => false
[receiver] => false
[sender] => false
[mms_max_size] => 0
[mms_max_height] => 0
[mms_max_width] => 0
[built_in_recorder] => false
[built_in_camera] => true
[mms_jpeg_baseline] => false
[mms_jpeg_progressive] => false
[mms_gif_static] => false
[mms_gif_animated] => false
[mms_png] => false
[mms_bmp] => false
[mms_wbmp] => false
[mms_amr] => false
[mms_wav] => false
[mms_midi_monophonic] => false
[mms_midi_polyphonic] => false
[mms_midi_polyphonic_voices] => 0
[mms_spmidi] => false
[mms_mmf] => false
[mms_mp3] => false
[mms_evrc] => false
[mms_qcelp] => false
[mms_ota_bitmap] => false
[mms_nokia_wallpaper] => false
[mms_nokia_operatorlogo] => false
[mms_nokia_3dscreensaver] => false
[mms_nokia_ringingtone] => false
[mms_rmf] => false
[mms_xmf] => false
[mms_symbian_install] => false
[mms_jar] => false
[mms_jad] => false
[mms_vcard] => false
[mms_vcalendar] => false
[mms_wml] => false
[mms_wbxml] => false
[mms_wmlc] => false
[mms_video] => false
[mms_mp4] => false
[mms_3gpp] => false
[mms_3gpp2] => false
[mms_max_frame_rate] => 0
[nokiaring] => false
[picturemessage] => false
[operatorlogo] => false
[largeoperatorlogo] => false
[callericon] => false
[nokiavcard] => false
[nokiavcal] => false
[sckl_ringtone] => false
[sckl_operatorlogo] => false
[sckl_groupgraphic] => false
[sckl_vcard] => false
[sckl_vcalendar] => false
[text_imelody] => false
[ems] => false
[ems_variablesizedpictures] => false
[ems_imelody] => false
[ems_odi] => false
[ems_upi] => false
[ems_version] => 0
[siemens_ota] => false
[siemens_logo_width] => 101
[siemens_logo_height] => 29
[siemens_screensaver_width] => 101
[siemens_screensaver_height] => 50
[gprtf] => false
[sagem_v1] => false
[sagem_v2] => false
[panasonic] => false
[sms_enabled] => true
[wav] => false
[mmf] => false
[smf] => false
[mld] => false
[midi_monophonic] => false
[midi_polyphonic] => false
[sp_midi] => false
[rmf] => false
[xmf] => false
[compactmidi] => false
[digiplug] => false
[nokia_ringtone] => false
[imelody] => false
[au] => false
[amr] => false
[awb] => false
[aac] => true
[mp3] => true
[voices] => 1
[qcelp] => false
[evrc] => false
[flash_lite_version] =>
[fl_wallpaper] => false
[fl_screensaver] => false
[fl_standalone] => false
[fl_browser] => false
[fl_sub_lcd] => false
[full_flash_support] => false
[css_supports_width_as_percentage] => true
[css_border_image] => webkit
[css_rounded_corners] => webkit
[css_gradient] => none
[css_spriting] => true
[css_gradient_linear] => none
[is_transcoder] => false
[transcoder_ua_header] => user-agent
[rss_support] => false
[pdf_support] => true
[progressive_download] => true
[playback_vcodec_h263_0] => 10
[playback_vcodec_h263_3] => -1
[playback_vcodec_mpeg4_sp] => 0
[playback_vcodec_mpeg4_asp] => -1
[playback_vcodec_h264_bp] => 3.0
[playback_real_media] => none
[playback_3gpp] => true
[playback_3g2] => false
[playback_mp4] => true
[playback_mov] => false
[playback_acodec_amr] => nb
[playback_acodec_aac] => none
[playback_df_size_limit] => 0
[playback_directdownload_size_limit] => 0
[playback_inline_size_limit] => 0
[playback_oma_size_limit] => 0
[playback_acodec_qcelp] => false
[playback_wmv] => none
[hinted_progressive_download] => true
[html_preferred_dtd] => html4
[viewport_supported] => true
[viewport_width] => device_width_token
[viewport_userscalable] => no
[viewport_initial_scale] =>
[viewport_maximum_scale] =>
[viewport_minimum_scale] =>
[mobileoptimized] => false
[handheldfriendly] => false
[canvas_support] => full
[image_inlining] => true
[is_smarttv] => false
[is_console] => false
[nfc_support] => false
[ux_full_desktop] => false
[jqm_grade] => A
[is_sencha_touch_ok] => false
[controlcap_is_smartphone] => default
[controlcap_is_ios] => default
[controlcap_is_android] => default
[controlcap_is_robot] => default
[controlcap_is_app] => default
[controlcap_advertised_device_os] => default
[controlcap_advertised_device_os_version] => default
[controlcap_advertised_browser] => default
[controlcap_advertised_browser_version] => default
[controlcap_is_windows_phone] => default
[controlcap_is_full_desktop] => default
[controlcap_is_largescreen] => default
[controlcap_is_mobile] => default
[controlcap_is_touchscreen] => default
[controlcap_is_wml_preferred] => default
[controlcap_is_xhtmlmp_preferred] => default
[controlcap_is_html_preferred] => default
[controlcap_form_factor] => default
[controlcap_complete_device_name] => default
)
)
</code></pre></p>
</div>
<div class="modal-footer">
<a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a>
</div>
</div>
</td></tr></table>
</div>
<div class="section">
<h1 class="header center orange-text">About this comparison</h1>
<div class="row center">
<h5 class="header light">
The primary goal of this project is simple<br />
I wanted to know which user agent parser is the most accurate in each part - device detection, bot detection and so on...<br />
<br />
The secondary goal is to provide a source for all user agent parsers to improve their detection based on this results.<br />
<br />
You can also improve this further, by suggesting ideas at <a href="https://github.com/ThaDafinser/UserAgentParserComparison">ThaDafinser/UserAgentParserComparison</a><br />
<br />
The comparison is based on the abstraction by <a href="https://github.com/ThaDafinser/UserAgentParser">ThaDafinser/UserAgentParser</a>
</h5>
</div>
</div>
<div class="card">
<div class="card-content">
Comparison created <i>2016-01-26 16:42:31</i> | by
<a href="https://github.com/ThaDafinser">ThaDafinser</a>
</div>
</div>
</div>
<script src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.3/js/materialize.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/list.js/1.1.1/list.min.js"></script>
<script>
$(document).ready(function(){
// the "href" attribute of .modal-trigger must specify the modal ID that wants to be triggered
$('.modal-trigger').leanModal();
});
</script>
</body>
</html> |
/******************************************************************************
*
* Copyright(c) 2003 - 2014 Intel Corporation. All rights reserved.
*
* Portions of this file are derived from the ipw3945 project, as well
* as portions of the ieee80211 subsystem header files.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License 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, USA
*
* The full GNU General Public License is included in this distribution in the
* file called LICENSE.
*
* Contact Information:
* Intel Linux Wireless <[email protected]>
* Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
*
*****************************************************************************/
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/delay.h>
#include <linux/sched.h>
#include <linux/skbuff.h>
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
#include <linux/if_arp.h>
#include <net/mac80211.h>
#include <asm/div64.h>
#include "iwl-eeprom-read.h"
#include "iwl-eeprom-parse.h"
#include "iwl-io.h"
#include "iwl-trans.h"
#include "iwl-op-mode.h"
#include "iwl-drv.h"
#include "iwl-modparams.h"
#include "iwl-prph.h"
#include "dev.h"
#include "calib.h"
#include "agn.h"
/******************************************************************************
*
* module boiler plate
*
******************************************************************************/
#define DRV_DESCRIPTION "Intel(R) Wireless WiFi Link AGN driver for Linux"
MODULE_DESCRIPTION(DRV_DESCRIPTION);
MODULE_AUTHOR(DRV_COPYRIGHT " " DRV_AUTHOR);
MODULE_LICENSE("GPL");
static const struct iwl_op_mode_ops iwl_dvm_ops;
void iwl_update_chain_flags(struct iwl_priv *priv)
{
struct iwl_rxon_context *ctx;
for_each_context(priv, ctx) {
iwlagn_set_rxon_chain(priv, ctx);
if (ctx->active.rx_chain != ctx->staging.rx_chain)
iwlagn_commit_rxon(priv, ctx);
}
}
/* Parse the beacon frame to find the TIM element and set tim_idx & tim_size */
static void iwl_set_beacon_tim(struct iwl_priv *priv,
struct iwl_tx_beacon_cmd *tx_beacon_cmd,
u8 *beacon, u32 frame_size)
{
u16 tim_idx;
struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)beacon;
/*
* The index is relative to frame start but we start looking at the
* variable-length part of the beacon.
*/
tim_idx = mgmt->u.beacon.variable - beacon;
/* Parse variable-length elements of beacon to find WLAN_EID_TIM */
while ((tim_idx < (frame_size - 2)) &&
(beacon[tim_idx] != WLAN_EID_TIM))
tim_idx += beacon[tim_idx+1] + 2;
/* If TIM field was found, set variables */
if ((tim_idx < (frame_size - 1)) && (beacon[tim_idx] == WLAN_EID_TIM)) {
tx_beacon_cmd->tim_idx = cpu_to_le16(tim_idx);
tx_beacon_cmd->tim_size = beacon[tim_idx+1];
} else
IWL_WARN(priv, "Unable to find TIM Element in beacon\n");
}
int iwlagn_send_beacon_cmd(struct iwl_priv *priv)
{
struct iwl_tx_beacon_cmd *tx_beacon_cmd;
struct iwl_host_cmd cmd = {
.id = REPLY_TX_BEACON,
};
struct ieee80211_tx_info *info;
u32 frame_size;
u32 rate_flags;
u32 rate;
/*
* We have to set up the TX command, the TX Beacon command, and the
* beacon contents.
*/
lockdep_assert_held(&priv->mutex);
if (!priv->beacon_ctx) {
IWL_ERR(priv, "trying to build beacon w/o beacon context!\n");
return 0;
}
if (WARN_ON(!priv->beacon_skb))
return -EINVAL;
/* Allocate beacon command */
if (!priv->beacon_cmd)
priv->beacon_cmd = kzalloc(sizeof(*tx_beacon_cmd), GFP_KERNEL);
tx_beacon_cmd = priv->beacon_cmd;
if (!tx_beacon_cmd)
return -ENOMEM;
frame_size = priv->beacon_skb->len;
/* Set up TX command fields */
tx_beacon_cmd->tx.len = cpu_to_le16((u16)frame_size);
tx_beacon_cmd->tx.sta_id = priv->beacon_ctx->bcast_sta_id;
tx_beacon_cmd->tx.stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE;
tx_beacon_cmd->tx.tx_flags = TX_CMD_FLG_SEQ_CTL_MSK |
TX_CMD_FLG_TSF_MSK | TX_CMD_FLG_STA_RATE_MSK;
/* Set up TX beacon command fields */
iwl_set_beacon_tim(priv, tx_beacon_cmd, priv->beacon_skb->data,
frame_size);
/* Set up packet rate and flags */
info = IEEE80211_SKB_CB(priv->beacon_skb);
/*
* Let's set up the rate at least somewhat correctly;
* it will currently not actually be used by the uCode,
* it uses the broadcast station's rate instead.
*/
if (info->control.rates[0].idx < 0 ||
info->control.rates[0].flags & IEEE80211_TX_RC_MCS)
rate = 0;
else
rate = info->control.rates[0].idx;
priv->mgmt_tx_ant = iwl_toggle_tx_ant(priv, priv->mgmt_tx_ant,
priv->nvm_data->valid_tx_ant);
rate_flags = iwl_ant_idx_to_flags(priv->mgmt_tx_ant);
/* In mac80211, rates for 5 GHz start at 0 */
if (info->band == IEEE80211_BAND_5GHZ)
rate += IWL_FIRST_OFDM_RATE;
else if (rate >= IWL_FIRST_CCK_RATE && rate <= IWL_LAST_CCK_RATE)
rate_flags |= RATE_MCS_CCK_MSK;
tx_beacon_cmd->tx.rate_n_flags =
iwl_hw_set_rate_n_flags(rate, rate_flags);
/* Submit command */
cmd.len[0] = sizeof(*tx_beacon_cmd);
cmd.data[0] = tx_beacon_cmd;
cmd.dataflags[0] = IWL_HCMD_DFL_NOCOPY;
cmd.len[1] = frame_size;
cmd.data[1] = priv->beacon_skb->data;
cmd.dataflags[1] = IWL_HCMD_DFL_NOCOPY;
return iwl_dvm_send_cmd(priv, &cmd);
}
static void iwl_bg_beacon_update(struct work_struct *work)
{
struct iwl_priv *priv =
container_of(work, struct iwl_priv, beacon_update);
struct sk_buff *beacon;
mutex_lock(&priv->mutex);
if (!priv->beacon_ctx) {
IWL_ERR(priv, "updating beacon w/o beacon context!\n");
goto out;
}
if (priv->beacon_ctx->vif->type != NL80211_IFTYPE_AP) {
/*
* The ucode will send beacon notifications even in
* IBSS mode, but we don't want to process them. But
* we need to defer the type check to here due to
* requiring locking around the beacon_ctx access.
*/
goto out;
}
/* Pull updated AP beacon from mac80211. will fail if not in AP mode */
beacon = ieee80211_beacon_get(priv->hw, priv->beacon_ctx->vif);
if (!beacon) {
IWL_ERR(priv, "update beacon failed -- keeping old\n");
goto out;
}
/* new beacon skb is allocated every time; dispose previous.*/
dev_kfree_skb(priv->beacon_skb);
priv->beacon_skb = beacon;
iwlagn_send_beacon_cmd(priv);
out:
mutex_unlock(&priv->mutex);
}
static void iwl_bg_bt_runtime_config(struct work_struct *work)
{
struct iwl_priv *priv =
container_of(work, struct iwl_priv, bt_runtime_config);
mutex_lock(&priv->mutex);
if (test_bit(STATUS_EXIT_PENDING, &priv->status))
goto out;
/* dont send host command if rf-kill is on */
if (!iwl_is_ready_rf(priv))
goto out;
iwlagn_send_advance_bt_config(priv);
out:
mutex_unlock(&priv->mutex);
}
static void iwl_bg_bt_full_concurrency(struct work_struct *work)
{
struct iwl_priv *priv =
container_of(work, struct iwl_priv, bt_full_concurrency);
struct iwl_rxon_context *ctx;
mutex_lock(&priv->mutex);
if (test_bit(STATUS_EXIT_PENDING, &priv->status))
goto out;
/* dont send host command if rf-kill is on */
if (!iwl_is_ready_rf(priv))
goto out;
IWL_DEBUG_INFO(priv, "BT coex in %s mode\n",
priv->bt_full_concurrent ?
"full concurrency" : "3-wire");
/*
* LQ & RXON updated cmds must be sent before BT Config cmd
* to avoid 3-wire collisions
*/
for_each_context(priv, ctx) {
iwlagn_set_rxon_chain(priv, ctx);
iwlagn_commit_rxon(priv, ctx);
}
iwlagn_send_advance_bt_config(priv);
out:
mutex_unlock(&priv->mutex);
}
int iwl_send_statistics_request(struct iwl_priv *priv, u8 flags, bool clear)
{
struct iwl_statistics_cmd statistics_cmd = {
.configuration_flags =
clear ? IWL_STATS_CONF_CLEAR_STATS : 0,
};
if (flags & CMD_ASYNC)
return iwl_dvm_send_cmd_pdu(priv, REPLY_STATISTICS_CMD,
CMD_ASYNC,
sizeof(struct iwl_statistics_cmd),
&statistics_cmd);
else
return iwl_dvm_send_cmd_pdu(priv, REPLY_STATISTICS_CMD, 0,
sizeof(struct iwl_statistics_cmd),
&statistics_cmd);
}
/**
* iwl_bg_statistics_periodic - Timer callback to queue statistics
*
* This callback is provided in order to send a statistics request.
*
* This timer function is continually reset to execute within
* REG_RECALIB_PERIOD seconds since the last STATISTICS_NOTIFICATION
* was received. We need to ensure we receive the statistics in order
* to update the temperature used for calibrating the TXPOWER.
*/
static void iwl_bg_statistics_periodic(unsigned long data)
{
struct iwl_priv *priv = (struct iwl_priv *)data;
if (test_bit(STATUS_EXIT_PENDING, &priv->status))
return;
/* dont send host command if rf-kill is on */
if (!iwl_is_ready_rf(priv))
return;
iwl_send_statistics_request(priv, CMD_ASYNC, false);
}
static void iwl_print_cont_event_trace(struct iwl_priv *priv, u32 base,
u32 start_idx, u32 num_events,
u32 capacity, u32 mode)
{
u32 i;
u32 ptr; /* SRAM byte address of log data */
u32 ev, time, data; /* event log data */
unsigned long reg_flags;
if (mode == 0)
ptr = base + (4 * sizeof(u32)) + (start_idx * 2 * sizeof(u32));
else
ptr = base + (4 * sizeof(u32)) + (start_idx * 3 * sizeof(u32));
/* Make sure device is powered up for SRAM reads */
if (!iwl_trans_grab_nic_access(priv->trans, false, ®_flags))
return;
/* Set starting address; reads will auto-increment */
iwl_write32(priv->trans, HBUS_TARG_MEM_RADDR, ptr);
/*
* Refuse to read more than would have fit into the log from
* the current start_idx. This used to happen due to the race
* described below, but now WARN because the code below should
* prevent it from happening here.
*/
if (WARN_ON(num_events > capacity - start_idx))
num_events = capacity - start_idx;
/*
* "time" is actually "data" for mode 0 (no timestamp).
* place event id # at far right for easier visual parsing.
*/
for (i = 0; i < num_events; i++) {
ev = iwl_read32(priv->trans, HBUS_TARG_MEM_RDAT);
time = iwl_read32(priv->trans, HBUS_TARG_MEM_RDAT);
if (mode == 0) {
trace_iwlwifi_dev_ucode_cont_event(
priv->trans->dev, 0, time, ev);
} else {
data = iwl_read32(priv->trans, HBUS_TARG_MEM_RDAT);
trace_iwlwifi_dev_ucode_cont_event(
priv->trans->dev, time, data, ev);
}
}
/* Allow device to power down */
iwl_trans_release_nic_access(priv->trans, ®_flags);
}
static void iwl_continuous_event_trace(struct iwl_priv *priv)
{
u32 capacity; /* event log capacity in # entries */
struct {
u32 capacity;
u32 mode;
u32 wrap_counter;
u32 write_counter;
} __packed read;
u32 base; /* SRAM byte address of event log header */
u32 mode; /* 0 - no timestamp, 1 - timestamp recorded */
u32 num_wraps; /* # times uCode wrapped to top of log */
u32 next_entry; /* index of next entry to be written by uCode */
base = priv->device_pointers.log_event_table;
if (iwlagn_hw_valid_rtc_data_addr(base)) {
iwl_trans_read_mem_bytes(priv->trans, base,
&read, sizeof(read));
capacity = read.capacity;
mode = read.mode;
num_wraps = read.wrap_counter;
next_entry = read.write_counter;
} else
return;
/*
* Unfortunately, the uCode doesn't use temporary variables.
* Therefore, it can happen that we read next_entry == capacity,
* which really means next_entry == 0.
*/
if (unlikely(next_entry == capacity))
next_entry = 0;
/*
* Additionally, the uCode increases the write pointer before
* the wraps counter, so if the write pointer is smaller than
* the old write pointer (wrap occurred) but we read that no
* wrap occurred, we actually read between the next_entry and
* num_wraps update (this does happen in practice!!) -- take
* that into account by increasing num_wraps.
*/
if (unlikely(next_entry < priv->event_log.next_entry &&
num_wraps == priv->event_log.num_wraps))
num_wraps++;
if (num_wraps == priv->event_log.num_wraps) {
iwl_print_cont_event_trace(
priv, base, priv->event_log.next_entry,
next_entry - priv->event_log.next_entry,
capacity, mode);
priv->event_log.non_wraps_count++;
} else {
if (num_wraps - priv->event_log.num_wraps > 1)
priv->event_log.wraps_more_count++;
else
priv->event_log.wraps_once_count++;
trace_iwlwifi_dev_ucode_wrap_event(priv->trans->dev,
num_wraps - priv->event_log.num_wraps,
next_entry, priv->event_log.next_entry);
if (next_entry < priv->event_log.next_entry) {
iwl_print_cont_event_trace(
priv, base, priv->event_log.next_entry,
capacity - priv->event_log.next_entry,
capacity, mode);
iwl_print_cont_event_trace(
priv, base, 0, next_entry, capacity, mode);
} else {
iwl_print_cont_event_trace(
priv, base, next_entry,
capacity - next_entry,
capacity, mode);
iwl_print_cont_event_trace(
priv, base, 0, next_entry, capacity, mode);
}
}
priv->event_log.num_wraps = num_wraps;
priv->event_log.next_entry = next_entry;
}
/**
* iwl_bg_ucode_trace - Timer callback to log ucode event
*
* The timer is continually set to execute every
* UCODE_TRACE_PERIOD milliseconds after the last timer expired
* this function is to perform continuous uCode event logging operation
* if enabled
*/
static void iwl_bg_ucode_trace(unsigned long data)
{
struct iwl_priv *priv = (struct iwl_priv *)data;
if (test_bit(STATUS_EXIT_PENDING, &priv->status))
return;
if (priv->event_log.ucode_trace) {
iwl_continuous_event_trace(priv);
/* Reschedule the timer to occur in UCODE_TRACE_PERIOD */
mod_timer(&priv->ucode_trace,
jiffies + msecs_to_jiffies(UCODE_TRACE_PERIOD));
}
}
static void iwl_bg_tx_flush(struct work_struct *work)
{
struct iwl_priv *priv =
container_of(work, struct iwl_priv, tx_flush);
if (test_bit(STATUS_EXIT_PENDING, &priv->status))
return;
/* do nothing if rf-kill is on */
if (!iwl_is_ready_rf(priv))
return;
IWL_DEBUG_INFO(priv, "device request: flush all tx frames\n");
iwlagn_dev_txfifo_flush(priv);
}
/*
* queue/FIFO/AC mapping definitions
*/
static const u8 iwlagn_bss_ac_to_fifo[] = {
IWL_TX_FIFO_VO,
IWL_TX_FIFO_VI,
IWL_TX_FIFO_BE,
IWL_TX_FIFO_BK,
};
static const u8 iwlagn_bss_ac_to_queue[] = {
0, 1, 2, 3,
};
static const u8 iwlagn_pan_ac_to_fifo[] = {
IWL_TX_FIFO_VO_IPAN,
IWL_TX_FIFO_VI_IPAN,
IWL_TX_FIFO_BE_IPAN,
IWL_TX_FIFO_BK_IPAN,
};
static const u8 iwlagn_pan_ac_to_queue[] = {
7, 6, 5, 4,
};
static void iwl_init_context(struct iwl_priv *priv, u32 ucode_flags)
{
int i;
/*
* The default context is always valid,
* the PAN context depends on uCode.
*/
priv->valid_contexts = BIT(IWL_RXON_CTX_BSS);
if (ucode_flags & IWL_UCODE_TLV_FLAGS_PAN)
priv->valid_contexts |= BIT(IWL_RXON_CTX_PAN);
for (i = 0; i < NUM_IWL_RXON_CTX; i++)
priv->contexts[i].ctxid = i;
priv->contexts[IWL_RXON_CTX_BSS].always_active = true;
priv->contexts[IWL_RXON_CTX_BSS].is_active = true;
priv->contexts[IWL_RXON_CTX_BSS].rxon_cmd = REPLY_RXON;
priv->contexts[IWL_RXON_CTX_BSS].rxon_timing_cmd = REPLY_RXON_TIMING;
priv->contexts[IWL_RXON_CTX_BSS].rxon_assoc_cmd = REPLY_RXON_ASSOC;
priv->contexts[IWL_RXON_CTX_BSS].qos_cmd = REPLY_QOS_PARAM;
priv->contexts[IWL_RXON_CTX_BSS].ap_sta_id = IWL_AP_ID;
priv->contexts[IWL_RXON_CTX_BSS].wep_key_cmd = REPLY_WEPKEY;
priv->contexts[IWL_RXON_CTX_BSS].bcast_sta_id = IWLAGN_BROADCAST_ID;
priv->contexts[IWL_RXON_CTX_BSS].exclusive_interface_modes =
BIT(NL80211_IFTYPE_ADHOC) | BIT(NL80211_IFTYPE_MONITOR);
priv->contexts[IWL_RXON_CTX_BSS].interface_modes =
BIT(NL80211_IFTYPE_STATION);
priv->contexts[IWL_RXON_CTX_BSS].ap_devtype = RXON_DEV_TYPE_AP;
priv->contexts[IWL_RXON_CTX_BSS].ibss_devtype = RXON_DEV_TYPE_IBSS;
priv->contexts[IWL_RXON_CTX_BSS].station_devtype = RXON_DEV_TYPE_ESS;
priv->contexts[IWL_RXON_CTX_BSS].unused_devtype = RXON_DEV_TYPE_ESS;
memcpy(priv->contexts[IWL_RXON_CTX_BSS].ac_to_queue,
iwlagn_bss_ac_to_queue, sizeof(iwlagn_bss_ac_to_queue));
memcpy(priv->contexts[IWL_RXON_CTX_BSS].ac_to_fifo,
iwlagn_bss_ac_to_fifo, sizeof(iwlagn_bss_ac_to_fifo));
priv->contexts[IWL_RXON_CTX_PAN].rxon_cmd = REPLY_WIPAN_RXON;
priv->contexts[IWL_RXON_CTX_PAN].rxon_timing_cmd =
REPLY_WIPAN_RXON_TIMING;
priv->contexts[IWL_RXON_CTX_PAN].rxon_assoc_cmd =
REPLY_WIPAN_RXON_ASSOC;
priv->contexts[IWL_RXON_CTX_PAN].qos_cmd = REPLY_WIPAN_QOS_PARAM;
priv->contexts[IWL_RXON_CTX_PAN].ap_sta_id = IWL_AP_ID_PAN;
priv->contexts[IWL_RXON_CTX_PAN].wep_key_cmd = REPLY_WIPAN_WEPKEY;
priv->contexts[IWL_RXON_CTX_PAN].bcast_sta_id = IWLAGN_PAN_BCAST_ID;
priv->contexts[IWL_RXON_CTX_PAN].station_flags = STA_FLG_PAN_STATION;
priv->contexts[IWL_RXON_CTX_PAN].interface_modes =
BIT(NL80211_IFTYPE_STATION) | BIT(NL80211_IFTYPE_AP);
priv->contexts[IWL_RXON_CTX_PAN].ap_devtype = RXON_DEV_TYPE_CP;
priv->contexts[IWL_RXON_CTX_PAN].station_devtype = RXON_DEV_TYPE_2STA;
priv->contexts[IWL_RXON_CTX_PAN].unused_devtype = RXON_DEV_TYPE_P2P;
memcpy(priv->contexts[IWL_RXON_CTX_PAN].ac_to_queue,
iwlagn_pan_ac_to_queue, sizeof(iwlagn_pan_ac_to_queue));
memcpy(priv->contexts[IWL_RXON_CTX_PAN].ac_to_fifo,
iwlagn_pan_ac_to_fifo, sizeof(iwlagn_pan_ac_to_fifo));
priv->contexts[IWL_RXON_CTX_PAN].mcast_queue = IWL_IPAN_MCAST_QUEUE;
BUILD_BUG_ON(NUM_IWL_RXON_CTX != 2);
}
static void iwl_rf_kill_ct_config(struct iwl_priv *priv)
{
struct iwl_ct_kill_config cmd;
struct iwl_ct_kill_throttling_config adv_cmd;
int ret = 0;
iwl_write32(priv->trans, CSR_UCODE_DRV_GP1_CLR,
CSR_UCODE_DRV_GP1_REG_BIT_CT_KILL_EXIT);
priv->thermal_throttle.ct_kill_toggle = false;
if (priv->lib->support_ct_kill_exit) {
adv_cmd.critical_temperature_enter =
cpu_to_le32(priv->hw_params.ct_kill_threshold);
adv_cmd.critical_temperature_exit =
cpu_to_le32(priv->hw_params.ct_kill_exit_threshold);
ret = iwl_dvm_send_cmd_pdu(priv,
REPLY_CT_KILL_CONFIG_CMD,
0, sizeof(adv_cmd), &adv_cmd);
if (ret)
IWL_ERR(priv, "REPLY_CT_KILL_CONFIG_CMD failed\n");
else
IWL_DEBUG_INFO(priv, "REPLY_CT_KILL_CONFIG_CMD "
"succeeded, critical temperature enter is %d,"
"exit is %d\n",
priv->hw_params.ct_kill_threshold,
priv->hw_params.ct_kill_exit_threshold);
} else {
cmd.critical_temperature_R =
cpu_to_le32(priv->hw_params.ct_kill_threshold);
ret = iwl_dvm_send_cmd_pdu(priv,
REPLY_CT_KILL_CONFIG_CMD,
0, sizeof(cmd), &cmd);
if (ret)
IWL_ERR(priv, "REPLY_CT_KILL_CONFIG_CMD failed\n");
else
IWL_DEBUG_INFO(priv, "REPLY_CT_KILL_CONFIG_CMD "
"succeeded, "
"critical temperature is %d\n",
priv->hw_params.ct_kill_threshold);
}
}
static int iwlagn_send_calib_cfg_rt(struct iwl_priv *priv, u32 cfg)
{
struct iwl_calib_cfg_cmd calib_cfg_cmd;
struct iwl_host_cmd cmd = {
.id = CALIBRATION_CFG_CMD,
.len = { sizeof(struct iwl_calib_cfg_cmd), },
.data = { &calib_cfg_cmd, },
};
memset(&calib_cfg_cmd, 0, sizeof(calib_cfg_cmd));
calib_cfg_cmd.ucd_calib_cfg.once.is_enable = IWL_CALIB_RT_CFG_ALL;
calib_cfg_cmd.ucd_calib_cfg.once.start = cpu_to_le32(cfg);
return iwl_dvm_send_cmd(priv, &cmd);
}
static int iwlagn_send_tx_ant_config(struct iwl_priv *priv, u8 valid_tx_ant)
{
struct iwl_tx_ant_config_cmd tx_ant_cmd = {
.valid = cpu_to_le32(valid_tx_ant),
};
if (IWL_UCODE_API(priv->fw->ucode_ver) > 1) {
IWL_DEBUG_HC(priv, "select valid tx ant: %u\n", valid_tx_ant);
return iwl_dvm_send_cmd_pdu(priv, TX_ANT_CONFIGURATION_CMD, 0,
sizeof(struct iwl_tx_ant_config_cmd),
&tx_ant_cmd);
} else {
IWL_DEBUG_HC(priv, "TX_ANT_CONFIGURATION_CMD not supported\n");
return -EOPNOTSUPP;
}
}
static void iwl_send_bt_config(struct iwl_priv *priv)
{
struct iwl_bt_cmd bt_cmd = {
.lead_time = BT_LEAD_TIME_DEF,
.max_kill = BT_MAX_KILL_DEF,
.kill_ack_mask = 0,
.kill_cts_mask = 0,
};
if (!iwlwifi_mod_params.bt_coex_active)
bt_cmd.flags = BT_COEX_DISABLE;
else
bt_cmd.flags = BT_COEX_ENABLE;
priv->bt_enable_flag = bt_cmd.flags;
IWL_DEBUG_INFO(priv, "BT coex %s\n",
(bt_cmd.flags == BT_COEX_DISABLE) ? "disable" : "active");
if (iwl_dvm_send_cmd_pdu(priv, REPLY_BT_CONFIG,
0, sizeof(struct iwl_bt_cmd), &bt_cmd))
IWL_ERR(priv, "failed to send BT Coex Config\n");
}
/**
* iwl_alive_start - called after REPLY_ALIVE notification received
* from protocol/runtime uCode (initialization uCode's
* Alive gets handled by iwl_init_alive_start()).
*/
int iwl_alive_start(struct iwl_priv *priv)
{
int ret = 0;
struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS];
IWL_DEBUG_INFO(priv, "Runtime Alive received.\n");
/* After the ALIVE response, we can send host commands to the uCode */
set_bit(STATUS_ALIVE, &priv->status);
if (iwl_is_rfkill(priv))
return -ERFKILL;
if (priv->event_log.ucode_trace) {
/* start collecting data now */
mod_timer(&priv->ucode_trace, jiffies);
}
/* download priority table before any calibration request */
if (priv->lib->bt_params &&
priv->lib->bt_params->advanced_bt_coexist) {
/* Configure Bluetooth device coexistence support */
if (priv->lib->bt_params->bt_sco_disable)
priv->bt_enable_pspoll = false;
else
priv->bt_enable_pspoll = true;
priv->bt_valid = IWLAGN_BT_ALL_VALID_MSK;
priv->kill_ack_mask = IWLAGN_BT_KILL_ACK_MASK_DEFAULT;
priv->kill_cts_mask = IWLAGN_BT_KILL_CTS_MASK_DEFAULT;
iwlagn_send_advance_bt_config(priv);
priv->bt_valid = IWLAGN_BT_VALID_ENABLE_FLAGS;
priv->cur_rssi_ctx = NULL;
iwl_send_prio_tbl(priv);
/* FIXME: w/a to force change uCode BT state machine */
ret = iwl_send_bt_env(priv, IWL_BT_COEX_ENV_OPEN,
BT_COEX_PRIO_TBL_EVT_INIT_CALIB2);
if (ret)
return ret;
ret = iwl_send_bt_env(priv, IWL_BT_COEX_ENV_CLOSE,
BT_COEX_PRIO_TBL_EVT_INIT_CALIB2);
if (ret)
return ret;
} else if (priv->lib->bt_params) {
/*
* default is 2-wire BT coexexistence support
*/
iwl_send_bt_config(priv);
}
/*
* Perform runtime calibrations, including DC calibration.
*/
iwlagn_send_calib_cfg_rt(priv, IWL_CALIB_CFG_DC_IDX);
ieee80211_wake_queues(priv->hw);
/* Configure Tx antenna selection based on H/W config */
iwlagn_send_tx_ant_config(priv, priv->nvm_data->valid_tx_ant);
if (iwl_is_associated_ctx(ctx) && !priv->wowlan) {
struct iwl_rxon_cmd *active_rxon =
(struct iwl_rxon_cmd *)&ctx->active;
/* apply any changes in staging */
ctx->staging.filter_flags |= RXON_FILTER_ASSOC_MSK;
active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK;
} else {
struct iwl_rxon_context *tmp;
/* Initialize our rx_config data */
for_each_context(priv, tmp)
iwl_connection_init_rx_config(priv, tmp);
iwlagn_set_rxon_chain(priv, ctx);
}
if (!priv->wowlan) {
/* WoWLAN ucode will not reply in the same way, skip it */
iwl_reset_run_time_calib(priv);
}
set_bit(STATUS_READY, &priv->status);
/* Configure the adapter for unassociated operation */
ret = iwlagn_commit_rxon(priv, ctx);
if (ret)
return ret;
/* At this point, the NIC is initialized and operational */
iwl_rf_kill_ct_config(priv);
IWL_DEBUG_INFO(priv, "ALIVE processing complete.\n");
return iwl_power_update_mode(priv, true);
}
/**
* iwl_clear_driver_stations - clear knowledge of all stations from driver
* @priv: iwl priv struct
*
* This is called during iwl_down() to make sure that in the case
* we're coming there from a hardware restart mac80211 will be
* able to reconfigure stations -- if we're getting there in the
* normal down flow then the stations will already be cleared.
*/
static void iwl_clear_driver_stations(struct iwl_priv *priv)
{
struct iwl_rxon_context *ctx;
spin_lock_bh(&priv->sta_lock);
memset(priv->stations, 0, sizeof(priv->stations));
priv->num_stations = 0;
priv->ucode_key_table = 0;
for_each_context(priv, ctx) {
/*
* Remove all key information that is not stored as part
* of station information since mac80211 may not have had
* a chance to remove all the keys. When device is
* reconfigured by mac80211 after an error all keys will
* be reconfigured.
*/
memset(ctx->wep_keys, 0, sizeof(ctx->wep_keys));
ctx->key_mapping_keys = 0;
}
spin_unlock_bh(&priv->sta_lock);
}
void iwl_down(struct iwl_priv *priv)
{
int exit_pending;
IWL_DEBUG_INFO(priv, DRV_NAME " is going down\n");
lockdep_assert_held(&priv->mutex);
iwl_scan_cancel_timeout(priv, 200);
exit_pending =
test_and_set_bit(STATUS_EXIT_PENDING, &priv->status);
iwl_clear_ucode_stations(priv, NULL);
iwl_dealloc_bcast_stations(priv);
iwl_clear_driver_stations(priv);
/* reset BT coex data */
priv->bt_status = 0;
priv->cur_rssi_ctx = NULL;
priv->bt_is_sco = 0;
if (priv->lib->bt_params)
priv->bt_traffic_load =
priv->lib->bt_params->bt_init_traffic_load;
else
priv->bt_traffic_load = 0;
priv->bt_full_concurrent = false;
priv->bt_ci_compliance = 0;
/* Wipe out the EXIT_PENDING status bit if we are not actually
* exiting the module */
if (!exit_pending)
clear_bit(STATUS_EXIT_PENDING, &priv->status);
if (priv->mac80211_registered)
ieee80211_stop_queues(priv->hw);
priv->ucode_loaded = false;
iwl_trans_stop_device(priv->trans);
/* Set num_aux_in_flight must be done after the transport is stopped */
atomic_set(&priv->num_aux_in_flight, 0);
/* Clear out all status bits but a few that are stable across reset */
priv->status &= test_bit(STATUS_RF_KILL_HW, &priv->status) <<
STATUS_RF_KILL_HW |
test_bit(STATUS_FW_ERROR, &priv->status) <<
STATUS_FW_ERROR |
test_bit(STATUS_EXIT_PENDING, &priv->status) <<
STATUS_EXIT_PENDING;
dev_kfree_skb(priv->beacon_skb);
priv->beacon_skb = NULL;
}
/*****************************************************************************
*
* Workqueue callbacks
*
*****************************************************************************/
static void iwl_bg_run_time_calib_work(struct work_struct *work)
{
struct iwl_priv *priv = container_of(work, struct iwl_priv,
run_time_calib_work);
mutex_lock(&priv->mutex);
if (test_bit(STATUS_EXIT_PENDING, &priv->status) ||
test_bit(STATUS_SCANNING, &priv->status)) {
mutex_unlock(&priv->mutex);
return;
}
if (priv->start_calib) {
iwl_chain_noise_calibration(priv);
iwl_sensitivity_calibration(priv);
}
mutex_unlock(&priv->mutex);
}
void iwlagn_prepare_restart(struct iwl_priv *priv)
{
bool bt_full_concurrent;
u8 bt_ci_compliance;
u8 bt_load;
u8 bt_status;
bool bt_is_sco;
int i;
lockdep_assert_held(&priv->mutex);
priv->is_open = 0;
/*
* __iwl_down() will clear the BT status variables,
* which is correct, but when we restart we really
* want to keep them so restore them afterwards.
*
* The restart process will later pick them up and
* re-configure the hw when we reconfigure the BT
* command.
*/
bt_full_concurrent = priv->bt_full_concurrent;
bt_ci_compliance = priv->bt_ci_compliance;
bt_load = priv->bt_traffic_load;
bt_status = priv->bt_status;
bt_is_sco = priv->bt_is_sco;
iwl_down(priv);
priv->bt_full_concurrent = bt_full_concurrent;
priv->bt_ci_compliance = bt_ci_compliance;
priv->bt_traffic_load = bt_load;
priv->bt_status = bt_status;
priv->bt_is_sco = bt_is_sco;
/* reset aggregation queues */
for (i = IWLAGN_FIRST_AMPDU_QUEUE; i < IWL_MAX_HW_QUEUES; i++)
priv->queue_to_mac80211[i] = IWL_INVALID_MAC80211_QUEUE;
/* and stop counts */
for (i = 0; i < IWL_MAX_HW_QUEUES; i++)
atomic_set(&priv->queue_stop_count[i], 0);
memset(priv->agg_q_alloc, 0, sizeof(priv->agg_q_alloc));
}
static void iwl_bg_restart(struct work_struct *data)
{
struct iwl_priv *priv = container_of(data, struct iwl_priv, restart);
if (test_bit(STATUS_EXIT_PENDING, &priv->status))
return;
if (test_and_clear_bit(STATUS_FW_ERROR, &priv->status)) {
mutex_lock(&priv->mutex);
iwlagn_prepare_restart(priv);
mutex_unlock(&priv->mutex);
iwl_cancel_deferred_work(priv);
if (priv->mac80211_registered)
ieee80211_restart_hw(priv->hw);
else
IWL_ERR(priv,
"Cannot request restart before registrating with mac80211\n");
} else {
WARN_ON(1);
}
}
/*****************************************************************************
*
* driver setup and teardown
*
*****************************************************************************/
static void iwl_setup_deferred_work(struct iwl_priv *priv)
{
priv->workqueue = create_singlethread_workqueue(DRV_NAME);
INIT_WORK(&priv->restart, iwl_bg_restart);
INIT_WORK(&priv->beacon_update, iwl_bg_beacon_update);
INIT_WORK(&priv->run_time_calib_work, iwl_bg_run_time_calib_work);
INIT_WORK(&priv->tx_flush, iwl_bg_tx_flush);
INIT_WORK(&priv->bt_full_concurrency, iwl_bg_bt_full_concurrency);
INIT_WORK(&priv->bt_runtime_config, iwl_bg_bt_runtime_config);
iwl_setup_scan_deferred_work(priv);
if (priv->lib->bt_params)
iwlagn_bt_setup_deferred_work(priv);
setup_timer(&priv->statistics_periodic, iwl_bg_statistics_periodic,
(unsigned long)priv);
setup_timer(&priv->ucode_trace, iwl_bg_ucode_trace,
(unsigned long)priv);
}
void iwl_cancel_deferred_work(struct iwl_priv *priv)
{
if (priv->lib->bt_params)
iwlagn_bt_cancel_deferred_work(priv);
cancel_work_sync(&priv->run_time_calib_work);
cancel_work_sync(&priv->beacon_update);
iwl_cancel_scan_deferred_work(priv);
cancel_work_sync(&priv->bt_full_concurrency);
cancel_work_sync(&priv->bt_runtime_config);
del_timer_sync(&priv->statistics_periodic);
del_timer_sync(&priv->ucode_trace);
}
static int iwl_init_drv(struct iwl_priv *priv)
{
spin_lock_init(&priv->sta_lock);
mutex_init(&priv->mutex);
INIT_LIST_HEAD(&priv->calib_results);
priv->band = IEEE80211_BAND_2GHZ;
priv->plcp_delta_threshold = priv->lib->plcp_delta_threshold;
priv->iw_mode = NL80211_IFTYPE_STATION;
priv->current_ht_config.smps = IEEE80211_SMPS_STATIC;
priv->missed_beacon_threshold = IWL_MISSED_BEACON_THRESHOLD_DEF;
priv->agg_tids_count = 0;
priv->rx_statistics_jiffies = jiffies;
/* Choose which receivers/antennas to use */
iwlagn_set_rxon_chain(priv, &priv->contexts[IWL_RXON_CTX_BSS]);
iwl_init_scan_params(priv);
/* init bt coex */
if (priv->lib->bt_params &&
priv->lib->bt_params->advanced_bt_coexist) {
priv->kill_ack_mask = IWLAGN_BT_KILL_ACK_MASK_DEFAULT;
priv->kill_cts_mask = IWLAGN_BT_KILL_CTS_MASK_DEFAULT;
priv->bt_valid = IWLAGN_BT_ALL_VALID_MSK;
priv->bt_on_thresh = BT_ON_THRESHOLD_DEF;
priv->bt_duration = BT_DURATION_LIMIT_DEF;
priv->dynamic_frag_thresh = BT_FRAG_THRESHOLD_DEF;
}
return 0;
}
static void iwl_uninit_drv(struct iwl_priv *priv)
{
kfree(priv->scan_cmd);
kfree(priv->beacon_cmd);
kfree(rcu_dereference_raw(priv->noa_data));
iwl_calib_free_results(priv);
#ifdef CONFIG_IWLWIFI_DEBUGFS
kfree(priv->wowlan_sram);
#endif
}
static void iwl_set_hw_params(struct iwl_priv *priv)
{
if (priv->cfg->ht_params)
priv->hw_params.use_rts_for_aggregation =
priv->cfg->ht_params->use_rts_for_aggregation;
/* Device-specific setup */
priv->lib->set_hw_params(priv);
}
/* show what optional capabilities we have */
static void iwl_option_config(struct iwl_priv *priv)
{
#ifdef CONFIG_IWLWIFI_DEBUG
IWL_INFO(priv, "CONFIG_IWLWIFI_DEBUG enabled\n");
#else
IWL_INFO(priv, "CONFIG_IWLWIFI_DEBUG disabled\n");
#endif
#ifdef CONFIG_IWLWIFI_DEBUGFS
IWL_INFO(priv, "CONFIG_IWLWIFI_DEBUGFS enabled\n");
#else
IWL_INFO(priv, "CONFIG_IWLWIFI_DEBUGFS disabled\n");
#endif
#ifdef CONFIG_IWLWIFI_DEVICE_TRACING
IWL_INFO(priv, "CONFIG_IWLWIFI_DEVICE_TRACING enabled\n");
#else
IWL_INFO(priv, "CONFIG_IWLWIFI_DEVICE_TRACING disabled\n");
#endif
}
static int iwl_eeprom_init_hw_params(struct iwl_priv *priv)
{
struct iwl_nvm_data *data = priv->nvm_data;
if (data->sku_cap_11n_enable &&
!priv->cfg->ht_params) {
IWL_ERR(priv, "Invalid 11n configuration\n");
return -EINVAL;
}
if (!data->sku_cap_11n_enable && !data->sku_cap_band_24GHz_enable &&
!data->sku_cap_band_52GHz_enable) {
IWL_ERR(priv, "Invalid device sku\n");
return -EINVAL;
}
IWL_DEBUG_INFO(priv,
"Device SKU: 24GHz %s %s, 52GHz %s %s, 11.n %s %s\n",
data->sku_cap_band_24GHz_enable ? "" : "NOT", "enabled",
data->sku_cap_band_52GHz_enable ? "" : "NOT", "enabled",
data->sku_cap_11n_enable ? "" : "NOT", "enabled");
priv->hw_params.tx_chains_num =
num_of_ant(data->valid_tx_ant);
if (priv->cfg->rx_with_siso_diversity)
priv->hw_params.rx_chains_num = 1;
else
priv->hw_params.rx_chains_num =
num_of_ant(data->valid_rx_ant);
IWL_DEBUG_INFO(priv, "Valid Tx ant: 0x%X, Valid Rx ant: 0x%X\n",
data->valid_tx_ant,
data->valid_rx_ant);
return 0;
}
static struct iwl_op_mode *iwl_op_mode_dvm_start(struct iwl_trans *trans,
const struct iwl_cfg *cfg,
const struct iwl_fw *fw,
struct dentry *dbgfs_dir)
{
struct iwl_priv *priv;
struct ieee80211_hw *hw;
struct iwl_op_mode *op_mode;
u16 num_mac;
u32 ucode_flags;
struct iwl_trans_config trans_cfg = {};
static const u8 no_reclaim_cmds[] = {
REPLY_RX_PHY_CMD,
REPLY_RX_MPDU_CMD,
REPLY_COMPRESSED_BA,
STATISTICS_NOTIFICATION,
REPLY_TX,
};
int i;
/************************
* 1. Allocating HW data
************************/
hw = iwl_alloc_all();
if (!hw) {
pr_err("%s: Cannot allocate network device\n", cfg->name);
goto out;
}
op_mode = hw->priv;
op_mode->ops = &iwl_dvm_ops;
priv = IWL_OP_MODE_GET_DVM(op_mode);
priv->trans = trans;
priv->dev = trans->dev;
priv->cfg = cfg;
priv->fw = fw;
switch (priv->cfg->device_family) {
case IWL_DEVICE_FAMILY_1000:
case IWL_DEVICE_FAMILY_100:
priv->lib = &iwl_dvm_1000_cfg;
break;
case IWL_DEVICE_FAMILY_2000:
priv->lib = &iwl_dvm_2000_cfg;
break;
case IWL_DEVICE_FAMILY_105:
priv->lib = &iwl_dvm_105_cfg;
break;
case IWL_DEVICE_FAMILY_2030:
case IWL_DEVICE_FAMILY_135:
priv->lib = &iwl_dvm_2030_cfg;
break;
case IWL_DEVICE_FAMILY_5000:
priv->lib = &iwl_dvm_5000_cfg;
break;
case IWL_DEVICE_FAMILY_5150:
priv->lib = &iwl_dvm_5150_cfg;
break;
case IWL_DEVICE_FAMILY_6000:
case IWL_DEVICE_FAMILY_6000i:
priv->lib = &iwl_dvm_6000_cfg;
break;
case IWL_DEVICE_FAMILY_6005:
priv->lib = &iwl_dvm_6005_cfg;
break;
case IWL_DEVICE_FAMILY_6050:
case IWL_DEVICE_FAMILY_6150:
priv->lib = &iwl_dvm_6050_cfg;
break;
case IWL_DEVICE_FAMILY_6030:
priv->lib = &iwl_dvm_6030_cfg;
break;
default:
break;
}
if (WARN_ON(!priv->lib))
goto out_free_hw;
/*
* Populate the state variables that the transport layer needs
* to know about.
*/
trans_cfg.op_mode = op_mode;
trans_cfg.no_reclaim_cmds = no_reclaim_cmds;
trans_cfg.n_no_reclaim_cmds = ARRAY_SIZE(no_reclaim_cmds);
trans_cfg.rx_buf_size_8k = iwlwifi_mod_params.amsdu_size_8K;
trans_cfg.cmd_q_wdg_timeout = IWL_WATCHDOG_DISABLED;
trans_cfg.command_names = iwl_dvm_cmd_strings;
trans_cfg.cmd_fifo = IWLAGN_CMD_FIFO_NUM;
WARN_ON(sizeof(priv->transport_queue_stop) * BITS_PER_BYTE <
priv->cfg->base_params->num_of_queues);
ucode_flags = fw->ucode_capa.flags;
if (ucode_flags & IWL_UCODE_TLV_FLAGS_PAN) {
priv->sta_key_max_num = STA_KEY_MAX_NUM_PAN;
trans_cfg.cmd_queue = IWL_IPAN_CMD_QUEUE_NUM;
} else {
priv->sta_key_max_num = STA_KEY_MAX_NUM;
trans_cfg.cmd_queue = IWL_DEFAULT_CMD_QUEUE_NUM;
}
/* Configure transport layer */
iwl_trans_configure(priv->trans, &trans_cfg);
trans->rx_mpdu_cmd = REPLY_RX_MPDU_CMD;
trans->rx_mpdu_cmd_hdr_size = sizeof(struct iwl_rx_mpdu_res_start);
/* At this point both hw and priv are allocated. */
SET_IEEE80211_DEV(priv->hw, priv->trans->dev);
iwl_option_config(priv);
IWL_DEBUG_INFO(priv, "*** LOAD DRIVER ***\n");
/* is antenna coupling more than 35dB ? */
priv->bt_ant_couple_ok =
(iwlwifi_mod_params.ant_coupling >
IWL_BT_ANTENNA_COUPLING_THRESHOLD) ?
true : false;
/* bt channel inhibition enabled*/
priv->bt_ch_announce = true;
IWL_DEBUG_INFO(priv, "BT channel inhibition is %s\n",
(priv->bt_ch_announce) ? "On" : "Off");
/* these spin locks will be used in apm_ops.init and EEPROM access
* we should init now
*/
spin_lock_init(&priv->statistics.lock);
/***********************
* 2. Read REV register
***********************/
IWL_INFO(priv, "Detected %s, REV=0x%X\n",
priv->cfg->name, priv->trans->hw_rev);
if (iwl_trans_start_hw(priv->trans))
goto out_free_hw;
/* Read the EEPROM */
if (iwl_read_eeprom(priv->trans, &priv->eeprom_blob,
&priv->eeprom_blob_size)) {
IWL_ERR(priv, "Unable to init EEPROM\n");
goto out_free_hw;
}
/* Reset chip to save power until we load uCode during "up". */
iwl_trans_stop_device(priv->trans);
priv->nvm_data = iwl_parse_eeprom_data(priv->trans->dev, priv->cfg,
priv->eeprom_blob,
priv->eeprom_blob_size);
if (!priv->nvm_data)
goto out_free_eeprom_blob;
if (iwl_nvm_check_version(priv->nvm_data, priv->trans))
goto out_free_eeprom;
if (iwl_eeprom_init_hw_params(priv))
goto out_free_eeprom;
/* extract MAC Address */
memcpy(priv->addresses[0].addr, priv->nvm_data->hw_addr, ETH_ALEN);
IWL_DEBUG_INFO(priv, "MAC address: %pM\n", priv->addresses[0].addr);
priv->hw->wiphy->addresses = priv->addresses;
priv->hw->wiphy->n_addresses = 1;
num_mac = priv->nvm_data->n_hw_addrs;
if (num_mac > 1) {
memcpy(priv->addresses[1].addr, priv->addresses[0].addr,
ETH_ALEN);
priv->addresses[1].addr[5]++;
priv->hw->wiphy->n_addresses++;
}
/************************
* 4. Setup HW constants
************************/
iwl_set_hw_params(priv);
if (!(priv->nvm_data->sku_cap_ipan_enable)) {
IWL_DEBUG_INFO(priv, "Your EEPROM disabled PAN\n");
ucode_flags &= ~IWL_UCODE_TLV_FLAGS_PAN;
/*
* if not PAN, then don't support P2P -- might be a uCode
* packaging bug or due to the eeprom check above
*/
priv->sta_key_max_num = STA_KEY_MAX_NUM;
trans_cfg.cmd_queue = IWL_DEFAULT_CMD_QUEUE_NUM;
/* Configure transport layer again*/
iwl_trans_configure(priv->trans, &trans_cfg);
}
/*******************
* 5. Setup priv
*******************/
for (i = 0; i < IWL_MAX_HW_QUEUES; i++) {
priv->queue_to_mac80211[i] = IWL_INVALID_MAC80211_QUEUE;
if (i < IWLAGN_FIRST_AMPDU_QUEUE &&
i != IWL_DEFAULT_CMD_QUEUE_NUM &&
i != IWL_IPAN_CMD_QUEUE_NUM)
priv->queue_to_mac80211[i] = i;
atomic_set(&priv->queue_stop_count[i], 0);
}
if (iwl_init_drv(priv))
goto out_free_eeprom;
/* At this point both hw and priv are initialized. */
/********************
* 6. Setup services
********************/
iwl_setup_deferred_work(priv);
iwl_setup_rx_handlers(priv);
iwl_power_initialize(priv);
iwl_tt_initialize(priv);
snprintf(priv->hw->wiphy->fw_version,
sizeof(priv->hw->wiphy->fw_version),
"%s", fw->fw_version);
priv->new_scan_threshold_behaviour =
!!(ucode_flags & IWL_UCODE_TLV_FLAGS_NEWSCAN);
priv->phy_calib_chain_noise_reset_cmd =
fw->ucode_capa.standard_phy_calibration_size;
priv->phy_calib_chain_noise_gain_cmd =
fw->ucode_capa.standard_phy_calibration_size + 1;
/* initialize all valid contexts */
iwl_init_context(priv, ucode_flags);
/**************************************************
* This is still part of probe() in a sense...
*
* 7. Setup and register with mac80211 and debugfs
**************************************************/
if (iwlagn_mac_setup_register(priv, &fw->ucode_capa))
goto out_destroy_workqueue;
if (iwl_dbgfs_register(priv, dbgfs_dir))
goto out_mac80211_unregister;
return op_mode;
out_mac80211_unregister:
iwlagn_mac_unregister(priv);
out_destroy_workqueue:
iwl_tt_exit(priv);
iwl_cancel_deferred_work(priv);
destroy_workqueue(priv->workqueue);
priv->workqueue = NULL;
iwl_uninit_drv(priv);
out_free_eeprom_blob:
kfree(priv->eeprom_blob);
out_free_eeprom:
iwl_free_nvm_data(priv->nvm_data);
out_free_hw:
ieee80211_free_hw(priv->hw);
out:
op_mode = NULL;
return op_mode;
}
static void iwl_op_mode_dvm_stop(struct iwl_op_mode *op_mode)
{
struct iwl_priv *priv = IWL_OP_MODE_GET_DVM(op_mode);
IWL_DEBUG_INFO(priv, "*** UNLOAD DRIVER ***\n");
iwlagn_mac_unregister(priv);
iwl_tt_exit(priv);
kfree(priv->eeprom_blob);
iwl_free_nvm_data(priv->nvm_data);
/*netif_stop_queue(dev); */
flush_workqueue(priv->workqueue);
/* ieee80211_unregister_hw calls iwlagn_mac_stop, which flushes
* priv->workqueue... so we can't take down the workqueue
* until now... */
destroy_workqueue(priv->workqueue);
priv->workqueue = NULL;
iwl_uninit_drv(priv);
dev_kfree_skb(priv->beacon_skb);
iwl_trans_op_mode_leave(priv->trans);
ieee80211_free_hw(priv->hw);
}
static const char * const desc_lookup_text[] = {
"OK",
"FAIL",
"BAD_PARAM",
"BAD_CHECKSUM",
"NMI_INTERRUPT_WDG",
"SYSASSERT",
"FATAL_ERROR",
"BAD_COMMAND",
"HW_ERROR_TUNE_LOCK",
"HW_ERROR_TEMPERATURE",
"ILLEGAL_CHAN_FREQ",
"VCC_NOT_STABLE",
"FH_ERROR",
"NMI_INTERRUPT_HOST",
"NMI_INTERRUPT_ACTION_PT",
"NMI_INTERRUPT_UNKNOWN",
"UCODE_VERSION_MISMATCH",
"HW_ERROR_ABS_LOCK",
"HW_ERROR_CAL_LOCK_FAIL",
"NMI_INTERRUPT_INST_ACTION_PT",
"NMI_INTERRUPT_DATA_ACTION_PT",
"NMI_TRM_HW_ER",
"NMI_INTERRUPT_TRM",
"NMI_INTERRUPT_BREAK_POINT",
"DEBUG_0",
"DEBUG_1",
"DEBUG_2",
"DEBUG_3",
};
static struct { char *name; u8 num; } advanced_lookup[] = {
{ "NMI_INTERRUPT_WDG", 0x34 },
{ "SYSASSERT", 0x35 },
{ "UCODE_VERSION_MISMATCH", 0x37 },
{ "BAD_COMMAND", 0x38 },
{ "NMI_INTERRUPT_DATA_ACTION_PT", 0x3C },
{ "FATAL_ERROR", 0x3D },
{ "NMI_TRM_HW_ERR", 0x46 },
{ "NMI_INTERRUPT_TRM", 0x4C },
{ "NMI_INTERRUPT_BREAK_POINT", 0x54 },
{ "NMI_INTERRUPT_WDG_RXF_FULL", 0x5C },
{ "NMI_INTERRUPT_WDG_NO_RBD_RXF_FULL", 0x64 },
{ "NMI_INTERRUPT_HOST", 0x66 },
{ "NMI_INTERRUPT_ACTION_PT", 0x7C },
{ "NMI_INTERRUPT_UNKNOWN", 0x84 },
{ "NMI_INTERRUPT_INST_ACTION_PT", 0x86 },
{ "ADVANCED_SYSASSERT", 0 },
};
static const char *desc_lookup(u32 num)
{
int i;
int max = ARRAY_SIZE(desc_lookup_text);
if (num < max)
return desc_lookup_text[num];
max = ARRAY_SIZE(advanced_lookup) - 1;
for (i = 0; i < max; i++) {
if (advanced_lookup[i].num == num)
break;
}
return advanced_lookup[i].name;
}
#define ERROR_START_OFFSET (1 * sizeof(u32))
#define ERROR_ELEM_SIZE (7 * sizeof(u32))
static void iwl_dump_nic_error_log(struct iwl_priv *priv)
{
struct iwl_trans *trans = priv->trans;
u32 base;
struct iwl_error_event_table table;
base = priv->device_pointers.error_event_table;
if (priv->cur_ucode == IWL_UCODE_INIT) {
if (!base)
base = priv->fw->init_errlog_ptr;
} else {
if (!base)
base = priv->fw->inst_errlog_ptr;
}
if (!iwlagn_hw_valid_rtc_data_addr(base)) {
IWL_ERR(priv,
"Not valid error log pointer 0x%08X for %s uCode\n",
base,
(priv->cur_ucode == IWL_UCODE_INIT)
? "Init" : "RT");
return;
}
/*TODO: Update dbgfs with ISR error stats obtained below */
iwl_trans_read_mem_bytes(trans, base, &table, sizeof(table));
if (ERROR_START_OFFSET <= table.valid * ERROR_ELEM_SIZE) {
IWL_ERR(trans, "Start IWL Error Log Dump:\n");
IWL_ERR(trans, "Status: 0x%08lX, count: %d\n",
priv->status, table.valid);
}
trace_iwlwifi_dev_ucode_error(trans->dev, table.error_id, table.tsf_low,
table.data1, table.data2, table.line,
table.blink1, table.blink2, table.ilink1,
table.ilink2, table.bcon_time, table.gp1,
table.gp2, table.gp3, table.ucode_ver,
table.hw_ver, 0, table.brd_ver);
IWL_ERR(priv, "0x%08X | %-28s\n", table.error_id,
desc_lookup(table.error_id));
IWL_ERR(priv, "0x%08X | uPc\n", table.pc);
IWL_ERR(priv, "0x%08X | branchlink1\n", table.blink1);
IWL_ERR(priv, "0x%08X | branchlink2\n", table.blink2);
IWL_ERR(priv, "0x%08X | interruptlink1\n", table.ilink1);
IWL_ERR(priv, "0x%08X | interruptlink2\n", table.ilink2);
IWL_ERR(priv, "0x%08X | data1\n", table.data1);
IWL_ERR(priv, "0x%08X | data2\n", table.data2);
IWL_ERR(priv, "0x%08X | line\n", table.line);
IWL_ERR(priv, "0x%08X | beacon time\n", table.bcon_time);
IWL_ERR(priv, "0x%08X | tsf low\n", table.tsf_low);
IWL_ERR(priv, "0x%08X | tsf hi\n", table.tsf_hi);
IWL_ERR(priv, "0x%08X | time gp1\n", table.gp1);
IWL_ERR(priv, "0x%08X | time gp2\n", table.gp2);
IWL_ERR(priv, "0x%08X | time gp3\n", table.gp3);
IWL_ERR(priv, "0x%08X | uCode version\n", table.ucode_ver);
IWL_ERR(priv, "0x%08X | hw version\n", table.hw_ver);
IWL_ERR(priv, "0x%08X | board version\n", table.brd_ver);
IWL_ERR(priv, "0x%08X | hcmd\n", table.hcmd);
IWL_ERR(priv, "0x%08X | isr0\n", table.isr0);
IWL_ERR(priv, "0x%08X | isr1\n", table.isr1);
IWL_ERR(priv, "0x%08X | isr2\n", table.isr2);
IWL_ERR(priv, "0x%08X | isr3\n", table.isr3);
IWL_ERR(priv, "0x%08X | isr4\n", table.isr4);
IWL_ERR(priv, "0x%08X | isr_pref\n", table.isr_pref);
IWL_ERR(priv, "0x%08X | wait_event\n", table.wait_event);
IWL_ERR(priv, "0x%08X | l2p_control\n", table.l2p_control);
IWL_ERR(priv, "0x%08X | l2p_duration\n", table.l2p_duration);
IWL_ERR(priv, "0x%08X | l2p_mhvalid\n", table.l2p_mhvalid);
IWL_ERR(priv, "0x%08X | l2p_addr_match\n", table.l2p_addr_match);
IWL_ERR(priv, "0x%08X | lmpm_pmg_sel\n", table.lmpm_pmg_sel);
IWL_ERR(priv, "0x%08X | timestamp\n", table.u_timestamp);
IWL_ERR(priv, "0x%08X | flow_handler\n", table.flow_handler);
}
#define EVENT_START_OFFSET (4 * sizeof(u32))
/**
* iwl_print_event_log - Dump error event log to syslog
*
*/
static int iwl_print_event_log(struct iwl_priv *priv, u32 start_idx,
u32 num_events, u32 mode,
int pos, char **buf, size_t bufsz)
{
u32 i;
u32 base; /* SRAM byte address of event log header */
u32 event_size; /* 2 u32s, or 3 u32s if timestamp recorded */
u32 ptr; /* SRAM byte address of log data */
u32 ev, time, data; /* event log data */
unsigned long reg_flags;
struct iwl_trans *trans = priv->trans;
if (num_events == 0)
return pos;
base = priv->device_pointers.log_event_table;
if (priv->cur_ucode == IWL_UCODE_INIT) {
if (!base)
base = priv->fw->init_evtlog_ptr;
} else {
if (!base)
base = priv->fw->inst_evtlog_ptr;
}
if (mode == 0)
event_size = 2 * sizeof(u32);
else
event_size = 3 * sizeof(u32);
ptr = base + EVENT_START_OFFSET + (start_idx * event_size);
/* Make sure device is powered up for SRAM reads */
if (!iwl_trans_grab_nic_access(trans, false, ®_flags))
return pos;
/* Set starting address; reads will auto-increment */
iwl_write32(trans, HBUS_TARG_MEM_RADDR, ptr);
/* "time" is actually "data" for mode 0 (no timestamp).
* place event id # at far right for easier visual parsing. */
for (i = 0; i < num_events; i++) {
ev = iwl_read32(trans, HBUS_TARG_MEM_RDAT);
time = iwl_read32(trans, HBUS_TARG_MEM_RDAT);
if (mode == 0) {
/* data, ev */
if (bufsz) {
pos += scnprintf(*buf + pos, bufsz - pos,
"EVT_LOG:0x%08x:%04u\n",
time, ev);
} else {
trace_iwlwifi_dev_ucode_event(trans->dev, 0,
time, ev);
IWL_ERR(priv, "EVT_LOG:0x%08x:%04u\n",
time, ev);
}
} else {
data = iwl_read32(trans, HBUS_TARG_MEM_RDAT);
if (bufsz) {
pos += scnprintf(*buf + pos, bufsz - pos,
"EVT_LOGT:%010u:0x%08x:%04u\n",
time, data, ev);
} else {
IWL_ERR(priv, "EVT_LOGT:%010u:0x%08x:%04u\n",
time, data, ev);
trace_iwlwifi_dev_ucode_event(trans->dev, time,
data, ev);
}
}
}
/* Allow device to power down */
iwl_trans_release_nic_access(trans, ®_flags);
return pos;
}
/**
* iwl_print_last_event_logs - Dump the newest # of event log to syslog
*/
static int iwl_print_last_event_logs(struct iwl_priv *priv, u32 capacity,
u32 num_wraps, u32 next_entry,
u32 size, u32 mode,
int pos, char **buf, size_t bufsz)
{
/*
* display the newest DEFAULT_LOG_ENTRIES entries
* i.e the entries just before the next ont that uCode would fill.
*/
if (num_wraps) {
if (next_entry < size) {
pos = iwl_print_event_log(priv,
capacity - (size - next_entry),
size - next_entry, mode,
pos, buf, bufsz);
pos = iwl_print_event_log(priv, 0,
next_entry, mode,
pos, buf, bufsz);
} else
pos = iwl_print_event_log(priv, next_entry - size,
size, mode, pos, buf, bufsz);
} else {
if (next_entry < size) {
pos = iwl_print_event_log(priv, 0, next_entry,
mode, pos, buf, bufsz);
} else {
pos = iwl_print_event_log(priv, next_entry - size,
size, mode, pos, buf, bufsz);
}
}
return pos;
}
#define DEFAULT_DUMP_EVENT_LOG_ENTRIES (20)
int iwl_dump_nic_event_log(struct iwl_priv *priv, bool full_log,
char **buf)
{
u32 base; /* SRAM byte address of event log header */
u32 capacity; /* event log capacity in # entries */
u32 mode; /* 0 - no timestamp, 1 - timestamp recorded */
u32 num_wraps; /* # times uCode wrapped to top of log */
u32 next_entry; /* index of next entry to be written by uCode */
u32 size; /* # entries that we'll print */
u32 logsize;
int pos = 0;
size_t bufsz = 0;
struct iwl_trans *trans = priv->trans;
base = priv->device_pointers.log_event_table;
if (priv->cur_ucode == IWL_UCODE_INIT) {
logsize = priv->fw->init_evtlog_size;
if (!base)
base = priv->fw->init_evtlog_ptr;
} else {
logsize = priv->fw->inst_evtlog_size;
if (!base)
base = priv->fw->inst_evtlog_ptr;
}
if (!iwlagn_hw_valid_rtc_data_addr(base)) {
IWL_ERR(priv,
"Invalid event log pointer 0x%08X for %s uCode\n",
base,
(priv->cur_ucode == IWL_UCODE_INIT)
? "Init" : "RT");
return -EINVAL;
}
/* event log header */
capacity = iwl_trans_read_mem32(trans, base);
mode = iwl_trans_read_mem32(trans, base + (1 * sizeof(u32)));
num_wraps = iwl_trans_read_mem32(trans, base + (2 * sizeof(u32)));
next_entry = iwl_trans_read_mem32(trans, base + (3 * sizeof(u32)));
if (capacity > logsize) {
IWL_ERR(priv, "Log capacity %d is bogus, limit to %d "
"entries\n", capacity, logsize);
capacity = logsize;
}
if (next_entry > logsize) {
IWL_ERR(priv, "Log write index %d is bogus, limit to %d\n",
next_entry, logsize);
next_entry = logsize;
}
size = num_wraps ? capacity : next_entry;
/* bail out if nothing in log */
if (size == 0) {
IWL_ERR(trans, "Start IWL Event Log Dump: nothing in log\n");
return pos;
}
if (!(iwl_have_debug_level(IWL_DL_FW_ERRORS)) && !full_log)
size = (size > DEFAULT_DUMP_EVENT_LOG_ENTRIES)
? DEFAULT_DUMP_EVENT_LOG_ENTRIES : size;
IWL_ERR(priv, "Start IWL Event Log Dump: display last %u entries\n",
size);
#ifdef CONFIG_IWLWIFI_DEBUG
if (buf) {
if (full_log)
bufsz = capacity * 48;
else
bufsz = size * 48;
*buf = kmalloc(bufsz, GFP_KERNEL);
if (!*buf)
return -ENOMEM;
}
if (iwl_have_debug_level(IWL_DL_FW_ERRORS) || full_log) {
/*
* if uCode has wrapped back to top of log,
* start at the oldest entry,
* i.e the next one that uCode would fill.
*/
if (num_wraps)
pos = iwl_print_event_log(priv, next_entry,
capacity - next_entry, mode,
pos, buf, bufsz);
/* (then/else) start at top of log */
pos = iwl_print_event_log(priv, 0,
next_entry, mode, pos, buf, bufsz);
} else
pos = iwl_print_last_event_logs(priv, capacity, num_wraps,
next_entry, size, mode,
pos, buf, bufsz);
#else
pos = iwl_print_last_event_logs(priv, capacity, num_wraps,
next_entry, size, mode,
pos, buf, bufsz);
#endif
return pos;
}
static void iwlagn_fw_error(struct iwl_priv *priv, bool ondemand)
{
unsigned int reload_msec;
unsigned long reload_jiffies;
if (iwl_have_debug_level(IWL_DL_FW_ERRORS))
iwl_print_rx_config_cmd(priv, IWL_RXON_CTX_BSS);
/* uCode is no longer loaded. */
priv->ucode_loaded = false;
/* Set the FW error flag -- cleared on iwl_down */
set_bit(STATUS_FW_ERROR, &priv->status);
iwl_abort_notification_waits(&priv->notif_wait);
/* Keep the restart process from trying to send host
* commands by clearing the ready bit */
clear_bit(STATUS_READY, &priv->status);
if (!ondemand) {
/*
* If firmware keep reloading, then it indicate something
* serious wrong and firmware having problem to recover
* from it. Instead of keep trying which will fill the syslog
* and hang the system, let's just stop it
*/
reload_jiffies = jiffies;
reload_msec = jiffies_to_msecs((long) reload_jiffies -
(long) priv->reload_jiffies);
priv->reload_jiffies = reload_jiffies;
if (reload_msec <= IWL_MIN_RELOAD_DURATION) {
priv->reload_count++;
if (priv->reload_count >= IWL_MAX_CONTINUE_RELOAD_CNT) {
IWL_ERR(priv, "BUG_ON, Stop restarting\n");
return;
}
} else
priv->reload_count = 0;
}
if (!test_bit(STATUS_EXIT_PENDING, &priv->status)) {
if (iwlwifi_mod_params.restart_fw) {
IWL_DEBUG_FW_ERRORS(priv,
"Restarting adapter due to uCode error.\n");
queue_work(priv->workqueue, &priv->restart);
} else
IWL_DEBUG_FW_ERRORS(priv,
"Detected FW error, but not restarting\n");
}
}
static void iwl_nic_error(struct iwl_op_mode *op_mode)
{
struct iwl_priv *priv = IWL_OP_MODE_GET_DVM(op_mode);
IWL_ERR(priv, "Loaded firmware version: %s\n",
priv->fw->fw_version);
iwl_dump_nic_error_log(priv);
iwl_dump_nic_event_log(priv, false, NULL);
iwlagn_fw_error(priv, false);
}
static void iwl_cmd_queue_full(struct iwl_op_mode *op_mode)
{
struct iwl_priv *priv = IWL_OP_MODE_GET_DVM(op_mode);
if (!iwl_check_for_ct_kill(priv)) {
IWL_ERR(priv, "Restarting adapter queue is full\n");
iwlagn_fw_error(priv, false);
}
}
#define EEPROM_RF_CONFIG_TYPE_MAX 0x3
static void iwl_nic_config(struct iwl_op_mode *op_mode)
{
struct iwl_priv *priv = IWL_OP_MODE_GET_DVM(op_mode);
/* SKU Control */
iwl_trans_set_bits_mask(priv->trans, CSR_HW_IF_CONFIG_REG,
CSR_HW_IF_CONFIG_REG_MSK_MAC_DASH |
CSR_HW_IF_CONFIG_REG_MSK_MAC_STEP,
(CSR_HW_REV_STEP(priv->trans->hw_rev) <<
CSR_HW_IF_CONFIG_REG_POS_MAC_STEP) |
(CSR_HW_REV_DASH(priv->trans->hw_rev) <<
CSR_HW_IF_CONFIG_REG_POS_MAC_DASH));
/* write radio config values to register */
if (priv->nvm_data->radio_cfg_type <= EEPROM_RF_CONFIG_TYPE_MAX) {
u32 reg_val =
priv->nvm_data->radio_cfg_type <<
CSR_HW_IF_CONFIG_REG_POS_PHY_TYPE |
priv->nvm_data->radio_cfg_step <<
CSR_HW_IF_CONFIG_REG_POS_PHY_STEP |
priv->nvm_data->radio_cfg_dash <<
CSR_HW_IF_CONFIG_REG_POS_PHY_DASH;
iwl_trans_set_bits_mask(priv->trans, CSR_HW_IF_CONFIG_REG,
CSR_HW_IF_CONFIG_REG_MSK_PHY_TYPE |
CSR_HW_IF_CONFIG_REG_MSK_PHY_STEP |
CSR_HW_IF_CONFIG_REG_MSK_PHY_DASH,
reg_val);
IWL_INFO(priv, "Radio type=0x%x-0x%x-0x%x\n",
priv->nvm_data->radio_cfg_type,
priv->nvm_data->radio_cfg_step,
priv->nvm_data->radio_cfg_dash);
} else {
WARN_ON(1);
}
/* set CSR_HW_CONFIG_REG for uCode use */
iwl_set_bit(priv->trans, CSR_HW_IF_CONFIG_REG,
CSR_HW_IF_CONFIG_REG_BIT_RADIO_SI |
CSR_HW_IF_CONFIG_REG_BIT_MAC_SI);
/* W/A : NIC is stuck in a reset state after Early PCIe power off
* (PCIe power is lost before PERST# is asserted),
* causing ME FW to lose ownership and not being able to obtain it back.
*/
iwl_set_bits_mask_prph(priv->trans, APMG_PS_CTRL_REG,
APMG_PS_CTRL_EARLY_PWR_OFF_RESET_DIS,
~APMG_PS_CTRL_EARLY_PWR_OFF_RESET_DIS);
if (priv->lib->nic_config)
priv->lib->nic_config(priv);
}
static void iwl_wimax_active(struct iwl_op_mode *op_mode)
{
struct iwl_priv *priv = IWL_OP_MODE_GET_DVM(op_mode);
clear_bit(STATUS_READY, &priv->status);
IWL_ERR(priv, "RF is used by WiMAX\n");
}
static void iwl_stop_sw_queue(struct iwl_op_mode *op_mode, int queue)
{
struct iwl_priv *priv = IWL_OP_MODE_GET_DVM(op_mode);
int mq = priv->queue_to_mac80211[queue];
if (WARN_ON_ONCE(mq == IWL_INVALID_MAC80211_QUEUE))
return;
if (atomic_inc_return(&priv->queue_stop_count[mq]) > 1) {
IWL_DEBUG_TX_QUEUES(priv,
"queue %d (mac80211 %d) already stopped\n",
queue, mq);
return;
}
set_bit(mq, &priv->transport_queue_stop);
ieee80211_stop_queue(priv->hw, mq);
}
static void iwl_wake_sw_queue(struct iwl_op_mode *op_mode, int queue)
{
struct iwl_priv *priv = IWL_OP_MODE_GET_DVM(op_mode);
int mq = priv->queue_to_mac80211[queue];
if (WARN_ON_ONCE(mq == IWL_INVALID_MAC80211_QUEUE))
return;
if (atomic_dec_return(&priv->queue_stop_count[mq]) > 0) {
IWL_DEBUG_TX_QUEUES(priv,
"queue %d (mac80211 %d) already awake\n",
queue, mq);
return;
}
clear_bit(mq, &priv->transport_queue_stop);
if (!priv->passive_no_rx)
ieee80211_wake_queue(priv->hw, mq);
}
void iwlagn_lift_passive_no_rx(struct iwl_priv *priv)
{
int mq;
if (!priv->passive_no_rx)
return;
for (mq = 0; mq < IWLAGN_FIRST_AMPDU_QUEUE; mq++) {
if (!test_bit(mq, &priv->transport_queue_stop)) {
IWL_DEBUG_TX_QUEUES(priv, "Wake queue %d\n", mq);
ieee80211_wake_queue(priv->hw, mq);
} else {
IWL_DEBUG_TX_QUEUES(priv, "Don't wake queue %d\n", mq);
}
}
priv->passive_no_rx = false;
}
static void iwl_free_skb(struct iwl_op_mode *op_mode, struct sk_buff *skb)
{
struct iwl_priv *priv = IWL_OP_MODE_GET_DVM(op_mode);
struct ieee80211_tx_info *info;
info = IEEE80211_SKB_CB(skb);
iwl_trans_free_tx_cmd(priv->trans, info->driver_data[1]);
ieee80211_free_txskb(priv->hw, skb);
}
static bool iwl_set_hw_rfkill_state(struct iwl_op_mode *op_mode, bool state)
{
struct iwl_priv *priv = IWL_OP_MODE_GET_DVM(op_mode);
if (state)
set_bit(STATUS_RF_KILL_HW, &priv->status);
else
clear_bit(STATUS_RF_KILL_HW, &priv->status);
wiphy_rfkill_set_hw_state(priv->hw->wiphy, state);
return false;
}
static void iwl_napi_add(struct iwl_op_mode *op_mode,
struct napi_struct *napi,
struct net_device *napi_dev,
int (*poll)(struct napi_struct *, int),
int weight)
{
struct iwl_priv *priv = IWL_OP_MODE_GET_DVM(op_mode);
netif_napi_add(napi_dev, napi, poll, weight);
priv->napi = napi;
}
static const struct iwl_op_mode_ops iwl_dvm_ops = {
.start = iwl_op_mode_dvm_start,
.stop = iwl_op_mode_dvm_stop,
.rx = iwl_rx_dispatch,
.queue_full = iwl_stop_sw_queue,
.queue_not_full = iwl_wake_sw_queue,
.hw_rf_kill = iwl_set_hw_rfkill_state,
.free_skb = iwl_free_skb,
.nic_error = iwl_nic_error,
.cmd_queue_full = iwl_cmd_queue_full,
.nic_config = iwl_nic_config,
.wimax_active = iwl_wimax_active,
.napi_add = iwl_napi_add,
};
/*****************************************************************************
*
* driver and module entry point
*
*****************************************************************************/
static int __init iwl_init(void)
{
int ret;
ret = iwlagn_rate_control_register();
if (ret) {
pr_err("Unable to register rate control algorithm: %d\n", ret);
return ret;
}
ret = iwl_opmode_register("iwldvm", &iwl_dvm_ops);
if (ret) {
pr_err("Unable to register op_mode: %d\n", ret);
iwlagn_rate_control_unregister();
}
return ret;
}
module_init(iwl_init);
static void __exit iwl_exit(void)
{
iwl_opmode_deregister("iwldvm");
iwlagn_rate_control_unregister();
}
module_exit(iwl_exit);
|
Annie composed by Charles Strouse. For Guitar, Piano/Keyboard, Vocal. Vocal Selections. 56 pages. Published by Hal Leonard (HL.383058). |
Welcome, friends, to a recipe as joyous as the dawn chorus. This one is outrageously easy to make, and perfect for a sombre Autumn afternoon.
Ingredients: One kilo of herring roe, a felt pocket, feta, rocket, salt, saffron.
1) Gently salt your herring roe.
2) Place the herring roe in a large felt pocket.
3) Cradle the felt pocket for three to four hours.
4) Transfer the herring from the felt pocket onto a plate. Add rocket, feta and saffron.
5) Tuck into the Herring and Felt Chili.
6) Embrace the feeling of Herring and Felt Chili inside your belly. A feeling of longing, of sickness, or remorse, of regret. A Herring and Felt Chili for what could have been and a Herring and Felt Chili for what still may transpire. A Herring and Felt Chili for him. For her. For them. For all.
7) Make another dish of Herring and Felt Chili but this time leave it on a neighbour’s wall.
8) Recite a poem about Herring and Felt Chili which you have invented on the spot.
9) Cry yourself to sleep.
Similar recipes: Herring and Satin Chili; Salmon and Felt Chili; Salmon and Satin Chili. |
/*
* (c) Copyright 2016 Hewlett Packard Enterprise Development LP
*
* 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 toolkit.neuralnetwork.layer
import libcog._
import toolkit.neuralnetwork.function.{Convolution, TrainableState}
import toolkit.neuralnetwork.policy._
import toolkit.neuralnetwork.{DifferentiableField, WeightBinding}
object ConvolutionLayer {
def apply(input: DifferentiableField,
filterShape: Shape,
filterNum: Int,
border: BorderPolicy,
learningRule: LearningRule,
stride: Int = 1,
impl: ConvolutionalLayerPolicy = Best,
initPolicy: WeightInitPolicy = ConvInit,
weightBinding: WeightBinding = EmptyBinding): Layer = {
val inputShape = input.forward.fieldShape
val inputTensorShape = input.forward.tensorShape
require(inputTensorShape.dimensions == 1, s"input must be a vector field, got $inputTensorShape")
require(inputTensorShape(0) % input.batchSize == 0, s"input vector length (${inputTensorShape(0)}) must be an integer multiple of the batch size (${input.batchSize})")
require(filterShape.dimensions == 2, s"filters must be 2D, got $filterShape")
require(filterNum >= 1, s"filter bank must contain at least one filter, got $filterNum")
val inputLen = inputTensorShape(0) / input.batchSize
// Allocating `filterNum` filters, each of a shape specified by `filterShape` and `inputLen` planes deep
val weights = TrainableState(filterShape, Shape(inputLen * filterNum), initPolicy, learningRule, weightBinding)
Layer(Convolution(input, weights, border, stride, impl), weights)
}
}
|
/*
* #%L
* Protempa Framework
* %%
* Copyright (C) 2012 - 2013 Emory University
* %%
* 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.
* #L%
*/
package org.protempa;
/**
* Thrown when a Protempa query fails. It always has a cause with a more
* specific error.
*
* @author Andrew Post
*
*/
public final class QueryException extends ProtempaException {
private static final long serialVersionUID = 7903820808353618290L;
private final String queryId;
public QueryException(String queryId, Throwable cause) {
super("Query " + queryId + " failed", cause);
if (cause == null) {
throw new IllegalArgumentException("cause cannot be null");
}
if (queryId == null) {
throw new IllegalArgumentException("queryId cannot be null");
}
this.queryId = queryId;
}
public QueryException(String queryId, String message) {
super(message != null ? "Query " + queryId + " failed: " + message : "Query " + queryId + " failed");
if (queryId == null) {
throw new IllegalArgumentException("queryId cannot be null");
}
this.queryId = queryId;
}
public String getQueryId() {
return this.queryId;
}
}
|
So lately theres this weird sound when I play. It sounds like an electrical spark, but its coming from the strings (between the bridge and my strumming hand) does this mean my strings are old or is it something else?
A dirty bass, such as Dust can cause this problem. A bass may look clean, but even a little build up that is able to collect on the pick ups can create this nuisance. People that notice a pop or crackling sound tend to think they have a bad instrument cable or a wiring problem. Before anyone assumes they have a problem with a certain pot/cable/ or wiring - clean the bass thoroughly for dust.
Hopefully, this is what is causing your problem and nothing more.
……… and another thing crossed my mind – make sure the instrument cable is tight from the jack to your bass. A loose/floppy connection will no doubt cause this sparking sound frequently. It happens often from plugging and unplugging the cable from the guitar on a regular basis. If this is the case, it's an easy fix. This just means the prong that keeps the cable snug has opened up enough where the cable is loose or the cable keeps falling out of the jack.
The fix - unscrew the jack from your guitar and push the prong inward 'till the cable and jack feel tight and secure.
do your pickups have silver dots across them - are the poles exposed? if so, are you touching them? That can give a crackly, electrical sound.
are your pick ups too high?
The spark sound returned. I turned the amp off and played unplugged and it was still there. it till sounds like an electrical spark, but its source isnt electric.
Could it be string slap? Do you have active pickups?
what do you mean by string slap?
Are the strings worn at the bridge? Very odd to making a spark sound while unplugged. |
With over 120 years combined experience, the technicians at Apple Valley – Eagan Appliance, Heating & Air supply expert heating services to the Elko-New Market, MN area. Our family owned and operated business always provides quality service you can count on at prices you can afford.
With 24 /7 emergency services to our customers, so they never have to wait to repair their heating systems.
With hundreds of sizes and models, our heating contractors can assist you in choosing the best equipment for your home.
If you’ve noticed a dip in temperature, it’s not just the Elko-New Market, MN climate; it could be your furnace! This requires a call to your Elko-New Market HVAC repair company.
Heating systems are very important in any home, especially in the Elko-New Market, MN area. Hiring professionals for heater repairs is always a great choice. Our team can solve your furnace problems efficiently and affordably.
Schedule your free estimate on replacement equipment today at 952-953-0080. |
KFN aims to serve a refreshing choice of delicious fresh food in inspiring and customized ways to the KIS community.
KFN has developed a reputation for fresh food, innovation and a personalized service. As such KFN has been honored with a Hospitality Assured Award. KFN are geared to provide the best possible catering service and value for money to all its customers.
KFN only buy the best. KFN insist on maximum freshness and have built up a reliable network of approved and trusted suppliers.
KFN chefs are hand-chosen professionals, cooking to the highest standards and offering an ever-evolving menu selection.
KFN nurtures and values a close working relationship with the KIS community. KFN welcomes sharing and developing new ideas, concepts and feedback for the benefit of one and all . |
Another week of Mr Green’s Spring Festivities has just begun, and you can win a share of cash and earn more free spins if you like.
This new promotional week is kicking off today, 27th March, and will continue until the 2nd April. Whilst only two promotions await this week, you can still make the most of it.
For starters, join the cash drop and play three qualifying slots at €0.75 to trigger one or more cash prizes. Yes, you can keep coming back and hope to win more than one prize!
The cash prizes are, of course, free from wagering requirements and they will be added to your account right away. Also, the remaining cash prizes are updated every 60 seconds.
Of course, it wouldn’t be the same without the chance to also earn some free spins. And whilst this is the second and last offer of this week, you can claim it three times per day until the 2nd April, making it worth your while.
In order to earn 30 seconds of free spins on Lucky Mr Green, you have to play 150 rounds on Mystery Reels Megaways, Wild Egypt, Imperial Palace and/or Wild Spartans for €2 per round.
Remember that free spin winnings will need to be wagered 35x at Mr Green before you can withdraw them.
Be sure to check back on the 3rd April with us when the third week of Mr Green’s spring festivities kicks off. Until then, have lots of fun and good luck! |
I just checked the Amazon page for Hope and Other Dangerous Pursuits, and nearly fell out of my chair. Apparently, readers who bought HODP also bought Nedjma’s The Almond. WTF? Sure, both are set in Morocco, but, really, you couldn’t pick two more different books if you tried. Bizarre. |
---
title: cmd_bat脚本
categories:
- Dev
tags:
- bat脚本
top: 10
abbrlink: 58627
date: 2017-03-18 22:31:02
keywords: bat,cmd
---
# bat_cmd常用命令
**::** 注释
**md** 创建目录
**xcopy** xcopy要用绝对路径才能在脚本里运行,遇到目录会提示,要指定参数,具体参数看帮助`xcopy /?`
**rd /s /q** 删除目录
如果要删除一个目录下的所有文件,用del命令是无法删除目录的,可以先**rd**后**md**。
同样**移动文件夹**时**move**只能移动文件,而不能移动文件夹;可以先**xcopy**然后**rd**。
**puase** 结尾加上这个,不用**goto exit**则会等待用户按任意键后才会退出脚本。
---
# <font color=#0000EE>关于时间的获取</font>(格式:20170318):
win7中:`%DATE:~0,4%%DATE:~5,2%%DATE:~8,2%`
win_server:`%date:~10,4%%date:~4,2%%date:~7,2%`
---
# <font color=#0000EE>电源管理</font>(具体参数看:shutdown /?):
在5:30分自动关机:`at 05:30 shutdown -s -f`
在XXX分钟后重启:`shutdown -r -t 60`
---
# <font color=#0000EE>forfiles</font>命令(针对文件的操作命令):
/p 指定的路径
/s 包括子目录
/m 查找的文件名掩码
/d 指定日期,有绝对日期和相对日期, 此处-7指当前日期 的7天前
/c 运行的命令行 表示为每个文件执行的命令。命令字符串应该用双引号括起来。默认命令是 "cmd /c echo @file"。下列变量可以用在命令字符串中:
* @file - 返回文件名。
* @fname - 返回不带扩展名的文件名。
* @ext - 只返回文件的扩展。
* @path - 返回文件的完整路径。
* @relpath - 返回文件的相对路径。
* @isdir - 如果文件类型是目录,返回 "TRUE";如果是文件,返回 "FALSE"。
* @fsize - 以字节为单位返回文件大小。
* @fdate - 返回文件上一次修改的日期。
* @ftime - 返回文件上一次修改的时间。
**示例**
要列出驱动器 C: 上的所有批处理文件,请键入:
```
forfiles /p c:/ /s /m*.bat /c"cmd /c echo @file is a batch file"```
要列出驱动器 C: 上的所有目录,请键入:
```
forfiles /p c:/ /s /m*.* /c"cmd /c if @isdir==true echo @file is a directory"```
要列出驱动器 C: 上存在时间多于 100 天的所有文件,请键入:
```
forfiles /p c:/ /s /m*.* /dt-100 /c"cmd /c echo @file :date >= 100 days"```
要列出驱动器 C: 上 1993 年 1 月 1 日以前创建的所有文件,而且对于日期早于 1993 年 1 月 1 日的文件显示“file is quite old!”,请键入:
```
forfiles /p c:/ /s /m*.* /dt-01011993 /c"cmd /c echo @file is quite old!"```
要按列格式列出驱动器 C: 上所有文件的扩展名,请键入:
```
forfiles /p c:/ /s /m*.* /c "cmd /c echo extension of @file is 0x09@ext0x09" With:```
要列出驱动器 C: 上的所有批处理文件,请键入:
```
forfiles /p c:/ /s /m *.bat /c "cmd /c echo @file is a batch file"```
要列出驱动器 C: 上的所有目录,请键入:
```
forfiles /p c:/ /s /m *.* /c "cmd /c if @isdir==true echo @file is a directory"```
要列出驱动器 C: 上存在时间多于 100 天的所有文件,请键入:
```
forfiles /p c:/ /s /m *.* /d t-100 /c "cmd /c echo @file :date >= 100 days"```
要列出驱动器 C: 上 1993 年 1 月 1 日以前创建的所有文件,而且对于日期早于 1993 年 1 月 1 日的文件显示“file is quite old!”,请键入:
```
forfiles /p c:/ /s /m *.* /d t-01011993 /c "cmd /c echo @file is quite old!"```
要按列格式列出驱动器 C: 上所有文件的扩展名,请键入:
```
forfiles /p c:/ /s /m*.* /c "cmd /c echo extension of @file is 0x09@ext0x09"```
---
# <font color=#0000EE>for循环</font>
for /?
FOR 变量参照的替换已被增强。您现在可以使用下列
选项语法:
~I - 删除任何引号("),扩充 %I
%~fI - 将 %I 扩充到一个完全合格的路径名
%~dI - 仅将 %I 扩充到一个驱动器号
%~pI - 仅将 %I 扩充到一个路径
%~nI - 仅将 %I 扩充到一个文件名
%~xI - 仅将 %I 扩充到一个文件扩展名
%~sI - 扩充的路径只含有短名
%~aI - 将 %I 扩充到文件的文件属性
%~tI - 将 %I 扩充到文件的日期/时间
%~zI - 将 %I 扩充到文件的大小
%~$PATH:I - 查找列在路径环境变量的目录,并将 %I 扩充
到找到的第一个完全合格的名称。如果环境变量名
未被定义,或者没有找到文件,此组合键会扩充到
空字符串
可以组合修饰符来得到多重结果:
%~dpI - 仅将 %I 扩充到一个驱动器号和路径
%~nxI - 仅将 %I 扩充到一个文件名和扩展名
%~fsI - 仅将 %I 扩充到一个带有短名的完整路径名
%~dp$PATH:i - 查找列在路径环境变量的目录,并将 %I 扩充
到找到的第一个驱动器号和路径。
%~ftzaI - 将 %I 扩充到类似输出线路的 DIR
## 删除D:\Logs下的空目录
```
for /f "delims=" %%a in ('dir D:\Logs /b /ad /s ^|sort /r' ) do rd /q "%%a" 2>nul
```
---
## 示例脚本1
这个脚本是复制备份文件到指定目录(目录以20170318这种格式创建),并递归查找7天以上的旧内容并删除。
```
@echo off
echo ----------------------------------------------------------- >>SQL_bat.log
echo SQL Databases backup start %Date% - %time% >>SQL_bat.log
::set yymmdd=%DATE:~0,4%%DATE:~5,2%%DATE:~8,2%
set yymmdd=%date:~10,4%%date:~4,2%%date:~7,2%
md F:\DB_Buckup\%yymmdd%
C:\Windows\System32\xcopy.exe C:\DBBackUp_Plan\* F:\DB_Buckup\%yymmdd% /s /e
C:\Windows\System32\xcopy.exe /e /i C:\DBBackUp_Plan\* F:\DB_Buckup\%yymmdd%
rd /s /q C:\DBBackUp_Plan
::下面这段是搜索7天以上旧内容并删除
set file_dir="F:\DB_Buckup"
set bak_dat=7
forfiles /p %file_dir% /S /M *.* /D -%bak_dat% /C "cmd /c echo del@relpath file… & echo. & del /s /q @file" >>SQL_bat.log
echo SQL Databases backup stop %Date% - %time% >>SQL_bat.log
echo ----------------------------------------------------------- >>SQL_bat.log
goto exit
:exit
```
---
# 功能实现
## 远程执行程序、脚本
下载PsExec:https://technet.microsoft.com/en-us/sysinternals/bb897553.aspx
**下载页面有相关的使用说明**
解压文件后把psexec放到你需要的位置,如果没有添加环境变量就要用绝对路径去执行。目标主机的防火墙要开135,139这两个端口。
<font color="#EE9A00">常见用法</font>
**语法**:`psexec 远程主机名/IP -u 用户名 -p 密码 [参数] [被执行的程序]`
只在局域网内应用成功,外网没有测试过,用IP可能会连接不了远程主机,可能是防火墙的问题,可以改用主机名,在cmd里输入hostname查看主机名。
```
psexec \\hostname -u Administrator -p mypassword -i "D:\123.bat"
psexec \\hostname -u Administrator -p mypassword -c "D:\123.bat"```
**参数**:
-i 是执行远程相应位置的脚本。
-c 是复制本地脚本到远程执行。
参考:
http://blog.csdn.net/miss_easy/article/details/47780797
http://blog.sina.com.cn/s/blog_4e46983d0101ovkw.html
---
# 备份数据库
备份SqlServer数据库:[SqlServer备份数据库的4种方式介绍](http://www.jb51.net/article/61423.htm)
---
|
/*
* Copyright (C) 2013, Broadcom Corporation. All Rights Reserved.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
* SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
* OTP support.
*
* $Id: bcmotp.c 322632 2012-03-21 05:17:48Z $
*/
#include <bcm_cfg.h>
#include <typedefs.h>
#include <bcmdefs.h>
#include <osl.h>
#include <bcmdevs.h>
#include <bcmutils.h>
#include <siutils.h>
#include <bcmendian.h>
#include <hndsoc.h>
#include <sbchipc.h>
#include <bcmotp.h>
/*
* There are two different OTP controllers so far:
* 1. new IPX OTP controller: chipc 21, >=23
* 2. older HND OTP controller: chipc 12, 17, 22
*
* Define BCMHNDOTP to include support for the HND OTP controller.
* Define BCMIPXOTP to include support for the IPX OTP controller.
*
* NOTE 1: More than one may be defined
* NOTE 2: If none are defined, the default is to include them all.
*/
#if !defined(BCMHNDOTP) && !defined(BCMIPXOTP)
#define BCMHNDOTP 1
#define BCMIPXOTP 1
#endif
#define OTPTYPE_HND(ccrev) ((ccrev) < 21 || (ccrev) == 22)
#define OTPTYPE_IPX(ccrev) ((ccrev) == 21 || (ccrev) >= 23)
#define OTP_ERR_VAL 0x0001
#define OTP_MSG_VAL 0x0002
#define OTP_DBG_VAL 0x0004
uint32 otp_msg_level = OTP_ERR_VAL;
#if defined(BCMDBG) || defined(BCMDBG_ERR)
#define OTP_ERR(args) do {if (otp_msg_level & OTP_ERR_VAL) printf args;} while (0)
#else
#define OTP_ERR(args)
#endif
#ifdef BCMDBG
#define OTP_MSG(args) do {if (otp_msg_level & OTP_MSG_VAL) printf args;} while (0)
#define OTP_DBG(args) do {if (otp_msg_level & OTP_DBG_VAL) printf args;} while (0)
#else
#define OTP_MSG(args)
#define OTP_DBG(args)
#endif
#define OTPP_TRIES 10000000 /* # of tries for OTPP */
#define OTP_FUSES_PER_BIT 2
#define OTP_WRITE_RETRY 16
#ifdef BCMIPXOTP
#define MAXNUMRDES 9 /* Maximum OTP redundancy entries */
#endif
/* OTP common function type */
typedef int (*otp_status_t)(void *oh);
typedef int (*otp_size_t)(void *oh);
typedef void* (*otp_init_t)(si_t *sih);
typedef uint16 (*otp_read_bit_t)(void *oh, chipcregs_t *cc, uint off);
typedef int (*otp_read_region_t)(si_t *sih, int region, uint16 *data, uint *wlen);
typedef int (*otp_nvread_t)(void *oh, char *data, uint *len);
typedef int (*otp_write_region_t)(void *oh, int region, uint16 *data, uint wlen);
typedef int (*otp_cis_append_region_t)(si_t *sih, int region, char *vars, int count);
typedef int (*otp_lock_t)(si_t *sih);
typedef int (*otp_nvwrite_t)(void *oh, uint16 *data, uint wlen);
typedef int (*otp_dump_t)(void *oh, int arg, char *buf, uint size);
typedef int (*otp_write_word_t)(void *oh, uint wn, uint16 data);
typedef int (*otp_read_word_t)(void *oh, uint wn, uint16 *data);
typedef int (*otp_write_bits_t)(void *oh, int bn, int bits, uint8* data);
/* OTP function struct */
typedef struct otp_fn_s {
otp_size_t size;
otp_read_bit_t read_bit;
otp_dump_t dump;
otp_status_t status;
otp_init_t init;
otp_read_region_t read_region;
otp_nvread_t nvread;
otp_write_region_t write_region;
otp_cis_append_region_t cis_append_region;
otp_lock_t lock;
otp_nvwrite_t nvwrite;
otp_write_word_t write_word;
otp_read_word_t read_word;
#if defined(BCMNVRAMW)
otp_write_bits_t write_bits;
#endif
} otp_fn_t;
typedef struct {
uint ccrev; /* chipc revision */
otp_fn_t *fn; /* OTP functions */
si_t *sih; /* Saved sb handle */
osl_t *osh;
#ifdef BCMIPXOTP
/* IPX OTP section */
uint16 wsize; /* Size of otp in words */
uint16 rows; /* Geometry */
uint16 cols; /* Geometry */
uint32 status; /* Flag bits (lock/prog/rv).
* (Reflected only when OTP is power cycled)
*/
uint16 hwbase; /* hardware subregion offset */
uint16 hwlim; /* hardware subregion boundary */
uint16 swbase; /* software subregion offset */
uint16 swlim; /* software subregion boundary */
uint16 fbase; /* fuse subregion offset */
uint16 flim; /* fuse subregion boundary */
int otpgu_base; /* offset to General Use Region */
uint16 fusebits; /* num of fusebits */
bool buotp; /* Uinified OTP flag */
uint usbmanfid_offset; /* Offset of the usb manfid inside the sdio CIS */
struct {
uint8 width; /* entry width in bits */
uint8 val_shift; /* value bit offset in the entry */
uint8 offsets; /* # entries */
uint8 stat_shift; /* valid bit in otpstatus */
uint16 offset[MAXNUMRDES]; /* entry offset in OTP */
} rde_cb; /* OTP redundancy control blocks */
uint16 rde_idx;
#endif /* BCMIPXOTP */
#ifdef BCMHNDOTP
/* HND OTP section */
uint size; /* Size of otp in bytes */
uint hwprot; /* Hardware protection bits */
uint signvalid; /* Signature valid bits */
int boundary; /* hw/sw boundary */
#endif /* BCMHNDOTP */
} otpinfo_t;
static otpinfo_t otpinfo;
/*
* ROM accessor to avoid struct in shdat
*/
static otpinfo_t *
get_otpinfo(void)
{
return (otpinfo_t *)&otpinfo;
}
/*
* IPX OTP Code
*
* Exported functions:
* ipxotp_status()
* ipxotp_size()
* ipxotp_init()
* ipxotp_read_bit()
* ipxotp_read_region()
* ipxotp_read_word()
* ipxotp_nvread()
* ipxotp_write_region()
* ipxotp_write_word()
* ipxotp_cis_append_region()
* ipxotp_lock()
* ipxotp_nvwrite()
* ipxotp_dump()
*
* IPX internal functions:
* ipxotp_otpr()
* _ipxotp_init()
* ipxotp_write_bit()
* ipxotp_otpwb16()
* ipxotp_check_otp_pmu_res()
* ipxotp_write_rde()
* ipxotp_fix_word16()
* ipxotp_check_word16()
* ipxotp_max_rgnsz()
* ipxotp_otprb16()
* ipxotp_uotp_usbmanfid_offset()
*
*/
#ifdef BCMIPXOTP
#define OTPWSIZE 16 /* word size */
#define HWSW_RGN(rgn) (((rgn) == OTP_HW_RGN) ? "h/w" : "s/w")
/* OTP layout */
/* CC revs 21, 24 and 27 OTP General Use Region word offset */
#define REVA4_OTPGU_BASE 12
/* CC revs 23, 25, 26, 28 and above OTP General Use Region word offset */
#define REVB8_OTPGU_BASE 20
/* CC rev 36 OTP General Use Region word offset */
#define REV36_OTPGU_BASE 12
/* Subregion word offsets in General Use region */
#define OTPGU_HSB_OFF 0
#define OTPGU_SFB_OFF 1
#define OTPGU_CI_OFF 2
#define OTPGU_P_OFF 3
#define OTPGU_SROM_OFF 4
/* Flag bit offsets in General Use region */
#define OTPGU_NEWCISFORMAT_OFF 59
#define OTPGU_HWP_OFF 60
#define OTPGU_SWP_OFF 61
#define OTPGU_CIP_OFF 62
#define OTPGU_FUSEP_OFF 63
#define OTPGU_CIP_MSK 0x4000
#define OTPGU_P_MSK 0xf000
#define OTPGU_P_SHIFT (OTPGU_HWP_OFF % 16)
/* LOCK but offset */
#define OTP_LOCK_ROW1_LOC_OFF 63 /* 1st ROW lock bit */
#define OTP_LOCK_ROW2_LOC_OFF 127 /* 2nd ROW lock bit */
#define OTP_LOCK_RD_LOC_OFF 128 /* Redundnancy Region lock bit */
#define OTP_LOCK_GU_LOC_OFF 129 /* General User Region lock bit */
/* OTP Size */
#define OTP_SZ_FU_324 ((ROUNDUP(324,8))/8) /* 324 bits */
#define OTP_SZ_FU_288 (288/8) /* 288 bits */
#define OTP_SZ_FU_216 (216/8) /* 216 bits */
#define OTP_SZ_FU_72 (72/8) /* 72 bits */
#define OTP_SZ_CHECKSUM (16/8) /* 16 bits */
#define OTP4315_SWREG_SZ 178 /* 178 bytes */
#define OTP_SZ_FU_144 (144/8) /* 144 bits */
#define OTP_SZ_FU_180 ((ROUNDUP(180,8))/8) /* 180 bits */
/* OTP BT shared region (pre-allocated) */
#define OTP_BT_BASE_4330 (1760/OTPWSIZE)
#define OTP_BT_END_4330 (1888/OTPWSIZE)
#define OTP_BT_BASE_4324 (2384/OTPWSIZE)
#define OTP_BT_END_4324 (2640/OTPWSIZE)
#define OTP_BT_BASE_4334 (2512/OTPWSIZE)
#define OTP_BT_END_4334 (2768/OTPWSIZE)
#define OTP_BT_BASE_4314 (4192/OTPWSIZE)
#define OTP_BT_END_4314 (4960/OTPWSIZE)
#define OTP_BT_BASE_4335 (4528/OTPWSIZE)
#define OTP_BT_END_4335 (5552/OTPWSIZE)
/* OTP unification */
#if defined(USBSDIOUNIFIEDOTP)
/* USB MANIFID tuple offset in the SDIO CIS in (16-bit) words */
#define USB_MANIFID_OFFSET_4319 42
#endif /* USBSDIOUNIFIEDOTP */
#if defined(BCMNVRAMW)
/* Local */
static int ipxotp_check_otp_pmu_res(chipcregs_t *cc);
static int ipxotp_write_bit(otpinfo_t *oi, chipcregs_t *cc, uint off);
static int ipxotp40n_read2x(void *oh, chipcregs_t *cc, uint off);
static int ipxotp_write_rde_nopc(void *oh, chipcregs_t *cc, int rde, uint bit, uint val);
#endif
static int
ipxotp_status(void *oh)
{
otpinfo_t *oi = (otpinfo_t *)oh;
return (int)(oi->status);
}
/* Return size in bytes */
static int
ipxotp_size(void *oh)
{
otpinfo_t *oi = (otpinfo_t *)oh;
return (int)oi->wsize * 2;
}
static uint16
ipxotp_otpr(void *oh, chipcregs_t *cc, uint wn)
{
otpinfo_t *oi;
oi = (otpinfo_t *)oh;
ASSERT(wn < oi->wsize);
ASSERT(cc != NULL);
return R_REG(oi->osh, &cc->sromotp[wn]);
}
static uint16
ipxotp_read_bit_common(void *oh, chipcregs_t *cc, uint off)
{
otpinfo_t *oi = (otpinfo_t *)oh;
uint k, row, col;
uint32 otpp, st;
uint otpwt;
otpwt = (R_REG(oi->osh, &cc->otplayout) & OTPL_WRAP_TYPE_MASK) >> OTPL_WRAP_TYPE_SHIFT;
row = off / oi->cols;
col = off % oi->cols;
otpp = OTPP_START_BUSY |
((((otpwt == OTPL_WRAP_TYPE_40NM)? OTPPOC_READ_40NM :
OTPPOC_READ) << OTPP_OC_SHIFT) & OTPP_OC_MASK) |
((row << OTPP_ROW_SHIFT) & OTPP_ROW_MASK) |
((col << OTPP_COL_SHIFT) & OTPP_COL_MASK);
OTP_DBG(("%s: off = %d, row = %d, col = %d, otpp = 0x%x",
__FUNCTION__, off, row, col, otpp));
W_REG(oi->osh, &cc->otpprog, otpp);
for (k = 0;
((st = R_REG(oi->osh, &cc->otpprog)) & OTPP_START_BUSY) && (k < OTPP_TRIES);
k ++)
;
if (k >= OTPP_TRIES) {
OTP_ERR(("\n%s: BUSY stuck: st=0x%x, count=%d\n", __FUNCTION__, st, k));
return 0xffff;
}
if (st & OTPP_READERR) {
OTP_ERR(("\n%s: Could not read OTP bit %d\n", __FUNCTION__, off));
return 0xffff;
}
st = (st & OTPP_VALUE_MASK) >> OTPP_VALUE_SHIFT;
OTP_DBG((" => %d\n", st));
return (int)st;
}
static uint16
ipxotp_read_bit(void *oh, chipcregs_t *cc, uint off)
{
otpinfo_t *oi;
oi = (otpinfo_t *)oh;
W_REG(oi->osh, &cc->otpcontrol, 0);
W_REG(oi->osh, &cc->otpcontrol1, 0);
return ipxotp_read_bit_common(oh, cc, off);
}
/*
* OTP BT region size
*/
static void
ipxotp_bt_region_get(otpinfo_t *oi, uint16 *start, uint16 *end)
{
*start = *end = 0;
switch (CHIPID(oi->sih->chip)) {
case BCM4330_CHIP_ID:
*start = OTP_BT_BASE_4330;
*end = OTP_BT_END_4330;
break;
case BCM4324_CHIP_ID:
*start = OTP_BT_BASE_4324;
*end = OTP_BT_END_4324;
break;
case BCM4334_CHIP_ID:
*start = OTP_BT_BASE_4334;
*end = OTP_BT_END_4334;
break;
case BCM4314_CHIP_ID:
case BCM43142_CHIP_ID:
*start = OTP_BT_BASE_4314;
*end = OTP_BT_END_4314;
break;
case BCM4335_CHIP_ID:
*start = OTP_BT_BASE_4335;
*end = OTP_BT_END_4335;
break;
}
}
/* Calculate max HW/SW region byte size by substracting fuse region and checksum size,
* osizew is oi->wsize (OTP size - GU size) in words
*/
static int
ipxotp_max_rgnsz(otpinfo_t *oi)
{
int osizew = oi->wsize;
int ret = 0;
uint16 checksum;
uint idx;
chipcregs_t *cc;
idx = si_coreidx(oi->sih);
cc = si_setcoreidx(oi->sih, SI_CC_IDX);
ASSERT(cc != NULL);
checksum = OTP_SZ_CHECKSUM;
/* for new chips, fusebit is available from cc register */
if (oi->sih->ccrev >= 35) {
oi->fusebits = R_REG(oi->osh, &cc->otplayoutextension) & OTPLAYOUTEXT_FUSE_MASK;
oi->fusebits = ROUNDUP(oi->fusebits, 8);
oi->fusebits >>= 3; /* bytes */
}
si_setcoreidx(oi->sih, idx);
switch (CHIPID(oi->sih->chip)) {
case BCM4322_CHIP_ID: case BCM43221_CHIP_ID: case BCM43231_CHIP_ID:
case BCM43239_CHIP_ID:
oi->fusebits = OTP_SZ_FU_288;
break;
case BCM43222_CHIP_ID: case BCM43111_CHIP_ID: case BCM43112_CHIP_ID:
case BCM43224_CHIP_ID: case BCM43225_CHIP_ID: case BCM43421_CHIP_ID:
case BCM43226_CHIP_ID:
oi->fusebits = OTP_SZ_FU_72;
break;
case BCM43236_CHIP_ID: case BCM43235_CHIP_ID: case BCM43238_CHIP_ID:
case BCM43237_CHIP_ID:
case BCM43234_CHIP_ID:
oi->fusebits = OTP_SZ_FU_324;
break;
case BCM4325_CHIP_ID:
case BCM5356_CHIP_ID:
oi->fusebits = OTP_SZ_FU_216;
break;
case BCM4336_CHIP_ID:
case BCM43362_CHIP_ID:
oi->fusebits = OTP_SZ_FU_144;
break;
case BCM4313_CHIP_ID:
oi->fusebits = OTP_SZ_FU_72;
break;
case BCM4330_CHIP_ID:
case BCM4334_CHIP_ID:
case BCM4314_CHIP_ID:
case BCM43142_CHIP_ID:
oi->fusebits = OTP_SZ_FU_144;
break;
case BCM4319_CHIP_ID:
oi->fusebits = OTP_SZ_FU_180;
break;
case BCM4331_CHIP_ID:
case BCM43431_CHIP_ID:
oi->fusebits = OTP_SZ_FU_72;
break;
case BCM43131_CHIP_ID:
case BCM43217_CHIP_ID:
case BCM43227_CHIP_ID:
case BCM43228_CHIP_ID:
case BCM43428_CHIP_ID:
oi->fusebits = OTP_SZ_FU_72;
break;
default:
if (oi->fusebits == 0)
ASSERT(0); /* Don't konw about this chip */
}
ret = osizew*2 - oi->fusebits - checksum;
if (CHIPID(oi->sih->chip) == BCM4315_CHIP_ID) {
ret = OTP4315_SWREG_SZ;
}
OTP_MSG(("max region size %d bytes\n", ret));
return ret;
}
/*
* OTP sizes for 65nm and 130nm
*/
static int
ipxotp_otpsize_set_65nm(otpinfo_t *oi, uint otpsz)
{
/* Check for otp size */
switch (otpsz) {
case 1: /* 32x64 */
oi->rows = 32;
oi->cols = 64;
oi->wsize = 128;
break;
case 2: /* 64x64 */
oi->rows = 64;
oi->cols = 64;
oi->wsize = 256;
break;
case 5: /* 96x64 */
oi->rows = 96;
oi->cols = 64;
oi->wsize = 384;
break;
case 7: /* 16x64 */ /* 1024 bits */
oi->rows = 16;
oi->cols = 64;
oi->wsize = 64;
break;
default:
/* Don't know the geometry */
OTP_ERR(("%s: unknown OTP geometry\n", __FUNCTION__));
}
return 0;
}
/*
* OTP sizes for 40nm
*/
static int
ipxotp_otpsize_set_40nm(otpinfo_t *oi, uint otpsz)
{
/* Check for otp size */
switch (otpsz) {
case 1: /* 64x32: 2048 bits */
oi->rows = 64;
oi->cols = 32;
break;
case 2: /* 96x32: 3072 bits */
oi->rows = 96;
oi->cols = 32;
break;
case 3: /* 128x32: 4096 bits */
oi->rows = 128;
oi->cols = 32;
break;
case 4: /* 160x32: 5120 bits */
oi->rows = 160;
oi->cols = 32;
break;
case 5: /* 192x32: 6144 bits */
oi->rows = 192;
oi->cols = 32;
break;
case 7: /* 256x32: 8192 bits */
oi->rows = 256;
oi->cols = 32;
break;
default:
/* Don't know the geometry */
OTP_ERR(("%s: unknown OTP geometry\n", __FUNCTION__));
}
oi->wsize = (oi->cols * oi->rows)/OTPWSIZE;
return 0;
}
/* OTP unification */
#if defined(USBSDIOUNIFIEDOTP) && defined(BCMNVRAMW)
static void
ipxotp_uotp_usbmanfid_offset(otpinfo_t *oi)
{
OTP_DBG(("%s: chip=0x%x\n", __FUNCTION__, CHIPID(oi->sih->chip)));
switch (CHIPID(oi->sih->chip)) {
/* Add cases for supporting chips */
case BCM4319_CHIP_ID:
oi->usbmanfid_offset = USB_MANIFID_OFFSET_4319;
oi->buotp = TRUE;
break;
default:
OTP_ERR(("chip=0x%x does not support Unified OTP.\n",
CHIPID(oi->sih->chip)));
break;
}
}
#endif /* USBSDIOUNIFIEDOTP && BCMNVRAMW */
static void
BCMNMIATTACHFN(_ipxotp_init)(otpinfo_t *oi, chipcregs_t *cc)
{
uint k;
uint32 otpp, st;
uint16 btsz, btbase = 0, btend = 0;
uint otpwt;
/* record word offset of General Use Region for various chipcommon revs */
if (oi->sih->ccrev >= 40) {
/* FIX: Available in rev >= 23; Verify before applying to others */
oi->otpgu_base = (R_REG(oi->osh, &cc->otplayout) & OTPL_HWRGN_OFF_MASK)
>> OTPL_HWRGN_OFF_SHIFT;
ASSERT((oi->otpgu_base - (OTPGU_SROM_OFF * OTPWSIZE)) > 0);
oi->otpgu_base >>= 4; /* words */
oi->otpgu_base -= OTPGU_SROM_OFF;
} else if (oi->sih->ccrev == 21 || oi->sih->ccrev == 24 || oi->sih->ccrev == 27) {
oi->otpgu_base = REVA4_OTPGU_BASE;
} else if ((oi->sih->ccrev == 36) || (oi->sih->ccrev == 39)) {
/* OTP size greater than equal to 2KB (128 words), otpgu_base is similar to rev23 */
if (oi->wsize >= 128)
oi->otpgu_base = REVB8_OTPGU_BASE;
else
oi->otpgu_base = REV36_OTPGU_BASE;
} else if (oi->sih->ccrev == 23 || oi->sih->ccrev >= 25) {
oi->otpgu_base = REVB8_OTPGU_BASE;
} else {
OTP_ERR(("%s: chipc rev %d not supported\n", __FUNCTION__, oi->sih->ccrev));
}
otpwt = (R_REG(oi->osh, &cc->otplayout) & OTPL_WRAP_TYPE_MASK) >> OTPL_WRAP_TYPE_SHIFT;
if (otpwt != OTPL_WRAP_TYPE_40NM) {
/* First issue an init command so the status is up to date */
otpp = OTPP_START_BUSY | ((OTPPOC_INIT << OTPP_OC_SHIFT) & OTPP_OC_MASK);
OTP_DBG(("%s: otpp = 0x%x", __FUNCTION__, otpp));
W_REG(oi->osh, &cc->otpprog, otpp);
for (k = 0;
((st = R_REG(oi->osh, &cc->otpprog)) & OTPP_START_BUSY) && (k < OTPP_TRIES);
k ++)
;
if (k >= OTPP_TRIES) {
OTP_ERR(("\n%s: BUSY stuck: st=0x%x, count=%d\n", __FUNCTION__, st, k));
return;
}
}
/* Read OTP lock bits and subregion programmed indication bits */
oi->status = R_REG(oi->osh, &cc->otpstatus);
if ((CHIPID(oi->sih->chip) == BCM43222_CHIP_ID) ||
(CHIPID(oi->sih->chip) == BCM43111_CHIP_ID) ||
(CHIPID(oi->sih->chip) == BCM43112_CHIP_ID) ||
(CHIPID(oi->sih->chip) == BCM43224_CHIP_ID) ||
(CHIPID(oi->sih->chip) == BCM43225_CHIP_ID) ||
(CHIPID(oi->sih->chip) == BCM43421_CHIP_ID) ||
(CHIPID(oi->sih->chip) == BCM43226_CHIP_ID) ||
(CHIPID(oi->sih->chip) == BCM43236_CHIP_ID) ||
(CHIPID(oi->sih->chip) == BCM43235_CHIP_ID) ||
(CHIPID(oi->sih->chip) == BCM43234_CHIP_ID) ||
(CHIPID(oi->sih->chip) == BCM43238_CHIP_ID) ||
(CHIPID(oi->sih->chip) == BCM43237_CHIP_ID) ||
(CHIPID(oi->sih->chip) == BCM43239_CHIP_ID) ||
(CHIPID(oi->sih->chip) == BCM4324_CHIP_ID) ||
(CHIPID(oi->sih->chip) == BCM4331_CHIP_ID) ||
(CHIPID(oi->sih->chip) == BCM43431_CHIP_ID) ||
(CHIPID(oi->sih->chip) == BCM4335_CHIP_ID) ||
(CHIPID(oi->sih->chip) == BCM4360_CHIP_ID) ||
(CHIPID(oi->sih->chip) == BCM43526_CHIP_ID) ||
0) {
uint32 p_bits;
p_bits = (ipxotp_otpr(oi, cc, oi->otpgu_base + OTPGU_P_OFF) & OTPGU_P_MSK)
>> OTPGU_P_SHIFT;
oi->status |= (p_bits << OTPS_GUP_SHIFT);
}
OTP_DBG(("%s: status 0x%x\n", __FUNCTION__, oi->status));
/* OTP unification */
oi->buotp = FALSE; /* Initialize it to false, until its explicitely set true. */
oi->usbmanfid_offset = 0;
#if defined(USBSDIOUNIFIEDOTP) && defined(BCMNVRAMW)
ipxotp_uotp_usbmanfid_offset(oi);
#endif /* USBSDIOUNIFIEDOTP && BCMNVRAMW */
if ((oi->status & (OTPS_GUP_HW | OTPS_GUP_SW)) == (OTPS_GUP_HW | OTPS_GUP_SW)) {
switch (CHIPID(oi->sih->chip)) {
/* Add cases for supporting chips */
case BCM4319_CHIP_ID:
oi->buotp = TRUE;
break;
default:
OTP_ERR(("chip=0x%x does not support Unified OTP.\n",
CHIPID(oi->sih->chip)));
break;
}
}
/*
* h/w region base and fuse region limit are fixed to the top and
* the bottom of the general use region. Everything else can be flexible.
*/
oi->hwbase = oi->otpgu_base + OTPGU_SROM_OFF;
oi->hwlim = oi->wsize;
oi->flim = oi->wsize;
ipxotp_bt_region_get(oi, &btbase, &btend);
btsz = btend - btbase;
if (btsz > 0) {
/* default to not exceed BT base */
oi->hwlim = btbase;
/* With BT shared region, swlim and fbase are fixed */
oi->swlim = btbase;
oi->fbase = btend;
}
/* Update hwlim and swbase */
if (oi->status & OTPS_GUP_HW) {
OTP_DBG(("%s: hw region programmed\n", __FUNCTION__));
oi->hwlim = ipxotp_otpr(oi, cc, oi->otpgu_base + OTPGU_HSB_OFF) / 16;
oi->swbase = oi->hwlim;
} else
oi->swbase = oi->hwbase;
/* Update swlim and fbase only if no BT region */
if (btsz == 0) {
/* subtract fuse and checksum from beginning */
oi->swlim = ipxotp_max_rgnsz(oi) / 2;
if (oi->status & OTPS_GUP_SW) {
OTP_DBG(("%s: sw region programmed\n", __FUNCTION__));
oi->swlim = ipxotp_otpr(oi, cc, oi->otpgu_base + OTPGU_SFB_OFF) / 16;
oi->fbase = oi->swlim;
}
else
oi->fbase = oi->swbase;
}
OTP_DBG(("%s: OTP limits---\n"
"hwbase %d/%d hwlim %d/%d\n"
"swbase %d/%d swlim %d/%d\n"
"fbase %d/%d flim %d/%d\n", __FUNCTION__,
oi->hwbase, oi->hwbase * 16, oi->hwlim, oi->hwlim * 16,
oi->swbase, oi->swbase * 16, oi->swlim, oi->swlim * 16,
oi->fbase, oi->fbase * 16, oi->flim, oi->flim * 16));
}
static void *
BCMNMIATTACHFN(ipxotp_init)(si_t *sih)
{
uint idx, otpsz, otpwt;
chipcregs_t *cc;
otpinfo_t *oi = NULL;
OTP_MSG(("%s: Use IPX OTP controller\n", __FUNCTION__));
/* Make sure we're running IPX OTP */
ASSERT(OTPTYPE_IPX(sih->ccrev));
if (!OTPTYPE_IPX(sih->ccrev))
return NULL;
/* Make sure OTP is not disabled */
if (si_is_otp_disabled(sih)) {
OTP_MSG(("%s: OTP is disabled\n", __FUNCTION__));
#if !defined(WLTEST)
return NULL;
#endif
}
/* Make sure OTP is powered up */
if (!si_is_otp_powered(sih)) {
OTP_ERR(("%s: OTP is powered down\n", __FUNCTION__));
return NULL;
}
/* Retrieve OTP region info */
idx = si_coreidx(sih);
cc = si_setcoreidx(sih, SI_CC_IDX);
ASSERT(cc != NULL);
otpsz = (sih->cccaps & CC_CAP_OTPSIZE) >> CC_CAP_OTPSIZE_SHIFT;
if (otpsz == 0) {
OTP_ERR(("%s: No OTP\n", __FUNCTION__));
goto exit;
}
oi = get_otpinfo();
otpwt = (R_REG(oi->osh, &cc->otplayout) & OTPL_WRAP_TYPE_MASK) >> OTPL_WRAP_TYPE_SHIFT;
if (otpwt == OTPL_WRAP_TYPE_40NM) {
ipxotp_otpsize_set_40nm(oi, otpsz);
} else if (otpwt == OTPL_WRAP_TYPE_65NM) {
ipxotp_otpsize_set_65nm(oi, otpsz);
} else {
OTP_ERR(("%s: Unknown wrap type: %d\n", __FUNCTION__, otpwt));
ASSERT(0);
}
OTP_MSG(("%s: rows %u cols %u wsize %u\n", __FUNCTION__, oi->rows, oi->cols, oi->wsize));
#ifdef BCMNVRAMW
/* Initialize OTP redundancy control blocks */
if (sih->ccrev >= 40) {
uint16 offset[] = {269, 286, 303, 333, 350, 367, 397, 414, 431};
bcopy(offset, &oi->rde_cb.offset, sizeof(offset));
oi->rde_cb.offsets = ARRAYSIZE(offset);
oi->rde_cb.width = 17;
oi->rde_cb.val_shift = 13;
oi->rde_cb.stat_shift = 16;
} else if (sih->ccrev == 36) {
uint16 offset[] = {141, 158, 175};
bcopy(offset, &oi->rde_cb.offset, sizeof(offset));
oi->rde_cb.offsets = ARRAYSIZE(offset);
oi->rde_cb.width = 15;
oi->rde_cb.val_shift = 13;
oi->rde_cb.stat_shift = 16;
} else if (sih->ccrev == 21 || sih->ccrev == 24) {
uint16 offset[] = {64, 79, 94, 109, 128, 143, 158, 173};
bcopy(offset, &oi->rde_cb.offset, sizeof(offset));
oi->rde_cb.offsets = ARRAYSIZE(offset);
oi->rde_cb.width = 15;
oi->rde_cb.val_shift = 11;
oi->rde_cb.stat_shift = 16;
}
else if (sih->ccrev == 27) {
uint16 offset[] = {128, 143, 158, 173};
bcopy(offset, &oi->rde_cb.offset, sizeof(offset));
oi->rde_cb.offsets = ARRAYSIZE(offset);
oi->rde_cb.width = 15;
oi->rde_cb.val_shift = 11;
oi->rde_cb.stat_shift = 20;
}
else {
uint16 offset[] = {141, 158, 175, 205, 222, 239, 269, 286, 303};
bcopy(offset, &oi->rde_cb.offset, sizeof(offset));
oi->rde_cb.offsets = ARRAYSIZE(offset);
oi->rde_cb.width = 17;
oi->rde_cb.val_shift = 13;
oi->rde_cb.stat_shift = 16;
}
ASSERT(oi->rde_cb.offsets <= MAXNUMRDES);
/* Initialize global rde index */
oi->rde_idx = 0;
#endif /* BCMNVRAMW */
_ipxotp_init(oi, cc);
exit:
si_setcoreidx(sih, idx);
return (void *)oi;
}
static int
ipxotp_read_region(void *oh, int region, uint16 *data, uint *wlen)
{
otpinfo_t *oi = (otpinfo_t *)oh;
uint idx;
chipcregs_t *cc;
uint base, i, sz;
/* Validate region selection */
switch (region) {
case OTP_HW_RGN:
/* OTP unification: For unified OTP sz=flim-hwbase */
if (oi->buotp)
sz = (uint)oi->flim - oi->hwbase;
else
sz = (uint)oi->hwlim - oi->hwbase;
if (!(oi->status & OTPS_GUP_HW)) {
OTP_ERR(("%s: h/w region not programmed\n", __FUNCTION__));
*wlen = sz;
return BCME_NOTFOUND;
}
if (*wlen < sz) {
OTP_ERR(("%s: buffer too small, should be at least %u\n",
__FUNCTION__, oi->hwlim - oi->hwbase));
*wlen = sz;
return BCME_BUFTOOSHORT;
}
base = oi->hwbase;
break;
case OTP_SW_RGN:
/* OTP unification: For unified OTP sz=flim-swbase */
if (oi->buotp)
sz = ((uint)oi->flim - oi->swbase);
else
sz = ((uint)oi->swlim - oi->swbase);
if (!(oi->status & OTPS_GUP_SW)) {
OTP_ERR(("%s: s/w region not programmed\n", __FUNCTION__));
*wlen = sz;
return BCME_NOTFOUND;
}
if (*wlen < sz) {
OTP_ERR(("%s: buffer too small should be at least %u\n",
__FUNCTION__, oi->swlim - oi->swbase));
*wlen = sz;
return BCME_BUFTOOSHORT;
}
base = oi->swbase;
break;
case OTP_CI_RGN:
sz = OTPGU_CI_SZ;
if (!(oi->status & OTPS_GUP_CI)) {
OTP_ERR(("%s: chipid region not programmed\n", __FUNCTION__));
*wlen = sz;
return BCME_NOTFOUND;
}
if (*wlen < sz) {
OTP_ERR(("%s: buffer too small, should be at least %u\n",
__FUNCTION__, OTPGU_CI_SZ));
*wlen = sz;
return BCME_BUFTOOSHORT;
}
base = oi->otpgu_base + OTPGU_CI_OFF;
break;
case OTP_FUSE_RGN:
sz = (uint)oi->flim - oi->fbase;
if (!(oi->status & OTPS_GUP_FUSE)) {
OTP_ERR(("%s: fuse region not programmed\n", __FUNCTION__));
*wlen = sz;
return BCME_NOTFOUND;
}
if (*wlen < sz) {
OTP_ERR(("%s: buffer too small, should be at least %u\n",
__FUNCTION__, oi->flim - oi->fbase));
*wlen = sz;
return BCME_BUFTOOSHORT;
}
base = oi->fbase;
break;
case OTP_ALL_RGN:
sz = ((uint)oi->flim - oi->hwbase);
if (!(oi->status & (OTPS_GUP_HW | OTPS_GUP_SW))) {
OTP_ERR(("%s: h/w & s/w region not programmed\n", __FUNCTION__));
*wlen = sz;
return BCME_NOTFOUND;
}
if (*wlen < sz) {
OTP_ERR(("%s: buffer too small, should be at least %u\n",
__FUNCTION__, oi->hwlim - oi->hwbase));
*wlen = sz;
return BCME_BUFTOOSHORT;
}
base = oi->hwbase;
break;
default:
OTP_ERR(("%s: reading region %d is not supported\n", __FUNCTION__, region));
return BCME_BADARG;
}
idx = si_coreidx(oi->sih);
cc = si_setcoreidx(oi->sih, SI_CC_IDX);
ASSERT(cc != NULL);
/* Read the data */
for (i = 0; i < sz; i ++)
data[i] = ipxotp_otpr(oh, cc, base + i);
si_setcoreidx(oi->sih, idx);
*wlen = sz;
return 0;
}
static int
ipxotp_read_word(void *oh, uint wn, uint16 *data)
{
otpinfo_t *oi = (otpinfo_t *)oh;
uint idx;
chipcregs_t *cc;
idx = si_coreidx(oi->sih);
cc = si_setcoreidx(oi->sih, SI_CC_IDX);
ASSERT(cc != NULL);
/* Read the data */
*data = ipxotp_otpr(oh, cc, wn);
si_setcoreidx(oi->sih, idx);
return 0;
}
static int
ipxotp_nvread(void *oh, char *data, uint *len)
{
return BCME_UNSUPPORTED;
}
#ifdef BCMNVRAMW
static int
ipxotp_writable(otpinfo_t *oi, chipcregs_t *cc)
{
uint otpwt;
otpwt = (R_REG(oi->osh, &cc->otplayout) & OTPL_WRAP_TYPE_MASK) >> OTPL_WRAP_TYPE_SHIFT;
if (otpwt == OTPL_WRAP_TYPE_40NM) {
uint i, k, row, col;
uint32 otpp, st;
uint cols[4] = {15, 4, 8, 13};
row = 0;
for (i = 0; i < 4; i++) {
col = cols[i];
otpp = OTPP_START_BUSY |
((OTPPOC_PROG_ENABLE_40NM << OTPP_OC_SHIFT) & OTPP_OC_MASK) |
((row << OTPP_ROW_SHIFT) & OTPP_ROW_MASK) |
((col << OTPP_COL_SHIFT) & OTPP_COL_MASK);
OTP_DBG(("%s: row = %d, col = %d, otpp = 0x%x\n",
__FUNCTION__, row, col, otpp));
W_REG(oi->osh, &cc->otpprog, otpp);
for (k = 0;
((st = R_REG(oi->osh, &cc->otpprog)) & OTPP_START_BUSY) &&
(k < OTPP_TRIES); k ++)
;
if (k >= OTPP_TRIES) {
OTP_ERR(("\n%s: BUSY stuck: st=0x%x, count=%d\n",
__FUNCTION__, st, k));
return -1;
}
}
/* wait till OTP Program mode is unlocked */
for (k = 0;
(!((st = R_REG(oi->osh, &cc->otpstatus)) & OTPS_PROGOK)) &&
(k < OTPP_TRIES); k ++)
;
OTP_MSG(("\n%s: OTP Program status: %x\n", __FUNCTION__, st));
if (k >= OTPP_TRIES) {
OTP_ERR(("\n%s: OTP Program mode is still locked, OTP is unwritable\n",
__FUNCTION__));
return -1;
}
}
OR_REG(oi->osh, &cc->otpcontrol, OTPC_PROGEN);
return 0;
}
static int
ipxotp_unwritable(otpinfo_t *oi, chipcregs_t *cc)
{
uint otpwt;
otpwt = (R_REG(oi->osh, &cc->otplayout) & OTPL_WRAP_TYPE_MASK) >> OTPL_WRAP_TYPE_SHIFT;
if (otpwt == OTPL_WRAP_TYPE_40NM) {
uint k, row, col;
uint32 otpp, st;
row = 0;
col = 0;
otpp = OTPP_START_BUSY |
((OTPPOC_PROG_DISABLE_40NM << OTPP_OC_SHIFT) & OTPP_OC_MASK) |
((row << OTPP_ROW_SHIFT) & OTPP_ROW_MASK) |
((col << OTPP_COL_SHIFT) & OTPP_COL_MASK);
OTP_DBG(("%s: row = %d, col = %d, otpp = 0x%x\n",
__FUNCTION__, row, col, otpp));
W_REG(oi->osh, &cc->otpprog, otpp);
for (k = 0;
((st = R_REG(oi->osh, &cc->otpprog)) & OTPP_START_BUSY) && (k < OTPP_TRIES);
k ++)
;
if (k >= OTPP_TRIES) {
OTP_ERR(("\n%s: BUSY stuck: st=0x%x, count=%d\n", __FUNCTION__, st, k));
return -1;
}
/* wait till OTP Program mode is unlocked */
for (k = 0;
((st = R_REG(oi->osh, &cc->otpstatus)) & OTPS_PROGOK) && (k < OTPP_TRIES);
k ++)
;
OTP_MSG(("\n%s: OTP Program status: %x\n", __FUNCTION__, st));
if (k >= OTPP_TRIES) {
OTP_ERR(("\n%s: OTP Program mode is still unlocked, OTP is writable\n",
__FUNCTION__));
return -1;
}
}
AND_REG(oi->osh, &cc->otpcontrol, ~OTPC_PROGEN);
return 0;
}
static int
ipxotp_write_bit_common(otpinfo_t *oi, chipcregs_t *cc, uint off)
{
uint k, row, col;
uint32 otpp, st;
uint otpwt;
otpwt = (R_REG(oi->osh, &cc->otplayout) & OTPL_WRAP_TYPE_MASK) >> OTPL_WRAP_TYPE_SHIFT;
row = off / oi->cols;
col = off % oi->cols;
otpp = OTPP_START_BUSY |
((1 << OTPP_VALUE_SHIFT) & OTPP_VALUE_MASK) |
((((otpwt == OTPL_WRAP_TYPE_40NM)? OTPPOC_BIT_PROG_40NM :
OTPPOC_BIT_PROG) << OTPP_OC_SHIFT) & OTPP_OC_MASK) |
((row << OTPP_ROW_SHIFT) & OTPP_ROW_MASK) |
((col << OTPP_COL_SHIFT) & OTPP_COL_MASK);
OTP_DBG(("%s: off = %d, row = %d, col = %d, otpp = 0x%x\n",
__FUNCTION__, off, row, col, otpp));
W_REG(oi->osh, &cc->otpprog, otpp);
for (k = 0;
((st = R_REG(oi->osh, &cc->otpprog)) & OTPP_START_BUSY) && (k < OTPP_TRIES);
k ++)
;
if (k >= OTPP_TRIES) {
OTP_ERR(("\n%s: BUSY stuck: st=0x%x, count=%d\n", __FUNCTION__, st, k));
return -1;
}
return 0;
}
static int
ipxotp40n_read2x(void *oh, chipcregs_t *cc, uint off)
{
otpinfo_t *oi;
oi = (otpinfo_t *)oh;
W_REG(oi->osh, &cc->otpcontrol,
(OTPC_40NM_PCOUNT_V1X << OTPC_40NM_PCOUNT_SHIFT) |
(OTPC_40NM_REGCSEL_DEF << OTPC_40NM_REGCSEL_SHIFT) |
(1 << OTPC_40NM_PROGIN_SHIFT) |
(1 << OTPC_40NM_R2X_SHIFT) |
(1 << OTPC_40NM_ODM_SHIFT) |
(1 << OTPC_40NM_DF_SHIFT) |
(OTPC_40NM_VSEL_R1X << OTPC_40NM_VSEL_SHIFT) |
(1 << OTPC_40NM_COFAIL_SHIFT));
W_REG(oi->osh, &cc->otpcontrol1,
(OTPC1_CPCSEL_DEF << OTPC1_CPCSEL_SHIFT) |
(OTPC1_TM_R1X << OTPC1_TM_SHIFT));
return ipxotp_read_bit_common(oh, cc, off);
}
static int
ipxotp40n_read1x(void *oh, chipcregs_t *cc, uint off, uint fuse)
{
otpinfo_t *oi;
oi = (otpinfo_t *)oh;
W_REG(oi->osh, &cc->otpcontrol,
(fuse << OTPC_40NM_PROGSEL_SHIFT) |
(OTPC_40NM_PCOUNT_V1X << OTPC_40NM_PCOUNT_SHIFT) |
(OTPC_40NM_REGCSEL_DEF << OTPC_40NM_REGCSEL_SHIFT) |
(1 << OTPC_40NM_PROGIN_SHIFT) |
(0 << OTPC_40NM_R2X_SHIFT) |
(1 << OTPC_40NM_ODM_SHIFT) |
(1 << OTPC_40NM_DF_SHIFT) |
(OTPC_40NM_VSEL_R1X << OTPC_40NM_VSEL_SHIFT) |
(1 << OTPC_40NM_COFAIL_SHIFT));
W_REG(oi->osh, &cc->otpcontrol1,
(OTPC1_CPCSEL_DEF << OTPC1_CPCSEL_SHIFT) |
(OTPC1_TM_R1X << OTPC1_TM_SHIFT));
return ipxotp_read_bit_common(oh, cc, off);
}
static int
ipxotp40n_verify1x(void *oh, chipcregs_t *cc, uint off, uint fuse)
{
otpinfo_t *oi;
oi = (otpinfo_t *)oh;
W_REG(oi->osh, &cc->otpcontrol,
(fuse << OTPC_40NM_PROGSEL_SHIFT) |
(OTPC_40NM_PCOUNT_V1X << OTPC_40NM_PCOUNT_SHIFT) |
(OTPC_40NM_REGCSEL_DEF << OTPC_40NM_REGCSEL_SHIFT) |
(1 << OTPC_40NM_PROGIN_SHIFT) |
(0 << OTPC_40NM_R2X_SHIFT) |
(1 << OTPC_40NM_ODM_SHIFT) |
(1 << OTPC_40NM_DF_SHIFT) |
(OTPC_40NM_VSEL_V1X << OTPC_40NM_VSEL_SHIFT) |
(1 << OTPC_40NM_COFAIL_SHIFT));
W_REG(oi->osh, &cc->otpcontrol1,
(OTPC1_CPCSEL_DEF << OTPC1_CPCSEL_SHIFT) |
(OTPC1_TM_V1X << OTPC1_TM_SHIFT));
return ipxotp_read_bit_common(oh, cc, off);
}
static int
ipxotp40n_write_fuse(otpinfo_t *oi, chipcregs_t *cc, uint off, uint fuse)
{
W_REG(oi->osh, &cc->otpcontrol,
(fuse << OTPC_40NM_PROGSEL_SHIFT) |
(OTPC_40NM_PCOUNT_WR << OTPC_40NM_PCOUNT_SHIFT) |
(OTPC_40NM_REGCSEL_DEF << OTPC_40NM_REGCSEL_SHIFT) |
(1 << OTPC_40NM_PROGIN_SHIFT) |
(0 << OTPC_40NM_R2X_SHIFT) |
(1 << OTPC_40NM_ODM_SHIFT) |
(0 << OTPC_40NM_DF_SHIFT) |
(OTPC_40NM_VSEL_WR << OTPC_40NM_VSEL_SHIFT) |
(1 << OTPC_40NM_COFAIL_SHIFT) |
OTPC_PROGEN);
W_REG(oi->osh, &cc->otpcontrol1,
(OTPC1_CPCSEL_DEF << OTPC1_CPCSEL_SHIFT) |
(OTPC1_TM_WR << OTPC1_TM_SHIFT));
return ipxotp_write_bit_common(oi, cc, off);
}
static int
ipxotp40n_write_bit(otpinfo_t *oi, chipcregs_t *cc, uint off)
{
uint32 oc_orig, oc1_orig;
uint8 i, j, err = 0;
int verr0, verr1, rerr0, rerr1, retry, val;
oc_orig = R_REG(oi->osh, &cc->otpcontrol);
oc1_orig = R_REG(oi->osh, &cc->otpcontrol1);
for (i = 0; i < OTP_FUSES_PER_BIT; i++) {
retry = 0;
for (j = 0; j < OTP_WRITE_RETRY; j++) {
/* program fuse */
ipxotp40n_write_fuse(oi, cc, off, i);
/* verify fuse */
val = ipxotp40n_verify1x(oi, cc, off, i);
if (val == 1)
break;
retry++;
}
if ((val != 1) && (j == OTP_WRITE_RETRY)) {
OTP_ERR(("ERROR: New write failed max attempts fuse:%d @ off:%d\n",
i, off));
} else if (retry > 0)
OTP_MSG(("Verify1x multi retries:%d fuse:%d @ off:%d\n",
retry, i, off));
}
/* Post screen */
verr0 = (ipxotp40n_verify1x(oi, cc, off, 0) == 1) ? TRUE : FALSE;
verr1 = (ipxotp40n_verify1x(oi, cc, off, 1) == 1) ? TRUE : FALSE;
rerr0 = (ipxotp40n_read1x(oi, cc, off, 0) == 1) ? TRUE : FALSE;
rerr1 = (ipxotp40n_read1x(oi, cc, off, 1) == 1) ? TRUE : FALSE;
if (verr0 && verr1) {
OTP_MSG(("V0:%d and V1:%d ok off:%d\n", verr0, verr1, off));
} else if (verr0 && rerr1) {
OTP_MSG(("V0:%d and R1:%d ok off:%d\n", verr0, rerr1, off));
} else if (rerr0 && verr1) {
OTP_MSG(("R0:%d and V1:%d ok off:%d\n", rerr0, verr1, off));
} else {
OTP_ERR(("Bit failed post screen v0:%d v1:%d r0:%d r1:%d off:%d\n",
verr0, verr1, rerr0, rerr1, off));
err = -1;
}
W_REG(oi->osh, &cc->otpcontrol, oc_orig);
W_REG(oi->osh, &cc->otpcontrol1, oc1_orig);
return err;
}
#ifdef OTP_DEBUG
int
otp_read1x(void *oh, uint off, uint fuse)
{
otpinfo_t *oi = (otpinfo_t *)oh;
chipcregs_t *cc;
uint idx, otpwt;
int val = 0;
idx = si_coreidx(oi->sih);
cc = si_setcoreidx(oi->sih, SI_CC_IDX);
ASSERT(cc != NULL);
otpwt = (R_REG(oi->osh, &cc->otplayout) & OTPL_WRAP_TYPE_MASK) >> OTPL_WRAP_TYPE_SHIFT;
if ((otpwt != OTPL_WRAP_TYPE_40NM) || (oi->sih->ccrev < 40))
goto exit;
val = ipxotp40n_read1x(oi, cc, off, fuse);
exit:
si_setcoreidx(oi->sih, idx);
return val;
}
int
otp_verify1x(void *oh, uint off, uint fuse)
{
otpinfo_t *oi = (otpinfo_t *)oh;
int err = 0;
chipcregs_t *cc;
uint idx, otpwt;
idx = si_coreidx(oi->sih);
cc = si_setcoreidx(oi->sih, SI_CC_IDX);
ASSERT(cc != NULL);
otpwt = (R_REG(oi->osh, &cc->otplayout) & OTPL_WRAP_TYPE_MASK) >> OTPL_WRAP_TYPE_SHIFT;
if ((otpwt != OTPL_WRAP_TYPE_40NM) || (oi->sih->ccrev < 40))
goto exit;
err = ipxotp40n_verify1x(oi, cc, off, fuse);
if (err != 1)
OTP_ERR(("v1x failed fuse:%d @ off:%d\n", fuse, off));
exit:
si_setcoreidx(oi->sih, idx);
return err;
}
/*
* Repair is to fix damaged bits; not intended to fix programming errors
* This is limited and for 4334 only nine repair entries available
*/
int
otp_repair_bit(void *oh, uint off, uint val)
{
otpinfo_t *oi = (otpinfo_t *)oh;
return ipxotp_write_rde(oi, -1, off, val);
}
int
otp_write_ones_old(void *oh, uint off, uint bits)
{
otpinfo_t *oi = (otpinfo_t *)oh;
uint idx;
chipcregs_t *cc;
uint32 i;
if (off < 0 || off + bits > oi->rows * oi->cols)
return BCME_RANGE;
idx = si_coreidx(oi->sih);
cc = si_setcoreidx(oi->sih, SI_CC_IDX);
ASSERT(cc != NULL);
W_REG(oi->osh, &cc->otpcontrol, 0);
W_REG(oi->osh, &cc->otpcontrol1, 0);
ipxotp_writable(oi, cc);
for (i = 0; i < bits; i++) {
ipxotp_write_bit_common(oi, cc, off++);
}
ipxotp_unwritable(oi, cc);
si_otp_power(oi->sih, FALSE);
si_otp_power(oi->sih, TRUE);
_ipxotp_init(oi, cc);
si_setcoreidx(oi->sih, idx);
return BCME_OK;
}
int
otp_write_ones(void *oh, uint off, uint bits)
{
otpinfo_t *oi = (otpinfo_t *)oh;
uint idx;
chipcregs_t *cc;
uint32 i;
int err;
if (off < 0 || off + bits > oi->rows * oi->cols)
return BCME_RANGE;
idx = si_coreidx(oi->sih);
cc = si_setcoreidx(oi->sih, SI_CC_IDX);
ASSERT(cc != NULL);
ipxotp_writable(oi, cc);
for (i = 0; i < bits; i++) {
err = ipxotp_write_bit(oi, cc, off);
if (err != 0) {
OTP_ERR(("%s: write bit failed: %d\n", __FUNCTION__, off));
err = ipxotp_write_rde_nopc(oi, cc,
ipxotp_check_otp_pmu_res(cc), off, 1);
if (err != 0)
OTP_ERR(("%s: repair bit failed: %d\n", __FUNCTION__, off));
else
OTP_ERR(("%s: repair bit ok: %d\n", __FUNCTION__, off));
}
off++;
}
ipxotp_unwritable(oi, cc);
si_otp_power(oi->sih, FALSE);
si_otp_power(oi->sih, TRUE);
_ipxotp_init(oi, cc);
si_setcoreidx(oi->sih, idx);
return BCME_OK;
}
#endif /* OTP_DEBUG */
static int
ipxotp_write_bit(otpinfo_t *oi, chipcregs_t *cc, uint off)
{
uint otpwt;
int status = 0;
otpwt = (R_REG(oi->osh, &cc->otplayout) & OTPL_WRAP_TYPE_MASK) >> OTPL_WRAP_TYPE_SHIFT;
if (otpwt == OTPL_WRAP_TYPE_40NM) {
/* Can damage fuse in 40nm so safeguard against reprogramming */
if (ipxotp40n_read2x(oi, cc, off) != 1) {
status = ipxotp40n_write_bit(oi, cc, off);
} else {
OTP_MSG(("Bit already programmed: %d\n", off));
}
} else {
W_REG(oi->osh, &cc->otpcontrol, 0);
W_REG(oi->osh, &cc->otpcontrol1, 0);
status = ipxotp_write_bit_common(oi, cc, off);
}
return status;
}
static int
ipxotp_write_bits(void *oh, int bn, int bits, uint8* data)
{
otpinfo_t *oi = (otpinfo_t *)oh;
uint idx;
chipcregs_t *cc;
int i, j;
uint8 temp;
int err;
if (bn < 0 || bn + bits > oi->rows * oi->cols)
return BCME_RANGE;
idx = si_coreidx(oi->sih);
cc = si_setcoreidx(oi->sih, SI_CC_IDX);
ASSERT(cc != NULL);
ipxotp_writable(oi, cc);
for (i = 0; i < bits; ) {
temp = *data++;
for (j = 0; j < 8; j++, i++) {
if (i >= bits)
break;
if (temp & 0x01)
{
if (ipxotp_write_bit(oi, cc, (uint)(i + bn)) != 0) {
OTP_ERR(("%s: write bit failed: %d\n",
__FUNCTION__, i + bn));
err = ipxotp_write_rde_nopc(oi, cc,
ipxotp_check_otp_pmu_res(cc), i + bn, 1);
if (err != 0) {
OTP_ERR(("%s: repair bit failed: %d\n",
__FUNCTION__, i + bn));
AND_REG(oi->osh, &cc->otpcontrol, ~OTPC_PROGEN);
return -1;
} else
OTP_ERR(("%s: repair bit ok: %d\n",
__FUNCTION__, i + bn));
}
}
temp >>= 1;
}
}
ipxotp_unwritable(oi, cc);
si_otp_power(oi->sih, FALSE);
si_otp_power(oi->sih, TRUE);
_ipxotp_init(oi, cc);
si_setcoreidx(oi->sih, idx);
return BCME_OK;
}
static int
ipxotp_write_lock_bit(otpinfo_t *oi, chipcregs_t *cc, uint off)
{
uint k, row, col;
uint32 otpp, st;
uint otpwt;
otpwt = (R_REG(oi->osh, &cc->otplayout) & OTPL_WRAP_TYPE_MASK) >> OTPL_WRAP_TYPE_SHIFT;
row = off / oi->cols;
col = off % oi->cols;
otpp = OTPP_START_BUSY |
((((otpwt == OTPL_WRAP_TYPE_40NM)? OTPPOC_ROW_LOCK_40NM :
OTPPOC_ROW_LOCK) << OTPP_OC_SHIFT) & OTPP_OC_MASK) |
((row << OTPP_ROW_SHIFT) & OTPP_ROW_MASK) |
((col << OTPP_COL_SHIFT) & OTPP_COL_MASK);
OTP_DBG(("%s: off = %d, row = %d, col = %d, otpp = 0x%x\n",
__FUNCTION__, off, row, col, otpp));
W_REG(oi->osh, &cc->otpprog, otpp);
for (k = 0;
((st = R_REG(oi->osh, &cc->otpprog)) & OTPP_START_BUSY) && (k < OTPP_TRIES);
k ++)
;
if (k >= OTPP_TRIES) {
OTP_ERR(("\n%s: BUSY stuck: st=0x%x, count=%d\n", __FUNCTION__, st, k));
return -1;
}
return 0;
}
static int
ipxotp_otpwb16(otpinfo_t *oi, chipcregs_t *cc, int wn, uint16 data)
{
uint base, i;
int rc = 0;
base = wn * 16;
for (i = 0; i < 16; i++) {
if (data & (1 << i)) {
rc = ipxotp_write_bit(oi, cc, base + i);
if (rc != 0) {
OTP_ERR(("%s: write bit failed:%d\n", __FUNCTION__, base + i));
rc = ipxotp_write_rde_nopc(oi, cc,
ipxotp_check_otp_pmu_res(cc), base + i, 1);
if (rc != 0) {
OTP_ERR(("%s: repair bit failed:%d\n",
__FUNCTION__, base + i));
break;
} else
OTP_ERR(("%s: repair bit ok:%d\n", __FUNCTION__, base + i));
}
}
}
return rc;
}
/* Write OTP redundancy entry:
* rde - redundancy entry index (-ve for "next")
* bit - bit offset
* val - bit value
*/
/* Check if for a particular chip OTP PMU resource is available */
static int
ipxotp_check_otp_pmu_res(chipcregs_t *cc)
{
switch (cc->chipid & 0x0000ffff) {
case BCM43131_CHIP_ID:
case BCM43217_CHIP_ID:
case BCM43227_CHIP_ID:
case BCM43228_CHIP_ID:
/* OTP PMU resource not available, hence use global rde index */
return OTP_GLOBAL_RDE_IDX;
default:
/* OTP PMU resource available, hence calculate rde index */
return -1;
}
return -1;
}
/* Assumes already writable and bypasses power-cycling */
static int
ipxotp_write_rde_nopc(void *oh, chipcregs_t *cc, int rde, uint bit, uint val)
{
otpinfo_t *oi = (otpinfo_t *)oh;
uint i, temp;
int err = BCME_OK;
#ifdef BCMDBG
if ((rde >= (int)oi->rde_cb.offsets) || (bit >= (uint)(oi->rows * oi->cols)) || (val > 1))
return BCME_RANGE;
#endif
if (rde < 0) {
for (rde = 0; rde < oi->rde_cb.offsets - 1; rde++) {
if ((oi->status & (1 << (oi->rde_cb.stat_shift + rde))) == 0)
break;
}
OTP_ERR(("%s: Auto rde index %d\n", __FUNCTION__, rde));
}
else if (rde == OTP_GLOBAL_RDE_IDX) {
/* Chips which do not have a OTP PMU res, OTP can't be pwr cycled from the drv. */
/* Hence we need to have a count of the global rde, and populate accordingly. */
/* Find the next available rde location */
while (oi->status & (1 << (oi->rde_cb.stat_shift + oi->rde_idx))) {
OTP_MSG(("%s: rde %d already in use, status 0x%08x\n", __FUNCTION__,
rde, oi->status));
oi->rde_idx++;
}
rde = oi->rde_idx++;
if (rde >= MAXNUMRDES) {
OTP_MSG(("%s: No rde location available to fix.\n", __FUNCTION__));
return BCME_ERROR;
}
}
if (oi->status & (1 << (oi->rde_cb.stat_shift + rde))) {
OTP_ERR(("%s: rde %d already in use, status 0x%08x\n", __FUNCTION__,
rde, oi->status));
return BCME_ERROR;
}
temp = ~(~0 << oi->rde_cb.width) &
((~0 << (oi->rde_cb.val_shift + 1)) | (val << oi->rde_cb.val_shift) | bit);
OTP_MSG(("%s: rde %d bit %d val %d bmp 0x%08x\n", __FUNCTION__, rde, bit, val, temp));
for (i = 0; i < oi->rde_cb.width; i ++) {
if (!(temp & (1 << i)))
continue;
if (ipxotp_write_bit(oi, cc, oi->rde_cb.offset[rde] + i) != 0)
err = BCME_ERROR;
}
/* no power-cyclying to just set status */
oi->status |= (1 << (oi->rde_cb.stat_shift + rde));
return err;
}
int
ipxotp_write_rde(void *oh, int rde, uint bit, uint val)
{
otpinfo_t *oi = (otpinfo_t *)oh;
uint idx;
chipcregs_t *cc;
int err;
idx = si_coreidx(oi->sih);
cc = si_setcoreidx(oi->sih, SI_CC_IDX);
ASSERT(cc != NULL);
/* Enable Write */
ipxotp_writable(oi, cc);
err = ipxotp_write_rde_nopc(oh, cc, rde, bit, val);
/* Disable Write */
ipxotp_unwritable(oi, cc);
si_otp_power(oi->sih, FALSE);
si_otp_power(oi->sih, TRUE);
_ipxotp_init(oi, cc);
si_setcoreidx(oi->sih, idx);
return err;
}
/* Set up redundancy entries for the specified bits */
static int
ipxotp_fix_word16(void *oh, uint wn, uint16 mask, uint16 val, chipcregs_t *cc)
{
otpinfo_t *oi;
uint bit;
int rc = 0;
oi = (otpinfo_t *)oh;
ASSERT(oi != NULL);
ASSERT(wn < oi->wsize);
for (bit = wn * 16; mask; bit++, mask >>= 1, val >>= 1) {
if (mask & 1) {
if ((rc = ipxotp_write_rde(oi, ipxotp_check_otp_pmu_res(cc), bit, val & 1)))
break;
}
}
return rc;
}
static int
ipxotp_check_word16(void *oh, chipcregs_t *cc, uint wn, uint16 val)
{
otpinfo_t *oi = (otpinfo_t *)oh;
uint16 word = ipxotp_otpr(oi, cc, wn);
int rc = 0;
if ((word ^= val)) {
OTP_MSG(("%s: word %d is 0x%04x, wanted 0x%04x, fixing...\n",
__FUNCTION__, wn, (word ^ val), val));
if ((rc = ipxotp_fix_word16(oi, wn, word, val, cc))) {
OTP_ERR(("FAILED, ipxotp_fix_word16 returns %d\n", rc));
/* Fatal error, unfixable. MFGC will have to fail. Board
* needs to be discarded!!
*/
return BCME_NORESOURCE;
}
}
return BCME_OK;
}
/* expects the caller to disable interrupts before calling this routine */
static int
ipxotp_write_region(void *oh, int region, uint16 *data, uint wlen)
{
otpinfo_t *oi = (otpinfo_t *)oh;
uint idx;
chipcregs_t *cc;
uint base, i;
int otpgu_bit_base;
bool rewrite = FALSE;
int rc = 0;
#if defined(DONGLEBUILD)
uint16 *origdata = NULL;
#endif /* DONGLEBUILD */
otpgu_bit_base = oi->otpgu_base * 16;
/* Validate region selection */
switch (region) {
case OTP_HW_RGN:
if (wlen > (uint)(oi->hwlim - oi->hwbase)) {
OTP_ERR(("%s: wlen %u exceeds OTP h/w region limit %u\n",
__FUNCTION__, wlen, oi->hwlim - oi->hwbase));
return BCME_BUFTOOLONG;
}
rewrite = !!(oi->status & OTPS_GUP_HW);
base = oi->hwbase;
break;
case OTP_SW_RGN:
if (wlen > (uint)(oi->swlim - oi->swbase)) {
OTP_ERR(("%s: wlen %u exceeds OTP s/w region limit %u\n",
__FUNCTION__, wlen, oi->swlim - oi->swbase));
return BCME_BUFTOOLONG;
}
rewrite = !!(oi->status & OTPS_GUP_SW);
base = oi->swbase;
break;
case OTP_CI_RGN:
if (oi->status & OTPS_GUP_CI) {
OTP_ERR(("%s: chipid region has been programmed\n", __FUNCTION__));
return BCME_ERROR;
}
if (wlen > OTPGU_CI_SZ) {
OTP_ERR(("%s: wlen %u exceeds OTP ci region limit %u\n",
__FUNCTION__, wlen, OTPGU_CI_SZ));
return BCME_BUFTOOLONG;
}
if ((wlen == OTPGU_CI_SZ) && (data[OTPGU_CI_SZ - 1] & OTPGU_P_MSK) != 0) {
OTP_ERR(("%s: subregion programmed bits not zero\n", __FUNCTION__));
return BCME_BADARG;
}
base = oi->otpgu_base + OTPGU_CI_OFF;
break;
case OTP_FUSE_RGN:
if (oi->status & OTPS_GUP_FUSE) {
OTP_ERR(("%s: fuse region has been programmed\n", __FUNCTION__));
return BCME_ERROR;
}
if (wlen > (uint)(oi->flim - oi->fbase)) {
OTP_ERR(("%s: wlen %u exceeds OTP ci region limit %u\n",
__FUNCTION__, wlen, oi->flim - oi->fbase));
return BCME_BUFTOOLONG;
}
base = oi->flim - wlen;
break;
default:
OTP_ERR(("%s: writing region %d is not supported\n", __FUNCTION__, region));
return BCME_ERROR;
}
idx = si_coreidx(oi->sih);
cc = si_setcoreidx(oi->sih, SI_CC_IDX);
ASSERT(cc != NULL);
#if defined(DONGLEBUILD)
/* Check for conflict; Since some bits might be programmed at ATE time, we need to
* avoid redundancy by clearing already written bits, but copy original for verification.
*/
if ((origdata = (uint16*)MALLOC(oi->osh, wlen * 2)) == NULL) {
rc = BCME_NOMEM;
goto exit;
}
for (i = 0; i < wlen; i++) {
origdata[i] = data[i];
data[i] = ipxotp_otpr(oi, cc, base + i);
if (data[i] & ~origdata[i]) {
OTP_ERR(("%s: %s region: word %d incompatible (0x%04x->0x%04x)\n",
__FUNCTION__, HWSW_RGN(region), i, data[i], origdata[i]));
rc = BCME_BADARG;
goto exit;
}
data[i] ^= origdata[i];
}
#endif /* DONGLEBUILD */
OTP_MSG(("%s: writing new bits in %s region\n", __FUNCTION__, HWSW_RGN(region)));
/* Enable Write */
ipxotp_writable(oi, cc);
/* Write the data */
for (i = 0; i < wlen; i++) {
rc = ipxotp_otpwb16(oi, cc, base + i, data[i]);
if (rc != 0) {
OTP_ERR(("%s: otpwb16 failed: %d 0x%x\n", __FUNCTION__, base + i, data[i]));
ipxotp_unwritable(oi, cc);
goto exit;
}
}
/* One time set region flag: Update boundary/flag in memory and in OTP */
if (!rewrite) {
switch (region) {
case OTP_HW_RGN:
/* OTP unification */
if (oi->buotp) {
ipxotp_otpwb16(oi, cc, oi->otpgu_base + OTPGU_HSB_OFF,
((base + oi->usbmanfid_offset) * 16));
ipxotp_write_bit(oi, cc, otpgu_bit_base + OTPGU_SWP_OFF);
} else
ipxotp_otpwb16(oi, cc, oi->otpgu_base + OTPGU_HSB_OFF,
(base + i) * 16);
ipxotp_write_bit(oi, cc, otpgu_bit_base + OTPGU_HWP_OFF);
if (CHIPID(oi->sih->chip) == BCM4336_CHIP_ID ||
CHIPID(oi->sih->chip) == BCM43362_CHIP_ID ||
CHIPID(oi->sih->chip) == BCM4324_CHIP_ID)
ipxotp_write_bit(oi, cc, otpgu_bit_base + OTPGU_NEWCISFORMAT_OFF);
break;
case OTP_SW_RGN:
/* Write HW region limit as well */
ipxotp_otpwb16(oi, cc, oi->otpgu_base + OTPGU_HSB_OFF, base * 16);
/* write max swlim(covert to bits) to the sw/fuse boundary */
ipxotp_otpwb16(oi, cc, oi->otpgu_base + OTPGU_SFB_OFF, oi->swlim * 16);
ipxotp_write_bit(oi, cc, otpgu_bit_base + OTPGU_SWP_OFF);
break;
case OTP_CI_RGN:
ipxotp_write_bit(oi, cc, otpgu_bit_base + OTPGU_CIP_OFF);
/* Also set the OTPGU_CIP_MSK bit in the input so verification
* doesn't fail
*/
if (wlen >= OTPGU_CI_SZ)
data[OTPGU_CI_SZ - 1] |= OTPGU_CIP_MSK;
break;
case OTP_FUSE_RGN:
ipxotp_otpwb16(oi, cc, oi->otpgu_base + OTPGU_SFB_OFF, base * 16);
ipxotp_write_bit(oi, cc, otpgu_bit_base + OTPGU_FUSEP_OFF);
break;
}
}
/* Disable Write */
ipxotp_unwritable(oi, cc);
/* Sync region info by retrieving them again (use PMU bit to power cycle OTP) */
si_otp_power(oi->sih, FALSE);
si_otp_power(oi->sih, TRUE);
/* Check and fix for region size and region programmed bits */
if (!rewrite) {
uint16 boundary_off = 0, boundary_val = 0;
uint16 programmed_off = 0;
uint16 bit = 0;
switch (region) {
case OTP_HW_RGN:
boundary_off = OTPGU_HSB_OFF;
/* OTP unification */
if (oi->buotp) {
boundary_val = ((base + oi->usbmanfid_offset) * 16);
} else
boundary_val = (base + i) * 16;
programmed_off = OTPGU_HWP_OFF;
break;
case OTP_SW_RGN:
/* Also write 0 to HW region boundary */
if ((rc = ipxotp_check_word16(oi, cc, oi->otpgu_base + OTPGU_HSB_OFF,
base * 16)))
goto exit;
boundary_off = OTPGU_SFB_OFF;
boundary_val = oi->swlim * 16;
programmed_off = OTPGU_SWP_OFF;
break;
case OTP_CI_RGN:
/* No CI region boundary */
programmed_off = OTPGU_CIP_OFF;
break;
case OTP_FUSE_RGN:
boundary_off = OTPGU_SFB_OFF;
boundary_val = base * 16;
programmed_off = OTPGU_FUSEP_OFF;
break;
}
/* Do the actual checking and return BCME_NORESOURCE if we cannot fix */
if ((region != OTP_CI_RGN) &&
(rc = ipxotp_check_word16(oi, cc, oi->otpgu_base + boundary_off,
boundary_val))) {
goto exit;
}
if ((bit = ipxotp_read_bit(oh, cc, otpgu_bit_base + programmed_off)) == 0xffff) {
OTP_ERR(("\n%s: FAILED bit %d reads %d\n", __FUNCTION__, otpgu_bit_base +
programmed_off, bit));
goto exit;
} else if (bit == 0) { /* error detected, fix it */
OTP_ERR(("\n%s: FAILED bit %d reads %d, fixing\n", __FUNCTION__,
otpgu_bit_base + programmed_off, bit));
if ((rc = ipxotp_write_rde(oi, ipxotp_check_otp_pmu_res(cc),
otpgu_bit_base + programmed_off, 1))) {
OTP_ERR(("\n%s: cannot fix, ipxotp_write_rde returns %d\n",
__FUNCTION__, rc));
goto exit;
}
}
}
/* Update status, apply WAR */
_ipxotp_init(oi, cc);
#if defined(DONGLEBUILD)
/* Recover original data... */
if (origdata)
bcopy(origdata, data, wlen * 2);
#endif /* DONGLEBUILD */
/* ...Check again so we can verify and fix where possible */
for (i = 0; i < wlen; i++) {
if ((rc = ipxotp_check_word16(oi, cc, base + i, data[i])))
goto exit;
}
exit:
#if defined(DONGLEBUILD)
if (origdata)
MFREE(oi->osh, origdata, wlen * 2);
#endif /* DONGLEBUILD */
si_setcoreidx(oi->sih, idx);
return rc;
}
static int
ipxotp_write_word(void *oh, uint wn, uint16 data)
{
otpinfo_t *oi = (otpinfo_t *)oh;
int rc = 0;
uint16 origdata;
uint idx;
chipcregs_t *cc;
idx = si_coreidx(oi->sih);
cc = si_setcoreidx(oi->sih, SI_CC_IDX);
ASSERT(cc != NULL);
/* Check for conflict */
origdata = data;
data = ipxotp_otpr(oi, cc, wn);
if (data & ~origdata) {
OTP_ERR(("%s: word %d incompatible (0x%04x->0x%04x)\n",
__FUNCTION__, wn, data, origdata));
rc = BCME_BADARG;
goto exit;
}
data ^= origdata;
/* Enable Write */
ipxotp_writable(oi, cc);
rc = ipxotp_otpwb16(oi, cc, wn, data);
/* Disable Write */
ipxotp_unwritable(oi, cc);
data = origdata;
if ((rc = ipxotp_check_word16(oi, cc, wn, data)))
goto exit;
exit:
si_setcoreidx(oi->sih, idx);
return rc;
}
static int
ipxotp_cis_append_region(si_t *sih, int region, char *vars, int count)
{
uint8 *cis;
osl_t *osh;
uint sz = OTP_SZ_MAX/2; /* size in words */
int rc = 0;
bool newchip = FALSE;
uint overwrite = 0;
ASSERT(region == OTP_HW_RGN || region == OTP_SW_RGN);
osh = si_osh(sih);
if ((cis = MALLOC(osh, OTP_SZ_MAX)) == NULL) {
return BCME_ERROR;
}
bzero(cis, OTP_SZ_MAX);
rc = otp_read_region(sih, region, (uint16 *)cis, &sz);
newchip = (rc == BCME_NOTFOUND) ? TRUE : FALSE;
if ((rc != 0) && (rc != BCME_NOTFOUND)) {
return BCME_ERROR;
}
rc = 0;
/* zero count for read, non-zero count for write */
if (count) {
int i = 0, newlen = 0;
if (newchip) {
int termw_len = 0; /* length of termination word */
/* convert halfwords to bytes offset */
newlen = sz * 2;
if ((CHIPID(sih->chip) == BCM4322_CHIP_ID) ||
(CHIPID(sih->chip) == BCM43231_CHIP_ID) ||
(CHIPID(sih->chip) == BCM4315_CHIP_ID) ||
(CHIPID(sih->chip) == BCM4319_CHIP_ID)) {
/* bootloader WAR, refer to above twiki link */
cis[newlen-1] = 0x00;
cis[newlen-2] = 0xff;
cis[newlen-3] = 0x00;
cis[newlen-4] = 0xff;
cis[newlen-5] = 0xff;
cis[newlen-6] = 0x1;
cis[newlen-7] = 0x2;
termw_len = 7;
} else {
cis[newlen-1] = 0xff;
cis[newlen-2] = 0xff;
termw_len = 2;
}
if (count >= newlen - termw_len) {
OTP_MSG(("OTP left %x bytes; buffer %x bytes\n", newlen, count));
rc = BCME_BUFTOOLONG;
}
} else {
int end = 0;
if (region == OTP_SW_RGN) {
/* Walk through the leading zeros (could be 0 or 8 bytes for now) */
for (i = 0; i < (int)sz*2; i++)
if (cis[i] != 0)
break;
} else {
/* move pass the hardware header */
if (sih->ccrev >= 36) {
uint32 otp_layout;
otp_layout = si_corereg(sih, SI_CC_IDX,
OFFSETOF(chipcregs_t, otplayout), 0, 0);
if (otp_layout & OTP_CISFORMAT_NEW) {
i += 4; /* new sdio header format, 2 half words */
} else {
i += 8; /* old sdio header format */
}
} else {
return BCME_ERROR; /* old chip, not suppported */
}
}
/* Find the place to append */
for (; i < (int)sz*2; i++) {
int j;
if (cis[i] == 0)
break;
/* If the tuple exist, check if it can be overwritten */
if (cis[i + 2] == vars[2]) {
if (cis[i+1] == vars[1]) {
/* found, check if it is compiatable for fix */
for (j = 0; j < cis[i+1] + 2; j++) {
if ((cis[i+j] ^ vars[j]) & cis[i+j]) {
break;
}
}
if (j == cis[i+1] + 2) {
overwrite = i;
}
}
}
i += ((int)cis[i+1] + 1);
}
for (end = i; end < (int)sz*2; end++) {
if (cis[end] != 0)
break;
}
if (overwrite)
i = overwrite;
newlen = i + count;
if (newlen & 1) /* make it even-sized buffer */
newlen++;
if (newlen >= (end - 1)) {
OTP_MSG(("OTP left %x bytes; buffer %x bytes\n", end-i, count));
rc = BCME_BUFTOOLONG;
}
}
/* copy the buffer */
memcpy(&cis[i], vars, count);
#ifdef BCMNVRAMW
/* Write the buffer back */
if (!rc)
rc = otp_write_region(sih, region, (uint16*)cis, newlen/2);
/* Print the buffer */
OTP_MSG(("Buffer of size %d bytes to write:\n", newlen));
for (i = 0; i < newlen; i++) {
OTP_DBG(("%02x ", cis[i] & 0xff));
if ((i % 16) == 15) {
OTP_DBG(("\n"));
}
}
OTP_MSG(("\n"));
#endif /* BCMNVRAMW */
}
if (cis)
MFREE(osh, cis, OTP_SZ_MAX);
return (rc);
}
/* No need to lock for IPXOTP */
static int
ipxotp_lock(void *oh)
{
uint idx;
chipcregs_t *cc;
otpinfo_t *oi = (otpinfo_t *)oh;
int err = 0, rc = 0;
idx = si_coreidx(oi->sih);
cc = si_setcoreidx(oi->sih, SI_CC_IDX);
ASSERT(cc != NULL);
/* Enable Write */
ipxotp_writable(oi, cc);
err = ipxotp_write_lock_bit(oi, cc, OTP_LOCK_ROW1_LOC_OFF);
if (err) {
OTP_ERR(("fail to lock ROW1\n"));
rc = -1;
}
err = ipxotp_write_lock_bit(oi, cc, OTP_LOCK_ROW2_LOC_OFF);
if (err) {
OTP_ERR(("fail to lock ROW2\n"));
rc = -2;
}
err = ipxotp_write_lock_bit(oi, cc, OTP_LOCK_RD_LOC_OFF);
if (err) {
OTP_ERR(("fail to lock RD\n"));
rc = -3;
}
err = ipxotp_write_lock_bit(oi, cc, OTP_LOCK_GU_LOC_OFF);
if (err) {
OTP_ERR(("fail to lock GU\n"));
rc = -4;
}
/* Disable Write */
ipxotp_unwritable(oi, cc);
/* Sync region info by retrieving them again (use PMU bit to power cycle OTP) */
si_otp_power(oi->sih, FALSE);
si_otp_power(oi->sih, TRUE);
/* Update status, apply WAR */
_ipxotp_init(oi, cc);
si_setcoreidx(oi->sih, idx);
return rc;
}
static int
ipxotp_nvwrite(void *oh, uint16 *data, uint wlen)
{
return -1;
}
#endif /* BCMNVRAMW */
#if defined(WLTEST) && !defined(BCMROMBUILD)
static uint16
ipxotp_otprb16(void *oh, chipcregs_t *cc, uint wn)
{
uint base, i;
uint16 val;
uint16 bit;
base = wn * 16;
val = 0;
for (i = 0; i < 16; i++) {
if ((bit = ipxotp_read_bit(oh, cc, base + i)) == 0xffff)
break;
val = val | (bit << i);
}
if (i < 16)
val = 0xffff;
return val;
}
static int
ipxotp_dump(void *oh, int arg, char *buf, uint size)
{
otpinfo_t *oi = (otpinfo_t *)oh;
chipcregs_t *cc;
uint idx, i, count;
uint16 val;
struct bcmstrbuf b;
idx = si_coreidx(oi->sih);
cc = si_setcoreidx(oi->sih, SI_CC_IDX);
ASSERT(cc != NULL);
count = ipxotp_size(oh);
bcm_binit(&b, buf, size);
for (i = 0; i < count / 2; i++) {
if (!(i % 4))
bcm_bprintf(&b, "\n0x%04x:", 2 * i);
if (arg == 0)
val = ipxotp_otpr(oh, cc, i);
else
val = ipxotp_otprb16(oi, cc, i);
bcm_bprintf(&b, " 0x%04x", val);
}
bcm_bprintf(&b, "\n");
si_setcoreidx(oi->sih, idx);
return ((int)(b.buf - b.origbuf));
}
#endif
static otp_fn_t ipxotp_fn = {
(otp_size_t)ipxotp_size,
(otp_read_bit_t)ipxotp_read_bit,
(otp_dump_t)NULL, /* Assigned in otp_init */
(otp_status_t)ipxotp_status,
(otp_init_t)ipxotp_init,
(otp_read_region_t)ipxotp_read_region,
(otp_nvread_t)ipxotp_nvread,
#ifdef BCMNVRAMW
(otp_write_region_t)ipxotp_write_region,
(otp_cis_append_region_t)ipxotp_cis_append_region,
(otp_lock_t)ipxotp_lock,
(otp_nvwrite_t)ipxotp_nvwrite,
(otp_write_word_t)ipxotp_write_word,
#else /* BCMNVRAMW */
(otp_write_region_t)NULL,
(otp_cis_append_region_t)NULL,
(otp_lock_t)NULL,
(otp_nvwrite_t)NULL,
(otp_write_word_t)NULL,
#endif /* BCMNVRAMW */
(otp_read_word_t)ipxotp_read_word,
#if defined(BCMNVRAMW)
(otp_write_bits_t)ipxotp_write_bits
#endif
};
#endif /* BCMIPXOTP */
/*
* HND OTP Code
*
* Exported functions:
* hndotp_status()
* hndotp_size()
* hndotp_init()
* hndotp_read_bit()
* hndotp_read_region()
* hndotp_read_word()
* hndotp_nvread()
* hndotp_write_region()
* hndotp_cis_append_region()
* hndotp_lock()
* hndotp_nvwrite()
* hndotp_dump()
*
* HND internal functions:
* hndotp_otpr()
* hndotp_otproff()
* hndotp_write_bit()
* hndotp_write_word()
* hndotp_valid_rce()
* hndotp_write_rce()
* hndotp_write_row()
* hndotp_otprb16()
*
*/
#ifdef BCMHNDOTP
/* Fields in otpstatus */
#define OTPS_PROGFAIL 0x80000000
#define OTPS_PROTECT 0x00000007
#define OTPS_HW_PROTECT 0x00000001
#define OTPS_SW_PROTECT 0x00000002
#define OTPS_CID_PROTECT 0x00000004
#define OTPS_RCEV_MSK 0x00003f00
#define OTPS_RCEV_SHIFT 8
/* Fields in the otpcontrol register */
#define OTPC_RECWAIT 0xff000000
#define OTPC_PROGWAIT 0x00ffff00
#define OTPC_PRW_SHIFT 8
#define OTPC_MAXFAIL 0x00000038
#define OTPC_VSEL 0x00000006
#define OTPC_SELVL 0x00000001
/* OTP regions (Word offsets from otp size) */
#define OTP_SWLIM_OFF (-4)
#define OTP_CIDBASE_OFF 0
#define OTP_CIDLIM_OFF 4
/* Predefined OTP words (Word offset from otp size) */
#define OTP_BOUNDARY_OFF (-4)
#define OTP_HWSIGN_OFF (-3)
#define OTP_SWSIGN_OFF (-2)
#define OTP_CIDSIGN_OFF (-1)
#define OTP_CID_OFF 0
#define OTP_PKG_OFF 1
#define OTP_FID_OFF 2
#define OTP_RSV_OFF 3
#define OTP_LIM_OFF 4
#define OTP_RD_OFF 4 /* Redundancy row starts here */
#define OTP_RC0_OFF 28 /* Redundancy control word 1 */
#define OTP_RC1_OFF 32 /* Redundancy control word 2 */
#define OTP_RC_LIM_OFF 36 /* Redundancy control word end */
#define OTP_HW_REGION OTPS_HW_PROTECT
#define OTP_SW_REGION OTPS_SW_PROTECT
#define OTP_CID_REGION OTPS_CID_PROTECT
#if OTP_HW_REGION != OTP_HW_RGN
#error "incompatible OTP_HW_RGN"
#endif
#if OTP_SW_REGION != OTP_SW_RGN
#error "incompatible OTP_SW_RGN"
#endif
#if OTP_CID_REGION != OTP_CI_RGN
#error "incompatible OTP_CI_RGN"
#endif
/* Redundancy entry definitions */
#define OTP_RCE_ROW_SZ 6
#define OTP_RCE_SIGN_MASK 0x7fff
#define OTP_RCE_ROW_MASK 0x3f
#define OTP_RCE_BITS 21
#define OTP_RCE_SIGN_SZ 15
#define OTP_RCE_BIT0 1
#define OTP_WPR 4
#define OTP_SIGNATURE 0x578a
#define OTP_MAGIC 0x4e56
static int
hndotp_status(void *oh)
{
otpinfo_t *oi = (otpinfo_t *)oh;
return ((int)(oi->hwprot | oi->signvalid));
}
static int
hndotp_size(void *oh)
{
otpinfo_t *oi = (otpinfo_t *)oh;
return ((int)(oi->size));
}
static uint16
hndotp_otpr(void *oh, chipcregs_t *cc, uint wn)
{
otpinfo_t *oi = (otpinfo_t *)oh;
osl_t *osh;
volatile uint16 *ptr;
ASSERT(wn < ((oi->size / 2) + OTP_RC_LIM_OFF));
ASSERT(cc != NULL);
osh = si_osh(oi->sih);
ptr = (volatile uint16 *)((volatile char *)cc + CC_SROM_OTP);
return (R_REG(osh, &ptr[wn]));
}
static uint16
hndotp_otproff(void *oh, chipcregs_t *cc, int woff)
{
otpinfo_t *oi = (otpinfo_t *)oh;
osl_t *osh;
volatile uint16 *ptr;
ASSERT(woff >= (-((int)oi->size / 2)));
ASSERT(woff < OTP_LIM_OFF);
ASSERT(cc != NULL);
osh = si_osh(oi->sih);
ptr = (volatile uint16 *)((volatile char *)cc + CC_SROM_OTP);
return (R_REG(osh, &ptr[(oi->size / 2) + woff]));
}
static uint16
hndotp_read_bit(void *oh, chipcregs_t *cc, uint idx)
{
otpinfo_t *oi = (otpinfo_t *)oh;
uint k, row, col;
uint32 otpp, st;
osl_t *osh;
osh = si_osh(oi->sih);
row = idx / 65;
col = idx % 65;
otpp = OTPP_START_BUSY | OTPP_READ |
((row << OTPP_ROW_SHIFT) & OTPP_ROW_MASK) |
(col & OTPP_COL_MASK);
OTP_DBG(("%s: idx = %d, row = %d, col = %d, otpp = 0x%x", __FUNCTION__,
idx, row, col, otpp));
W_REG(osh, &cc->otpprog, otpp);
st = R_REG(osh, &cc->otpprog);
for (k = 0; ((st & OTPP_START_BUSY) == OTPP_START_BUSY) && (k < OTPP_TRIES); k++)
st = R_REG(osh, &cc->otpprog);
if (k >= OTPP_TRIES) {
OTP_ERR(("\n%s: BUSY stuck: st=0x%x, count=%d\n", __FUNCTION__, st, k));
return 0xffff;
}
if (st & OTPP_READERR) {
OTP_ERR(("\n%s: Could not read OTP bit %d\n", __FUNCTION__, idx));
return 0xffff;
}
st = (st & OTPP_VALUE_MASK) >> OTPP_VALUE_SHIFT;
OTP_DBG((" => %d\n", st));
return (uint16)st;
}
static void *
BCMNMIATTACHFN(hndotp_init)(si_t *sih)
{
uint idx;
chipcregs_t *cc;
otpinfo_t *oi;
uint32 cap = 0, clkdiv, otpdiv = 0;
void *ret = NULL;
osl_t *osh;
OTP_MSG(("%s: Use HND OTP controller\n", __FUNCTION__));
oi = get_otpinfo();
idx = si_coreidx(sih);
osh = si_osh(oi->sih);
/* Check for otp */
if ((cc = si_setcoreidx(sih, SI_CC_IDX)) != NULL) {
cap = R_REG(osh, &cc->capabilities);
if ((cap & CC_CAP_OTPSIZE) == 0) {
/* Nothing there */
goto out;
}
/* As of right now, support only 4320a2, 4311a1 and 4312 */
ASSERT((oi->ccrev == 12) || (oi->ccrev == 17) || (oi->ccrev == 22));
if (!((oi->ccrev == 12) || (oi->ccrev == 17) || (oi->ccrev == 22)))
return NULL;
/* Read the OTP byte size. chipcommon rev >= 18 has RCE so the size is
* 8 row (64 bytes) smaller
*/
oi->size = 1 << (((cap & CC_CAP_OTPSIZE) >> CC_CAP_OTPSIZE_SHIFT)
+ CC_CAP_OTPSIZE_BASE);
if (oi->ccrev >= 18) {
oi->size -= ((OTP_RC0_OFF - OTP_BOUNDARY_OFF) * 2);
} else {
OTP_ERR(("Negative otp size, shouldn't happen for programmed chip."));
oi->size = 0;
}
oi->hwprot = (int)(R_REG(osh, &cc->otpstatus) & OTPS_PROTECT);
oi->boundary = -1;
/* Check the region signature */
if (hndotp_otproff(oi, cc, OTP_HWSIGN_OFF) == OTP_SIGNATURE) {
oi->signvalid |= OTP_HW_REGION;
oi->boundary = hndotp_otproff(oi, cc, OTP_BOUNDARY_OFF);
}
if (hndotp_otproff(oi, cc, OTP_SWSIGN_OFF) == OTP_SIGNATURE)
oi->signvalid |= OTP_SW_REGION;
if (hndotp_otproff(oi, cc, OTP_CIDSIGN_OFF) == OTP_SIGNATURE)
oi->signvalid |= OTP_CID_REGION;
/* Set OTP clkdiv for stability */
if (oi->ccrev == 22)
otpdiv = 12;
if (otpdiv) {
clkdiv = R_REG(osh, &cc->clkdiv);
clkdiv = (clkdiv & ~CLKD_OTP) | (otpdiv << CLKD_OTP_SHIFT);
W_REG(osh, &cc->clkdiv, clkdiv);
OTP_MSG(("%s: set clkdiv to %x\n", __FUNCTION__, clkdiv));
}
OSL_DELAY(10);
ret = (void *)oi;
}
OTP_MSG(("%s: ccrev %d\tsize %d bytes\thwprot %x\tsignvalid %x\tboundary %x\n",
__FUNCTION__, oi->ccrev, oi->size, oi->hwprot, oi->signvalid,
oi->boundary));
out: /* All done */
si_setcoreidx(sih, idx);
return ret;
}
static int
hndotp_read_region(void *oh, int region, uint16 *data, uint *wlen)
{
otpinfo_t *oi = (otpinfo_t *)oh;
uint32 idx, st;
chipcregs_t *cc;
int i;
/* Only support HW region (no active chips use HND OTP SW region) */
ASSERT(region == OTP_HW_REGION);
OTP_MSG(("%s: region %x wlen %d\n", __FUNCTION__, region, *wlen));
/* Region empty? */
st = oi->hwprot | oi-> signvalid;
if ((st & region) == 0)
return BCME_NOTFOUND;
*wlen = ((int)*wlen < oi->boundary/2) ? *wlen : (uint)oi->boundary/2;
idx = si_coreidx(oi->sih);
cc = si_setcoreidx(oi->sih, SI_CC_IDX);
ASSERT(cc != NULL);
for (i = 0; i < (int)*wlen; i++)
data[i] = hndotp_otpr(oh, cc, i);
si_setcoreidx(oi->sih, idx);
return 0;
}
static int
hndotp_read_word(void *oh, uint wn, uint16 *data)
{
otpinfo_t *oi = (otpinfo_t *)oh;
uint32 idx;
chipcregs_t *cc;
idx = si_coreidx(oi->sih);
cc = si_setcoreidx(oi->sih, SI_CC_IDX);
ASSERT(cc != NULL);
*data = hndotp_otpr(oh, cc, wn);
si_setcoreidx(oi->sih, idx);
return 0;
}
static int
hndotp_nvread(void *oh, char *data, uint *len)
{
int rc = 0;
otpinfo_t *oi = (otpinfo_t *)oh;
uint32 base, bound, lim = 0, st;
int i, chunk, gchunks, tsz = 0;
uint32 idx;
chipcregs_t *cc;
uint offset;
uint16 *rawotp = NULL;
/* save the orig core */
idx = si_coreidx(oi->sih);
cc = si_setcoreidx(oi->sih, SI_CC_IDX);
ASSERT(cc != NULL);
st = hndotp_status(oh);
if (!(st & (OTP_HW_REGION | OTP_SW_REGION))) {
OTP_ERR(("OTP not programmed\n"));
rc = -1;
goto out;
}
/* Read the whole otp so we can easily manipulate it */
lim = hndotp_size(oh);
if (lim == 0) {
OTP_ERR(("OTP size is 0\n"));
rc = -1;
goto out;
}
if ((rawotp = MALLOC(si_osh(oi->sih), lim)) == NULL) {
OTP_ERR(("Out of memory for rawotp\n"));
rc = -2;
goto out;
}
for (i = 0; i < (int)(lim / 2); i++)
rawotp[i] = hndotp_otpr(oh, cc, i);
if ((st & OTP_HW_REGION) == 0) {
OTP_ERR(("otp: hw region not written (0x%x)\n", st));
/* This could be a programming failure in the first
* chunk followed by one or more good chunks
*/
for (i = 0; i < (int)(lim / 2); i++)
if (rawotp[i] == OTP_MAGIC)
break;
if (i < (int)(lim / 2)) {
base = i;
bound = (i * 2) + rawotp[i + 1];
OTP_MSG(("otp: trying chunk at 0x%x-0x%x\n", i * 2, bound));
} else {
OTP_MSG(("otp: unprogrammed\n"));
rc = -3;
goto out;
}
} else {
bound = rawotp[(lim / 2) + OTP_BOUNDARY_OFF];
/* There are two cases: 1) The whole otp is used as nvram
* and 2) There is a hardware header followed by nvram.
*/
if (rawotp[0] == OTP_MAGIC) {
base = 0;
if (bound != rawotp[1])
OTP_MSG(("otp: Bound 0x%x != chunk0 len 0x%x\n", bound,
rawotp[1]));
} else
base = bound;
}
/* Find and copy the data */
chunk = 0;
gchunks = 0;
i = base / 2;
offset = 0;
while ((i < (int)(lim / 2)) && (rawotp[i] == OTP_MAGIC)) {
int dsz, rsz = rawotp[i + 1];
if (((i * 2) + rsz) >= (int)lim) {
OTP_MSG((" bad chunk size, chunk %d, base 0x%x, size 0x%x\n",
chunk, i * 2, rsz));
/* Bad length, try to find another chunk anyway */
rsz = 6;
}
if (hndcrc16((uint8 *)&rawotp[i], rsz,
CRC16_INIT_VALUE) == CRC16_GOOD_VALUE) {
/* Good crc, copy the vars */
OTP_MSG((" good chunk %d, base 0x%x, size 0x%x\n",
chunk, i * 2, rsz));
gchunks++;
dsz = rsz - 6;
tsz += dsz;
if (offset + dsz >= *len) {
OTP_MSG(("Out of memory for otp\n"));
goto out;
}
bcopy((char *)&rawotp[i + 2], &data[offset], dsz);
offset += dsz;
/* Remove extra null characters at the end */
while (offset > 1 &&
data[offset - 1] == 0 && data[offset - 2] == 0)
offset --;
i += rsz / 2;
} else {
/* bad length or crc didn't check, try to find the next set */
OTP_MSG((" chunk %d @ 0x%x size 0x%x: bad crc, ",
chunk, i * 2, rsz));
if (rawotp[i + (rsz / 2)] == OTP_MAGIC) {
/* Assume length is good */
i += rsz / 2;
} else {
while (++i < (int)(lim / 2))
if (rawotp[i] == OTP_MAGIC)
break;
}
if (i < (int)(lim / 2))
OTP_MSG(("trying next base 0x%x\n", i * 2));
else
OTP_MSG(("no more chunks\n"));
}
chunk++;
}
OTP_MSG((" otp size = %d, boundary = 0x%x, nv base = 0x%x\n", lim, bound, base));
if (tsz != 0) {
OTP_MSG((" Found %d bytes in %d good chunks out of %d\n", tsz, gchunks, chunk));
} else {
OTP_MSG((" No good chunks found out of %d\n", chunk));
}
*len = offset;
out:
if (rawotp)
MFREE(si_osh(oi->sih), rawotp, lim);
si_setcoreidx(oi->sih, idx);
return rc;
}
#ifdef BCMNVRAMW
#if defined(BCMDBG) || defined(WLTEST)
static uint st_n, st_s, st_hwm, pp_hwm;
#ifdef OTP_FORCEFAIL
static uint forcefail_bitcount = 0;
#endif /* OTP_FORCEFAIL */
#endif /* BCMDBG || WLTEST */
static int
hndotp_write_bit(void *oh, chipcregs_t *cc, int bn, bool bit, int no_retry)
{
otpinfo_t *oi = (otpinfo_t *)oh;
uint row, col, j, k;
uint32 pwait, init_pwait, otpc, otpp, pst, st;
osl_t *osh;
osh = si_osh(oi->sih);
ASSERT((bit >> 1) == 0);
#ifdef OTP_FORCEFAIL
OTP_MSG(("%s: [0x%x] = 0x%x\n", __FUNCTION__, wn * 2, data));
#endif
/* This is bit-at-a-time writing, future cores may do word-at-a-time */
if (oi->ccrev == 12) {
otpc = 0x20000001;
init_pwait = 0x00000200;
} else if (oi->ccrev == 22) {
otpc = 0x20000001;
init_pwait = 0x00000400;
} else {
otpc = 0x20000001;
init_pwait = 0x00004000;
}
pwait = init_pwait;
row = bn / 65;
col = bn % 65;
otpp = OTPP_START_BUSY |
((bit << OTPP_VALUE_SHIFT) & OTPP_VALUE_MASK) |
((row << OTPP_ROW_SHIFT) & OTPP_ROW_MASK) |
(col & OTPP_COL_MASK);
j = 0;
while (1) {
j++;
if (j > 1) {
OTP_DBG(("row %d, col %d, val %d, otpc 0x%x, otpp 0x%x\n",
row, col, bit, (otpc | pwait), otpp));
}
W_REG(osh, &cc->otpcontrol, otpc | pwait);
W_REG(osh, &cc->otpprog, otpp);
pst = R_REG(osh, &cc->otpprog);
for (k = 0; ((pst & OTPP_START_BUSY) == OTPP_START_BUSY) && (k < OTPP_TRIES); k++)
pst = R_REG(osh, &cc->otpprog);
#if defined(BCMDBG) || defined(WLTEST)
if (k > pp_hwm)
pp_hwm = k;
#endif /* BCMDBG || WLTEST */
if (k >= OTPP_TRIES) {
OTP_ERR(("BUSY stuck: pst=0x%x, count=%d\n", pst, k));
st = OTPS_PROGFAIL;
break;
}
st = R_REG(osh, &cc->otpstatus);
if (((st & OTPS_PROGFAIL) == 0) || (pwait == OTPC_PROGWAIT) || (no_retry)) {
break;
} else {
if ((oi->ccrev == 12) || (oi->ccrev == 22))
pwait = (pwait << 3) & OTPC_PROGWAIT;
else
pwait = (pwait << 1) & OTPC_PROGWAIT;
if (pwait == 0)
pwait = OTPC_PROGWAIT;
}
}
#if defined(BCMDBG) || defined(WLTEST)
st_n++;
st_s += j;
if (j > st_hwm)
st_hwm = j;
#ifdef OTP_FORCEFAIL
if (forcefail_bitcount++ == OTP_FORCEFAIL * 16) {
OTP_DBG(("Forcing PROGFAIL on bit %d (FORCEFAIL = %d/0x%x)\n",
forcefail_bitcount, OTP_FORCEFAIL, OTP_FORCEFAIL));
st = OTPS_PROGFAIL;
}
#endif
#endif /* BCMDBG || WLTEST */
if (st & OTPS_PROGFAIL) {
OTP_ERR(("After %d tries: otpc = 0x%x, otpp = 0x%x/0x%x, otps = 0x%x\n",
j, otpc | pwait, otpp, pst, st));
OTP_ERR(("otp prog failed. bit=%d, ppret=%d, ret=%d\n", bit, k, j));
return 1;
}
return 0;
}
static int
hndotp_write_bits(void *oh, int bn, int bits, uint8* data)
{
otpinfo_t *oi = (otpinfo_t *)oh;
uint idx;
chipcregs_t *cc;
int i, j;
uint8 temp;
if (bn < 0 || bn + bits >= oi->rows * oi->cols)
return BCME_RANGE;
idx = si_coreidx(oi->sih);
cc = si_setcoreidx(oi->sih, SI_CC_IDX);
ASSERT(cc != NULL);
for (i = 0; i < bits; ) {
temp = *data++;
for (j = 0; j < 8; j++, i++) {
if (i >= bits)
break;
if (hndotp_write_bit(oh, cc, i + bn, (temp & 0x01), 0) != 0) {
return -1;
}
temp >>= 1;
}
}
si_setcoreidx(oi->sih, idx);
return BCME_OK;
}
static int
hndotp_write_word(void *oh, chipcregs_t *cc, int wn, uint16 data)
{
uint base, i;
int err = 0;
OTP_MSG(("%s: wn %d data %x\n", __FUNCTION__, wn, data));
/* There is one test bit for each row */
base = (wn * 16) + (wn / 4);
for (i = 0; i < 16; i++) {
err += hndotp_write_bit(oh, cc, base + i, data & 1, 0);
data >>= 1;
/* abort write after first error to avoid stress the charge-pump */
if (err) {
OTP_DBG(("%s: wn %d fail on bit %d\n", __FUNCTION__, wn, i));
break;
}
}
return err;
}
static int
hndotp_valid_rce(void *oh, chipcregs_t *cc, int i)
{
otpinfo_t *oi = (otpinfo_t *)oh;
osl_t *osh;
uint32 hwv, fw, rce, e, sign, row, st;
ASSERT(oi->ccrev >= 18);
/* HW valid bit */
osh = si_osh(oi->sih);
st = R_REG(osh, &cc->otpstatus);
hwv = (st & OTPS_RCEV_MSK) & (1 << (OTPS_RCEV_SHIFT + i));
BCM_REFERENCE(hwv);
if (i < 3) {
e = i;
fw = hndotp_size(oh)/2 + OTP_RC0_OFF + e;
} else {
e = i - 3;
fw = hndotp_size(oh)/2 + OTP_RC1_OFF + e;
}
rce = hndotp_otpr(oh, cc, fw+1) << 16 | hndotp_otpr(oh, cc, fw);
rce >>= ((e * OTP_RCE_BITS) + OTP_RCE_BIT0 - (e * 16));
row = rce & OTP_RCE_ROW_MASK;
sign = (rce >> OTP_RCE_ROW_SZ) & OTP_RCE_SIGN_MASK;
OTP_MSG(("rce %d sign %x row %d hwv %x\n", i, sign, row, hwv));
return (sign == OTP_SIGNATURE) ? row : -1;
}
static int
hndotp_write_rce(void *oh, chipcregs_t *cc, int r, uint16* data)
{
int i, rce = -1;
uint32 sign;
ASSERT(((otpinfo_t *)oh)->ccrev >= 18);
ASSERT(r >= 0 && r < hndotp_size(oh)/(2*OTP_WPR));
ASSERT(data);
for (rce = OTP_RCE_ROW_SZ -1; rce >= 0; rce--) {
int e, rt, rcr, bit, err = 0;
int rr = hndotp_valid_rce(oh, cc, rce);
/* redundancy row in use already */
if (rr != -1) {
if (rr == r) {
OTP_MSG(("%s: row %d already replaced by RCE %d",
__FUNCTION__, r, rce));
return 0;
}
continue; /* If row used, go for the next row */
}
/*
* previously used bad rce entry maybe treaed as valid rce and used again, abort on
* first bit error to avoid stress the charge pump
*/
/* Write the data to the redundant row */
for (i = 0; i < OTP_WPR; i++) {
err += hndotp_write_word(oh, cc, hndotp_size(oh)/2+OTP_RD_OFF+rce*4+i,
data[i]);
if (err) {
OTP_MSG(("fail to write redundant row %d\n", rce));
break;
}
}
/* Now write the redundant row index */
if (rce < 3) {
e = rce;
rcr = hndotp_size(oh)/2 + OTP_RC0_OFF;
} else {
e = rce - 3;
rcr = hndotp_size(oh)/2 + OTP_RC1_OFF;
}
/* Write row numer bit-by-bit */
bit = (rcr * 16 + rcr / 4) + e * OTP_RCE_BITS + OTP_RCE_BIT0;
rt = r;
for (i = 0; i < OTP_RCE_ROW_SZ; i++) {
/* If any timeout happened, invalidate the subsequent bits with 0 */
if (hndotp_write_bit(oh, cc, bit, (rt & (err ? 0 : 1)), err)) {
OTP_MSG(("%s: timeout fixing row %d with RCE %d - at row"
" number bit %x\n", __FUNCTION__, r, rce, i));
err++;
}
rt >>= 1;
bit ++;
}
/* Write the RCE signature bit-by-bit */
sign = OTP_SIGNATURE;
for (i = 0; i < OTP_RCE_SIGN_SZ; i++) {
/* If any timeout happened, invalidate the subsequent bits with 0 */
if (hndotp_write_bit(oh, cc, bit, (sign & (err ? 0 : 1)), err)) {
OTP_MSG(("%s: timeout fixing row %d with RCE %d - at row"
" number bit %x\n", __FUNCTION__, r, rce, i));
err++;
}
sign >>= 1;
bit ++;
}
if (err) {
OTP_ERR(("%s: row %d not fixed by RCE %d due to %d timeouts. try next"
" RCE\n", __FUNCTION__, r, rce, err));
continue;
} else {
OTP_MSG(("%s: Fixed row %d by RCE %d\n", __FUNCTION__, r, rce));
return BCME_OK;
}
}
OTP_ERR(("All RCE's are in use. Failed fixing OTP.\n"));
/* Fatal error, unfixable. MFGC will have to fail. Board needs to be discarded!! */
return BCME_NORESOURCE;
}
/* Write a row and fix it with RCE if any error detected */
static int
hndotp_write_row(void *oh, chipcregs_t *cc, int wn, uint16* data, bool rewrite)
{
otpinfo_t *oi = (otpinfo_t *)oh;
int err = 0, i;
ASSERT(wn % OTP_WPR == 0);
/* Write the data */
for (i = 0; i < OTP_WPR; i++) {
if (rewrite && (data[i] == hndotp_otpr(oh, cc, wn+i)))
continue;
err += hndotp_write_word(oh, cc, wn + i, data[i]);
}
/* Fix this row if any error */
if (err && (oi->ccrev >= 18)) {
OTP_DBG(("%s: %d write errors in row %d. Fixing...\n", __FUNCTION__, err, wn/4));
if ((err = hndotp_write_rce(oh, cc, wn / OTP_WPR, data)))
OTP_MSG(("%s: failed to fix row %d\n", __FUNCTION__, wn/4));
}
return err;
}
/* expects the caller to disable interrupts before calling this routine */
static int
hndotp_write_region(void *oh, int region, uint16 *data, uint wlen)
{
otpinfo_t *oi = (otpinfo_t *)oh;
uint32 st;
uint wn, base = 0, lim;
int ret = BCME_OK;
uint idx;
chipcregs_t *cc;
bool rewrite = FALSE;
uint32 save_clk;
ASSERT(wlen % OTP_WPR == 0);
idx = si_coreidx(oi->sih);
cc = si_setcoreidx(oi->sih, SI_CC_IDX);
ASSERT(cc != NULL);
/* Check valid region */
if ((region != OTP_HW_REGION) &&
(region != OTP_SW_REGION) &&
(region != OTP_CID_REGION)) {
ret = BCME_BADARG;
goto out;
}
/* Region already written? */
st = oi->hwprot | oi-> signvalid;
if ((st & region) != 0)
rewrite = TRUE;
/* HW and CID have to be written before SW */
if ((((st & (OTP_HW_REGION | OTP_CID_REGION)) == 0) &&
(st & OTP_SW_REGION) != 0)) {
OTP_ERR(("%s: HW/CID region should be programmed first\n", __FUNCTION__));
ret = BCME_BADARG;
goto out;
}
/* Bounds for the region */
lim = (oi->size / 2) + OTP_SWLIM_OFF;
if (region == OTP_HW_REGION) {
base = 0;
} else if (region == OTP_SW_REGION) {
base = oi->boundary / 2;
} else if (region == OTP_CID_REGION) {
base = (oi->size / 2) + OTP_CID_OFF;
lim = (oi->size / 2) + OTP_LIM_OFF;
}
if (wlen > (lim - base)) {
ret = BCME_BUFTOOLONG;
goto out;
}
lim = base + wlen;
#if defined(BCMDBG) || defined(WLTEST)
st_n = st_s = st_hwm = pp_hwm = 0;
#endif /* BCMDBG || WLTEST */
/* force ALP for progrramming stability */
save_clk = R_REG(oi->osh, &cc->clk_ctl_st);
OR_REG(oi->osh, &cc->clk_ctl_st, CCS_FORCEALP);
OSL_DELAY(10);
/* Write the data row by row */
for (wn = base; wn < lim; wn += OTP_WPR, data += OTP_WPR) {
if ((ret = hndotp_write_row(oh, cc, wn, data, rewrite)) != 0) {
if (ret == BCME_NORESOURCE) {
OTP_ERR(("%s: Abort at word %x\n", __FUNCTION__, wn));
break;
}
}
}
/* Don't need to update signature & boundary if rewrite */
if (rewrite)
goto out_rclk;
/* Done with the data, write the signature & boundary if needed */
if (region == OTP_HW_REGION) {
if (hndotp_write_word(oh, cc, (oi->size / 2) + OTP_BOUNDARY_OFF, lim * 2) != 0) {
ret = BCME_NORESOURCE;
goto out_rclk;
}
if (hndotp_write_word(oh, cc, (oi->size / 2) + OTP_HWSIGN_OFF,
OTP_SIGNATURE) != 0) {
ret = BCME_NORESOURCE;
goto out_rclk;
}
oi->boundary = lim * 2;
oi->signvalid |= OTP_HW_REGION;
} else if (region == OTP_SW_REGION) {
if (hndotp_write_word(oh, cc, (oi->size / 2) + OTP_SWSIGN_OFF,
OTP_SIGNATURE) != 0) {
ret = BCME_NORESOURCE;
goto out_rclk;
}
oi->signvalid |= OTP_SW_REGION;
} else if (region == OTP_CID_REGION) {
if (hndotp_write_word(oh, cc, (oi->size / 2) + OTP_CIDSIGN_OFF,
OTP_SIGNATURE) != 0) {
ret = BCME_NORESOURCE;
goto out_rclk;
}
oi->signvalid |= OTP_CID_REGION;
}
out_rclk:
/* Restore clock */
W_REG(oi->osh, &cc->clk_ctl_st, save_clk);
out:
#if defined(BCMDBG) || defined(WLTEST)
OTP_MSG(("bits written: %d, average (%d/%d): %d, max retry: %d, pp max: %d\n",
st_n, st_s, st_n, st_n?(st_s / st_n):0, st_hwm, pp_hwm));
#endif
si_setcoreidx(oi->sih, idx);
return ret;
}
/* For HND OTP, there's no space for appending after filling in SROM image */
static int
hndotp_cis_append_region(si_t *sih, int region, char *vars, int count)
{
return otp_write_region(sih, region, (uint16*)vars, count/2);
}
/*
* Fill all unwritten RCE signature with 0 and return the number of them.
* HNDOTP needs lock due to the randomness of unprogrammed content.
*/
static int
hndotp_lock(void *oh)
{
otpinfo_t *oi = (otpinfo_t *)oh;
int i, j, e, rcr, bit, ret = 0;
uint32 st, idx;
chipcregs_t *cc;
ASSERT(oi->ccrev >= 18);
idx = si_coreidx(oi->sih);
cc = si_setcoreidx(oi->sih, SI_CC_IDX);
ASSERT(cc != NULL);
/* Region already written? */
st = oi->hwprot | oi-> signvalid;
if ((st & (OTP_HW_REGION | OTP_SW_REGION)) == 0) {
si_setcoreidx(oi->sih, idx);
return BCME_NOTREADY; /* Don't lock unprogrammed OTP */
}
/* Find the highest valid RCE */
for (i = 0; i < OTP_RCE_ROW_SZ -1; i++) {
if ((hndotp_valid_rce(oh, cc, i) != -1))
break;
}
i--; /* Start invalidating from the next RCE */
for (; i >= 0; i--) {
if ((hndotp_valid_rce(oh, cc, i) == -1)) {
ret++; /* This is a unprogrammed row */
/* Invalidate the row with 0 */
if (i < 3) {
e = i;
rcr = hndotp_size(oh)/2 + OTP_RC0_OFF;
} else {
e = i - 3;
rcr = hndotp_size(oh)/2 + OTP_RC1_OFF;
}
/* Fill row numer and signature with 0 bit-by-bit */
bit = (rcr * 16 + rcr / 4) + e * OTP_RCE_BITS + OTP_RCE_BIT0;
for (j = 0; j < (OTP_RCE_ROW_SZ + OTP_RCE_SIGN_SZ); j++) {
hndotp_write_bit(oh, cc, bit, 0, 1);
bit ++;
}
OTP_MSG(("locking rce %d\n", i));
}
}
si_setcoreidx(oi->sih, idx);
return ret;
}
/* expects the caller to disable interrupts before calling this routine */
static int
hndotp_nvwrite(void *oh, uint16 *data, uint wlen)
{
otpinfo_t *oi = (otpinfo_t *)oh;
uint32 st;
uint16 crc, clen, *p, hdr[2];
uint wn, base = 0, lim;
int err, gerr = 0;
uint idx;
chipcregs_t *cc;
/* otp already written? */
st = oi->hwprot | oi-> signvalid;
if ((st & (OTP_HW_REGION | OTP_SW_REGION)) == (OTP_HW_REGION | OTP_SW_REGION))
return BCME_EPERM;
/* save the orig core */
idx = si_coreidx(oi->sih);
cc = si_setcoreidx(oi->sih, SI_CC_IDX);
ASSERT(cc != NULL);
/* Bounds for the region */
lim = (oi->size / 2) + OTP_SWLIM_OFF;
base = 0;
/* Look for possible chunks from the end down */
wn = lim;
while (wn > 0) {
wn--;
if (hndotp_otpr(oh, cc, wn) == OTP_MAGIC) {
base = wn + (hndotp_otpr(oh, cc, wn + 1) / 2);
break;
}
}
if (base == 0) {
OTP_MSG(("Unprogrammed otp\n"));
} else {
OTP_MSG(("Found some chunks, skipping to 0x%x\n", base * 2));
}
if ((wlen + 3) > (lim - base)) {
err = BCME_NORESOURCE;
goto out;
}
#if defined(BCMDBG) || defined(WLTEST)
st_n = st_s = st_hwm = pp_hwm = 0;
#endif /* BCMDBG || WLTEST */
/* Prepare the header and crc */
hdr[0] = OTP_MAGIC;
hdr[1] = (wlen + 3) * 2;
crc = hndcrc16((uint8 *)hdr, sizeof(hdr), CRC16_INIT_VALUE);
crc = hndcrc16((uint8 *)data, wlen * 2, crc);
crc = ~crc;
do {
p = data;
wn = base + 2;
lim = base + wlen + 2;
OTP_MSG(("writing chunk, 0x%x bytes @ 0x%x-0x%x\n", wlen * 2,
base * 2, (lim + 1) * 2));
/* Write the header */
err = hndotp_write_word(oh, cc, base, hdr[0]);
/* Write the data */
while (wn < lim) {
err += hndotp_write_word(oh, cc, wn++, *p++);
/* If there has been an error, close this chunk */
if (err != 0) {
OTP_MSG(("closing early @ 0x%x\n", wn * 2));
break;
}
}
/* If we wrote the whole chunk, write the crc */
if (wn == lim) {
OTP_MSG((" whole chunk written, crc = 0x%x\n", crc));
err += hndotp_write_word(oh, cc, wn++, crc);
clen = hdr[1];
} else {
/* If there was an error adjust the count to point to
* the word after the error so we can start the next
* chunk there.
*/
clen = (wn - base) * 2;
OTP_MSG((" partial chunk written, chunk len = 0x%x\n", clen));
}
/* And now write the chunk length */
err += hndotp_write_word(oh, cc, base + 1, clen);
if (base == 0) {
/* Write the signature and boundary if this is the HW region,
* but don't report failure if either of these 2 writes fail.
*/
if (hndotp_write_word(oh, cc, (oi->size / 2) + OTP_BOUNDARY_OFF,
wn * 2) == 0)
gerr += hndotp_write_word(oh, cc, (oi->size / 2) + OTP_HWSIGN_OFF,
OTP_SIGNATURE);
else
gerr++;
oi->boundary = wn * 2;
oi->signvalid |= OTP_HW_REGION;
}
if (err != 0) {
gerr += err;
/* Errors, do it all over again if there is space left */
if ((wlen + 3) <= ((oi->size / 2) + OTP_SWLIM_OFF - wn)) {
base = wn;
lim = base + wlen + 2;
OTP_ERR(("Programming errors, retry @ 0x%x\n", wn * 2));
} else {
OTP_ERR(("Programming errors, no space left ( 0x%x)\n", wn * 2));
break;
}
}
} while (err != 0);
OTP_MSG(("bits written: %d, average (%d/%d): %d, max retry: %d, pp max: %d\n",
st_n, st_s, st_n, st_s / st_n, st_hwm, pp_hwm));
if (gerr != 0)
OTP_MSG(("programming %s after %d errors\n", (err == 0) ? "succedded" : "failed",
gerr));
out:
/* done */
si_setcoreidx(oi->sih, idx);
if (err)
return BCME_ERROR;
else
return 0;
}
#endif /* BCMNVRAMW */
#if defined(WLTEST) && !defined(BCMROMBUILD)
static uint16
hndotp_otprb16(void *oh, chipcregs_t *cc, uint wn)
{
uint base, i;
uint16 val, bit;
base = (wn * 16) + (wn / 4);
val = 0;
for (i = 0; i < 16; i++) {
if ((bit = hndotp_read_bit(oh, cc, base + i)) == 0xffff)
break;
val = val | (bit << i);
}
if (i < 16)
val = 0xaaaa;
return val;
}
static int
hndotp_dump(void *oh, int arg, char *buf, uint size)
{
otpinfo_t *oi = (otpinfo_t *)oh;
chipcregs_t *cc;
uint idx, i, count, lil;
uint16 val;
struct bcmstrbuf b;
idx = si_coreidx(oi->sih);
cc = si_setcoreidx(oi->sih, SI_CC_IDX);
ASSERT(cc != NULL);
if (arg >= 16)
arg -= 16;
if (arg == 2) {
count = 66 * 4;
lil = 3;
} else {
count = (oi->size / 2) + OTP_RC_LIM_OFF;
lil = 7;
}
OTP_MSG(("%s: arg %d, size %d, words %d\n", __FUNCTION__, arg, size, count));
bcm_binit(&b, buf, size);
for (i = 0; i < count; i++) {
if ((i & lil) == 0)
bcm_bprintf(&b, "0x%04x:", 2 * i);
if (arg == 0)
val = hndotp_otpr(oh, cc, i);
else
val = hndotp_otprb16(oi, cc, i);
bcm_bprintf(&b, " 0x%04x", val);
if ((i & lil) == lil) {
if (arg == 2) {
bcm_bprintf(&b, " %d\n",
hndotp_read_bit(oh, cc, ((i / 4) * 65) + 64) & 1);
} else {
bcm_bprintf(&b, "\n");
}
}
}
if ((i & lil) != lil)
bcm_bprintf(&b, "\n");
OTP_MSG(("%s: returning %d, left %d, wn %d\n",
__FUNCTION__, (int)(b.buf - b.origbuf), b.size, i));
si_setcoreidx(oi->sih, idx);
return ((int)(b.buf - b.origbuf));
}
#endif
static otp_fn_t hndotp_fn = {
(otp_size_t)hndotp_size,
(otp_read_bit_t)hndotp_read_bit,
(otp_dump_t)NULL, /* Assigned in otp_init */
(otp_status_t)hndotp_status,
(otp_init_t)hndotp_init,
(otp_read_region_t)hndotp_read_region,
(otp_nvread_t)hndotp_nvread,
#ifdef BCMNVRAMW
(otp_write_region_t)hndotp_write_region,
(otp_cis_append_region_t)hndotp_cis_append_region,
(otp_lock_t)hndotp_lock,
(otp_nvwrite_t)hndotp_nvwrite,
(otp_write_word_t)NULL,
#else /* BCMNVRAMW */
(otp_write_region_t)NULL,
(otp_cis_append_region_t)NULL,
(otp_lock_t)NULL,
(otp_nvwrite_t)NULL,
(otp_write_word_t)NULL,
#endif /* BCMNVRAMW */
(otp_read_word_t)hndotp_read_word,
#if defined(BCMNVRAMW)
(otp_write_bits_t)hndotp_write_bits
#endif
};
#endif /* BCMHNDOTP */
/*
* Common Code: Compiled for IPX / HND / AUTO
* otp_status()
* otp_size()
* otp_read_bit()
* otp_init()
* otp_read_region()
* otp_read_word()
* otp_nvread()
* otp_write_region()
* otp_write_word()
* otp_cis_append_region()
* otp_lock()
* otp_nvwrite()
* otp_dump()
*/
int
otp_status(void *oh)
{
otpinfo_t *oi = (otpinfo_t *)oh;
return oi->fn->status(oh);
}
int
otp_size(void *oh)
{
otpinfo_t *oi = (otpinfo_t *)oh;
return oi->fn->size(oh);
}
uint16
otp_read_bit(void *oh, uint offset)
{
otpinfo_t *oi = (otpinfo_t *)oh;
uint idx = si_coreidx(oi->sih);
chipcregs_t *cc = si_setcoreidx(oi->sih, SI_CC_IDX);
uint16 readBit = (uint16)oi->fn->read_bit(oh, cc, offset);
si_setcoreidx(oi->sih, idx);
return readBit;
}
#if defined(BCMNVRAMW)
int
otp_write_bits(void *oh, uint offset, int bits, uint8* data)
{
otpinfo_t *oi = (otpinfo_t *)oh;
return oi->fn->write_bits(oh, offset, bits, data);
}
#endif
void *
BCMNMIATTACHFN(otp_init)(si_t *sih)
{
otpinfo_t *oi;
void *ret = NULL;
bool wasup = FALSE;
oi = get_otpinfo();
bzero(oi, sizeof(otpinfo_t));
oi->ccrev = sih->ccrev;
#ifdef BCMIPXOTP
if (OTPTYPE_IPX(oi->ccrev)) {
#if defined(WLTEST) && !defined(BCMROMBUILD)
/* Dump function is excluded from ROM */
ipxotp_fn.dump = ipxotp_dump;
#endif
oi->fn = &ipxotp_fn;
}
#endif /* BCMIPXOTP */
#ifdef BCMHNDOTP
if (OTPTYPE_HND(oi->ccrev)) {
#if defined(WLTEST) && !defined(BCMROMBUILD)
/* Dump function is excluded from ROM */
hndotp_fn.dump = hndotp_dump;
#endif
oi->fn = &hndotp_fn;
}
#endif /* BCMHNDOTP */
if (oi->fn == NULL) {
OTP_ERR(("otp_init: unsupported OTP type\n"));
return NULL;
}
oi->sih = sih;
oi->osh = si_osh(oi->sih);
if (!(wasup = si_is_otp_powered(sih)))
si_otp_power(sih, TRUE);
ret = (oi->fn->init)(sih);
if (!wasup)
si_otp_power(sih, FALSE);
return ret;
}
int
BCMNMIATTACHFN(otp_read_region)(si_t *sih, int region, uint16 *data, uint *wlen)
{
bool wasup = FALSE;
void *oh;
int err = 0;
if (!(wasup = si_is_otp_powered(sih)))
si_otp_power(sih, TRUE);
if (!si_is_otp_powered(sih) || si_is_otp_disabled(sih)) {
err = BCME_NOTREADY;
goto out;
}
oh = otp_init(sih);
if (oh == NULL) {
OTP_ERR(("otp_init failed.\n"));
err = BCME_ERROR;
goto out;
}
err = (((otpinfo_t*)oh)->fn->read_region)(oh, region, data, wlen);
out:
if (!wasup)
si_otp_power(sih, FALSE);
return err;
}
int
otp_read_word(si_t *sih, uint wn, uint16 *data)
{
bool wasup = FALSE;
void *oh;
int err = 0;
if (!(wasup = si_is_otp_powered(sih)))
si_otp_power(sih, TRUE);
if (!si_is_otp_powered(sih) || si_is_otp_disabled(sih)) {
err = BCME_NOTREADY;
goto out;
}
oh = otp_init(sih);
if (oh == NULL) {
OTP_ERR(("otp_init failed.\n"));
err = BCME_ERROR;
goto out;
}
if (((otpinfo_t*)oh)->fn->read_word == NULL) {
err = BCME_UNSUPPORTED;
goto out;
}
err = (((otpinfo_t*)oh)->fn->read_word)(oh, wn, data);
out:
if (!wasup)
si_otp_power(sih, FALSE);
return err;
}
int
otp_nvread(void *oh, char *data, uint *len)
{
otpinfo_t *oi = (otpinfo_t *)oh;
return oi->fn->nvread(oh, data, len);
}
#ifdef BCMNVRAMW
int
BCMNMIATTACHFN(otp_write_region)(si_t *sih, int region, uint16 *data, uint wlen)
{
bool wasup = FALSE;
void *oh;
int err = 0;
if (!(wasup = si_is_otp_powered(sih)))
si_otp_power(sih, TRUE);
if (!si_is_otp_powered(sih) || si_is_otp_disabled(sih)) {
err = BCME_NOTREADY;
goto out;
}
oh = otp_init(sih);
if (oh == NULL) {
OTP_ERR(("otp_init failed.\n"));
err = BCME_ERROR;
goto out;
}
err = (((otpinfo_t*)oh)->fn->write_region)(oh, region, data, wlen);
out:
if (!wasup)
si_otp_power(sih, FALSE);
return err;
}
int
otp_write_word(si_t *sih, uint wn, uint16 data)
{
bool wasup = FALSE;
void *oh;
int err = 0;
if (!(wasup = si_is_otp_powered(sih)))
si_otp_power(sih, TRUE);
if (!si_is_otp_powered(sih) || si_is_otp_disabled(sih)) {
err = BCME_NOTREADY;
goto out;
}
oh = otp_init(sih);
if (oh == NULL) {
OTP_ERR(("otp_init failed.\n"));
err = BCME_ERROR;
goto out;
}
if (((otpinfo_t*)oh)->fn->write_word == NULL) {
err = BCME_UNSUPPORTED;
goto out;
}
err = (((otpinfo_t*)oh)->fn->write_word)(oh, wn, data);
out:
if (!wasup)
si_otp_power(sih, FALSE);
return err;
}
int
otp_cis_append_region(si_t *sih, int region, char *vars, int count)
{
void *oh = otp_init(sih);
if (oh == NULL) {
OTP_ERR(("otp_init failed.\n"));
return -1;
}
return (((otpinfo_t*)oh)->fn->cis_append_region)(sih, region, vars, count);
}
int
otp_lock(si_t *sih)
{
bool wasup = FALSE;
void *oh;
int ret = 0;
if (!(wasup = si_is_otp_powered(sih)))
si_otp_power(sih, TRUE);
if (!si_is_otp_powered(sih) || si_is_otp_disabled(sih)) {
ret = BCME_NOTREADY;
goto out;
}
oh = otp_init(sih);
if (oh == NULL) {
OTP_ERR(("otp_init failed.\n"));
ret = BCME_ERROR;
goto out;
}
ret = (((otpinfo_t*)oh)->fn->lock)(oh);
out:
if (!wasup)
si_otp_power(sih, FALSE);
return ret;
}
int
otp_nvwrite(void *oh, uint16 *data, uint wlen)
{
otpinfo_t *oi = (otpinfo_t *)oh;
return oi->fn->nvwrite(oh, data, wlen);
}
#endif /* BCMNVRAMW */
#if defined(WLTEST)
int
otp_dump(void *oh, int arg, char *buf, uint size)
{
otpinfo_t *oi = (otpinfo_t *)oh;
if (oi->fn->dump == NULL)
return BCME_UNSUPPORTED;
else
return oi->fn->dump(oh, arg, buf, size);
}
int
otp_dumpstats(void *oh, int arg, char *buf, uint size)
{
otpinfo_t *oi = (otpinfo_t *)oh;
struct bcmstrbuf b;
bcm_binit(&b, buf, size);
bcm_bprintf(&b, "\nOTP, ccrev 0x%04x\n", oi->ccrev);
#if defined(BCMIPXOTP)
bcm_bprintf(&b, "wsize %d rows %d cols %d\n", oi->wsize, oi->rows, oi->cols);
bcm_bprintf(&b, "hwbase %d hwlim %d swbase %d swlim %d fusebits %d\n",
oi->hwbase, oi->hwlim, oi->swbase, oi->swlim, oi->fbase, oi->flim, oi->fusebits);
bcm_bprintf(&b, "otpgu_base %d status %d\n", oi->otpgu_base, oi->status);
#endif
#if defined(BCMHNDOTP)
bcm_bprintf(&b, "OLD OTP, size %d hwprot 0x%x signvalid 0x%x boundary %d\n",
oi->size, oi->hwprot, oi->signvalid, oi->boundary);
#endif
bcm_bprintf(&b, "\n");
return 200; /* real buf length, pick one to cover above print */
}
#endif
|
import { NavigationExtras } from '@angular/router';
export interface SkyFlyoutPermalink {
/**
* Specifies a text label for the permalink button.
*/
label?: string;
/**
* Specifies an object that represents the
* [Angular application route](https://angular.io/api/router/Router#navigate).
* The object includes two properties that are mapped to Angular's
* `Router.navigate(commands, extras?)` method.
*/
route?: {
commands: any[];
extras?: NavigationExtras;
};
/**
* Specifies an external URL for the permalink.
*/
url?: string;
}
|
// Copyright 2015 Google Inc. 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.
package pod
import (
"reflect"
"testing"
"k8s.io/kubernetes/pkg/api"
)
func TestGetRestartCount(t *testing.T) {
cases := []struct {
pod api.Pod
expected int
}{
{
api.Pod{}, 0,
},
{
api.Pod{
Status: api.PodStatus{
ContainerStatuses: []api.ContainerStatus{
{
Name: "container-1",
RestartCount: 1,
},
},
},
},
1,
},
{
api.Pod{
Status: api.PodStatus{
ContainerStatuses: []api.ContainerStatus{
{
Name: "container-1",
RestartCount: 3,
},
{
Name: "container-2",
RestartCount: 2,
},
},
},
},
5,
},
}
for _, c := range cases {
actual := getRestartCount(c.pod)
if !reflect.DeepEqual(actual, c.expected) {
t.Errorf("AppendEvents(%#v) == %#v, expected %#v", c.pod, actual, c.expected)
}
}
}
|
TOP= ../..
include Makefile.config
include ${TOP}/core/Makefile.inc
include ${TOP}/gui/Makefile.inc
include ${TOP}/rg/Makefile.inc
include ${TOP}/vg/Makefile.inc
include ${TOP}/dev/Makefile.inc
PROJECT= "agarpaint"
#SUBDIR= po
PROG= agarpaint
PROG_TYPE= "GUI"
PROG_GUID= "68DBFDA9-4965-4cca-8348-38409D8587A6"
PROG_LINKS= ${CORE_LINKS} ${GUI_LINKS} ${RG_LINKS} ${VG_LINKS} ${DEV_LINKS}
SRCS= agarpaint.c
SHARE= agarpaint.bmp
CFLAGS+=${AGAR_CFLAGS} ${AGAR_RG_CFLAGS} ${AGAR_VG_CFLAGS} \
${AGAR_DEV_CFLAGS} ${GETTEXT_CFLAGS}
LIBS+= ${AGAR_LIBS} ${AGAR_RG_LIBS} ${AGAR_VG_LIBS} \
${AGAR_DEV_LIBS} ${GETTEXT_CFLAGS}
all: all-subdir ${PROG}
configure: configure.in
cat configure.in | mkconfigure > configure
chmod 755 configure
.PHONY: configure
include ${TOP}/mk/build.prog.mk
|
// Copyright 2012 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef V8_HEAP_MARK_COMPACT_INL_H_
#define V8_HEAP_MARK_COMPACT_INL_H_
#include "src/heap/mark-compact.h"
#include "src/heap/slots-buffer.h"
#include "src/isolate.h"
namespace v8 {
namespace internal {
void MarkCompactCollector::PushBlack(HeapObject* obj) {
DCHECK(Marking::IsBlack(Marking::MarkBitFrom(obj)));
if (marking_deque_.Push(obj)) {
MemoryChunk::IncrementLiveBytesFromGC(obj, obj->Size());
} else {
Marking::BlackToGrey(obj);
}
}
void MarkCompactCollector::UnshiftBlack(HeapObject* obj) {
DCHECK(Marking::IsBlack(Marking::MarkBitFrom(obj)));
if (!marking_deque_.Unshift(obj)) {
MemoryChunk::IncrementLiveBytesFromGC(obj, -obj->Size());
Marking::BlackToGrey(obj);
}
}
void MarkCompactCollector::MarkObject(HeapObject* obj, MarkBit mark_bit) {
DCHECK(Marking::MarkBitFrom(obj) == mark_bit);
if (Marking::IsWhite(mark_bit)) {
Marking::WhiteToBlack(mark_bit);
DCHECK(obj->GetIsolate()->heap()->Contains(obj));
PushBlack(obj);
}
}
void MarkCompactCollector::SetMark(HeapObject* obj, MarkBit mark_bit) {
DCHECK(Marking::IsWhite(mark_bit));
DCHECK(Marking::MarkBitFrom(obj) == mark_bit);
Marking::WhiteToBlack(mark_bit);
MemoryChunk::IncrementLiveBytesFromGC(obj, obj->Size());
}
bool MarkCompactCollector::IsMarked(Object* obj) {
DCHECK(obj->IsHeapObject());
HeapObject* heap_object = HeapObject::cast(obj);
return Marking::IsBlackOrGrey(Marking::MarkBitFrom(heap_object));
}
void MarkCompactCollector::RecordSlot(HeapObject* object, Object** slot,
Object* target) {
Page* target_page = Page::FromAddress(reinterpret_cast<Address>(target));
if (target_page->IsEvacuationCandidate() &&
!ShouldSkipEvacuationSlotRecording(object)) {
if (!SlotsBuffer::AddTo(slots_buffer_allocator_,
target_page->slots_buffer_address(), slot,
SlotsBuffer::FAIL_ON_OVERFLOW)) {
EvictPopularEvacuationCandidate(target_page);
}
}
}
void MarkCompactCollector::ForceRecordSlot(HeapObject* object, Object** slot,
Object* target) {
Page* target_page = Page::FromAddress(reinterpret_cast<Address>(target));
if (target_page->IsEvacuationCandidate() &&
!ShouldSkipEvacuationSlotRecording(object)) {
CHECK(SlotsBuffer::AddTo(slots_buffer_allocator_,
target_page->slots_buffer_address(), slot,
SlotsBuffer::IGNORE_OVERFLOW));
}
}
void CodeFlusher::AddCandidate(SharedFunctionInfo* shared_info) {
if (GetNextCandidate(shared_info) == NULL) {
SetNextCandidate(shared_info, shared_function_info_candidates_head_);
shared_function_info_candidates_head_ = shared_info;
}
}
void CodeFlusher::AddCandidate(JSFunction* function) {
DCHECK(function->code() == function->shared()->code());
if (GetNextCandidate(function)->IsUndefined()) {
SetNextCandidate(function, jsfunction_candidates_head_);
jsfunction_candidates_head_ = function;
}
}
void CodeFlusher::AddOptimizedCodeMap(SharedFunctionInfo* code_map_holder) {
if (GetNextCodeMap(code_map_holder)->IsUndefined()) {
SetNextCodeMap(code_map_holder, optimized_code_map_holder_head_);
optimized_code_map_holder_head_ = code_map_holder;
}
}
JSFunction** CodeFlusher::GetNextCandidateSlot(JSFunction* candidate) {
return reinterpret_cast<JSFunction**>(
HeapObject::RawField(candidate, JSFunction::kNextFunctionLinkOffset));
}
JSFunction* CodeFlusher::GetNextCandidate(JSFunction* candidate) {
Object* next_candidate = candidate->next_function_link();
return reinterpret_cast<JSFunction*>(next_candidate);
}
void CodeFlusher::SetNextCandidate(JSFunction* candidate,
JSFunction* next_candidate) {
candidate->set_next_function_link(next_candidate, UPDATE_WEAK_WRITE_BARRIER);
}
void CodeFlusher::ClearNextCandidate(JSFunction* candidate, Object* undefined) {
DCHECK(undefined->IsUndefined());
candidate->set_next_function_link(undefined, SKIP_WRITE_BARRIER);
}
SharedFunctionInfo* CodeFlusher::GetNextCandidate(
SharedFunctionInfo* candidate) {
Object* next_candidate = candidate->code()->gc_metadata();
return reinterpret_cast<SharedFunctionInfo*>(next_candidate);
}
void CodeFlusher::SetNextCandidate(SharedFunctionInfo* candidate,
SharedFunctionInfo* next_candidate) {
candidate->code()->set_gc_metadata(next_candidate);
}
void CodeFlusher::ClearNextCandidate(SharedFunctionInfo* candidate) {
candidate->code()->set_gc_metadata(NULL, SKIP_WRITE_BARRIER);
}
SharedFunctionInfo* CodeFlusher::GetNextCodeMap(SharedFunctionInfo* holder) {
FixedArray* code_map = FixedArray::cast(holder->optimized_code_map());
Object* next_map = code_map->get(SharedFunctionInfo::kNextMapIndex);
return reinterpret_cast<SharedFunctionInfo*>(next_map);
}
void CodeFlusher::SetNextCodeMap(SharedFunctionInfo* holder,
SharedFunctionInfo* next_holder) {
FixedArray* code_map = FixedArray::cast(holder->optimized_code_map());
code_map->set(SharedFunctionInfo::kNextMapIndex, next_holder);
}
void CodeFlusher::ClearNextCodeMap(SharedFunctionInfo* holder) {
FixedArray* code_map = FixedArray::cast(holder->optimized_code_map());
code_map->set_undefined(SharedFunctionInfo::kNextMapIndex);
}
} // namespace internal
} // namespace v8
#endif // V8_HEAP_MARK_COMPACT_INL_H_
|
require "gumby/engine"
module Gumby
end
|
From time to time I am approached and invited to be a guest contributor to Vanilla Magazine in Melbourne. It’s an opportunity I thoroughly enjoy as I get to share with readers my experiences on various topics, be it my beautiful home city of Adelaide, the tradition of the dowry, or the celebration of an Orthodox Easter.
You can find my article on celebrating Easter the Orthodox way in the Autumn issue of Vanilla Magazine, on pages 12 and 13.
Vanilla Magazine do a wonderful job of showcasing some amazing talent, sharing interviews with people who ‘are doing if for themselves’, and opening up a world of inspiration and dedication. I think you’ll love this magazine as much as I do!
You can find all that you need to know about how to celebrate Easter the Orthodox Way in my book Greek Life, available from my stockists here in Australia, as an eBook from the links on my website, or as a soft cover at Amazon. |
/**
* Copyright (c) 2014, Oculus VR, 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.
*
*/
#include "NativeFeatureIncludes.h"
#if _RAKNET_SUPPORT_Rackspace==1 && _RAKNET_SUPPORT_TCPInterface==1
#include "Rackspace.h"
#include "RakString.h"
#include "TCPInterface.h"
using namespace RakNet;
Rackspace::Rackspace()
{
tcpInterface=0;
}
Rackspace::~Rackspace()
{
}
void Rackspace::AddEventCallback(Rackspace2EventCallback *callback)
{
unsigned int idx = eventCallbacks.GetIndexOf(callback);
if (idx == (unsigned int)-1)
eventCallbacks.Push(callback,_FILE_AND_LINE_);
}
void Rackspace::RemoveEventCallback(Rackspace2EventCallback *callback)
{
unsigned int idx = eventCallbacks.GetIndexOf(callback);
if (idx != (unsigned int)-1)
eventCallbacks.RemoveAtIndex(idx);
}
void Rackspace::ClearEventCallbacks(void)
{
eventCallbacks.Clear(true, _FILE_AND_LINE_);
}
SystemAddress Rackspace::Authenticate(TCPInterface *_tcpInterface, const char *_authenticationURL, const char *_rackspaceCloudUsername, const char *_apiAccessKey)
{
unsigned int index = GetOperationOfTypeIndex(RO_CONNECT_AND_AUTHENTICATE);
if (index!=(unsigned int)-1)
{
// In progress
return operations[index].connectionAddress;
}
tcpInterface=_tcpInterface;
rackspaceCloudUsername=_rackspaceCloudUsername;
apiAccessKey=_apiAccessKey;
unsigned int i;
RackspaceOperation ro;
ro.type=RO_CONNECT_AND_AUTHENTICATE;
ro.isPendingAuthentication=false;
RakAssert(tcpInterface->WasStarted());
ro.connectionAddress=tcpInterface->Connect(_authenticationURL,443,true);
if (ro.connectionAddress==UNASSIGNED_SYSTEM_ADDRESS)
{
for (i=0; i < eventCallbacks.Size(); i++)
eventCallbacks[i]->OnConnectionAttemptFailure(RO_CONNECT_AND_AUTHENTICATE, _authenticationURL);
return UNASSIGNED_SYSTEM_ADDRESS;
}
#if OPEN_SSL_CLIENT_SUPPORT==1
tcpInterface->StartSSLClient(ro.connectionAddress);
#endif
RakNet::RakString command(
"GET /v1.0 HTTP/1.1\n"
"Host: %s\n"
"X-Auth-User: %s\n"
"X-Auth-Key: %s\n\n"
,_authenticationURL, _rackspaceCloudUsername, _apiAccessKey);
tcpInterface->Send(command.C_String(), (unsigned int) command.GetLength(), ro.connectionAddress, false);
operations.Insert(ro,_FILE_AND_LINE_);
return ro.connectionAddress;
}
const char * Rackspace::EventTypeToString(RackspaceEventType eventType)
{
switch (eventType)
{
case RET_Success_200:
return "Success_200";
case RET_Success_201:
return "Success_201";
case RET_Success_202:
return "Success_202";
case RET_Success_203:
return "Success_203";
case RET_Success_204:
return "Success_204";
case RET_Cloud_Servers_Fault_500:
return "Cloud_Servers_Fault_500";
case RET_Service_Unavailable_503:
return "Service_Unavailable_503";
case RET_Unauthorized_401:
return "Unauthorized_401";
case RET_Bad_Request_400:
return "Bad_Request_400";
case RET_Over_Limit_413:
return "Over_Limit_413";
case RET_Bad_Media_Type_415:
return "Bad_Media_Type_415";
case RET_Item_Not_Found_404:
return "Item_Not_Found_404";
case RET_Build_In_Progress_409:
return "Build_In_Progress_409";
case RET_Resize_Not_Allowed_403:
return "Resize_Not_Allowed_403";
case RET_Connection_Closed_Without_Reponse:
return "Connection_Closed_Without_Reponse";
case RET_Unknown_Failure:
return "Unknown_Failure";
}
return "Unknown event type (bug)";
}
void Rackspace::AddOperation(RackspaceOperationType type, RakNet::RakString httpCommand, RakNet::RakString operation, RakNet::RakString xml)
{
RackspaceOperation ro;
ro.type=type;
ro.httpCommand=httpCommand;
ro.operation=operation;
ro.xml=xml;
ro.isPendingAuthentication=HasOperationOfType(RO_CONNECT_AND_AUTHENTICATE);
if (ro.isPendingAuthentication==false)
{
if (ExecuteOperation(ro))
operations.Insert(ro,_FILE_AND_LINE_);
}
else
operations.Insert(ro,_FILE_AND_LINE_);
}
void Rackspace::ListServers(void)
{
AddOperation(RO_LIST_SERVERS, "GET", "servers", "");
}
void Rackspace::ListServersWithDetails(void)
{
AddOperation(RO_LIST_SERVERS_WITH_DETAILS, "GET", "servers/detail", "");
}
void Rackspace::CreateServer(RakNet::RakString name, RakNet::RakString imageId, RakNet::RakString flavorId)
{
RakNet::RakString xml(
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
"<server xmlns=\"http://docs.rackspacecloud.com/servers/api/v1.0\" name=\"%s\" imageId=\"%s\" flavorId=\"%s\">"
"</server>"
,name.C_String() ,imageId.C_String(), flavorId.C_String());
AddOperation(RO_CREATE_SERVER, "POST", "servers", xml);
}
void Rackspace::GetServerDetails(RakNet::RakString serverId)
{
AddOperation(RO_GET_SERVER_DETAILS, "GET", RakNet::RakString("servers/%s", serverId.C_String()), "");
}
void Rackspace::UpdateServerNameOrPassword(RakNet::RakString serverId, RakNet::RakString newName, RakNet::RakString newPassword)
{
if (newName.IsEmpty() && newPassword.IsEmpty())
return;
RakNet::RakString xml(
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
"<server xmlns=\"http://docs.rackspacecloud.com/servers/api/v1.0\""
);
if (newName.IsEmpty()==false)
xml += RakNet::RakString(" name=\"%s\"", newName.C_String());
if (newPassword.IsEmpty()==false)
xml += RakNet::RakString(" adminPass=\"%s\"", newPassword.C_String());
xml += " />";
AddOperation(RO_UPDATE_SERVER_NAME_OR_PASSWORD, "PUT", RakNet::RakString("servers/%s", serverId.C_String()), xml);
}
void Rackspace::DeleteServer(RakNet::RakString serverId)
{
AddOperation(RO_DELETE_SERVER, "DELETE", RakNet::RakString("servers/%s", serverId.C_String()), "");
}
void Rackspace::ListServerAddresses(RakNet::RakString serverId)
{
AddOperation(RO_LIST_SERVER_ADDRESSES, "GET", RakNet::RakString("servers/%s/ips", serverId.C_String()), "");
}
void Rackspace::ShareServerAddress(RakNet::RakString serverId, RakNet::RakString ipAddress)
{
AddOperation(RO_SHARE_SERVER_ADDRESS, "PUT", RakNet::RakString("servers/%s/ips/public/%s", serverId.C_String(), ipAddress.C_String()), "");
}
void Rackspace::DeleteServerAddress(RakNet::RakString serverId, RakNet::RakString ipAddress)
{
AddOperation(RO_DELETE_SERVER_ADDRESS, "DELETE", RakNet::RakString("servers/%s/ips/public/%s", serverId.C_String(), ipAddress.C_String()), "");
}
void Rackspace::RebootServer(RakNet::RakString serverId, RakNet::RakString rebootType)
{
RakNet::RakString xml(
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
"<reboot xmlns=\"http://docs.rackspacecloud.com/servers/api/v1.0\" type=\"%s\""
"/>",
rebootType.C_String());
AddOperation(RO_REBOOT_SERVER, "POST", RakNet::RakString("servers/%s/action", serverId.C_String()), xml);
}
void Rackspace::RebuildServer(RakNet::RakString serverId, RakNet::RakString imageId)
{
RakNet::RakString xml(
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
"<rebuild xmlns=\"http://docs.rackspacecloud.com/servers/api/v1.0\" imageId=\"%s\""
"/>",
imageId.C_String());
AddOperation(RO_REBUILD_SERVER, "POST", RakNet::RakString("servers/%s/action", serverId.C_String()), xml);
}
void Rackspace::ResizeServer(RakNet::RakString serverId, RakNet::RakString flavorId)
{
RakNet::RakString xml(
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
"<resize xmlns=\"http://docs.rackspacecloud.com/servers/api/v1.0\" flavorId=\"%s\""
"/>",
flavorId.C_String());
AddOperation(RO_RESIZE_SERVER, "POST", RakNet::RakString("servers/%s/action", serverId.C_String()), xml);
}
void Rackspace::ConfirmResizedServer(RakNet::RakString serverId)
{
RakNet::RakString xml(
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
"<confirmResize xmlns=\"http://docs.rackspacecloud.com/servers/api/v1.0\" "
"/>");
AddOperation(RO_CONFIRM_RESIZED_SERVER, "POST", RakNet::RakString("servers/%s/action", serverId.C_String()), xml);
}
void Rackspace::RevertResizedServer(RakNet::RakString serverId)
{
RakNet::RakString xml(
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
"<revertResize xmlns=\"http://docs.rackspacecloud.com/servers/api/v1.0\" "
"/>");
AddOperation(RO_REVERT_RESIZED_SERVER, "POST", RakNet::RakString("servers/%s/action", serverId.C_String()), xml);
}
void Rackspace::ListFlavors(void)
{
AddOperation(RO_LIST_FLAVORS, "GET", "flavors", "");
}
void Rackspace::GetFlavorDetails(RakNet::RakString flavorId)
{
AddOperation(RO_GET_FLAVOR_DETAILS, "GET", RakNet::RakString("flavors/%s", flavorId.C_String()), "");
}
void Rackspace::ListImages(void)
{
AddOperation(RO_LIST_IMAGES, "GET", "images", "");
}
void Rackspace::CreateImage(RakNet::RakString serverId, RakNet::RakString imageName)
{
RakNet::RakString xml(
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
"<image xmlns=\"http://docs.rackspacecloud.com/servers/api/v1.0\" name=\"%s\" serverId=\"%s\""
"/>",
imageName.C_String(),serverId.C_String());
AddOperation(RO_CREATE_IMAGE, "POST", "images", xml);
}
void Rackspace::GetImageDetails(RakNet::RakString imageId)
{
AddOperation(RO_GET_IMAGE_DETAILS, "GET", RakNet::RakString("images/%s", imageId.C_String()), "");
}
void Rackspace::DeleteImage(RakNet::RakString imageId)
{
AddOperation(RO_DELETE_IMAGE, "DELETE", RakNet::RakString("images/%s", imageId.C_String()), "");
}
void Rackspace::ListSharedIPGroups(void)
{
AddOperation(RO_LIST_SHARED_IP_GROUPS, "GET", "shared_ip_groups", "");
}
void Rackspace::ListSharedIPGroupsWithDetails(void)
{
AddOperation(RO_LIST_SHARED_IP_GROUPS_WITH_DETAILS, "GET", "shared_ip_groups/detail", "");
}
void Rackspace::CreateSharedIPGroup(RakNet::RakString name, RakNet::RakString optionalServerId)
{
RakNet::RakString xml(
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
"<sharedIpGroup xmlns=\"http://docs.rackspacecloud.com/servers/api/v1.0\" name=\"%s\">", name.C_String());
if (optionalServerId.IsEmpty()==false)
xml+=RakNet::RakString("<server id=\"%s\"/>", optionalServerId.C_String());
xml+="</sharedIpGroup>";
AddOperation(RO_CREATE_SHARED_IP_GROUP, "POST", "shared_ip_groups", xml);
}
void Rackspace::GetSharedIPGroupDetails(RakNet::RakString groupId)
{
AddOperation(RO_GET_SHARED_IP_GROUP_DETAILS, "GET", RakNet::RakString("shared_ip_groups/%s", groupId.C_String()), "");
}
void Rackspace::DeleteSharedIPGroup(RakNet::RakString groupId)
{
AddOperation(RO_DELETE_SHARED_IP_GROUP, "DELETE", RakNet::RakString("shared_ip_groups/%s", groupId.C_String()), "");
}
void Rackspace::OnClosedConnection(SystemAddress systemAddress)
{
if (systemAddress==UNASSIGNED_SYSTEM_ADDRESS)
return;
unsigned int i, operationsIndex;
operationsIndex=0;
while (operationsIndex < operations.Size())
{
if (operations[operationsIndex].isPendingAuthentication==false && operations[operationsIndex].connectionAddress==systemAddress)
{
RackspaceOperation ro = operations[operationsIndex];
operations.RemoveAtIndex(operationsIndex);
RakNet::RakString packetDataString = ro.incomingStream;
const char *packetData = packetDataString.C_String();
char resultCodeStr[32];
int resultCodeInt;
RackspaceEventType rackspaceEventType;
char *result;
result=strstr((char*) packetData, "HTTP/1.1 ");
if (result!=0)
{
result+=strlen("HTTP/1.1 ");
for (i=0; i < sizeof(resultCodeStr)-1 && result[i] && result[i]>='0' && result[i]<='9'; i++)
resultCodeStr[i]=result[i];
resultCodeStr[i]=0;
resultCodeInt=atoi(resultCodeStr);
switch (resultCodeInt)
{
case 200: rackspaceEventType=RET_Success_200; break;
case 201: rackspaceEventType=RET_Success_201; break;
case 202: rackspaceEventType=RET_Success_202; break;
case 203: rackspaceEventType=RET_Success_203; break;
case 204: rackspaceEventType=RET_Success_204; break;
case 500: rackspaceEventType=RET_Cloud_Servers_Fault_500; break;
case 503: rackspaceEventType=RET_Service_Unavailable_503; break;
case 401: rackspaceEventType=RET_Unauthorized_401; break;
case 400: rackspaceEventType=RET_Bad_Request_400; break;
case 413: rackspaceEventType=RET_Over_Limit_413; break;
case 415: rackspaceEventType=RET_Bad_Media_Type_415; break;
case 404: rackspaceEventType=RET_Item_Not_Found_404; break;
case 409: rackspaceEventType=RET_Build_In_Progress_409; break;
case 403: rackspaceEventType=RET_Resize_Not_Allowed_403; break;
default: rackspaceEventType=RET_Unknown_Failure; break;
}
}
else
{
rackspaceEventType=RET_Connection_Closed_Without_Reponse;
}
switch (ro.type)
{
case RO_CONNECT_AND_AUTHENTICATE:
{
if (rackspaceEventType==RET_Success_204)
{
RakNet::RakString header;
ReadLine(packetData, "X-Server-Management-Url: ", serverManagementURL);
serverManagementURL.SplitURI(header, serverManagementDomain, serverManagementPath);
ReadLine(packetData, "X-Storage-Url: ", storageURL);
storageURL.SplitURI(header, storageDomain, storagePath);
ReadLine(packetData, "X-CDN-Management-Url: ", cdnManagementURL);
cdnManagementURL.SplitURI(header, cdnManagementDomain, cdnManagementPath);
ReadLine(packetData, "X-Auth-Token: ", authToken);
ReadLine(packetData, "X-Storage-Token: ", storageToken);
operationsIndex=0;
while (operationsIndex < operations.Size())
{
if (operations[operationsIndex].isPendingAuthentication==true)
{
operations[operationsIndex].isPendingAuthentication=false;
if (ExecuteOperation(operations[operationsIndex])==false)
{
operations.RemoveAtIndex(operationsIndex);
}
else
operationsIndex++;
}
else
operationsIndex++;
}
// Restart in list
operationsIndex=0;
}
for (i=0; i < eventCallbacks.Size(); i++)
eventCallbacks[i]->OnAuthenticationResult(rackspaceEventType, (const char*) packetData);
break;
}
case RO_LIST_SERVERS:
{
for (i=0; i < eventCallbacks.Size(); i++)
eventCallbacks[i]->OnListServersResult(rackspaceEventType, (const char*) packetData);
break;
}
case RO_LIST_SERVERS_WITH_DETAILS:
{
for (i=0; i < eventCallbacks.Size(); i++)
eventCallbacks[i]->OnListServersWithDetailsResult(rackspaceEventType, (const char*) packetData);
break;
}
case RO_CREATE_SERVER:
{
for (i=0; i < eventCallbacks.Size(); i++)
eventCallbacks[i]->OnCreateServerResult(rackspaceEventType, (const char*) packetData);
break;
}
case RO_GET_SERVER_DETAILS:
{
for (i=0; i < eventCallbacks.Size(); i++)
eventCallbacks[i]->OnGetServerDetails(rackspaceEventType, (const char*) packetData);
break;
}
case RO_UPDATE_SERVER_NAME_OR_PASSWORD:
{
for (i=0; i < eventCallbacks.Size(); i++)
eventCallbacks[i]->OnUpdateServerNameOrPassword(rackspaceEventType, (const char*) packetData);
break;
}
case RO_DELETE_SERVER:
{
for (i=0; i < eventCallbacks.Size(); i++)
eventCallbacks[i]->OnDeleteServer(rackspaceEventType, (const char*) packetData);
break;
}
case RO_LIST_SERVER_ADDRESSES:
{
for (i=0; i < eventCallbacks.Size(); i++)
eventCallbacks[i]->OnListServerAddresses(rackspaceEventType, (const char*) packetData);
break;
}
case RO_SHARE_SERVER_ADDRESS:
{
for (i=0; i < eventCallbacks.Size(); i++)
eventCallbacks[i]->OnShareServerAddress(rackspaceEventType, (const char*) packetData);
break;
}
case RO_DELETE_SERVER_ADDRESS:
{
for (i=0; i < eventCallbacks.Size(); i++)
eventCallbacks[i]->OnDeleteServerAddress(rackspaceEventType, (const char*) packetData);
break;
}
case RO_REBOOT_SERVER:
{
for (i=0; i < eventCallbacks.Size(); i++)
eventCallbacks[i]->OnRebootServer(rackspaceEventType, (const char*) packetData);
break;
}
case RO_REBUILD_SERVER:
{
for (i=0; i < eventCallbacks.Size(); i++)
eventCallbacks[i]->OnRebuildServer(rackspaceEventType, (const char*) packetData);
break;
}
case RO_RESIZE_SERVER:
{
for (i=0; i < eventCallbacks.Size(); i++)
eventCallbacks[i]->OnResizeServer(rackspaceEventType, (const char*) packetData);
break;
}
case RO_CONFIRM_RESIZED_SERVER:
{
for (i=0; i < eventCallbacks.Size(); i++)
eventCallbacks[i]->OnConfirmResizedServer(rackspaceEventType, (const char*) packetData);
break;
}
case RO_REVERT_RESIZED_SERVER:
{
for (i=0; i < eventCallbacks.Size(); i++)
eventCallbacks[i]->OnRevertResizedServer(rackspaceEventType, (const char*) packetData);
break;
}
case RO_LIST_FLAVORS:
{
for (i=0; i < eventCallbacks.Size(); i++)
eventCallbacks[i]->OnListFlavorsResult(rackspaceEventType, (const char*) packetData);
break;
}
case RO_GET_FLAVOR_DETAILS:
{
for (i=0; i < eventCallbacks.Size(); i++)
eventCallbacks[i]->OnGetFlavorDetailsResult(rackspaceEventType, (const char*) packetData);
break;
}
case RO_LIST_IMAGES:
{
for (i=0; i < eventCallbacks.Size(); i++)
eventCallbacks[i]->OnListImagesResult(rackspaceEventType, (const char*) packetData);
break;
}
case RO_CREATE_IMAGE:
{
for (i=0; i < eventCallbacks.Size(); i++)
eventCallbacks[i]->OnCreateImageResult(rackspaceEventType, (const char*) packetData);
break;
}
case RO_GET_IMAGE_DETAILS:
{
for (i=0; i < eventCallbacks.Size(); i++)
eventCallbacks[i]->OnGetImageDetailsResult(rackspaceEventType, (const char*) packetData);
break;
}
case RO_DELETE_IMAGE:
{
for (i=0; i < eventCallbacks.Size(); i++)
eventCallbacks[i]->OnDeleteImageResult(rackspaceEventType, (const char*) packetData);
break;
}
case RO_LIST_SHARED_IP_GROUPS:
{
for (i=0; i < eventCallbacks.Size(); i++)
eventCallbacks[i]->OnListSharedIPGroups(rackspaceEventType, (const char*) packetData);
break;
}
case RO_LIST_SHARED_IP_GROUPS_WITH_DETAILS:
{
for (i=0; i < eventCallbacks.Size(); i++)
eventCallbacks[i]->OnListSharedIPGroupsWithDetails(rackspaceEventType, (const char*) packetData);
break;
}
case RO_CREATE_SHARED_IP_GROUP:
{
for (i=0; i < eventCallbacks.Size(); i++)
eventCallbacks[i]->OnCreateSharedIPGroup(rackspaceEventType, (const char*) packetData);
break;
}
case RO_GET_SHARED_IP_GROUP_DETAILS:
{
for (i=0; i < eventCallbacks.Size(); i++)
eventCallbacks[i]->OnGetSharedIPGroupDetails(rackspaceEventType, (const char*) packetData);
break;
}
case RO_DELETE_SHARED_IP_GROUP:
{
for (i=0; i < eventCallbacks.Size(); i++)
eventCallbacks[i]->OnDeleteSharedIPGroup(rackspaceEventType, (const char*) packetData);
break;
}
default:
break;
}
}
else
{
operationsIndex++;
}
}
}
void Rackspace::OnReceive(Packet *packet)
{
unsigned int operationsIndex;
for (operationsIndex=0; operationsIndex < operations.Size(); operationsIndex++)
{
if (operations[operationsIndex].isPendingAuthentication==false && operations[operationsIndex].connectionAddress==packet->systemAddress)
{
operations[operationsIndex].incomingStream+=packet->data;
}
}
}
bool Rackspace::ExecuteOperation(RackspaceOperation &ro)
{
if (ConnectToServerManagementDomain(ro)==false)
return false;
RakNet::RakString command(
"%s %s/%s HTTP/1.1\n"
"Host: %s\n"
"Content-Type: application/xml\n"
"Content-Length: %i\n"
"Accept: application/xml\n"
"X-Auth-Token: %s\n",
ro.httpCommand.C_String(), serverManagementPath.C_String(), ro.operation.C_String(), serverManagementDomain.C_String(),
ro.xml.GetLength(),
authToken.C_String());
if (ro.xml.IsEmpty()==false)
{
command+="\n";
command+=ro.xml;
command+="\n";
}
command+="\n";
//printf(command.C_String());
tcpInterface->Send(command.C_String(), (unsigned int) command.GetLength(), ro.connectionAddress, false);
return true;
}
void Rackspace::ReadLine(const char *data, const char *stringStart, RakNet::RakString &output)
{
output.Clear();
char *result, *resultEnd;
result=strstr((char*) data, stringStart);
if (result==0)
{
RakAssert(0);
return;
}
result+=strlen(stringStart);
if (result==0)
{
RakAssert(0);
return;
}
output=result;
resultEnd=result;
while (*resultEnd && (*resultEnd!='\r') && (*resultEnd!='\n') )
resultEnd++;
output.Truncate((unsigned int) (resultEnd-result));
}
bool Rackspace::ConnectToServerManagementDomain(RackspaceOperation &ro)
{
unsigned int i;
ro.connectionAddress=tcpInterface->Connect(serverManagementDomain.C_String(),443,true);
if (ro.connectionAddress==UNASSIGNED_SYSTEM_ADDRESS)
{
for (i=0; i < eventCallbacks.Size(); i++)
eventCallbacks[i]->OnConnectionAttemptFailure(ro.type, serverManagementURL);
return false;
}
#if OPEN_SSL_CLIENT_SUPPORT==1
tcpInterface->StartSSLClient(ro.connectionAddress);
#endif
return true;
}
bool Rackspace::HasOperationOfType(RackspaceOperationType t)
{
unsigned int i;
for (i=0; i < operations.Size(); i++)
{
if (operations[i].type==t)
return true;
}
return false;
}
unsigned int Rackspace::GetOperationOfTypeIndex(RackspaceOperationType t)
{
unsigned int i;
for (i=0; i < operations.Size(); i++)
{
if (operations[i].type==t)
return i;
}
return (unsigned int) -1;
}
#endif
|
<?php
/**
* Array-like proxy used to iterate through a MySQL resultset saving some memory.
*
* @package PHPTracker
* @subpackage Persistence
*/
class PHPTracker_Persistence_MysqlResult implements ArrayAccess, Iterator, Countable
{
/**
* Mysqli result object.
*
* @var MySQLi_Result
*/
protected $result;
/**
* Number of rows in the resultset.
*
* @var integer
*/
protected $num_rows = 0;
/**
* Pointer of the currently sought row in the resultset.
*
* @var integer
*/
protected $row_pointer = 0;
/**
* Initializing object with the mysqli result object.
*
* @param MySQLi_Result $result
*/
public function __construct( MySQLi_Result $result )
{
$this->result = $result;
$this->num_rows = $this->result->num_rows;
}
/**
* ArrayAccess method, tells if an array index exists.
*
* @param integer $offset
* @return boolean
*/
public function offsetExists( $offset )
{
return ( $offset >= 0 ) && ( $offset < $this->num_rows );
}
/**
* ArrayAccess method to set offset. Our array is read-only, so this method issues a warning.
*
* @param index $offset
* @param mixed $value
*/
public function offsetSet( $offset, $value )
{
trigger_error( 'Cannot set keys of read-only array: ' . __CLASS__, E_USER_WARNING );
}
/**
* ArrayAccess method
*
* @param <type> $offset
* @param <type> $step
* @return <type>
*/
public function offsetGet( $offset, $step = false )
{
if ( $this->offsetExists( $offset ) )
{
$this->jumpTo( $offset );
$return = $this->result->fetch_array();
++$this->row_pointer;
if ( $step )
{
$this->jumpTo( $offset );
}
return $return;
}
}
/**
* ArrayAccess method to unset offset. Our array is read-only, so this method issues a warning.
*
* @param integer $offset
*/
public function offsetUnset( $offset )
{
trigger_error( 'Cannot unset keys of read-only array: ' . __CLASS__, E_USER_WARNING );
}
/**
* Seek the resultset to a certain index.
*
* @param integer $offset Offset to seek to.
*/
protected function jumpTo( $offset )
{
if ( $offset != $this->row_pointer )
{
if ( $this->offsetExists( $offset ) )
{
$this->result->data_seek( $offset );
}
$this->row_pointer = $offset;
}
}
/**
* Iterator method. Rewinds array to the beginning.
*/
public function rewind()
{
$this->jumpTo( 0 );
}
/**
* Iterator method. Returns the current row.
*
* @return array
*/
public function current()
{
return $this->offsetGet( $this->row_pointer, true );
}
/**
* Iterator method. Returns the current key.
*
* @return integer
*/
public function key()
{
return $this->row_pointer;
}
/**
* Iterator method. Drives the array to the next key.
*/
public function next()
{
$this->jumpTo( $this->row_pointer + 1 );
}
/**
* Iterator method. Checks if the current key is valid.
*
* @return boolean
*/
public function valid()
{
return $this->offsetExists( $this->row_pointer );
}
/**
* Countable method. Returns the number of rows in the resultset.
*
* @return integer
*/
public function count()
{
return $this->num_rows;
}
/**
* If the array-like object is not an options and you really need the whole
* resultset in the memory, you can convert it to an array.
*
* @return array
*/
public function toArray()
{
$return = array();
foreach ( $this as $row )
{
$return[] = $row;
}
return $return;
}
}
|
import * as React from 'react'
import { CommitMessage } from './commit-message'
import { ChangedFile } from './changed-file'
import { List, ClickSource } from '../list'
import { WorkingDirectoryStatus, WorkingDirectoryFileChange } from '../../models/status'
import { DiffSelectionType } from '../../models/diff'
import { CommitIdentity } from '../../models/commit-identity'
import { Checkbox, CheckboxValue } from '../lib/checkbox'
import { ICommitMessage } from '../../lib/app-state'
import { IGitHubUser } from '../../lib/dispatcher'
import { IAutocompletionProvider } from '../autocompletion'
import { Dispatcher } from '../../lib/dispatcher'
import { Repository } from '../../models/repository'
import { showContextualMenu, IMenuItem } from '../main-process-proxy'
const RowHeight = 29
interface IChangesListProps {
readonly repository: Repository
readonly workingDirectory: WorkingDirectoryStatus
readonly selectedFileID: string | null
readonly onFileSelectionChanged: (row: number) => void
readonly onIncludeChanged: (path: string, include: boolean) => void
readonly onSelectAll: (selectAll: boolean) => void
readonly onCreateCommit: (message: ICommitMessage) => Promise<boolean>
readonly onDiscardChanges: (file: WorkingDirectoryFileChange) => void
readonly onDiscardAllChanges: (files: ReadonlyArray<WorkingDirectoryFileChange>) => void
readonly branch: string | null
readonly commitAuthor: CommitIdentity | null
readonly gitHubUser: IGitHubUser | null
readonly dispatcher: Dispatcher
readonly availableWidth: number
readonly isCommitting: boolean
/**
* Click event handler passed directly to the onRowClick prop of List, see
* List Props for documentation.
*/
readonly onRowClick?: (row: number, source: ClickSource) => void
readonly commitMessage: ICommitMessage | null
readonly contextualCommitMessage: ICommitMessage | null
/** The autocompletion providers available to the repository. */
readonly autocompletionProviders: ReadonlyArray<IAutocompletionProvider<any>>
/** Called when the given pattern should be ignored. */
readonly onIgnore: (pattern: string) => void
}
export class ChangesList extends React.Component<IChangesListProps, void> {
private onIncludeAllChanged = (event: React.FormEvent<HTMLInputElement>) => {
const include = event.currentTarget.checked
this.props.onSelectAll(include)
}
private renderRow = (row: number): JSX.Element => {
const file = this.props.workingDirectory.files[row]
const selection = file.selection.getSelectionType()
const includeAll = selection === DiffSelectionType.All
? true
: (selection === DiffSelectionType.None ? false : null)
return (
<ChangedFile
path={file.path}
status={file.status}
oldPath={file.oldPath}
include={includeAll}
key={file.id}
onIncludeChanged={this.props.onIncludeChanged}
onDiscardChanges={this.onDiscardChanges}
availableWidth={this.props.availableWidth}
onIgnore={this.props.onIgnore}
/>
)
}
private get includeAllValue(): CheckboxValue {
const includeAll = this.props.workingDirectory.includeAll
if (includeAll === true) {
return CheckboxValue.On
} else if (includeAll === false) {
return CheckboxValue.Off
} else {
return CheckboxValue.Mixed
}
}
private onDiscardAllChanges = () => {
this.props.onDiscardAllChanges(this.props.workingDirectory.files)
}
private onDiscardChanges = (path: string) => {
const workingDirectory = this.props.workingDirectory
const file = workingDirectory.files.find(f => f.path === path)
if (!file) { return }
this.props.onDiscardChanges(file)
}
private onContextMenu = (event: React.MouseEvent<any>) => {
event.preventDefault()
const items: IMenuItem[] = [
{
label: __DARWIN__ ? 'Discard All Changes…' : 'Discard all changes…',
action: this.onDiscardAllChanges,
enabled: this.props.workingDirectory.files.length > 0,
},
]
showContextualMenu(items)
}
public render() {
const fileList = this.props.workingDirectory.files
const selectedRow = fileList.findIndex(file => file.id === this.props.selectedFileID)
const fileCount = fileList.length
const filesPlural = fileCount === 1 ? 'file' : 'files'
const filesDescription = `${fileCount} changed ${filesPlural}`
const anyFilesSelected = fileCount > 0 && this.includeAllValue !== CheckboxValue.Off
return (
<div className='changes-list-container file-list'>
<div className='header' onContextMenu={this.onContextMenu}>
<Checkbox
label={filesDescription}
value={this.includeAllValue}
onChange={this.onIncludeAllChanged}
/>
</div>
<List id='changes-list'
rowCount={this.props.workingDirectory.files.length}
rowHeight={RowHeight}
rowRenderer={this.renderRow}
selectedRow={selectedRow}
onSelectionChanged={this.props.onFileSelectionChanged}
invalidationProps={this.props.workingDirectory}
onRowClick={this.props.onRowClick}/>
<CommitMessage
onCreateCommit={this.props.onCreateCommit}
branch={this.props.branch}
gitHubUser={this.props.gitHubUser}
commitAuthor={this.props.commitAuthor}
anyFilesSelected={anyFilesSelected}
repository={this.props.repository}
dispatcher={this.props.dispatcher}
commitMessage={this.props.commitMessage}
contextualCommitMessage={this.props.contextualCommitMessage}
autocompletionProviders={this.props.autocompletionProviders}
isCommitting={this.props.isCommitting}/>
</div>
)
}
}
|
Dragon City is a first of its kind development that encompasses over 787 commercial units, making it the largest wholesale and retail trading centre in the Kingdom of Bahrain.
Situated to the South-West of Diyar Al Muharraq in close proximity to Bahrain’s International Airport, the state-of-the-art Khalifa Bin Salman Port and the Capital of the Kingdom of Bahrain, Manama, Dragon City caters to customers from both the Kingdom and beyond. Dragon City is infused with Chinese architectural and cultural aspects and offers Chinese products of the highest quality to local consumers, trade customers and tourists. |
Excellent advice! Although, I'm not sure if the owners would like to come home to a room full of mess after their break. However, by the time they find it, you'll be long gone and it won't be your problem any more.
That's why there's a step 4.
Never put anything on your bed that you're not willing to sleep on top of.
I find that if you don't put things on the bed, but on the bedroom floor, you'll be alright.
You just need to be good at stacking stuff. Besides, if you stack it high enough you don't have to worry about pulling your curtains closed.
…spent three hours looking for them before giving it up as a bad job, threw myself on the bed and landed on them.
Who needs a filiing system?
This would expain the need to have 40 needles pushed into your back. Extra Extra kinks cause by lumpy bed!
this GooJa link to “Mountain of Laundry”.
Previous post: Truly wireless working is mine! All mine!
Next post: Should I rip this? |
# CIS17A-SI-CODE |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_112) on Mon May 01 08:43:55 MST 2017 -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Uses of Interface org.wildfly.swarm.config.messaging.activemq.server.LegacyConnectionFactoryConsumer (Public javadocs 2017.5.0 API)</title>
<meta name="date" content="2017-05-01">
<link rel="stylesheet" type="text/css" href="../../../../../../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../../../../../../script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Uses of Interface org.wildfly.swarm.config.messaging.activemq.server.LegacyConnectionFactoryConsumer (Public javadocs 2017.5.0 API)";
}
}
catch(err) {
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../../../../overview-summary.html">Overview</a></li>
<li><a href="../package-summary.html">Package</a></li>
<li><a href="../../../../../../../../org/wildfly/swarm/config/messaging/activemq/server/LegacyConnectionFactoryConsumer.html" title="interface in org.wildfly.swarm.config.messaging.activemq.server">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../../../../../../../../overview-tree.html">Tree</a></li>
<li><a href="../../../../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../../../../help-doc.html">Help</a></li>
</ul>
<div class="aboutLanguage">WildFly Swarm API, 2017.5.0</div>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../../../../../../index.html?org/wildfly/swarm/config/messaging/activemq/server/class-use/LegacyConnectionFactoryConsumer.html" target="_top">Frames</a></li>
<li><a href="LegacyConnectionFactoryConsumer.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<div class="header">
<h2 title="Uses of Interface org.wildfly.swarm.config.messaging.activemq.server.LegacyConnectionFactoryConsumer" class="title">Uses of Interface<br>org.wildfly.swarm.config.messaging.activemq.server.LegacyConnectionFactoryConsumer</h2>
</div>
<div class="classUseContainer">
<ul class="blockList">
<li class="blockList">
<table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing packages, and an explanation">
<caption><span>Packages that use <a href="../../../../../../../../org/wildfly/swarm/config/messaging/activemq/server/LegacyConnectionFactoryConsumer.html" title="interface in org.wildfly.swarm.config.messaging.activemq.server">LegacyConnectionFactoryConsumer</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Package</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><a href="#org.wildfly.swarm.config.messaging.activemq">org.wildfly.swarm.config.messaging.activemq</a></td>
<td class="colLast"> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="#org.wildfly.swarm.config.messaging.activemq.server">org.wildfly.swarm.config.messaging.activemq.server</a></td>
<td class="colLast"> </td>
</tr>
</tbody>
</table>
</li>
<li class="blockList">
<ul class="blockList">
<li class="blockList"><a name="org.wildfly.swarm.config.messaging.activemq">
<!-- -->
</a>
<h3>Uses of <a href="../../../../../../../../org/wildfly/swarm/config/messaging/activemq/server/LegacyConnectionFactoryConsumer.html" title="interface in org.wildfly.swarm.config.messaging.activemq.server">LegacyConnectionFactoryConsumer</a> in <a href="../../../../../../../../org/wildfly/swarm/config/messaging/activemq/package-summary.html">org.wildfly.swarm.config.messaging.activemq</a></h3>
<table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation">
<caption><span>Methods in <a href="../../../../../../../../org/wildfly/swarm/config/messaging/activemq/package-summary.html">org.wildfly.swarm.config.messaging.activemq</a> with parameters of type <a href="../../../../../../../../org/wildfly/swarm/config/messaging/activemq/server/LegacyConnectionFactoryConsumer.html" title="interface in org.wildfly.swarm.config.messaging.activemq.server">LegacyConnectionFactoryConsumer</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><code><a href="../../../../../../../../org/wildfly/swarm/config/messaging/activemq/Server.html" title="type parameter in Server">T</a></code></td>
<td class="colLast"><span class="typeNameLabel">Server.</span><code><span class="memberNameLink"><a href="../../../../../../../../org/wildfly/swarm/config/messaging/activemq/Server.html#legacyConnectionFactory-java.lang.String-org.wildfly.swarm.config.messaging.activemq.server.LegacyConnectionFactoryConsumer-">legacyConnectionFactory</a></span>(<a href="http://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> childKey,
<a href="../../../../../../../../org/wildfly/swarm/config/messaging/activemq/server/LegacyConnectionFactoryConsumer.html" title="interface in org.wildfly.swarm.config.messaging.activemq.server">LegacyConnectionFactoryConsumer</a> consumer)</code>
<div class="block">Create and configure a LegacyConnectionFactory object to the list of
subresources</div>
</td>
</tr>
</tbody>
</table>
</li>
<li class="blockList"><a name="org.wildfly.swarm.config.messaging.activemq.server">
<!-- -->
</a>
<h3>Uses of <a href="../../../../../../../../org/wildfly/swarm/config/messaging/activemq/server/LegacyConnectionFactoryConsumer.html" title="interface in org.wildfly.swarm.config.messaging.activemq.server">LegacyConnectionFactoryConsumer</a> in <a href="../../../../../../../../org/wildfly/swarm/config/messaging/activemq/server/package-summary.html">org.wildfly.swarm.config.messaging.activemq.server</a></h3>
<table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation">
<caption><span>Methods in <a href="../../../../../../../../org/wildfly/swarm/config/messaging/activemq/server/package-summary.html">org.wildfly.swarm.config.messaging.activemq.server</a> that return <a href="../../../../../../../../org/wildfly/swarm/config/messaging/activemq/server/LegacyConnectionFactoryConsumer.html" title="interface in org.wildfly.swarm.config.messaging.activemq.server">LegacyConnectionFactoryConsumer</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><code>default <a href="../../../../../../../../org/wildfly/swarm/config/messaging/activemq/server/LegacyConnectionFactoryConsumer.html" title="interface in org.wildfly.swarm.config.messaging.activemq.server">LegacyConnectionFactoryConsumer</a><<a href="../../../../../../../../org/wildfly/swarm/config/messaging/activemq/server/LegacyConnectionFactoryConsumer.html" title="type parameter in LegacyConnectionFactoryConsumer">T</a>></code></td>
<td class="colLast"><span class="typeNameLabel">LegacyConnectionFactoryConsumer.</span><code><span class="memberNameLink"><a href="../../../../../../../../org/wildfly/swarm/config/messaging/activemq/server/LegacyConnectionFactoryConsumer.html#andThen-org.wildfly.swarm.config.messaging.activemq.server.LegacyConnectionFactoryConsumer-">andThen</a></span>(<a href="../../../../../../../../org/wildfly/swarm/config/messaging/activemq/server/LegacyConnectionFactoryConsumer.html" title="interface in org.wildfly.swarm.config.messaging.activemq.server">LegacyConnectionFactoryConsumer</a><<a href="../../../../../../../../org/wildfly/swarm/config/messaging/activemq/server/LegacyConnectionFactoryConsumer.html" title="type parameter in LegacyConnectionFactoryConsumer">T</a>> after)</code> </td>
</tr>
</tbody>
</table>
<table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation">
<caption><span>Methods in <a href="../../../../../../../../org/wildfly/swarm/config/messaging/activemq/server/package-summary.html">org.wildfly.swarm.config.messaging.activemq.server</a> with parameters of type <a href="../../../../../../../../org/wildfly/swarm/config/messaging/activemq/server/LegacyConnectionFactoryConsumer.html" title="interface in org.wildfly.swarm.config.messaging.activemq.server">LegacyConnectionFactoryConsumer</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><code>default <a href="../../../../../../../../org/wildfly/swarm/config/messaging/activemq/server/LegacyConnectionFactoryConsumer.html" title="interface in org.wildfly.swarm.config.messaging.activemq.server">LegacyConnectionFactoryConsumer</a><<a href="../../../../../../../../org/wildfly/swarm/config/messaging/activemq/server/LegacyConnectionFactoryConsumer.html" title="type parameter in LegacyConnectionFactoryConsumer">T</a>></code></td>
<td class="colLast"><span class="typeNameLabel">LegacyConnectionFactoryConsumer.</span><code><span class="memberNameLink"><a href="../../../../../../../../org/wildfly/swarm/config/messaging/activemq/server/LegacyConnectionFactoryConsumer.html#andThen-org.wildfly.swarm.config.messaging.activemq.server.LegacyConnectionFactoryConsumer-">andThen</a></span>(<a href="../../../../../../../../org/wildfly/swarm/config/messaging/activemq/server/LegacyConnectionFactoryConsumer.html" title="interface in org.wildfly.swarm.config.messaging.activemq.server">LegacyConnectionFactoryConsumer</a><<a href="../../../../../../../../org/wildfly/swarm/config/messaging/activemq/server/LegacyConnectionFactoryConsumer.html" title="type parameter in LegacyConnectionFactoryConsumer">T</a>> after)</code> </td>
</tr>
</tbody>
</table>
</li>
</ul>
</li>
</ul>
</div>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../../../../overview-summary.html">Overview</a></li>
<li><a href="../package-summary.html">Package</a></li>
<li><a href="../../../../../../../../org/wildfly/swarm/config/messaging/activemq/server/LegacyConnectionFactoryConsumer.html" title="interface in org.wildfly.swarm.config.messaging.activemq.server">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../../../../../../../../overview-tree.html">Tree</a></li>
<li><a href="../../../../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../../../../help-doc.html">Help</a></li>
</ul>
<div class="aboutLanguage">WildFly Swarm API, 2017.5.0</div>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../../../../../../index.html?org/wildfly/swarm/config/messaging/activemq/server/class-use/LegacyConnectionFactoryConsumer.html" target="_top">Frames</a></li>
<li><a href="LegacyConnectionFactoryConsumer.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small>Copyright © 2017 <a href="http://www.jboss.org">JBoss by Red Hat</a>. All rights reserved.</small></p>
</body>
</html>
|
Victorian women of all ages now have access to the latest exercise, health and nutrition research and advice thanks to a series of fact sheets designed to give women the right information to make the right choices at different stages of their lives. The Active Women in Sport factsheet series, developed by Sports Medicine Australia – Victoria provide advice on topics ranging from nutrition and bone health for active women, to exercise during pregnancy to exercising at a young and older age.
For more information on these resources visit Sports Medicine Australia - Victoria. |
using System;
using System.Collections.Concurrent;
using ReminderService.Router.Consumers;
using ReminderService.Router.Topics;
using log4net;
using ReminderService.Router.MessageInterfaces;
namespace ReminderService.Router
{
public class Bus_Multiplexer : IBus
{
private static readonly ILog Logger = LogManager.GetLogger(typeof(Bus));
private readonly ITopicFactory<Type> _messageTypeTopics = new MessageTypeTopics();
private readonly ConcurrentDictionary<string, Multiplexer<IMessage>> _subscribers
= new ConcurrentDictionary<string, Multiplexer<IMessage>>();
private readonly ConcurrentDictionary<string, IDispatchMessages> _queryHandlers
= new ConcurrentDictionary<string, IDispatchMessages> ();
// public Bus (ITopicFactory<Type> topicFactory)
// {
// Ensure.NotNull (topicFactory, "topicFactory");
// _messageTypeTopics = topicFactory;
// }
public void Send(IMessage message)
{
var topics = _messageTypeTopics.GetTopicsFor(message.GetType());
foreach (var topic in topics)
{
SendToTopic(topic, message);
}
}
public TResponse Send<TResponse>(IRequest<TResponse> query)
{
throw new NotImplementedException();
}
private void SendToTopic(string topic, IMessage message)
{
Multiplexer<IMessage> multiplexer;
if (_subscribers.TryGetValue(topic, out multiplexer))
multiplexer.Handle(message);
}
public void Subscribe<T>(IConsume<T> consumer) where T : class, IMessage
{
var wideningConsumer = new WideningConsumer<T, IMessage>(consumer);
_subscribers.AddOrUpdate (
typeof(T).FullName,
s =>
new Multiplexer<IMessage> (wideningConsumer),
(_, multiplexer) => {
multiplexer.Attach (wideningConsumer);
return multiplexer;
});
}
public void Subscribe<TRequest, TResponse> (IHandleQueries<TRequest, TResponse> queryhandler) where TRequest : IRequest<TResponse>
{
throw new NotImplementedException ();
// if (_queryHandlers.ContainsKey(typeof(TRequest).FullName))
// throw new InvalidOperationException(string.Format("There is already a query handler registered to handle messages of type [{0}]", typeof(TRequest).FullName));
//
// _queryHandlers.AddOrUpdate (
// typeof(TRequest).FullName,
// r =>
// new MessageDispatcher<TRequest>(queryhandler),
// (r, multiplexer) => {
// multiplexer.Attach (queryhandler);
// return multiplexer;
// });
}
public void ClearSubscribers()
{
_subscribers.Clear();
}
}
}
|
Eleectra . TeenyMegan. SarahCrofte. VickyLeeX.
AliceSweet1BlackSweetForUSophieGoddessTSKarollAndre .mmSweetBabyDollKimmYukiMikypolTits4USensual .AlexAndJoannaNatochkaMelissaNRoksanaADRIANTOKE .LindaSweetCandyTammyMagistralTits4USensualmmSweetBabyDoll .AzaleaFayLadyNVickiBeefyManlyManAlexisShine .BustyAvroraCarllaBradleyEdward4DominicIvyStar .INDIANLATINADebbiePlayKissamoredoll25myfeet89 .SWETSUEatServiceBonnieSoBeautyGirlforGameAirWavhe .AdrianysUrCuteBrazilianMarinaSugarySweetheartTanyaConner .SaraLooveSarahCrofteSarahCrofteLuxuryHouseWife .AzaleaFayJessycute77SWETSUEatServiceCarllaBradley .
SleepingBeauticonoryloganPaulaGoldGirlforGame .Browniec4USexyAylin4uSophieGoddessTSLannaAndDass .LoraLittleGirlforGameLovelyBertaMistressNicky .AlexAndJoannaPaulaGoldTammyMagistralConnyBella .MikypolAdrianysUrCute1SweetSEXbitchViliamS .NatochkaSandraDiRoseSarahCrofteLidiaWalker .ViolettFoolAzaleaFayROMEROFORJULIETALyndaSteele .BrazilianMarinaAirWavheBeefyManlyManPaulaGold .LylaKitty1SweetSEXbitchAlexisShineLadyNVicki .SWETSUEatServiceJennyPageAlexAndJoannaMicaeladolly .LyndaSteeleTanyaConnerLenaWilkinJayWish . |
Property Location With a stay at Boscolo Budapest, Autograph Collection, you'll be centrally located in Budapest, steps from Claustrophilia and minutes from Blaha Lujza Square. This 5-star hotel is within close proximity of MindQuest and Locked Up.Rooms Make yourself at home in one of the 185 air-conditioned rooms featuring minibars and LCD televisions. Complimentary wireless Internet access keeps you connected, and satellite programming is available for your entertainment. Private bathrooms with shower/tub combinations feature complimentary toiletries and bidets. Conveniences include safes and desks, and housekeeping is provided daily.Rec, Spa, Premium Amenities Pamper yourself with a visit to the spa, which offers massages, body treatments, and facials. If you're looking for recreational opportunities, you'll find an indoor pool, a sauna, and a steam room. Additional amenities include complimentary wireless Internet access, concierge services, and a hair salon.Dining Enjoy a meal at a restaurant or in a coffee shop/café. Or stay in and take advantage of the hotel's 24-hour room service. Quench your thirst with your favorite drink at a bar/lounge.Business, Other Amenities Featured amenities include a business center, limo/town car service, and a computer station. Event facilities at this hotel consist of conference space and meeting rooms. Guests may use a roundtrip airport shuttle for a surcharge, and self parking (subject to charges) is available onsite. Pets not allowed Check-in time starts at 3 PM Check-out time is noon Enjoy a meal at a restaurant or in a coffee shop/café. Or stay in and take advantage of the hotel's 24-hour room service. Quench your thirst with your favorite drink at a bar/lounge. Extra-person charges may apply and vary depending on hotel policy. Government-issued photo identification and a credit card or cash deposit are required at check-in for incidental charges. Special requests are subject to availability upon check-in and may incur additional charges. Special requests cannot be guaranteed. Pamper yourself with a visit to the spa, which offers massages, body treatments, and facials. If you're looking for recreational opportunities, you'll find an indoor pool, a sauna, and a steam room. Additional amenities include complimentary wireless Internet access, concierge services, and a hair salon. Make yourself at home in one of the 185 air-conditioned rooms featuring minibars and LCD televisions. Complimentary wireless Internet access keeps you connected, and satellite programming is available for your entertainment. Private bathrooms with shower/tub combinations feature complimentary toiletries and bidets. Conveniences include safes and desks, and housekeeping is provided daily. |
This Giant variety can spread to 25 inches. Give it space to grow for full development or plant closer together and take leaves at all sizes. Tender leaves are great for canning, steaming or salads. An heirloom introduced in 1926.
A teaspoon of Noble Spinach Seeds. That is the easiest way for me to measure. |
For most youngsters around the world playing Mario games would be most nostalgic moment. The Mario games are unique virtual sports that were designed more than three decades ago. Since their establishment, they have continuously released appealing plays that have really withstood the test of time. Mario games have always been most popular games among youngsters and its unique gameplay have always been impressive. Every game released in the market features unique and unavoidably addictive features that will compel you to continue playing throughout. The mymariogames.co.uk is one of the stand-alone online gaming networks available in market that would be right place to check out for people who were looking for super mario bros online games. If you are a virtual gaming aficionado, there is a bigger collection of Mario games you can play such as: Mario runner; Super Mario Revived; Super Mario Soccer, poker, Tetris, Coins, Rampage, Remix and Quiz and Zombie Mario among others. The diverse collection will help you to keep playing for several hours without getting bored. Everyone can now enjoy all the amazing adventures that are featuring all the favorite characters. The online gaming site have hundreds of games in mario kart for you. The mymariogames.co.uk online gaming network has wide collections of games such as: Mario’s revenge, Super Mario dress up, Mario Combat, Mario and Friends, Mario Bros and Motocross, Mario Stacker, Mario’s Revenge and Paper Mario World among others. The designers of these games intended to test your smartness and speed of thinking. Go through the various stages or play with sonic that will help to rekindle the nostalgic memories in front of your NES. Many of the characters featured in the games have appeared in earlier games. The integration of the different activities makes it possible for you to play the games for several hours without getting bored. Your task as the player in the game would involve fighting villains, controlling battles, race around and race around. For more information and unique collection of Mario games, please feel free to check out the above-mentioned link. |
The hotel offers a restaurant. A bar/lounge is on site where guests can unwind with a drink. This Art Deco hotel also offers an outdoor pool, room service (during limited hours), and beach/pool umbrellas.
Kilavuz Hotel Pension has designated areas for smoking.
Kilavuz Hotel Pension offers 15 accommodations. Bathrooms include showers. Housekeeping is provided daily.
Kilavuz Hotel Pension has a restaurant on site.
Located in Bodrum City Center, this hotel is within a 10-minute walk of Bodrum Beach, Bodrum Castle, and Museum of Underwater Archaeology. Bodrum Windmills is 1.8 mi (2.9 km) away.
This hotel features a restaurant, an outdoor pool, and a bar/lounge. Other amenities include a 24-hour front desk.
Rooms offer room service and showers. |
/*
* 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.commons.configuration2;
import java.util.Iterator;
import org.apache.commons.configuration2.ex.ConfigurationException;
import org.apache.commons.configuration2.io.FileHandler;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
* A configuration based on the system properties.
*
* @author Emmanuel Bourg
* @version $Id$
* @since 1.1
*/
public class SystemConfiguration extends MapConfiguration
{
/** The logger. */
private static Log log = LogFactory.getLog(SystemConfiguration.class);
/**
* Create a Configuration based on the system properties.
*
* @see System#getProperties
*/
public SystemConfiguration()
{
super(System.getProperties());
}
/**
* Sets system properties from a file specified by its file name. This is
* just a short cut for {@code setSystemProperties(null, fileName)}.
*
* @param fileName The name of the property file.
* @throws ConfigurationException if an error occurs.
* @since 1.6
*/
public static void setSystemProperties(String fileName)
throws ConfigurationException
{
setSystemProperties(null, fileName);
}
/**
* Sets system properties from a file specified using its base path and
* file name. The file can either be a properties file or an XML properties
* file. It is loaded, and all properties it contains are added to system
* properties.
*
* @param basePath The base path to look for the property file.
* @param fileName The name of the property file.
* @throws ConfigurationException if an error occurs.
* @since 1.6
*/
public static void setSystemProperties(String basePath, String fileName)
throws ConfigurationException
{
FileBasedConfiguration config =
fileName.endsWith(".xml") ? new XMLPropertiesConfiguration()
: new PropertiesConfiguration();
FileHandler handler = new FileHandler(config);
handler.setBasePath(basePath);
handler.setFileName(fileName);
handler.load();
setSystemProperties(config);
}
/**
* Set System properties from a configuration object.
* @param systemConfig The configuration containing the properties to be set.
* @since 1.6
*/
public static void setSystemProperties(Configuration systemConfig)
{
Iterator<String> iter = systemConfig.getKeys();
while (iter.hasNext())
{
String key = iter.next();
String value = (String) systemConfig.getProperty(key);
if (log.isDebugEnabled())
{
log.debug("Setting system property " + key + " to " + value);
}
System.setProperty(key, value);
}
}
/**
* {@inheritDoc} This implementation returns a snapshot of the keys in the
* system properties. If another thread modifies system properties concurrently,
* these changes are not reflected by the iterator returned by this method.
*/
@Override
protected Iterator<String> getKeysInternal()
{
return System.getProperties().stringPropertyNames().iterator();
}
}
|
Zerb is an A4, full colour, high quality magazine, distributed to the GTC membership, as well as relevant and interested parties from around the world. It is also available on subscription.
GTC In Focus is an A4, full colour newsletter, distributed only to GTC members. It closely reflects the work of the organisation and membership.
The GTC website you are viewing aims to be informative, entertaining, interactive and full of news and views – the kind of site members will want to return to regularly, as there will always be something new to look at and read.
It is a great resource of information for cameramen as well as providing them with a useful promotional tool through our Search for a Cameraman service.
Just send us your HTML code and we will send an email directly to the membership and to other interested parties. They are sent to over 1,400 verified email addresses.
Our MailChimp emails are sent out to the membership on an irregular basis. They are used to inform the membership of impending events between issues of GTC In Focus.
They are sent to over 1,400 verified email addresses. |
The first season of Happy on SyFy was a pleasant surprise for me. All the previews looked really silly and didn’t do much to capture my interest. On a whim I decided to give the first episode a view. All I can say is WOW! |
#include <fstream>
#include <boost/network/include/http/client.hpp>
#include "Osmosis/Chain/Http/Connection.h"
#include "Osmosis/Chain/ObjectStoreConnectionInterface.h"
#include "Osmosis/ObjectStore/DirectoryNames.h"
namespace Osmosis {
namespace Chain {
namespace Http
{
Connection::Connection( const std::string & url ):
_url( url )
{}
void Connection::putString( const std::string & blob, const Hash & hash )
{
THROW( Error, "'http://' object store does not support the putString operation "
"(this kind of object store can only be used for checkout operations "
"as the last in the chain)" );
}
std::string Connection::getString( const Hash & hash )
{
BACKTRACE_BEGIN
boost::network::http::client::request request( hashUrl( hash ) );
boost::network::http::client::response response = _client.get( request );
std::ostringstream out;
out << boost::network::http::body( response );
return std::move( out.str() );
BACKTRACE_END_VERBOSE( "Hash " << hash );
}
void Connection::putFile( const boost::filesystem::path & path, const Hash & hash )
{
THROW( Error, "'http://' object store does not support the putFile operation "
"(this kind of object store can only be used for checkout operations "
"as the last in the chain)" );
}
void Connection::getFile( const boost::filesystem::path & path, const Hash & hash )
{
BACKTRACE_BEGIN
boost::network::http::client::request request( hashUrl( hash ) );
boost::network::http::client::response response = _client.get( request );
std::ofstream out( path.string(), std::ios::out | std::ios::binary );
out << boost::network::http::body( response );
BACKTRACE_END_VERBOSE( "Path " << path << " Hash " << hash );
}
bool Connection::exists( const Hash & hash )
{
BACKTRACE_BEGIN
boost::network::http::client::request request( hashUrl( hash ) );
boost::network::http::client::response response = _client.head( request );
auto status = boost::network::http::status( response );
return status == 200;
BACKTRACE_END_VERBOSE( "Hash " << hash );
}
void Connection::verify( const Hash & hash )
{}
void Connection::eraseLabel( const std::string & label )
{
THROW( Error, "'http://' object store does not support the eraseLabel operation "
"(this kind of object store can only be used for checkout operations "
"as the last in the chain)" );
}
void Connection::setLabel( const Hash & hash, const std::string & label )
{
THROW( Error, "'http://' object store does not support the setLabel operation "
"(this kind of object store can only be used for checkout operations "
"as the last in the chain)" );
}
Hash Connection::getLabel( const std::string & label )
{
BACKTRACE_BEGIN
std::string url = _url + "/" + ObjectStore::DirectoryNames::LABELS + "/" + label;
boost::network::http::client::request request( url );
boost::network::http::client::response response = _client.get( request );
std::ostringstream out;
out << boost::network::http::body( response );
return Hash( out.str() );
BACKTRACE_END_VERBOSE( "Label " << label );
}
void Connection::renameLabel( const std::string & currentLabel, const std::string & renameLabelTo )
{
THROW( Error, "'http://' object store does not support the renameLabel operation "
"(this kind of object store can only be used for checkout operations "
"as the last in the chain)" );
}
std::list< std::string > Connection::listLabels( const std::string & regex )
{
BACKTRACE_BEGIN
if ( regex[ 0 ] != '^' and regex[ regex.size() - 1 ] != '$' )
THROW( Error, "'http://' object store does not support the listLabels operation "
"(this kind of object store can only be used for checkout operations "
"as the last in the chain)" );
std::string label = regex.substr( 1, regex.size() - 2 );
std::string url = _url + "/" + ObjectStore::DirectoryNames::LABELS + "/" + label;
boost::network::http::client::request request( url );
boost::network::http::client::response response = _client.head( request );
std::list< std::string > result;
auto status = boost::network::http::status( response );
if ( status == 200 )
result.push_back( label );
return result;
BACKTRACE_END_VERBOSE( "Regex " << regex );
}
std::string Connection::hashUrl( const Hash & hash )
{
return _url + "/" + hash.relativeFilename().string();
}
} // namespace Http
} // namespace Chain
} // namespace Osmosis
|
Tim McGraw Soul2Soul Vintage cologne, a fougere oriental fragrance for men launched in February 2013. The original Soul2Soul bottle with a beige tint and cap. Available in 1oz eau de toilette spray, $24 at Kohl's.
Tim McGraw SOUL2SOUL Vintage is a modern fragrance that portrays the intimate side of Tim while carrying on the timeless American love story between two souls.
The fragrance is a class fougere oriental that blends approachable masculinity with sensibility. It opens up with Zesty Mandarin, invigorating Ginger Root and Lavender. The heart of the fragrance is made up of sensual spicy notes of Cardamom Absolute and Cinnamon Bark, mixed with Moroccan Orange Flower. The dry-down consists of Cedar Leaf, Cashmeran and Tonka Bean Absolute.
SOUL2SOUL Vintage Tim McGraw The packaging is masculine and confident with a weathered pattern on a khaki carton, wrapped with a ribbon symbolic of special memories that are tied and stored away. |
/*
* wm8940.h -- WM8940 Soc Audio driver
*
* 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.
*/
#ifndef _WM8940_H
#define _WM8940_H
struct wm8940_setup_data {
/* Vref to analogue output resistance */
#define WM8940_VROI_1K 0
#define WM8940_VROI_30K 1
unsigned int vroi:1;
};
/* WM8940 register space */
#define WM8940_SOFTRESET 0x00
#define WM8940_POWER1 0x01
#define WM8940_POWER2 0x02
#define WM8940_POWER3 0x03
#define WM8940_IFACE 0x04
#define WM8940_COMPANDINGCTL 0x05
#define WM8940_CLOCK 0x06
#define WM8940_ADDCNTRL 0x07
#define WM8940_GPIO 0x08
#define WM8940_CTLINT 0x09
#define WM8940_DAC 0x0A
#define WM8940_DACVOL 0x0B
#define WM8940_ADC 0x0E
#define WM8940_ADCVOL 0x0F
#define WM8940_NOTCH1 0x10
#define WM8940_NOTCH2 0x11
#define WM8940_NOTCH3 0x12
#define WM8940_NOTCH4 0x13
#define WM8940_NOTCH5 0x14
#define WM8940_NOTCH6 0x15
#define WM8940_NOTCH7 0x16
#define WM8940_NOTCH8 0x17
#define WM8940_DACLIM1 0x18
#define WM8940_DACLIM2 0x19
#define WM8940_ALC1 0x20
#define WM8940_ALC2 0x21
#define WM8940_ALC3 0x22
#define WM8940_NOISEGATE 0x23
#define WM8940_PLLN 0x24
#define WM8940_PLLK1 0x25
#define WM8940_PLLK2 0x26
#define WM8940_PLLK3 0x27
#define WM8940_ALC4 0x2A
#define WM8940_INPUTCTL 0x2C
#define WM8940_PGAGAIN 0x2D
#define WM8940_ADCBOOST 0x2F
#define WM8940_OUTPUTCTL 0x31
#define WM8940_SPKMIX 0x32
#define WM8940_SPKVOL 0x36
#define WM8940_MONOMIX 0x38
#define WM8940_CACHEREGNUM 0x57
/* Clock divider Id's */
#define WM8940_BCLKDIV 0
#define WM8940_MCLKDIV 1
#define WM8940_OPCLKDIV 2
/* MCLK clock dividers */
#define WM8940_MCLKDIV_1 0
#define WM8940_MCLKDIV_1_5 1
#define WM8940_MCLKDIV_2 2
#define WM8940_MCLKDIV_3 3
#define WM8940_MCLKDIV_4 4
#define WM8940_MCLKDIV_6 5
#define WM8940_MCLKDIV_8 6
#define WM8940_MCLKDIV_12 7
/* BCLK clock dividers */
#define WM8940_BCLKDIV_1 0
#define WM8940_BCLKDIV_2 1
#define WM8940_BCLKDIV_4 2
#define WM8940_BCLKDIV_8 3
#define WM8940_BCLKDIV_16 4
#define WM8940_BCLKDIV_32 5
/* PLL Out Dividers */
#define WM8940_OPCLKDIV_1 0
#define WM8940_OPCLKDIV_2 1
#define WM8940_OPCLKDIV_3 2
#define WM8940_OPCLKDIV_4 3
#endif /* _WM8940_H */
|
#ifndef __ASM_ARM_CACHETYPE_H
#define __ASM_ARM_CACHETYPE_H
#define CACHEID_VIVT (1 << 0)
#define CACHEID_VIPT_NONALIASING (1 << 1)
#define CACHEID_VIPT_ALIASING (1 << 2)
#define CACHEID_VIPT (CACHEID_VIPT_ALIASING|CACHEID_VIPT_NONALIASING)
#define CACHEID_ASID_TAGGED (1 << 3)
#define CACHEID_VIPT_I_ALIASING (1 << 4)
extern unsigned int cacheid;
#define cache_is_vivt() cacheid_is(CACHEID_VIVT)
#define cache_is_vipt() cacheid_is(CACHEID_VIPT)
#define cache_is_vipt_nonaliasing() cacheid_is(CACHEID_VIPT_NONALIASING)
#define cache_is_vipt_aliasing() cacheid_is(CACHEID_VIPT_ALIASING)
#define icache_is_vivt_asid_tagged() cacheid_is(CACHEID_ASID_TAGGED)
#define icache_is_vipt_aliasing() cacheid_is(CACHEID_VIPT_I_ALIASING)
/*
* __LINUX_ARM_ARCH__ is the minimum supported CPU architecture
* Mask out support which will never be present on newer CPUs.
* - v6+ is never VIVT
* - v7+ VIPT never aliases on D-side
*/
#if __LINUX_ARM_ARCH__ >= 7
#define __CACHEID_ARCH_MIN (CACHEID_VIPT_NONALIASING |\
CACHEID_ASID_TAGGED |\
CACHEID_VIPT_I_ALIASING)
#elif __LINUX_ARM_ARCH__ >= 6
#define __CACHEID_ARCH_MIN (~CACHEID_VIVT)
#else
#define __CACHEID_ARCH_MIN (~0)
#endif
/*
* Mask out support which isn't configured
*/
#if defined(CONFIG_CPU_CACHE_VIVT) && !defined(CONFIG_CPU_CACHE_VIPT)
#define __CACHEID_ALWAYS (CACHEID_VIVT)
#define __CACHEID_NEVER (~CACHEID_VIVT)
#elif !defined(CONFIG_CPU_CACHE_VIVT) && defined(CONFIG_CPU_CACHE_VIPT)
#define __CACHEID_ALWAYS (0)
#define __CACHEID_NEVER (CACHEID_VIVT)
#else
#define __CACHEID_ALWAYS (0)
#define __CACHEID_NEVER (0)
#endif
static inline unsigned int __attribute__((pure)) cacheid_is(unsigned int mask)
{
return (__CACHEID_ALWAYS & mask) |
(~__CACHEID_NEVER & __CACHEID_ARCH_MIN & mask & cacheid);
}
#endif
|
InvestorsAlly Realty has started a business brokerage unit in 2013. The following are opportunities of established businesses for sale.
In case you and your clients would like to see more detailed info of these business related investment properties, here are our company’s business purpose NDA templates ( 请下载并签署商业保密协议 ) for the agent ( https://app.box.com/s/1d2kuxpo0seemn378fn7 ) and for the buyers ( https://app.box.com/s/1d2kuxpo0seemn378fn7 ) if you do not have one between you and your buyers already. Please email us a signed copy or fax it to us at 888-315-3831. Thanks!
An accredited SEVP certified career training school or private high school. The school is currently in operation and authorized to enroll international students. Boarding facilities could be arranged. Student capacity of 100 – 300.
An established home construction or remodeling company with existing revenue and clients in Southern California.
Hardware manufacturing companies valued between or $1 million to $2 million.
Companies with proprietary technologies in environmental protection, waste water treatment or biomass energy productions. |
/**
* DO NOT EDIT
*
* This file was automatically generated by
* https://github.com/Polymer/tools/tree/master/packages/gen-typescript-declarations
*
* To modify these typings, edit the source file(s):
* marked-import.js
*/
export {};
|
---
layout: sgpm-default-display
title:
author:
tags: ["1950s", "1960s", "1970s", "1980s", "1990s", "bhairahawa", "dharan", "gurkhas", "kathmandu", "nepal", "pokhara", "singapore", "singapore gurkha archive", "singapore gurkha old photographs", "singapore gurkha photography museum", "singapore gurkhas"]
credit:
source: -singapore-gurkhas-070216-gcspf-gurkha-contingent-archives-cbt-26
description: "Chandra Bahadur Thapa's brother-in-law. Was from British army."
copyright: ChandraBahadurThapa-SingaporeGurkhaPhotographyMuseum
slug: -singapore-gurkhas-070216-gcspf-gurkha-contingent-archives-cbt-26
date: 2014-10-07
img_path: singapore-gurkhas-070216-gcspf-gurkha-contingent-archives-cbt-26.jpg
category: singapore-gurkha-photography-museum
---
<h1></h1>
{{ site.tags }}
|
\subsection{A session on linearity}
\label{sec:session-linearity}
Session typing \cite{Honda1993,DBLP:conf/esop/HondaVK98} is a type
discipline for checking protocols statically. A session type is
ascribed to a communication channel and describes
a sequence of interactions. For instance, the type
\lstinline{int!int!int?end} specifies a protocol
where the program must send two integers, receive an integer, and then
close the channel.
%
In this context, channels must be used linearly, because every use of
a channel ``consumes'' one interaction and changes the type of the
channel. That is, after sending two integers on the channel,
the remaining channel has type \lstinline{int?end}.
%
Here are some standard type operators for session types \SType:
\begin{center}
\begin{tabular}[t]{rl}
$\tau ! \SType$ & Send a value of type $\tau$ then continue with $\SType$.\\
$\tau ? \SType$& Receive a value of type $\tau$ then continue with $\SType$.\\
$\SType \oplus \SType'$& Internal choice between protocols $\SType$ and $\SType'$.\\
$\SType \operatorname{\&} \SType'$
& Offer a choice between protocols $\SType$ and $\SType'$.
\end{tabular}
\end{center}
\citet{DBLP:journals/jfp/Padovani17} has shown how to encode this
style of session typing in ML-like languages, but his implementation
downgrades linearity to a run-time check for affinity. Building on that
encoding we can provide a safe API in \lang that statically enforces
linear handling of channels:
%
\begin{lstlisting}
type 'S st : lin (*@\label{line:session1}*)
val receive: ('a ? 'S) st -> 'a * 'S st (*@\label{line:session2}*)
val send : ('a ! 'S) st -> 'a -{lin}> 'S st
val create : unit -> 'S st * (dual 'S) st
val close : end st -> unit
\end{lstlisting}
% val send : ('a:'k). 'a -> ('a ! 'S) st -{'k}> 'S st
Line~\ref{line:session1} introduces a parameterized abstract
type \lstinline{st} which is linear as indicated
by its kind \lstinline{lin}. Its low-level implementation would wrap a
handle for a socket, for example. The \lstinline{receive} operation
in Line~\ref{line:session2} takes a channel that is ready to receive a
value of type \lstinline{'a} and returns a pair of the value a the
channel at its residual type \lstinline{'S}. It does not matter
whether \lstinline{'a} is restricted to be linear, in fact
\lstinline{receive} is polymorphic in the kind of \lstinline{'a}.
This kind polymorphism is the
default if no constraints are specified.
%
The \lstinline{send} operation takes a linear channel and returns a
single-use function that takes a value of type \lstinline{'a} suitable
for sending and returns the channel with updated type.
%
The \lstinline{create} operation returns a pair of channel
endpoints. They follow dual communication protocols, where the
\lstinline{dual} operator swaps sending and receiving operations.
%
Finally, \lstinline{close} closes the channel.
In \cref{fig:sessiontype} we show how to use these primitives to
implement client and server for an addition service.
No linearity annotations are needed in the code, as all linearity
properties can be inferred from the linearity of the \texttt{st} type.
The inferred type of the server, \lstinline{add_service}, is
\lstinline{(int ! int ! int ? end) st -> unit}.
The client operates by sending two messages
and receiving the result.
This code is polymorphic in both argument and return types, so it could
be used with any binary operator.
%
\begin{figure}[!h]
\begin{subfigure}[t]{0.5\linewidth}
\begin{lstlisting}
let add_service ep =
let x, ep = receive ep in
let y, ep = receive ep in
let ep = send ep (x + y) in
close ep
# add_service : (int ! int ! int ? end) st -> unit
\end{lstlisting}
\vspace{-5pt}
\caption{Addition server}
\end{subfigure}
\hfill
\begin{subfigure}[t]{0.45\linewidth}
\begin{lstlisting}
let op_client ep x y =
let ep = send ep x in
let ep = send ep y in
let result, ep = receive ep in
close ep;
result
# op_client :
('a_1 ? 'a_2 ? 'b ! end) st -> 'a_1 -{lin}> 'a_2 -{lin}> 'b
\end{lstlisting}
% The actual answer from the typechecker looks like this:
% # ('m2:^k2), ('m1:^k1).
% # (^k1 < ^k) & (lin < ^k) =>
% # ('m1 ?'m2 ? 'result ! end) st -> 'm1 -{lin}> 'm2 -{^k}> 'result
\vspace{-5pt}
\caption{Binary operators client}
\end{subfigure}
\vspace{-10pt}
\caption{Corresponding session type programs in \lang}
\label{fig:sessiontype}
\end{figure}
%
Moreover, the \lstinline/op_client/ function can be partially applied
to a channel. Since the closure returned by such a partial application
captures the channel, it can only be used once. This restriction is
reflected by the arrow of kind \lstinline{lin}, \lstinline/-{lin}>/,
which is the type of a single-use function.
The general form of
arrow types in \lang is \lstinline/-{k}>/, where \lstinline/kk/ is a
kind that restricts the number of uses of the function. For
convenience, we shorten \lstinline/-{un}>/ to \lstinline/->/. \lang
infers the
single-use property of the arrows without any user
annotation. In fact, the only difference between the
code presented here and Padovani's examples
\cite{DBLP:journals/jfp/Padovani17} is the kind annotation on the
type definition of \lstinline/st/.
To run client and server, we can create a channel and apply
\lstinline{add_service} to one end and \lstinline{op_client} to the other.
Failure to consume either channel endpoints (\lstinline/a/ or \lstinline/b/)
would result in a type error.
\begin{lstlisting}
let main () =
let (a, b) = create () in
fork add_service a;
op_client b 1 2
# main : unit -> int
\end{lstlisting}
% \begin{figure}
% \centering
% \begin{lstlisting}
% val select : ('S st -{'k}> 'a) -> 'a ot -{'k}> ('S dual) st
% val branch : 'm it -> 'm
% \end{lstlisting}
% \caption{Session primitives}
% \label{api:session}
% \end{figure}
%%% Local Variables:
%%% mode: latex
%%% TeX-master: "main"
%%% End:
|
<!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"/>
<title>SteelBreeze Reference Manual: SBDBHLRecHS1 Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">SteelBreeze Reference Manual
 <span id="projectnumber">2.0.2</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- Generated by Doxygen 1.7.5.1 -->
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="pages.html"><span>Related Pages</span></a></li>
<li class="current"><a href="annotated.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
<li><a href="dirs.html"><span>Directories</span></a></li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="annotated.html"><span>Class List</span></a></li>
<li><a href="classes.html"><span>Class Index</span></a></li>
<li><a href="hierarchy.html"><span>Class Hierarchy</span></a></li>
<li><a href="functions.html"><span>Class Members</span></a></li>
</ul>
</div>
</div>
<div class="header">
<div class="summary">
<a href="#pub-methods">Public Member Functions</a> |
<a href="#pro-attribs">Protected Attributes</a> |
<a href="#friends">Friends</a> </div>
<div class="headertitle">
<div class="title">SBDBHLRecHS1 Class Reference</div> </div>
</div>
<div class="contents">
<!-- doxytag: class="SBDBHLRecHS1" --><!-- doxytag: inherits="SBDBHLRecPrefixed" -->
<p><code>#include <<a class="el" href="SbGeoObsVLBI__IO_8H_source.html">SbGeoObsVLBI_IO.H</a>></code></p>
<div class="dynheader">
Inheritance diagram for SBDBHLRecHS1:</div>
<div class="dyncontent">
<div class="center">
<img src="classSBDBHLRecHS1.png" usemap="#SBDBHLRecHS1_map" alt=""/>
<map id="SBDBHLRecHS1_map" name="SBDBHLRecHS1_map">
<area href="classSBDBHLRecPrefixed.html" alt="SBDBHLRecPrefixed" shape="rect" coords="0,56,130,80"/>
<area href="classSBDBHPhysRec.html" alt="SBDBHPhysRec" shape="rect" coords="0,0,130,24"/>
</map>
</div></div>
<p><a href="classSBDBHLRecHS1-members.html">List of all members.</a></p>
<table class="memberdecls">
<tr><td colspan="2"><h2><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classSBDBHLRecHS1.html#a76976b7242e7383e4397a32177cf378b">SBDBHLRecHS1</a> ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="classSBDBHLRecHS1.html#a9c7224f48047df388ddbedf6c21d09d3">histLength</a> ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="classSBDBHLRecHS1.html#a060135ac178287a344340c86d317cabf">verNum</a> ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="classSBMJD.html">SBMJD</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="classSBDBHLRecHS1.html#ac8f81de81887536f4b5db64ace6888a5">date</a> ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classSBDBHLRecHS1.html#afc279341ddc9b08a1e765e5d30ec0694">isZ1</a> ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classSBDBHLRecHS1.html#a207a5e01433b32601f4ac3ce07870b25">isAlter</a> ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual int </td><td class="memItemRight" valign="bottom"><a class="el" href="classSBDBHLRecHS1.html#a53f45cbb8dd62533197919834596eec2">parseLR</a> (<a class="el" href="classSBDS__dbh.html">SBDS_dbh</a> &s)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classSBDBHLRecPrefixed.html#ae4b06b310cf1951d874ea7409b8c8bcf">isP</a> ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classSBDBHLRecPrefixed.html#a8adb99d6e636027a479fad946af3abd4">isPrefixParsed</a> (<a class="el" href="classSBDS__dbh.html">SBDS_dbh</a> &)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classSBDBHPhysRec.html#a072ba370e159dea36cf97cfafc355d9c">isOk</a> ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="classSBDBHPhysRec.html#a7575f9c7f4f1e2b753a4069ff832e045">length</a> ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual <a class="el" href="classSBDBHPar.html#a30c73725ca31a388a2d354552aab2bc0">SBDBHPar::PType</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="classSBDBHPhysRec.html#ae2c5a60d2997d001bd4112367b1a4272">type</a> ()</td></tr>
<tr><td colspan="2"><h2><a name="pro-attribs"></a>
Protected Attributes</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">short </td><td class="memItemRight" valign="bottom"><a class="el" href="classSBDBHLRecHS1.html#ad82cfcd24dff5af2f87308d422caa03d">HistLength</a></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">short </td><td class="memItemRight" valign="bottom"><a class="el" href="classSBDBHLRecHS1.html#aff380f4a59953a15250116301536eb05">Date</a> [5]</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">short </td><td class="memItemRight" valign="bottom"><a class="el" href="classSBDBHLRecHS1.html#a35855628f207b8a1a7f01d3e6d0358f7">VerNum</a></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">char </td><td class="memItemRight" valign="bottom"><a class="el" href="classSBDBHLRecPrefixed.html#a47d89f9f78cae1d7447e2c43cc0b23b1">Prefix</a> [2]</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">char </td><td class="memItemRight" valign="bottom"><a class="el" href="classSBDBHLRecPrefixed.html#a8473e562daca89000eabd265fe36c939">P</a> [3]</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="classSBDBHPhysRec.html#abb37a50c3005431679135e9e3c11a1d3">Length</a></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">char * </td><td class="memItemRight" valign="bottom"><a class="el" href="classSBDBHPhysRec.html#ad4c598f4e7884322181d3be1ebf34aca">LogRec</a></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classSBDBHPhysRec.html#ab3c52c4dcef95efe16eecc10f58085b5">isOK</a></td></tr>
<tr><td colspan="2"><h2><a name="friends"></a>
Friends</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="classSBDS__dbh.html">SBDS_dbh</a> & </td><td class="memItemRight" valign="bottom"><a class="el" href="classSBDBHPhysRec.html#a3df8c2b6d90d751eac16f59e1885c9f4">operator>></a> (<a class="el" href="classSBDS__dbh.html">SBDS_dbh</a> &, <a class="el" href="classSBDBHPhysRec.html">SBDBHPhysRec</a> &)</td></tr>
</table>
<hr/><a name="details" id="details"></a><h2>Detailed Description</h2>
<div class="textblock">
<p>Definition at line <a class="el" href="SbGeoObsVLBI__IO_8H_source.html#l00155">155</a> of file <a class="el" href="SbGeoObsVLBI__IO_8H_source.html">SbGeoObsVLBI_IO.H</a>.</p>
</div><hr/><h2>Constructor & Destructor Documentation</h2>
<a class="anchor" id="a76976b7242e7383e4397a32177cf378b"></a><!-- doxytag: member="SBDBHLRecHS1::SBDBHLRecHS1" ref="a76976b7242e7383e4397a32177cf378b" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">SBDBHLRecHS1::SBDBHLRecHS1 </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td><code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Definition at line <a class="el" href="SbGeoObsVLBI__IO_8H_source.html#l00162">162</a> of file <a class="el" href="SbGeoObsVLBI__IO_8H_source.html">SbGeoObsVLBI_IO.H</a>.</p>
<p>References <a class="el" href="SbGeoObsVLBI__IO_8H_source.html#l00159">Date</a>, <a class="el" href="SbGeoObsVLBI__IO_8H_source.html#l00158">HistLength</a>, and <a class="el" href="SbGeoObsVLBI__IO_8H_source.html#l00160">VerNum</a>.</p>
</div>
</div>
<hr/><h2>Member Function Documentation</h2>
<a class="anchor" id="ac8f81de81887536f4b5db64ace6888a5"></a><!-- doxytag: member="SBDBHLRecHS1::date" ref="ac8f81de81887536f4b5db64ace6888a5" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classSBMJD.html">SBMJD</a> SBDBHLRecHS1::date </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td><code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Definition at line <a class="el" href="SbGeoObsVLBI__IO_8H_source.html#l00166">166</a> of file <a class="el" href="SbGeoObsVLBI__IO_8H_source.html">SbGeoObsVLBI_IO.H</a>.</p>
<p>References <a class="el" href="SbGeoObsVLBI__IO_8H_source.html#l00159">Date</a>.</p>
<p>Referenced by <a class="el" href="SbGeoObsVLBI__IO_8H_source.html#l00396">SBDBHHistTriplet::date()</a>, and <a class="el" href="SbGeoObsVLBI__IO_8H_source.html#l00399">SBDBHHistTriplet::dump()</a>.</p>
</div>
</div>
<a class="anchor" id="a9c7224f48047df388ddbedf6c21d09d3"></a><!-- doxytag: member="SBDBHLRecHS1::histLength" ref="a9c7224f48047df388ddbedf6c21d09d3" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int SBDBHLRecHS1::histLength </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td><code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Definition at line <a class="el" href="SbGeoObsVLBI__IO_8H_source.html#l00164">164</a> of file <a class="el" href="SbGeoObsVLBI__IO_8H_source.html">SbGeoObsVLBI_IO.H</a>.</p>
<p>References <a class="el" href="SbGeoObsVLBI__IO_8H_source.html#l00158">HistLength</a>.</p>
<p>Referenced by <a class="el" href="SbGeoObsVLBI__IO_8C_source.html#l02478">operator>>()</a>.</p>
</div>
</div>
<a class="anchor" id="a207a5e01433b32601f4ac3ce07870b25"></a><!-- doxytag: member="SBDBHLRecHS1::isAlter" ref="a207a5e01433b32601f4ac3ce07870b25" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">virtual bool SBDBHLRecHS1::isAlter </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td><code> [inline, virtual]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Reimplemented from <a class="el" href="classSBDBHLRecPrefixed.html#afc5d48393d419592b2c658eb3ba4405f">SBDBHLRecPrefixed</a>.</p>
<p>Definition at line <a class="el" href="SbGeoObsVLBI__IO_8H_source.html#l00168">168</a> of file <a class="el" href="SbGeoObsVLBI__IO_8H_source.html">SbGeoObsVLBI_IO.H</a>.</p>
<p>References <a class="el" href="SbGeoObsVLBI__IO_8H_source.html#l00167">isZ1()</a>.</p>
</div>
</div>
<a class="anchor" id="a072ba370e159dea36cf97cfafc355d9c"></a><!-- doxytag: member="SBDBHLRecHS1::isOk" ref="a072ba370e159dea36cf97cfafc355d9c" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool SBDBHPhysRec::isOk </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td><code> [inline, inherited]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Definition at line <a class="el" href="SbGeoObsVLBI__IO_8H_source.html#l00117">117</a> of file <a class="el" href="SbGeoObsVLBI__IO_8H_source.html">SbGeoObsVLBI_IO.H</a>.</p>
<p>References <a class="el" href="SbGeoObsVLBI__IO_8H_source.html#l00112">SBDBHPhysRec::isOK</a>.</p>
<p>Referenced by <a class="el" href="SbGeoObsVLBI__IO_8C_source.html#l02478">operator>>()</a>.</p>
</div>
</div>
<a class="anchor" id="ae4b06b310cf1951d874ea7409b8c8bcf"></a><!-- doxytag: member="SBDBHLRecHS1::isP" ref="ae4b06b310cf1951d874ea7409b8c8bcf" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool SBDBHLRecPrefixed::isP </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td><code> [inline, inherited]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Definition at line <a class="el" href="SbGeoObsVLBI__IO_8H_source.html#l00140">140</a> of file <a class="el" href="SbGeoObsVLBI__IO_8H_source.html">SbGeoObsVLBI_IO.H</a>.</p>
<p>References <a class="el" href="SbGeoObsVLBI__IO_8H_source.html#l00137">SBDBHLRecPrefixed::P</a>, and <a class="el" href="SbGeoObsVLBI__IO_8H_source.html#l00136">SBDBHLRecPrefixed::Prefix</a>.</p>
<p>Referenced by <a class="el" href="SbGeoObsVLBI__IO_8H_source.html#l00393">SBDBHHistTriplet::isHistLine()</a>, <a class="el" href="SbGeoObsVLBI__IO_8C_source.html#l02389">SBDBHLRecPrefixed::isPrefixParsed()</a>, and <a class="el" href="SbGeoObsVLBI__IO_8C_source.html#l02478">operator>>()</a>.</p>
</div>
</div>
<a class="anchor" id="a8adb99d6e636027a479fad946af3abd4"></a><!-- doxytag: member="SBDBHLRecHS1::isPrefixParsed" ref="a8adb99d6e636027a479fad946af3abd4" args="(SBDS_dbh &)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool SBDBHLRecPrefixed::isPrefixParsed </td>
<td>(</td>
<td class="paramtype"><a class="el" href="classSBDS__dbh.html">SBDS_dbh</a> & </td>
<td class="paramname"><em>s</em></td><td>)</td>
<td><code> [virtual, inherited]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Definition at line <a class="el" href="SbGeoObsVLBI__IO_8C_source.html#l02389">2389</a> of file <a class="el" href="SbGeoObsVLBI__IO_8C_source.html">SbGeoObsVLBI_IO.C</a>.</p>
<p>References <a class="el" href="SbGeneral_8H_source.html#l00083">SBLog::DATA</a>, <a class="el" href="SbGeneral_8H_source.html#l00075">SBLog::ERR</a>, <a class="el" href="SbGeoObsVLBI__IO_8H_source.html#l00141">SBDBHLRecPrefixed::isAlter()</a>, <a class="el" href="SbGeoObsVLBI__IO_8H_source.html#l00112">SBDBHPhysRec::isOK</a>, <a class="el" href="SbGeoObsVLBI__IO_8H_source.html#l00140">SBDBHLRecPrefixed::isP()</a>, <a class="el" href="SbGeneral_8C_source.html#l00031">Log</a>, <a class="el" href="SbGeoObsVLBI__IO_8H_source.html#l00137">SBDBHLRecPrefixed::P</a>, <a class="el" href="SbGeoObsVLBI__IO_8H_source.html#l00136">SBDBHLRecPrefixed::Prefix</a>, and <a class="el" href="SbGeneral_8C_source.html#l00071">SBLog::write()</a>.</p>
<p>Referenced by <a class="el" href="SbGeoObsVLBI__IO_8H_source.html#l00143">SBDBHLRecPrefixed::parseLR()</a>, <a class="el" href="SbGeoObsVLBI__IO_8H_source.html#l00169">parseLR()</a>, <a class="el" href="SbGeoObsVLBI__IO_8H_source.html#l00203">SBDBHLRecTE::parseLR()</a>, <a class="el" href="SbGeoObsVLBI__IO_8C_source.html#l02411">SBDBHLRecTC::parseLR()</a>, <a class="el" href="SbGeoObsVLBI__IO_8H_source.html#l00254">SBDBHLRecDR::parseLR()</a>, <a class="el" href="SbGeoObsVLBI__IO_8C_source.html#l02435">SBDBHLRecDE::parseLR()</a>, and <a class="el" href="SbGeoObsVLBI__IO_8H_source.html#l00309">SBDBHLRecZ3::parseLR()</a>.</p>
</div>
</div>
<a class="anchor" id="afc279341ddc9b08a1e765e5d30ec0694"></a><!-- doxytag: member="SBDBHLRecHS1::isZ1" ref="afc279341ddc9b08a1e765e5d30ec0694" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool SBDBHLRecHS1::isZ1 </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td><code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Definition at line <a class="el" href="SbGeoObsVLBI__IO_8H_source.html#l00167">167</a> of file <a class="el" href="SbGeoObsVLBI__IO_8H_source.html">SbGeoObsVLBI_IO.H</a>.</p>
<p>References <a class="el" href="SbGeoObsVLBI__IO_8H_source.html#l00136">SBDBHLRecPrefixed::Prefix</a>.</p>
<p>Referenced by <a class="el" href="SbGeoObsVLBI__IO_8H_source.html#l00168">isAlter()</a>, and <a class="el" href="SbGeoObsVLBI__IO_8H_source.html#l00394">SBDBHHistTriplet::isLast()</a>.</p>
</div>
</div>
<a class="anchor" id="a7575f9c7f4f1e2b753a4069ff832e045"></a><!-- doxytag: member="SBDBHLRecHS1::length" ref="a7575f9c7f4f1e2b753a4069ff832e045" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int SBDBHPhysRec::length </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td><code> [inline, inherited]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Definition at line <a class="el" href="SbGeoObsVLBI__IO_8H_source.html#l00118">118</a> of file <a class="el" href="SbGeoObsVLBI__IO_8H_source.html">SbGeoObsVLBI_IO.H</a>.</p>
<p>References <a class="el" href="SbGeoObsVLBI__IO_8H_source.html#l00110">SBDBHPhysRec::Length</a>.</p>
<p>Referenced by <a class="el" href="SbGeoObsVLBI__IO_8C_source.html#l02478">operator>>()</a>.</p>
</div>
</div>
<a class="anchor" id="a53f45cbb8dd62533197919834596eec2"></a><!-- doxytag: member="SBDBHLRecHS1::parseLR" ref="a53f45cbb8dd62533197919834596eec2" args="(SBDS_dbh &s)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">virtual int SBDBHLRecHS1::parseLR </td>
<td>(</td>
<td class="paramtype"><a class="el" href="classSBDS__dbh.html">SBDS_dbh</a> & </td>
<td class="paramname"><em>s</em></td><td>)</td>
<td><code> [inline, virtual]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Reimplemented from <a class="el" href="classSBDBHLRecPrefixed.html#a3273aa8e88ecd68c29b2519a6e89f0df">SBDBHLRecPrefixed</a>.</p>
<p>Definition at line <a class="el" href="SbGeoObsVLBI__IO_8H_source.html#l00169">169</a> of file <a class="el" href="SbGeoObsVLBI__IO_8H_source.html">SbGeoObsVLBI_IO.H</a>.</p>
<p>References <a class="el" href="SbGeoObsVLBI__IO_8H_source.html#l00159">Date</a>, <a class="el" href="SbGeoObsVLBI__IO_8H_source.html#l00158">HistLength</a>, <a class="el" href="SbGeoObsVLBI__IO_8C_source.html#l02389">SBDBHLRecPrefixed::isPrefixParsed()</a>, and <a class="el" href="SbGeoObsVLBI__IO_8H_source.html#l00160">VerNum</a>.</p>
</div>
</div>
<a class="anchor" id="ae2c5a60d2997d001bd4112367b1a4272"></a><!-- doxytag: member="SBDBHLRecHS1::type" ref="ae2c5a60d2997d001bd4112367b1a4272" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">virtual <a class="el" href="classSBDBHPar.html#a30c73725ca31a388a2d354552aab2bc0">SBDBHPar::PType</a> SBDBHPhysRec::type </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td><code> [inline, virtual, inherited]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Reimplemented in <a class="el" href="classSBDBHDRecString.html#a73309c8a428a290c1eb6319cae440e0a">SBDBHDRecString</a>.</p>
<p>Definition at line <a class="el" href="SbGeoObsVLBI__IO_8H_source.html#l00119">119</a> of file <a class="el" href="SbGeoObsVLBI__IO_8H_source.html">SbGeoObsVLBI_IO.H</a>.</p>
<p>References <a class="el" href="SbGeoObsVLBI__IO_8H_source.html#l00076">SBDBHPar::T_UNKN</a>.</p>
</div>
</div>
<a class="anchor" id="a060135ac178287a344340c86d317cabf"></a><!-- doxytag: member="SBDBHLRecHS1::verNum" ref="a060135ac178287a344340c86d317cabf" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int SBDBHLRecHS1::verNum </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td><code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Definition at line <a class="el" href="SbGeoObsVLBI__IO_8H_source.html#l00165">165</a> of file <a class="el" href="SbGeoObsVLBI__IO_8H_source.html">SbGeoObsVLBI_IO.H</a>.</p>
<p>References <a class="el" href="SbGeoObsVLBI__IO_8H_source.html#l00160">VerNum</a>.</p>
<p>Referenced by <a class="el" href="SbGeoObsVLBI__IO_8H_source.html#l00399">SBDBHHistTriplet::dump()</a>, and <a class="el" href="SbGeoObsVLBI__IO_8H_source.html#l00395">SBDBHHistTriplet::verNum()</a>.</p>
</div>
</div>
<hr/><h2>Friends And Related Function Documentation</h2>
<a class="anchor" id="a3df8c2b6d90d751eac16f59e1885c9f4"></a><!-- doxytag: member="SBDBHLRecHS1::operator>>" ref="a3df8c2b6d90d751eac16f59e1885c9f4" args="(SBDS_dbh &, SBDBHPhysRec &)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classSBDS__dbh.html">SBDS_dbh</a>& operator>> </td>
<td>(</td>
<td class="paramtype"><a class="el" href="classSBDS__dbh.html">SBDS_dbh</a> & </td>
<td class="paramname"><em>s</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="classSBDBHPhysRec.html">SBDBHPhysRec</a> & </td>
<td class="paramname"><em>PH</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td><code> [friend, inherited]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Definition at line <a class="el" href="SbGeoObsVLBI__IO_8C_source.html#l02325">2325</a> of file <a class="el" href="SbGeoObsVLBI__IO_8C_source.html">SbGeoObsVLBI_IO.C</a>.</p>
</div>
</div>
<hr/><h2>Member Data Documentation</h2>
<a class="anchor" id="aff380f4a59953a15250116301536eb05"></a><!-- doxytag: member="SBDBHLRecHS1::Date" ref="aff380f4a59953a15250116301536eb05" args="[5]" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">short <a class="el" href="classSBDBHLRecHS1.html#aff380f4a59953a15250116301536eb05">SBDBHLRecHS1::Date</a>[5]<code> [protected]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Definition at line <a class="el" href="SbGeoObsVLBI__IO_8H_source.html#l00159">159</a> of file <a class="el" href="SbGeoObsVLBI__IO_8H_source.html">SbGeoObsVLBI_IO.H</a>.</p>
<p>Referenced by <a class="el" href="SbGeoObsVLBI__IO_8H_source.html#l00166">date()</a>, <a class="el" href="SbGeoObsVLBI__IO_8H_source.html#l00169">parseLR()</a>, and <a class="el" href="SbGeoObsVLBI__IO_8H_source.html#l00162">SBDBHLRecHS1()</a>.</p>
</div>
</div>
<a class="anchor" id="ad82cfcd24dff5af2f87308d422caa03d"></a><!-- doxytag: member="SBDBHLRecHS1::HistLength" ref="ad82cfcd24dff5af2f87308d422caa03d" args="" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">short <a class="el" href="classSBDBHLRecHS1.html#ad82cfcd24dff5af2f87308d422caa03d">SBDBHLRecHS1::HistLength</a><code> [protected]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Definition at line <a class="el" href="SbGeoObsVLBI__IO_8H_source.html#l00158">158</a> of file <a class="el" href="SbGeoObsVLBI__IO_8H_source.html">SbGeoObsVLBI_IO.H</a>.</p>
<p>Referenced by <a class="el" href="SbGeoObsVLBI__IO_8H_source.html#l00164">histLength()</a>, <a class="el" href="SbGeoObsVLBI__IO_8H_source.html#l00169">parseLR()</a>, and <a class="el" href="SbGeoObsVLBI__IO_8H_source.html#l00162">SBDBHLRecHS1()</a>.</p>
</div>
</div>
<a class="anchor" id="ab3c52c4dcef95efe16eecc10f58085b5"></a><!-- doxytag: member="SBDBHLRecHS1::isOK" ref="ab3c52c4dcef95efe16eecc10f58085b5" args="" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool <a class="el" href="classSBDBHPhysRec.html#ab3c52c4dcef95efe16eecc10f58085b5">SBDBHPhysRec::isOK</a><code> [protected, inherited]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Definition at line <a class="el" href="SbGeoObsVLBI__IO_8H_source.html#l00112">112</a> of file <a class="el" href="SbGeoObsVLBI__IO_8H_source.html">SbGeoObsVLBI_IO.H</a>.</p>
<p>Referenced by <a class="el" href="SbGeoObsVLBI__IO_8H_source.html#l00117">SBDBHPhysRec::isOk()</a>, <a class="el" href="SbGeoObsVLBI__IO_8C_source.html#l02389">SBDBHLRecPrefixed::isPrefixParsed()</a>, <a class="el" href="SbGeoObsVLBI__IO_8C_source.html#l02325">operator>>()</a>, <a class="el" href="SbGeoObsVLBI__IO_8C_source.html#l02411">SBDBHLRecTC::parseLR()</a>, <a class="el" href="SbGeoObsVLBI__IO_8C_source.html#l02435">SBDBHLRecDE::parseLR()</a>, <a class="el" href="SbGeoObsVLBI__IO_8H_source.html#l00338">SBDBHDRecString::parseLR()</a>, and <a class="el" href="SbGeoObsVLBI__IO_8H_source.html#l00114">SBDBHPhysRec::SBDBHPhysRec()</a>.</p>
</div>
</div>
<a class="anchor" id="abb37a50c3005431679135e9e3c11a1d3"></a><!-- doxytag: member="SBDBHLRecHS1::Length" ref="abb37a50c3005431679135e9e3c11a1d3" args="" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int <a class="el" href="classSBDBHPhysRec.html#abb37a50c3005431679135e9e3c11a1d3">SBDBHPhysRec::Length</a><code> [protected, inherited]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Definition at line <a class="el" href="SbGeoObsVLBI__IO_8H_source.html#l00110">110</a> of file <a class="el" href="SbGeoObsVLBI__IO_8H_source.html">SbGeoObsVLBI_IO.H</a>.</p>
<p>Referenced by <a class="el" href="SbGeoObsVLBI__IO_8H_source.html#l00118">SBDBHPhysRec::length()</a>, <a class="el" href="SbGeoObsVLBI__IO_8C_source.html#l02325">operator>>()</a>, <a class="el" href="SbGeoObsVLBI__IO_8H_source.html#l00120">SBDBHPhysRec::parseLR()</a>, <a class="el" href="SbGeoObsVLBI__IO_8H_source.html#l00366">SBDBHDRecT< short >::parseLR()</a>, and <a class="el" href="SbGeoObsVLBI__IO_8H_source.html#l00114">SBDBHPhysRec::SBDBHPhysRec()</a>.</p>
</div>
</div>
<a class="anchor" id="ad4c598f4e7884322181d3be1ebf34aca"></a><!-- doxytag: member="SBDBHLRecHS1::LogRec" ref="ad4c598f4e7884322181d3be1ebf34aca" args="" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">char* <a class="el" href="classSBDBHPhysRec.html#ad4c598f4e7884322181d3be1ebf34aca">SBDBHPhysRec::LogRec</a><code> [protected, inherited]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Definition at line <a class="el" href="SbGeoObsVLBI__IO_8H_source.html#l00111">111</a> of file <a class="el" href="SbGeoObsVLBI__IO_8H_source.html">SbGeoObsVLBI_IO.H</a>.</p>
<p>Referenced by <a class="el" href="SbGeoObsVLBI__IO_8H_source.html#l00120">SBDBHPhysRec::parseLR()</a>, <a class="el" href="SbGeoObsVLBI__IO_8H_source.html#l00338">SBDBHDRecString::parseLR()</a>, <a class="el" href="SbGeoObsVLBI__IO_8H_source.html#l00114">SBDBHPhysRec::SBDBHPhysRec()</a>, <a class="el" href="SbGeoObsVLBI__IO_8C_source.html#l02458">SBDBHDRecString::val()</a>, and <a class="el" href="SbGeoObsVLBI__IO_8H_source.html#l00115">SBDBHPhysRec::~SBDBHPhysRec()</a>.</p>
</div>
</div>
<a class="anchor" id="a8473e562daca89000eabd265fe36c939"></a><!-- doxytag: member="SBDBHLRecHS1::P" ref="a8473e562daca89000eabd265fe36c939" args="[3]" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">char <a class="el" href="classSBDBHLRecPrefixed.html#a8473e562daca89000eabd265fe36c939">SBDBHLRecPrefixed::P</a>[3]<code> [protected, inherited]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Definition at line <a class="el" href="SbGeoObsVLBI__IO_8H_source.html#l00137">137</a> of file <a class="el" href="SbGeoObsVLBI__IO_8H_source.html">SbGeoObsVLBI_IO.H</a>.</p>
<p>Referenced by <a class="el" href="SbGeoObsVLBI__IO_8H_source.html#l00140">SBDBHLRecPrefixed::isP()</a>, <a class="el" href="SbGeoObsVLBI__IO_8C_source.html#l02389">SBDBHLRecPrefixed::isPrefixParsed()</a>, and <a class="el" href="SbGeoObsVLBI__IO_8H_source.html#l00139">SBDBHLRecPrefixed::SBDBHLRecPrefixed()</a>.</p>
</div>
</div>
<a class="anchor" id="a47d89f9f78cae1d7447e2c43cc0b23b1"></a><!-- doxytag: member="SBDBHLRecHS1::Prefix" ref="a47d89f9f78cae1d7447e2c43cc0b23b1" args="[2]" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">char <a class="el" href="classSBDBHLRecPrefixed.html#a47d89f9f78cae1d7447e2c43cc0b23b1">SBDBHLRecPrefixed::Prefix</a>[2]<code> [protected, inherited]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Definition at line <a class="el" href="SbGeoObsVLBI__IO_8H_source.html#l00136">136</a> of file <a class="el" href="SbGeoObsVLBI__IO_8H_source.html">SbGeoObsVLBI_IO.H</a>.</p>
<p>Referenced by <a class="el" href="SbGeoObsVLBI__IO_8H_source.html#l00261">SBDBHLRecDR::dump()</a>, <a class="el" href="SbGeoObsVLBI__IO_8H_source.html#l00232">SBDBHLRecTC::isAlter()</a>, <a class="el" href="SbGeoObsVLBI__IO_8H_source.html#l00287">SBDBHLRecDE::isAlter()</a>, <a class="el" href="SbGeoObsVLBI__IO_8H_source.html#l00140">SBDBHLRecPrefixed::isP()</a>, <a class="el" href="SbGeoObsVLBI__IO_8C_source.html#l02389">SBDBHLRecPrefixed::isPrefixParsed()</a>, <a class="el" href="SbGeoObsVLBI__IO_8H_source.html#l00167">isZ1()</a>, <a class="el" href="SbGeoObsVLBI__IO_8C_source.html#l02411">SBDBHLRecTC::parseLR()</a>, <a class="el" href="SbGeoObsVLBI__IO_8C_source.html#l02435">SBDBHLRecDE::parseLR()</a>, and <a class="el" href="SbGeoObsVLBI__IO_8H_source.html#l00139">SBDBHLRecPrefixed::SBDBHLRecPrefixed()</a>.</p>
</div>
</div>
<a class="anchor" id="a35855628f207b8a1a7f01d3e6d0358f7"></a><!-- doxytag: member="SBDBHLRecHS1::VerNum" ref="a35855628f207b8a1a7f01d3e6d0358f7" args="" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">short <a class="el" href="classSBDBHLRecHS1.html#a35855628f207b8a1a7f01d3e6d0358f7">SBDBHLRecHS1::VerNum</a><code> [protected]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Definition at line <a class="el" href="SbGeoObsVLBI__IO_8H_source.html#l00160">160</a> of file <a class="el" href="SbGeoObsVLBI__IO_8H_source.html">SbGeoObsVLBI_IO.H</a>.</p>
<p>Referenced by <a class="el" href="SbGeoObsVLBI__IO_8H_source.html#l00169">parseLR()</a>, <a class="el" href="SbGeoObsVLBI__IO_8H_source.html#l00162">SBDBHLRecHS1()</a>, and <a class="el" href="SbGeoObsVLBI__IO_8H_source.html#l00165">verNum()</a>.</p>
</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li><a class="el" href="SbGeoObsVLBI__IO_8H_source.html">SbGeoObsVLBI_IO.H</a></li>
</ul>
</div>
<hr class="footer"/><address class="footer"><small>
Generated on Mon May 14 2012 13:21:52 for SteelBreeze Reference Manual by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.5.1
</small></address>
</body>
</html>
|
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#include <aws/iotanalytics/model/DescribeChannelRequest.h>
#include <aws/core/utils/json/JsonSerializer.h>
#include <aws/core/http/URI.h>
#include <aws/core/utils/memory/stl/AWSStringStream.h>
#include <utility>
using namespace Aws::IoTAnalytics::Model;
using namespace Aws::Utils::Json;
using namespace Aws::Utils;
using namespace Aws::Http;
DescribeChannelRequest::DescribeChannelRequest() :
m_channelNameHasBeenSet(false),
m_includeStatistics(false),
m_includeStatisticsHasBeenSet(false)
{
}
Aws::String DescribeChannelRequest::SerializePayload() const
{
return {};
}
void DescribeChannelRequest::AddQueryStringParameters(URI& uri) const
{
Aws::StringStream ss;
if(m_includeStatisticsHasBeenSet)
{
ss << m_includeStatistics;
uri.AddQueryStringParameter("includeStatistics", ss.str());
ss.str("");
}
}
|
This repair serum maximizes the power of skin’s natural nighttime renewal with a cutting-edge technology that dramatically reducing visible signs of aging. Improves the appearance of fine lines and wrinkles, hydrates skin, and creates an even-toned, healthier-looking, and refreshed complexion. Reveals a smoother, more luminous, younger look and wake up to beautiful skin every day.
Using several pumps, apply on clean skin before your moisturizer. Smooth in gently all over face and neck. |
doll coloring pages girl grace page of printable dolls boy games lol.
barbie doll coloring pages for kids the princess charm school page download dolls games lol.
coloring pages girl doll free printable spice page for adults to dolls games lol.
coloring games pages club colouring online toy dolls for girls la source lol.
our favorite dolls word search for kids free puzzles coloring pages and other activities games lol doll.
paper dolls coloring pages barbie doll sheets games free frozen color lol.
horse coloring pages games paper doll pony dolls 2 lol.
horse coloring pages games letter k sheet dolls lol doll.
doll coloring pages dolls pictures games to lol.
paper dolls coloring pages doll page imagination print outs col games lol.
barbie doll coloring pages dolls free games lol.
medium size of barbie drawing and painting games with colour coloring doll pages dolls pretty lol.
coloring dolls pages doll amazing page games lol.
baby alive coloring pages related keywords suggestions barbie doll games with of dolls lol.
gorgeous design coloring monster high free printable pages for kids games book dolls pets lol.
rbie doll color pages coloring online excellent of dolls games r lol.
stein monster high dolls girl wolf coloring page games to download lol.
free download the collectible dolls coloring books games toys comic video lol.
monster high coloring pages games color page dolls lol.
horse coloring pages games printable valentines day hearts dolls lol doll.
dolls coloring pages prettier line games of luxury figure lol.
coloring dolls games lol doll pages.
free download dolls coloring screenshot 2 games lol doll pages. |
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>SoCal</title>
<link rel="stylesheet" href="socal.css" type="text/css" />
</head>
<body>
<div id="main">
<div id="content">
<h2 class="hdr">SoCal Fall 2012: Presentation Instructions</h2>
<h4 class="hdr">Talks</h4>
Talk slots are 20+5 minutes, meaning 20 minutes for the talk and 5
minutes for questions.
<!-- <h4 class="hdr">Poster Presentations</h4> -->
<!-- <p> -->
<!-- Individuals with posters will have two chances to present their work: -->
<!-- a 2 minute spotlight talk followed by the poster sessions. -->
<!-- </p> -->
<!-- <p><b>Poster Format</b> SoCal will provide easels and foam backing to -->
<!-- hold posters. Posters should be no larger than 36 inches wide -->
<!-- by 46 inches tall. <\!--Either portrait or landscape orientation is fine.-\-> -->
<!-- Tape and/or pushpins will be available for mounting. -->
<!-- </p> -->
<!-- <p><b>Poster Format</b> Spotlight talks will be will run on a strict -->
<!-- schedule. To minimize time lost to speaker changes, all slides will -->
<!-- projected from a provided laptop. Please prepare two slides in PDF format. -->
<!-- Email your slides to <a href="mailto:[email protected]">Stefan Brunthaler</a> -->
<!-- or bring them to SoCal on a USB key. -->
<!-- </p> -->
<!-- <p> Spotlights will run for 2 minutes, and time limits will be strictly -->
<!-- enforced. </p> -->
</div>
</div>
</body>
</html>
|
from cStringIO import StringIO
from textwrap import dedent
from mock import Mock, patch
from ceph_deploy import conf
from ceph_deploy.tests import fakes
class TestLocateOrCreate(object):
def setup(self):
self.fake_write = Mock(name='fake_write')
self.fake_file = fakes.mock_open(data=self.fake_write)
self.fake_file.readline.return_value = self.fake_file
def test_no_conf(self):
fake_path = Mock()
fake_path.exists = Mock(return_value=False)
with patch('__builtin__.open', self.fake_file):
with patch('ceph_deploy.conf.cephdeploy.path', fake_path):
conf.cephdeploy.location()
assert self.fake_file.called is True
assert self.fake_file.call_args[0][0].endswith('/.cephdeploy.conf')
def test_cwd_conf_exists(self):
fake_path = Mock()
fake_path.join = Mock(return_value='/srv/cephdeploy.conf')
fake_path.exists = Mock(return_value=True)
with patch('ceph_deploy.conf.cephdeploy.path', fake_path):
result = conf.cephdeploy.location()
assert result == '/srv/cephdeploy.conf'
def test_home_conf_exists(self):
fake_path = Mock()
fake_path.expanduser = Mock(return_value='/home/alfredo/.cephdeploy.conf')
fake_path.exists = Mock(side_effect=[False, True])
with patch('ceph_deploy.conf.cephdeploy.path', fake_path):
result = conf.cephdeploy.location()
assert result == '/home/alfredo/.cephdeploy.conf'
class TestConf(object):
def test_has_repos(self):
cfg = conf.cephdeploy.Conf()
cfg.sections = lambda: ['foo']
assert cfg.has_repos is True
def test_has_no_repos(self):
cfg = conf.cephdeploy.Conf()
cfg.sections = lambda: ['ceph-deploy-install']
assert cfg.has_repos is False
def test_get_repos_is_empty(self):
cfg = conf.cephdeploy.Conf()
cfg.sections = lambda: ['ceph-deploy-install']
assert cfg.get_repos() == []
def test_get_repos_is_not_empty(self):
cfg = conf.cephdeploy.Conf()
cfg.sections = lambda: ['ceph-deploy-install', 'foo']
assert cfg.get_repos() == ['foo']
def test_get_safe_not_empty(self):
cfg = conf.cephdeploy.Conf()
cfg.get = lambda section, key: True
assert cfg.get_safe(1, 2) is True
def test_get_safe_empty(self):
cfg = conf.cephdeploy.Conf()
assert cfg.get_safe(1, 2) is None
class TestConfGetList(object):
def test_get_list_empty(self):
cfg = conf.cephdeploy.Conf()
conf_file = StringIO(dedent("""
[foo]
key =
"""))
cfg.readfp(conf_file)
assert cfg.get_list('foo', 'key') == ['']
def test_get_list_empty_when_no_key(self):
cfg = conf.cephdeploy.Conf()
conf_file = StringIO(dedent("""
[foo]
"""))
cfg.readfp(conf_file)
assert cfg.get_list('foo', 'key') == []
def test_get_list_if_value_is_one_item(self):
cfg = conf.cephdeploy.Conf()
conf_file = StringIO(dedent("""
[foo]
key = 1
"""))
cfg.readfp(conf_file)
assert cfg.get_list('foo', 'key') == ['1']
def test_get_list_with_mutltiple_items(self):
cfg = conf.cephdeploy.Conf()
conf_file = StringIO(dedent("""
[foo]
key = 1, 3, 4
"""))
cfg.readfp(conf_file)
assert cfg.get_list('foo', 'key') == ['1', '3', '4']
def test_get_rid_of_comments(self):
cfg = conf.cephdeploy.Conf()
conf_file = StringIO(dedent("""
[foo]
key = 1, 3, 4 # this is a wonderful comment y'all
"""))
cfg.readfp(conf_file)
assert cfg.get_list('foo', 'key') == ['1', '3', '4']
def test_get_rid_of_whitespace(self):
cfg = conf.cephdeploy.Conf()
conf_file = StringIO(dedent("""
[foo]
key = 1, 3 , 4
"""))
cfg.readfp(conf_file)
assert cfg.get_list('foo', 'key') == ['1', '3', '4']
def test_get_default_repo(self):
cfg = conf.cephdeploy.Conf()
conf_file = StringIO(dedent("""
[foo]
default = True
"""))
cfg.readfp(conf_file)
assert cfg.get_default_repo() == 'foo'
def test_get_default_repo_fails_non_truthy(self):
cfg = conf.cephdeploy.Conf()
conf_file = StringIO(dedent("""
[foo]
default = 0
"""))
cfg.readfp(conf_file)
assert cfg.get_default_repo() is False
class TestSetOverrides(object):
def setup(self):
self.args = Mock()
self.args.func.__name__ = 'foo'
self.conf = Mock()
def test_override_global(self):
self.conf.sections = Mock(return_value=['ceph-deploy-global'])
self.conf.items = Mock(return_value=(('foo', 1),))
arg_obj = conf.cephdeploy.set_overrides(self.args, self.conf)
assert arg_obj.foo == 1
def test_override_foo_section(self):
self.conf.sections = Mock(
return_value=['ceph-deploy-global', 'ceph-deploy-foo']
)
self.conf.items = Mock(return_value=(('bar', 1),))
arg_obj = conf.cephdeploy.set_overrides(self.args, self.conf)
assert arg_obj.bar == 1
|
# Repository moved
This is code for provisioning an older, unmaintained version of [Unhangout](https://unhangout.media.mit.edu). The current code for provisioning Unhangout is found [in the new repository](https://gitlab.com/unhangout/reunhangout/tree/master/ansible)
This code is kept here only for historical interest.
--------
# Overview
This project attempts to ease the installation and configuration of the [Unhangout](https://unhangout.media.mit.edu) online un-conference style conferencing software. After running the installation, users should have a fully-functioning [Unhangout codebase](https://github.com/drewww/unhangout) up and running on their server.
## Features
* Well documented and easy to configure.
* Leveraging [Salt](http://saltstack.com/community), automatically installs and configures all necessary software.
* Development and production configurations ensure consistency across environments, with the necessary customizations for each.
* Dead-easy setup for local development environments using [Vagrant](https://www.vagrantup.com).
* Sensible defaults that are easily overridden via config files.
* Easily extend the automated deployment scripts for further server customization.
* Extra goodies installed for development setups to aid/ease development.
## Installation
See [INSTALL.md](INSTALL.md)
## Caveats
* Tested on recent versions of [OS X](https://www.apple.com/osx)/[Vagrant](https://www.vagrantup.com)/[VirtualBox](https://www.virtualbox.org) and [CentOS](http://www.centos.org) 6.x
* Salt installation should work on [RHEL](http://www.redhat.com/en/technologies/linux-platforms/enterprise-linux)/[CentOS](http://www.centos.org) and similar variants, versions 5.x and 6.x
* Salt is currently configured to use a masterless setup. It should be pretty trivial to adjust the implementation for use with a master.
* No support for installation on other platforms, but they could be added fairly easily, I think. Patches welcome. :)
* No [Windows](http://windows.microsoft.com) support yet for the [Vagrant](https://www.vagrantup.com) installation scripts.
## Support
The issue tracker for this project is provided to file bug reports, feature requests, and project tasks -- support requests are not accepted via the issue tracker. For all support-related issues, including configuration, usage, and training, consider hiring a competent consultant.
|
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Shell")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Shell")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
//In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
//inside a <PropertyGroup>. For example, if you are using US english
//in your source files, set the <UICulture> to en-US. Then uncomment
//the NeutralResourceLanguage attribute below. Update the "en-US" in
//the line below to match the UICulture setting in the project file.
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
|
+++
title = "Tidy error handling"
description = "The joys of Result and Option"
date = "2016-11-28"
tags = ["software"]
+++
In some code I was looking through recently, I came across the following
pattern:
```rust
match a.do_something() {
Ok(b) => {
match b.do_something_else() {
Ok(_) => Ok(()),
Err(err) => CustomError::from(err),
}
}
Err(err) => CustomError::from(err),
}
```
It is very clear what that code is doing, and what all the possible paths are.
However, there are ways of shortening this and reducing the level of indentation
required. We could, for example, use `try!(...)` (or `...?` in 1.13):
```rust
let mut b = try!(a.do_something());
try!(b.do_something_else());
Ok(())
```
However, this has certain drawbacks. This would fall apart if we wanted to do
anything clever with the errors (e.g. write an error log before returning). I'm
also not particularly fond of `try!` - it implicitly introduces a bunch of
`return` calls into the code.
Instead, the pattern I've come to prefer is as follows:
```rust
a.do_something()
.and_then(|b| b.do_something_else())
.map(|_| ())
.map_err(CustomError::from)
```
This has the advantage of conciseness, with each quantum of functionality on a
separate line.
[`std::option::Option`](https://doc.rust-lang.org/std/option/enum.Option.html)
and
[`std::result::Result`](https://doc.rust-lang.org/std/result/enum.Result.html)
are two very powerful elements of Rust, both with a number of very useful
methods. I'd thoroughly recommend reading their docs - I've been referring to
both quite a bit lately, and think it has helped the readability of the code
I've written.
|
<?php
/**
* @package Azura Joomla Pagebuilder
* @author Cththemes - www.cththemes.com
* @date: 15-07-2014
*
* @copyright Copyright ( C ) 2014 cththemes.com . All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
defined('_JEXEC') or die;
$app = JFactory::getApplication();
?>
<div class="width100 azura-element-block" data-typeName="<?php echo $element->type;?>">
<div class="width100 azura-element azura-element-type-<?php echo strtolower($element->type);?>" data-typeName="<?php echo $element->type;?>">
<span class="azura-element-title"><?php echo $element->elementTypeName;?><?php if(!empty($element->name)) echo ' - '.$element->name;?></span>
<div class="azura-element-tools">
<i class="fa fa-arrow-up azura-element-tools-levelup"></i>
<i class="fa fa-eye azura-element-tools-showhide <?php echo $this->elements_expand;?>"></i>
<i class="fa fa-edit azura-element-tools-configs"></i>
<i class="fa fa-copy azura-element-tools-copy"></i>
<i class="fa fa-times azura-element-tools-remove"></i>
</div>
</div>
<div class="azura-element-type-<?php echo strtolower($element->type);?>-container">
<div class="azura-sortable elementchildren <?php echo $this->elements_expand;?> clearfix">
<div class="hide-in-elements" style="text-align: center; vertical-align: bottom; margin-top: 5px;"><i class="fa fa-plus tabToggleAddItem" title="Add tab" style="color: rgb(204, 204, 204); margin: 0px auto; font-size: 20px; cursor: pointer;"></i></div>
<?php
if(isset($element->elementChilds) && count($element->elementChilds)) {
foreach ($element->elementChilds as $child) {
$this->parseElement($child);
}
}
?>
</div>
</div>
<!-- /.azura-element-type-azuraaccordion-container -->
<div class="azura-element-settings-saved saved" data="<?php echo $element->elementData;?>"></div>
</div>
|
/*
* Copyright (c) 2017. MIT-license for Jari Van Melckebeke
* Note that there was a lot of educational work in this project,
* this project was (or is) used for an assignment from Realdolmen in Belgium.
* Please just don't abuse my work
*/
define(function (require) {
return function (ecModel) {
ecModel.eachSeriesByType('map', function (seriesModel) {
var colorList = seriesModel.get('color');
var itemStyleModel = seriesModel.getModel('itemStyle.normal');
var areaColor = itemStyleModel.get('areaColor');
var color = itemStyleModel.get('color')
|| colorList[seriesModel.seriesIndex % colorList.length];
seriesModel.getData().setVisual({
'areaColor': areaColor,
'color': color
});
});
};
});
|
/**
* Copyright (c) 2015 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:
* 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 the copyright holder 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 HOLDER 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.
*/
/**
* This file contains code to run in workram before calling code in ROM to enter
* standby, and after code in ROM resumed from standby.
* This file is only needed by the third stage FW. It is here in the boot ROM
* source tree as code to test the standby/resume function of the boot ROM
*/
#include <stddef.h>
#include <string.h>
#include <errno.h>
#include "bootrom.h"
#include "chipapi.h"
#include "unipro.h"
#include "tsb_unipro.h"
#include "debug.h"
#include "utils.h"
#include "tsb_scm.h"
#include "special_test.h"
/**
* Code to handle standby and resume in workram.
* The code is implemented according to section 4.1.4.4 (modified
* based on discussion with Toshiba), and section 4.1.4.2 from
* ARA_ES3_APBridge_rev091.pdf.
* The part of sequence can run in workram is implemented here. It calls
* function in ROM to enter standby and being called by ROM code upon resume.
*
* This file is not part of boot ROM code. Instead, it is an example
* of how later stage FW should implement standby/resume function
*/
int chip_enter_hibern8_client(void) {
uint32_t tx_reset_offset, rx_reset_offset;
uint32_t cportid;
int rc;
uint32_t tempval;
dbgprint("Wait for hibernate\n");
do {
rc = chip_unipro_attr_read(TSB_HIBERNATE_ENTER_IND, &tempval, 0,
ATTR_LOCAL);
} while (!rc && tempval == 0);
if (rc) {
return rc;
}
for (cportid = 0; cportid < CPORT_MAX; cportid++) {
tx_reset_offset = TX_SW_RESET_00 + (cportid << 2);
rx_reset_offset = RX_SW_RESET_00 + (cportid << 2);
putreg32(CPORT_SW_RESET_BITS,
(volatile unsigned int*)(AIO_UNIPRO_BASE + tx_reset_offset));
putreg32(CPORT_SW_RESET_BITS,
(volatile unsigned int*)(AIO_UNIPRO_BASE + rx_reset_offset));
}
dbgprint("hibernate entered\n");
return 0;
}
int chip_exit_hibern8_client(void) {
int rc;
uint32_t tempval;
tsb_clk_enable(TSB_CLK_UNIPROSYS);
dbgprint("Try to exit hibernate\n");
while(1) {
tempval = 1;
rc = chip_unipro_attr_write(TSB_HIBERNATE_EXIT_REQ, tempval, 0,
ATTR_LOCAL);
if (rc) {
return rc;
}
rc = chip_unipro_attr_read(TSB_HIBERNATE_EXIT_REQ, &tempval, 0,
ATTR_LOCAL);
if (rc) {
return rc;
}
/**
* There are two bits defined in this DME. Bit 0 means the command
* was accepted and bit 1 means it is rejected. It is not clear if
* other value, such as 0 or 3 is possible when reading this DME.
* But Toshiba said that we should re-issue the command if the REQ/CNF
* returns EXIT_REQ_DENIED as rejected
*/
if (tempval != EXIT_REQ_DENIED)
break;
}
do {
rc = chip_unipro_attr_read(TSB_HIBERNATE_EXIT_IND, &tempval, 0,
ATTR_LOCAL);
} while (!rc && tempval == 0);
if (rc) {
return rc;
}
dbgprint("hibernate exit\n");
return 0;
}
static int enter_hibern8(void) {
uint32_t tx_reset_offset, rx_reset_offset;
uint32_t cportid;
int rc;
uint32_t tempval;
dbgprint("entering hibernate\n");
for (cportid = 0; cportid < CPORT_MAX; cportid++) {
tx_reset_offset = TX_SW_RESET_00 + (cportid << 2);
rx_reset_offset = RX_SW_RESET_00 + (cportid << 2);
putreg32(CPORT_SW_RESET_BITS,
(volatile unsigned int*)(AIO_UNIPRO_BASE + tx_reset_offset));
putreg32(CPORT_SW_RESET_BITS,
(volatile unsigned int*)(AIO_UNIPRO_BASE + rx_reset_offset));
}
tempval = 1;
rc = chip_unipro_attr_write(TSB_HIBERNATE_ENTER_REQ, tempval, 0,
ATTR_LOCAL);
if (rc) {
return rc;
}
dbgprint("wait for hibernate\n");
do {
rc = chip_unipro_attr_read(TSB_HIBERNATE_ENTER_IND, &tempval, 0,
ATTR_LOCAL);
} while (!rc && tempval == 0);
if (rc) {
return rc;
}
dbgprint("hibernate entered\n");
return 0;
}
int chip_enter_hibern8_server(void) {
int rc;
uint32_t tempval;
enter_hibern8();
dbgprint("wait for hibernate exit\n");
do {
rc = chip_unipro_attr_read(TSB_HIBERNATE_EXIT_IND, &tempval, 0,
ATTR_LOCAL);
} while (!rc && tempval == 0);
if (rc) {
return rc;
}
dbgprint("hibernate exit\n");
return 0;
}
/* use all 4 GPIOs 3, 4, 5, 23 as wakeup source */
#define TEST_WAKEUPSRC 0x1111
int standby_sequence(void) {
int (*enter_standby_func)(void);
int status;
putreg32(TEST_WAKEUPSRC, WAKEUPSRC);
#if _SPECIAL_TEST == SPECIAL_GBBOOT_SERVER_STANDBY
chip_enter_hibern8_client();
#else
enter_hibern8();
#endif
while (0 != getreg32((volatile unsigned int*)UNIPRO_CLK_EN));
tsb_clk_disable(TSB_CLK_UNIPROSYS);
putreg32(0, HB8CLK_EN);
delay_ns(1500);
putreg32(1, RETFFSAVE);
delay_ns(100);
putreg32(0, RETFFSAVE);
/**
* Following code cannot run in workram
* let's use the code in ROM, as part of the boot ROM shared function
*/
enter_standby_func = get_shared_function(SHARED_FUNCTION_ENTER_STANDBY);
status = enter_standby_func();
return status;
}
void resume_sequence_in_workram(void) {
putreg32(SRSTRELEASE_UNIPRO_SYSRESET_N, SOFTRESETRELEASE1);
/* delay 0.1us or more */
delay_ns(100);
putreg32(1, RETFFSTR);
/* delay 5us or more */
delay_ns(5000);
putreg32(0, RETFFSTR);
/* delay 5us or more */
delay_ns(5000);
putreg32(1, HB8CLK_EN);
/* delay 1.5us or more */
delay_ns(1500);
chip_init();
dbginit();
chip_exit_hibern8_client();
putreg32(0, ISO_FOR_IO_EN);
/* write 1 to clear BOOTRET_o */
putreg32(1, BOOTRET_O);
dbgprint("Resumed from standby\n");
}
|
Whether it's your first visit or Laurel is a favorite travel destination, get ready to explore all that Laurel has to offer and find the perfect temporary home base with help from IHG. Our easy-to-navigate website allows you to compare the best hotels in Laurel by reading through our honest 1394 reviews from verified hotel guests. When you book your room with IHG, you're assured a great deal and lowest rate with our Best Price Guarantee. We boast 4 hotels in Laurel, MS, all with a distinctive flair and a variety of amenities, and you can conveniently narrow down your choices and book your room directly with us.
No matter if you're travelling to Laurel to attend a conference, unwind on vacation, or enjoy a romantic weekend getaway, we have you covered. And if your travels take you to another part of the world, you'll find an IHG accommodation that meets your needs. From hotels in the heart of it all to luxury accommodations off the beaten path, IHG offers great hotel deals in Laurel and throughout the world. |
Today I'm featuring my current read, The Thing About December by Donal Ryan, which I purchased on a recent trip to Dublin.
Mother always said January is a lovely month. Everything starts over again in the New Year. The visitors are all finished with and you won't see sight nor hear sound of them until next Christmas with the help of God. Before you know it you'll see a stretch in the evenings. The calving starts in January and as each new life wobbles into the slatted house your wealth grows a little bit. It'd want to -- you have to try and claw back what was squandered in December on rubbish that no one really wanted. The bit of frost kills any lingering badness. That's the thing about January: it makes the world fresh. That's what Mother used to say anyway, back when she used to have a lot more to say for herself.
The narrator makes some spot on comments about the month of January in the opening paragraph. I really relate to the idea of a fresh start, quieter moments, and the need to put one's earnings toward paying for those Christmas gifts.
First Chapter ~ First Paragraph #133 was originally published by Catherine for bookclublibrarian.com. This post cannot be republished without attribution. Retweeting and sharing on Google+ encouraged. |
Copyright © 2016 - 2019 www.lebrononline.com. All Rights Reserved. Processed in 0.0367916 second(s),0 Queries. |
package com.circuits.circuitsmod.common;
import java.util.HashSet;
import java.util.Optional;
import java.util.Set;
import java.util.Stack;
import java.util.function.Function;
import java.util.function.Predicate;
import java.util.stream.Stream;
public class GraphUtils {
public static <T> Optional<T> generalSearch(T init, Function<T, Stream<T>> neighbors, Predicate<T> success) {
//TODO: Make this a stream-generating function!
Set<T> searched = new HashSet<T>();
Stack<T> front = new Stack<T>();
front.add(init);
while (!front.isEmpty()) {
T current = front.pop();
if (success.test(current)) {
return Optional.of(current);
}
searched.add(current);
neighbors.apply(current).filter((p) -> !searched.contains(p))
.forEach((p) -> front.push(p));
}
return Optional.empty();
}
}
|
using System;
using System.Data.Linq;
using System.Diagnostics;
using System.Linq;
using System.Net;
using System.Xml;
using System.Xml.Linq;
using LinqToDB;
using LinqToDB.Common;
using LinqToDB.Data;
using LinqToDB.Mapping;
using NUnit.Framework;
using NpgsqlTypes;
namespace Tests.DataProvider
{
using Model;
[TestFixture]
public class PostgreSQLTest : DataProviderTestBase
{
public PostgreSQLTest()
{
PassNullSql = "SELECT ID FROM AllTypes WHERE :p IS NULL AND {0} IS NULL OR :p IS NOT NULL AND {0} = :p";
PassValueSql = "SELECT ID FROM AllTypes WHERE {0} = :p";
}
const string CurrentProvider = ProviderName.PostgreSQL;
[Test, IncludeDataContextSource(CurrentProvider)]
public void TestParameters(string context)
{
using (var conn = new DataConnection(context))
{
Assert.That(conn.Execute<string>("SELECT :p", new { p = 1 }), Is.EqualTo("1"));
Assert.That(conn.Execute<string>("SELECT :p", new { p = "1" }), Is.EqualTo("1"));
Assert.That(conn.Execute<int> ("SELECT :p", new { p = new DataParameter { Value = 1 } }), Is.EqualTo(1));
Assert.That(conn.Execute<string>("SELECT :p1", new { p1 = new DataParameter { Value = "1" } }), Is.EqualTo("1"));
Assert.That(conn.Execute<int> ("SELECT :p1 + :p2", new { p1 = 2, p2 = 3 }), Is.EqualTo(5));
Assert.That(conn.Execute<int> ("SELECT :p2 + :p1", new { p2 = 2, p1 = 3 }), Is.EqualTo(5));
}
}
[Test, IncludeDataContextSource(CurrentProvider)]
public void TestDataTypes(string context)
{
using (var conn = new DataConnection(context))
{
Assert.That(TestType<long?> (conn, "bigintDataType", DataType.Int64), Is.EqualTo(1000000));
Assert.That(TestType<decimal?> (conn, "numericDataType", DataType.Decimal), Is.EqualTo(9999999m));
Assert.That(TestType<short?> (conn, "smallintDataType", DataType.Int16), Is.EqualTo(25555));
Assert.That(TestType<int?> (conn, "intDataType", DataType.Int32), Is.EqualTo(7777777));
// Assert.That(TestType<decimal?> (conn, "moneyDataType", DataType.Money), Is.EqualTo(100000m));
Assert.That(TestType<double?> (conn, "doubleDataType", DataType.Double), Is.EqualTo(20.31d));
Assert.That(TestType<float?> (conn, "realDataType", DataType.Single), Is.EqualTo(16.2f));
Assert.That(TestType<NpgsqlTimeStamp?> (conn, "timestampDataType"), Is.EqualTo(new NpgsqlTimeStamp(2012, 12, 12, 12, 12, 12)));
Assert.That(TestType<DateTime?> (conn, "timestampDataType", DataType.DateTime2), Is.EqualTo(new DateTime(2012, 12, 12, 12, 12, 12)));
Assert.That(TestType<NpgsqlTimeStampTZ?>(conn, "timestampTZDataType"), Is.EqualTo(new NpgsqlTimeStampTZ(2012, 12, 12, 11, 12, 12, new NpgsqlTimeZone(-5, 0))));
Assert.That(TestType<DateTimeOffset?> (conn, "timestampTZDataType", DataType.DateTimeOffset), Is.EqualTo(new DateTimeOffset(2012, 12, 12, 11, 12, 12, new TimeSpan(-5, 0, 0))));
Assert.That(TestType<NpgsqlDate?> (conn, "dateDataType"), Is.EqualTo(new NpgsqlDate(2012, 12, 12)));
Assert.That(TestType<DateTime?> (conn, "dateDataType", DataType.Date), Is.EqualTo(new DateTime(2012, 12, 12)));
Assert.That(TestType<NpgsqlTime?> (conn, "timeDataType"), Is.EqualTo(new NpgsqlTime(12, 12, 12)));
Assert.That(TestType<NpgsqlTimeTZ?> (conn, "timeTZDataType"), Is.EqualTo(new NpgsqlTimeTZ(12, 12, 12)));
Assert.That(TestType<NpgsqlInterval?> (conn, "intervalDataType"), Is.EqualTo(new NpgsqlInterval(1, 3, 5, 20)));
Assert.That(TestType<char?> (conn, "charDataType", DataType.Char), Is.EqualTo('1'));
Assert.That(TestType<string> (conn, "charDataType", DataType.Char), Is.EqualTo("1"));
Assert.That(TestType<string> (conn, "charDataType", DataType.NChar), Is.EqualTo("1"));
Assert.That(TestType<string> (conn, "varcharDataType", DataType.VarChar), Is.EqualTo("234"));
Assert.That(TestType<string> (conn, "varcharDataType", DataType.NVarChar), Is.EqualTo("234"));
Assert.That(TestType<string> (conn, "textDataType", DataType.Text), Is.EqualTo("567"));
Assert.That(TestType<byte[]> (conn, "binaryDataType", DataType.Binary), Is.EqualTo(new byte[] { 42 }));
Assert.That(TestType<byte[]> (conn, "binaryDataType", DataType.VarBinary), Is.EqualTo(new byte[] { 42 }));
Assert.That(TestType<Binary> (conn, "binaryDataType", DataType.VarBinary).ToArray(), Is.EqualTo(new byte[] { 42 }));
Assert.That(TestType<Guid?> (conn, "uuidDataType", DataType.Guid), Is.EqualTo(new Guid("6F9619FF-8B86-D011-B42D-00C04FC964FF")));
Assert.That(TestType<BitString?> (conn, "bitDataType"), Is.EqualTo(new BitString(new[] { true, false, true })));
Assert.That(TestType<bool?> (conn, "booleanDataType", DataType.Boolean), Is.EqualTo(true));
Assert.That(TestType<string> (conn, "colorDataType"), Is.EqualTo("Green"));
Assert.That(TestType<NpgsqlPoint?> (conn, "pointDataType", skipNull:true, skipNotNull:true), Is.EqualTo(new NpgsqlPoint(1, 2)));
Assert.That(TestType<NpgsqlLSeg?> (conn, "lsegDataType"), Is.EqualTo(new NpgsqlLSeg(new NpgsqlPoint(1, 2), new NpgsqlPoint(3, 4))));
Assert.That(TestType<NpgsqlBox?> (conn, "boxDataType").ToString(), Is.EqualTo(new NpgsqlBox(new NpgsqlPoint(1, 2), new NpgsqlPoint(3, 4)).ToString()));
Assert.That(TestType<NpgsqlPath?> (conn, "pathDataType"), Is.EqualTo(new NpgsqlPath(new[] { new NpgsqlPoint(1, 2), new NpgsqlPoint(3, 4) })));
Assert.That(TestType<NpgsqlPolygon?> (conn, "polygonDataType", skipNull:true, skipNotNull:true), Is.EqualTo(new NpgsqlPolygon(new[] { new NpgsqlPoint(1, 2), new NpgsqlPoint(3, 4) })));
Assert.That(TestType<NpgsqlCircle?> (conn, "circleDataType"), Is.EqualTo(new NpgsqlCircle(new NpgsqlPoint(1, 2), 3)));
Assert.That(TestType<NpgsqlInet?> (conn, "inetDataType"), Is.EqualTo(new NpgsqlInet(new IPAddress(new byte[] { 192, 168, 1, 1 }))));
Assert.That(TestType<NpgsqlMacAddress?> (conn, "macaddrDataType"), Is.EqualTo(new NpgsqlMacAddress("01:02:03:04:05:06")));
Assert.That(TestType<string> (conn, "xmlDataType", DataType.Xml, skipNull:true, skipNotNull:true),
Is.EqualTo("<root><element strattr=\"strvalue\" intattr=\"12345\"/></root>"));
Assert.That(TestType<XDocument> (conn, "xmlDataType", DataType.Xml, skipNull:true, skipNotNull:true).ToString(),
Is.EqualTo(XDocument.Parse("<root><element strattr=\"strvalue\" intattr=\"12345\"/></root>").ToString()));
Assert.That(TestType<XmlDocument> (conn, "xmlDataType", DataType.Xml, skipNull:true, skipNotNull:true).InnerXml,
Is.EqualTo(ConvertTo<XmlDocument>.From("<root><element strattr=\"strvalue\" intattr=\"12345\"/></root>").InnerXml));
}
}
static void TestNumeric<T>(DataConnection conn, T expectedValue, DataType dataType, string skip = "")
{
var skipTypes = skip.Split(' ');
foreach (var sqlType in new[]
{
"bigint",
"int",
"money",
"numeric",
"numeric(38)",
"smallint",
"float",
"real"
}.Except(skipTypes))
{
var sqlValue = (object)expectedValue;
var sql = string.Format("SELECT Cast({0} as {1})", sqlValue ?? "NULL", sqlType);
Debug.WriteLine(sql + " -> " + typeof(T));
Assert.That(conn.Execute<T>(sql), Is.EqualTo(expectedValue));
}
Debug.WriteLine("{0} -> DataType.{1}", typeof(T), dataType);
Assert.That(conn.Execute<T>("SELECT :p", new DataParameter { Name = "p", DataType = dataType, Value = expectedValue }), Is.EqualTo(expectedValue));
Debug.WriteLine("{0} -> auto", typeof(T));
Assert.That(conn.Execute<T>("SELECT :p", new DataParameter { Name = "p", Value = expectedValue }), Is.EqualTo(expectedValue));
Debug.WriteLine("{0} -> new", typeof(T));
Assert.That(conn.Execute<T>("SELECT :p", new { p = expectedValue }), Is.EqualTo(expectedValue));
}
static void TestSimple<T>(DataConnection conn, T expectedValue, DataType dataType)
where T : struct
{
TestNumeric<T> (conn, expectedValue, dataType);
TestNumeric<T?>(conn, expectedValue, dataType);
TestNumeric<T?>(conn, (T?)null, dataType);
}
[Test, IncludeDataContextSource(CurrentProvider)]
public void TestNumerics(string context)
{
using (var conn = new DataConnection(context))
{
TestSimple<sbyte> (conn, 1, DataType.SByte);
TestSimple<short> (conn, 1, DataType.Int16);
TestSimple<int> (conn, 1, DataType.Int32);
TestSimple<long> (conn, 1L, DataType.Int64);
TestSimple<byte> (conn, 1, DataType.Byte);
TestSimple<ushort> (conn, 1, DataType.UInt16);
TestSimple<uint> (conn, 1u, DataType.UInt32);
TestSimple<ulong> (conn, 1ul, DataType.UInt64);
TestSimple<float> (conn, 1, DataType.Single);
TestSimple<double> (conn, 1d, DataType.Double);
TestSimple<decimal>(conn, 1m, DataType.Decimal);
TestSimple<decimal>(conn, 1m, DataType.VarNumeric);
TestSimple<decimal>(conn, 1m, DataType.Money);
TestSimple<decimal>(conn, 1m, DataType.SmallMoney);
TestNumeric(conn, sbyte.MinValue, DataType.SByte, "money");
TestNumeric(conn, sbyte.MaxValue, DataType.SByte);
TestNumeric(conn, short.MinValue, DataType.Int16, "money");
TestNumeric(conn, short.MaxValue, DataType.Int16);
TestNumeric(conn, int.MinValue, DataType.Int32, "money smallint");
TestNumeric(conn, int.MaxValue, DataType.Int32, "smallint real");
TestNumeric(conn, long.MinValue, DataType.Int64, "int money smallint");
TestNumeric(conn, long.MaxValue, DataType.Int64, "int money smallint float real");
TestNumeric(conn, byte.MaxValue, DataType.Byte);
TestNumeric(conn, ushort.MaxValue, DataType.UInt16, "int smallint");
TestNumeric(conn, uint.MaxValue, DataType.UInt32, "int smallint real");
TestNumeric(conn, ulong.MaxValue, DataType.UInt64, "bigint int money smallint float real");
TestNumeric(conn, -3.40282306E+38f, DataType.Single, "bigint int money smallint numeric numeric(38)");
TestNumeric(conn, 3.40282306E+38f, DataType.Single, "bigint int money numeric numeric(38) smallint");
TestNumeric(conn, -1.79E+308d, DataType.Double, "bigint int money numeric numeric(38) smallint real");
TestNumeric(conn, 1.79E+308d, DataType.Double, "bigint int money numeric numeric(38) smallint real");
TestNumeric(conn, decimal.MinValue, DataType.Decimal, "bigint int money numeric numeric(38) smallint float real");
TestNumeric(conn, decimal.MaxValue, DataType.Decimal, "bigint int money numeric numeric(38) smallint float real");
TestNumeric(conn, decimal.MinValue, DataType.VarNumeric, "bigint int money numeric numeric(38) smallint float real");
TestNumeric(conn, decimal.MaxValue, DataType.VarNumeric, "bigint int money numeric numeric(38) smallint float real");
TestNumeric(conn, -922337203685477m, DataType.Money, "int money smallint real");
TestNumeric(conn, +922337203685477m, DataType.Money, "int smallint real");
TestNumeric(conn, -214748m, DataType.SmallMoney, "money smallint smallint");
TestNumeric(conn, +214748m, DataType.SmallMoney, "smallint");
}
}
[Test, IncludeDataContextSource(CurrentProvider)]
public void TestDate(string context)
{
using (var conn = new DataConnection(context))
{
var dateTime = new DateTime(2012, 12, 12);
Assert.That(conn.Execute<DateTime> ("SELECT Cast('2012-12-12' as date)"), Is.EqualTo(dateTime));
Assert.That(conn.Execute<DateTime?>("SELECT Cast('2012-12-12' as date)"), Is.EqualTo(dateTime));
Assert.That(conn.Execute<DateTime> ("SELECT :p", DataParameter.Date("p", dateTime)), Is.EqualTo(dateTime));
Assert.That(conn.Execute<DateTime?>("SELECT :p", new DataParameter("p", dateTime, DataType.Date)), Is.EqualTo(dateTime));
}
}
[Test, IncludeDataContextSource(CurrentProvider)]
public void TestDateTime(string context)
{
using (var conn = new DataConnection(context))
{
var dateTime = new DateTime(2012, 12, 12, 12, 12, 12);
Assert.That(conn.Execute<DateTime> ("SELECT Cast('2012-12-12 12:12:12' as timestamp)"), Is.EqualTo(dateTime));
Assert.That(conn.Execute<DateTime?>("SELECT Cast('2012-12-12 12:12:12' as timestamp)"), Is.EqualTo(dateTime));
Assert.That(conn.Execute<DateTime> ("SELECT :p", DataParameter.DateTime("p", dateTime)), Is.EqualTo(dateTime));
Assert.That(conn.Execute<DateTime?>("SELECT :p", new DataParameter("p", dateTime)), Is.EqualTo(dateTime));
Assert.That(conn.Execute<DateTime?>("SELECT :p", new DataParameter("p", dateTime, DataType.DateTime)), Is.EqualTo(dateTime));
}
}
[Test, IncludeDataContextSource(CurrentProvider)]
public void TestChar(string context)
{
using (var conn = new DataConnection(context))
{
Assert.That(conn.Execute<char> ("SELECT Cast('1' as char)"), Is.EqualTo('1'));
Assert.That(conn.Execute<char?>("SELECT Cast('1' as char)"), Is.EqualTo('1'));
Assert.That(conn.Execute<char> ("SELECT Cast('1' as char(1))"), Is.EqualTo('1'));
Assert.That(conn.Execute<char?>("SELECT Cast('1' as char(1))"), Is.EqualTo('1'));
Assert.That(conn.Execute<char> ("SELECT Cast('1' as varchar)"), Is.EqualTo('1'));
Assert.That(conn.Execute<char?>("SELECT Cast('1' as varchar)"), Is.EqualTo('1'));
Assert.That(conn.Execute<char> ("SELECT Cast('1' as varchar(20))"), Is.EqualTo('1'));
Assert.That(conn.Execute<char?>("SELECT Cast('1' as varchar(20))"), Is.EqualTo('1'));
Assert.That(conn.Execute<char> ("SELECT :p", DataParameter.Char("p", '1')), Is.EqualTo('1'));
Assert.That(conn.Execute<char?>("SELECT :p", DataParameter.Char("p", '1')), Is.EqualTo('1'));
Assert.That(conn.Execute<char> ("SELECT Cast(:p as char)", DataParameter.Char("p", '1')), Is.EqualTo('1'));
Assert.That(conn.Execute<char?>("SELECT Cast(:p as char)", DataParameter.Char("p", '1')), Is.EqualTo('1'));
Assert.That(conn.Execute<char> ("SELECT Cast(:p as char(1))", DataParameter.Char("@p", '1')), Is.EqualTo('1'));
Assert.That(conn.Execute<char?>("SELECT Cast(:p as char(1))", DataParameter.Char("@p", '1')), Is.EqualTo('1'));
Assert.That(conn.Execute<char> ("SELECT :p", DataParameter.VarChar ("p", '1')), Is.EqualTo('1'));
Assert.That(conn.Execute<char?>("SELECT :p", DataParameter.VarChar ("p", '1')), Is.EqualTo('1'));
Assert.That(conn.Execute<char> ("SELECT :p", DataParameter.NChar ("p", '1')), Is.EqualTo('1'));
Assert.That(conn.Execute<char?>("SELECT :p", DataParameter.NChar ("p", '1')), Is.EqualTo('1'));
Assert.That(conn.Execute<char> ("SELECT :p", DataParameter.NVarChar("p", '1')), Is.EqualTo('1'));
Assert.That(conn.Execute<char?>("SELECT :p", DataParameter.NVarChar("p", '1')), Is.EqualTo('1'));
Assert.That(conn.Execute<char> ("SELECT :p", DataParameter.Create ("p", '1')), Is.EqualTo('1'));
Assert.That(conn.Execute<char?>("SELECT :p", DataParameter.Create ("p", '1')), Is.EqualTo('1'));
Assert.That(conn.Execute<char> ("SELECT :p", new DataParameter { Name = "p", Value = '1' }), Is.EqualTo('1'));
Assert.That(conn.Execute<char?>("SELECT :p", new DataParameter { Name = "p", Value = '1' }), Is.EqualTo('1'));
}
}
[Test, IncludeDataContextSource(CurrentProvider)]
public void TestString(string context)
{
using (var conn = new DataConnection(context))
{
Assert.That(conn.Execute<string>("SELECT Cast('12345' as char(20))"), Is.EqualTo("12345"));
Assert.That(conn.Execute<string>("SELECT Cast(NULL as char(20))"), Is.Null);
Assert.That(conn.Execute<string>("SELECT Cast('12345' as varchar(20))"), Is.EqualTo("12345"));
Assert.That(conn.Execute<string>("SELECT Cast(NULL as varchar(20))"), Is.Null);
Assert.That(conn.Execute<string>("SELECT Cast('12345' as text)"), Is.EqualTo("12345"));
Assert.That(conn.Execute<string>("SELECT Cast(NULL as text)"), Is.Null);
Assert.That(conn.Execute<string>("SELECT :p", DataParameter.Char ("p", "123")), Is.EqualTo("123"));
Assert.That(conn.Execute<string>("SELECT :p", DataParameter.VarChar ("p", "123")), Is.EqualTo("123"));
Assert.That(conn.Execute<string>("SELECT :p", DataParameter.Text ("p", "123")), Is.EqualTo("123"));
Assert.That(conn.Execute<string>("SELECT :p", DataParameter.NChar ("p", "123")), Is.EqualTo("123"));
Assert.That(conn.Execute<string>("SELECT :p", DataParameter.NVarChar("p", "123")), Is.EqualTo("123"));
Assert.That(conn.Execute<string>("SELECT :p", DataParameter.NText ("p", "123")), Is.EqualTo("123"));
Assert.That(conn.Execute<string>("SELECT :p", DataParameter.Create ("p", "123")), Is.EqualTo("123"));
Assert.That(conn.Execute<string>("SELECT :p", DataParameter.Create("p", (string)null)), Is.EqualTo(null));
Assert.That(conn.Execute<string>("SELECT :p", new DataParameter { Name = "p", Value = "1" }), Is.EqualTo("1"));
}
}
[Test, IncludeDataContextSource(CurrentProvider)]
public void TestBinary(string context)
{
var arr1 = new byte[] { 48, 57 };
using (var conn = new DataConnection(context))
{
Assert.That(conn.Execute<byte[]>("SELECT E'\\060\\071'::bytea"), Is.EqualTo(arr1));
Assert.That(conn.Execute<byte[]>("SELECT @p", DataParameter.Binary ("p", arr1)), Is.EqualTo(arr1));
Assert.That(conn.Execute<byte[]>("SELECT @p", DataParameter.VarBinary("p", arr1)), Is.EqualTo(arr1));
Assert.That(conn.Execute<byte[]>("SELECT @p", DataParameter.Create ("p", arr1)), Is.EqualTo(arr1));
Assert.That(conn.Execute<byte[]>("SELECT @p", DataParameter.VarBinary("p", null)), Is.EqualTo(null));
Assert.That(conn.Execute<byte[]>("SELECT @p", DataParameter.VarBinary("p", new byte[0])), Is.EqualTo(new byte[0]));
Assert.That(conn.Execute<byte[]>("SELECT @p", DataParameter.Image ("p", new byte[0])), Is.EqualTo(new byte[0]));
Assert.That(conn.Execute<byte[]>("SELECT @p", new DataParameter { Name = "p", Value = arr1 }), Is.EqualTo(arr1));
Assert.That(conn.Execute<byte[]>("SELECT @p", DataParameter.Create ("p", new Binary(arr1))), Is.EqualTo(arr1));
Assert.That(conn.Execute<byte[]>("SELECT @p", new DataParameter("p", new Binary(arr1))), Is.EqualTo(arr1));
}
}
[Test, IncludeDataContextSource(CurrentProvider)]
public void TestGuid(string context)
{
using (var conn = new DataConnection(context))
{
Assert.That(
conn.Execute<Guid>("SELECT Cast('6F9619FF-8B86-D011-B42D-00C04FC964FF' as uuid)"),
Is.EqualTo(new Guid("6F9619FF-8B86-D011-B42D-00C04FC964FF")));
Assert.That(
conn.Execute<Guid?>("SELECT Cast('6F9619FF-8B86-D011-B42D-00C04FC964FF' as uuid)"),
Is.EqualTo(new Guid("6F9619FF-8B86-D011-B42D-00C04FC964FF")));
var guid = Guid.NewGuid();
Assert.That(conn.Execute<Guid>("SELECT :p", DataParameter.Create("p", guid)), Is.EqualTo(guid));
Assert.That(conn.Execute<Guid>("SELECT :p", new DataParameter { Name = "p", Value = guid }), Is.EqualTo(guid));
}
}
[Test, IncludeDataContextSource(CurrentProvider)]
public void TestXml(string context)
{
using (var conn = new DataConnection(context))
{
Assert.That(conn.Execute<string> ("SELECT XMLPARSE (DOCUMENT'<xml/>')"), Is.EqualTo("<xml/>"));
Assert.That(conn.Execute<XDocument> ("SELECT XMLPARSE (DOCUMENT'<xml/>')").ToString(), Is.EqualTo("<xml />"));
Assert.That(conn.Execute<XmlDocument>("SELECT XMLPARSE (DOCUMENT'<xml/>')").InnerXml, Is.EqualTo("<xml />"));
var xdoc = XDocument.Parse("<xml/>");
var xml = Convert<string,XmlDocument>.Lambda("<xml/>");
Assert.That(conn.Execute<string> ("SELECT @p", DataParameter.Xml("p", "<xml/>")), Is.EqualTo("<xml/>"));
Assert.That(conn.Execute<XDocument> ("SELECT @p", DataParameter.Xml("p", xdoc)).ToString(), Is.EqualTo("<xml />"));
Assert.That(conn.Execute<XmlDocument>("SELECT @p", DataParameter.Xml("p", xml)). InnerXml, Is.EqualTo("<xml />"));
Assert.That(conn.Execute<XDocument> ("SELECT @p", new DataParameter("p", xdoc)).ToString(), Is.EqualTo("<xml />"));
Assert.That(conn.Execute<XDocument> ("SELECT @p", new DataParameter("p", xml)). ToString(), Is.EqualTo("<xml />"));
}
}
enum TestEnum
{
[MapValue("A")] AA,
[MapValue("B")] BB,
}
[Test, IncludeDataContextSource(CurrentProvider)]
public void TestEnum1(string context)
{
using (var conn = new DataConnection(context))
{
Assert.That(conn.Execute<TestEnum> ("SELECT 'A'"), Is.EqualTo(TestEnum.AA));
Assert.That(conn.Execute<TestEnum?>("SELECT 'A'"), Is.EqualTo(TestEnum.AA));
Assert.That(conn.Execute<TestEnum> ("SELECT 'B'"), Is.EqualTo(TestEnum.BB));
Assert.That(conn.Execute<TestEnum?>("SELECT 'B'"), Is.EqualTo(TestEnum.BB));
}
}
[Test, IncludeDataContextSource(CurrentProvider)]
public void TestEnum2(string context)
{
using (var conn = new DataConnection(context))
{
Assert.That(conn.Execute<string>("SELECT @p", new { p = TestEnum.AA }), Is.EqualTo("A"));
Assert.That(conn.Execute<string>("SELECT @p", new { p = (TestEnum?)TestEnum.BB }), Is.EqualTo("B"));
Assert.That(conn.Execute<string>("SELECT @p", new { p = ConvertTo<string>.From((TestEnum?)TestEnum.AA) }), Is.EqualTo("A"));
Assert.That(conn.Execute<string>("SELECT @p", new { p = ConvertTo<string>.From(TestEnum.AA) }), Is.EqualTo("A"));
Assert.That(conn.Execute<string>("SELECT @p", new { p = conn.MappingSchema.GetConverter<TestEnum?,string>()(TestEnum.AA) }), Is.EqualTo("A"));
}
}
[Test, IncludeDataContextSource(CurrentProvider)]
public void SequenceInsert1(string context)
{
using (var db = GetDataContext(context))
{
db.GetTable<PostgreSQLSpecific.SequenceTest1>().Where(_ => _.Value == "SeqValue").Delete();
db.Insert(new PostgreSQLSpecific.SequenceTest1 { Value = "SeqValue" });
var id = db.GetTable<PostgreSQLSpecific.SequenceTest1>().Single(_ => _.Value == "SeqValue").ID;
db.GetTable<PostgreSQLSpecific.SequenceTest1>().Where(_ => _.ID == id).Delete();
Assert.AreEqual(0, db.GetTable<PostgreSQLSpecific.SequenceTest1>().Count(_ => _.Value == "SeqValue"));
}
}
[Test, IncludeDataContextSource(CurrentProvider)]
public void SequenceInsert2(string context)
{
using (var db = GetDataContext(context))
{
db.GetTable<PostgreSQLSpecific.SequenceTest2>().Where(_ => _.Value == "SeqValue").Delete();
db.Insert(new PostgreSQLSpecific.SequenceTest2 { Value = "SeqValue" });
var id = db.GetTable<PostgreSQLSpecific.SequenceTest2>().Single(_ => _.Value == "SeqValue").ID;
db.GetTable<PostgreSQLSpecific.SequenceTest2>().Where(_ => _.ID == id).Delete();
Assert.AreEqual(0, db.GetTable<PostgreSQLSpecific.SequenceTest2>().Count(_ => _.Value == "SeqValue"));
}
}
[Test, IncludeDataContextSource(CurrentProvider)]
public void SequenceInsert3(string context)
{
using (var db = GetDataContext(context))
{
db.GetTable<PostgreSQLSpecific.SequenceTest3>().Where(_ => _.Value == "SeqValue").Delete();
db.Insert(new PostgreSQLSpecific.SequenceTest3 { Value = "SeqValue" });
var id = db.GetTable<PostgreSQLSpecific.SequenceTest3>().Single(_ => _.Value == "SeqValue").ID;
db.GetTable<PostgreSQLSpecific.SequenceTest3>().Where(_ => _.ID == id).Delete();
Assert.AreEqual(0, db.GetTable<PostgreSQLSpecific.SequenceTest3>().Count(_ => _.Value == "SeqValue"));
}
}
[Test, IncludeDataContextSource(CurrentProvider)]
public void SequenceInsertWithIdentity1(string context)
{
using (var db = GetDataContext(context))
{
db.GetTable<PostgreSQLSpecific.SequenceTest1>().Where(_ => _.Value == "SeqValue").Delete();
var id1 = Convert.ToInt32(db.InsertWithIdentity(new PostgreSQLSpecific.SequenceTest1 { Value = "SeqValue" }));
var id2 = db.GetTable<PostgreSQLSpecific.SequenceTest1>().Single(_ => _.Value == "SeqValue").ID;
Assert.AreEqual(id1, id2);
db.GetTable<PostgreSQLSpecific.SequenceTest1>().Where(_ => _.ID == id1).Delete();
Assert.AreEqual(0, db.GetTable<PostgreSQLSpecific.SequenceTest1>().Count(_ => _.Value == "SeqValue"));
}
}
[Test, IncludeDataContextSource(CurrentProvider)]
public void SequenceInsertWithIdentity2(string context)
{
using (var db = GetDataContext(context))
{
db.GetTable<PostgreSQLSpecific.SequenceTest2>().Where(_ => _.Value == "SeqValue").Delete();
var id1 = Convert.ToInt32(db.InsertWithIdentity(new PostgreSQLSpecific.SequenceTest2 { Value = "SeqValue" }));
var id2 = db.GetTable<PostgreSQLSpecific.SequenceTest2>().Single(_ => _.Value == "SeqValue").ID;
Assert.AreEqual(id1, id2);
db.GetTable<PostgreSQLSpecific.SequenceTest2>().Where(_ => _.ID == id1).Delete();
Assert.AreEqual(0, db.GetTable<PostgreSQLSpecific.SequenceTest2>().Count(_ => _.Value == "SeqValue"));
}
}
[Test, IncludeDataContextSource(CurrentProvider)]
public void SequenceInsertWithIdentity3(string context)
{
using (var db = GetDataContext(context))
{
db.GetTable<PostgreSQLSpecific.SequenceTest3>().Where(_ => _.Value == "SeqValue").Delete();
var id1 = Convert.ToInt32(db.InsertWithIdentity(new PostgreSQLSpecific.SequenceTest3 { Value = "SeqValue" }));
var id2 = db.GetTable<PostgreSQLSpecific.SequenceTest3>().Single(_ => _.Value == "SeqValue").ID;
Assert.AreEqual(id1, id2);
db.GetTable<PostgreSQLSpecific.SequenceTest3>().Where(_ => _.ID == id1).Delete();
Assert.AreEqual(0, db.GetTable<PostgreSQLSpecific.SequenceTest3>().Count(_ => _.Value == "SeqValue"));
}
}
[Test, IncludeDataContextSource(CurrentProvider)]
public void SequenceInsertWithIdentity4(string context)
{
using (var db = GetDataContext(context))
{
db.GetTable<PostgreSQLSpecific.TestSchemaIdentity>().Delete();
var id1 = Convert.ToInt32(db.InsertWithIdentity(new PostgreSQLSpecific.TestSchemaIdentity { }));
var id2 = db.GetTable<PostgreSQLSpecific.TestSchemaIdentity>().Single().ID;
Assert.AreEqual(id1, id2);
db.GetTable<PostgreSQLSpecific.TestSchemaIdentity>().Delete();
}
}
[Test, IncludeDataContextSource(CurrentProvider)]
public void SequenceInsertWithIdentity5(string context)
{
using (var db = GetDataContext(context))
{
db.GetTable<PostgreSQLSpecific.TestSerialIdentity>().Delete();
var id1 = Convert.ToInt32(db.InsertWithIdentity(new PostgreSQLSpecific.TestSerialIdentity { }));
var id2 = db.GetTable<PostgreSQLSpecific.TestSerialIdentity>().Single().ID;
Assert.AreEqual(id1, id2);
db.GetTable<PostgreSQLSpecific.TestSerialIdentity>().Delete();
}
}
[Test, IncludeDataContextSource(CurrentProvider)]
public void BulkCopyLinqTypes(string context)
{
foreach (var bulkCopyType in new[] { BulkCopyType.MultipleRows, BulkCopyType.ProviderSpecific })
{
using (var db = new DataConnection(context))
{
db.BulkCopy(
new BulkCopyOptions { BulkCopyType = bulkCopyType },
Enumerable.Range(0, 10).Select(n =>
new LinqDataTypes
{
ID = 4000 + n,
MoneyValue = 1000m + n,
DateTimeValue = new DateTime(2001, 1, 11, 1, 11, 21, 100),
BoolValue = true,
GuidValue = Guid.NewGuid(),
SmallIntValue = (short)n
}
));
db.GetTable<LinqDataTypes>().Delete(p => p.ID >= 4000);
}
}
}
public class TestTeamplate
{
public string cdni_cd_cod_numero_item1;
}
[Test, IncludeDataContextSource(CurrentProvider)]
public void Issue140(string context)
{
using (var db = new DataConnection(context))
{
var list = db.Query<TestTeamplate>("select 1 as cdni_cd_cod_numero_item1").ToList();
Assert.That(list.Count, Is.EqualTo(1));
Assert.That(list[0].cdni_cd_cod_numero_item1, Is.EqualTo("1"));
}
}
}
}
|
Walter’s career started as a fitter/welder on the shop floor and progressed through several roles to spending over 20 years as the President of Walters Group. Under his direction, Walters Group experienced significant and sustained growth.
In 2016 Walter moved into the role of CEO & Chairman, allowing him to focus on client relationship development and further development of Walters relationships with their partner companies, including iSPAN. In 2018, seeing great potential for the business, Walter then also took on the role of President of iSPAN to lead the business through their accelerating growth.
Walter is actively involved in several structural steel and local business associations. He has held the position of President of the Hamilton Construction Association and is a member of the Board of Directors of the Ontario Erectors Association. He has also served as a Board Member of the Canadian Institute of Structural Steel and led the development of Architecturally Exposed Structural Steel (AESS) specifications and Chaired the committee to formalize AESS standards. |
package com.wind.common;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.io.CharTypes;
import com.fasterxml.jackson.core.json.JsonWriteContext;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;
import java.io.IOException;
public class StringUnicodeSerializer extends JsonSerializer<String> {
private final char[] HEX_CHARS = "0123456789ABCDEF".toCharArray();
private final int[] ESCAPE_CODES = CharTypes.get7BitOutputEscapes();
private void writeUnicodeEscape(JsonGenerator gen, char c) throws IOException {
gen.writeRaw('\\');
gen.writeRaw('u');
gen.writeRaw(HEX_CHARS[(c >> 12) & 0xF]);
gen.writeRaw(HEX_CHARS[(c >> 8) & 0xF]);
gen.writeRaw(HEX_CHARS[(c >> 4) & 0xF]);
gen.writeRaw(HEX_CHARS[c & 0xF]);
}
private void writeShortEscape(JsonGenerator gen, char c) throws IOException {
gen.writeRaw('\\');
gen.writeRaw(c);
}
@Override
public void serialize(String str, JsonGenerator gen,
SerializerProvider provider) throws IOException {
int status = ((JsonWriteContext) gen.getOutputContext()).writeValue();
switch (status) {
case JsonWriteContext.STATUS_OK_AFTER_COLON:
gen.writeRaw(':');
break;
case JsonWriteContext.STATUS_OK_AFTER_COMMA:
gen.writeRaw(',');
break;
case JsonWriteContext.STATUS_EXPECT_NAME:
throw new IOException("Can not write string value here");
}
gen.writeRaw('"');//写入JSON中字符串的开头引号
for (char c : str.toCharArray()) {
if (c >= 0x80) {
writeUnicodeEscape(gen, c); // 为所有非ASCII字符生成转义的unicode字符
} else {
// 为ASCII字符中前128个字符使用转义的unicode字符
int code = (c < ESCAPE_CODES.length ? ESCAPE_CODES[c] : 0);
if (code == 0) {
gen.writeRaw(c); // 此处不用转义
} else if (code < 0) {
writeUnicodeEscape(gen, (char) (-code - 1)); // 通用转义字符
} else {
writeShortEscape(gen, (char) code); // 短转义字符 (\n \t ...)
}
}
}
gen.writeRaw('"');//写入JSON中字符串的结束引号
}
} |
// 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;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Diagnostics;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.Emit;
using Microsoft.CodeAnalysis.ErrorReporting;
using Microsoft.CodeAnalysis.Host;
using Microsoft.CodeAnalysis.Internal.Log;
using Microsoft.CodeAnalysis.PooledObjects;
using Microsoft.CodeAnalysis.Text;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.EditAndContinue
{
/// <summary>
/// Implements core of Edit and Continue orchestration: management of edit sessions and connecting EnC related services.
/// </summary>
internal sealed class EditAndContinueWorkspaceService : IEditAndContinueWorkspaceService
{
internal static readonly TraceLog Log = new(2048, "EnC");
private readonly Workspace _workspace;
private readonly IDiagnosticAnalyzerService _diagnosticService;
private readonly IDebuggeeModuleMetadataProvider _debugeeModuleMetadataProvider;
private readonly EditAndContinueDiagnosticUpdateSource _emitDiagnosticsUpdateSource;
private readonly EditSessionTelemetry _editSessionTelemetry;
private readonly DebuggingSessionTelemetry _debuggingSessionTelemetry;
private readonly Func<Project, CompilationOutputs> _compilationOutputsProvider;
private readonly Action<DebuggingSessionTelemetry.Data> _reportTelemetry;
/// <summary>
/// A document id is added whenever a diagnostic is reported while in run mode.
/// These diagnostics are cleared as soon as we enter break mode or the debugging session terminates.
/// </summary>
private readonly HashSet<DocumentId> _documentsWithReportedDiagnosticsDuringRunMode;
private readonly object _documentsWithReportedDiagnosticsDuringRunModeGuard = new();
private DebuggingSession? _debuggingSession;
private EditSession? _editSession;
internal EditAndContinueWorkspaceService(
Workspace workspace,
IDiagnosticAnalyzerService diagnosticService,
EditAndContinueDiagnosticUpdateSource diagnosticUpdateSource,
IDebuggeeModuleMetadataProvider debugeeModuleMetadataProvider,
Func<Project, CompilationOutputs>? testCompilationOutputsProvider = null,
Action<DebuggingSessionTelemetry.Data>? testReportTelemetry = null)
{
_workspace = workspace;
_diagnosticService = diagnosticService;
_emitDiagnosticsUpdateSource = diagnosticUpdateSource;
_debugeeModuleMetadataProvider = debugeeModuleMetadataProvider;
_debuggingSessionTelemetry = new DebuggingSessionTelemetry();
_editSessionTelemetry = new EditSessionTelemetry();
_documentsWithReportedDiagnosticsDuringRunMode = new HashSet<DocumentId>();
_compilationOutputsProvider = testCompilationOutputsProvider ?? GetCompilationOutputs;
_reportTelemetry = testReportTelemetry ?? ReportTelemetry;
}
// test only:
internal DebuggingSession? Test_GetDebuggingSession() => _debuggingSession;
internal EditSession? Test_GetEditSession() => _editSession;
internal Workspace Test_GetWorkspace() => _workspace;
public bool IsDebuggingSessionInProgress
=> _debuggingSession != null;
private static CompilationOutputs GetCompilationOutputs(Project project)
{
// The Project System doesn't always indicate whether we emit PDB, what kind of PDB we emit nor the path of the PDB.
// To work around we look for the PDB on the path specified in the PDB debug directory.
// https://github.com/dotnet/roslyn/issues/35065
return new CompilationOutputFilesWithImplicitPdbPath(project.CompilationOutputInfo.AssemblyPath);
}
public void OnSourceFileUpdated(DocumentId documentId)
{
var debuggingSession = _debuggingSession;
if (debuggingSession != null)
{
// fire and forget
_ = Task.Run(() => debuggingSession.LastCommittedSolution.OnSourceFileUpdatedAsync(documentId, debuggingSession.CancellationToken));
}
}
public void StartDebuggingSession(Solution solution)
{
var previousSession = Interlocked.CompareExchange(ref _debuggingSession, new DebuggingSession(solution, _compilationOutputsProvider), null);
Contract.ThrowIfFalse(previousSession == null, "New debugging session can't be started until the existing one has ended.");
}
public void StartEditSession(ActiveStatementProvider activeStatementsProvider)
{
var debuggingSession = _debuggingSession;
Contract.ThrowIfNull(debuggingSession, "Edit session can only be started during debugging session");
var newSession = new EditSession(debuggingSession, _editSessionTelemetry, activeStatementsProvider, _debugeeModuleMetadataProvider);
var previousSession = Interlocked.CompareExchange(ref _editSession, newSession, null);
Contract.ThrowIfFalse(previousSession == null, "New edit session can't be started until the existing one has ended.");
// clear diagnostics reported during run mode:
ClearReportedRunModeDiagnostics();
}
public void EndEditSession()
{
// first, publish null session:
var session = Interlocked.Exchange(ref _editSession, null);
Contract.ThrowIfNull(session, "Edit session has not started.");
// then cancel all ongoing work bound to the session:
session.Cancel();
// then clear all reported rude edits:
_diagnosticService.Reanalyze(_workspace, documentIds: session.GetDocumentsWithReportedDiagnostics());
_debuggingSessionTelemetry.LogEditSession(_editSessionTelemetry.GetDataAndClear());
session.Dispose();
}
public void EndDebuggingSession()
{
var debuggingSession = Interlocked.Exchange(ref _debuggingSession, null);
Contract.ThrowIfNull(debuggingSession, "Debugging session has not started.");
// cancel all ongoing work bound to the session:
debuggingSession.Cancel();
_reportTelemetry(_debuggingSessionTelemetry.GetDataAndClear());
// clear emit/apply diagnostics reported previously:
_emitDiagnosticsUpdateSource.ClearDiagnostics();
// clear diagnostics reported during run mode:
ClearReportedRunModeDiagnostics();
debuggingSession.Dispose();
}
internal static bool SupportsEditAndContinue(Project project)
=> project.LanguageServices.GetService<IEditAndContinueAnalyzer>() != null;
public async Task<ImmutableArray<Diagnostic>> GetDocumentDiagnosticsAsync(Document document, DocumentActiveStatementSpanProvider activeStatementSpanProvider, CancellationToken cancellationToken)
{
try
{
var debuggingSession = _debuggingSession;
if (debuggingSession == null)
{
return ImmutableArray<Diagnostic>.Empty;
}
// Not a C# or VB project.
var project = document.Project;
if (!SupportsEditAndContinue(project))
{
return ImmutableArray<Diagnostic>.Empty;
}
// Document does not compile to the assembly (e.g. cshtml files, .g.cs files generated for completion only)
if (document.State.Attributes.DesignTimeOnly || !document.SupportsSyntaxTree)
{
return ImmutableArray<Diagnostic>.Empty;
}
// Do not analyze documents (and report diagnostics) of projects that have not been built.
// Allow user to make any changes in these documents, they won't be applied within the current debugging session.
// Do not report the file read error - it might be an intermittent issue. The error will be reported when the
// change is attempted to be applied.
var (mvid, _) = await debuggingSession.GetProjectModuleIdAsync(project, cancellationToken).ConfigureAwait(false);
if (mvid == Guid.Empty)
{
return ImmutableArray<Diagnostic>.Empty;
}
var (oldDocument, oldDocumentState) = await debuggingSession.LastCommittedSolution.GetDocumentAndStateAsync(document.Id, cancellationToken).ConfigureAwait(false);
if (oldDocumentState == CommittedSolution.DocumentState.OutOfSync ||
oldDocumentState == CommittedSolution.DocumentState.Indeterminate ||
oldDocumentState == CommittedSolution.DocumentState.DesignTimeOnly)
{
// Do not report diagnostics for existing out-of-sync documents or design-time-only documents.
return ImmutableArray<Diagnostic>.Empty;
}
// The document has not changed while the application is running since the last changes were committed:
var editSession = _editSession;
if (editSession == null)
{
if (document == oldDocument)
{
return ImmutableArray<Diagnostic>.Empty;
}
// Any changes made in loaded, built projects outside of edit session are rude edits (the application is running):
var newSyntaxTree = await document.GetSyntaxTreeAsync(cancellationToken).ConfigureAwait(false);
Contract.ThrowIfNull(newSyntaxTree);
var changedSpans = await GetChangedSpansAsync(oldDocument, newSyntaxTree, cancellationToken).ConfigureAwait(false);
return GetRunModeDocumentDiagnostics(document, newSyntaxTree, changedSpans);
}
var documentActiveStatementSpans = await activeStatementSpanProvider(cancellationToken).ConfigureAwait(false);
var analysis = await editSession.GetDocumentAnalysis(oldDocument, document, documentActiveStatementSpans).GetValueAsync(cancellationToken).ConfigureAwait(false);
if (analysis.HasChanges)
{
// Once we detected a change in a document let the debugger know that the corresponding loaded module
// is about to be updated, so that it can start initializing it for EnC update, reducing the amount of time applying
// the change blocks the UI when the user "continues".
if (debuggingSession.AddModulePreparedForUpdate(mvid))
{
// fire and forget:
_ = Task.Run(() => _debugeeModuleMetadataProvider.PrepareModuleForUpdateAsync(mvid, cancellationToken), cancellationToken);
}
}
if (analysis.RudeEditErrors.IsEmpty)
{
return ImmutableArray<Diagnostic>.Empty;
}
editSession.Telemetry.LogRudeEditDiagnostics(analysis.RudeEditErrors);
// track the document, so that we can refresh or clean diagnostics at the end of edit session:
editSession.TrackDocumentWithReportedDiagnostics(document.Id);
var tree = await document.GetSyntaxTreeAsync(cancellationToken).ConfigureAwait(false);
return analysis.RudeEditErrors.SelectAsArray((e, t) => e.ToDiagnostic(t), tree);
}
catch (Exception e) when (FatalError.ReportWithoutCrashUnlessCanceled(e))
{
return ImmutableArray<Diagnostic>.Empty;
}
}
private static async Task<IEnumerable<TextSpan>> GetChangedSpansAsync(Document? oldDocument, SyntaxTree newSyntaxTree, CancellationToken cancellationToken)
{
if (oldDocument != null)
{
var oldSyntaxTree = await oldDocument.GetSyntaxTreeAsync(cancellationToken).ConfigureAwait(false);
Contract.ThrowIfNull(oldSyntaxTree);
return GetSpansInNewDocument(await GetDocumentTextChangesAsync(oldSyntaxTree, newSyntaxTree, cancellationToken).ConfigureAwait(false));
}
var newRoot = await newSyntaxTree.GetRootAsync(cancellationToken).ConfigureAwait(false);
return SpecializedCollections.SingletonEnumerable(newRoot.FullSpan);
}
private ImmutableArray<Diagnostic> GetRunModeDocumentDiagnostics(Document newDocument, SyntaxTree newSyntaxTree, IEnumerable<TextSpan> changedSpans)
{
if (!changedSpans.Any())
{
return ImmutableArray<Diagnostic>.Empty;
}
lock (_documentsWithReportedDiagnosticsDuringRunModeGuard)
{
_documentsWithReportedDiagnosticsDuringRunMode.Add(newDocument.Id);
}
var descriptor = EditAndContinueDiagnosticDescriptors.GetDescriptor(EditAndContinueErrorCode.ChangesNotAppliedWhileRunning);
var args = new[] { newDocument.Project.Name };
return changedSpans.SelectAsArray(span => Diagnostic.Create(descriptor, Location.Create(newSyntaxTree, span), args));
}
// internal for testing
internal static async Task<IList<TextChange>> GetDocumentTextChangesAsync(SyntaxTree oldSyntaxTree, SyntaxTree newSyntaxTree, CancellationToken cancellationToken)
{
var list = newSyntaxTree.GetChanges(oldSyntaxTree);
if (list.Count != 0)
{
return list;
}
var oldText = await oldSyntaxTree.GetTextAsync(cancellationToken).ConfigureAwait(false);
var newText = await newSyntaxTree.GetTextAsync(cancellationToken).ConfigureAwait(false);
if (oldText.ContentEquals(newText))
{
return Array.Empty<TextChange>();
}
var roList = newText.GetTextChanges(oldText);
if (roList.Count != 0)
{
return roList.ToArray();
}
return Array.Empty<TextChange>();
}
// internal for testing
internal static IEnumerable<TextSpan> GetSpansInNewDocument(IEnumerable<TextChange> changes)
{
var oldPosition = 0;
var newPosition = 0;
foreach (var change in changes)
{
if (change.Span.Start < oldPosition)
{
Debug.Fail("Text changes not ordered");
yield break;
}
RoslynDebug.Assert(change.NewText is object);
if (change.Span.Length == 0 && change.NewText.Length == 0)
{
continue;
}
// skip unchanged text:
newPosition += change.Span.Start - oldPosition;
yield return new TextSpan(newPosition, change.NewText.Length);
// apply change:
oldPosition = change.Span.End;
newPosition += change.NewText.Length;
}
}
private void ClearReportedRunModeDiagnostics()
{
// clear diagnostics reported during run mode:
ImmutableArray<DocumentId> documentsToReanalyze;
lock (_documentsWithReportedDiagnosticsDuringRunModeGuard)
{
documentsToReanalyze = _documentsWithReportedDiagnosticsDuringRunMode.ToImmutableArray();
_documentsWithReportedDiagnosticsDuringRunMode.Clear();
}
// clear all reported run mode diagnostics:
_diagnosticService.Reanalyze(_workspace, documentIds: documentsToReanalyze);
}
/// <summary>
/// Determine whether the updates made to projects containing the specified file (or all projects that are built,
/// if <paramref name="sourceFilePath"/> is null) are ready to be applied and the debugger should attempt to apply
/// them on "continue".
/// </summary>
/// <returns>
/// Returns <see cref="SolutionUpdateStatus.Blocked"/> if there are rude edits or other errors
/// that block the application of the updates. Might return <see cref="SolutionUpdateStatus.Ready"/> even if there are
/// errors in the code that will block the application of the updates. E.g. emit diagnostics can't be determined until
/// emit is actually performed. Therefore, this method only serves as an optimization to avoid unnecessary emit attempts,
/// but does not provide a definitive answer. Only <see cref="EmitSolutionUpdateAsync"/> can definitively determine whether
/// the update is valid or not.
/// </returns>
public Task<bool> HasChangesAsync(Solution solution, SolutionActiveStatementSpanProvider solutionActiveStatementSpanProvider, string? sourceFilePath, CancellationToken cancellationToken)
{
// GetStatusAsync is called outside of edit session when the debugger is determining
// whether a source file checksum matches the one in PDB.
// The debugger expects no changes in this case.
var editSession = _editSession;
if (editSession == null)
{
return SpecializedTasks.False;
}
return editSession.HasChangesAsync(solution, solutionActiveStatementSpanProvider, sourceFilePath, cancellationToken);
}
public async Task<(SolutionUpdateStatus Summary, ImmutableArray<Deltas> Deltas)> EmitSolutionUpdateAsync(
Solution solution, SolutionActiveStatementSpanProvider activeStatementSpanProvider, CancellationToken cancellationToken)
{
var editSession = _editSession;
if (editSession == null)
{
return (SolutionUpdateStatus.None, ImmutableArray<Deltas>.Empty);
}
var solutionUpdate = await editSession.EmitSolutionUpdateAsync(solution, activeStatementSpanProvider, cancellationToken).ConfigureAwait(false);
if (solutionUpdate.Summary == SolutionUpdateStatus.Ready)
{
editSession.StorePendingUpdate(solution, solutionUpdate);
}
// clear emit/apply diagnostics reported previously:
_emitDiagnosticsUpdateSource.ClearDiagnostics();
// report emit/apply diagnostics:
foreach (var (projectId, diagnostics) in solutionUpdate.Diagnostics)
{
_emitDiagnosticsUpdateSource.ReportDiagnostics(_workspace, solution, projectId, diagnostics);
}
// Note that we may return empty deltas if all updates have been deferred.
// The debugger will still call commit or discard on the update batch.
return (solutionUpdate.Summary, solutionUpdate.Deltas);
}
public void CommitSolutionUpdate()
{
var editSession = _editSession;
Contract.ThrowIfNull(editSession);
var pendingUpdate = editSession.RetrievePendingUpdate();
editSession.DebuggingSession.CommitSolutionUpdate(pendingUpdate);
editSession.ChangesApplied();
}
public void DiscardSolutionUpdate()
{
var editSession = _editSession;
Contract.ThrowIfNull(editSession);
var pendingUpdate = editSession.RetrievePendingUpdate();
foreach (var moduleReader in pendingUpdate.ModuleReaders)
{
moduleReader.Dispose();
}
}
public async Task<ImmutableArray<ImmutableArray<(LinePositionSpan, ActiveStatementFlags)>>> GetBaseActiveStatementSpansAsync(ImmutableArray<DocumentId> documentIds, CancellationToken cancellationToken)
{
var editSession = _editSession;
if (editSession == null)
{
return default;
}
var lastCommittedSolution = editSession.DebuggingSession.LastCommittedSolution;
var baseActiveStatements = await editSession.BaseActiveStatements.GetValueAsync(cancellationToken).ConfigureAwait(false);
using var _ = ArrayBuilder<ImmutableArray<(LinePositionSpan, ActiveStatementFlags)>>.GetInstance(out var spans);
foreach (var documentId in documentIds)
{
if (baseActiveStatements.DocumentMap.TryGetValue(documentId, out var documentActiveStatements))
{
var (baseDocument, _) = await lastCommittedSolution.GetDocumentAndStateAsync(documentId, cancellationToken).ConfigureAwait(false);
if (baseDocument != null)
{
spans.Add(documentActiveStatements.SelectAsArray(s => (s.Span, s.Flags)));
continue;
}
}
// Document contains no active statements, or the document is not C#/VB document,
// it has been added, is out-of-sync or a design-time-only document.
spans.Add(ImmutableArray<(LinePositionSpan, ActiveStatementFlags)>.Empty);
}
return spans.ToImmutable();
}
public async Task<ImmutableArray<(LinePositionSpan, ActiveStatementFlags)>> GetAdjustedActiveStatementSpansAsync(Document document, DocumentActiveStatementSpanProvider activeStatementSpanProvider, CancellationToken cancellationToken)
{
var editSession = _editSession;
if (editSession == null)
{
return default;
}
if (!SupportsEditAndContinue(document.Project))
{
return default;
}
var lastCommittedSolution = editSession.DebuggingSession.LastCommittedSolution;
var (baseDocument, _) = await lastCommittedSolution.GetDocumentAndStateAsync(document.Id, cancellationToken).ConfigureAwait(false);
if (baseDocument == null)
{
return default;
}
var documentActiveStatementSpans = await activeStatementSpanProvider(cancellationToken).ConfigureAwait(false);
var analysis = await editSession.GetDocumentAnalysis(baseDocument, document, documentActiveStatementSpans).GetValueAsync(cancellationToken).ConfigureAwait(false);
if (analysis.ActiveStatements.IsDefault)
{
return default;
}
return analysis.ActiveStatements.SelectAsArray(s => (s.Span, s.Flags));
}
public async Task<LinePositionSpan?> GetCurrentActiveStatementPositionAsync(Solution solution, SolutionActiveStatementSpanProvider activeStatementSpanProvider, ActiveInstructionId instructionId, CancellationToken cancellationToken)
{
try
{
// It is allowed to call this method before entering or after exiting break mode. In fact, the VS debugger does so.
// We return null since there the concept of active statement only makes sense during break mode.
var editSession = _editSession;
if (editSession == null)
{
return null;
}
// TODO: Avoid enumerating active statements for unchanged documents.
// We would need to add a document path parameter to be able to find the document we need to check for changes.
// https://github.com/dotnet/roslyn/issues/24324
var baseActiveStatements = await editSession.BaseActiveStatements.GetValueAsync(cancellationToken).ConfigureAwait(false);
if (!baseActiveStatements.InstructionMap.TryGetValue(instructionId, out var baseActiveStatement))
{
return null;
}
var (oldPrimaryDocument, _) = await editSession.DebuggingSession.LastCommittedSolution.GetDocumentAndStateAsync(baseActiveStatement.PrimaryDocumentId, cancellationToken).ConfigureAwait(false);
if (oldPrimaryDocument == null)
{
// Can't determine position of an active statement if the document is out-of-sync with loaded module debug information.
return null;
}
var primaryDocument = solution.GetDocument(baseActiveStatement.PrimaryDocumentId);
if (primaryDocument == null)
{
// The document has been deleted.
return null;
}
var activeStatementSpans = await activeStatementSpanProvider(primaryDocument.Id, cancellationToken).ConfigureAwait(false);
var documentAnalysis = await editSession.GetDocumentAnalysis(oldPrimaryDocument, primaryDocument, activeStatementSpans).GetValueAsync(cancellationToken).ConfigureAwait(false);
var currentActiveStatements = documentAnalysis.ActiveStatements;
if (currentActiveStatements.IsDefault)
{
// The document has syntax errors.
return null;
}
return currentActiveStatements[baseActiveStatement.PrimaryDocumentOrdinal].Span;
}
catch (Exception e) when (FatalError.ReportWithoutCrashUnlessCanceled(e))
{
return null;
}
}
/// <summary>
/// Called by the debugger to determine whether an active statement is in an exception region,
/// so it can determine whether the active statement can be remapped. This only happens when the EnC is about to apply changes.
/// If the debugger determines we can remap active statements, the application of changes proceeds.
/// </summary>
/// <returns>
/// True if the instruction is located within an exception region, false if it is not, null if the instruction isn't an active statement
/// or the exception regions can't be determined.
/// </returns>
public async Task<bool?> IsActiveStatementInExceptionRegionAsync(ActiveInstructionId instructionId, CancellationToken cancellationToken)
{
try
{
var editSession = _editSession;
if (editSession == null)
{
return null;
}
// This method is only called when the EnC is about to apply changes, at which point all active statements and
// their exception regions will be needed. Hence it's not necessary to scope this query down to just the instruction
// the debugger is interested at this point while not calculating the others.
var baseActiveStatements = await editSession.BaseActiveStatements.GetValueAsync(cancellationToken).ConfigureAwait(false);
if (!baseActiveStatements.InstructionMap.TryGetValue(instructionId, out var baseActiveStatement))
{
return null;
}
var baseExceptionRegions = (await editSession.GetBaseActiveExceptionRegionsAsync(cancellationToken).ConfigureAwait(false))[baseActiveStatement.Ordinal];
// If the document is out-of-sync the exception regions can't be determined.
return baseExceptionRegions.Spans.IsDefault ? (bool?)null : baseExceptionRegions.IsActiveStatementCovered;
}
catch (Exception e) when (FatalError.ReportWithoutCrashUnlessCanceled(e))
{
return null;
}
}
public void ReportApplyChangesException(Solution solution, string message)
{
var descriptor = EditAndContinueDiagnosticDescriptors.GetDescriptor(EditAndContinueErrorCode.CannotApplyChangesUnexpectedError);
_emitDiagnosticsUpdateSource.ReportDiagnostics(
_workspace,
solution,
projectId: null,
new[] { Diagnostic.Create(descriptor, Location.None, new[] { message }) });
}
private static void ReportTelemetry(DebuggingSessionTelemetry.Data data)
{
// report telemetry (fire and forget):
_ = Task.Run(() => LogDebuggingSessionTelemetry(data, Logger.Log, LogAggregator.GetNextId));
}
// internal for testing
internal static void LogDebuggingSessionTelemetry(DebuggingSessionTelemetry.Data debugSessionData, Action<FunctionId, LogMessage> log, Func<int> getNextId)
{
const string SessionId = nameof(SessionId);
const string EditSessionId = nameof(EditSessionId);
var debugSessionId = getNextId();
log(FunctionId.Debugging_EncSession, KeyValueLogMessage.Create(map =>
{
map[SessionId] = debugSessionId;
map["SessionCount"] = debugSessionData.EditSessionData.Length;
map["EmptySessionCount"] = debugSessionData.EmptyEditSessionCount;
}));
foreach (var editSessionData in debugSessionData.EditSessionData)
{
var editSessionId = getNextId();
log(FunctionId.Debugging_EncSession_EditSession, KeyValueLogMessage.Create(map =>
{
map[SessionId] = debugSessionId;
map[EditSessionId] = editSessionId;
map["HadCompilationErrors"] = editSessionData.HadCompilationErrors;
map["HadRudeEdits"] = editSessionData.HadRudeEdits;
map["HadValidChanges"] = editSessionData.HadValidChanges;
map["HadValidInsignificantChanges"] = editSessionData.HadValidInsignificantChanges;
map["RudeEditsCount"] = editSessionData.RudeEdits.Length;
map["EmitDeltaErrorIdCount"] = editSessionData.EmitErrorIds.Length;
}));
foreach (var errorId in editSessionData.EmitErrorIds)
{
log(FunctionId.Debugging_EncSession_EditSession_EmitDeltaErrorId, KeyValueLogMessage.Create(map =>
{
map[SessionId] = debugSessionId;
map[EditSessionId] = editSessionId;
map["ErrorId"] = errorId;
}));
}
foreach (var (editKind, syntaxKind) in editSessionData.RudeEdits)
{
log(FunctionId.Debugging_EncSession_EditSession_RudeEdit, KeyValueLogMessage.Create(map =>
{
map[SessionId] = debugSessionId;
map[EditSessionId] = editSessionId;
map["RudeEditKind"] = editKind;
map["RudeEditSyntaxKind"] = syntaxKind;
map["RudeEditBlocking"] = editSessionData.HadRudeEdits;
}));
}
}
}
}
}
|
1. Complete form below and submit payment.
2. Check your email for a link and password to enter the course within 24 hours.
3. Complete the module(s) and submit the quiz(zes).
4. Check your email for a certificate of completion within 1 business day of submitting the quiz. |
Best Of 200 Led Christmas Tree Lights – From the thousand pictures on the internet in relation to 200 led christmas tree lights, choices the best selections with ideal resolution simply for you all, and this photos is usually one among graphics selections in our finest graphics gallery concerning Best Of 200 Led Christmas Tree Lights. I hope you will want it.
That photograph (200 Led Christmas Tree Lights Beautiful Großhandel Lampen Led String Lights Fairy Urlaub Weihnachten Party) above is labelled together with: all for you.
Submitted by means of smvll in 2018-06-06 19:54:14. To view many photographs inside Best Of 200 Led Christmas Tree Lights photographs gallery make sure you follow this particular web page link. |
San Francisco, CA / ACCESSWIRE / July 28, 2014 / Pennystockegghead.com is a website that offers an excellent trading system to those people who are interested to gain higher amounts of income in the stock market without spending a lot of effort. All of the operations of this website are available online and accessible for everyone especially to those marketers who want to trade stocks more effectively with the use of some reliable marketing strategies that were created also by expert marketers in the different parts of the country nowadays.
With the help of Penny stock egg head (Visit Here), it will be very easy for people to generate higher amounts of income from their weekly operations. In this website, people will be able to learn an excellent marketing system which will require them to perform at least one successful trading process every week to earn millions of dollars with a starting investment of $1,000 only. It sounds interesting right? The registration fee is one hundred percent free. In other words, all of the owners of small businesses and even the owner of largest companies in the country may register in this website to see the amazing trading system that it can share.
Many people have already tried to register in the amazing trading system that Pennystockegghead.com has successfully created in the internet before. And all of them are already millionaires because of the huge amounts of money that it has successfully provided in their weekly earning status. To register in this website is the best way to earn several amounts of money without spending a lot of effort. The excellent trading opportunity that this website can offer to its subscribers will never require people to trade all of their personal belongings or properties just to earn millions of dollars.
It’s a very mysterious yet reliable trading system that will surely amaze those people who do not want to suffer from several kinds of financial problems for the rest of their lives. To register at Pennystockegghead.com is the best chance of people to achieve their dreams in life more effectively. It will provide them with maximum satisfaction and will also help them to experience the benefits of having a luxurious life in this world. |
Filing a personal injury lawsuit oftentimes seems scary. But with the right legal help, the process of getting compensated for injury doesn’t have to be that tough. We can help you get what you deserve. |
/**
* @license
* Copyright The Closure Library Authors.
* SPDX-License-Identifier: Apache-2.0
*/
/**
* @fileoverview Animated zippy widget implementation.
*
* @see ../demos/zippy.html
*/
goog.provide('goog.ui.AnimatedZippy');
goog.require('goog.a11y.aria.Role');
goog.require('goog.dom');
goog.require('goog.dom.TagName');
goog.require('goog.events');
goog.require('goog.fx.Animation');
goog.require('goog.fx.Transition');
goog.require('goog.fx.easing');
goog.require('goog.ui.Zippy');
goog.require('goog.ui.ZippyEvent');
goog.requireType('goog.events.Event');
/**
* Zippy widget. Expandable/collapsible container, clicking the header toggles
* the visibility of the content.
*
* @param {Element|string|null} header Header element, either element
* reference, string id or null if no header exists.
* @param {Element|string} content Content element, either element reference or
* string id.
* @param {boolean=} opt_expanded Initial expanded/visibility state. Defaults to
* false.
* @param {goog.dom.DomHelper=} opt_domHelper An optional DOM helper.
* @param {goog.a11y.aria.Role<string>=} opt_role ARIA role, default TAB.
* @constructor
* @extends {goog.ui.Zippy}
*/
goog.ui.AnimatedZippy = function(
header, content, opt_expanded, opt_domHelper, opt_role) {
'use strict';
var domHelper = opt_domHelper || goog.dom.getDomHelper();
// Create wrapper element and move content into it.
var elWrapper =
domHelper.createDom(goog.dom.TagName.DIV, {'style': 'overflow:hidden'});
var elContent = domHelper.getElement(content);
elContent.parentNode.replaceChild(elWrapper, elContent);
elWrapper.appendChild(elContent);
/**
* Content wrapper, used for animation.
* @type {Element}
* @private
*/
this.elWrapper_ = elWrapper;
/**
* Reference to animation or null if animation is not active.
* @type {?goog.fx.Animation}
* @private
*/
this.anim_ = null;
// Call constructor of super class.
goog.ui.Zippy.call(
this, header, elContent, opt_expanded, undefined, domHelper, opt_role);
// Set initial state.
// NOTE: Set the class names as well otherwise animated zippys
// start with empty class names.
var expanded = this.isExpanded();
this.elWrapper_.style.display = expanded ? '' : 'none';
this.updateHeaderClassName(expanded);
};
goog.inherits(goog.ui.AnimatedZippy, goog.ui.Zippy);
/**
* Constants for event names.
*
* @const
*/
goog.ui.AnimatedZippy.Events = {
// The beginning of the animation when the zippy state toggles.
TOGGLE_ANIMATION_BEGIN: goog.events.getUniqueId('toggleanimationbegin'),
// The end of the animation when the zippy state toggles.
TOGGLE_ANIMATION_END: goog.events.getUniqueId('toggleanimationend')
};
/**
* Duration of expand/collapse animation, in milliseconds.
* @type {number}
*/
goog.ui.AnimatedZippy.prototype.animationDuration = 500;
/**
* Acceleration function for expand/collapse animation.
* @type {!Function}
*/
goog.ui.AnimatedZippy.prototype.animationAcceleration = goog.fx.easing.easeOut;
/**
* @return {boolean} Whether the zippy is in the process of being expanded or
* collapsed.
*/
goog.ui.AnimatedZippy.prototype.isBusy = function() {
'use strict';
return this.anim_ != null;
};
/**
* Sets expanded state.
*
* @param {boolean} expanded Expanded/visibility state.
* @override
*/
goog.ui.AnimatedZippy.prototype.setExpanded = function(expanded) {
'use strict';
if (this.isExpanded() == expanded && !this.anim_) {
return;
}
// Reset display property of wrapper to allow content element to be
// measured.
if (this.elWrapper_.style.display == 'none') {
this.elWrapper_.style.display = '';
}
// Measure content element.
var h = this.getContentElement().offsetHeight;
// Stop active animation (if any) and determine starting height.
var startH = 0;
if (this.anim_) {
goog.events.removeAll(this.anim_);
this.anim_.stop(false);
var marginTop = parseInt(this.getContentElement().style.marginTop, 10);
startH = h - Math.abs(marginTop);
} else {
startH = expanded ? 0 : h;
}
// Updates header class name after the animation has been stopped.
this.updateHeaderClassName(expanded);
// Set up expand/collapse animation.
this.anim_ = new goog.fx.Animation(
[0, startH], [0, expanded ? h : 0], this.animationDuration,
this.animationAcceleration);
var events = [
goog.fx.Transition.EventType.BEGIN, goog.fx.Animation.EventType.ANIMATE,
goog.fx.Transition.EventType.END
];
goog.events.listen(this.anim_, events, this.onAnimate_, false, this);
goog.events.listen(
this.anim_, goog.fx.Transition.EventType.BEGIN,
goog.bind(this.onAnimationBegin_, this, expanded));
goog.events.listen(
this.anim_, goog.fx.Transition.EventType.END,
goog.bind(this.onAnimationCompleted_, this, expanded));
// Start animation.
this.anim_.play(false);
};
/**
* Called during animation
*
* @param {goog.events.Event} e The event.
* @private
*/
goog.ui.AnimatedZippy.prototype.onAnimate_ = function(e) {
'use strict';
var contentElement = this.getContentElement();
var h = contentElement.offsetHeight;
contentElement.style.marginTop = (e.y - h) + 'px';
};
/**
* Called once the expand/collapse animation has started.
*
* @param {boolean} expanding Expanded/visibility state.
* @private
*/
goog.ui.AnimatedZippy.prototype.onAnimationBegin_ = function(expanding) {
'use strict';
this.dispatchEvent(new goog.ui.ZippyEvent(
goog.ui.AnimatedZippy.Events.TOGGLE_ANIMATION_BEGIN, this, expanding));
};
/**
* Called once the expand/collapse animation has completed.
*
* @param {boolean} expanded Expanded/visibility state.
* @private
*/
goog.ui.AnimatedZippy.prototype.onAnimationCompleted_ = function(expanded) {
'use strict';
// Fix wrong end position if the content has changed during the animation.
if (expanded) {
this.getContentElement().style.marginTop = '0';
}
goog.events.removeAll(/** @type {!goog.fx.Animation} */ (this.anim_));
this.setExpandedInternal(expanded);
this.anim_ = null;
if (!expanded) {
this.elWrapper_.style.display = 'none';
}
// Fire toggle event.
this.dispatchEvent(
new goog.ui.ZippyEvent(goog.ui.Zippy.Events.TOGGLE, this, expanded));
this.dispatchEvent(new goog.ui.ZippyEvent(
goog.ui.AnimatedZippy.Events.TOGGLE_ANIMATION_END, this, expanded));
};
|
package type_ref
// Define type and refer it from another file.
type Person struct {
Name string
}
|
Build the confidence that is required to take the lead when the situation requires you to do so.
Describe transformational leadership and your leadership style.
Identify the need to value the people you lead and how to adapt. |
// Math.extend v0.5.0
// Copyright (c) 2008-2009 Laurent Fortin
//
// 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.
Object.extend(Math, {
sum: function(list) {
var sum = 0;
for(var i = 0, len = list.length; i < len; i++)
sum += list[i];
return sum;
},
mean: function(list) {
return list.length ? this.sum(list) / list.length : false;
},
median: function(list) {
if(!list.length) return false;
list = this.sort(list);
if(list.length.isEven()) {
return this.mean([list[list.length / 2 - 1], list[list.length / 2]]);
} else {
return list[(list.length / 2).floor()];
}
},
variance: function(list) {
if(!list.length) return false;
var mean = this.mean(list);
var dev = [];
for(var i = 0, len = list.length; i < len; i++)
dev.push(this.pow(list[i] - mean, 2));
return this.mean(dev);
},
stdDev: function(list) {
return this.sqrt(this.variance(list));
},
sort: function(list, desc) {
// we output a clone of the original array
return list.clone().sort(function(a, b) { return desc ? b - a : a - b });
},
baseLog: function(n, base) {
return this.log(n) / this.log(base || 10);
},
factorize: function(n) {
if(!n.isNatural(true) || n == 1) return false;
if(n.isPrime()) return [n];
var sqrtOfN = this.sqrt(n);
for(var i = 2; i <= sqrtOfN; i++)
if((n % i).isNull() && i.isPrime())
return [i, this.factorize(n / i)].flatten();
},
sinh: function(n) {
return (this.exp(n) - this.exp(-n)) / 2;
},
cosh: function(n) {
return (this.exp(n) + this.exp(-n)) / 2;
},
tanh: function(n) {
return this.sinh(n) / this.cosh(n);
}
});
Object.extend(Number.prototype, {
isNaN: function() {
return isNaN(this);
},
isNull: function() {
return this == 0;
},
isEven: function() {
if(!this.isInteger()) return false;
return(this % 2 ? false : true);
},
isOdd: function() {
if(!this.isInteger()) return false;
return(this % 2 ? true : false);
},
isInteger: function(excludeZero) {
// if this == NaN ...
if(this.isNaN()) return false;
if(excludeZero && this.isNull()) return false;
return (this - this.floor()) ? false : true;
},
isNatural: function(excludeZero) {
return(this.isInteger(excludeZero) && this >= 0);
},
isPrime: function() {
var sqrtOfThis = Math.sqrt(this);
var somePrimes = [2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101];
if(!this.isNatural(true) || sqrtOfThis.isInteger()) {
return false;
}
if(somePrimes.include(this)) return true;
for(var i = 0, len = somePrimes.length; i < len; i++) {
if(somePrimes[i] > sqrtOfThis) {
return true;
}
if((this % somePrimes[i]).isNull()) {
return false;
}
}
for(var i = 103; i <= sqrtOfThis; i += 2) {
if((this % i).isNull()) {
return false;
}
}
return true;
},
compute: function(fn) {
return fn(this);
}
});
Object.extend(Array.prototype, {
swap: function(index1, index2) {
var swap = this[index1];
this[index1] = this[index2];
this[index2] = swap;
return this;
},
shuffle: function(inline, times) {
var list = (inline != false ? this : this.clone());
for(var i = 0, len = list.length * (times || 4); i < len; i++) {
list.swap(
(Math.random() * list.length).floor(),
(Math.random() * list.length).floor()
);
}
return list;
},
randomDraw: function(items) {
items = Number(items) || 1;
var list = this.shuffle(false);
if (items >= list.length) {
return list;
}
var sample = [];
for(var i = 1; i <= items; i++) {
if(list.length > 0) {
sample.push(list.shift());
} else {
return sample;
}
}
return sample;
}
});
Object.extend(Object, {
numericValues: function(object) {
return Object.values(object).select(Object.isNumber);
}
});
|
--[er]test the operators + using set,varchar type
create class DML_0001
( int_col integer,
var_col varchar(20),
set_col set (int, varchar(10)) );
insert into DML_0001 values (1,'test1', {1,'test1'});
insert into DML_0001 values (2,'test1', {1,'test1'});
insert into DML_0001 values (3,'test2', {1,'test2'});
insert into DML_0001 values (4,'test1', {2,'test1'});
insert into DML_0001 values (5,'test2', {2,'test2'});
select 140 as t1, set_col + var_col as t2 from DML_0001 order by 1;
drop class DML_0001;
|
{% extends "layout.html" %}
{% block page_title %}
Apprenticeships
{% endblock %}
{% block content %}
<main id="content" role="main">
{% include "includes/phase_banner_alpha.html" %}
<div class="breadcrumbs">
<ol role="breadcrumbs">
<li><a href="/{% include "includes/sprint-link.html" %}/balance">Access my funds</a></li>
<li><a href="/{% include "includes/sprint-link.html" %}/contracts">Contracts</a></li>
</ol>
</div>
<!--h1 class="heading-large">Levy account</h1-->
<!--h2 class="bold-medium">Acme Ltd Levy Account</h2-->
<div class="grid-row">
<div class="column-two-thirds">
<h1 class="heading-xlarge" style="margin:0px 0 50px 0">{% include "includes/account-name-number.html" %}Aeronautical engineering</h1>
</div>
</div>
<div class="space-at-bottom">
<div class="grid-row">
<div class="column-quarter">
<h3 class="heading-small smallMarginBotom">Provider</h3>
<p class="noMarginTop">Hackney skills & training Ltd</p>
</div>
<div class="column-quarter">
<h3 class="heading-small smallMarginBotom">Contract reference</h3>
<p class="noMarginTop">98HGS3F</p>
</div>
</div>
</div>
<div class="space-at-bottom">
<div class="grid-row">
<div class="column-half">
<h2 class="heading-medium ">Apprenticeship Overview</h2>
</div>
</div>
<div class="grid-row" >
<div class="column-quarter" >
<h3 class="heading-small smallMarginBotom ">Apprenticeship level</h3>
<p class="noMarginTop">Level 2 NVQ</p>
</div>
<div class="column-quarter">
<h3 class="heading-small smallMarginBotom ">Endpoint assessor</h3>
<p class="noMarginTop">Pham Assessment Ltd</p>
</div>
<div class="column-quarter">
<h3 class="heading-small smallMarginBotom ">Training start date</h3>
<p class="noMarginTop">20th July 2018</p>
</div>
</div>
</div>
<div class=" space-at-bottom">
<h2 class="heading-medium ">Payments</h2>
<div class="grid-row">
<div class="column-one-quarter">
<h2 class="heading-small">Date of first payment</h2>
<p style="margin-bottom:5px">20th August 2018</p>
</div>
</div>
<div class="grid-row">
<div class="column-one-quarter">
<h2 class="heading-small" >Total agreed</h2>
<p>£2,987<span class="robPence">.24</span></p> <!--style="color:#08c" -->
<!--p style="font-size:16px" >on 27th August 2018</p-->
</div>
<div class="column-one-quarter">
<h2 class="heading-small">Current total</h2>
<p>£2,987<span class="robPence">.24</span></p>
<!--p style="margin-top:0">Before 31 Jan 2019</p-->
</div>
</div>
<div class="grid-row">
<div class="column-one-quarter">
<h2 class="heading-small">Total paid</h2>
<p style="margin-bottom:5px">£0</p>
<p style="margin-top:0" class=" looks-like-a-link-underline">View details</p>
</div>
<div class="column-one-quarter">
<h2 class="heading-small">Left to pay</h2>
<p style="margin-bottom:5px">£2,987<span class="robPence">.24</span></p>
<p style="margin-top:0" class=" looks-like-a-link-underline">View details</p>
</div>
</div>
</div>
<div class="space-at-bottom">
<h2 class="heading-medium ">Apprentices</h2>
<div class="grid-row">
<div class="column-half">
<p style="margin-top:20px" ><a href="../apprentice-view/individual-apprentice">Rob Edwards</a></p>
<p class="looks-like-a-link-underline">Mel O'Connor</p>
<p class="looks-like-a-link-underline">Carson Maayan</p>
<p class="looks-like-a-link-underline">Kim Martie</p>
<p class="looks-like-a-link-underline">Mattie Cheyenne</p>
<p class="looks-like-a-link-underline">Ziv Yoshi</p>
<p class="looks-like-a-link-underline">Lou Eden</p>
</div>
<div class="column-half">
<p class="looks-like-a-link-underline" style="margin-top:20px">David Jenkins</p>
<p class="looks-like-a-link-underline">Susan Hamazaki</p>
<p class="looks-like-a-link-underline">Eden Tierney</p>
<p class="looks-like-a-link-underline">Freddie Dikla</p>
<p class="looks-like-a-link-underline">September Logan</p>
<p class="looks-like-a-link-underline">Florence Hadar</p>
<p class="looks-like-a-link-underline">Greer Merlyn</p>
</div>
</div>
</div>
</main>
<!--button class="button">Do the thing</button-->
<script>
//jquery that runs the tabs. Uses the jquery.tabs.js from gov.uk
$( document ).ready(function() {
// change the tabs themselves to active - should be in the above but isn't working because it's looking for a not li so I added this as a quick fix.
$("ul#tabs-nav li").click(function(e){
if (!$(this).hasClass("active")) {
var tabNum = $(this).index();
var nthChild = tabNum+1;
$("ul#tabs-nav li.active").removeClass("active");
$(this).addClass("active");
$("ul#tabs-nav li.active").removeClass("active");
$("ul#tabs-nav li:nth-child("+nthChild+")").addClass("active");
}
});
});
$('ul.tabs-nav').each(function(){
// For each set of tabs, we want to keep track of
// which tab is active and its associated content
var $active, $content, $links = $(this).find('a');
// If the location.hash matches one of the links, use that as the active tab.
// If no match is found, use the first link as the initial active tab.
$active = $($links.filter('[href="'+location.hash+'"]')[0] || $links[0]);
// $active.addClass('active');
console.log($active)
$content = $($active[0].hash);
// Hide the remaining content
$links.not($active).each(function () {
$(this.hash).hide();
});
// Bind the click event handler
$(this).on('click', 'a', function(e){
// Make the old tab inactive.
// $active.removeClass('active');
$content.hide();
// Update the variables with the new link and content
// $active = $(this);
$content = $(this.hash);
// Make the tab active.
// $active.addClass('active');
$content.show();
// Prevent the anchor's default click action
e.preventDefault();
});
});
</script>
{% endblock %}
|
Home/OAKLEY SUNGLASSES/The perfect lenses for running.
The perfect lenses for running.
You are an avid runner but the sun and road glare sometimes make it difficult?
The blinding glare from flat surfaces can strain your eyes and fatigue you to the point where you’re ready to quit, or probably should because your mental focus is gone.
That’s why OAKLEY engineered the OO® Red Iridium® Polarized lens to cut 99% of glare from paths and pavement.
Oakley’s red iridium Prizm lenses enhances the bright light and shadow areas of vision which in turns help you spot changes in texture of road surfaces.
Harsh rays of light won’t distract you, and with the improved depth perception of enhanced visual contrast, you’ll spot loose gravel and sand, small cracks, potholes and even slick areas that can be danger zones.
By Ocorner ocorner|2017-02-13T13:24:36+00:00February 13th, 2017|OAKLEY SUNGLASSES|Comments Off on The perfect lenses for running.
Are Oakley Sunglasses Worth It? Let see how they put them to the test. |