Skip to content

Instantly share code, notes, and snippets.

@giuliomoro
giuliomoro / gist:457c8cde1eda6190a28566b3288d38c0
Last active October 27, 2016 01:51
xenomai shared memory causes mode switches
#include <sys/mman.h>
#include <sys/stat.h> /* For mode constants */
#include <fcntl.h> /* For O_* constants */
#include <stdio.h>
#include <error.h>
#include <errno.h>
#include <native/task.h>
#define SHM_NAME "/myshared"
#
# Automatically generated file; DO NOT EDIT.
# Linux/arm 3.8.13 Kernel Configuration
#
CONFIG_ARM=y
CONFIG_IPIPE_WANT_ACTIVE_MM=y
CONFIG_SYS_SUPPORTS_APM_EMULATION=y
CONFIG_GENERIC_GPIO=y
CONFIG_HAVE_PROC_CPU=y
CONFIG_STACKTRACE_SUPPORT=y
@giuliomoro
giuliomoro / gist:0b553fd15611a439c3eef6115b3e2122
Created April 26, 2017 00:09
This is the diff between the stock BBBW and the BBBW that works for me for Bela on 4.4.61 (I basically diffed BBB vs BBG and tried to disable the same things (HDMI, some McASP) in the BBBW:
diff --git a/bbbw.bak b/bbbw
index 91791c1..7e1e10e 100644
--- a/bbbw.bak
+++ b/bbbw
@@ -989,18 +989,6 @@
phandle = <0x32>;
};
- nxp_hdmi_bonelt_pins {
- pinctrl-single,pins = <0x1b0 0x3 0xa0 0x8 0xa4 0x8 0xa8 0x8 0xac 0x8 0xb0 0x8 0xb4 0x8 0xb8 0x8 0xbc 0x8 0xc0 0x8 0xc4 0x8 0xc8 0x8 0xcc 0x8 0xd0 0x8 0xd4 0x8 0xd8 0x8 0xdc 0x8 0xe0 0x0 0xe4 0x0 0xe8 0x0 0xec 0x0>;
@giuliomoro
giuliomoro / _main.pd
Created July 2, 2018 22:17
a 7Mb _main.pd
This file has been truncated, but you can view the full file.
#N canvas 0 22 450 300 10;
#N canvas 0 22 450 278 (subpatch) 0;
#X array array1 1.7e+06 float 3;
#A 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
// Pass audio data between two RtThreads bi-directionally.
// This should create a slave RtThread.
// The master thread should be a RtThread.
// The master thread starts a transmission;
// the slave thread should be woken up when there is data available,
// process the data, and send data back to the master thread
// Uni-directional RT-safe-queue.
// A light wrapper around __wrap_mq_...
class DataFifo
@giuliomoro
giuliomoro / uEnv.txt
Last active October 16, 2018 00:39
uEnv.txt for CTAG image, place in /uEnv.txt
uenvcmd=echo loading am335x-bonegreen-ctag-face.dtb; load mmc ${mmcid}:1 ${fdtaddr} boot/dtbs/${uname_r}/am335x-bonegreen-ctag-face.dtb; if env exists uboot_overlay_addr0; then setenv overlay ${uboot_overlay_addr0}; run bela_loadoverlay; fi; if env exists uboot_overlay_addr1; then setenv overlay ${uboot_overlay_addr1}; run bela_loadoverlay; fi; if env exists uboot_overlay_addr2; then setenv overlay ${uboot_overlay_addr2}; run bela_loadoverlay; fi; if env exists uboot_overlay_addr3; then setenv overlay ${uboot_overlay_addr3}; run bela_loadoverlay; fi; if env exists uboot_overlay_addr4; then setenv overlay ${uboot_overlay_addr4}; run bela_loadoverlay; fi; if env exists uboot_overlay_addr5; then setenv overlay ${uboot_overlay_addr5}; run bela_loadoverlay; fi; if env exists uboot_overlay_addr6; then setenv overlay ${uboot_overlay_addr6}; run bela_loadoverlay; fi; if env exists uboot_overlay_addr7; then setenv overlay ${uboot_overlay_addr7}; run bela_loadoverlay; fi; load mmc ${mmcid}:1 ${loadaddr} /boot/vmlinuz-$
/*
* Default render file for Bela projects running Pd patches
* using libpd.
*/
#include <Bela.h>
#include <DigitalChannelManager.h>
#include <cmath>
#include <stdio.h>
#define PD_THREADED_IO
```
/*
* Default render file for Bela projects running Pd patches
* using libpd.
*/
#include <Bela.h>
#include <DigitalChannelManager.h>
#include <cmath>
#include <stdio.h>
@giuliomoro
giuliomoro / flash_mainline.sh
Created September 23, 2019 12:19
update uboot (locally or remotely) on a single-partition SD card with BeagleBoard image.
#!/bin/bash -ex
MLO=MLO
IMG=u-boot.img
if [ ! "x${SSH_DEST}" = "x" ]; then
SSH_CMD="ssh -tt $SSH_DEST"
scp $MLO ${SSH_DEST}:MLO
scp $IMG ${SSH_DEST}:uboot.img
MLO=MLO
IMG=uboot.img
else
/*
____ _____ _ _
| __ )| ____| | / \
| _ \| _| | | / _ \
| |_) | |___| |___ / ___ \
|____/|_____|_____/_/ \_\
The platform for ultra-low latency audio and sensor processing
http://bela.io