Idea: Convert APIs that takes addresses in HALs to take `anytype`.
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 15/100
- issue の種類
- リファクタリング
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 領域
- embedded-iot
調査の方向性
Start with the trigger_transfer function on the DMA Channel enum shown in the diff, and with the call sites that pass @intFromPtr(...) values. Survey which HAL functions take raw addresses as u32 or usize, and check how callers pass them. The issue is a proposal, not a settled change, so done means agreeing on the API direction with maintainers first. Only then would you add pointer checks and update the callers.
索引モデルが issue の本文から書いたものです。
説明
We have a bunch of functions that take addresses in our various HALs, but the type is often u32 or usize.
We should evaluate how they are used, and see if people tend to call them with points (e.g. by providing a slice or array) or an actual int.
In the former case, they'd have to do something like @intFromPtr, which is fine, but a bit annoying.
We can improve the ergonomics of these APIs (if we find that usage common) by having the type be anytype, and make type checks to ensure it is a pointer or appropriate type.
@@ -95,14 +95,16 @@ pub const Channel = enum(u4) {
pub fn trigger_transfer(
chan: Channel,
- write_addr: u32,
- read_addr: u32,
+ write_addr: anytype,
+ read_addr: anytype,
count: u32,
config: TransferConfig,
) void {
+ comptime if (@typeInfo(@TypeOf(write_addr)) != .pointer) @compileError("write_addr must be a pointer");
+ comptime if (@typeInfo(@TypeOf(read_addr)) != .pointer) @compileError("read_addr must be a pointer");
const regs = chan.get_regs();
- regs.read_addr = read_addr;
- regs.write_addr = write_addr;
+ regs.read_addr = @intFromPtr(read_addr);
+ regs.write_addr = @intFromPtr(write_addr);
regs.trans_count = count;
regs.ctrl_trig.modify(.{
.EN = @intFromBool(config.enable),
This allows the client to have a cleaner call:
channel.?.trigger_transfer(
- @intFromPtr(dst[0..dst.len].ptr),
- @intFromPtr(hello[0..src.len].ptr),
+ dst[0..dst.len].ptr,
+ src[0..hello.len].ptr,
src.len,
.{
Of course, we can allow ints of the appropriate size as well, and we can write a helper to verify the type.
- 主要言語
- Zig
- スター
- 2.3k
- フォーク
- 198
- 平均マージ
- 1日 8時間
- マージ済み PR(30日)
- 37
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
ZigEmbeddedGroup/microzig のほかの issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
ZigEmbeddedGroup/microzig#1086 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 69/100
ZigEmbeddedGroup/microzig#1085 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
ZigEmbeddedGroup/microzig#1061 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
ZigEmbeddedGroup/microzig#1059 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
regz: AVR peripherals generated at address 0 when the register-group name matches the module (ATDF)オープン
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
ZigEmbeddedGroup/microzig#1072 ·
メンテナーはふだん 1 日以内に返信
ZigEmbeddedGroup/microzig の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
immortalwrt/immortalwrt#2501 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
zephyrproject-rtos/zephyr#122261 ·
メンテナーはふだん 3 日以内に返信
-
area: core priority: p2 type: bug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
EPFL-TOP/smart-microscope-control#132 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
FujiNetWIFI/fujinet-config#264 ·
メンテナーはふだん 1 日以内に返信
-
scope:mqtt-bridge type:feature
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
メンテナーはふだん 1 日以内に返信