Skip to content

Instantly share code, notes, and snippets.

@teqdruid
teqdruid / spatialc.cf
Last active August 29, 2015 14:25
BNFC Output
PDefs.Program ::= [Def] ;
DefImport. Def ::= "import" [PackageName] ";" ;
DefPackage. Def ::= "package" [PackageName] ";" ;
DefModule. Def ::= "module" Id "{" [ModDef] "}" ;
terminator Def "" ;
DefStorage. ModDef ::= Type Id ";" ;
DefInput. ModDef ::= "input" Type Id ";" ;
DefOutput. ModDef ::= "output" Type Id ";" ;
@teqdruid
teqdruid / gist:cb095c58fef94f4aad23
Created June 24, 2014 19:40
Zynq PMU initialization module
/*
* Kernel module to initialize counters
*/
#include <linux/module.h> /* Needed by all modules */
#include <linux/kernel.h> /* Needed for KERN_ERR */
#include <asm/io.h>
#include <linux/fs.h>
#include <linux/slab.h>
#include <asm/uaccess.h>
@teqdruid
teqdruid / Console output -- no Sleep
Created August 7, 2012 20:25
An attempt at making an ARMv7 kernel module for performance counting
# depmod -a; modprobe pmu_sync_sample ; sleep 0; modprobe -r pmu_sync_sample
dmesg output
[91376.479217] Found 6 counters
[91376.479339] Hello, ARM from core 0
[91376.479492] PMNC registers dump:
[91376.479583] PMNC =0x41093001
[91376.479736] CNTENS=0x8000003f
[91376.479827] INTENS=0x00000000
[91376.479919] FLAGS =0x00000000
@teqdruid
teqdruid / perf_event_template.c
Created April 23, 2012 18:59
Template for using perf_event
/*
============================================================================
Name : branch_mispred.c
Author : John Demme
Version : Mar 21, 2011
Description : A template for perf_event. Requires Linux 2.6.32 or higher
============================================================================
*/
#define _GNU_SOURCE