Skip to content

Instantly share code, notes, and snippets.

@stu9458
stu9458 / Fib.c
Last active August 29, 2015 14:04
Just a test-file
#include<stdio.h>
int Fib(int x);
int Fib(int x)
{
if(x==0)return 0;
if(x==1)return 1;
return fib(x-1)+fib(x-2);
}
int main(void)
{
@stu9458
stu9458 / Env.txt forBBB
Last active October 9, 2017 10:51
uEnv.txt for Beaglebone black
##This will work with: Angstrom's 2013.06.20 u-boot.
loadaddr=0x82000000
fdtaddr=0x88000000
rdaddr=0x88080000
initrd_high=0xffffffff
fdt_high=0xffffffff
loadximage=load mmc 0:2 ${loadaddr} /boot/vmlinuz-${uname_r}
@stu9458
stu9458 / SPI_Master
Created November 3, 2014 03:28
The msp430f5529 SPI code.(By TI example but some error)
/* --COPYRIGHT--,BSD_EX
* Copyright (c) 2012, Texas Instruments Incorporated
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
@stu9458
stu9458 / SPI_Slave
Created November 3, 2014 03:31
MSP430f5529 SPI slave.(TI example but some error)
/* --COPYRIGHT--,BSD_EX
* Copyright (c) 2012, Texas Instruments Incorporated
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
@stu9458
stu9458 / Oscillateur-gpio-rtdm.c
Created November 28, 2014 09:39
That's describe the xenomai gpio module in beaglebone black
#include <linux/cdev.h>
#include <linux/device.h>
#include <linux/fs.h>
#include <linux/gpio.h>
#include <linux/module.h>
#include <linux/sched.h>
#include <linux/version.h>
#include <asm/uaccess.h>
@stu9458
stu9458 / Makefile
Last active August 29, 2015 14:10
Use that to make the oscillateur-gpio-rtdm.c
EXTRA_CFLAGS := -I/home/emp-chen/git/bbb/xenomai-2.6.4/include
ifneq (${KERNELRELEASE},)
obj-m += oscillateur-gpio-rtdm.o
else
ARCH ?= arm
CROSS_COMPILE ?= /home/emp-chen/linux-arm-genuhbi-
KERNEL_DIR = /home/emp-chen/git/bbb/beagle-kernel/kernel
/***************
Use the code to drive interrupt function.
When input "high" to GPIO-20, the GPIO-7 will output a signal between high and low.
****************/
#include <linux/fs.h>
#include <linux/gpio.h>
#include <linux/interrupt.h>
#include <linux/module.h>
#include <rtdm/rtdm_driver.h>
loadximage=load mmc 0:2 ${loadaddr} /boot/vmlinuz-${uname_r}
loadxfdt=load mmc 0:2 ${fdtaddr} /boot/dtbs/${uname_r}/${fdtfile}
loadxrd=load mmc 0:2 ${rdaddr} /boot/initrd.img-${uname_r}; setenv rdsize ${filesize}
loaduEnvtxt=load mmc 0:2 ${loadaddr} /boot/uEnv.txt ; env import -t ${loadaddr} ${filesize};
check_dtb=if test -n ${dtb}; then setenv fdtfile ${dtb};fi;
loadall=run loaduEnvtxt; run check_dtb; run loadximage; run loadxrd; run loadxfdt;
mmcargs=setenv bootargs console=tty0 console=${console} ${optargs} ${cape_disable} ${cape_enable} root=/dev/mmcblk0p2 rootfstype=${mmcrootfstype} ${cmdline}
uenvcmd=run loadall; run mmcargs; bootz ${loadaddr} ${rdaddr}:${rdsize} ${fdtaddr};
@stu9458
stu9458 / rootfs->boot->uEnv.txt(Mapabone)
Created December 10, 2014 15:43
rootfs -> boot -> uEnv.txt
uname_r=3.8.13-bone67
#dtb=
cmdline=quiet init=/lib/systemd/systemd
##Example
#cape_disable=capemgr.disable_partno=
#cape_enable=capemgr.enable_partno=
@stu9458
stu9458 / gist:64892f44dc3989a1f271
Created January 20, 2015 03:37
MSP430F5529-I2C(Slave)
//******************************************************************************
// MSP430F552x Demo - USCI_B0 I2C Slave RX single bytes from MSP430 Master
//
// Description: This demo connects two MSP430's via the I2C bus. The master
// transmits to the slave. This is the slave code. The interrupt driven
// data receiption is demonstrated using the USCI_B0 RX interrupt.
// ACLK = n/a, MCLK = SMCLK = default DCO = ~1.045MHz
//
// ***to be used with "MSP430F55xx_uscib0_i2c_06.c" ***
//