-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit ce45651
Showing
7 changed files
with
313 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
__pycache__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
<!-- | ||
SPDX-FileCopyrightText: 2014 Coraline Ada Ehmke | ||
SPDX-FileCopyrightText: 2019 Kattni Rembor for Adafruit Industries | ||
SPDX-License-Identifier: CC-BY-4.0 | ||
--> | ||
# Adafruit Community Code of Conduct | ||
|
||
## Our Pledge | ||
|
||
In the interest of fostering an open and welcoming environment, we as | ||
contributors and leaders pledge to making participation in our project and | ||
our community a harassment-free experience for everyone, regardless of age, body | ||
size, disability, ethnicity, gender identity and expression, level or type of | ||
experience, education, socio-economic status, nationality, personal appearance, | ||
race, religion, or sexual identity and orientation. | ||
|
||
## Our Standards | ||
|
||
We are committed to providing a friendly, safe and welcoming environment for | ||
all. | ||
|
||
Examples of behavior that contributes to creating a positive environment | ||
include: | ||
|
||
* Be kind and courteous to others | ||
* Using welcoming and inclusive language | ||
* Being respectful of differing viewpoints and experiences | ||
* Collaborating with other community members | ||
* Gracefully accepting constructive criticism | ||
* Focusing on what is best for the community | ||
* Showing empathy towards other community members | ||
|
||
Examples of unacceptable behavior by participants include: | ||
|
||
* The use of sexualized language or imagery and sexual attention or advances | ||
* The use of inappropriate images, including in a community member's avatar | ||
* The use of inappropriate language, including in a community member's nickname | ||
* Any spamming, flaming, baiting or other attention-stealing behavior | ||
* Excessive or unwelcome helping; answering outside the scope of the question | ||
asked | ||
* Trolling, insulting/derogatory comments, and personal or political attacks | ||
* Promoting or spreading disinformation, lies, or conspiracy theories against | ||
a person, group, organisation, project, or community | ||
* Public or private harassment | ||
* Publishing others' private information, such as a physical or electronic | ||
address, without explicit permission | ||
* Other conduct which could reasonably be considered inappropriate | ||
|
||
The goal of the standards and moderation guidelines outlined here is to build | ||
and maintain a respectful community. We ask that you don’t just aim to be | ||
"technically unimpeachable", but rather try to be your best self. | ||
|
||
We value many things beyond technical expertise, including collaboration and | ||
supporting others within our community. Providing a positive experience for | ||
other community members can have a much more significant impact than simply | ||
providing the correct answer. | ||
|
||
## Our Responsibilities | ||
|
||
Project leaders are responsible for clarifying the standards of acceptable | ||
behavior and are expected to take appropriate and fair corrective action in | ||
response to any instances of unacceptable behavior. | ||
|
||
Project leaders have the right and responsibility to remove, edit, or | ||
reject messages, comments, commits, code, issues, and other contributions | ||
that are not aligned to this Code of Conduct, or to ban temporarily or | ||
permanently any community member for other behaviors that they deem | ||
inappropriate, threatening, offensive, or harmful. | ||
|
||
## Moderation | ||
|
||
Instances of behaviors that violate the Adafruit Community Code of Conduct | ||
may be reported by any member of the community. Community members are | ||
encouraged to report these situations, including situations they witness | ||
involving other community members. | ||
|
||
You may report in the following ways: | ||
|
||
In any situation, you may send an email to <[email protected]>. | ||
|
||
On the Adafruit Discord, you may send an open message from any channel | ||
to all Community Moderators by tagging @community moderators. You may | ||
also send an open message from any channel, or a direct message to | ||
@kattni#1507, @tannewt#4653, @danh#1614, @cater#2442, | ||
@sommersoft#0222, @Mr. Certainly#0472 or @Andon#8175. | ||
|
||
Email and direct message reports will be kept confidential. | ||
|
||
In situations on Discord where the issue is particularly egregious, possibly | ||
illegal, requires immediate action, or violates the Discord terms of service, | ||
you should also report the message directly to Discord. | ||
|
||
These are the steps for upholding our community’s standards of conduct. | ||
|
||
1. Any member of the community may report any situation that violates the | ||
Adafruit Community Code of Conduct. All reports will be reviewed and | ||
investigated. | ||
2. If the behavior is an egregious violation, the community member who | ||
committed the violation may be banned immediately, without warning. | ||
3. Otherwise, moderators will first respond to such behavior with a warning. | ||
4. Moderators follow a soft "three strikes" policy - the community member may | ||
be given another chance, if they are receptive to the warning and change their | ||
behavior. | ||
5. If the community member is unreceptive or unreasonable when warned by a | ||
moderator, or the warning goes unheeded, they may be banned for a first or | ||
second offense. Repeated offenses will result in the community member being | ||
banned. | ||
|
||
## Scope | ||
|
||
This Code of Conduct and the enforcement policies listed above apply to all | ||
Adafruit Community venues. This includes but is not limited to any community | ||
spaces (both public and private), the entire Adafruit Discord server, and | ||
Adafruit GitHub repositories. Examples of Adafruit Community spaces include | ||
but are not limited to meet-ups, audio chats on the Adafruit Discord, or | ||
interaction at a conference. | ||
|
||
This Code of Conduct applies both within project spaces and in public spaces | ||
when an individual is representing the project or its community. As a community | ||
member, you are representing our community, and are expected to behave | ||
accordingly. | ||
|
||
## Attribution | ||
|
||
This Code of Conduct is adapted from the [Contributor Covenant][homepage], | ||
version 1.4, available at | ||
<https://www.contributor-covenant.org/version/1/4/code-of-conduct.html>, | ||
and the [Rust Code of Conduct](https://www.rust-lang.org/en-US/conduct.html). | ||
|
||
For other projects adopting the Adafruit Community Code of | ||
Conduct, please contact the maintainers of those projects for enforcement. | ||
If you wish to use this code of conduct for your own project, consider | ||
explicitly mentioning your moderation policy or making a copy with your | ||
own moderation policy so as to avoid confusion. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2013, 2014 Damien P. George | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
|
||
# SPI Flash Analyzer for Logic 2 | ||
|
||
|
||
[![Box with Discord user count](https://img.shields.io/discord/327254708534116352.svg)](https://adafru.it/discord) | ||
[![Box with MIT license](https://img.shields.io/badge/License-MIT-brightgreen.svg)](https://choosealicense.com/licenses/mit/) | ||
|
||
This is a basic high level analyzer for Saleae Logic 2 that interprets semi-standard SPI flash commands. The output can be limited by command type and data commands can also be limited by address. One can add the analyzer multiple times to get separate analysis tracks for different types of commands. | ||
|
||
![Screenshot of the extension](screenshot.png) | ||
|
||
## Installation | ||
|
||
In Logic 2, click extensions on the right hand side. | ||
|
||
### To Use | ||
|
||
Under the three dot, more menu, click `Check for Updates` then install the `SPI Flash` extension. | ||
|
||
### To Develop | ||
|
||
1. Clone this repo locally. | ||
2. Under the three dot, more menu, click `Load Existing Extension...` and then select the local repo location. | ||
|
||
## Usage | ||
1. Click the analyzers tab. | ||
2. Add a `SPI` analyzer and configure it for your capture. | ||
3. Add a `SPI Flash` analyzer. | ||
4. Set the `SPI` analyzer as the Input Analyzer. | ||
5. `Min Address`, `Max Address` and `Decode Level` are optional. | ||
6. Change `Address Bytes` to match |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
# High Level Analyzer | ||
# For more information and documentation, please go to https://support.saleae.com/extensions/high-level-analyzer-extensions | ||
|
||
from saleae.analyzers import HighLevelAnalyzer, AnalyzerFrame, StringSetting, NumberSetting, ChoicesSetting | ||
|
||
import struct | ||
|
||
DATA_COMMANDS = {0x03: "Read", | ||
0x0b: "Fast Read", | ||
0x02: "Page Program", | ||
0x32: "Quad Page Program"} | ||
|
||
CONTROL_COMMANDS = { | ||
0x06: "Write Enable", | ||
0x05: "Read Status Register", | ||
0x75: "Program Suspend" | ||
} | ||
|
||
# High level analyzers must subclass the HighLevelAnalyzer class. | ||
class SPIFlash(HighLevelAnalyzer): | ||
# List of settings that a user can set for this High Level Analyzer. | ||
address_bytes = NumberSetting(min_value=1, max_value=4) | ||
min_address = NumberSetting(min_value=0) | ||
max_address = NumberSetting(min_value=0) | ||
decode_level = ChoicesSetting(choices=('Everything', 'Only Data', 'Only Errors', 'Only Control')) | ||
|
||
# An optional list of types this analyzer produces, providing a way to customize the way frames are displayed in Logic 2. | ||
result_types = { | ||
'error': { | ||
'format': 'Error!' | ||
}, | ||
'control_command': { | ||
'format': '{{data.command}}' | ||
}, | ||
'data_command': { | ||
'format': '{{data.command}} 0x{{data.address}}' | ||
} | ||
} | ||
|
||
def __init__(self): | ||
''' | ||
Initialize HLA. | ||
Settings can be accessed using the same name used above. | ||
''' | ||
self._start_time = None | ||
self._address_format = "{:0" + str(2*int(self.address_bytes)) + "x}" | ||
self._min_address = int(self.min_address) | ||
self._max_address = None | ||
if self.max_address: | ||
self._max_address = int(self.max_address) | ||
|
||
def decode(self, frame: AnalyzerFrame): | ||
''' | ||
Process a frame from the input analyzer, and optionally return a single `AnalyzerFrame` or a list of `AnalyzerFrame`s. | ||
The type and data values in `frame` will depend on the input analyzer. | ||
''' | ||
|
||
if frame.type == "enable": | ||
self._start_time = frame.start_time | ||
self._miso_data = bytearray() | ||
self._mosi_data = bytearray() | ||
elif frame.type == "result": | ||
if self._miso_data is None or self._mosi_data is None: | ||
print(frame) | ||
return | ||
self._miso_data.extend(frame.data["miso"]) | ||
self._mosi_data.extend(frame.data["mosi"]) | ||
elif frame.type == "disable": | ||
if not self._miso_data or not self._mosi_data: | ||
return | ||
command = self._mosi_data[0] | ||
frame_type = None | ||
frame_data = {"command": command} | ||
if command in DATA_COMMANDS: | ||
if len(self._mosi_data) < 1 + int(self.address_bytes): | ||
frame_type = "error" | ||
else: | ||
frame_type = "data_command" | ||
frame_data["command"] = DATA_COMMANDS[command] | ||
frame_address = 0 | ||
for i in range(int(self.address_bytes)): | ||
frame_address <<= 8 | ||
frame_address += self._mosi_data[1+i] | ||
if self.min_address > 0 and frame_address < self._min_address: | ||
frame_type = None | ||
elif self.max_address and frame_address > self.max_address: | ||
frame_type = None | ||
else: | ||
frame_data["address"] = self._address_format.format(frame_address) | ||
else: | ||
if command in CONTROL_COMMANDS: | ||
frame_data["command"] = CONTROL_COMMANDS[command] | ||
frame_type = "control_command" | ||
our_frame = None | ||
if frame_type: | ||
our_frame = AnalyzerFrame(frame_type, | ||
self._start_time, | ||
frame.end_time, | ||
frame_data) | ||
self._miso_data = None | ||
self._mosi_data = None | ||
if self.decode_level == 'Only Data' and frame_type == "control_command": | ||
return None | ||
if self.decode_level == 'Only Errors' and frame_type != "error": | ||
return None | ||
if self.decode_level == "Only Control" and frame_type != "control_command": | ||
return None | ||
return our_frame | ||
else: | ||
print(frame) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"name": "SPI Flash", | ||
"apiVersion": "1.0.0", | ||
"author": "Scott Shawcroft for Adafruit", | ||
"version": "0.8.0", | ||
"description": "Annotate common SPI flash commands", | ||
"extensions": { | ||
"SPI Flash": { | ||
"type": "HighLevelAnalyzer", | ||
"entryPoint": "SPIFlashAnalyzer.SPIFlash" | ||
} | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.