Skip to content

Instantly share code, notes, and snippets.

View sjlongland's full-sized avatar

Stuart Longland sjlongland

View GitHub Profile
@sjlongland
sjlongland / arm_cortex_m3_mutex.c
Last active January 17, 2018 13:26 — forked from hdznrrd/arm_cortex_m3_mutex.c
basic implementation of a no-block / no-wait mutex for ARM Cortex M3 and compatible models
/*!
* Cortex M3 mutex implementation.
* Ported to gcc by Stuart Longland <stuartl@vrt.com.au>
*
* Credit: https://gist.github.com/hdznrrd/4032002
*/
#ifndef _CM3MUTEX_H
#define _CM3MUTEX_H
@sjlongland
sjlongland / portable_endian.h
Last active March 8, 2024 06:10 — forked from panzi/portable_endian.h
This provides the endian conversion functions form endian.h on Windows, Linux, *BSD, and Mac OS X. You still need to use -std=gnu99 instead of -std=c99 for gcc. The functions might actually be macros. Functions: htobe16, htole16, be16toh, le16toh, htobe32, htole32, be32toh, le32toh, htobe64, htole64, be64toh, le64toh. License: I hereby put "port…
// "License": Public Domain
// I, Mathias Panzenböck, place this file hereby into the public domain. Use it at your own risk for whatever you like.
// In case there are jurisdictions that don't support putting things in the public domain you can also consider it to
// be "dual licensed" under the BSD, MIT and Apache licenses, if you want to. This code is trivial anyway. Consider it
// an example on how to get the endian conversion functions on different platforms.
#ifndef PORTABLE_ENDIAN_H__
#define PORTABLE_ENDIAN_H__
#if (defined(_WIN16) || defined(_WIN32) || defined(_WIN64)) && !defined(__WINDOWS__)