Skip to content

Instantly share code, notes, and snippets.

Avatar

Matthijs van Duin mvduin

View GitHub Profile
@mvduin
mvduin / die.h
Last active Sep 9, 2019
sysfs gpio event example
View die.h
#pragma once
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
[[ noreturn ]]
inline void die( char const *fmt, ... )
{
va_list ap;
va_start( ap, fmt );
View sgx-init.service
# /etc/systemd/system/sgx-init.service
[Unit]
Description=Initialize SGX
BindsTo=dev-dri-sgx.device
After=dev-dri-sgx.device
RefuseManualStop=true
DefaultDependencies=no
[Service]
View omap5-emif.c
struct __attribute__((packed,aligned(4))) Ratios11 {
u32 d0r0 : 11;
u32 d0r1 : 11;
u32 d1r0 : 11;
u32 d1r1 : 11;
u32 d2r0 : 11;
u32 d2r1 : 11;
u32 d3r0 : 11;
u32 d3r1 : 11;
};
@mvduin
mvduin / wsegl.h
Created Jul 20, 2017
wsegl v4, cleaned up
View wsegl.h
/*************************************************************************/ /*!
@Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
@License Dual MIT/GPLv2
The contents of this file are subject to the MIT license as set out below.
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
View sysfs-gpio.h
#pragma once
#include "die.h"
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
struct Gpio {
int fd = -1;
char *path = NULL;
@mvduin
mvduin / demo.asm
Created Mar 21, 2017
clpru code output
View demo.asm
; boilerplate and compiler spam removed for readability
.global ||_Z6istruei||
||_Z6istruei||:
LDI r0.b0, 0x00
QBEQ ||$C$L4||, r14, 0x00
LDI r0.b0, 0x01
||$C$L4||:
MOV r14.b0, r0.b0
JMP r3.w2
@mvduin
mvduin / 1 - empty.c
Created Mar 21, 2017
empty PRU program with clpru
View 1 - empty.c
int main() {
return 0;
}
View shrink-image.sh
#!/bin/bash
set -e
shopt -s lastpipe extglob
if [[ $# != 1 ]]; then
echo "Usage: ${BASH_SOURCE} <device or image file>" >&2
false
fi
View gpio.h
#pragma once
#include "die.h"
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
class Gpio {
int fd = -1;
char *path = NULL;
View icepick.tcl
proc _icepick_ir { jrc ir valbits {regbits 0} } {
set ::$jrc.valbits $valbits
set ::$jrc.regbits $regbits
irscan $jrc $ir
}
proc icepick_ir_bypass { jrc } { _icepick_ir $jrc 0x3f 1 }
proc icepick_ir_idcode { jrc } { _icepick_ir $jrc 0x04 32 }
proc icepick_ir_ipcode { jrc } { _icepick_ir $jrc 0x05 32 }
proc icepick_ir_usrcode { jrc } { _icepick_ir $jrc 0x08 32 }
proc icepick_ir_connect { jrc } { _icepick_ir $jrc 0x07 4 3 }