Giter VIP home page Giter VIP logo

canarium's Introduction

Canarium - PERIDOT board driver

CanariumはChrome/Node.jsアプリケーション用のPERIDOTボードドライバです。

通信仕様

通信仕様世代 対応ボードのシリーズ コンフィグ*1 Avalon-MM
マスタ*2
ストリーム
入出力*3
Canarium
バージョン
プラットフォーム
Gen1 PERIDOT Classic および
PERIDOT New Generations
対応 対応 非対応 ^0.9
>=1.0
Chrome (^0.9.x)
Node.js (>=1.0)
Gen2 PERIDOT New Generations 非対応 対応 対応 >=1.0 Node.js

*1) RBF(やRPD)を転送して、FPGAのコンフィグレーションをリアルタイムで行う機能。
*2) CanariumからQsys上のペリフェラル(Avalon-MM Slave)にアクセスする機能。
*3) Avalon-STやNiosII上の疑似ストリームファイルにデータを入出力する機能。

APIリファレンス

対応ボード種別通信仕様クラス名とAPIリファレンスへのリンク
PERIDOT ClassicGen1Canarium または
CanariumGen1 (Canarium の別名として定義)
PERIDOT Piccolo (BOOT側)
PERIDOT Piccolo (USER側)
※Rubic対応ファームの場合
Gen2CanariumGen2

使用例 / Examples (Gen1)

const { Canarium } = require('canarium');
const fs = require('fs');

let canarium = new Canarium();
// Connect to PERIDOT Classic (PS mode) on COM3 port
canarium.open('COM3')
.then(() => {
    // Program FPGA
    return canarium.config(fs.readFileSync('test.rbf'));
})
.then(() => {
    // Read memory
    return canarium.avm.read(0x10000000, 256);
})
.then((data) => {
    // Show memory dump
    console.log(data);

    // Disconnect
    return canarium.close();
});

使用例 / Examples (Gen2)

const { CanariumGen2 } = require('canarium');

// Connect to PERIDOT with Gen2 I/F on COM3 port
let canarium = new CanariumGen2('COM3');
canarium.open()
.then(() => {
    // Create writable stream on Channel 8
    let txStream = canarium.createWriteStream(8);
    txStream.write(...);
.then(() => {
    // ...
})
.then(() => {
    // Disconnect from board
    canarium.close();
});

インストール方法 / How to install

  • npm install canarium

変更履歴 / History

See CHANGELOG.md

ライセンス / License

This package is distributed under MIT license.

canarium's People

Contributors

kimushu avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Forkers

osafune

canarium's Issues

自動切断検知ができない

具体的にどのバージョンから発生したかは不明であるが、
少なくとも Chrome 52.0 にて、自動切断の検知ができなくなっている。
エラー時のメッセージが "system_error" に変更されており、エラーハンドリングができていない。

callback内で例外発生させると、callbackが再度呼び出される

すべての非同期APIにおいて、正常終了時のコールバック callback(true, ...) 内部で例外を発生させると、
異常終了時のコールバック callback(false, ...) が再帰呼び出しされる。
期待する動作は、異常終了時のコールバックは呼び出されず、ブラウザが例外をキャッチすることである。

コンフィグ済みの判定ロジック改善

open()内部でのconfiguredの判定に、現在はAS/PSスイッチ状態を用いているが、
スイッチ状態は必ずしもコンフィグレーションの状態を示しておらず、CONF_DONE(CPLD応答bit2)を用いるべきである。

そうすることで、以下のような場合にも正しく判定できる。

  • SW=ASだがコンフィグレーションされていない場合 (EPCSがEraseされている等)
  • NewGenを繋いだ場合 (そもそも応答する相手がいる時点でコンフィグ済みなので)

同時に、config()関数については、ボードが1stGenである場合に限定して使えるように改善する。
判定ロジックはboardInfoのシリアル番号先頭4桁(J72A:1stGen)を用いるのがよい。

open時にID等のチェックを同時に実施するAPIが欲しい

ボードIDのチェックやRBFの書き込みを同時に実行してくれるopenが欲しい。(@osafune さんの要望)

イメージとしては、Canarium#openのAPIプロトタイプを以下のように変更する案がある。
open(path, [config], [callback])
ここで config は

{
  id: "許容するIDを示す文字列または許容できるかを調べる関数(省略可)",
  serialCode: "許容するシリアルコードを示す文字列または許容出来るかを調べる関数(省略可)",
  rbfdata: 書き込むRBFのArrayBuffer(省略可)
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.