Idea: Convert APIs that takes addresses in HALs to take `anytype`.
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 15/100
- Tipo de issue
- Refactorización
- Claridad
- Bastante claro
- Estado de actividad
- Estancado
- Área
- embedded-iot
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- Zig
- Estrellas
- 2.3k
- Forks
- 198
- Merge medio
- 1 d 8 h
- PR fusionados (30 d)
- 37
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de ZigEmbeddedGroup/microzig
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
ZigEmbeddedGroup/microzig#1086 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 69/100
ZigEmbeddedGroup/microzig#1085 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
ZigEmbeddedGroup/microzig#1061 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
ZigEmbeddedGroup/microzig#1059 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
regz: AVR peripherals generated at address 0 when the register-group name matches the module (ATDF)Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
ZigEmbeddedGroup/microzig#1072 ·
Los mantenedores suelen responder en 1 día
Todos los issues de ZigEmbeddedGroup/microzig
Issues similares
-
docs
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
adidshaft/grok-gadgets#202 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
FujiNetWIFI/fujinet-firmware#1908 ·
Los mantenedores suelen responder en 1 día
-
firmware: transmit() doesn't reset rfTxCurBufIdx, so RFxmit after RFxmitLong can send wrong bytesPosiblemente ocupada @hermes-crew-337 la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
atlas0fd00m/rfcat#182 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
-
followup
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
Los mantenedores suelen responder en 1 día