Skip to content

Commit

Permalink
Update zig master (#407)
Browse files Browse the repository at this point in the history
  • Loading branch information
tact1m4n3 authored Mar 11, 2025
1 parent 4be8f2b commit 61b0ecc
Show file tree
Hide file tree
Showing 56 changed files with 119,111 additions and 748 deletions.
8 changes: 4 additions & 4 deletions core/src/core/usb.zig
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ pub fn Usb(comptime f: anytype) type {
var usb_config: ?*DeviceConfiguration = null;
/// The clock has been initialized [Y/n]
var clk_init: bool = false;
var itf_to_drv: [f.cfg_max_interfaces_count]u8 = .{0} ** f.cfg_max_interfaces_count;
var ep_to_drv: [f.cfg_max_endpoints_count][2]u8 = .{.{0} ** 2} ** f.cfg_max_endpoints_count;
var itf_to_drv: [f.cfg_max_interfaces_count]u8 = @splat(0);
var ep_to_drv: [f.cfg_max_endpoints_count][2]u8 = @splat(@splat(0));
pub const max_packet_size = if (f.high_speed) 512 else 64;
const drvid_invalid = 0xff;

Expand All @@ -77,7 +77,7 @@ pub fn Usb(comptime f: anytype) type {
var started = false;
// Some scratch space that we'll use for things like preparing string
// descriptors for transmission.
var tmp: [128]u8 = .{0} ** 128;
var tmp: [128]u8 = @splat(0);
// Keeps track of sent data from tmp buffer
var buffer_reader = BufferReader{ .buffer = &.{} };
// Last setup packet request
Expand Down Expand Up @@ -654,7 +654,7 @@ pub const UsbUtils = struct {
/// Convert an utf8 into an utf16 (little endian) string
pub fn utf8ToUtf16Le(comptime s: []const u8) [s.len << 1]u8 {
const l = s.len << 1;
var ret: [l]u8 = .{0} ** l;
var ret: [l]u8 = @splat(0);
var i: usize = 0;
while (i < s.len) : (i += 1) {
ret[i << 1] = s[i];
Expand Down
20 changes: 11 additions & 9 deletions core/src/cpus/avr5.zig
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@ const std = @import("std");
const microzig = @import("microzig");
const root = @import("root");

pub fn enable_interrupts() void {
asm volatile ("sei");
}
pub const interrupt = struct {
pub fn enable_interrupts() void {
asm volatile ("sei");
}

pub fn disable_interrupts() void {
asm volatile ("cli");
}
pub fn disable_interrupts() void {
asm volatile ("cli");
}
};

pub inline fn sbi(comptime reg: u5, comptime bit: u3) void {
asm volatile ("sbi %[reg], %[bit]"
Expand Down Expand Up @@ -51,7 +53,7 @@ pub const vector_table_asm = blk: {
break :blk asm_str;
};

fn vector_table() callconv(.Naked) noreturn {
fn vector_table() callconv(.naked) noreturn {
asm volatile (vector_table_asm);
}

Expand Down Expand Up @@ -93,13 +95,13 @@ fn make_isr_handler(comptime name: []const u8, comptime func: anytype) type {
}

pub const startup_logic = struct {
export fn microzig_unhandled_vector() callconv(.C) noreturn {
export fn microzig_unhandled_vector() callconv(.c) noreturn {
@panic("Unhandled interrupt");
}

extern fn microzig_main() noreturn;

export fn microzig_start() callconv(.C) noreturn {
export fn microzig_start() callconv(.c) noreturn {
// At startup the stack pointer is at the end of RAM
// so, no need to set it manually!

Expand Down
Loading

0 comments on commit 61b0ecc

Please sign in to comment.