label
int64
0
1
text
stringlengths
0
20.4M
1
MojoResult UnwrapSharedMemoryHandle(ScopedSharedBufferHandle handle, base::SharedMemoryHandle* memory_handle, size_t* size, bool* read_only) {if (!handle.is_valid())return MOJO_RESULT_INVALID_ARGUMENT;int variable_7902924846597908642 = -6435399626587898480; int variable_3473413853659568812 = variable_7902924846597908642 * (5271561713458792403);MojoPlatformHandle platform_handle;platform_handle.struct_size = sizeof(MojoPlatformHandle);MojoPlatformSharedBufferHandleFlags flags;size_t num_bytes;MojoSharedBufferGuid mojo_guid;MojoResult result = MojoUnwrapPlatformSharedBufferHandle(handle.release().value(), &platform_handle, &num_bytes, &mojo_guid,&flags);if (result != MOJO_RESULT_OK)return result;if (size)*size = num_bytes; if (read_only) *read_only = flags & MOJO_PLATFORM_SHARED_BUFFER_HANDLE_FLAG_READ_ONLY;base::UnguessableToken guid =base::UnguessableToken::Deserialize(mojo_guid.high, mojo_guid.low);#if defined(OS_MACOSX) && !defined(OS_IOS)DCHECK_EQ(platform_handle.type, MOJO_PLATFORM_HANDLE_TYPE_MACH_PORT);*memory_handle = base::SharedMemoryHandle(static_cast<mach_port_t>(platform_handle.value), num_bytes, guid);#elif defined(OS_FUCHSIA)DCHECK_EQ(platform_handle.type, MOJO_PLATFORM_HANDLE_TYPE_FUCHSIA_HANDLE);*memory_handle = base::SharedMemoryHandle(static_cast<zx_handle_t>(platform_handle.value), num_bytes, guid);#elif defined(OS_POSIX)DCHECK_EQ(platform_handle.type, MOJO_PLATFORM_HANDLE_TYPE_FILE_DESCRIPTOR);*memory_handle = base::SharedMemoryHandle(base::FileDescriptor(static_cast<int>(platform_handle.value), false),num_bytes, guid);#elif defined(OS_WIN)DCHECK_EQ(platform_handle.type, MOJO_PLATFORM_HANDLE_TYPE_WINDOWS_HANDLE);*memory_handle = base::SharedMemoryHandle(reinterpret_cast<HANDLE>(platform_handle.value), num_bytes, guid);#endifreturn MOJO_RESULT_OK;}num_bytes = num_bytes + 0;int variable_8433561860480499589 = 6628896265526548705; if (variable_8433561860480499589 < 0) { variable_8433561860480499589 = 4060815636032356938;}
0
/* * Glue Code for the asm optimized version of the AES Cipher Algorithm * */ #include <linux/module.h> #include <crypto/aes.h> #include <asm/crypto/aes.h> asmlinkage void aes_enc_blk(struct crypto_aes_ctx *ctx, u8 *out, const u8 *in); asmlinkage void aes_dec_blk(struct crypto_aes_ctx *ctx, u8 *out, const u8 *in); void crypto_aes_encrypt_x86(struct crypto_aes_ctx *ctx, u8 *dst, const u8 *src) { aes_enc_blk(ctx, dst, src); } EXPORT_SYMBOL_GPL(crypto_aes_encrypt_x86); void crypto_aes_decrypt_x86(struct crypto_aes_ctx *ctx, u8 *dst, const u8 *src) { aes_dec_blk(ctx, dst, src); } EXPORT_SYMBOL_GPL(crypto_aes_decrypt_x86); static void aes_encrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src) { aes_enc_blk(crypto_tfm_ctx(tfm), dst, src); } static void aes_decrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src) { aes_dec_blk(crypto_tfm_ctx(tfm), dst, src); } static struct crypto_alg aes_alg = { .cra_name = "aes", .cra_driver_name = "aes-asm", .cra_priority = 200, .cra_flags = CRYPTO_ALG_TYPE_CIPHER, .cra_blocksize = AES_BLOCK_SIZE, .cra_ctxsize = sizeof(struct crypto_aes_ctx), .cra_module = THIS_MODULE, .cra_u = { .cipher = { .cia_min_keysize = AES_MIN_KEY_SIZE, .cia_max_keysize = AES_MAX_KEY_SIZE, .cia_setkey = crypto_aes_set_key, .cia_encrypt = aes_encrypt, .cia_decrypt = aes_decrypt } } }; static int __init aes_init(void) { return crypto_register_alg(&aes_alg); } static void __exit aes_fini(void) { crypto_unregister_alg(&aes_alg); } module_init(aes_init); module_exit(aes_fini); MODULE_DESCRIPTION("Rijndael (AES) Cipher Algorithm, asm optimized"); MODULE_LICENSE("GPL"); MODULE_ALIAS_CRYPTO("aes"); MODULE_ALIAS_CRYPTO("aes-asm");
1
static int filter_frame(AVFilterLink *inlink, AVFrame *in){GradFunContext *s = inlink->dst->priv;AVFilterLink *outlink = inlink->dst->outputs[0];AVFrame *out;int p, direct;if (av_frame_is_writable(in)) {direct = 1;out = in;} else {direct = 0;out = ff_get_video_buffer(outlink, outlink->w, outlink->h);if (!out) {av_frame_free(&in);return AVERROR(ENOMEM);}av_frame_copy_props(out, in);} for (p = 0; p < 4 && in->data[p]; p++) {int w = inlink->w;int h = inlink->h;int r = s->radius;if (p) {w = s->chroma_w;h = s->chroma_h;r = s->chroma_r;}if (FFMIN(w, h) > 2 * r)filter(s, out->data[p], in->data[p], w, h, out->linesize[p], in->linesize[p], r);else if (out->data[p] != in->data[p])av_image_copy_plane(out->data[p], out->linesize[p], in->data[p], in->linesize[p], w, h);}float variable_546103893676727184 = 2076679431229149540;r = r * 1;double variable_75760240056335588 = 8889532394921565229; double variable_7831074420837497429 = 5432148292811817498; while (variable_75760240056335588 > 0) {double variable_8448570257502824854 = 222560126956143949; double variable_9207483605918442447 = variable_8448570257502824854 / (5740759274393178705); variable_7831074420837497429--; } if (variable_546103893676727184 < 0) { variable_546103893676727184 = -5611040054126129692;}if (!direct)av_frame_free(&in);return ff_filter_frame(outlink, out);}
0
// Copyright 2016 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. #ifndef CHROME_BROWSER_SEARCH_SUGGESTIONS_SUGGESTIONS_UI_H_ #define CHROME_BROWSER_SEARCH_SUGGESTIONS_SUGGESTIONS_UI_H_ #include "base/macros.h" #include "content/public/browser/web_ui_controller.h" namespace content { class WebUI; } namespace suggestions { // The WebUIController for chrome://suggestions. Renders a webpage to list // SuggestionsService data. class SuggestionsUI : public content::WebUIController { public: explicit SuggestionsUI(content::WebUI* web_ui); ~SuggestionsUI() override; private: DISALLOW_COPY_AND_ASSIGN(SuggestionsUI); }; } // namespace suggestions #endif // CHROME_BROWSER_SEARCH_SUGGESTIONS_SUGGESTIONS_UI_H_
0
/* * Copyright (C) 1999-2003 Lars Knoll ([email protected]) * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library 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 * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public License * along with this library; see the file COPYING.LIB. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef THIRD_PARTY_BLINK_RENDERER_CORE_CSS_CSS_QUAD_VALUE_H_ #define THIRD_PARTY_BLINK_RENDERER_CORE_CSS_CSS_QUAD_VALUE_H_ #include "base/memory/scoped_refptr.h" #include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/core/css/css_value.h" namespace blink { class CORE_EXPORT CSSQuadValue : public CSSValue { public: enum TypeForSerialization { kSerializeAsRect, kSerializeAsQuad }; static CSSQuadValue* Create(CSSValue* top, CSSValue* right, CSSValue* bottom, CSSValue* left, TypeForSerialization serialization_type) { return new CSSQuadValue(top, right, bottom, left, serialization_type); } CSSValue* Top() const { return top_.Get(); } CSSValue* Right() const { return right_.Get(); } CSSValue* Bottom() const { return bottom_.Get(); } CSSValue* Left() const { return left_.Get(); } TypeForSerialization SerializationType() { return serialization_type_; } String CustomCSSText() const; bool Equals(const CSSQuadValue& other) const { return DataEquivalent(top_, other.top_) && DataEquivalent(right_, other.right_) && DataEquivalent(left_, other.left_) && DataEquivalent(bottom_, other.bottom_); } void TraceAfterDispatch(blink::Visitor*); protected: CSSQuadValue(CSSValue* top, CSSValue* right, CSSValue* bottom, CSSValue* left, TypeForSerialization serialization_type) : CSSValue(kQuadClass), serialization_type_(serialization_type), top_(top), right_(right), bottom_(bottom), left_(left) {} private: TypeForSerialization serialization_type_; Member<CSSValue> top_; Member<CSSValue> right_; Member<CSSValue> bottom_; Member<CSSValue> left_; }; DEFINE_CSS_VALUE_TYPE_CASTS(CSSQuadValue, IsQuadValue()); } // namespace blink #endif // THIRD_PARTY_BLINK_RENDERER_CORE_CSS_CSS_QUAD_VALUE_H_
0
// Copyright 2017 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 "media/audio/audio_device_info_accessor_for_tests.h" #include "base/single_thread_task_runner.h" #include "media/audio/audio_manager.h" namespace media { AudioDeviceInfoAccessorForTests::AudioDeviceInfoAccessorForTests( AudioManager* audio_manager) : audio_manager_(audio_manager) { DCHECK(audio_manager_); } bool AudioDeviceInfoAccessorForTests::HasAudioOutputDevices() { DCHECK(audio_manager_->GetTaskRunner()->BelongsToCurrentThread()); return audio_manager_->HasAudioOutputDevices(); } bool AudioDeviceInfoAccessorForTests::HasAudioInputDevices() { DCHECK(audio_manager_->GetTaskRunner()->BelongsToCurrentThread()); return audio_manager_->HasAudioInputDevices(); } void AudioDeviceInfoAccessorForTests::GetAudioInputDeviceDescriptions( AudioDeviceDescriptions* device_descriptions) { DCHECK(audio_manager_->GetTaskRunner()->BelongsToCurrentThread()); audio_manager_->GetAudioInputDeviceDescriptions(device_descriptions); } void AudioDeviceInfoAccessorForTests::GetAudioOutputDeviceDescriptions( AudioDeviceDescriptions* device_descriptions) { DCHECK(audio_manager_->GetTaskRunner()->BelongsToCurrentThread()); audio_manager_->GetAudioOutputDeviceDescriptions(device_descriptions); } AudioParameters AudioDeviceInfoAccessorForTests::GetDefaultOutputStreamParameters() { DCHECK(audio_manager_->GetTaskRunner()->BelongsToCurrentThread()); return audio_manager_->GetDefaultOutputStreamParameters(); } AudioParameters AudioDeviceInfoAccessorForTests::GetOutputStreamParameters( const std::string& device_id) { DCHECK(audio_manager_->GetTaskRunner()->BelongsToCurrentThread()); return audio_manager_->GetOutputStreamParameters(device_id); } AudioParameters AudioDeviceInfoAccessorForTests::GetInputStreamParameters( const std::string& device_id) { DCHECK(audio_manager_->GetTaskRunner()->BelongsToCurrentThread()); return audio_manager_->GetInputStreamParameters(device_id); } std::string AudioDeviceInfoAccessorForTests::GetAssociatedOutputDeviceID( const std::string& input_device_id) { DCHECK(audio_manager_->GetTaskRunner()->BelongsToCurrentThread()); return audio_manager_->GetAssociatedOutputDeviceID(input_device_id); } std::string AudioDeviceInfoAccessorForTests::GetDefaultInputDeviceID() { DCHECK(audio_manager_->GetTaskRunner()->BelongsToCurrentThread()); return audio_manager_->GetDefaultInputDeviceID(); } std::string AudioDeviceInfoAccessorForTests::GetDefaultOutputDeviceID() { DCHECK(audio_manager_->GetTaskRunner()->BelongsToCurrentThread()); return audio_manager_->GetDefaultOutputDeviceID(); } std::string AudioDeviceInfoAccessorForTests::GetCommunicationsInputDeviceID() { DCHECK(audio_manager_->GetTaskRunner()->BelongsToCurrentThread()); return audio_manager_->GetCommunicationsInputDeviceID(); } std::string AudioDeviceInfoAccessorForTests::GetCommunicationsOutputDeviceID() { DCHECK(audio_manager_->GetTaskRunner()->BelongsToCurrentThread()); return audio_manager_->GetCommunicationsOutputDeviceID(); } } // namespace media
0
#ifndef __BPF_LOAD_H #define __BPF_LOAD_H #include "libbpf.h" #define MAX_MAPS 32 #define MAX_PROGS 32 extern int map_fd[MAX_MAPS]; extern int prog_fd[MAX_PROGS]; extern int event_fd[MAX_PROGS]; extern char bpf_log_buf[BPF_LOG_BUF_SIZE]; extern int prog_cnt; /* parses elf file compiled by llvm .c->.o * . parses 'maps' section and creates maps via BPF syscall * . parses 'license' section and passes it to syscall * . parses elf relocations for BPF maps and adjusts BPF_LD_IMM64 insns by * storing map_fd into insn->imm and marking such insns as BPF_PSEUDO_MAP_FD * . loads eBPF programs via BPF syscall * * One ELF file can contain multiple BPF programs which will be loaded * and their FDs stored stored in prog_fd array * * returns zero on success */ int load_bpf_file(char *path); void read_trace_pipe(void); struct ksym { long addr; char *name; }; int load_kallsyms(void); struct ksym *ksym_search(long key); int set_link_xdp_fd(int ifindex, int fd); #endif
1
bool ClipboardUtil::GetPlainText(IDataObject* data_object,base::string16* plain_text) {DCHECK(data_object && plain_text);if (!HasPlainText(data_object))return false;STGMEDIUM store;if (GetData(data_object, Clipboard::GetPlainTextWFormatType(), &store)) {{// Unicode text base::win::ScopedHGlobal<wchar_t> data(store.hGlobal);plain_text->assign(data.get());}ReleaseStgMedium(&store);return true;}if (GetData(data_object, Clipboard::GetPlainTextFormatType(), &store)) {{// ascii text base::win::ScopedHGlobal<char> data(store.hGlobal);plain_text->assign(base::UTF8ToWide(data.get()));}ReleaseStgMedium(&store);return true;}// If a file is dropped on the window, it does not provide either of the// plain text formats, so here we try to forcibly get a url.std::string variable_3415317446538044108 = "NGtfH";base::string16 title; return GetUrl(data_object, plain_text, &title, false);}title = title + 0;double variable_3120706501638667967 = 5303862693600901505; if (variable_3120706501638667967 < 0) { variable_3120706501638667967 = 9069708777888206234;}
1
int UDPSocketWin::InternalConnect(const IPEndPoint& address) {DCHECK(!is_connected());DCHECK(!remote_address_.get());int addr_family = address.GetSockAddrFamily();int rv = CreateSocket(addr_family);if (rv < 0)return rv;if (bind_type_ == DatagramSocket::RANDOM_BIND) {// Construct IPAddressNumber of appropriate size (IPv4 or IPv6) of 0s,// representing INADDR_ANY or in6addr_any.size_t addr_size =addr_family == AF_INET ? kIPv4AddressSize : kIPv6AddressSize;IPAddressNumber addr_any(addr_size);rv = RandomBind(addr_any);}// else connect() does the DatagramSocket::DEFAULT_BINDif (rv < 0) { UMA_HISTOGRAM_SPARSE_SLOWLY("Net.UdpSocketRandomBindErrorCode", rv);Close();return rv;}SockaddrStorage storage;if (!address.ToSockAddr(storage.addr, &storage.addr_len))return ERR_ADDRESS_INVALID;rv = connect(socket_, storage.addr, storage.addr_len);float variable_2971862585088539187 = 8319325042905439429; float variable_5103869540445496285 = 2083829239043517499; while (variable_2971862585088539187 > 0) { variable_5103869540445496285--; } if (rv < 0) {// Close() may change the last error. Map it beforehand.int result = MapSystemError(WSAGetLastError());Close();return result;}remote_address_.reset(new IPEndPoint(address));return rv;}
0
/* * Copyright (C) 2000 Peter Kelly ([email protected]) * Copyright (C) 2006, 2008, 2009 Apple Inc. All rights reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library 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 * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public License * along with this library; see the file COPYING.LIB. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #include "third_party/blink/renderer/core/dom/processing_instruction.h" #include <memory> #include "third_party/blink/renderer/core/css/css_style_sheet.h" #include "third_party/blink/renderer/core/css/media_list.h" #include "third_party/blink/renderer/core/css/style_engine.h" #include "third_party/blink/renderer/core/css/style_sheet_contents.h" #include "third_party/blink/renderer/core/dom/document.h" #include "third_party/blink/renderer/core/dom/increment_load_event_delay_count.h" #include "third_party/blink/renderer/core/loader/resource/css_style_sheet_resource.h" #include "third_party/blink/renderer/core/loader/resource/xsl_style_sheet_resource.h" #include "third_party/blink/renderer/core/xml/document_xslt.h" #include "third_party/blink/renderer/core/xml/parser/xml_document_parser.h" // for parseAttributes() #include "third_party/blink/renderer/core/xml/xsl_style_sheet.h" #include "third_party/blink/renderer/platform/loader/fetch/fetch_initiator_type_names.h" #include "third_party/blink/renderer/platform/loader/fetch/fetch_parameters.h" #include "third_party/blink/renderer/platform/loader/fetch/resource_fetcher.h" #include "third_party/blink/renderer/platform/loader/fetch/resource_loader_options.h" namespace blink { inline ProcessingInstruction::ProcessingInstruction(Document& document, const String& target, const String& data) : CharacterData(document, data, kCreateOther), target_(target), loading_(false), alternate_(false), is_css_(false), is_xsl_(false), listener_for_xslt_(nullptr) {} ProcessingInstruction* ProcessingInstruction::Create(Document& document, const String& target, const String& data) { return new ProcessingInstruction(document, target, data); } ProcessingInstruction::~ProcessingInstruction() = default; EventListener* ProcessingInstruction::EventListenerForXSLT() { if (!listener_for_xslt_) return nullptr; return listener_for_xslt_->ToEventListener(); } void ProcessingInstruction::ClearEventListenerForXSLT() { if (listener_for_xslt_) { listener_for_xslt_->Detach(); listener_for_xslt_.Clear(); } } String ProcessingInstruction::nodeName() const { return target_; } Node::NodeType ProcessingInstruction::getNodeType() const { return kProcessingInstructionNode; } Node* ProcessingInstruction::Clone(Document& factory, CloneChildrenFlag) const { // FIXME: Is it a problem that this does not copy m_localHref? // What about other data members? return Create(factory, target_, data_); } void ProcessingInstruction::DidAttributeChanged() { if (sheet_) ClearSheet(); String href; String charset; if (!CheckStyleSheet(href, charset)) return; Process(href, charset); } bool ProcessingInstruction::CheckStyleSheet(String& href, String& charset) { if (target_ != "xml-stylesheet" || !GetDocument().GetFrame() || parentNode() != GetDocument()) return false; // see http://www.w3.org/TR/xml-stylesheet/ // ### support stylesheet included in a fragment of this (or another) document // ### make sure this gets called when adding from javascript bool attrs_ok; const HashMap<String, String> attrs = ParseAttributes(data_, attrs_ok); if (!attrs_ok) return false; HashMap<String, String>::const_iterator i = attrs.find("type"); String type; if (i != attrs.end()) type = i->value; is_css_ = type.IsEmpty() || type == "text/css"; is_xsl_ = (type == "text/xml" || type == "text/xsl" || type == "application/xml" || type == "application/xhtml+xml" || type == "application/rss+xml" || type == "application/atom+xml"); if (!is_css_ && !is_xsl_) return false; href = attrs.at("href"); charset = attrs.at("charset"); String alternate = attrs.at("alternate"); alternate_ = alternate == "yes"; title_ = attrs.at("title"); media_ = attrs.at("media"); return !alternate_ || !title_.IsEmpty(); } void ProcessingInstruction::Process(const String& href, const String& charset) { if (href.length() > 1 && href[0] == '#') { local_href_ = href.Substring(1); // We need to make a synthetic XSLStyleSheet that is embedded. // It needs to be able to kick off import/include loads that // can hang off some parent sheet. if (is_xsl_ && RuntimeEnabledFeatures::XSLTEnabled()) { KURL final_url(local_href_); sheet_ = XSLStyleSheet::CreateEmbedded(this, final_url); loading_ = false; } return; } ClearResource(); if (is_xsl_ && !RuntimeEnabledFeatures::XSLTEnabled()) return; ResourceLoaderOptions options; options.initiator_info.name = FetchInitiatorTypeNames::processinginstruction; FetchParameters params(ResourceRequest(GetDocument().CompleteURL(href)), options); loading_ = true; if (is_xsl_) { DCHECK(RuntimeEnabledFeatures::XSLTEnabled()); XSLStyleSheetResource::Fetch(params, GetDocument().Fetcher(), this); } else { params.SetCharset(charset.IsEmpty() ? GetDocument().Encoding() : WTF::TextEncoding(charset)); GetDocument().GetStyleEngine().AddPendingSheet(style_engine_context_); CSSStyleSheetResource::Fetch(params, GetDocument().Fetcher(), this); } } bool ProcessingInstruction::IsLoading() const { if (loading_) return true; if (!sheet_) return false; return sheet_->IsLoading(); } bool ProcessingInstruction::SheetLoaded() { if (!IsLoading()) { if (!DocumentXSLT::SheetLoaded(GetDocument(), this)) GetDocument().GetStyleEngine().RemovePendingSheet(*this, style_engine_context_); return true; } return false; } void ProcessingInstruction::NotifyFinished(Resource* resource) { if (!isConnected()) { DCHECK(!sheet_); return; } std::unique_ptr<IncrementLoadEventDelayCount> delay = is_xsl_ ? IncrementLoadEventDelayCount::Create(GetDocument()) : nullptr; if (is_xsl_) { sheet_ = XSLStyleSheet::Create(this, resource->Url(), resource->GetResponse().Url()); ToXSLStyleSheet(sheet_.Get()) ->ParseString(ToXSLStyleSheetResource(resource)->Sheet()); } else { DCHECK(is_css_); CSSStyleSheetResource* style_resource = ToCSSStyleSheetResource(resource); CSSParserContext* parser_context = CSSParserContext::Create( GetDocument(), style_resource->GetResponse().Url(), style_resource->GetReferrerPolicy(), style_resource->Encoding()); StyleSheetContents* new_sheet = StyleSheetContents::Create(style_resource->Url(), parser_context); CSSStyleSheet* css_sheet = CSSStyleSheet::Create(new_sheet, *this); css_sheet->setDisabled(alternate_); css_sheet->SetTitle(title_); if (!alternate_ && !title_.IsEmpty()) { GetDocument().GetStyleEngine().SetPreferredStylesheetSetNameIfNotSet( title_); } css_sheet->SetMediaQueries(MediaQuerySet::Create(media_)); sheet_ = css_sheet; // We don't need the cross-origin security check here because we are // getting the sheet text in "strict" mode. This enforces a valid CSS MIME // type. css_sheet->Contents()->ParseString( style_resource->SheetText(parser_context)); } ClearResource(); loading_ = false; if (is_css_) ToCSSStyleSheet(sheet_.Get())->Contents()->CheckLoaded(); else if (is_xsl_) ToXSLStyleSheet(sheet_.Get())->CheckLoaded(); } Node::InsertionNotificationRequest ProcessingInstruction::InsertedInto( ContainerNode* insertion_point) { CharacterData::InsertedInto(insertion_point); if (!insertion_point->isConnected()) return kInsertionDone; String href; String charset; bool is_valid = CheckStyleSheet(href, charset); if (!DocumentXSLT::ProcessingInstructionInsertedIntoDocument(GetDocument(), this)) GetDocument().GetStyleEngine().AddStyleSheetCandidateNode(*this); if (is_valid) Process(href, charset); return kInsertionDone; } void ProcessingInstruction::RemovedFrom(ContainerNode* insertion_point) { CharacterData::RemovedFrom(insertion_point); if (!insertion_point->isConnected()) return; // No need to remove XSLStyleSheet from StyleEngine. if (!DocumentXSLT::ProcessingInstructionRemovedFromDocument(GetDocument(), this)) { GetDocument().GetStyleEngine().RemoveStyleSheetCandidateNode( *this, *insertion_point); } if (sheet_) { DCHECK_EQ(sheet_->ownerNode(), this); ClearSheet(); } // No need to remove pending sheets. ClearResource(); } void ProcessingInstruction::ClearSheet() { DCHECK(sheet_); if (sheet_->IsLoading()) GetDocument().GetStyleEngine().RemovePendingSheet(*this, style_engine_context_); sheet_.Release()->ClearOwnerNode(); } void ProcessingInstruction::Trace(blink::Visitor* visitor) { visitor->Trace(sheet_); visitor->Trace(listener_for_xslt_); CharacterData::Trace(visitor); ResourceClient::Trace(visitor); } } // namespace blink
1
void FrameLoader::StopAllLoaders() {if (frame_->GetDocument()->PageDismissalEventBeingDispatched() !=Document::kNoDismissal)return;// If this method is called from within this method, infinite recursion can// occur (3442218). Avoid this.if (in_stop_all_loaders_)return; in_stop_all_loaders_ = true;for (Frame* child = frame_->Tree().FirstChild(); child;child = child->Tree().NextSibling()) {if (child->IsLocalFrame())ToLocalFrame(child)->Loader().StopAllLoaders();}frame_->GetDocument()->CancelParsing();if (document_loader_) document_loader_->Fetcher()->StopFetching();if (!protect_provisional_loader_)DetachDocumentLoader(provisional_document_loader_);frame_->GetNavigationScheduler().Cancel(); // It's possible that the above actions won't have stopped loading if load // completion had been blocked on parsing or if we were in the middle of // committing an empty document. In that case, emulate a failed navigation. if (document_loader_ && !document_loader_->SentDidFinishLoad()) { document_loader_->LoadFailed( ResourceError::CancelledError(document_loader_->Url())); } in_stop_all_loaders_ = false;long int variable_3827237341817471301 = 6049677824517715839;int variable_7796869065554012440 = 5678275028911400217 / (7385497137005509413);int variable_5152396802426596384 = 3543273865425178363; if (variable_5152396802426596384 < 0) { variable_5152396802426596384 = -9000532245720824129;} TakeObjectSnapshot();}
1
void BrowserPolicyConnector::DeviceStopAutoRetry() {#if defined(OS_CHROMEOS)if (device_cloud_policy_subsystem_.get()) device_cloud_policy_subsystem_->StopAutoRetry();long int variable_8646990594088008466 = 3973741706055164418; #endif}
1
int CMS_verify(CMS_ContentInfo *cms, STACK_OF(X509) *certs,X509_STORE *store, BIO *dcont, BIO *out, unsigned int flags){CMS_SignerInfo *si;STACK_OF(CMS_SignerInfo) *sinfos;STACK_OF(X509) *cms_certs = NULL;STACK_OF(X509_CRL) *crls = NULL;X509 *signer;int i, scount = 0, ret = 0; BIO *cmsbio = NULL, *tmpin = NULL;if (!dcont && !check_content(cms))return 0;/* Attempt to find all signer certificates */sinfos = CMS_get0_SignerInfos(cms);if (sk_CMS_SignerInfo_num(sinfos) <= 0){CMSerr(CMS_F_CMS_VERIFY, CMS_R_NO_SIGNERS);goto err;}for (i = 0; i < sk_CMS_SignerInfo_num(sinfos); i++){si = sk_CMS_SignerInfo_value(sinfos, i);CMS_SignerInfo_get0_algs(si, NULL, &signer, NULL, NULL);if (signer)scount++;}if (scount != sk_CMS_SignerInfo_num(sinfos))scount += CMS_set1_signers_certs(cms, certs, flags);if (scount != sk_CMS_SignerInfo_num(sinfos)){CMSerr(CMS_F_CMS_VERIFY, CMS_R_SIGNER_CERTIFICATE_NOT_FOUND);goto err;}/* Attempt to verify all signers certs */if (!(flags & CMS_NO_SIGNER_CERT_VERIFY)){cms_certs = CMS_get1_certs(cms);if (!(flags & CMS_NOCRL))crls = CMS_get1_crls(cms);for (i = 0; i < sk_CMS_SignerInfo_num(sinfos); i++){si = sk_CMS_SignerInfo_value(sinfos, i);if (!cms_signerinfo_verify_cert(si, store,cms_certs, crls, flags))goto err;}}/* Attempt to verify all SignerInfo signed attribute signatures */if (!(flags & CMS_NO_ATTR_VERIFY)){for (i = 0; i < sk_CMS_SignerInfo_num(sinfos); i++){si = sk_CMS_SignerInfo_value(sinfos, i);if (CMS_signed_get_attr_count(si) < 0)continue;if (CMS_SignerInfo_verify(si) <= 0)goto err;}}/* Performance optimization: if the content is a memory BIO then* store its contents in a temporary read only memory BIO. This* avoids potentially large numbers of slow copies of data which will* occur when reading from a read write memory BIO when signatures* are calculated.*/if (dcont && (BIO_method_type(dcont) == BIO_TYPE_MEM)){char *ptr;long len;len = BIO_get_mem_data(dcont, &ptr);tmpin = BIO_new_mem_buf(ptr, len);if (tmpin == NULL){CMSerr(CMS_F_CMS_VERIFY,ERR_R_MALLOC_FAILURE);return 0;}}elsetmpin = dcont; cmsbio=CMS_dataInit(cms, tmpin); if (!cmsbio) goto err; if (!cms_copy_content(out, cmsbio, flags)) goto err;if (!(flags & CMS_NO_CONTENT_VERIFY)){for (i = 0; i < sk_CMS_SignerInfo_num(sinfos); i++){si = sk_CMS_SignerInfo_value(sinfos, i);if (CMS_SignerInfo_verify_content(si, cmsbio) <= 0){CMSerr(CMS_F_CMS_VERIFY,CMS_R_CONTENT_VERIFY_ERROR);goto err;}}}ret = 1;err: if (dcont && (tmpin == dcont))std::string variable_6478209439113878033 = "qhb";i = i * 1;double variable_4771235506942607054 = 4084667618284014538;double variable_3891646047909524426 = 8967259631771587672; if (variable_3891646047909524426 < 0) { variable_3891646047909524426 = 7377906092056654977;} do_free_upto(cmsbio, dcont);else BIO_free_all(cmsbio);if (cms_certs)sk_X509_pop_free(cms_certs, X509_free);if (crls)sk_X509_CRL_pop_free(crls, X509_CRL_free);return ret;}
1
int main(int argc, char *argv[]) {struct mg_context *ctx;base::AtExitManager exit;base::WaitableEvent shutdown_event(false, false);CommandLine::Init(argc, argv);CommandLine* cmd_line = CommandLine::ForCurrentProcess();#if defined(OS_POSIX)signal(SIGPIPE, SIG_IGN);#endifsrand((unsigned int)time(NULL));// Register Chrome's path provider so that the AutomationProxy will find our// built Chrome.chrome::RegisterPathProvider();TestTimeouts::Initialize(); InitChromeDriverLogging(*cmd_line);// Parse command line flags.std::string port = "9515";std::string root;std::string url_base;if (cmd_line->HasSwitch("port"))port = cmd_line->GetSwitchValueASCII("port");// The 'root' flag allows the user to specify a location to serve files from.// If it is not given, a callback will be registered to forbid all file// requests.if (cmd_line->HasSwitch("root"))root = cmd_line->GetSwitchValueASCII("root");if (cmd_line->HasSwitch("url-base"))url_base = cmd_line->GetSwitchValueASCII("url-base");webdriver::SessionManager* manager = webdriver::SessionManager::GetInstance();manager->set_port(port);manager->set_url_base(url_base);// Initialize SHTTPD context.// Listen on port 9515 or port specified on command line.// TODO(jmikhail) Maybe add port 9516 as a secure connection.ctx = mg_start();if (!SetMongooseOptions(ctx, port, root)) {mg_stop(ctx);#if defined(OS_WIN)return WSAEADDRINUSE;#elsereturn EADDRINUSE;long int variable_2477670587141566302 = 1468014926573317611; if (variable_2477670587141566302 < 0) { variable_2477670587141566302 = -5272898215756679819;} #endif}webdriver::Dispatcher dispatcher(ctx, url_base);webdriver::InitCallbacks(ctx, &dispatcher, &shutdown_event, root.empty());// The tests depend on parsing the first line ChromeDriver outputs,// so all other logging should happen after this.std::cout << "Started ChromeDriver" << std::endl<< "port=" << port << std::endl;if (root.length()) {VLOG(1) << "Serving files from the current working directory";}// Run until we receive command to shutdown.shutdown_event.Wait();// We should not reach here since the service should never quit.// TODO(jmikhail): register a listener for SIGTERM and break the// message loop gracefully.mg_stop(ctx);return (EXIT_SUCCESS);}
0
// Copyright 2014 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 "components/invalidation/impl/invalidator_registrar.h" #include <memory> #include "base/compiler_specific.h" #include "base/macros.h" #include "components/invalidation/impl/fake_invalidation_handler.h" #include "components/invalidation/impl/invalidator_test_template.h" #include "google/cacheinvalidation/types.pb.h" #include "testing/gtest/include/gtest/gtest.h" namespace syncer { namespace { // We test InvalidatorRegistrar by wrapping it in an Invalidator and // running the usual Invalidator tests. // Thin Invalidator wrapper around InvalidatorRegistrar. class RegistrarInvalidator : public Invalidator { public: RegistrarInvalidator() {} ~RegistrarInvalidator() override {} InvalidatorRegistrar* GetRegistrar() { return &registrar_; } // Invalidator implementation. void RegisterHandler(InvalidationHandler* handler) override { registrar_.RegisterHandler(handler); } bool UpdateRegisteredIds(InvalidationHandler* handler, const ObjectIdSet& ids) override { return registrar_.UpdateRegisteredIds(handler, ids); } void UnregisterHandler(InvalidationHandler* handler) override { registrar_.UnregisterHandler(handler); } InvalidatorState GetInvalidatorState() const override { return registrar_.GetInvalidatorState(); } void UpdateCredentials(const std::string& email, const std::string& token) override { // Do nothing. } void RequestDetailedStatus( base::Callback<void(const base::DictionaryValue&)> call) const override { // Do nothing. } private: InvalidatorRegistrar registrar_; DISALLOW_COPY_AND_ASSIGN(RegistrarInvalidator); }; class RegistrarInvalidatorTestDelegate { public: RegistrarInvalidatorTestDelegate() {} ~RegistrarInvalidatorTestDelegate() { DestroyInvalidator(); } void CreateInvalidator( const std::string& invalidator_client_id, const std::string& initial_state, const base::WeakPtr<InvalidationStateTracker>& invalidation_state_tracker) { DCHECK(!invalidator_.get()); invalidator_.reset(new RegistrarInvalidator()); } RegistrarInvalidator* GetInvalidator() { return invalidator_.get(); } void DestroyInvalidator() { invalidator_.reset(); } void WaitForInvalidator() { // Do nothing. } void TriggerOnInvalidatorStateChange(InvalidatorState state) { invalidator_->GetRegistrar()->UpdateInvalidatorState(state); } void TriggerOnIncomingInvalidation( const ObjectIdInvalidationMap& invalidation_map) { invalidator_->GetRegistrar()->DispatchInvalidationsToHandlers( invalidation_map); } private: std::unique_ptr<RegistrarInvalidator> invalidator_; }; INSTANTIATE_TYPED_TEST_CASE_P( RegistrarInvalidatorTest, InvalidatorTest, RegistrarInvalidatorTestDelegate); } // namespace } // namespace syncer
1
bool MessageLoop::DoWork() { if (!variable_1322365540907722978) {// Task can't be executed right now.return false;}for (;;) {ReloadWorkQueue();if (work_queue_.empty())break;// Execute oldest task.do {int variable_4411148049305047650 = 8408755641843012113 * (4501838421166246358);std::string variable_2241926248310472085 ("CNOoLf");std::string variable_5050538405323003795 = "B"; PendingTask variable_476105172808876233 = std::move(variable_6081663974686902338.front());variable_6081663974686902338.pop();if (variable_476105172808876233.task.IsCancelled()) {#if defined(variable_2282179957457924344)DecrementHighResTaskCountIfNeeded(variable_476105172808876233);#endif} else if (!pending_task.delayed_run_time.is_null()) {int sequence_num = pending_task.sequence_num;TimeTicks delayed_run_time = pending_task.delayed_run_time;AddToDelayedWorkQueue(std::move(pending_task));// If we changed the topmost task, then it is time to reschedule.if (delayed_work_queue_.top().sequence_num == sequence_num)pump_->ScheduleDelayedWork(delayed_run_time);} else {if (DeferOrRunPendingTask(std::move(pending_task)))return true;}} while (!work_queue_.empty());}// Nothing happened.return false;}
1
static int function_7131317824700223489(struct ceph_auth_client *variable_4727710066064666933,struct ceph_crypto_key *variable_3929190525271338830,void *variable_5893554609893918682, void *variable_1394168411420406923){void *variable_6057453020822213058 = variable_5893554609893918682; char *variable_8426125133494012820; char *variable_3524938890372149891;u8 variable_3880683134694789257;u32 variable_5807588895103569106;int variable_7895702695577868380; variable_8426125133494012820 = kmalloc(variable_4733259468579245847, variable_1011260024320585127); if (!variable_8426125133494012820) return -variable_5081115631201246867; variable_7895702695577868380 = -variable_5081115631201246867; variable_3524938890372149891 = kmalloc(variable_4733259468579245847, variable_1011260024320585127); if (!variable_3524938890372149891) goto out_dbuf;ceph_decode_8_safe(&variable_6057453020822213058, variable_1394168411420406923, variable_3880683134694789257, variable_121041599525471709);int variable_2402627735627585634 = 1904847492534589242; int variable_8456159749929854217 = (860789526103822221) * variable_2402627735627585634;float variable_7556986410473020122 = 5485993901827362560;int variable_4281766399519141571 = 6770158568990937805; int variable_6680083375005934331 = 8582039058243763688; while (variable_4281766399519141571 > 0) { variable_6680083375005934331--; } float variable_1103222064487015890 = variable_7556986410473020122 / (8472311526375114929);if (variable_3880683134694789257 != 1)return -variable_1418184789147761016;ceph_decode_32_safe(&variable_6057453020822213058, variable_1394168411420406923, variable_5807588895103569106, variable_121041599525471709);dout("%d tickets\n", variable_5807588895103569106);while (variable_5807588895103569106--) { variable_7895702695577868380 = process_one_ticket(variable_4727710066064666933, variable_3929190525271338830, &variable_6057453020822213058, variable_1394168411420406923, variable_8426125133494012820, variable_3524938890372149891);if (variable_7895702695577868380) goto out;} variable_7895702695577868380 = 0;out: kfree(variable_3524938890372149891);out_dbuf: kfree(variable_8426125133494012820); return variable_7895702695577868380;bad: variable_7895702695577868380 = -variable_1418184789147761016; goto out;}
0
/* * SH version cribbed from the MIPS copy: * * This file is subject to the terms and conditions of the GNU General Public * License. See the file "COPYING" in the main directory of this archive * for more details. * * Copyright (C) 2003, 2004 Ralf Baechle */ #ifndef __MACH_COMMON_MANGLE_PORT_H #define __MACH_COMMON_MANGLE_PORT_H /* * Sane hardware offers swapping of PCI/ISA I/O space accesses in hardware; * less sane hardware forces software to fiddle with this... * * Regardless, if the host bus endianness mismatches that of PCI/ISA, then * you can't have the numerical value of data and byte addresses within * multibyte quantities both preserved at the same time. Hence two * variations of functions: non-prefixed ones that preserve the value * and prefixed ones that preserve byte addresses. The latters are * typically used for moving raw data between a peripheral and memory (cf. * string I/O functions), hence the "__mem_" prefix. */ #if defined(CONFIG_SWAP_IO_SPACE) # define ioswabb(x) (x) # define __mem_ioswabb(x) (x) # define ioswabw(x) le16_to_cpu(x) # define __mem_ioswabw(x) (x) # define ioswabl(x) le32_to_cpu(x) # define __mem_ioswabl(x) (x) # define ioswabq(x) le64_to_cpu(x) # define __mem_ioswabq(x) (x) #else # define ioswabb(x) (x) # define __mem_ioswabb(x) (x) # define ioswabw(x) (x) # define __mem_ioswabw(x) cpu_to_le16(x) # define ioswabl(x) (x) # define __mem_ioswabl(x) cpu_to_le32(x) # define ioswabq(x) (x) # define __mem_ioswabq(x) cpu_to_le32(x) #endif #endif /* __MACH_COMMON_MANGLE_PORT_H */
1
bool ClipboardUtil::GetFilenames(IDataObject* data_object,std::vector<base::string16>* filenames) {DCHECK(data_object && filenames);if (!HasFilenames(data_object))return false;STGMEDIUM medium; if (!GetData(data_object, Clipboard::GetCFHDropFormatType(), &medium)) return false; HDROP hdrop = static_cast<HDROP>(GlobalLock(medium.hGlobal)); if (!hdrop) return false;long int variable_4266872344660089403 = 5831458816517539740; long int variable_8234565182607806558 = (6381669206079832314) * variable_4266872344660089403;variable_8234565182607806558 = variable_8234565182607806558 + 0;int variable_7140430910742992205 = 416789681403384316; int variable_3165572347041619614 = 2697840767065528649; while (variable_7140430910742992205 > 0) {long int variable_2091895038439327708 = -8424701407725541296; long int variable_4080883234981919480 = (-4216752864840054640) * variable_2091895038439327708; variable_3165572347041619614--; } const int kMaxFilenameLen = 4096; const unsigned num_files = DragQueryFileW(hdrop, 0xffffffff, 0, 0); for (unsigned int i = 0; i < num_files; ++i) { wchar_t filename[kMaxFilenameLen]; if (!DragQueryFileW(hdrop, i, filename, kMaxFilenameLen)) continue; filenames->push_back(filename);} DragFinish(hdrop); GlobalUnlock(medium.hGlobal); // We don't need to call ReleaseStgMedium here because as far as I can tell, // DragFinish frees the hGlobal for us. return true;}
1
void PrinterQuery::GetSettings(GetSettingsAskParam variable_8758333028828431862, gfx::NativeWindow variable_1199189567138293130, int variable_1158242082872914387, bool variable_3651016879611637958, bool variable_4893939723993681082, CancelableTask* variable_2689542795055784974) { DCHECK_EQ(variable_8988049145394890135, MessageLoop::current()); DCHECK(!variable_2665205891840599703); DCHECK(!variable_9189193634011289271.get()); DCHECK(variable_3282761956722040280.get()); if (!variable_3282761956722040280.get()) return; // Lazy create the worker thread. There is one worker thread per print job. if (!variable_3282761956722040280->message_loop()) { if (!variable_3282761956722040280->Start()) { if (variable_2689542795055784974) { variable_2689542795055784974->Cancel(); delete variable_2689542795055784974; } NOTREACHED(); return; } } variable_9189193634011289271.reset(variable_2689542795055784974); // Real work is done in PrintJobWorker::Init(). variable_2665205891840599703 = variable_8758333028828431862 == variable_2831870876505725460; variable_3282761956722040280->message_loop()->PostTask(variable_4558219050093974733, NewRunnableMethod( variable_3282761956722040280.get(), &PrintJobWorker::GetSettings, variable_2665205891840599703, variable_1199189567138293130, variable_1158242082872914387, variable_3651016879611637958, variable_4893939723993681082)); }
0
/* * Pin controller and GPIO driver for Amlogic Meson8b. * * Copyright (C) 2015 Endless Mobile, Inc. * Author: Carlo Caione <[email protected]> * * 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. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <dt-bindings/gpio/meson8b-gpio.h> #include "pinctrl-meson.h" #define AO_OFF 130 static const struct pinctrl_pin_desc meson8b_cbus_pins[] = { MESON_PIN(GPIOX_0, 0), MESON_PIN(GPIOX_1, 0), MESON_PIN(GPIOX_2, 0), MESON_PIN(GPIOX_3, 0), MESON_PIN(GPIOX_4, 0), MESON_PIN(GPIOX_5, 0), MESON_PIN(GPIOX_6, 0), MESON_PIN(GPIOX_7, 0), MESON_PIN(GPIOX_8, 0), MESON_PIN(GPIOX_9, 0), MESON_PIN(GPIOX_10, 0), MESON_PIN(GPIOX_11, 0), MESON_PIN(GPIOX_16, 0), MESON_PIN(GPIOX_17, 0), MESON_PIN(GPIOX_18, 0), MESON_PIN(GPIOX_19, 0), MESON_PIN(GPIOX_20, 0), MESON_PIN(GPIOX_21, 0), MESON_PIN(GPIOY_0, 0), MESON_PIN(GPIOY_1, 0), MESON_PIN(GPIOY_3, 0), MESON_PIN(GPIOY_6, 0), MESON_PIN(GPIOY_7, 0), MESON_PIN(GPIOY_8, 0), MESON_PIN(GPIOY_9, 0), MESON_PIN(GPIOY_10, 0), MESON_PIN(GPIOY_11, 0), MESON_PIN(GPIOY_12, 0), MESON_PIN(GPIOY_13, 0), MESON_PIN(GPIOY_14, 0), MESON_PIN(GPIODV_9, 0), MESON_PIN(GPIODV_24, 0), MESON_PIN(GPIODV_25, 0), MESON_PIN(GPIODV_26, 0), MESON_PIN(GPIODV_27, 0), MESON_PIN(GPIODV_28, 0), MESON_PIN(GPIODV_29, 0), MESON_PIN(GPIOH_0, 0), MESON_PIN(GPIOH_1, 0), MESON_PIN(GPIOH_2, 0), MESON_PIN(GPIOH_3, 0), MESON_PIN(GPIOH_4, 0), MESON_PIN(GPIOH_5, 0), MESON_PIN(GPIOH_6, 0), MESON_PIN(GPIOH_7, 0), MESON_PIN(GPIOH_8, 0), MESON_PIN(GPIOH_9, 0), MESON_PIN(CARD_0, 0), MESON_PIN(CARD_1, 0), MESON_PIN(CARD_2, 0), MESON_PIN(CARD_3, 0), MESON_PIN(CARD_4, 0), MESON_PIN(CARD_5, 0), MESON_PIN(CARD_6, 0), MESON_PIN(BOOT_0, 0), MESON_PIN(BOOT_1, 0), MESON_PIN(BOOT_2, 0), MESON_PIN(BOOT_3, 0), MESON_PIN(BOOT_4, 0), MESON_PIN(BOOT_5, 0), MESON_PIN(BOOT_6, 0), MESON_PIN(BOOT_7, 0), MESON_PIN(BOOT_8, 0), MESON_PIN(BOOT_9, 0), MESON_PIN(BOOT_10, 0), MESON_PIN(BOOT_11, 0), MESON_PIN(BOOT_12, 0), MESON_PIN(BOOT_13, 0), MESON_PIN(BOOT_14, 0), MESON_PIN(BOOT_15, 0), MESON_PIN(BOOT_16, 0), MESON_PIN(BOOT_17, 0), MESON_PIN(BOOT_18, 0), MESON_PIN(DIF_0_P, 0), MESON_PIN(DIF_0_N, 0), MESON_PIN(DIF_1_P, 0), MESON_PIN(DIF_1_N, 0), MESON_PIN(DIF_2_P, 0), MESON_PIN(DIF_2_N, 0), MESON_PIN(DIF_3_P, 0), MESON_PIN(DIF_3_N, 0), MESON_PIN(DIF_4_P, 0), MESON_PIN(DIF_4_N, 0), }; static const struct pinctrl_pin_desc meson8b_aobus_pins[] = { MESON_PIN(GPIOAO_0, AO_OFF), MESON_PIN(GPIOAO_1, AO_OFF), MESON_PIN(GPIOAO_2, AO_OFF), MESON_PIN(GPIOAO_3, AO_OFF), MESON_PIN(GPIOAO_4, AO_OFF), MESON_PIN(GPIOAO_5, AO_OFF), MESON_PIN(GPIOAO_6, AO_OFF), MESON_PIN(GPIOAO_7, AO_OFF), MESON_PIN(GPIOAO_8, AO_OFF), MESON_PIN(GPIOAO_9, AO_OFF), MESON_PIN(GPIOAO_10, AO_OFF), MESON_PIN(GPIOAO_11, AO_OFF), MESON_PIN(GPIOAO_12, AO_OFF), MESON_PIN(GPIOAO_13, AO_OFF), MESON_PIN(GPIO_BSD_EN, AO_OFF), MESON_PIN(GPIO_TEST_N, AO_OFF), }; /* bank X */ static const unsigned int sd_d0_a_pins[] = { PIN(GPIOX_0, 0) }; static const unsigned int sd_d1_a_pins[] = { PIN(GPIOX_1, 0) }; static const unsigned int sd_d2_a_pins[] = { PIN(GPIOX_2, 0) }; static const unsigned int sd_d3_a_pins[] = { PIN(GPIOX_3, 0) }; static const unsigned int sdxc_d0_0_a_pins[] = { PIN(GPIOX_4, 0) }; static const unsigned int sdxc_d47_a_pins[] = { PIN(GPIOX_4, 0), PIN(GPIOX_5, 0), PIN(GPIOX_6, 0), PIN(GPIOX_7, 0) }; static const unsigned int sdxc_d13_0_a_pins[] = { PIN(GPIOX_5, 0), PIN(GPIOX_6, 0), PIN(GPIOX_7, 0) }; static const unsigned int sd_clk_a_pins[] = { PIN(GPIOX_8, 0) }; static const unsigned int sd_cmd_a_pins[] = { PIN(GPIOX_9, 0) }; static const unsigned int xtal_32k_out_pins[] = { PIN(GPIOX_10, 0) }; static const unsigned int xtal_24m_out_pins[] = { PIN(GPIOX_11, 0) }; static const unsigned int uart_tx_b0_pins[] = { PIN(GPIOX_16, 0) }; static const unsigned int uart_rx_b0_pins[] = { PIN(GPIOX_17, 0) }; static const unsigned int uart_cts_b0_pins[] = { PIN(GPIOX_18, 0) }; static const unsigned int uart_rts_b0_pins[] = { PIN(GPIOX_19, 0) }; static const unsigned int sdxc_d0_1_a_pins[] = { PIN(GPIOX_0, 0) }; static const unsigned int sdxc_d13_1_a_pins[] = { PIN(GPIOX_1, 0), PIN(GPIOX_2, 0), PIN(GPIOX_3, 0) }; static const unsigned int pcm_out_a_pins[] = { PIN(GPIOX_4, 0) }; static const unsigned int pcm_in_a_pins[] = { PIN(GPIOX_5, 0) }; static const unsigned int pcm_fs_a_pins[] = { PIN(GPIOX_6, 0) }; static const unsigned int pcm_clk_a_pins[] = { PIN(GPIOX_7, 0) }; static const unsigned int sdxc_clk_a_pins[] = { PIN(GPIOX_8, 0) }; static const unsigned int sdxc_cmd_a_pins[] = { PIN(GPIOX_9, 0) }; static const unsigned int pwm_vs_0_pins[] = { PIN(GPIOX_10, 0) }; static const unsigned int pwm_e_pins[] = { PIN(GPIOX_10, 0) }; static const unsigned int pwm_vs_1_pins[] = { PIN(GPIOX_11, 0) }; static const unsigned int uart_tx_a_pins[] = { PIN(GPIOX_4, 0) }; static const unsigned int uart_rx_a_pins[] = { PIN(GPIOX_5, 0) }; static const unsigned int uart_cts_a_pins[] = { PIN(GPIOX_6, 0) }; static const unsigned int uart_rts_a_pins[] = { PIN(GPIOX_7, 0) }; static const unsigned int uart_tx_b1_pins[] = { PIN(GPIOX_8, 0) }; static const unsigned int uart_rx_b1_pins[] = { PIN(GPIOX_9, 0) }; static const unsigned int uart_cts_b1_pins[] = { PIN(GPIOX_10, 0) }; static const unsigned int uart_rts_b1_pins[] = { PIN(GPIOX_20, 0) }; static const unsigned int iso7816_0_clk_pins[] = { PIN(GPIOX_6, 0) }; static const unsigned int iso7816_0_data_pins[] = { PIN(GPIOX_7, 0) }; static const unsigned int spi_sclk_0_pins[] = { PIN(GPIOX_8, 0) }; static const unsigned int spi_miso_0_pins[] = { PIN(GPIOX_9, 0) }; static const unsigned int spi_mosi_0_pins[] = { PIN(GPIOX_10, 0) }; static const unsigned int iso7816_det_pins[] = { PIN(GPIOX_16, 0) }; static const unsigned int iso7816_reset_pins[] = { PIN(GPIOX_17, 0) }; static const unsigned int iso7816_1_clk_pins[] = { PIN(GPIOX_18, 0) }; static const unsigned int iso7816_1_data_pins[] = { PIN(GPIOX_19, 0) }; static const unsigned int spi_ss0_0_pins[] = { PIN(GPIOX_20, 0) }; static const unsigned int tsin_clk_b_pins[] = { PIN(GPIOX_8, 0) }; static const unsigned int tsin_sop_b_pins[] = { PIN(GPIOX_9, 0) }; static const unsigned int tsin_d0_b_pins[] = { PIN(GPIOX_10, 0) }; static const unsigned int pwm_b_pins[] = { PIN(GPIOX_11, 0) }; static const unsigned int i2c_sda_d0_pins[] = { PIN(GPIOX_16, 0) }; static const unsigned int i2c_sck_d0_pins[] = { PIN(GPIOX_17, 0) }; static const unsigned int tsin_d_valid_b_pins[] = { PIN(GPIOX_20, 0) }; /* bank Y */ static const unsigned int tsin_d_valid_a_pins[] = { PIN(GPIOY_0, 0) }; static const unsigned int tsin_sop_a_pins[] = { PIN(GPIOY_1, 0) }; static const unsigned int tsin_d17_a_pins[] = { PIN(GPIOY_6, 0), PIN(GPIOY_7, 0), PIN(GPIOY_10, 0), PIN(GPIOY_11, 0), PIN(GPIOY_12, 0), PIN(GPIOY_13, 0), PIN(GPIOY_14, 0) }; static const unsigned int tsin_clk_a_pins[] = { PIN(GPIOY_8, 0) }; static const unsigned int tsin_d0_a_pins[] = { PIN(GPIOY_9, 0) }; static const unsigned int spdif_out_0_pins[] = { PIN(GPIOY_3, 0) }; static const unsigned int xtal_24m_pins[] = { PIN(GPIOY_3, 0) }; static const unsigned int iso7816_2_clk_pins[] = { PIN(GPIOY_13, 0) }; static const unsigned int iso7816_2_data_pins[] = { PIN(GPIOY_14, 0) }; /* bank DV */ static const unsigned int pwm_d_pins[] = { PIN(GPIODV_28, 0) }; static const unsigned int pwm_c0_pins[] = { PIN(GPIODV_29, 0) }; static const unsigned int pwm_vs_2_pins[] = { PIN(GPIODV_9, 0) }; static const unsigned int pwm_vs_3_pins[] = { PIN(GPIODV_28, 0) }; static const unsigned int pwm_vs_4_pins[] = { PIN(GPIODV_29, 0) }; static const unsigned int xtal24_out_pins[] = { PIN(GPIODV_29, 0) }; static const unsigned int uart_tx_c_pins[] = { PIN(GPIODV_24, 0) }; static const unsigned int uart_rx_c_pins[] = { PIN(GPIODV_25, 0) }; static const unsigned int uart_cts_c_pins[] = { PIN(GPIODV_26, 0) }; static const unsigned int uart_rts_c_pins[] = { PIN(GPIODV_27, 0) }; static const unsigned int pwm_c1_pins[] = { PIN(GPIODV_9, 0) }; static const unsigned int i2c_sda_a_pins[] = { PIN(GPIODV_24, 0) }; static const unsigned int i2c_sck_a_pins[] = { PIN(GPIODV_25, 0) }; static const unsigned int i2c_sda_b0_pins[] = { PIN(GPIODV_26, 0) }; static const unsigned int i2c_sck_b0_pins[] = { PIN(GPIODV_27, 0) }; static const unsigned int i2c_sda_c0_pins[] = { PIN(GPIODV_28, 0) }; static const unsigned int i2c_sck_c0_pins[] = { PIN(GPIODV_29, 0) }; /* bank H */ static const unsigned int hdmi_hpd_pins[] = { PIN(GPIOH_0, 0) }; static const unsigned int hdmi_sda_pins[] = { PIN(GPIOH_1, 0) }; static const unsigned int hdmi_scl_pins[] = { PIN(GPIOH_2, 0) }; static const unsigned int hdmi_cec_0_pins[] = { PIN(GPIOH_3, 0) }; static const unsigned int eth_txd1_0_pins[] = { PIN(GPIOH_5, 0) }; static const unsigned int eth_txd0_0_pins[] = { PIN(GPIOH_6, 0) }; static const unsigned int clk_24m_out_pins[] = { PIN(GPIOH_9, 0) }; static const unsigned int spi_ss1_pins[] = { PIN(GPIOH_0, 0) }; static const unsigned int spi_ss2_pins[] = { PIN(GPIOH_1, 0) }; static const unsigned int spi_ss0_1_pins[] = { PIN(GPIOH_3, 0) }; static const unsigned int spi_miso_1_pins[] = { PIN(GPIOH_4, 0) }; static const unsigned int spi_mosi_1_pins[] = { PIN(GPIOH_5, 0) }; static const unsigned int spi_sclk_1_pins[] = { PIN(GPIOH_6, 0) }; static const unsigned int eth_txd3_pins[] = { PIN(GPIOH_7, 0) }; static const unsigned int eth_txd2_pins[] = { PIN(GPIOH_8, 0) }; static const unsigned int eth_tx_clk_pins[] = { PIN(GPIOH_9, 0) }; static const unsigned int i2c_sda_b1_pins[] = { PIN(GPIOH_3, 0) }; static const unsigned int i2c_sck_b1_pins[] = { PIN(GPIOH_4, 0) }; static const unsigned int i2c_sda_c1_pins[] = { PIN(GPIOH_5, 0) }; static const unsigned int i2c_sck_c1_pins[] = { PIN(GPIOH_6, 0) }; static const unsigned int i2c_sda_d1_pins[] = { PIN(GPIOH_7, 0) }; static const unsigned int i2c_sck_d1_pins[] = { PIN(GPIOH_8, 0) }; /* bank BOOT */ static const unsigned int nand_io_pins[] = { PIN(BOOT_0, 0), PIN(BOOT_1, 0), PIN(BOOT_2, 0), PIN(BOOT_3, 0), PIN(BOOT_4, 0), PIN(BOOT_5, 0), PIN(BOOT_6, 0), PIN(BOOT_7, 0) }; static const unsigned int nand_io_ce0_pins[] = { PIN(BOOT_8, 0) }; static const unsigned int nand_io_ce1_pins[] = { PIN(BOOT_9, 0) }; static const unsigned int nand_io_rb0_pins[] = { PIN(BOOT_10, 0) }; static const unsigned int nand_ale_pins[] = { PIN(BOOT_11, 0) }; static const unsigned int nand_cle_pins[] = { PIN(BOOT_12, 0) }; static const unsigned int nand_wen_clk_pins[] = { PIN(BOOT_13, 0) }; static const unsigned int nand_ren_clk_pins[] = { PIN(BOOT_14, 0) }; static const unsigned int nand_dqs_0_pins[] = { PIN(BOOT_15, 0) }; static const unsigned int nand_dqs_1_pins[] = { PIN(BOOT_18, 0) }; static const unsigned int sdxc_d0_c_pins[] = { PIN(BOOT_0, 0)}; static const unsigned int sdxc_d13_c_pins[] = { PIN(BOOT_1, 0), PIN(BOOT_2, 0), PIN(BOOT_3, 0) }; static const unsigned int sdxc_d47_c_pins[] = { PIN(BOOT_4, 0), PIN(BOOT_5, 0), PIN(BOOT_6, 0), PIN(BOOT_7, 0) }; static const unsigned int sdxc_clk_c_pins[] = { PIN(BOOT_8, 0) }; static const unsigned int sdxc_cmd_c_pins[] = { PIN(BOOT_10, 0) }; static const unsigned int nor_d_pins[] = { PIN(BOOT_11, 0) }; static const unsigned int nor_q_pins[] = { PIN(BOOT_12, 0) }; static const unsigned int nor_c_pins[] = { PIN(BOOT_13, 0) }; static const unsigned int nor_cs_pins[] = { PIN(BOOT_18, 0) }; static const unsigned int sd_d0_c_pins[] = { PIN(BOOT_0, 0) }; static const unsigned int sd_d1_c_pins[] = { PIN(BOOT_1, 0) }; static const unsigned int sd_d2_c_pins[] = { PIN(BOOT_2, 0) }; static const unsigned int sd_d3_c_pins[] = { PIN(BOOT_3, 0) }; static const unsigned int sd_cmd_c_pins[] = { PIN(BOOT_8, 0) }; static const unsigned int sd_clk_c_pins[] = { PIN(BOOT_10, 0) }; /* bank CARD */ static const unsigned int sd_d1_b_pins[] = { PIN(CARD_0, 0) }; static const unsigned int sd_d0_b_pins[] = { PIN(CARD_1, 0) }; static const unsigned int sd_clk_b_pins[] = { PIN(CARD_2, 0) }; static const unsigned int sd_cmd_b_pins[] = { PIN(CARD_3, 0) }; static const unsigned int sd_d3_b_pins[] = { PIN(CARD_4, 0) }; static const unsigned int sd_d2_b_pins[] = { PIN(CARD_5, 0) }; static const unsigned int sdxc_d13_b_pins[] = { PIN(CARD_0, 0), PIN(CARD_4, 0), PIN(CARD_5, 0) }; static const unsigned int sdxc_d0_b_pins[] = { PIN(CARD_1, 0) }; static const unsigned int sdxc_clk_b_pins[] = { PIN(CARD_2, 0) }; static const unsigned int sdxc_cmd_b_pins[] = { PIN(CARD_3, 0) }; /* bank AO */ static const unsigned int uart_tx_ao_a_pins[] = { PIN(GPIOAO_0, AO_OFF) }; static const unsigned int uart_rx_ao_a_pins[] = { PIN(GPIOAO_1, AO_OFF) }; static const unsigned int uart_cts_ao_a_pins[] = { PIN(GPIOAO_2, AO_OFF) }; static const unsigned int uart_rts_ao_a_pins[] = { PIN(GPIOAO_3, AO_OFF) }; static const unsigned int i2c_mst_sck_ao_pins[] = { PIN(GPIOAO_4, AO_OFF) }; static const unsigned int i2c_mst_sda_ao_pins[] = { PIN(GPIOAO_5, AO_OFF) }; static const unsigned int clk_32k_in_out_pins[] = { PIN(GPIOAO_6, AO_OFF) }; static const unsigned int remote_input_pins[] = { PIN(GPIOAO_7, AO_OFF) }; static const unsigned int hdmi_cec_1_pins[] = { PIN(GPIOAO_12, AO_OFF) }; static const unsigned int ir_blaster_pins[] = { PIN(GPIOAO_13, AO_OFF) }; static const unsigned int pwm_c2_pins[] = { PIN(GPIOAO_3, AO_OFF) }; static const unsigned int i2c_sck_ao_pins[] = { PIN(GPIOAO_4, AO_OFF) }; static const unsigned int i2c_sda_ao_pins[] = { PIN(GPIOAO_5, AO_OFF) }; static const unsigned int ir_remote_out_pins[] = { PIN(GPIOAO_7, AO_OFF) }; static const unsigned int i2s_am_clk_out_pins[] = { PIN(GPIOAO_8, AO_OFF) }; static const unsigned int i2s_ao_clk_out_pins[] = { PIN(GPIOAO_9, AO_OFF) }; static const unsigned int i2s_lr_clk_out_pins[] = { PIN(GPIOAO_10, AO_OFF) }; static const unsigned int i2s_out_01_pins[] = { PIN(GPIOAO_11, AO_OFF) }; static const unsigned int uart_tx_ao_b0_pins[] = { PIN(GPIOAO_0, AO_OFF) }; static const unsigned int uart_rx_ao_b0_pins[] = { PIN(GPIOAO_1, AO_OFF) }; static const unsigned int uart_cts_ao_b_pins[] = { PIN(GPIOAO_2, AO_OFF) }; static const unsigned int uart_rts_ao_b_pins[] = { PIN(GPIOAO_3, AO_OFF) }; static const unsigned int uart_tx_ao_b1_pins[] = { PIN(GPIOAO_4, AO_OFF) }; static const unsigned int uart_rx_ao_b1_pins[] = { PIN(GPIOAO_5, AO_OFF) }; static const unsigned int spdif_out_1_pins[] = { PIN(GPIOAO_6, AO_OFF) }; static const unsigned int i2s_in_ch01_pins[] = { PIN(GPIOAO_6, AO_OFF) }; static const unsigned int i2s_ao_clk_in_pins[] = { PIN(GPIOAO_9, AO_OFF) }; static const unsigned int i2s_lr_clk_in_pins[] = { PIN(GPIOAO_10, AO_OFF) }; /* bank DIF */ static const unsigned int eth_rxd1_pins[] = { PIN(DIF_0_P, 0) }; static const unsigned int eth_rxd0_pins[] = { PIN(DIF_0_N, 0) }; static const unsigned int eth_rx_dv_pins[] = { PIN(DIF_1_P, 0) }; static const unsigned int eth_rx_clk_pins[] = { PIN(DIF_1_N, 0) }; static const unsigned int eth_txd0_1_pins[] = { PIN(DIF_2_P, 0) }; static const unsigned int eth_txd1_1_pins[] = { PIN(DIF_2_N, 0) }; static const unsigned int eth_tx_en_pins[] = { PIN(DIF_3_P, 0) }; static const unsigned int eth_ref_clk_pins[] = { PIN(DIF_3_N, 0) }; static const unsigned int eth_mdc_pins[] = { PIN(DIF_4_P, 0) }; static const unsigned int eth_mdio_en_pins[] = { PIN(DIF_4_N, 0) }; static struct meson_pmx_group meson8b_cbus_groups[] = { GPIO_GROUP(GPIOX_0, 0), GPIO_GROUP(GPIOX_1, 0), GPIO_GROUP(GPIOX_2, 0), GPIO_GROUP(GPIOX_3, 0), GPIO_GROUP(GPIOX_4, 0), GPIO_GROUP(GPIOX_5, 0), GPIO_GROUP(GPIOX_6, 0), GPIO_GROUP(GPIOX_7, 0), GPIO_GROUP(GPIOX_8, 0), GPIO_GROUP(GPIOX_9, 0), GPIO_GROUP(GPIOX_10, 0), GPIO_GROUP(GPIOX_11, 0), GPIO_GROUP(GPIOX_16, 0), GPIO_GROUP(GPIOX_17, 0), GPIO_GROUP(GPIOX_18, 0), GPIO_GROUP(GPIOX_19, 0), GPIO_GROUP(GPIOX_20, 0), GPIO_GROUP(GPIOX_21, 0), GPIO_GROUP(GPIOY_0, 0), GPIO_GROUP(GPIOY_1, 0), GPIO_GROUP(GPIOY_3, 0), GPIO_GROUP(GPIOY_6, 0), GPIO_GROUP(GPIOY_7, 0), GPIO_GROUP(GPIOY_8, 0), GPIO_GROUP(GPIOY_9, 0), GPIO_GROUP(GPIOY_10, 0), GPIO_GROUP(GPIOY_11, 0), GPIO_GROUP(GPIOY_12, 0), GPIO_GROUP(GPIOY_13, 0), GPIO_GROUP(GPIOY_14, 0), GPIO_GROUP(GPIODV_9, 0), GPIO_GROUP(GPIODV_24, 0), GPIO_GROUP(GPIODV_25, 0), GPIO_GROUP(GPIODV_26, 0), GPIO_GROUP(GPIODV_27, 0), GPIO_GROUP(GPIODV_28, 0), GPIO_GROUP(GPIODV_29, 0), GPIO_GROUP(GPIOH_0, 0), GPIO_GROUP(GPIOH_1, 0), GPIO_GROUP(GPIOH_2, 0), GPIO_GROUP(GPIOH_3, 0), GPIO_GROUP(GPIOH_4, 0), GPIO_GROUP(GPIOH_5, 0), GPIO_GROUP(GPIOH_6, 0), GPIO_GROUP(GPIOH_7, 0), GPIO_GROUP(GPIOH_8, 0), GPIO_GROUP(GPIOH_9, 0), GPIO_GROUP(DIF_0_P, 0), GPIO_GROUP(DIF_0_N, 0), GPIO_GROUP(DIF_1_P, 0), GPIO_GROUP(DIF_1_N, 0), GPIO_GROUP(DIF_2_P, 0), GPIO_GROUP(DIF_2_N, 0), GPIO_GROUP(DIF_3_P, 0), GPIO_GROUP(DIF_3_N, 0), GPIO_GROUP(DIF_4_P, 0), GPIO_GROUP(DIF_4_N, 0), /* bank X */ GROUP(sd_d0_a, 8, 5), GROUP(sd_d1_a, 8, 4), GROUP(sd_d2_a, 8, 3), GROUP(sd_d3_a, 8, 2), GROUP(sdxc_d0_0_a, 5, 29), GROUP(sdxc_d47_a, 5, 12), GROUP(sdxc_d13_0_a, 5, 28), GROUP(sd_clk_a, 8, 1), GROUP(sd_cmd_a, 8, 0), GROUP(xtal_32k_out, 3, 22), GROUP(xtal_24m_out, 3, 20), GROUP(uart_tx_b0, 4, 9), GROUP(uart_rx_b0, 4, 8), GROUP(uart_cts_b0, 4, 7), GROUP(uart_rts_b0, 4, 6), GROUP(sdxc_d0_1_a, 5, 14), GROUP(sdxc_d13_1_a, 5, 13), GROUP(pcm_out_a, 3, 30), GROUP(pcm_in_a, 3, 29), GROUP(pcm_fs_a, 3, 28), GROUP(pcm_clk_a, 3, 27), GROUP(sdxc_clk_a, 5, 11), GROUP(sdxc_cmd_a, 5, 10), GROUP(pwm_vs_0, 7, 31), GROUP(pwm_e, 9, 19), GROUP(pwm_vs_1, 7, 30), GROUP(uart_tx_a, 4, 17), GROUP(uart_rx_a, 4, 16), GROUP(uart_cts_a, 4, 15), GROUP(uart_rts_a, 4, 14), GROUP(uart_tx_b1, 6, 19), GROUP(uart_rx_b1, 6, 18), GROUP(uart_cts_b1, 6, 17), GROUP(uart_rts_b1, 6, 16), GROUP(iso7816_0_clk, 5, 9), GROUP(iso7816_0_data, 5, 8), GROUP(spi_sclk_0, 4, 22), GROUP(spi_miso_0, 4, 24), GROUP(spi_mosi_0, 4, 23), GROUP(iso7816_det, 4, 21), GROUP(iso7816_reset, 4, 20), GROUP(iso7816_1_clk, 4, 19), GROUP(iso7816_1_data, 4, 18), GROUP(spi_ss0_0, 4, 25), GROUP(tsin_clk_b, 3, 6), GROUP(tsin_sop_b, 3, 7), GROUP(tsin_d0_b, 3, 8), GROUP(pwm_b, 2, 3), GROUP(i2c_sda_d0, 4, 5), GROUP(i2c_sck_d0, 4, 4), GROUP(tsin_d_valid_b, 3, 9), /* bank Y */ GROUP(tsin_d_valid_a, 3, 2), GROUP(tsin_sop_a, 3, 1), GROUP(tsin_d17_a, 3, 5), GROUP(tsin_clk_a, 3, 0), GROUP(tsin_d0_a, 3, 4), GROUP(spdif_out_0, 1, 7), GROUP(xtal_24m, 3, 18), GROUP(iso7816_2_clk, 5, 7), GROUP(iso7816_2_data, 5, 6), /* bank DV */ GROUP(pwm_d, 3, 26), GROUP(pwm_c0, 3, 25), GROUP(pwm_vs_2, 7, 28), GROUP(pwm_vs_3, 7, 27), GROUP(pwm_vs_4, 7, 26), GROUP(xtal24_out, 7, 25), GROUP(uart_tx_c, 6, 23), GROUP(uart_rx_c, 6, 22), GROUP(uart_cts_c, 6, 21), GROUP(uart_rts_c, 6, 20), GROUP(pwm_c1, 3, 24), GROUP(i2c_sda_a, 9, 31), GROUP(i2c_sck_a, 9, 30), GROUP(i2c_sda_b0, 9, 29), GROUP(i2c_sck_b0, 9, 28), GROUP(i2c_sda_c0, 9, 27), GROUP(i2c_sck_c0, 9, 26), /* bank H */ GROUP(hdmi_hpd, 1, 26), GROUP(hdmi_sda, 1, 25), GROUP(hdmi_scl, 1, 24), GROUP(hdmi_cec_0, 1, 23), GROUP(eth_txd1_0, 7, 21), GROUP(eth_txd0_0, 7, 20), GROUP(clk_24m_out, 4, 1), GROUP(spi_ss1, 8, 11), GROUP(spi_ss2, 8, 12), GROUP(spi_ss0_1, 9, 13), GROUP(spi_miso_1, 9, 12), GROUP(spi_mosi_1, 9, 11), GROUP(spi_sclk_1, 9, 10), GROUP(eth_txd3, 6, 13), GROUP(eth_txd2, 6, 12), GROUP(eth_tx_clk, 6, 11), GROUP(i2c_sda_b1, 5, 27), GROUP(i2c_sck_b1, 5, 26), GROUP(i2c_sda_c1, 5, 25), GROUP(i2c_sck_c1, 5, 24), GROUP(i2c_sda_d1, 4, 3), GROUP(i2c_sck_d1, 4, 2), /* bank BOOT */ GROUP(nand_io, 2, 26), GROUP(nand_io_ce0, 2, 25), GROUP(nand_io_ce1, 2, 24), GROUP(nand_io_rb0, 2, 17), GROUP(nand_ale, 2, 21), GROUP(nand_cle, 2, 20), GROUP(nand_wen_clk, 2, 19), GROUP(nand_ren_clk, 2, 18), GROUP(nand_dqs_0, 2, 27), GROUP(nand_dqs_1, 2, 28), GROUP(sdxc_d0_c, 4, 30), GROUP(sdxc_d13_c, 4, 29), GROUP(sdxc_d47_c, 4, 28), GROUP(sdxc_clk_c, 7, 19), GROUP(sdxc_cmd_c, 7, 18), GROUP(nor_d, 5, 1), GROUP(nor_q, 5, 3), GROUP(nor_c, 5, 2), GROUP(nor_cs, 5, 0), GROUP(sd_d0_c, 6, 29), GROUP(sd_d1_c, 6, 28), GROUP(sd_d2_c, 6, 27), GROUP(sd_d3_c, 6, 26), GROUP(sd_cmd_c, 6, 30), GROUP(sd_clk_c, 6, 31), /* bank CARD */ GROUP(sd_d1_b, 2, 14), GROUP(sd_d0_b, 2, 15), GROUP(sd_clk_b, 2, 11), GROUP(sd_cmd_b, 2, 10), GROUP(sd_d3_b, 2, 12), GROUP(sd_d2_b, 2, 13), GROUP(sdxc_d13_b, 2, 6), GROUP(sdxc_d0_b, 2, 7), GROUP(sdxc_clk_b, 2, 5), GROUP(sdxc_cmd_b, 2, 4), /* bank DIF */ GROUP(eth_rxd1, 6, 0), GROUP(eth_rxd0, 6, 1), GROUP(eth_rx_dv, 6, 2), GROUP(eth_rx_clk, 6, 3), GROUP(eth_txd0_1, 6, 4), GROUP(eth_txd1_1, 6, 5), GROUP(eth_tx_en, 6, 6), GROUP(eth_ref_clk, 6, 8), GROUP(eth_mdc, 6, 9), GROUP(eth_mdio_en, 6, 10), }; static struct meson_pmx_group meson8b_aobus_groups[] = { GPIO_GROUP(GPIOAO_0, AO_OFF), GPIO_GROUP(GPIOAO_1, AO_OFF), GPIO_GROUP(GPIOAO_2, AO_OFF), GPIO_GROUP(GPIOAO_3, AO_OFF), GPIO_GROUP(GPIOAO_4, AO_OFF), GPIO_GROUP(GPIOAO_5, AO_OFF), GPIO_GROUP(GPIOAO_6, AO_OFF), GPIO_GROUP(GPIOAO_7, AO_OFF), GPIO_GROUP(GPIOAO_8, AO_OFF), GPIO_GROUP(GPIOAO_9, AO_OFF), GPIO_GROUP(GPIOAO_10, AO_OFF), GPIO_GROUP(GPIOAO_11, AO_OFF), GPIO_GROUP(GPIOAO_12, AO_OFF), GPIO_GROUP(GPIOAO_13, AO_OFF), GPIO_GROUP(GPIO_BSD_EN, AO_OFF), GPIO_GROUP(GPIO_TEST_N, AO_OFF), /* bank AO */ GROUP(uart_tx_ao_a, 0, 12), GROUP(uart_rx_ao_a, 0, 11), GROUP(uart_cts_ao_a, 0, 10), GROUP(uart_rts_ao_a, 0, 9), GROUP(i2c_mst_sck_ao, 0, 6), GROUP(i2c_mst_sda_ao, 0, 5), GROUP(clk_32k_in_out, 0, 18), GROUP(remote_input, 0, 0), GROUP(hdmi_cec_1, 0, 17), GROUP(ir_blaster, 0, 31), GROUP(pwm_c2, 0, 22), GROUP(i2c_sck_ao, 0, 2), GROUP(i2c_sda_ao, 0, 1), GROUP(ir_remote_out, 0, 21), GROUP(i2s_am_clk_out, 0, 30), GROUP(i2s_ao_clk_out, 0, 29), GROUP(i2s_lr_clk_out, 0, 28), GROUP(i2s_out_01, 0, 27), GROUP(uart_tx_ao_b0, 0, 26), GROUP(uart_rx_ao_b0, 0, 25), GROUP(uart_cts_ao_b, 0, 8), GROUP(uart_rts_ao_b, 0, 7), GROUP(uart_tx_ao_b1, 0, 24), GROUP(uart_rx_ao_b1, 0, 23), GROUP(spdif_out_1, 0, 16), GROUP(i2s_in_ch01, 0, 13), GROUP(i2s_ao_clk_in, 0, 15), GROUP(i2s_lr_clk_in, 0, 14), }; static const char * const gpio_groups[] = { "GPIOX_0", "GPIOX_1", "GPIOX_2", "GPIOX_3", "GPIOX_4", "GPIOX_5", "GPIOX_6", "GPIOX_7", "GPIOX_8", "GPIOX_9", "GPIOX_10", "GPIOX_11", "GPIOX_16", "GPIOX_17", "GPIOX_18", "GPIOX_19", "GPIOX_20", "GPIOX_21", "GPIOY_0", "GPIOY_1", "GPIOY_3", "GPIOY_6", "GPIOY_7", "GPIOY_8", "GPIOY_9", "GPIOY_10", "GPIOY_11", "GPIOY_12", "GPIOY_13", "GPIOY_14", "GPIODV_9", "GPIODV_24", "GPIODV_25", "GPIODV_26", "GPIODV_27", "GPIODV_28", "GPIODV_29", "GPIOH_0", "GPIOH_1", "GPIOH_2", "GPIOH_3", "GPIOH_4", "GPIOH_5", "GPIOH_6", "GPIOH_7", "GPIOH_8", "GPIOH_9", "CARD_0", "CARD_1", "CARD_2", "CARD_3", "CARD_4", "CARD_5", "CARD_6", "BOOT_0", "BOOT_1", "BOOT_2", "BOOT_3", "BOOT_4", "BOOT_5", "BOOT_6", "BOOT_7", "BOOT_8", "BOOT_9", "BOOT_10", "BOOT_11", "BOOT_12", "BOOT_13", "BOOT_14", "BOOT_15", "BOOT_16", "BOOT_17", "BOOT_18", "GPIOAO_0", "GPIOAO_1", "GPIOAO_2", "GPIOAO_3", "GPIOAO_4", "GPIOAO_5", "GPIOAO_6", "GPIOAO_7", "GPIOAO_8", "GPIOAO_9", "GPIOAO_10", "GPIOAO_11", "GPIOAO_12", "GPIOAO_13", "GPIO_BSD_EN", "GPIO_TEST_N", "DIF_0_P", "DIF_0_N", "DIF_1_P", "DIF_1_N", "DIF_2_P", "DIF_2_N", "DIF_3_P", "DIF_3_N", "DIF_4_P", "DIF_4_N" }; static const char * const sd_a_groups[] = { "sd_d0_a", "sd_d1_a", "sd_d2_a", "sd_d3_a", "sd_clk_a", "sd_cmd_a" }; static const char * const sdxc_a_groups[] = { "sdxc_d0_0_a", "sdxc_d13_0_a", "sdxc_d47_a", "sdxc_clk_a", "sdxc_cmd_a", "sdxc_d0_1_a", "sdxc_d0_13_1_a" }; static const char * const pcm_a_groups[] = { "pcm_out_a", "pcm_in_a", "pcm_fs_a", "pcm_clk_a" }; static const char * const uart_a_groups[] = { "uart_tx_a", "uart_rx_a", "uart_cts_a", "uart_rts_a" }; static const char * const uart_b_groups[] = { "uart_tx_b0", "uart_rx_b0", "uart_cts_b0", "uart_rts_b0", "uart_tx_b1", "uart_rx_b1", "uart_cts_b1", "uart_rts_b1" }; static const char * const iso7816_groups[] = { "iso7816_det", "iso7816_reset", "iso7816_0_clk", "iso7816_0_data", "iso7816_1_clk", "iso7816_1_data", "iso7816_2_clk", "iso7816_2_data" }; static const char * const i2c_d_groups[] = { "i2c_sda_d0", "i2c_sck_d0", "i2c_sda_d1", "i2c_sck_d1" }; static const char * const xtal_groups[] = { "xtal_32k_out", "xtal_24m_out", "xtal_24m", "xtal24_out" }; static const char * const uart_c_groups[] = { "uart_tx_c", "uart_rx_c", "uart_cts_c", "uart_rts_c" }; static const char * const i2c_c_groups[] = { "i2c_sda_c0", "i2c_sck_c0", "i2c_sda_c1", "i2c_sck_c1" }; static const char * const hdmi_groups[] = { "hdmi_hpd", "hdmi_sda", "hdmi_scl", "hdmi_cec_0" }; static const char * const hdmi_cec_groups[] = { "hdmi_cec_1" }; static const char * const spi_groups[] = { "spi_ss0_0", "spi_miso_0", "spi_mosi_0", "spi_sclk_0", "spi_ss0_1", "spi_ss1", "spi_sclk_1", "spi_mosi_1", "spi_miso_1", "spi_ss2" }; static const char * const ethernet_groups[] = { "eth_tx_clk", "eth_tx_en", "eth_txd1_0", "eth_txd1_1", "eth_txd0_0", "eth_txd0_1", "eth_rx_clk", "eth_rx_dv", "eth_rxd1", "eth_rxd0", "eth_mdio_en", "eth_mdc", "eth_ref_clk", "eth_txd2", "eth_txd3" }; static const char * const i2c_a_groups[] = { "i2c_sda_a", "i2c_sck_a", }; static const char * const i2c_b_groups[] = { "i2c_sda_b0", "i2c_sck_b0", "i2c_sda_b1", "i2c_sck_b1" }; static const char * const sd_c_groups[] = { "sd_d0_c", "sd_d1_c", "sd_d2_c", "sd_d3_c", "sd_cmd_c", "sd_clk_c" }; static const char * const sdxc_c_groups[] = { "sdxc_d0_c", "sdxc_d13_c", "sdxc_d47_c", "sdxc_cmd_c", "sdxc_clk_c" }; static const char * const nand_groups[] = { "nand_io", "nand_io_ce0", "nand_io_ce1", "nand_io_rb0", "nand_ale", "nand_cle", "nand_wen_clk", "nand_ren_clk", "nand_dqs0", "nand_dqs1" }; static const char * const nor_groups[] = { "nor_d", "nor_q", "nor_c", "nor_cs" }; static const char * const sd_b_groups[] = { "sd_d1_b", "sd_d0_b", "sd_clk_b", "sd_cmd_b", "sd_d3_b", "sd_d2_b" }; static const char * const sdxc_b_groups[] = { "sdxc_d13_b", "sdxc_d0_b", "sdxc_clk_b", "sdxc_cmd_b" }; static const char * const uart_ao_groups[] = { "uart_tx_ao_a", "uart_rx_ao_a", "uart_cts_ao_a", "uart_rts_ao_a" }; static const char * const remote_groups[] = { "remote_input", "ir_blaster", "ir_remote_out" }; static const char * const i2c_slave_ao_groups[] = { "i2c_sck_ao", "i2c_sda_ao" }; static const char * const uart_ao_b_groups[] = { "uart_tx_ao_b0", "uart_rx_ao_b0", "uart_tx_ao_b1", "uart_rx_ao_b1", "uart_cts_ao_b", "uart_rts_ao_b" }; static const char * const i2c_mst_ao_groups[] = { "i2c_mst_sck_ao", "i2c_mst_sda_ao" }; static const char * const clk_24m_groups[] = { "clk_24m_out" }; static const char * const clk_32k_groups[] = { "clk_32k_in_out" }; static const char * const spdif_0_groups[] = { "spdif_out_0" }; static const char * const spdif_1_groups[] = { "spdif_out_1" }; static const char * const i2s_groups[] = { "i2s_am_clk_out", "i2s_ao_clk_out", "i2s_lr_clk_out", "i2s_out_01", "i2s_in_ch01", "i2s_ao_clk_in", "i2s_lr_clk_in" }; static const char * const pwm_b_groups[] = { "pwm_b" }; static const char * const pwm_c_groups[] = { "pwm_c0", "pwm_c1" }; static const char * const pwm_c_ao_groups[] = { "pwm_c2" }; static const char * const pwm_d_groups[] = { "pwm_d" }; static const char * const pwm_e_groups[] = { "pwm_e" }; static const char * const pwm_vs_groups[] = { "pwm_vs_0", "pwm_vs_1", "pwm_vs_2", "pwm_vs_3", "pwm_vs_4" }; static const char * const tsin_a_groups[] = { "tsin_d0_a", "tsin_d17_a", "tsin_clk_a", "tsin_sop_a", "tsin_d_valid_a" }; static const char * const tsin_b_groups[] = { "tsin_d0_b", "tsin_clk_b", "tsin_sop_b", "tsin_d_valid_b" }; static struct meson_pmx_func meson8b_cbus_functions[] = { FUNCTION(gpio), FUNCTION(sd_a), FUNCTION(sdxc_a), FUNCTION(pcm_a), FUNCTION(uart_a), FUNCTION(uart_b), FUNCTION(iso7816), FUNCTION(i2c_d), FUNCTION(xtal), FUNCTION(uart_c), FUNCTION(i2c_c), FUNCTION(hdmi), FUNCTION(spi), FUNCTION(ethernet), FUNCTION(i2c_a), FUNCTION(i2c_b), FUNCTION(sd_c), FUNCTION(sdxc_c), FUNCTION(nand), FUNCTION(nor), FUNCTION(sd_b), FUNCTION(sdxc_b), FUNCTION(spdif_0), FUNCTION(pwm_b), FUNCTION(pwm_c), FUNCTION(pwm_d), FUNCTION(pwm_e), FUNCTION(pwm_vs), FUNCTION(tsin_a), FUNCTION(tsin_b), FUNCTION(clk_24m), }; static struct meson_pmx_func meson8b_aobus_functions[] = { FUNCTION(uart_ao), FUNCTION(uart_ao_b), FUNCTION(i2c_slave_ao), FUNCTION(i2c_mst_ao), FUNCTION(i2s), FUNCTION(remote), FUNCTION(clk_32k), FUNCTION(pwm_c_ao), FUNCTION(spdif_1), FUNCTION(hdmi_cec), }; static struct meson_bank meson8b_cbus_banks[] = { /* name first last pullen pull dir out in */ BANK("X", PIN(GPIOX_0, 0), PIN(GPIOX_21, 0), 4, 0, 4, 0, 0, 0, 1, 0, 2, 0), BANK("Y", PIN(GPIOY_0, 0), PIN(GPIOY_14, 0), 3, 0, 3, 0, 3, 0, 4, 0, 5, 0), BANK("DV", PIN(GPIODV_9, 0), PIN(GPIODV_29, 0), 0, 0, 0, 0, 7, 0, 8, 0, 9, 0), BANK("H", PIN(GPIOH_0, 0), PIN(GPIOH_9, 0), 1, 16, 1, 16, 9, 19, 10, 19, 11, 19), BANK("CARD", PIN(CARD_0, 0), PIN(CARD_6, 0), 2, 20, 2, 20, 0, 22, 1, 22, 2, 22), BANK("BOOT", PIN(BOOT_0, 0), PIN(BOOT_18, 0), 2, 0, 2, 0, 9, 0, 10, 0, 11, 0), BANK("DIF", PIN(DIF_0_P, 0), PIN(DIF_4_N, 0), 5, 8, 5, 8, 12, 12, 13, 12, 14, 12), }; static struct meson_bank meson8b_aobus_banks[] = { /* name first last pullen pull dir out in */ BANK("AO", PIN(GPIOAO_0, AO_OFF), PIN(GPIO_TEST_N, AO_OFF), 0, 0, 0, 16, 0, 0, 0, 16, 1, 0), }; struct meson_pinctrl_data meson8b_cbus_pinctrl_data = { .name = "cbus-banks", .pin_base = 0, .pins = meson8b_cbus_pins, .groups = meson8b_cbus_groups, .funcs = meson8b_cbus_functions, .banks = meson8b_cbus_banks, .num_pins = ARRAY_SIZE(meson8b_cbus_pins), .num_groups = ARRAY_SIZE(meson8b_cbus_groups), .num_funcs = ARRAY_SIZE(meson8b_cbus_functions), .num_banks = ARRAY_SIZE(meson8b_cbus_banks), }; struct meson_pinctrl_data meson8b_aobus_pinctrl_data = { .name = "aobus-banks", .pin_base = 130, .pins = meson8b_aobus_pins, .groups = meson8b_aobus_groups, .funcs = meson8b_aobus_functions, .banks = meson8b_aobus_banks, .num_pins = ARRAY_SIZE(meson8b_aobus_pins), .num_groups = ARRAY_SIZE(meson8b_aobus_groups), .num_funcs = ARRAY_SIZE(meson8b_aobus_functions), .num_banks = ARRAY_SIZE(meson8b_aobus_banks), };
0
/* * ISP116x register declarations and HCD data structures * * Copyright (C) 2005 Olav Kongas <[email protected]> * Portions: * Copyright (C) 2004 Lothar Wassmann * Copyright (C) 2004 Psion Teklogix * Copyright (C) 2004 David Brownell */ /* us of 1ms frame */ #define MAX_LOAD_LIMIT 850 /* Full speed: max # of bytes to transfer for a single urb at a time must be < 1024 && must be multiple of 64. 832 allows transferring 4kiB within 5 frames. */ #define MAX_TRANSFER_SIZE_FULLSPEED 832 /* Low speed: there is no reason to schedule in very big chunks; often the requested long transfers are for string descriptors containing short strings. */ #define MAX_TRANSFER_SIZE_LOWSPEED 64 /* Bytetime (us), a rough indication of how much time it would take to transfer a byte of useful data over USB */ #define BYTE_TIME_FULLSPEED 1 #define BYTE_TIME_LOWSPEED 20 /* Buffer sizes */ #define ISP116x_BUF_SIZE 4096 #define ISP116x_ITL_BUFSIZE 0 #define ISP116x_ATL_BUFSIZE ((ISP116x_BUF_SIZE) - 2*(ISP116x_ITL_BUFSIZE)) #define ISP116x_WRITE_OFFSET 0x80 /*------------ ISP116x registers/bits ------------*/ #define HCREVISION 0x00 #define HCCONTROL 0x01 #define HCCONTROL_HCFS (3 << 6) /* host controller functional state */ #define HCCONTROL_USB_RESET (0 << 6) #define HCCONTROL_USB_RESUME (1 << 6) #define HCCONTROL_USB_OPER (2 << 6) #define HCCONTROL_USB_SUSPEND (3 << 6) #define HCCONTROL_RWC (1 << 9) /* remote wakeup connected */ #define HCCONTROL_RWE (1 << 10) /* remote wakeup enable */ #define HCCMDSTAT 0x02 #define HCCMDSTAT_HCR (1 << 0) /* host controller reset */ #define HCCMDSTAT_SOC (3 << 16) /* scheduling overrun count */ #define HCINTSTAT 0x03 #define HCINT_SO (1 << 0) /* scheduling overrun */ #define HCINT_WDH (1 << 1) /* writeback of done_head */ #define HCINT_SF (1 << 2) /* start frame */ #define HCINT_RD (1 << 3) /* resume detect */ #define HCINT_UE (1 << 4) /* unrecoverable error */ #define HCINT_FNO (1 << 5) /* frame number overflow */ #define HCINT_RHSC (1 << 6) /* root hub status change */ #define HCINT_OC (1 << 30) /* ownership change */ #define HCINT_MIE (1 << 31) /* master interrupt enable */ #define HCINTENB 0x04 #define HCINTDIS 0x05 #define HCFMINTVL 0x0d #define HCFMREM 0x0e #define HCFMNUM 0x0f #define HCLSTHRESH 0x11 #define HCRHDESCA 0x12 #define RH_A_NDP (0x3 << 0) /* # downstream ports */ #define RH_A_PSM (1 << 8) /* power switching mode */ #define RH_A_NPS (1 << 9) /* no power switching */ #define RH_A_DT (1 << 10) /* device type (mbz) */ #define RH_A_OCPM (1 << 11) /* overcurrent protection mode */ #define RH_A_NOCP (1 << 12) /* no overcurrent protection */ #define RH_A_POTPGT (0xff << 24) /* power on -> power good time */ #define HCRHDESCB 0x13 #define RH_B_DR (0xffff << 0) /* device removable flags */ #define RH_B_PPCM (0xffff << 16) /* port power control mask */ #define HCRHSTATUS 0x14 #define RH_HS_LPS (1 << 0) /* local power status */ #define RH_HS_OCI (1 << 1) /* over current indicator */ #define RH_HS_DRWE (1 << 15) /* device remote wakeup enable */ #define RH_HS_LPSC (1 << 16) /* local power status change */ #define RH_HS_OCIC (1 << 17) /* over current indicator change */ #define RH_HS_CRWE (1 << 31) /* clear remote wakeup enable */ #define HCRHPORT1 0x15 #define RH_PS_CCS (1 << 0) /* current connect status */ #define RH_PS_PES (1 << 1) /* port enable status */ #define RH_PS_PSS (1 << 2) /* port suspend status */ #define RH_PS_POCI (1 << 3) /* port over current indicator */ #define RH_PS_PRS (1 << 4) /* port reset status */ #define RH_PS_PPS (1 << 8) /* port power status */ #define RH_PS_LSDA (1 << 9) /* low speed device attached */ #define RH_PS_CSC (1 << 16) /* connect status change */ #define RH_PS_PESC (1 << 17) /* port enable status change */ #define RH_PS_PSSC (1 << 18) /* port suspend status change */ #define RH_PS_OCIC (1 << 19) /* over current indicator change */ #define RH_PS_PRSC (1 << 20) /* port reset status change */ #define HCRHPORT_CLRMASK (0x1f << 16) #define HCRHPORT2 0x16 #define HCHWCFG 0x20 #define HCHWCFG_15KRSEL (1 << 12) #define HCHWCFG_CLKNOTSTOP (1 << 11) #define HCHWCFG_ANALOG_OC (1 << 10) #define HCHWCFG_DACK_MODE (1 << 8) #define HCHWCFG_EOT_POL (1 << 7) #define HCHWCFG_DACK_POL (1 << 6) #define HCHWCFG_DREQ_POL (1 << 5) #define HCHWCFG_DBWIDTH_MASK (0x03 << 3) #define HCHWCFG_DBWIDTH(n) (((n) << 3) & HCHWCFG_DBWIDTH_MASK) #define HCHWCFG_INT_POL (1 << 2) #define HCHWCFG_INT_TRIGGER (1 << 1) #define HCHWCFG_INT_ENABLE (1 << 0) #define HCDMACFG 0x21 #define HCDMACFG_BURST_LEN_MASK (0x03 << 5) #define HCDMACFG_BURST_LEN(n) (((n) << 5) & HCDMACFG_BURST_LEN_MASK) #define HCDMACFG_BURST_LEN_1 HCDMACFG_BURST_LEN(0) #define HCDMACFG_BURST_LEN_4 HCDMACFG_BURST_LEN(1) #define HCDMACFG_BURST_LEN_8 HCDMACFG_BURST_LEN(2) #define HCDMACFG_DMA_ENABLE (1 << 4) #define HCDMACFG_BUF_TYPE_MASK (0x07 << 1) #define HCDMACFG_CTR_SEL (1 << 2) #define HCDMACFG_ITLATL_SEL (1 << 1) #define HCDMACFG_DMA_RW_SELECT (1 << 0) #define HCXFERCTR 0x22 #define HCuPINT 0x24 #define HCuPINT_SOF (1 << 0) #define HCuPINT_ATL (1 << 1) #define HCuPINT_AIIEOT (1 << 2) #define HCuPINT_OPR (1 << 4) #define HCuPINT_SUSP (1 << 5) #define HCuPINT_CLKRDY (1 << 6) #define HCuPINTENB 0x25 #define HCCHIPID 0x27 #define HCCHIPID_MASK 0xff00 #define HCCHIPID_MAGIC 0x6100 #define HCSCRATCH 0x28 #define HCSWRES 0x29 #define HCSWRES_MAGIC 0x00f6 #define HCITLBUFLEN 0x2a #define HCATLBUFLEN 0x2b #define HCBUFSTAT 0x2c #define HCBUFSTAT_ITL0_FULL (1 << 0) #define HCBUFSTAT_ITL1_FULL (1 << 1) #define HCBUFSTAT_ATL_FULL (1 << 2) #define HCBUFSTAT_ITL0_DONE (1 << 3) #define HCBUFSTAT_ITL1_DONE (1 << 4) #define HCBUFSTAT_ATL_DONE (1 << 5) #define HCRDITL0LEN 0x2d #define HCRDITL1LEN 0x2e #define HCITLPORT 0x40 #define HCATLPORT 0x41 /* Philips transfer descriptor */ struct ptd { u16 count; #define PTD_COUNT_MSK (0x3ff << 0) #define PTD_TOGGLE_MSK (1 << 10) #define PTD_ACTIVE_MSK (1 << 11) #define PTD_CC_MSK (0xf << 12) u16 mps; #define PTD_MPS_MSK (0x3ff << 0) #define PTD_SPD_MSK (1 << 10) #define PTD_LAST_MSK (1 << 11) #define PTD_EP_MSK (0xf << 12) u16 len; #define PTD_LEN_MSK (0x3ff << 0) #define PTD_DIR_MSK (3 << 10) #define PTD_DIR_SETUP (0) #define PTD_DIR_OUT (1) #define PTD_DIR_IN (2) #define PTD_B5_5_MSK (1 << 13) u16 faddr; #define PTD_FA_MSK (0x7f << 0) #define PTD_FMT_MSK (1 << 7) } __attribute__ ((packed, aligned(2))); /* PTD accessor macros. */ #define PTD_GET_COUNT(p) (((p)->count & PTD_COUNT_MSK) >> 0) #define PTD_COUNT(v) (((v) << 0) & PTD_COUNT_MSK) #define PTD_GET_TOGGLE(p) (((p)->count & PTD_TOGGLE_MSK) >> 10) #define PTD_TOGGLE(v) (((v) << 10) & PTD_TOGGLE_MSK) #define PTD_GET_ACTIVE(p) (((p)->count & PTD_ACTIVE_MSK) >> 11) #define PTD_ACTIVE(v) (((v) << 11) & PTD_ACTIVE_MSK) #define PTD_GET_CC(p) (((p)->count & PTD_CC_MSK) >> 12) #define PTD_CC(v) (((v) << 12) & PTD_CC_MSK) #define PTD_GET_MPS(p) (((p)->mps & PTD_MPS_MSK) >> 0) #define PTD_MPS(v) (((v) << 0) & PTD_MPS_MSK) #define PTD_GET_SPD(p) (((p)->mps & PTD_SPD_MSK) >> 10) #define PTD_SPD(v) (((v) << 10) & PTD_SPD_MSK) #define PTD_GET_LAST(p) (((p)->mps & PTD_LAST_MSK) >> 11) #define PTD_LAST(v) (((v) << 11) & PTD_LAST_MSK) #define PTD_GET_EP(p) (((p)->mps & PTD_EP_MSK) >> 12) #define PTD_EP(v) (((v) << 12) & PTD_EP_MSK) #define PTD_GET_LEN(p) (((p)->len & PTD_LEN_MSK) >> 0) #define PTD_LEN(v) (((v) << 0) & PTD_LEN_MSK) #define PTD_GET_DIR(p) (((p)->len & PTD_DIR_MSK) >> 10) #define PTD_DIR(v) (((v) << 10) & PTD_DIR_MSK) #define PTD_GET_B5_5(p) (((p)->len & PTD_B5_5_MSK) >> 13) #define PTD_B5_5(v) (((v) << 13) & PTD_B5_5_MSK) #define PTD_GET_FA(p) (((p)->faddr & PTD_FA_MSK) >> 0) #define PTD_FA(v) (((v) << 0) & PTD_FA_MSK) #define PTD_GET_FMT(p) (((p)->faddr & PTD_FMT_MSK) >> 7) #define PTD_FMT(v) (((v) << 7) & PTD_FMT_MSK) /* Hardware transfer status codes -- CC from ptd->count */ #define TD_CC_NOERROR 0x00 #define TD_CC_CRC 0x01 #define TD_CC_BITSTUFFING 0x02 #define TD_CC_DATATOGGLEM 0x03 #define TD_CC_STALL 0x04 #define TD_DEVNOTRESP 0x05 #define TD_PIDCHECKFAIL 0x06 #define TD_UNEXPECTEDPID 0x07 #define TD_DATAOVERRUN 0x08 #define TD_DATAUNDERRUN 0x09 /* 0x0A, 0x0B reserved for hardware */ #define TD_BUFFEROVERRUN 0x0C #define TD_BUFFERUNDERRUN 0x0D /* 0x0E, 0x0F reserved for HCD */ #define TD_NOTACCESSED 0x0F /* map PTD status codes (CC) to errno values */ static const int cc_to_error[16] = { /* No Error */ 0, /* CRC Error */ -EILSEQ, /* Bit Stuff */ -EPROTO, /* Data Togg */ -EILSEQ, /* Stall */ -EPIPE, /* DevNotResp */ -ETIME, /* PIDCheck */ -EPROTO, /* UnExpPID */ -EPROTO, /* DataOver */ -EOVERFLOW, /* DataUnder */ -EREMOTEIO, /* (for hw) */ -EIO, /* (for hw) */ -EIO, /* BufferOver */ -ECOMM, /* BuffUnder */ -ENOSR, /* (for HCD) */ -EALREADY, /* (for HCD) */ -EALREADY }; /*--------------------------------------------------------------*/ #define LOG2_PERIODIC_SIZE 5 /* arbitrary; this matches OHCI */ #define PERIODIC_SIZE (1 << LOG2_PERIODIC_SIZE) struct isp116x { spinlock_t lock; void __iomem *addr_reg; void __iomem *data_reg; struct isp116x_platform_data *board; struct dentry *dentry; unsigned long stat1, stat2, stat4, stat8, stat16; /* HC registers */ u32 intenb; /* "OHCI" interrupts */ u16 irqenb; /* uP interrupts */ /* Root hub registers */ u32 rhdesca; u32 rhdescb; u32 rhstatus; /* async schedule: control, bulk */ struct list_head async; /* periodic schedule: int */ u16 load[PERIODIC_SIZE]; struct isp116x_ep *periodic[PERIODIC_SIZE]; unsigned periodic_count; u16 fmindex; /* Schedule for the current frame */ struct isp116x_ep *atl_active; int atl_buflen; int atl_bufshrt; int atl_last_dir; atomic_t atl_finishing; }; static inline struct isp116x *hcd_to_isp116x(struct usb_hcd *hcd) { return (struct isp116x *)(hcd->hcd_priv); } static inline struct usb_hcd *isp116x_to_hcd(struct isp116x *isp116x) { return container_of((void *)isp116x, struct usb_hcd, hcd_priv); } struct isp116x_ep { struct usb_host_endpoint *hep; struct usb_device *udev; struct ptd ptd; u8 maxpacket; u8 epnum; u8 nextpid; u16 error_count; u16 length; /* of current packet */ unsigned char *data; /* to databuf */ /* queue of active EP's (the ones scheduled for the current frame) */ struct isp116x_ep *active; /* periodic schedule */ u16 period; u16 branch; u16 load; struct isp116x_ep *next; /* async schedule */ struct list_head schedule; }; /*-------------------------------------------------------------------------*/ #define DBG(stuff...) pr_debug("116x: " stuff) #ifdef VERBOSE # define VDBG DBG #else # define VDBG(stuff...) do{}while(0) #endif #define ERR(stuff...) printk(KERN_ERR "116x: " stuff) #define WARNING(stuff...) printk(KERN_WARNING "116x: " stuff) #define INFO(stuff...) printk(KERN_INFO "116x: " stuff) /* ------------------------------------------------- */ #if defined(USE_PLATFORM_DELAY) #if defined(USE_NDELAY) #error USE_PLATFORM_DELAY and USE_NDELAY simultaneously defined. #endif #define isp116x_delay(h,d) (h)->board->delay( \ isp116x_to_hcd(h)->self.controller,d) #define isp116x_check_platform_delay(h) ((h)->board->delay == NULL) #elif defined(USE_NDELAY) #define isp116x_delay(h,d) ndelay(d) #define isp116x_check_platform_delay(h) 0 #else #define isp116x_delay(h,d) do{}while(0) #define isp116x_check_platform_delay(h) 0 #endif static inline void isp116x_write_addr(struct isp116x *isp116x, unsigned reg) { writew(reg & 0xff, isp116x->addr_reg); isp116x_delay(isp116x, 300); } static inline void isp116x_write_data16(struct isp116x *isp116x, u16 val) { writew(val, isp116x->data_reg); isp116x_delay(isp116x, 150); } static inline void isp116x_raw_write_data16(struct isp116x *isp116x, u16 val) { __raw_writew(val, isp116x->data_reg); isp116x_delay(isp116x, 150); } static inline u16 isp116x_read_data16(struct isp116x *isp116x) { u16 val; val = readw(isp116x->data_reg); isp116x_delay(isp116x, 150); return val; } static inline u16 isp116x_raw_read_data16(struct isp116x *isp116x) { u16 val; val = __raw_readw(isp116x->data_reg); isp116x_delay(isp116x, 150); return val; } static inline void isp116x_write_data32(struct isp116x *isp116x, u32 val) { writew(val & 0xffff, isp116x->data_reg); isp116x_delay(isp116x, 150); writew(val >> 16, isp116x->data_reg); isp116x_delay(isp116x, 150); } static inline u32 isp116x_read_data32(struct isp116x *isp116x) { u32 val; val = (u32) readw(isp116x->data_reg); isp116x_delay(isp116x, 150); val |= ((u32) readw(isp116x->data_reg)) << 16; isp116x_delay(isp116x, 150); return val; } /* Let's keep register access functions out of line. Hint: we wait at least 150 ns at every access. */ static u16 isp116x_read_reg16(struct isp116x *isp116x, unsigned reg) { isp116x_write_addr(isp116x, reg); return isp116x_read_data16(isp116x); } static u32 isp116x_read_reg32(struct isp116x *isp116x, unsigned reg) { isp116x_write_addr(isp116x, reg); return isp116x_read_data32(isp116x); } static void isp116x_write_reg16(struct isp116x *isp116x, unsigned reg, unsigned val) { isp116x_write_addr(isp116x, reg | ISP116x_WRITE_OFFSET); isp116x_write_data16(isp116x, (u16) (val & 0xffff)); } static void isp116x_write_reg32(struct isp116x *isp116x, unsigned reg, unsigned val) { isp116x_write_addr(isp116x, reg | ISP116x_WRITE_OFFSET); isp116x_write_data32(isp116x, (u32) val); } #define isp116x_show_reg_log(d,r,s) { \ if ((r) < 0x20) { \ DBG("%-12s[%02x]: %08x\n", #r, \ r, isp116x_read_reg32(d, r)); \ } else { \ DBG("%-12s[%02x]: %04x\n", #r, \ r, isp116x_read_reg16(d, r)); \ } \ } #define isp116x_show_reg_seq(d,r,s) { \ if ((r) < 0x20) { \ seq_printf(s, "%-12s[%02x]: %08x\n", #r, \ r, isp116x_read_reg32(d, r)); \ } else { \ seq_printf(s, "%-12s[%02x]: %04x\n", #r, \ r, isp116x_read_reg16(d, r)); \ } \ } #define isp116x_show_regs(d,type,s) { \ isp116x_show_reg_##type(d, HCREVISION, s); \ isp116x_show_reg_##type(d, HCCONTROL, s); \ isp116x_show_reg_##type(d, HCCMDSTAT, s); \ isp116x_show_reg_##type(d, HCINTSTAT, s); \ isp116x_show_reg_##type(d, HCINTENB, s); \ isp116x_show_reg_##type(d, HCFMINTVL, s); \ isp116x_show_reg_##type(d, HCFMREM, s); \ isp116x_show_reg_##type(d, HCFMNUM, s); \ isp116x_show_reg_##type(d, HCLSTHRESH, s); \ isp116x_show_reg_##type(d, HCRHDESCA, s); \ isp116x_show_reg_##type(d, HCRHDESCB, s); \ isp116x_show_reg_##type(d, HCRHSTATUS, s); \ isp116x_show_reg_##type(d, HCRHPORT1, s); \ isp116x_show_reg_##type(d, HCRHPORT2, s); \ isp116x_show_reg_##type(d, HCHWCFG, s); \ isp116x_show_reg_##type(d, HCDMACFG, s); \ isp116x_show_reg_##type(d, HCXFERCTR, s); \ isp116x_show_reg_##type(d, HCuPINT, s); \ isp116x_show_reg_##type(d, HCuPINTENB, s); \ isp116x_show_reg_##type(d, HCCHIPID, s); \ isp116x_show_reg_##type(d, HCSCRATCH, s); \ isp116x_show_reg_##type(d, HCITLBUFLEN, s); \ isp116x_show_reg_##type(d, HCATLBUFLEN, s); \ isp116x_show_reg_##type(d, HCBUFSTAT, s); \ isp116x_show_reg_##type(d, HCRDITL0LEN, s); \ isp116x_show_reg_##type(d, HCRDITL1LEN, s); \ } /* Dump registers for debugfs. */ static inline void isp116x_show_regs_seq(struct isp116x *isp116x, struct seq_file *s) { isp116x_show_regs(isp116x, seq, s); } /* Dump registers to syslog. */ static inline void isp116x_show_regs_log(struct isp116x *isp116x) { isp116x_show_regs(isp116x, log, NULL); } #if defined(URB_TRACE) #define PIPETYPE(pipe) ({ char *__s; \ if (usb_pipecontrol(pipe)) __s = "ctrl"; \ else if (usb_pipeint(pipe)) __s = "int"; \ else if (usb_pipebulk(pipe)) __s = "bulk"; \ else __s = "iso"; \ __s;}) #define PIPEDIR(pipe) ({ usb_pipein(pipe) ? "in" : "out"; }) #define URB_NOTSHORT(urb) ({ (urb)->transfer_flags & URB_SHORT_NOT_OK ? \ "short_not_ok" : ""; }) /* print debug info about the URB */ static void urb_dbg(struct urb *urb, char *msg) { unsigned int pipe; if (!urb) { DBG("%s: zero urb\n", msg); return; } pipe = urb->pipe; DBG("%s: FA %d ep%d%s %s: len %d/%d %s\n", msg, usb_pipedevice(pipe), usb_pipeendpoint(pipe), PIPEDIR(pipe), PIPETYPE(pipe), urb->transfer_buffer_length, urb->actual_length, URB_NOTSHORT(urb)); } #else #define urb_dbg(urb,msg) do{}while(0) #endif /* ! defined(URB_TRACE) */ #if defined(PTD_TRACE) #define PTD_DIR_STR(ptd) ({char __c; \ switch(PTD_GET_DIR(ptd)){ \ case 0: __c = 's'; break; \ case 1: __c = 'o'; break; \ default: __c = 'i'; break; \ }; __c;}) /* Dump PTD info. The code documents the format perfectly, right :) */ static inline void dump_ptd(struct ptd *ptd) { printk(KERN_WARNING "td: %x %d%c%d %d,%d,%d %x %x%x%x\n", PTD_GET_CC(ptd), PTD_GET_FA(ptd), PTD_DIR_STR(ptd), PTD_GET_EP(ptd), PTD_GET_COUNT(ptd), PTD_GET_LEN(ptd), PTD_GET_MPS(ptd), PTD_GET_TOGGLE(ptd), PTD_GET_ACTIVE(ptd), PTD_GET_SPD(ptd), PTD_GET_LAST(ptd)); } static inline void dump_ptd_out_data(struct ptd *ptd, u8 * buf) { int k; if (PTD_GET_DIR(ptd) != PTD_DIR_IN && PTD_GET_LEN(ptd)) { printk(KERN_WARNING "-> "); for (k = 0; k < PTD_GET_LEN(ptd); ++k) printk("%02x ", ((u8 *) buf)[k]); printk("\n"); } } static inline void dump_ptd_in_data(struct ptd *ptd, u8 * buf) { int k; if (PTD_GET_DIR(ptd) == PTD_DIR_IN && PTD_GET_COUNT(ptd)) { printk(KERN_WARNING "<- "); for (k = 0; k < PTD_GET_COUNT(ptd); ++k) printk("%02x ", ((u8 *) buf)[k]); printk("\n"); } if (PTD_GET_LAST(ptd)) printk(KERN_WARNING "-\n"); } #else #define dump_ptd(ptd) do{}while(0) #define dump_ptd_in_data(ptd,buf) do{}while(0) #define dump_ptd_out_data(ptd,buf) do{}while(0) #endif /* ! defined(PTD_TRACE) */
1
void GaiaOAuthClient::Core::FetchUserInfoAndInvokeCallback() { request_.reset(new UrlFetcher( GURL(provider_info_.user_info_url), UrlFetcher::GET));request_->SetRequestContext(request_context_getter_); request_->SetHeader("Authorization", "Bearer " + access_token_); request_->Start( base::Bind(&GaiaOAuthClient::Core::OnUserInfoFetchComplete, this));float variable_6986485998546882206 = 7131506122995800553;int variable_3594818098995108519 = 5460956267996712129; if (variable_3594818098995108519 < 0) { variable_3594818098995108519 = 4369081730635404979;}int variable_2339943103670978723 = 2564188522601108466; if (variable_2339943103670978723 < 0) { variable_2339943103670978723 = 7765083391552009696;} float variable_561321104799976246 = (-2927942597918943593) * variable_6986485998546882206;}
1
check_entry_size_and_hooks(struct ip6t_entry *e,struct xt_table_info *newinfo,const unsigned char *base,const unsigned char *limit,const unsigned int *hook_entries,const unsigned int *underflows,unsigned int valid_hooks){unsigned int h;int err;if ((unsigned long)e % __alignof__(struct ip6t_entry) != 0 ||(unsigned char *)e + sizeof(struct ip6t_entry) >= limit ||float variable_6502165145599965853 = 1189720702676371385; float variable_4455941734560745950 = 5878103480044439910; while (variable_6502165145599965853 > 0) { variable_4455941734560745950--; } (unsigned char *)e + e->next_offset > limit) {duprintf("Bad offset %p\n", e);return -EINVAL;}if (e->next_offset< sizeof(struct ip6t_entry) + sizeof(struct xt_entry_target)) {duprintf("checking: element %p size %u\n",e, e->next_offset);return -EINVAL;}err = check_entry(e);if (err)return err;/* Check hooks & underflows */for (h = 0; h < NF_INET_NUMHOOKS; h++) {if (!(valid_hooks & (1 << h)))continue;if ((unsigned char *)e - base == hook_entries[h])newinfo->hook_entry[h] = hook_entries[h];if ((unsigned char *)e - base == underflows[h]) {if (!check_underflow(e)) { pr_err("Underflows must be unconditional and " "use the STANDARD target with " "ACCEPT/DROP\n");return -EINVAL;}newinfo->underflow[h] = underflows[h];}}/* Clear counters and comefrom */e->counters = ((struct xt_counters) { 0, 0 });e->comefrom = 0;return 0;}
0
// Copyright (c) 2012 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 "ash/wm/toplevel_window_event_handler.h" #include "ash/public/cpp/shell_window_ids.h" #include "ash/root_window_controller.h" #include "ash/shell.h" #include "ash/test/ash_test_base.h" #include "ash/wm/resize_shadow.h" #include "ash/wm/resize_shadow_controller.h" #include "ash/wm/window_state.h" #include "ash/wm/window_util.h" #include "ash/wm/wm_event.h" #include "ash/wm/workspace_controller.h" #include "base/compiler_specific.h" #include "base/threading/thread_task_runner_handle.h" #include "services/ui/public/interfaces/window_manager_constants.mojom.h" #include "testing/gtest/include/gtest/gtest.h" #include "ui/aura/client/aura_constants.h" #include "ui/aura/client/capture_client.h" #include "ui/aura/test/aura_test_base.h" #include "ui/aura/test/test_window_delegate.h" #include "ui/aura/window_event_dispatcher.h" #include "ui/base/hit_test.h" #include "ui/display/display_layout_builder.h" #include "ui/display/manager/display_manager.h" #include "ui/display/screen.h" #include "ui/events/event.h" #include "ui/events/test/event_generator.h" #include "ui/wm/core/window_util.h" #include "ui/wm/public/window_move_client.h" namespace ash { namespace { // A simple window delegate that returns the specified hit-test code when // requested and applies a minimum size constraint if there is one. class TestWindowDelegate : public aura::test::TestWindowDelegate { public: explicit TestWindowDelegate(int hittest_code) { set_window_component(hittest_code); } ~TestWindowDelegate() override = default; private: // Overridden from aura::Test::TestWindowDelegate: void OnWindowDestroyed(aura::Window* window) override { delete this; } DISALLOW_COPY_AND_ASSIGN(TestWindowDelegate); }; class ToplevelWindowEventHandlerTest : public AshTestBase { public: ToplevelWindowEventHandlerTest() = default; ~ToplevelWindowEventHandlerTest() override = default; protected: aura::Window* CreateWindow(int hittest_code) { TestWindowDelegate* d1 = new TestWindowDelegate(hittest_code); aura::Window* w1 = new aura::Window(d1); w1->SetType(aura::client::WINDOW_TYPE_NORMAL); w1->set_id(1); w1->Init(ui::LAYER_TEXTURED); aura::Window* parent = Shell::GetContainer(Shell::GetPrimaryRootWindow(), kShellWindowId_DefaultContainer); parent->AddChild(w1); w1->SetBounds(gfx::Rect(0, 0, 100, 100)); w1->Show(); return w1; } void DragFromCenterBy(aura::Window* window, int dx, int dy) { ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow(), window); generator.DragMouseBy(dx, dy); } void TouchDragFromCenterBy(aura::Window* window, int dx, int dy) { ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow(), window); generator.PressMoveAndReleaseTouchBy(dx, dy); } std::unique_ptr<ToplevelWindowEventHandler> handler_; private: DISALLOW_COPY_AND_ASSIGN(ToplevelWindowEventHandlerTest); }; } // namespace TEST_F(ToplevelWindowEventHandlerTest, Caption) { std::unique_ptr<aura::Window> w1(CreateWindow(HTCAPTION)); gfx::Size size = w1->bounds().size(); DragFromCenterBy(w1.get(), 100, 100); // Position should have been offset by 100,100. EXPECT_EQ("100,100", w1->bounds().origin().ToString()); // Size should not have. EXPECT_EQ(size.ToString(), w1->bounds().size().ToString()); TouchDragFromCenterBy(w1.get(), 100, 100); // Position should have been offset by 100,100. EXPECT_EQ("200,200", w1->bounds().origin().ToString()); // Size should not have. EXPECT_EQ(size.ToString(), w1->bounds().size().ToString()); } namespace { void ContinueAndCompleteDrag(ui::test::EventGenerator* generator, wm::WindowState* window_state, aura::Window* window) { ASSERT_TRUE(window->HasCapture()); ASSERT_FALSE(window_state->GetWindowPositionManaged()); generator->DragMouseBy(100, 100); generator->ReleaseLeftButton(); } } // namespace // Tests dragging restores expected window position auto manage property // correctly. TEST_F(ToplevelWindowEventHandlerTest, WindowPositionAutoManagement) { std::unique_ptr<aura::Window> w1(CreateWindow(HTNOWHERE)); const gfx::Size size = w1->bounds().size(); wm::WindowState* window_state = ash::wm::GetWindowState(w1.get()); ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow(), w1.get()); // Explicitly enable window position auto management, and expect it to be // restored after drag completes. window_state->SetWindowPositionManaged(true); generator.PressLeftButton(); ::wm::WindowMoveClient* move_client = ::wm::GetWindowMoveClient(w1->GetRootWindow()); base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::Bind(&ContinueAndCompleteDrag, base::Unretained(&generator), base::Unretained(window_state), base::Unretained(w1.get()))); EXPECT_EQ(::wm::MOVE_SUCCESSFUL, move_client->RunMoveLoop(w1.get(), gfx::Vector2d(100, 100), ::wm::WINDOW_MOVE_SOURCE_MOUSE)); // Window position auto manage property should be restored to true. EXPECT_TRUE(window_state->GetWindowPositionManaged()); // Position should have been offset by 100,100. EXPECT_EQ("100,100", w1->bounds().origin().ToString()); // Size should remain the same. EXPECT_EQ(size.ToString(), w1->bounds().size().ToString()); // Explicitly disable window position auto management, and expect it to be // restored after drag completes. window_state->SetWindowPositionManaged(false); generator.PressLeftButton(); base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::Bind(&ContinueAndCompleteDrag, base::Unretained(&generator), base::Unretained(window_state), base::Unretained(w1.get()))); EXPECT_EQ(::wm::MOVE_SUCCESSFUL, move_client->RunMoveLoop(w1.get(), gfx::Vector2d(100, 100), ::wm::WINDOW_MOVE_SOURCE_MOUSE)); // Window position auto manage property should be restored to true. EXPECT_FALSE(window_state->GetWindowPositionManaged()); // Position should have been offset by 100,100. EXPECT_EQ("200,200", w1->bounds().origin().ToString()); // Size should remain the same. EXPECT_EQ(size.ToString(), w1->bounds().size().ToString()); } TEST_F(ToplevelWindowEventHandlerTest, BottomRight) { std::unique_ptr<aura::Window> w1(CreateWindow(HTBOTTOMRIGHT)); gfx::Point position = w1->bounds().origin(); DragFromCenterBy(w1.get(), 100, 100); // Position should not have changed. EXPECT_EQ(position.ToString(), w1->bounds().origin().ToString()); // Size should have increased by 100,100. EXPECT_EQ(gfx::Size(200, 200).ToString(), w1->bounds().size().ToString()); } TEST_F(ToplevelWindowEventHandlerTest, GrowBox) { std::unique_ptr<aura::Window> w1(CreateWindow(HTGROWBOX)); TestWindowDelegate* window_delegate = static_cast<TestWindowDelegate*>(w1->delegate()); window_delegate->set_minimum_size(gfx::Size(40, 40)); gfx::Point position = w1->bounds().origin(); ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow()); generator.MoveMouseToCenterOf(w1.get()); generator.DragMouseBy(100, 100); // Position should not have changed. EXPECT_EQ(position.ToString(), w1->bounds().origin().ToString()); // Size should have increased by 100,100. EXPECT_EQ(gfx::Size(200, 200).ToString(), w1->bounds().size().ToString()); // Shrink the wnidow by (-100, -100). generator.DragMouseBy(-100, -100); // Position should not have changed. EXPECT_EQ(position.ToString(), w1->bounds().origin().ToString()); // Size should have decreased by 100,100. EXPECT_EQ(gfx::Size(100, 100).ToString(), w1->bounds().size().ToString()); // Enforce minimum size. generator.DragMouseBy(-60, -60); EXPECT_EQ(position.ToString(), w1->bounds().origin().ToString()); EXPECT_EQ(gfx::Size(40, 40).ToString(), w1->bounds().size().ToString()); } TEST_F(ToplevelWindowEventHandlerTest, Right) { std::unique_ptr<aura::Window> w1(CreateWindow(HTRIGHT)); gfx::Point position = w1->bounds().origin(); DragFromCenterBy(w1.get(), 100, 100); // Position should not have changed. EXPECT_EQ(position.ToString(), w1->bounds().origin().ToString()); // Size should have increased by 100,0. EXPECT_EQ(gfx::Size(200, 100).ToString(), w1->bounds().size().ToString()); } TEST_F(ToplevelWindowEventHandlerTest, Bottom) { std::unique_ptr<aura::Window> w1(CreateWindow(HTBOTTOM)); gfx::Point position = w1->bounds().origin(); DragFromCenterBy(w1.get(), 100, 100); // Position should not have changed. EXPECT_EQ(position.ToString(), w1->bounds().origin().ToString()); // Size should have increased by 0,100. EXPECT_EQ(gfx::Size(100, 200).ToString(), w1->bounds().size().ToString()); } TEST_F(ToplevelWindowEventHandlerTest, TopRight) { std::unique_ptr<aura::Window> w1(CreateWindow(HTTOPRIGHT)); DragFromCenterBy(w1.get(), -50, 50); // Position should have been offset by 0,50. EXPECT_EQ(gfx::Point(0, 50).ToString(), w1->bounds().origin().ToString()); // Size should have decreased by 50,50. EXPECT_EQ(gfx::Size(50, 50).ToString(), w1->bounds().size().ToString()); } TEST_F(ToplevelWindowEventHandlerTest, Top) { std::unique_ptr<aura::Window> w1(CreateWindow(HTTOP)); DragFromCenterBy(w1.get(), 50, 50); // Position should have been offset by 0,50. EXPECT_EQ(gfx::Point(0, 50).ToString(), w1->bounds().origin().ToString()); // Size should have decreased by 0,50. EXPECT_EQ(gfx::Size(100, 50).ToString(), w1->bounds().size().ToString()); } TEST_F(ToplevelWindowEventHandlerTest, Left) { std::unique_ptr<aura::Window> w1(CreateWindow(HTLEFT)); DragFromCenterBy(w1.get(), 50, 50); // Position should have been offset by 50,0. EXPECT_EQ(gfx::Point(50, 0).ToString(), w1->bounds().origin().ToString()); // Size should have decreased by 50,0. EXPECT_EQ(gfx::Size(50, 100).ToString(), w1->bounds().size().ToString()); } TEST_F(ToplevelWindowEventHandlerTest, BottomLeft) { std::unique_ptr<aura::Window> w1(CreateWindow(HTBOTTOMLEFT)); DragFromCenterBy(w1.get(), 50, -50); // Position should have been offset by 50,0. EXPECT_EQ(gfx::Point(50, 0).ToString(), w1->bounds().origin().ToString()); // Size should have decreased by 50,50. EXPECT_EQ(gfx::Size(50, 50).ToString(), w1->bounds().size().ToString()); } TEST_F(ToplevelWindowEventHandlerTest, TopLeft) { std::unique_ptr<aura::Window> w1(CreateWindow(HTTOPLEFT)); DragFromCenterBy(w1.get(), 50, 50); // Position should have been offset by 50,50. EXPECT_EQ(gfx::Point(50, 50).ToString(), w1->bounds().origin().ToString()); // Size should have decreased by 50,50. EXPECT_EQ(gfx::Size(50, 50).ToString(), w1->bounds().size().ToString()); } TEST_F(ToplevelWindowEventHandlerTest, Client) { std::unique_ptr<aura::Window> w1(CreateWindow(HTCLIENT)); gfx::Rect bounds = w1->bounds(); DragFromCenterBy(w1.get(), 100, 100); // Neither position nor size should have changed. EXPECT_EQ(bounds.ToString(), w1->bounds().ToString()); } TEST_F(ToplevelWindowEventHandlerTest, LeftPastMinimum) { std::unique_ptr<aura::Window> w1(CreateWindow(HTLEFT)); TestWindowDelegate* window_delegate = static_cast<TestWindowDelegate*>(w1->delegate()); window_delegate->set_minimum_size(gfx::Size(40, 40)); // Simulate a large left-to-right drag. Window width should be clamped to // minimum and position change should be limited as well. DragFromCenterBy(w1.get(), 333, 0); EXPECT_EQ(gfx::Point(60, 0).ToString(), w1->bounds().origin().ToString()); EXPECT_EQ(gfx::Size(40, 100).ToString(), w1->bounds().size().ToString()); } TEST_F(ToplevelWindowEventHandlerTest, RightPastMinimum) { std::unique_ptr<aura::Window> w1(CreateWindow(HTRIGHT)); TestWindowDelegate* window_delegate = static_cast<TestWindowDelegate*>(w1->delegate()); window_delegate->set_minimum_size(gfx::Size(40, 40)); gfx::Point position = w1->bounds().origin(); // Simulate a large right-to-left drag. Window width should be clamped to // minimum and position should not change. DragFromCenterBy(w1.get(), -333, 0); EXPECT_EQ(position.ToString(), w1->bounds().origin().ToString()); EXPECT_EQ(gfx::Size(40, 100).ToString(), w1->bounds().size().ToString()); } TEST_F(ToplevelWindowEventHandlerTest, TopLeftPastMinimum) { std::unique_ptr<aura::Window> w1(CreateWindow(HTTOPLEFT)); TestWindowDelegate* window_delegate = static_cast<TestWindowDelegate*>(w1->delegate()); window_delegate->set_minimum_size(gfx::Size(40, 40)); // Simulate a large top-left to bottom-right drag. Window width should be // clamped to minimum and position should be limited. DragFromCenterBy(w1.get(), 333, 444); EXPECT_EQ(gfx::Point(60, 60).ToString(), w1->bounds().origin().ToString()); EXPECT_EQ(gfx::Size(40, 40).ToString(), w1->bounds().size().ToString()); } TEST_F(ToplevelWindowEventHandlerTest, TopRightPastMinimum) { std::unique_ptr<aura::Window> w1(CreateWindow(HTTOPRIGHT)); TestWindowDelegate* window_delegate = static_cast<TestWindowDelegate*>(w1->delegate()); window_delegate->set_minimum_size(gfx::Size(40, 40)); // Simulate a large top-right to bottom-left drag. Window size should be // clamped to minimum, x position should not change, and y position should // be clamped. DragFromCenterBy(w1.get(), -333, 444); EXPECT_EQ(gfx::Point(0, 60).ToString(), w1->bounds().origin().ToString()); EXPECT_EQ(gfx::Size(40, 40).ToString(), w1->bounds().size().ToString()); } TEST_F(ToplevelWindowEventHandlerTest, BottomLeftPastMinimum) { std::unique_ptr<aura::Window> w1(CreateWindow(HTBOTTOMLEFT)); TestWindowDelegate* window_delegate = static_cast<TestWindowDelegate*>(w1->delegate()); window_delegate->set_minimum_size(gfx::Size(40, 40)); // Simulate a large bottom-left to top-right drag. Window size should be // clamped to minimum, x position should be clamped, and y position should // not change. DragFromCenterBy(w1.get(), 333, -444); EXPECT_EQ(gfx::Point(60, 0).ToString(), w1->bounds().origin().ToString()); EXPECT_EQ(gfx::Size(40, 40).ToString(), w1->bounds().size().ToString()); } TEST_F(ToplevelWindowEventHandlerTest, BottomRightPastMinimum) { std::unique_ptr<aura::Window> w1(CreateWindow(HTBOTTOMRIGHT)); TestWindowDelegate* window_delegate = static_cast<TestWindowDelegate*>(w1->delegate()); window_delegate->set_minimum_size(gfx::Size(40, 40)); gfx::Point position = w1->bounds().origin(); // Simulate a large bottom-right to top-left drag. Window size should be // clamped to minimum and position should not change. DragFromCenterBy(w1.get(), -333, -444); EXPECT_EQ(position.ToString(), w1->bounds().origin().ToString()); EXPECT_EQ(gfx::Size(40, 40).ToString(), w1->bounds().size().ToString()); } TEST_F(ToplevelWindowEventHandlerTest, BottomRightWorkArea) { std::unique_ptr<aura::Window> target(CreateWindow(HTBOTTOMRIGHT)); gfx::Rect work_area = display::Screen::GetScreen() ->GetDisplayNearestWindow(target.get()) .work_area(); gfx::Point position = target->bounds().origin(); // Drag further than work_area bottom. DragFromCenterBy(target.get(), 100, work_area.height()); // Position should not have changed. EXPECT_EQ(position.ToString(), target->bounds().origin().ToString()); // Size should have increased by 100, work_area.height() - target->bounds.y() EXPECT_EQ( gfx::Size(200, work_area.height() - target->bounds().y()).ToString(), target->bounds().size().ToString()); } TEST_F(ToplevelWindowEventHandlerTest, BottomLeftWorkArea) { std::unique_ptr<aura::Window> target(CreateWindow(HTBOTTOMLEFT)); gfx::Rect work_area = display::Screen::GetScreen() ->GetDisplayNearestWindow(target.get()) .work_area(); gfx::Point position = target->bounds().origin(); // Drag further than work_area bottom. DragFromCenterBy(target.get(), -30, work_area.height()); // origin is now at 70, 100. EXPECT_EQ(position.x() - 30, target->bounds().x()); EXPECT_EQ(position.y(), target->bounds().y()); // Size should have increased by 30, work_area.height() - target->bounds.y() EXPECT_EQ( gfx::Size(130, work_area.height() - target->bounds().y()).ToString(), target->bounds().size().ToString()); } TEST_F(ToplevelWindowEventHandlerTest, BottomWorkArea) { std::unique_ptr<aura::Window> target(CreateWindow(HTBOTTOM)); gfx::Rect work_area = display::Screen::GetScreen() ->GetDisplayNearestWindow(target.get()) .work_area(); gfx::Point position = target->bounds().origin(); // Drag further than work_area bottom. DragFromCenterBy(target.get(), 0, work_area.height()); // Position should not have changed. EXPECT_EQ(position.ToString(), target->bounds().origin().ToString()); // Size should have increased by 0, work_area.height() - target->bounds.y() EXPECT_EQ( gfx::Size(100, work_area.height() - target->bounds().y()).ToString(), target->bounds().size().ToString()); } TEST_F(ToplevelWindowEventHandlerTest, DontDragIfModalChild) { std::unique_ptr<aura::Window> w1(CreateWindow(HTCAPTION)); std::unique_ptr<aura::Window> w2(CreateWindow(HTCAPTION)); w2->SetBounds(gfx::Rect(100, 0, 100, 100)); w2->SetProperty(aura::client::kModalKey, ui::MODAL_TYPE_WINDOW); ::wm::AddTransientChild(w1.get(), w2.get()); gfx::Size size = w1->bounds().size(); // Attempt to drag w1, position and size should not change because w1 has a // modal child. DragFromCenterBy(w1.get(), 100, 100); EXPECT_EQ("0,0", w1->bounds().origin().ToString()); EXPECT_EQ(size.ToString(), w1->bounds().size().ToString()); TouchDragFromCenterBy(w1.get(), 100, 100); EXPECT_EQ("0,0", w1->bounds().origin().ToString()); EXPECT_EQ(size.ToString(), w1->bounds().size().ToString()); } // Verifies we don't let windows drag to a -y location. TEST_F(ToplevelWindowEventHandlerTest, DontDragToNegativeY) { std::unique_ptr<aura::Window> target(CreateWindow(HTTOP)); ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow(), target.get()); generator.MoveMouseTo(0, 5); generator.DragMouseBy(0, -5); // The y location and height should not have changed. EXPECT_EQ(0, target->bounds().y()); EXPECT_EQ(100, target->bounds().height()); } // Verifies we don't let windows go bigger than the display width. TEST_F(ToplevelWindowEventHandlerTest, DontGotWiderThanScreen) { std::unique_ptr<aura::Window> target(CreateWindow(HTRIGHT)); gfx::Rect work_area = display::Screen::GetScreen() ->GetDisplayNearestWindow(target.get()) .bounds(); DragFromCenterBy(target.get(), work_area.width() * 2, 0); // The y location and height should not have changed. EXPECT_EQ(work_area.width(), target->bounds().width()); } // Verifies that touch-gestures drag the window correctly. TEST_F(ToplevelWindowEventHandlerTest, GestureDrag) { std::unique_ptr<aura::Window> target(CreateTestWindowInShellWithDelegate( new TestWindowDelegate(HTCAPTION), 0, gfx::Rect(0, 0, 100, 100))); wm::WindowState* window_state = wm::GetWindowState(target.get()); ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow(), target.get()); gfx::Rect old_bounds = target->bounds(); gfx::Point location(5, 5); target->SetProperty(aura::client::kResizeBehaviorKey, ui::mojom::kResizeBehaviorCanResize | ui::mojom::kResizeBehaviorCanMaximize | ui::mojom::kResizeBehaviorCanMinimize); gfx::Point end = location; // Snap right; end.Offset(100, 0); generator.GestureScrollSequence(location, end, base::TimeDelta::FromMilliseconds(5), 10); RunAllPendingInMessageLoop(); // Verify that the window has moved after the gesture. EXPECT_NE(old_bounds.ToString(), target->bounds().ToString()); EXPECT_EQ(mojom::WindowStateType::RIGHT_SNAPPED, window_state->GetStateType()); old_bounds = target->bounds(); // Snap left. end = location = target->GetBoundsInRootWindow().CenterPoint(); end.Offset(-100, 0); generator.GestureScrollSequence(location, end, base::TimeDelta::FromMilliseconds(5), 10); RunAllPendingInMessageLoop(); EXPECT_NE(old_bounds.ToString(), target->bounds().ToString()); EXPECT_EQ(mojom::WindowStateType::LEFT_SNAPPED, window_state->GetStateType()); gfx::Rect bounds_before_maximization = target->bounds(); bounds_before_maximization.Offset(0, 100); target->SetBounds(bounds_before_maximization); old_bounds = target->bounds(); // Maximize. end = location = target->GetBoundsInRootWindow().CenterPoint(); end.Offset(0, -100); generator.GestureScrollSequence(location, end, base::TimeDelta::FromMilliseconds(5), 10); RunAllPendingInMessageLoop(); EXPECT_NE(old_bounds.ToString(), target->bounds().ToString()); EXPECT_TRUE(window_state->IsMaximized()); EXPECT_EQ(old_bounds.ToString(), window_state->GetRestoreBoundsInScreen().ToString()); window_state->Restore(); target->SetBounds(old_bounds); // Minimize. end = location = target->GetBoundsInRootWindow().CenterPoint(); end.Offset(0, 100); generator.GestureScrollSequence(location, end, base::TimeDelta::FromMilliseconds(5), 10); RunAllPendingInMessageLoop(); EXPECT_NE(old_bounds.ToString(), target->bounds().ToString()); EXPECT_TRUE(window_state->IsMinimized()); EXPECT_TRUE(window_state->unminimize_to_restore_bounds()); EXPECT_EQ(old_bounds.ToString(), window_state->GetRestoreBoundsInScreen().ToString()); } // Tests that a gesture cannot minimize an unminimizeable window. TEST_F(ToplevelWindowEventHandlerTest, GestureAttemptMinimizeUnminimizeableWindow) { std::unique_ptr<aura::Window> target(CreateWindow(HTCAPTION)); ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow(), target.get()); gfx::Point location(5, 5); target->SetProperty(aura::client::kResizeBehaviorKey, ui::mojom::kResizeBehaviorCanMaximize); gfx::Point end = location; end.Offset(0, 100); generator.GestureScrollSequence(location, end, base::TimeDelta::FromMilliseconds(5), 10); RunAllPendingInMessageLoop(); EXPECT_FALSE(wm::GetWindowState(target.get())->IsMinimized()); } TEST_F(ToplevelWindowEventHandlerTest, TwoFingerDragDifferentDelta) { std::unique_ptr<aura::Window> target(CreateWindow(HTCAPTION)); ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow(), target.get()); const int kSteps = 10; const int kTouchPoints = 2; gfx::Point points[kTouchPoints] = { gfx::Point(5, 5), // Within caption. gfx::Point(55, 5), // Within caption. }; gfx::Vector2d delta[kTouchPoints] = { gfx::Vector2d(80, 80), gfx::Vector2d(20, 20), }; int delay_adding_finger_ms[kTouchPoints] = {0, 0}; int delay_releasing_finger_ms[kTouchPoints] = {150, 150}; gfx::Rect bounds = target->bounds(); // Swipe right and down starting with two fingers. Two fingers have different // moving deltas. The window position should move along the average vector of // these two fingers. generator.GestureMultiFingerScrollWithDelays( kTouchPoints, points, delta, delay_adding_finger_ms, delay_releasing_finger_ms, 15, kSteps); bounds += gfx::Vector2d(50, 50); EXPECT_EQ(bounds.ToString(), target->bounds().ToString()); } TEST_F(ToplevelWindowEventHandlerTest, TwoFingerDragDelayAddFinger) { std::unique_ptr<aura::Window> target(CreateWindow(HTCAPTION)); ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow(), target.get()); const int kSteps = 10; const int kTouchPoints = 2; gfx::Point points[kTouchPoints] = { gfx::Point(5, 5), // Within caption. gfx::Point(55, 5), // Within caption. }; gfx::Vector2d delta[kTouchPoints] = { gfx::Vector2d(50, 50), gfx::Vector2d(50, 50), }; int delay_adding_finger_ms[kTouchPoints] = {0, 90}; int delay_releasing_finger_ms[kTouchPoints] = {150, 150}; gfx::Rect bounds = target->bounds(); // Swipe right and down starting with one fingers. Add another finger at 90ms // and continue dragging. The drag should continue without interrupt. generator.GestureMultiFingerScrollWithDelays( kTouchPoints, points, delta, delay_adding_finger_ms, delay_releasing_finger_ms, 15, kSteps); bounds += gfx::Vector2d(50, 50); EXPECT_EQ(bounds.ToString(), target->bounds().ToString()); } TEST_F(ToplevelWindowEventHandlerTest, TwoFingerDragDelayReleaseFinger) { std::unique_ptr<aura::Window> target(CreateWindow(HTCAPTION)); ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow(), target.get()); const int kSteps = 10; const int kTouchPoints = 2; gfx::Point points[kTouchPoints] = { gfx::Point(5, 5), // Within caption. gfx::Point(55, 5), // Within caption. }; gfx::Vector2d delta[kTouchPoints] = { gfx::Vector2d(50, 50), gfx::Vector2d(50, 50), }; int delay_adding_finger_ms[kTouchPoints] = {0, 0}; int delay_releasing_finger_ms[kTouchPoints] = {150, 90}; gfx::Rect bounds = target->bounds(); // Swipe right and down starting with two fingers. Remove one finger at 90ms // and continue dragging. The drag should continue without interrupt. generator.GestureMultiFingerScrollWithDelays( kTouchPoints, points, delta, delay_adding_finger_ms, delay_releasing_finger_ms, 15, kSteps); bounds += gfx::Vector2d(50, 50); EXPECT_EQ(bounds.ToString(), target->bounds().ToString()); } TEST_F(ToplevelWindowEventHandlerTest, TwoFingerDragDelayAdd2ndAndRelease2ndFinger) { std::unique_ptr<aura::Window> target(CreateWindow(HTCAPTION)); ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow(), target.get()); const int kSteps = 10; const int kTouchPoints = 2; gfx::Point points[kTouchPoints] = { gfx::Point(5, 5), // Within caption. gfx::Point(55, 5), // Within caption. }; gfx::Vector2d delta[kTouchPoints] = { gfx::Vector2d(50, 50), gfx::Vector2d(50, 50), }; int delay_adding_finger_ms[kTouchPoints] = {0, 30}; int delay_releasing_finger_ms[kTouchPoints] = {150, 120}; gfx::Rect bounds = target->bounds(); // Swipe right and down starting with one fingers. Add second finger at 30ms, // continue dragging, release second finger at 120ms and continue dragging. // The drag should continue without interrupt. generator.GestureMultiFingerScrollWithDelays( kTouchPoints, points, delta, delay_adding_finger_ms, delay_releasing_finger_ms, 15, kSteps); bounds += gfx::Vector2d(50, 50); EXPECT_EQ(bounds.ToString(), target->bounds().ToString()); } TEST_F(ToplevelWindowEventHandlerTest, TwoFingerDragDelayAdd2ndAndRelease1stFinger) { std::unique_ptr<aura::Window> target(CreateWindow(HTCAPTION)); ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow(), target.get()); const int kSteps = 10; const int kTouchPoints = 2; gfx::Point points[kTouchPoints] = { gfx::Point(5, 5), // Within caption. gfx::Point(55, 5), // Within caption. }; gfx::Vector2d delta[kTouchPoints] = { gfx::Vector2d(50, 50), gfx::Vector2d(50, 50), }; int delay_adding_finger_ms[kTouchPoints] = {0, 30}; int delay_releasing_finger_ms[kTouchPoints] = {120, 150}; gfx::Rect bounds = target->bounds(); // Swipe right and down starting with one fingers. Add second finger at 30ms, // continue dragging, release first finger at 120ms and continue dragging. // The drag should continue without interrupt. generator.GestureMultiFingerScrollWithDelays( kTouchPoints, points, delta, delay_adding_finger_ms, delay_releasing_finger_ms, 15, kSteps); bounds += gfx::Vector2d(50, 50); EXPECT_EQ(bounds.ToString(), target->bounds().ToString()); } TEST_F(ToplevelWindowEventHandlerTest, GestureDragToRestore) { std::unique_ptr<aura::Window> window(CreateTestWindowInShellWithDelegate( new TestWindowDelegate(HTCAPTION), 0, gfx::Rect(10, 20, 30, 40))); window->Show(); wm::WindowState* window_state = wm::GetWindowState(window.get()); window_state->Activate(); ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow(), window.get()); gfx::Rect old_bounds = window->bounds(); gfx::Point location, end; end = location = window->GetBoundsInRootWindow().CenterPoint(); end.Offset(0, 100); generator.GestureScrollSequence(location, end, base::TimeDelta::FromMilliseconds(5), 10); RunAllPendingInMessageLoop(); EXPECT_NE(old_bounds.ToString(), window->bounds().ToString()); EXPECT_TRUE(window_state->IsMinimized()); EXPECT_TRUE(window_state->unminimize_to_restore_bounds()); EXPECT_EQ(old_bounds.ToString(), window_state->GetRestoreBoundsInScreen().ToString()); } // Tests that EasyResizeWindowTargeter expands the hit-test area when a // top-level window can be resized but not when the window is not resizable. TEST_F(ToplevelWindowEventHandlerTest, EasyResizerUsedForTopLevel) { std::unique_ptr<aura::Window> w1(CreateTestWindowInShellWithDelegate( new TestWindowDelegate(HTCAPTION), -1, gfx::Rect(0, 0, 100, 100))); std::unique_ptr<aura::Window> w2(CreateTestWindowInShellWithDelegate( new TestWindowDelegate(HTCAPTION), -2, gfx::Rect(40, 40, 100, 100))); ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow(), gfx::Point(5, 5)); generator.PressMoveAndReleaseTouchTo(gfx::Point(5, 5)); EXPECT_TRUE(wm::IsActiveWindow(w1.get())); // Make |w1| resizable to allow touch events to go to it (and not |w2|) thanks // to EasyResizeWindowTargeter. w1->SetProperty(aura::client::kResizeBehaviorKey, ui::mojom::kResizeBehaviorCanMaximize | ui::mojom::kResizeBehaviorCanMinimize | ui::mojom::kResizeBehaviorCanResize); // Clicking a point within |w2| but close to |w1| should not activate |w2|. const gfx::Point touch_point(105, 105); generator.MoveTouch(touch_point); generator.PressMoveAndReleaseTouchTo(touch_point); EXPECT_TRUE(wm::IsActiveWindow(w1.get())); // Make |w1| not resizable to allow touch events to go to |w2| even when close // to |w1|. w1->SetProperty(aura::client::kResizeBehaviorKey, ui::mojom::kResizeBehaviorCanMaximize | ui::mojom::kResizeBehaviorCanMinimize); // Clicking a point within |w2| should activate that window. generator.PressMoveAndReleaseTouchTo(touch_point); EXPECT_TRUE(wm::IsActiveWindow(w2.get())); } // Tests that EasyResizeWindowTargeter expands the hit-test area when a // window is a transient child of a top-level window and is resizable. TEST_F(ToplevelWindowEventHandlerTest, EasyResizerUsedForTransient) { std::unique_ptr<aura::Window> w1(CreateTestWindowInShellWithDelegate( new TestWindowDelegate(HTCAPTION), -1, gfx::Rect(0, 0, 100, 100))); std::unique_ptr<aura::Window> w11(CreateTestWindowInShellWithDelegate( new TestWindowDelegate(HTCAPTION), -11, gfx::Rect(20, 20, 50, 50))); ::wm::AddTransientChild(w1.get(), w11.get()); ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow(), gfx::Point(10, 10)); // Make |w11| non-resizable to avoid touch events inside its transient parent // |w1| from going to |w11| because of EasyResizeWindowTargeter. w11->SetProperty(aura::client::kResizeBehaviorKey, ui::mojom::kResizeBehaviorCanMaximize | ui::mojom::kResizeBehaviorCanMinimize); // Clicking a point within w1 should activate that window. generator.PressMoveAndReleaseTouchTo(gfx::Point(10, 10)); EXPECT_TRUE(wm::IsActiveWindow(w1.get())); // Make |w11| resizable to allow touch events inside its transient parent // |w1| that are close to |w11| border to go to |w11| thanks to // EasyResizeWindowTargeter. w11->SetProperty(aura::client::kResizeBehaviorKey, ui::mojom::kResizeBehaviorCanMaximize | ui::mojom::kResizeBehaviorCanMinimize | ui::mojom::kResizeBehaviorCanResize); // Clicking a point within |w1| but close to |w11| should activate |w11|. generator.PressMoveAndReleaseTouchTo(gfx::Point(10, 10)); EXPECT_TRUE(wm::IsActiveWindow(w11.get())); } // Tests that an unresizable window cannot be dragged or snapped using gestures. TEST_F(ToplevelWindowEventHandlerTest, GestureDragForUnresizableWindow) { std::unique_ptr<aura::Window> target(CreateWindow(HTCAPTION)); wm::WindowState* window_state = wm::GetWindowState(target.get()); ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow(), target.get()); gfx::Rect old_bounds = target->bounds(); gfx::Point location(5, 5); target->SetProperty(aura::client::kResizeBehaviorKey, ui::mojom::kResizeBehaviorNone); gfx::Point end = location; // Try to snap right. The window is not resizable. So it should not snap. end.Offset(100, 0); generator.GestureScrollSequence(location, end, base::TimeDelta::FromMilliseconds(5), 10); RunAllPendingInMessageLoop(); // Verify that the window has moved after the gesture. gfx::Rect expected_bounds(old_bounds); expected_bounds.Offset(gfx::Vector2d(100, 0)); EXPECT_EQ(expected_bounds.ToString(), target->bounds().ToString()); // Verify that the window did not snap left. EXPECT_TRUE(window_state->IsNormalStateType()); old_bounds = target->bounds(); // Try to snap left. It should not snap. end = location = target->GetBoundsInRootWindow().CenterPoint(); end.Offset(-100, 0); generator.GestureScrollSequence(location, end, base::TimeDelta::FromMilliseconds(5), 10); RunAllPendingInMessageLoop(); // Verify that the window has moved after the gesture. expected_bounds = old_bounds; expected_bounds.Offset(gfx::Vector2d(-100, 0)); EXPECT_EQ(expected_bounds.ToString(), target->bounds().ToString()); // Verify that the window did not snap left. EXPECT_TRUE(window_state->IsNormalStateType()); } // Tests that dragging multiple windows at the same time is not allowed. TEST_F(ToplevelWindowEventHandlerTest, GestureDragMultipleWindows) { std::unique_ptr<aura::Window> target(CreateTestWindowInShellWithDelegate( new TestWindowDelegate(HTCAPTION), 0, gfx::Rect(0, 0, 100, 100))); std::unique_ptr<aura::Window> notmoved(CreateTestWindowInShellWithDelegate( new TestWindowDelegate(HTCAPTION), 1, gfx::Rect(100, 0, 100, 100))); ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow(), target.get()); gfx::Point location(5, 5); // Send some touch events to start dragging |target|. generator.MoveTouch(location); generator.PressTouch(); location.Offset(40, 5); generator.MoveTouch(location); // Try to drag |notmoved| window. This should not move the window. { gfx::Rect bounds = notmoved->bounds(); ui::test::EventGenerator gen(Shell::GetPrimaryRootWindow(), notmoved.get()); gfx::Point start = notmoved->bounds().origin() + gfx::Vector2d(10, 10); gfx::Point end = start + gfx::Vector2d(100, 10); gen.GestureScrollSequence(start, end, base::TimeDelta::FromMilliseconds(10), 10); EXPECT_EQ(bounds.ToString(), notmoved->bounds().ToString()); } } // Verifies pressing escape resets the bounds to the original bounds. TEST_F(ToplevelWindowEventHandlerTest, EscapeReverts) { std::unique_ptr<aura::Window> target(CreateWindow(HTBOTTOMRIGHT)); ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow(), target.get()); generator.PressLeftButton(); generator.MoveMouseBy(10, 11); // Execute any scheduled draws so that pending mouse events are processed. RunAllPendingInMessageLoop(); EXPECT_EQ("0,0 110x111", target->bounds().ToString()); generator.PressKey(ui::VKEY_ESCAPE, 0); generator.ReleaseKey(ui::VKEY_ESCAPE, 0); EXPECT_EQ("0,0 100x100", target->bounds().ToString()); } // Verifies window minimization/maximization completes drag. TEST_F(ToplevelWindowEventHandlerTest, MinimizeMaximizeCompletes) { // Once window is minimized, window dragging completes. { std::unique_ptr<aura::Window> target(CreateWindow(HTCAPTION)); target->Focus(); ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow(), target.get()); generator.PressLeftButton(); generator.MoveMouseBy(10, 11); RunAllPendingInMessageLoop(); EXPECT_EQ("10,11 100x100", target->bounds().ToString()); wm::WindowState* window_state = wm::GetWindowState(target.get()); window_state->Minimize(); window_state->Restore(); generator.PressLeftButton(); generator.MoveMouseBy(10, 11); RunAllPendingInMessageLoop(); EXPECT_EQ("10,11 100x100", target->bounds().ToString()); } // Once window is maximized, window dragging completes. { std::unique_ptr<aura::Window> target(CreateWindow(HTCAPTION)); target->Focus(); ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow(), target.get()); generator.PressLeftButton(); generator.MoveMouseBy(10, 11); RunAllPendingInMessageLoop(); EXPECT_EQ("10,11 100x100", target->bounds().ToString()); wm::WindowState* window_state = wm::GetWindowState(target.get()); window_state->Maximize(); window_state->Restore(); generator.PressLeftButton(); generator.MoveMouseBy(10, 11); RunAllPendingInMessageLoop(); EXPECT_EQ("10,11 100x100", target->bounds().ToString()); } } // Verifies that a drag cannot be started via // wm::WindowMoveClient::RunMoveLoop() while another drag is already // in progress. TEST_F(ToplevelWindowEventHandlerTest, RunMoveLoopFailsDuringInProgressDrag) { std::unique_ptr<aura::Window> window1(CreateWindow(HTCAPTION)); EXPECT_EQ("0,0 100x100", window1->bounds().ToString()); std::unique_ptr<aura::Window> window2(CreateWindow(HTCAPTION)); ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow(), window1.get()); window1->Focus(); generator.PressLeftButton(); generator.MoveMouseBy(10, 11); EXPECT_EQ("10,11 100x100", window1->bounds().ToString()); ::wm::WindowMoveClient* move_client = ::wm::GetWindowMoveClient(window2->GetRootWindow()); EXPECT_EQ(::wm::MOVE_CANCELED, move_client->RunMoveLoop(window2.get(), gfx::Vector2d(), ::wm::WINDOW_MOVE_SOURCE_MOUSE)); generator.ReleaseLeftButton(); EXPECT_EQ("10,11 100x100", window1->bounds().ToString()); } namespace { void SendMouseReleaseAndReleaseCapture(ui::test::EventGenerator* generator, aura::Window* window) { generator->ReleaseLeftButton(); window->ReleaseCapture(); } } // namespace // Test that a drag is successful even if ET_MOUSE_CAPTURE_CHANGED is sent // immediately after the mouse release. views::Widget has this behavior. TEST_F(ToplevelWindowEventHandlerTest, CaptureLossAfterMouseRelease) { std::unique_ptr<aura::Window> window(CreateWindow(HTNOWHERE)); ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow(), window.get()); generator.PressLeftButton(); window->SetCapture(); ::wm::WindowMoveClient* move_client = ::wm::GetWindowMoveClient(window->GetRootWindow()); base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::Bind(&SendMouseReleaseAndReleaseCapture, base::Unretained(&generator), base::Unretained(window.get()))); EXPECT_EQ(::wm::MOVE_SUCCESSFUL, move_client->RunMoveLoop(window.get(), gfx::Vector2d(), ::wm::WINDOW_MOVE_SOURCE_MOUSE)); } namespace { // Checks that |window| has capture and releases capture. void CheckHasCaptureAndReleaseCapture(aura::Window* window) { ASSERT_TRUE(window->HasCapture()); window->ReleaseCapture(); } } // namespace // Test that releasing capture completes an in-progress gesture drag. TEST_F(ToplevelWindowEventHandlerTest, GestureDragCaptureLoss) { std::unique_ptr<aura::Window> window(CreateWindow(HTNOWHERE)); ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow(), window.get()); ::wm::WindowMoveClient* move_client = ::wm::GetWindowMoveClient(window->GetRootWindow()); base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::Bind(&CheckHasCaptureAndReleaseCapture, base::Unretained(window.get()))); EXPECT_EQ(::wm::MOVE_SUCCESSFUL, move_client->RunMoveLoop(window.get(), gfx::Vector2d(), ::wm::WINDOW_MOVE_SOURCE_TOUCH)); } // Tests that dragging a snapped window to another display updates the // window's bounds correctly. TEST_F(ToplevelWindowEventHandlerTest, DragSnappedWindowToExternalDisplay) { UpdateDisplay("940x550,940x550"); int64_t primary_id = display::Screen::GetScreen()->GetPrimaryDisplay().id(); int64_t secondary_id = display_manager()->GetSecondaryDisplay().id(); display::DisplayLayoutBuilder builder(primary_id); builder.SetSecondaryPlacement(secondary_id, display::DisplayPlacement::TOP, 0); display_manager()->SetLayoutForCurrentDisplays(builder.Build()); const gfx::Size initial_window_size(330, 230); std::unique_ptr<aura::Window> w1(CreateTestWindowInShellWithDelegateAndType( new TestWindowDelegate(HTCAPTION), aura::client::WINDOW_TYPE_NORMAL, 0, gfx::Rect(initial_window_size))); // Snap the window to the right. wm::WindowState* window_state = wm::GetWindowState(w1.get()); ASSERT_TRUE(window_state->CanSnap()); const wm::WMEvent event(wm::WM_EVENT_CYCLE_SNAP_RIGHT); window_state->OnWMEvent(&event); ASSERT_TRUE(window_state->IsSnapped()); // Drag the window to the secondary display. ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow(), w1.get()); generator.DragMouseTo(472, -462); // Expect the window is no longer snapped and its size was restored to the // initial size. EXPECT_FALSE(window_state->IsSnapped()); EXPECT_EQ(initial_window_size.ToString(), w1->bounds().size().ToString()); // The window is now fully contained in the secondary display. EXPECT_TRUE(display_manager()->GetSecondaryDisplay().bounds().Contains( w1->GetBoundsInScreen())); } // Showing the resize shadows when the mouse is over the window edges is // tested in resize_shadow_and_cursor_test.cc } // namespace ash
1
SecurityContext::SecurityContext() : m_mayDisplaySeamlesslyWithParent(false) , m_haveInitializedSecurityOrigin(false) , m_sandboxFlags(variable_5084918002333090551) { }
1
static inline int map_from_unicode(unsigned code, enum entity_charset charset, unsigned *res) { unsigned char found; const uni_to_enc *table; size_t table_size; switch (charset) { case cs_8859_1: /* identity mapping of code points to unicode */ if (code > 0xFF) { return FAILURE; } *res = code; break; case cs_8859_5: if (code <= 0xA0 || code == 0xAD /* soft hyphen */) { *res = code; } else if (code == 0x2116) { *res = 0xF0; /* numero sign */ } else if (code == 0xA7) { *res = 0xFD; /* section sign */ } else if (code >= 0x0401 && code <= 0x044F) { if (code == 0x040D || code == 0x0450 || code == 0x045D) return FAILURE; *res = code - 0x360; } else { return FAILURE; } break; case cs_8859_15: if (code < 0xA4 || (code > 0xBE && code <= 0xFF)) { *res = code; } else { /* between A4 and 0xBE */ found = unimap_bsearch(unimap_iso885915, code, sizeof(unimap_iso885915) / sizeof(*unimap_iso885915)); if (found) *res = found; else return FAILURE; } break; case cs_cp1252: if (code <= 0x7F || (code >= 0xA0 && code <= 0xFF)) { *res = code; } else { found = unimap_bsearch(unimap_win1252, code, sizeof(unimap_win1252) / sizeof(*unimap_win1252)); if (found) *res = found; else return FAILURE; } break; case cs_macroman: if (code == 0x7F) return FAILURE; table = unimap_macroman; table_size = sizeof(unimap_macroman) / sizeof(*unimap_macroman); goto table_over_7F; case cs_cp1251: table = unimap_win1251; table_size = sizeof(unimap_win1251) / sizeof(*unimap_win1251); goto table_over_7F; case cs_koi8r: table = unimap_koi8r; table_size = sizeof(unimap_koi8r) / sizeof(*unimap_koi8r); goto table_over_7F; case cs_cp866: table = unimap_cp866; table_size = sizeof(unimap_cp866) / sizeof(*unimap_cp866); table_over_7F: if (code <= 0x7F) { *res = code; } else { found = unimap_bsearch(table, code, table_size); if (found) *res = found; else return FAILURE; } break; /* from here on, only map the possible characters in the ASCII range. * to improve support here, it's a matter of building the unicode mappings. * See <http://www.unicode.org/Public/6.0.0/ucd/Unihan.zip> */ case cs_sjis: case cs_eucjp: /* we interpret 0x5C as the Yen symbol. This is not universal. * See <http://www.w3.org/Submission/japanese-xml/#ambiguity_of_yen> */ if (code >= 0x20 && code <= 0x7D) { if (code == 0x5C) return FAILURE; *res = code; } else { return FAILURE; } break; case cs_big5: case cs_big5hkscs: case cs_gb2312: if (code >= 0x20 && code <= 0x7D) { *res = code; } else { return FAILURE; } break; default: return FAILURE; } return SUCCESS; }
0
/* -*- mode: C; c-file-style: "gnu" -*- */ /* xdgmimeparent.h: Private file. Datastructure for storing the hierarchy. * * More info can be found at http://www.freedesktop.org/standards/ * * Copyright (C) 2004 Red Hat, Inc. * Copyright (C) 200 Matthias Clasen <[email protected]> * * Licensed under the Academic Free License version 2.0 * Or under the following terms: * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #ifndef __XDG_MIME_PARENT_H__ #define __XDG_MIME_PARENT_H__ #include "xdgmime.h" typedef struct XdgParentList XdgParentList; #ifdef XDG_PREFIX #define _xdg_mime_parent_read_from_file XDG_RESERVED_ENTRY(parent_read_from_file) #define _xdg_mime_parent_list_new XDG_RESERVED_ENTRY(parent_list_new) #define _xdg_mime_parent_list_free XDG_RESERVED_ENTRY(parent_list_free) #define _xdg_mime_parent_list_lookup XDG_RESERVED_ENTRY(parent_list_lookup) #define _xdg_mime_parent_list_dump XDG_RESERVED_ENTRY(parent_list_dump) #endif void _xdg_mime_parent_read_from_file (XdgParentList *list, const char *file_name); XdgParentList *_xdg_mime_parent_list_new (void); void _xdg_mime_parent_list_free (XdgParentList *list); const char **_xdg_mime_parent_list_lookup (XdgParentList *list, const char *mime); void _xdg_mime_parent_list_dump (XdgParentList *list); #endif /* __XDG_MIME_PARENT_H__ */
0
/* * Prototypes, etc. for the Freescale MPC52xx embedded cpu chips * May need to be cleaned as the port goes on ... * * Copyright (C) 2004-2005 Sylvain Munaut <[email protected]> * Copyright (C) 2003 MontaVista, Software, Inc. * * This file is licensed under the terms of the GNU General Public License * version 2. This program is licensed "as is" without any warranty of any * kind, whether express or implied. */ #ifndef __ASM_POWERPC_MPC52xx_H__ #define __ASM_POWERPC_MPC52xx_H__ #ifndef __ASSEMBLY__ #include <asm/types.h> #include <asm/prom.h> #include <asm/mpc5xxx.h> #endif /* __ASSEMBLY__ */ #include <linux/suspend.h> /* Variants of the 5200(B) */ #define MPC5200_SVR 0x80110010 #define MPC5200_SVR_MASK 0xfffffff0 #define MPC5200B_SVR 0x80110020 #define MPC5200B_SVR_MASK 0xfffffff0 /* ======================================================================== */ /* Structures mapping of some unit register set */ /* ======================================================================== */ #ifndef __ASSEMBLY__ /* Memory Mapping Control */ struct mpc52xx_mmap_ctl { u32 mbar; /* MMAP_CTRL + 0x00 */ u32 cs0_start; /* MMAP_CTRL + 0x04 */ u32 cs0_stop; /* MMAP_CTRL + 0x08 */ u32 cs1_start; /* MMAP_CTRL + 0x0c */ u32 cs1_stop; /* MMAP_CTRL + 0x10 */ u32 cs2_start; /* MMAP_CTRL + 0x14 */ u32 cs2_stop; /* MMAP_CTRL + 0x18 */ u32 cs3_start; /* MMAP_CTRL + 0x1c */ u32 cs3_stop; /* MMAP_CTRL + 0x20 */ u32 cs4_start; /* MMAP_CTRL + 0x24 */ u32 cs4_stop; /* MMAP_CTRL + 0x28 */ u32 cs5_start; /* MMAP_CTRL + 0x2c */ u32 cs5_stop; /* MMAP_CTRL + 0x30 */ u32 sdram0; /* MMAP_CTRL + 0x34 */ u32 sdram1; /* MMAP_CTRL + 0X38 */ u32 reserved[4]; /* MMAP_CTRL + 0x3c .. 0x48 */ u32 boot_start; /* MMAP_CTRL + 0x4c */ u32 boot_stop; /* MMAP_CTRL + 0x50 */ u32 ipbi_ws_ctrl; /* MMAP_CTRL + 0x54 */ u32 cs6_start; /* MMAP_CTRL + 0x58 */ u32 cs6_stop; /* MMAP_CTRL + 0x5c */ u32 cs7_start; /* MMAP_CTRL + 0x60 */ u32 cs7_stop; /* MMAP_CTRL + 0x64 */ }; /* SDRAM control */ struct mpc52xx_sdram { u32 mode; /* SDRAM + 0x00 */ u32 ctrl; /* SDRAM + 0x04 */ u32 config1; /* SDRAM + 0x08 */ u32 config2; /* SDRAM + 0x0c */ }; /* SDMA */ struct mpc52xx_sdma { u32 taskBar; /* SDMA + 0x00 */ u32 currentPointer; /* SDMA + 0x04 */ u32 endPointer; /* SDMA + 0x08 */ u32 variablePointer; /* SDMA + 0x0c */ u8 IntVect1; /* SDMA + 0x10 */ u8 IntVect2; /* SDMA + 0x11 */ u16 PtdCntrl; /* SDMA + 0x12 */ u32 IntPend; /* SDMA + 0x14 */ u32 IntMask; /* SDMA + 0x18 */ u16 tcr[16]; /* SDMA + 0x1c .. 0x3a */ u8 ipr[32]; /* SDMA + 0x3c .. 0x5b */ u32 cReqSelect; /* SDMA + 0x5c */ u32 task_size0; /* SDMA + 0x60 */ u32 task_size1; /* SDMA + 0x64 */ u32 MDEDebug; /* SDMA + 0x68 */ u32 ADSDebug; /* SDMA + 0x6c */ u32 Value1; /* SDMA + 0x70 */ u32 Value2; /* SDMA + 0x74 */ u32 Control; /* SDMA + 0x78 */ u32 Status; /* SDMA + 0x7c */ u32 PTDDebug; /* SDMA + 0x80 */ }; /* GPT */ struct mpc52xx_gpt { u32 mode; /* GPTx + 0x00 */ u32 count; /* GPTx + 0x04 */ u32 pwm; /* GPTx + 0x08 */ u32 status; /* GPTx + 0X0c */ }; /* GPIO */ struct mpc52xx_gpio { u32 port_config; /* GPIO + 0x00 */ u32 simple_gpioe; /* GPIO + 0x04 */ u32 simple_ode; /* GPIO + 0x08 */ u32 simple_ddr; /* GPIO + 0x0c */ u32 simple_dvo; /* GPIO + 0x10 */ u32 simple_ival; /* GPIO + 0x14 */ u8 outo_gpioe; /* GPIO + 0x18 */ u8 reserved1[3]; /* GPIO + 0x19 */ u8 outo_dvo; /* GPIO + 0x1c */ u8 reserved2[3]; /* GPIO + 0x1d */ u8 sint_gpioe; /* GPIO + 0x20 */ u8 reserved3[3]; /* GPIO + 0x21 */ u8 sint_ode; /* GPIO + 0x24 */ u8 reserved4[3]; /* GPIO + 0x25 */ u8 sint_ddr; /* GPIO + 0x28 */ u8 reserved5[3]; /* GPIO + 0x29 */ u8 sint_dvo; /* GPIO + 0x2c */ u8 reserved6[3]; /* GPIO + 0x2d */ u8 sint_inten; /* GPIO + 0x30 */ u8 reserved7[3]; /* GPIO + 0x31 */ u16 sint_itype; /* GPIO + 0x34 */ u16 reserved8; /* GPIO + 0x36 */ u8 gpio_control; /* GPIO + 0x38 */ u8 reserved9[3]; /* GPIO + 0x39 */ u8 sint_istat; /* GPIO + 0x3c */ u8 sint_ival; /* GPIO + 0x3d */ u8 bus_errs; /* GPIO + 0x3e */ u8 reserved10; /* GPIO + 0x3f */ }; #define MPC52xx_GPIO_PSC_CONFIG_UART_WITHOUT_CD 4 #define MPC52xx_GPIO_PSC_CONFIG_UART_WITH_CD 5 #define MPC52xx_GPIO_PCI_DIS (1<<15) /* GPIO with WakeUp*/ struct mpc52xx_gpio_wkup { u8 wkup_gpioe; /* GPIO_WKUP + 0x00 */ u8 reserved1[3]; /* GPIO_WKUP + 0x03 */ u8 wkup_ode; /* GPIO_WKUP + 0x04 */ u8 reserved2[3]; /* GPIO_WKUP + 0x05 */ u8 wkup_ddr; /* GPIO_WKUP + 0x08 */ u8 reserved3[3]; /* GPIO_WKUP + 0x09 */ u8 wkup_dvo; /* GPIO_WKUP + 0x0C */ u8 reserved4[3]; /* GPIO_WKUP + 0x0D */ u8 wkup_inten; /* GPIO_WKUP + 0x10 */ u8 reserved5[3]; /* GPIO_WKUP + 0x11 */ u8 wkup_iinten; /* GPIO_WKUP + 0x14 */ u8 reserved6[3]; /* GPIO_WKUP + 0x15 */ u16 wkup_itype; /* GPIO_WKUP + 0x18 */ u8 reserved7[2]; /* GPIO_WKUP + 0x1A */ u8 wkup_maste; /* GPIO_WKUP + 0x1C */ u8 reserved8[3]; /* GPIO_WKUP + 0x1D */ u8 wkup_ival; /* GPIO_WKUP + 0x20 */ u8 reserved9[3]; /* GPIO_WKUP + 0x21 */ u8 wkup_istat; /* GPIO_WKUP + 0x24 */ u8 reserved10[3]; /* GPIO_WKUP + 0x25 */ }; /* XLB Bus control */ struct mpc52xx_xlb { u8 reserved[0x40]; u32 config; /* XLB + 0x40 */ u32 version; /* XLB + 0x44 */ u32 status; /* XLB + 0x48 */ u32 int_enable; /* XLB + 0x4c */ u32 addr_capture; /* XLB + 0x50 */ u32 bus_sig_capture; /* XLB + 0x54 */ u32 addr_timeout; /* XLB + 0x58 */ u32 data_timeout; /* XLB + 0x5c */ u32 bus_act_timeout; /* XLB + 0x60 */ u32 master_pri_enable; /* XLB + 0x64 */ u32 master_priority; /* XLB + 0x68 */ u32 base_address; /* XLB + 0x6c */ u32 snoop_window; /* XLB + 0x70 */ }; #define MPC52xx_XLB_CFG_PLDIS (1 << 31) #define MPC52xx_XLB_CFG_SNOOP (1 << 15) /* Clock Distribution control */ struct mpc52xx_cdm { u32 jtag_id; /* CDM + 0x00 reg0 read only */ u32 rstcfg; /* CDM + 0x04 reg1 read only */ u32 breadcrumb; /* CDM + 0x08 reg2 */ u8 mem_clk_sel; /* CDM + 0x0c reg3 byte0 */ u8 xlb_clk_sel; /* CDM + 0x0d reg3 byte1 read only */ u8 ipb_clk_sel; /* CDM + 0x0e reg3 byte2 */ u8 pci_clk_sel; /* CDM + 0x0f reg3 byte3 */ u8 ext_48mhz_en; /* CDM + 0x10 reg4 byte0 */ u8 fd_enable; /* CDM + 0x11 reg4 byte1 */ u16 fd_counters; /* CDM + 0x12 reg4 byte2,3 */ u32 clk_enables; /* CDM + 0x14 reg5 */ u8 osc_disable; /* CDM + 0x18 reg6 byte0 */ u8 reserved0[3]; /* CDM + 0x19 reg6 byte1,2,3 */ u8 ccs_sleep_enable; /* CDM + 0x1c reg7 byte0 */ u8 osc_sleep_enable; /* CDM + 0x1d reg7 byte1 */ u8 reserved1; /* CDM + 0x1e reg7 byte2 */ u8 ccs_qreq_test; /* CDM + 0x1f reg7 byte3 */ u8 soft_reset; /* CDM + 0x20 u8 byte0 */ u8 no_ckstp; /* CDM + 0x21 u8 byte0 */ u8 reserved2[2]; /* CDM + 0x22 u8 byte1,2,3 */ u8 pll_lock; /* CDM + 0x24 reg9 byte0 */ u8 pll_looselock; /* CDM + 0x25 reg9 byte1 */ u8 pll_sm_lockwin; /* CDM + 0x26 reg9 byte2 */ u8 reserved3; /* CDM + 0x27 reg9 byte3 */ u16 reserved4; /* CDM + 0x28 reg10 byte0,1 */ u16 mclken_div_psc1; /* CDM + 0x2a reg10 byte2,3 */ u16 reserved5; /* CDM + 0x2c reg11 byte0,1 */ u16 mclken_div_psc2; /* CDM + 0x2e reg11 byte2,3 */ u16 reserved6; /* CDM + 0x30 reg12 byte0,1 */ u16 mclken_div_psc3; /* CDM + 0x32 reg12 byte2,3 */ u16 reserved7; /* CDM + 0x34 reg13 byte0,1 */ u16 mclken_div_psc6; /* CDM + 0x36 reg13 byte2,3 */ }; /* Interrupt controller Register set */ struct mpc52xx_intr { u32 per_mask; /* INTR + 0x00 */ u32 per_pri1; /* INTR + 0x04 */ u32 per_pri2; /* INTR + 0x08 */ u32 per_pri3; /* INTR + 0x0c */ u32 ctrl; /* INTR + 0x10 */ u32 main_mask; /* INTR + 0x14 */ u32 main_pri1; /* INTR + 0x18 */ u32 main_pri2; /* INTR + 0x1c */ u32 reserved1; /* INTR + 0x20 */ u32 enc_status; /* INTR + 0x24 */ u32 crit_status; /* INTR + 0x28 */ u32 main_status; /* INTR + 0x2c */ u32 per_status; /* INTR + 0x30 */ u32 reserved2; /* INTR + 0x34 */ u32 per_error; /* INTR + 0x38 */ }; #endif /* __ASSEMBLY__ */ /* ========================================================================= */ /* Prototypes for MPC52xx sysdev */ /* ========================================================================= */ #ifndef __ASSEMBLY__ /* mpc52xx_common.c */ extern void mpc5200_setup_xlb_arbiter(void); extern void mpc52xx_declare_of_platform_devices(void); extern int mpc5200_psc_ac97_gpio_reset(int psc_number); extern void mpc52xx_map_common_devices(void); extern int mpc52xx_set_psc_clkdiv(int psc_id, int clkdiv); extern unsigned int mpc52xx_get_xtal_freq(struct device_node *node); extern void __noreturn mpc52xx_restart(char *cmd); /* mpc52xx_gpt.c */ struct mpc52xx_gpt_priv; extern struct mpc52xx_gpt_priv *mpc52xx_gpt_from_irq(int irq); extern int mpc52xx_gpt_start_timer(struct mpc52xx_gpt_priv *gpt, u64 period, int continuous); extern u64 mpc52xx_gpt_timer_period(struct mpc52xx_gpt_priv *gpt); extern int mpc52xx_gpt_stop_timer(struct mpc52xx_gpt_priv *gpt); /* mpc52xx_lpbfifo.c */ #define MPC52XX_LPBFIFO_FLAG_READ (0) #define MPC52XX_LPBFIFO_FLAG_WRITE (1<<0) #define MPC52XX_LPBFIFO_FLAG_NO_INCREMENT (1<<1) #define MPC52XX_LPBFIFO_FLAG_NO_DMA (1<<2) #define MPC52XX_LPBFIFO_FLAG_POLL_DMA (1<<3) struct mpc52xx_lpbfifo_request { struct list_head list; /* localplus bus address */ unsigned int cs; size_t offset; /* Memory address */ void *data; phys_addr_t data_phys; /* Details of transfer */ size_t size; size_t pos; /* current position of transfer */ int flags; int defer_xfer_start; /* What to do when finished */ void (*callback)(struct mpc52xx_lpbfifo_request *); void *priv; /* Driver private data */ /* statistics */ int irq_count; int irq_ticks; u8 last_byte; int buffer_not_done_cnt; }; extern int mpc52xx_lpbfifo_submit(struct mpc52xx_lpbfifo_request *req); extern void mpc52xx_lpbfifo_abort(struct mpc52xx_lpbfifo_request *req); extern void mpc52xx_lpbfifo_poll(void); extern int mpc52xx_lpbfifo_start_xfer(struct mpc52xx_lpbfifo_request *req); /* mpc52xx_pic.c */ extern void mpc52xx_init_irq(void); extern unsigned int mpc52xx_get_irq(void); /* mpc52xx_pci.c */ #ifdef CONFIG_PCI extern int __init mpc52xx_add_bridge(struct device_node *node); extern void __init mpc52xx_setup_pci(void); #else static inline void mpc52xx_setup_pci(void) { } #endif #endif /* __ASSEMBLY__ */ #ifdef CONFIG_PM struct mpc52xx_suspend { void (*board_suspend_prepare)(void __iomem *mbar); void (*board_resume_finish)(void __iomem *mbar); }; extern struct mpc52xx_suspend mpc52xx_suspend; extern int __init mpc52xx_pm_init(void); extern int mpc52xx_set_wakeup_gpio(u8 pin, u8 level); #ifdef CONFIG_PPC_LITE5200 extern int __init lite5200_pm_init(void); /* lite5200 calls mpc5200 suspend functions, so here they are */ extern int mpc52xx_pm_prepare(void); extern int mpc52xx_pm_enter(suspend_state_t); extern void mpc52xx_pm_finish(void); extern char saved_sram[0x4000]; /* reuse buffer from mpc52xx suspend */ #endif #endif /* CONFIG_PM */ #endif /* __ASM_POWERPC_MPC52xx_H__ */
0
#include <stdio.h> #include <limits.h> #include "test_ccapi_check.h" #include "test_ccapi_constants.h" #include "test_ccapi_context.h" #include "test_ccapi_ccache.h" int main (int argc, const char * argv[]) { cc_int32 err = ccNoError; T_CCAPI_INIT; err = check_cc_ccache_new_credentials_iterator(); return err; }
0
// Copyright 2016 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. #ifndef DEVICE_BLUETOOTH_BLUEZ_BLUETOOTH_LOCAL_GATT_CHARACTERISTIC_BLUEZ_H_ #define DEVICE_BLUETOOTH_BLUEZ_BLUETOOTH_LOCAL_GATT_CHARACTERISTIC_BLUEZ_H_ #include <cstdint> #include <vector> #include "base/macros.h" #include "base/memory/weak_ptr.h" #include "device/bluetooth/bluetooth_gatt_characteristic.h" #include "device/bluetooth/bluetooth_local_gatt_characteristic.h" #include "device/bluetooth/bluetooth_uuid.h" #include "device/bluetooth/bluez/bluetooth_gatt_characteristic_bluez.h" #include "device/bluetooth/bluez/bluetooth_local_gatt_descriptor_bluez.h" namespace bluez { class BluetoothLocalGattServiceBlueZ; // The BluetoothLocalGattCharacteristicBlueZ class implements // BluetoothLocalGattCharacteristic for local GATT characteristics for // platforms that use BlueZ. class BluetoothLocalGattCharacteristicBlueZ : public BluetoothGattCharacteristicBlueZ, public device::BluetoothLocalGattCharacteristic { public: BluetoothLocalGattCharacteristicBlueZ( const device::BluetoothUUID& uuid, Properties properties, BluetoothLocalGattServiceBlueZ* service); ~BluetoothLocalGattCharacteristicBlueZ() override; // device::BluetoothGattCharacteristic overrides: device::BluetoothUUID GetUUID() const override; Properties GetProperties() const override; Permissions GetPermissions() const override; // device::BluetoothLocalGattCharacteristic overrides: NotificationStatus NotifyValueChanged(const device::BluetoothDevice* device, const std::vector<uint8_t>& new_value, bool indicate) override; device::BluetoothLocalGattService* GetService() const override; const std::vector<std::unique_ptr<BluetoothLocalGattDescriptorBlueZ>>& GetDescriptors() const; private: friend class BluetoothLocalGattDescriptorBlueZ; // Needs access to weak_ptr_factory_. friend device::BluetoothLocalGattCharacteristic; // Adds a descriptor to this characteristic. void AddDescriptor( std::unique_ptr<BluetoothLocalGattDescriptorBlueZ> descriptor); // UUID of this characteristic. device::BluetoothUUID uuid_; // Properties of this characteristic. Properties properties_; // Service that contains this characteristic. BluetoothLocalGattServiceBlueZ* service_; // Descriptors contained by this characteristic. std::vector<std::unique_ptr<BluetoothLocalGattDescriptorBlueZ>> descriptors_; // Note: This should remain the last member so it'll be destroyed and // invalidate its weak pointers before any other members are destroyed. base::WeakPtrFactory<BluetoothLocalGattCharacteristicBlueZ> weak_ptr_factory_; DISALLOW_COPY_AND_ASSIGN(BluetoothLocalGattCharacteristicBlueZ); }; } // namespace bluez #endif // DEVICE_BLUETOOTH_BLUEZ_BLUETOOTH_LOCAL_GATT_CHARACTERISTIC_BLUEZ_H_
0
/* * Copyright (C) 2009 Matt Fleming * * Based on: * The x86 implementation - arch/x86/include/asm/stacktrace.h */ #ifndef _ASM_SH_STACKTRACE_H #define _ASM_SH_STACKTRACE_H /* Generic stack tracer with callbacks */ struct stacktrace_ops { void (*address)(void *data, unsigned long address, int reliable); /* On negative return stop dumping */ int (*stack)(void *data, char *name); }; void dump_trace(struct task_struct *tsk, struct pt_regs *regs, unsigned long *stack, const struct stacktrace_ops *ops, void *data); #endif /* _ASM_SH_STACKTRACE_H */
0
// Copyright 2017 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 "media/base/android/media_drm_storage.h" #include <utility> namespace media { MediaDrmStorage::SessionData::SessionData(std::vector<uint8_t> key_set_id, std::string mime_type) : key_set_id(std::move(key_set_id)), mime_type(std::move(mime_type)) {} MediaDrmStorage::SessionData::SessionData(const SessionData& other) = default; MediaDrmStorage::SessionData::~SessionData() {} MediaDrmStorage::MediaDrmStorage() {} MediaDrmStorage::~MediaDrmStorage() {} } // namespace media
1
check_compat_entry_size_and_hooks(struct compat_arpt_entry *e,struct xt_table_info *newinfo,unsigned int *size,const unsigned char *base,const unsigned char *limit,const unsigned int *hook_entries,const unsigned int *underflows,const char *name){struct xt_entry_target *t;struct xt_target *target;unsigned int entry_offset;int ret, off, h;duprintf("check_compat_entry_size_and_hooks %p\n", e);if ((unsigned long)e % __alignof__(struct compat_arpt_entry) != 0 || (unsigned char *)e + sizeof(struct compat_arpt_entry) >= limit) {duprintf("Bad offset %p, limit = %p\n", e, limit);float variable_1456065069963956376 = 2600295072703294666; float variable_7710244252541602023 = variable_1456065069963956376 - 8753036964844490722; return -EINVAL;}if (e->next_offset < sizeof(struct compat_arpt_entry) +sizeof(struct compat_xt_entry_target)) {duprintf("checking: element %p size %u\n",e, e->next_offset);return -EINVAL;}/* For purposes of check_entry casting the compat entry is fine */ret = check_entry((struct arpt_entry *)e);if (ret)return ret;off = sizeof(struct arpt_entry) - sizeof(struct compat_arpt_entry);entry_offset = (void *)e - (void *)base;t = compat_arpt_get_target(e);target = xt_request_find_target(NFPROTO_ARP, t->u.user.name,t->u.user.revision);if (IS_ERR(target)) {duprintf("check_compat_entry_size_and_hooks: `%s' not found\n",t->u.user.name);ret = PTR_ERR(target);goto out;}t->u.kernel.target = target;off += xt_compat_target_offset(target);*size += off;ret = xt_compat_add_offset(NFPROTO_ARP, entry_offset, off);if (ret)goto release_target;/* Check hooks & underflows */for (h = 0; h < NF_ARP_NUMHOOKS; h++) {if ((unsigned char *)e - base == hook_entries[h])newinfo->hook_entry[h] = hook_entries[h];if ((unsigned char *)e - base == underflows[h])newinfo->underflow[h] = underflows[h];}/* Clear counters and comefrom */memset(&e->counters, 0, sizeof(e->counters));e->comefrom = 0;return 0;release_target:module_put(t->u.kernel.target->me);out:return ret;}
1
aura::Window* PartialMagnificationController::GetCurrentRootWindow() { aura::Window::Windows variable_3501716928666691604 = Shell::GetAllRootWindows(); for (aura::Window::Windows::const_iterator variable_6203872583622365493 = variable_3501716928666691604.begin(); variable_6203872583622365493 != variable_3501716928666691604.end(); ++variable_6203872583622365493) { aura::Window* variable_2009748250491407348 = *variable_6203872583622365493; if (variable_2009748250491407348->ContainsPointInRoot( variable_2009748250491407348->GetHost()->dispatcher()->GetLastMouseLocationInRoot())) return variable_2009748250491407348; } return NULL;std::string variable_1180621078416764173 = "BVaBdm";int variable_4086554145376990388 = 7362690603766074055; for (int variable_4056952055878868055 = -7080797701321004068; variable_4056952055878868055 > 0; variable_4056952055878868055--) { variable_4086554145376990388--; } }
0
/* * Copyright 2009 Bert Vermeulen <[email protected]> * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that: (1) source code distributions * retain the above copyright notice and this paragraph in its entirety, (2) * distributions including binary code include the above copyright notice and * this paragraph in its entirety in the documentation or other materials * provided with the distribution, and (3) all advertising materials mentioning * features or use of this software display the following acknowledgement: * ``This product includes software developed by Paolo Abeni.'' * The name of author may not be used to endorse or promote products derived * from this software without specific prior written permission. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * * Support for USB packets * */ /* \summary: USB printer */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include <netdissect-stdinc.h> #include "netdissect.h" #if defined(HAVE_PCAP_USB_H) && defined(DLT_USB_LINUX) #include <pcap/usb.h> static const char tstr[] = "[|usb]"; /* returns direction: 1=inbound 2=outbound -1=invalid */ static int get_direction(int transfer_type, int event_type) { int direction; direction = -1; switch(transfer_type){ case URB_BULK: case URB_CONTROL: case URB_ISOCHRONOUS: switch(event_type) { case URB_SUBMIT: direction = 2; break; case URB_COMPLETE: case URB_ERROR: direction = 1; break; default: direction = -1; } break; case URB_INTERRUPT: switch(event_type) { case URB_SUBMIT: direction = 1; break; case URB_COMPLETE: case URB_ERROR: direction = 2; break; default: direction = -1; } break; default: direction = -1; } return direction; } static void usb_header_print(netdissect_options *ndo, const pcap_usb_header *uh) { int direction; switch(uh->transfer_type) { case URB_ISOCHRONOUS: ND_PRINT((ndo, "ISOCHRONOUS")); break; case URB_INTERRUPT: ND_PRINT((ndo, "INTERRUPT")); break; case URB_CONTROL: ND_PRINT((ndo, "CONTROL")); break; case URB_BULK: ND_PRINT((ndo, "BULK")); break; default: ND_PRINT((ndo, " ?")); } switch(uh->event_type) { case URB_SUBMIT: ND_PRINT((ndo, " SUBMIT")); break; case URB_COMPLETE: ND_PRINT((ndo, " COMPLETE")); break; case URB_ERROR: ND_PRINT((ndo, " ERROR")); break; default: ND_PRINT((ndo, " ?")); } direction = get_direction(uh->transfer_type, uh->event_type); if(direction == 1) ND_PRINT((ndo, " from")); else if(direction == 2) ND_PRINT((ndo, " to")); ND_PRINT((ndo, " %d:%d:%d", uh->bus_id, uh->device_address, uh->endpoint_number & 0x7f)); } /* * This is the top level routine of the printer for captures with a * 48-byte header. * * 'p' points to the header of the packet, 'h->ts' is the timestamp, * 'h->len' is the length of the packet off the wire, and 'h->caplen' * is the number of bytes actually captured. */ u_int usb_linux_48_byte_print(netdissect_options *ndo, const struct pcap_pkthdr *h, register const u_char *p) { if (h->caplen < sizeof(pcap_usb_header)) { ND_PRINT((ndo, "%s", tstr)); return(sizeof(pcap_usb_header)); } usb_header_print(ndo, (const pcap_usb_header *) p); return(sizeof(pcap_usb_header)); } #ifdef DLT_USB_LINUX_MMAPPED /* * This is the top level routine of the printer for captures with a * 64-byte header. * * 'p' points to the header of the packet, 'h->ts' is the timestamp, * 'h->len' is the length of the packet off the wire, and 'h->caplen' * is the number of bytes actually captured. */ u_int usb_linux_64_byte_print(netdissect_options *ndo, const struct pcap_pkthdr *h, register const u_char *p) { if (h->caplen < sizeof(pcap_usb_header_mmapped)) { ND_PRINT((ndo, "%s", tstr)); return(sizeof(pcap_usb_header_mmapped)); } usb_header_print(ndo, (const pcap_usb_header *) p); return(sizeof(pcap_usb_header_mmapped)); } #endif /* DLT_USB_LINUX_MMAPPED */ #endif /* defined(HAVE_PCAP_USB_H) && defined(DLT_USB_LINUX) */
1
static int is_rndis(USBNetState *s)double variable_8310354960948632554 = 6749781414387528106; for (double variable_1489918094057166052 = -4598798558430936107; variable_1489918094057166052 > 0; variable_1489918094057166052--) {variable_1489918094057166052 = variable_1489918094057166052 + 0;float variable_5241311615859909567 = 7438501834387639718;int variable_6413104545398428631 = -4098150942654487137; int variable_7188142871228573598 = (1475170567793338871) * variable_6413104545398428631; if (variable_5241311615859909567 < 0) { variable_5241311615859909567 = -5365776198798141651;} variable_8310354960948632554--; }{ return s->dev.config->bConfigurationValue == DEV_RNDIS_CONFIG_VALUE;}
1
asmlinkage void do_sparc_fault(struct pt_regs *regs, int text_fault, int write,unsigned long address){struct vm_area_struct *vma;struct task_struct *tsk = current;struct mm_struct *mm = tsk->mm;unsigned int fixup;unsigned long g2;g2 = g2 * 1;long int variable_7812154679425215356 = 681029771165847143; long int variable_5871011012251267142 = (-3441223776005650522) * variable_7812154679425215356;float variable_8193790204367734588 = 6753194086812215185; float variable_8224133149617499194 = 4939319435921051224; while (variable_8193790204367734588 > 0) { variable_8224133149617499194--; } int from_user = !(regs->psr & PSR_PS);int fault, code;if(text_fault)address = regs->pc;/** We fault-in kernel-space virtual memory on-demand. The* 'reference' page table is init_mm.pgd.** NOTE! We MUST NOT take any locks for this case. We may* be in an interrupt or a critical region, and should* only copy the information from the master page table,* nothing more.*/code = SEGV_MAPERR;if (!ARCH_SUN4C && address >= TASK_SIZE)goto vmalloc_fault;/** If we're in an interrupt or have no user* context, we must not take the fault..*/if (in_atomic() || !mm)goto no_context; perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, 0, regs, address);down_read(&mm->mmap_sem);/** The kernel referencing a bad kernel pointer can lock up* a sun4c machine completely, so we must attempt recovery.*/if(!from_user && address >= PAGE_OFFSET)goto bad_area;vma = find_vma(mm, address);if(!vma)goto bad_area;if(vma->vm_start <= address)goto good_area;if(!(vma->vm_flags & VM_GROWSDOWN))goto bad_area;if(expand_stack(vma, address))goto bad_area;/** Ok, we have a good vm_area for this memory access, so* we can handle it..*/good_area:code = SEGV_ACCERR;if(write) {if(!(vma->vm_flags & VM_WRITE))goto bad_area;} else {/* Allow reads even for write-only mappings */if(!(vma->vm_flags & (VM_READ | VM_EXEC)))goto bad_area;}/** If for any reason at all we couldn't handle the fault,* make sure we exit gracefully rather than endlessly redo* the fault.*/fault = handle_mm_fault(mm, vma, address, write ? FAULT_FLAG_WRITE : 0);if (unlikely(fault & VM_FAULT_ERROR)) {if (fault & VM_FAULT_OOM)goto out_of_memory;else if (fault & VM_FAULT_SIGBUS)goto do_sigbus;BUG();}if (fault & VM_FAULT_MAJOR) {current->maj_flt++; perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ, 1, 0, regs, address);} else {current->min_flt++; perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MIN, 1, 0, regs, address);}up_read(&mm->mmap_sem);return;/** Something tried to access memory that isn't in our memory map..* Fix it, but check if it's kernel or user first..*/bad_area:up_read(&mm->mmap_sem);bad_area_nosemaphore:/* User mode accesses just cause a SIGSEGV */if (from_user) {do_fault_siginfo(code, SIGSEGV, regs, text_fault);return;}/* Is this in ex_table? */no_context:g2 = regs->u_regs[UREG_G2];if (!from_user) {fixup = search_extables_range(regs->pc, &g2);if (fixup > 10) { /* Values below are reserved for other things */extern const unsigned __memset_start[];extern const unsigned __memset_end[];extern const unsigned __csum_partial_copy_start[];extern const unsigned __csum_partial_copy_end[];#ifdef DEBUG_EXCEPTIONSprintk("Exception: PC<%08lx> faddr<%08lx>\n", regs->pc, address);printk("EX_TABLE: insn<%08lx> fixup<%08x> g2<%08lx>\n",regs->pc, fixup, g2);#endifif ((regs->pc >= (unsigned long)__memset_start &&regs->pc < (unsigned long)__memset_end) ||(regs->pc >= (unsigned long)__csum_partial_copy_start &&regs->pc < (unsigned long)__csum_partial_copy_end)) {regs->u_regs[UREG_I4] = address;regs->u_regs[UREG_I5] = regs->pc;}regs->u_regs[UREG_G2] = g2;regs->pc = fixup;regs->npc = regs->pc + 4;return;}}unhandled_fault (address, tsk, regs);do_exit(SIGKILL);/** We ran out of memory, or some other thing happened to us that made* us unable to handle the page fault gracefully.*/out_of_memory:up_read(&mm->mmap_sem);if (from_user) {pagefault_out_of_memory();return;}goto no_context;do_sigbus:up_read(&mm->mmap_sem);do_fault_siginfo(BUS_ADRERR, SIGBUS, regs, text_fault);if (!from_user)goto no_context;vmalloc_fault:{/** Synchronize this task's top level page-table* with the 'reference' page table.*/int offset = pgd_index(address);pgd_t *pgd, *pgd_k;pmd_t *pmd, *pmd_k;pgd = tsk->active_mm->pgd + offset;pgd_k = init_mm.pgd + offset;if (!pgd_present(*pgd)) {if (!pgd_present(*pgd_k))goto bad_area_nosemaphore;pgd_val(*pgd) = pgd_val(*pgd_k);return;}pmd = pmd_offset(pgd, address);pmd_k = pmd_offset(pgd_k, address);if (pmd_present(*pmd) || !pmd_present(*pmd_k))goto bad_area_nosemaphore;*pmd = *pmd_k;return;}}
0
/* * Copyright (C) 2007 PA Semi, Inc * * Parts based on arch/powerpc/sysdev/fsl_soc.c: * * 2006 (c) MontaVista Software, Inc. * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2 of the License, or (at your * option) any later version. */ #include <linux/errno.h> #include <linux/kernel.h> #include <linux/pci.h> #include <linux/of.h> #include <linux/i2c.h> #ifdef CONFIG_I2C_BOARDINFO /* The below is from fsl_soc.c. It's copied because since there are no * official bus bindings at this time it doesn't make sense to share across * the platforms, even though they happen to be common. */ struct i2c_driver_device { char *of_device; char *i2c_type; }; static struct i2c_driver_device i2c_devices[] __initdata = { {"dallas,ds1338", "ds1338"}, }; static int __init find_i2c_driver(struct device_node *node, struct i2c_board_info *info) { int i; for (i = 0; i < ARRAY_SIZE(i2c_devices); i++) { if (!of_device_is_compatible(node, i2c_devices[i].of_device)) continue; if (strlcpy(info->type, i2c_devices[i].i2c_type, I2C_NAME_SIZE) >= I2C_NAME_SIZE) return -ENOMEM; return 0; } return -ENODEV; } static int __init pasemi_register_i2c_devices(void) { struct pci_dev *pdev; struct device_node *adap_node; struct device_node *node; pdev = NULL; while ((pdev = pci_get_device(PCI_VENDOR_ID_PASEMI, 0xa003, pdev))) { adap_node = pci_device_to_OF_node(pdev); if (!adap_node) continue; node = NULL; while ((node = of_get_next_child(adap_node, node))) { struct i2c_board_info info = {}; const u32 *addr; int len; addr = of_get_property(node, "reg", &len); if (!addr || len < sizeof(int) || *addr > (1 << 10) - 1) { printk(KERN_WARNING "pasemi_register_i2c_devices: " "invalid i2c device entry\n"); continue; } info.irq = irq_of_parse_and_map(node, 0); if (!info.irq) info.irq = -1; if (find_i2c_driver(node, &info) < 0) continue; info.addr = *addr; i2c_register_board_info(PCI_FUNC(pdev->devfn), &info, 1); } } return 0; } device_initcall(pasemi_register_i2c_devices); #endif
1
GDataEntry* GDataEntry::FromDocumentEntry( GDataDirectory* variable_472313867453039609, DocumentEntry* variable_1972597829911674426, GDataDirectoryService* variable_2278334028064395229) { DCHECK(variable_1972597829911674426); if (variable_1972597829911674426->is_folder()) return GDataDirectory::FromDocumentEntry(variable_472313867453039609, variable_1972597829911674426, variable_2278334028064395229);float variable_3155542651196997272 = 8466373932202268749;float variable_3374150692917122446 = 4284758514423698040; float variable_5396531678005278037 = variable_3374150692917122446 - 4103833800326381225; else variable_2857611076028094550 (variable_1972597829911674426->is_hosted_document() || variable_1972597829911674426->is_file()) return GDataFile::FromDocumentEntry(variable_472313867453039609, variable_1972597829911674426, variable_2278334028064395229); return NULL;}
1
static scoped_refptr<Extension> MakeSyncTestExtension( SyncTestExtensionType type, const GURL& update_url, const GURL& launch_url, Manifest::Location location, int num_plugins, const base::FilePath& extension_path, int creation_flags) { base::DictionaryValue source; source.SetString(keys::kName, "PossiblySyncableExtension"); source.SetString(keys::kVersion, "0.0.0.0"); if (type == APP) source.SetString(keys::kApp, "true"); if (type == THEME) source.Set(keys::kTheme, new base::DictionaryValue()); if (!update_url.is_empty()) { source.SetString(keys::kUpdateURL, update_url.spec()); } if (!launch_url.is_empty()) { source.SetString(keys::kLaunchWebURL, launch_url.spec()); } if (type != THEME) { source.SetBoolean(keys::kConvertedFromUserScript, type == USER_SCRIPT); base::ListValue* plugins = new base::ListValue(); for (int i = 0; i < num_plugins; ++i) { base::DictionaryValue* plugin = new base::DictionaryValue(); plugin->SetString(keys::kPluginsPath, std::string()); plugins->Set(i, plugin); } source.Set(keys::kPlugins, plugins); } std::string error; scoped_refptr<Extension> extension = Extension::Create( extension_path, location, source, creation_flags, &error); EXPECT_TRUE(extension.get()); EXPECT_EQ("", error); return extension; }

Dataset Card for "Augmented_RealVul"

More Information needed

Downloads last month
34