[repo] purge the repo to reduce its scope to the Fluksometer v1 firmware

This commit is contained in:
Bart Van Der Meerssche 2011-06-16 00:02:59 +02:00
parent f1cfba46bd
commit 1fb5d7f4f9
10532 changed files with 0 additions and 710888 deletions

View File

@ -1,83 +0,0 @@
//
// avrlibdefs.h : AVRlib global defines and macros include file
//
// Copyright (c) 2001-2002 Pascal Stang
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
//
// $Id$
#ifndef AVRLIBDEFS_H
#define AVRLIBDEFS_H
// Code compatibility to new AVR-libc
// outb(), inb(), inw(), outw(), BV(), sbi(), cbi(), sei(), cli()
#ifndef outb
#define outb(addr, data) addr = (data)
#endif
#ifndef inb
#define inb(addr) (addr)
#endif
#ifndef outw
#define outw(addr, data) addr = (data)
#endif
#ifndef inw
#define inw(addr) (addr)
#endif
#ifndef BV
#define BV(bit) (1<<(bit))
#endif
#ifndef cbi
#define cbi(reg,bit) reg &= ~(BV(bit))
#endif
#ifndef sbi
#define sbi(reg,bit) reg |= (BV(bit))
#endif
#ifndef cli
#define cli() __asm__ __volatile__ ("cli" ::)
#endif
#ifndef sei
#define sei() __asm__ __volatile__ ("sei" ::)
#endif
// support for individual port pin naming in the mega128
// see port128.h for details
#ifdef __AVR_ATmega128__
// not currently necessary due to inclusion
// of these defines in newest AVR-GCC
// do a quick test to see if include is needed
#ifndef PD0
#include "port128.h"
#endif
#endif
// use this for packed structures
// (this is seldom necessary on an 8-bit architecture like AVR,
// but can assist in code portability to AVR)
#define GNUC_PACKED __attribute__((packed))
// port address helpers
#define DDR(x) ((x)-1) // address of data direction register of port x
#define PIN(x) ((x)-2) // address of input register of port x
// MIN/MAX/ABS macros
#define MIN(a,b) ((a<b)?(a):(b))
#define MAX(a,b) ((a>b)?(a):(b))
#define ABS(x) ((x>0)?(x):(-x))
// constants
#define PI 3.14159265359
#endif

View File

@ -1,84 +0,0 @@
//
// avrlibtypes.h : AVRlib global types and typedefines include file
//
// Copyright (c) 2001-2002 Pascal Stang
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
//
// $Id$
#ifndef AVRLIBTYPES_H
#define AVRLIBTYPES_H
#ifndef WIN32
// true/false defines
#define FALSE 0
#define TRUE -1
#endif
// datatype definitions macros
typedef unsigned char u08;
typedef signed char s08;
typedef unsigned short u16;
typedef signed short s16;
typedef unsigned long u32;
typedef signed long s32;
typedef unsigned long long u64;
typedef signed long long s64;
/* use inttypes.h instead
// C99 standard integer type definitions
typedef unsigned char uint8_t;
typedef signed char int8_t;
typedef unsigned short uint16_t;
typedef signed short int16_t;
typedef unsigned long uint32_t;
typedef signed long int32_t;
typedef unsigned long uint64_t;
typedef signed long int64_t;
*/
// maximum value that can be held
// by unsigned data types (8,16,32bits)
#define MAX_U08 255
#define MAX_U16 65535
#define MAX_U32 4294967295
// maximum values that can be held
// by signed data types (8,16,32bits)
#define MIN_S08 -128
#define MAX_S08 127
#define MIN_S16 -32768
#define MAX_S16 32767
#define MIN_S32 -2147483648
#define MAX_S32 2147483647
#ifndef WIN32
// more type redefinitions
typedef unsigned char BOOL;
typedef unsigned char BYTE;
typedef unsigned int WORD;
typedef unsigned long DWORD;
typedef unsigned char UCHAR;
typedef unsigned int UINT;
typedef unsigned short USHORT;
typedef unsigned long ULONG;
typedef char CHAR;
typedef int INT;
typedef long LONG;
#endif
#endif

View File

@ -1,269 +0,0 @@
//
// basiciotest.c : test code for the io and buffer ops of the UART and SPI ports
//
// Copyright (c) 2010 flukso.net
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
//
// $Id$
#include <avr/io.h>
#include <avr/interrupt.h>
#include <avr/eeprom.h>
#include <util/delay.h>
#include "uart.h"
#include "spi.h"
#include "ctrl.h"
#define NO_OP_1 1
#define NO_OP_2 2
#define START_TX 4
#define TRANSMIT 8
#define HIGH_HEX 16
#define TO_FROM_UART 32
#define NEW_CTRL_MSG 64
#define SPI_END_OF_TX 0x00
#define SPI_END_OF_MESSAGE '.'
#define SPI_FORWARD_TO_UART_PORT 'u'
#define SPI_FORWARD_TO_CTRL_PORT 'l' // 'l'ocal port
volatile uint8_t spi_status, high_hex;
// hex to binary/byte decoding
uint8_t htob(uint16_t hex)
{
uint8_t low_hex = (uint8_t) hex;
uint8_t high_hex = (uint8_t) (hex >> 8);
uint8_t byte;
byte = (high_hex > 0x40) ? (high_hex & 0x0F) + 9 : high_hex & 0x0F;
byte = byte << 4;
byte |= (low_hex > 0x40) ? (low_hex & 0x0F) + 9 : low_hex & 0x0F;
return byte;
}
// binary/byte to hex encoding
uint16_t btoh(uint8_t byte)
{
uint8_t low_nibble = (byte & 0x0F);
uint8_t high_nibble = (byte & 0xF0) >> 4;
uint16_t hex;
hex = (high_nibble > 0x09) ? high_nibble - 9 + 0x60 : high_nibble + 0x30;
hex = hex << 8;
hex |= (low_nibble > 0x09) ? low_nibble - 9 + 0x60 : low_nibble + 0x30;
return hex;
}
ISR(SPI_STC_vect)
{
uint8_t spi_rx, rx, tx;
uint16_t spi_tx;
// the SPI is double-buffered, requiring two NO_OPs when switching from Tx to Rx
if (spi_status & (NO_OP_1 | NO_OP_2)) {
spi_status--;
return;
}
// do we have to transmit the first byte?
if (spi_status & START_TX) {
received_from_spi(SPI_FORWARD_TO_CTRL_PORT);
spi_status &= ~START_TX;
return;
}
// are we in Tx mode?
if (spi_status & TRANSMIT) {
if (spi_status & HIGH_HEX) {
received_from_spi(high_hex);
spi_status &= ~HIGH_HEX;
return;
}
if (spi_status & TO_FROM_UART) {
if (!uartReceiveByte(&tx)) {
received_from_spi(SPI_END_OF_TX);
spi_status &= ~TRANSMIT;
spi_status |= NO_OP_2;
return;
}
}
else {
if (ctrlGetFromTxBuffer(&tx)) {
if (tx == SPI_END_OF_MESSAGE) {
received_from_spi(tx);
return;
}
}
else {
received_from_spi(SPI_FORWARD_TO_UART_PORT);
spi_status |= TO_FROM_UART;
return;
}
}
spi_tx = btoh(tx);
high_hex = (uint8_t)spi_tx;
spi_status |= HIGH_HEX;
received_from_spi((uint8_t)(spi_tx >> 8));
return;
}
// we're in Rx mode
switch (spi_rx = received_from_spi(0x00)) {
case SPI_END_OF_TX:
spi_status |= TRANSMIT | START_TX;
spi_status &= ~(HIGH_HEX | TO_FROM_UART);
break;
case SPI_END_OF_MESSAGE:
if (!(spi_status & TO_FROM_UART)) {
ctrlAddToRxBuffer(spi_rx);
spi_status |= NEW_CTRL_MSG;
}
break;
case SPI_FORWARD_TO_UART_PORT:
spi_status |= TO_FROM_UART;
break;
case SPI_FORWARD_TO_CTRL_PORT:
spi_status &= ~TO_FROM_UART;
break;
default:
if (spi_status & HIGH_HEX) {
rx = htob(((uint16_t)high_hex << 8) + spi_rx);
if (spi_status & TO_FROM_UART) {
uartAddToTxBuffer(rx);
}
else {
ctrlAddToRxBuffer(rx);
}
}
else {
high_hex = spi_rx;
}
// toggle the HEX bit in spi_status
spi_status ^= HIGH_HEX;
}
}
ISR(TIMER1_COMPA_vect)
{
/* void */
}
ISR(ANALOG_COMP_vect)
{
uint8_t i;
PORTB |= (1<<PB0);
//disable uC sections to consume less power while writing to EEPROM
//disable UART Tx and Rx:
UCSR0B &= ~((1<<RXEN0) | (1<<TXEN0));
//disable ADC:
ADCSRA &= ~(1<<ADEN);
for (i=0; i<128; i++)
eeprom_write_byte((uint8_t *)i, i);
//enable UART Tx and Rx:
UCSR0B |= (1<<RXEN0) | (1<<TXEN0);
// enable ADC and start a first ADC conversion
ADCSRA |= (1<<ADEN) | (1<<ADSC);
PORTB &= ~(1<<PB0);
}
void setup_pulse_input(void)
{
// PD2=INT0 and PD3=INT1 configuration
// set as input pin with 20k pull-up enabled
PORTD |= (1<<PD2) | (1<<PD3);
// INT0 and INT1 to trigger an interrupt on a falling edge
EICRA = (1<<ISC01) | (1<<ISC11);
// enable INT0 and INT1 interrupts
EIMSK = (1<<INT0) | (1<<INT1);
}
void setup_timer1(void)
{
// Timer1 clock prescaler set to 1 => fTOV1 = 3686.4kHz / 65536 = 56.25Hz (DS p.134)
TCCR1B |= (1<<CS10);
// Increase sampling frequency to 2kHz (= 667Hz per channel) with an error of 0.01% (DS p.122)
OCR1A = 0x0732;
// Timer1 set to CTC mode (DS p.133)
TCCR1B |= 1<<WGM12;
// Enable output compare match interrupt for timer1 (DS p.136)
TIMSK1 |= (1<<OCIE1A);
#if DBG > 0
// Set PB1=OC1A as output pin
DDRB |= (1<<DDB1);
// Toggle pin OC1A=PB1 on compare match
TCCR1A |= 1<<COM1A0;
#endif
}
void setup_analog_comparator(void)
{
// analog comparator setup for brown-out detection
// PD7=AIN1 configured by default as input to obtain high impedance
// disable digital input cicuitry on AIN0 and AIN1 pins to reduce leakage current
DIDR1 |= (1<<AIN1D) | (1<<AIN0D);
// comparing AIN1 (Vcc/4.4) to bandgap reference (1.1V)
// bandgap select | AC interrupt enable | AC interrupt on rising edge (DS p.243)
ACSR |= (1<<ACBG) | (1<<ACIE) | (1<<ACIS1) | (1<<ACIS0);
}
int main(void)
{
// RS-485: Configure PD5=DE as output pin with low as default
DDRD |= (1<<DDD5);
// set high to transmit
//PORTD |= (1<<PD5);
setup_timer1();
setup_pulse_input();
setup_analog_comparator();
// initialize the CTRL buffers
ctrlInit();
// initialize the UART hardware and buffers
uartInit();
// initialize the SPI in slave mode
setup_spi(SPI_MODE_0, SPI_MSB, SPI_INTERRUPT, SPI_SLAVE);
for(;;) {
if (spi_status & NEW_CTRL_MSG) {
ctrlRxToTxLoop();
spi_status &= ~NEW_CTRL_MSG;
}
// toggle the LED=PB0 pin
_delay_ms(50);
DDRB ^= (1<<PB0);
}
return 0;
}

View File

@ -1,153 +0,0 @@
//
// buffer.c : Multipurpose byte buffer structure and methods
//
// Copyright (c) 2001 Pascal Stang
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
//
// $Id$
#include "buffer.h"
#include "global.h"
#include "avr/io.h"
#ifndef CRITICAL_SECTION_START
#define CRITICAL_SECTION_START unsigned char _sreg = SREG; cli()
#define CRITICAL_SECTION_END SREG = _sreg
#endif
// global variables
// initialization
void bufferInit(cBuffer* buffer, unsigned char *start, unsigned short size)
{
// begin critical section
CRITICAL_SECTION_START;
// set start pointer of the buffer
buffer->dataptr = start;
buffer->size = size;
// initialize index and length
buffer->dataindex = 0;
buffer->datalength = 0;
// end critical section
CRITICAL_SECTION_END;
}
// access routines
unsigned char bufferGetFromFront(cBuffer* buffer)
{
unsigned char data = 0;
// begin critical section
CRITICAL_SECTION_START;
// check to see if there's data in the buffer
if(buffer->datalength)
{
// get the first character from buffer
data = buffer->dataptr[buffer->dataindex];
// move index down and decrement length
buffer->dataindex++;
if(buffer->dataindex >= buffer->size)
{
buffer->dataindex -= buffer->size;
}
buffer->datalength--;
}
// end critical section
CRITICAL_SECTION_END;
// return
return data;
}
void bufferDumpFromFront(cBuffer* buffer, unsigned short numbytes)
{
// begin critical section
CRITICAL_SECTION_START;
// dump numbytes from the front of the buffer
// are we dumping less than the entire buffer?
if(numbytes < buffer->datalength)
{
// move index down by numbytes and decrement length by numbytes
buffer->dataindex += numbytes;
if(buffer->dataindex >= buffer->size)
{
buffer->dataindex -= buffer->size;
}
buffer->datalength -= numbytes;
}
else
{
// flush the whole buffer
buffer->datalength = 0;
}
// end critical section
CRITICAL_SECTION_END;
}
unsigned char bufferGetAtIndex(cBuffer* buffer, unsigned short index)
{
// begin critical section
CRITICAL_SECTION_START;
// return character at index in buffer
unsigned char data = buffer->dataptr[(buffer->dataindex+index)%(buffer->size)];
// end critical section
CRITICAL_SECTION_END;
return data;
}
unsigned char bufferAddToEnd(cBuffer* buffer, unsigned char data)
{
// begin critical section
CRITICAL_SECTION_START;
// make sure the buffer has room
if(buffer->datalength < buffer->size)
{
// save data byte at end of buffer
buffer->dataptr[(buffer->dataindex + buffer->datalength) % buffer->size] = data;
// increment the length
buffer->datalength++;
// end critical section
CRITICAL_SECTION_END;
// return success
return -1;
}
// end critical section
CRITICAL_SECTION_END;
// return failure
return 0;
}
unsigned short bufferIsNotFull(cBuffer* buffer)
{
// begin critical section
CRITICAL_SECTION_START;
// check to see if the buffer has room
// return true if there is room
unsigned short bytesleft = (buffer->size - buffer->datalength);
// end critical section
CRITICAL_SECTION_END;
return bytesleft;
}
void bufferFlush(cBuffer* buffer)
{
// begin critical section
CRITICAL_SECTION_START;
// flush contents of the buffer
buffer->datalength = 0;
// end critical section
CRITICAL_SECTION_END;
}

View File

@ -1,73 +0,0 @@
//
// buffer.h : Multipurpose byte buffer structure and methods
//
// This byte-buffer structure provides an easy and efficient way to store
// and process a stream of bytes. You can create as many buffers as you
// like (within memory limits), and then use this common set of functions to
// access each buffer. The buffers are designed for FIFO operation (first
// in, first out). This means that the first byte you put in the buffer
// will be the first one you get when you read out the buffer. Supported
// functions include buffer initialize, get byte from front of buffer, add
// byte to end of buffer, check if buffer is full, and flush buffer. The
// buffer uses a circular design so no copying of data is ever necessary.
// This buffer is not dynamically allocated, it has a user-defined fixed
// maximum size. This buffer is used in many places in the avrlib code.
//
// Copyright (c) 2001-2002 Pascal Stang
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
//
// $Id$
#ifndef BUFFER_H
#define BUFFER_H
// structure/typdefs
//! cBuffer structure
typedef struct struct_cBuffer
{
unsigned char *dataptr; ///< the physical memory address where the buffer is stored
unsigned short size; ///< the allocated size of the buffer
unsigned short datalength; ///< the length of the data currently in the buffer
unsigned short dataindex; ///< the index into the buffer where the data starts
} cBuffer;
// function prototypes
//! initialize a buffer to start at a given address and have given size
void bufferInit(cBuffer* buffer, unsigned char *start, unsigned short size);
//! get the first byte from the front of the buffer
unsigned char bufferGetFromFront(cBuffer* buffer);
//! dump (discard) the first numbytes from the front of the buffer
void bufferDumpFromFront(cBuffer* buffer, unsigned short numbytes);
//! get a byte at the specified index in the buffer (kind of like array access)
// ** note: this does not remove the byte that was read from the buffer
unsigned char bufferGetAtIndex(cBuffer* buffer, unsigned short index);
//! add a byte to the end of the buffer
unsigned char bufferAddToEnd(cBuffer* buffer, unsigned char data);
//! check if the buffer is full/not full (returns zero value if full)
unsigned short bufferIsNotFull(cBuffer* buffer);
//! flush (clear) the contents of the buffer
void bufferFlush(cBuffer* buffer);
#endif

View File

@ -1,468 +0,0 @@
//
// ctrl.c : AVR uC code for ctrl buffer initialisation and put/get ops
//
// Copyright (c) 2010 flukso.net
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
//
// $Id$
#include <avr/eeprom.h>
#include <util/crc16.h>
#include "global.h"
#include "main.h"
#include "buffer.h"
#include "ctrl.h"
#include "encode.h"
cBuffer ctrlRxBuffer; // ctrl receive buffer
cBuffer ctrlTxBuffer; // ctrl transmit buffer
static char ctrlRxData[CTRL_RX_BUFFER_SIZE];
static char ctrlTxData[CTRL_TX_BUFFER_SIZE];
extern struct version_struct EEMEM EEPROM_version;
extern struct version_struct version;
extern struct event_struct EEMEM EEPROM_event;
extern struct event_struct event;
extern uint8_t EEMEM EEPROM_enabled;
extern uint8_t enabled;
extern uint8_t EEMEM EEPROM_phy_to_log[MAX_SENSORS];
extern uint8_t phy_to_log[MAX_SENSORS];
extern struct sensor_struct EEMEM EEPROM_sensor[MAX_SENSORS];
extern struct sensor_struct sensor[MAX_SENSORS];
extern struct state_struct state[MAX_SENSORS];
void ctrlInit(void)
{
// initialize the CTRL receive buffer
bufferInit(&ctrlRxBuffer, (u08*) ctrlRxData, CTRL_RX_BUFFER_SIZE);
// initialize the CTRL transmit buffer
bufferInit(&ctrlTxBuffer, (u08*) ctrlTxData, CTRL_TX_BUFFER_SIZE);
}
uint8_t ctrlTxBufferIsEmpty(void)
{
if(ctrlTxBuffer.datalength == 0) {
return TRUE;
}
else {
return FALSE;
}
}
uint8_t ctrlAddToTxBuffer(uint8_t data)
{
return bufferAddToEnd(&ctrlTxBuffer, data);
}
uint8_t ctrlGetFromTxBuffer(uint8_t* data) {
// make sure we have data in the Tx buffer
if(ctrlTxBuffer.datalength) {
// get byte from beginning of buffer
*data = bufferGetFromFront(&ctrlTxBuffer);
return TRUE;
}
else {
// no data
return FALSE;
}
}
uint8_t ctrlRxBufferIsEmpty(void)
{
if(ctrlRxBuffer.datalength == 0) {
return TRUE;
}
else {
return FALSE;
}
}
uint8_t ctrlAddToRxBuffer(uint8_t data)
{
return bufferAddToEnd(&ctrlRxBuffer, data);
}
uint8_t ctrlGetFromRxBuffer(uint8_t* pdata)
{
// make sure we have data in the Rx buffer
if(ctrlRxBuffer.datalength) {
// get byte from beginning of buffer
*pdata = bufferGetFromFront(&ctrlRxBuffer);
return TRUE;
}
else {
// no data
return FALSE;
}
}
void ctrlFlushRxBuffer(void)
{
ctrlRxBuffer.datalength = 0;
}
void ctrlFlushTxBuffer(void)
{
ctrlTxBuffer.datalength = 0;
}
uint8_t ctrlReadCharFromRxBuffer(uint8_t* pdata)
{
uint8_t high_hex, low_hex;
if (ctrlGetFromRxBuffer(&high_hex) && ctrlGetFromRxBuffer(&low_hex)) {
htob(high_hex, low_hex, pdata);
return TRUE;
}
else {
return FALSE;
}
}
uint8_t ctrlReadShortFromRxBuffer(uint16_t* pdata)
{
uint8_t high_char, low_char;
if(ctrlReadCharFromRxBuffer(&high_char) && ctrlReadCharFromRxBuffer(&low_char)) {
*pdata = ((uint16_t)high_char << 8) + low_char;
return TRUE;
}
else {
return FALSE;
}
}
uint8_t ctrlReadLongFromRxBuffer(uint32_t* pdata)
{
uint16_t high_short, low_short;
if(ctrlReadShortFromRxBuffer(&high_short) && ctrlReadShortFromRxBuffer(&low_short)) {
*pdata = ((uint32_t)high_short << 16) + low_short;
return TRUE;
}
else {
return FALSE;
}
}
uint8_t ctrlWriteCharToTxBuffer(uint8_t data)
{
uint8_t high_hex, low_hex;
btoh(data, &high_hex, &low_hex);
if (ctrlAddToTxBuffer(high_hex) && ctrlAddToTxBuffer(low_hex)) {
return TRUE;
}
else {
return FALSE;
}
}
uint8_t ctrlWriteShortToTxBuffer(uint16_t data)
{
if (ctrlWriteCharToTxBuffer((uint8_t)(data >> 8)) && ctrlWriteCharToTxBuffer((uint8_t)data)) {
return TRUE;
}
else {
return FALSE;
}
}
uint8_t ctrlWriteLongToTxBuffer(uint32_t data)
{
if (ctrlWriteShortToTxBuffer((uint16_t)(data >> 16)) && ctrlWriteShortToTxBuffer((uint16_t)data)) {
return TRUE;
}
else {
return FALSE;
}
}
void ctrlRxToTxLoop(void)
{
uint8_t data;
while (ctrlGetFromRxBuffer(&data)) {
ctrlAddToTxBuffer(data);
}
}
uint8_t ctrlCalcCrc8(cBuffer* buffer, uint8_t chop)
{
uint8_t i, crc = 0;
for (i = 0; i < buffer->datalength - chop; i++) {
crc = _crc_ibutton_update(crc, bufferGetAtIndex(buffer, i));
}
return crc;
}
uint8_t ctrlExtractCrc8fromMessage(cBuffer* buffer)
{
uint8_t crc, high_hex, low_hex;
high_hex = bufferGetAtIndex(buffer, buffer->datalength - 2);
low_hex = bufferGetAtIndex(buffer, buffer->datalength - 1);
htob(high_hex, low_hex, &crc);
return crc;
}
void ctrlDecode(void)
{
uint8_t cmd[2], crc;
ctrlFlushTxBuffer();
crc = ctrlExtractCrc8fromMessage(&ctrlRxBuffer);
if (ctrlCalcCrc8(&ctrlRxBuffer, 2) != crc) {
ctrlAddToTxBuffer('z');
ctrlAddToTxBuffer('z');
}
else if (ctrlGetFromRxBuffer(cmd) && ctrlGetFromRxBuffer(cmd+1)) {
ctrlAddToTxBuffer(cmd[0]);
ctrlAddToTxBuffer(cmd[1]);
switch (cmd[0]) {
case 'g': /* get */
ctrlCmdGet(cmd[1]);
break;
case 's': /* set */
ctrlCmdSet(cmd[1]);
break;
case 'c': /* commit */
if (cmd[1] == 't') ctrlCmdCommit();
break;
}
}
else {
ctrlAddToTxBuffer('z');
ctrlAddToTxBuffer('y');
}
crc = ctrlCalcCrc8(&ctrlTxBuffer, 0);
ctrlWriteCharToTxBuffer(crc);
ctrlAddToTxBuffer('.');
ctrlFlushRxBuffer();
}
void ctrlCmdGet(uint8_t cmd)
{
uint8_t i = 0;
uint32_t tmp32, tmp32_bis;
switch (cmd) {
case 'h': /* hardware {major,minor} version */
ctrlWriteShortToTxBuffer(version.hw_major);
ctrlWriteCharToTxBuffer(version.hw_minor);
break;
case 's': /* software {major,minor} version */
ctrlWriteCharToTxBuffer(version.sw_major);
ctrlWriteCharToTxBuffer(version.sw_minor);
break;
case 'e': /* sensor enabled | disabled */
ctrlReadCharFromRxBuffer(&i);
if (i < MAX_SENSORS) {
ctrlWriteCharToTxBuffer(i);
ctrlWriteCharToTxBuffer((enabled >> i) & 0x01);
}
break;
case 'p': /* phy-to-logical mapping */
for (i = 0 ; i < MAX_SENSORS; i++) {
ctrlWriteCharToTxBuffer(phy_to_log[i]);
}
break;
case 'c': /* sensor counter value */
ctrlReadCharFromRxBuffer(&i);
if (i < MAX_SENSORS) {
cli();
tmp32 = sensor[i].counter;
sei();
ctrlWriteCharToTxBuffer(i);
ctrlWriteLongToTxBuffer(tmp32);
}
break;
case 'm': /* sensor meterconstant */
ctrlReadCharFromRxBuffer(&i);
if (i < MAX_SENSORS) {
ctrlWriteCharToTxBuffer(i);
ctrlWriteShortToTxBuffer(sensor[i].meterconst);
}
break;
case 'w': /* watchdog counter */
ctrlWriteShortToTxBuffer(event.wdt);
break;
case 'b': /* brown-out counter */
ctrlWriteShortToTxBuffer(event.brown_out);
break;
case 'd': /* delta: all changes since last gd */
for (i = 0 ; i < MAX_SENSORS; i++) {
if (state[i].flags & (STATE_PULSE | STATE_POWER)) {
ctrlWriteCharToTxBuffer(i);
cli();
tmp32 = sensor[i].counter;
tmp32_bis = (i < MAX_ANALOG_SENSORS) ? state[i].power : state[i].timestamp;
state[i].flags &= ~(STATE_PULSE | STATE_POWER);
sei();
ctrlWriteLongToTxBuffer(tmp32);
ctrlWriteLongToTxBuffer(tmp32_bis);
}
}
break;
}
}
void ctrlCmdSet(uint8_t cmd)
{
uint8_t i = 0, tmp8 = 0;
uint16_t tmp16 = 0;
uint32_t tmp32 = 0;
switch (cmd) {
case 'h': /* hardware {major,minor} version */
ctrlReadShortFromRxBuffer(&version.hw_major);
ctrlReadCharFromRxBuffer(&version.hw_minor);
ctrlWriteShortToTxBuffer(version.hw_major);
ctrlWriteCharToTxBuffer(version.hw_minor);
break;
case 's': /* software {major,minor} version */
ctrlReadCharFromRxBuffer(&version.sw_major);
ctrlReadCharFromRxBuffer(&version.sw_minor);
ctrlWriteCharToTxBuffer(version.sw_major);
ctrlWriteCharToTxBuffer(version.sw_minor);
break;
case 'e': /* sensor enabled | disabled */
ctrlReadCharFromRxBuffer(&i);
if (i < MAX_SENSORS) {
ctrlReadCharFromRxBuffer(&tmp8);
if (tmp8) {
enabled |= (1 << i);
}
else {
enabled &= ~(1 << i);
}
ctrlWriteCharToTxBuffer(i);
ctrlWriteCharToTxBuffer((enabled >> i) & 0x01);
}
break;
case 'p': /* phy-to-logical mapping */
for (i = 0 ; i < MAX_SENSORS; i++) {
ctrlReadCharFromRxBuffer(&tmp8);
cli();
phy_to_log[i] = tmp8;
sei();
ctrlWriteCharToTxBuffer(phy_to_log[i]);
}
break;
case 'c': /* sensor counter value */
ctrlReadCharFromRxBuffer(&i);
if (i < MAX_SENSORS) {
ctrlReadLongFromRxBuffer(&tmp32);
cli();
sensor[i].counter = tmp32;
sei();
ctrlWriteCharToTxBuffer(i);
ctrlWriteLongToTxBuffer(tmp32);
}
break;
case 'm': /* sensor meterconstant */
ctrlReadCharFromRxBuffer(&i);
if (i < MAX_SENSORS) {
ctrlReadShortFromRxBuffer(&tmp16);
cli();
sensor[i].meterconst = tmp16;
sei();
ctrlWriteCharToTxBuffer(i);
ctrlWriteShortToTxBuffer(sensor[i].meterconst);
}
break;
case 'w': /* watchdog counter */
ctrlReadShortFromRxBuffer(&tmp16);
cli();
event.wdt = tmp16;
sei();
ctrlWriteShortToTxBuffer(event.wdt);
break;
case 'b': /* brown-out counter */
ctrlReadShortFromRxBuffer(&tmp16);
cli();
event.brown_out = tmp16;
sei();
ctrlWriteShortToTxBuffer(event.brown_out);
break;
}
}
void ctrlCmdCommit(void)
{
cli();
eeprom_update_block((const void*)&version, (void*)&EEPROM_version, sizeof(version));
eeprom_update_block((const void*)&event, (void*)&EEPROM_event, sizeof(event));
eeprom_update_block((const void*)&enabled, (void*)&EEPROM_enabled, sizeof(enabled));
eeprom_update_block((const void*)&phy_to_log, (void*)&EEPROM_phy_to_log, sizeof(phy_to_log));
eeprom_update_block((const void*)&sensor, (void*)&EEPROM_sensor, sizeof(sensor));
sei();
}

View File

@ -1,153 +0,0 @@
//
// ctrl.h : AVR uC code for ctrl buffer initialisation and put/get ops
//
// Copyright (c) 2010 flukso.net
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
//
// $Id$
#ifndef CTRL_H
#define CTRL_H
#endif
#include <inttypes.h>
#include "buffer.h"
#ifndef CTRL_RX_BUFFER_SIZE
#define CTRL_RX_BUFFER_SIZE 32
#endif
#ifndef CTRL_TX_BUFFER_SIZE
#define CTRL_TX_BUFFER_SIZE 32
#endif
/**
* Initialize the ctrl receive and transmit buffers.
*
* Overrule the default Rx and Tx ctrl buffer size (32 bytes) in the makefile.
*/
void ctrlInit(void);
/**
* Check whether the ctrl Tx buffer is empty.
*
* @return TRUE/FALSE if empty/not empty
*/
uint8_t ctrlTxBufferIsEmpty(void);
/**
* Add a byte to the ctrl Tx buffer's tail.
*
* @param data the byte to be added to the buffer's tail
* @return TRUE/FALSE if byte could/could not be written
*/
uint8_t ctrlAddToTxBuffer(uint8_t data);
/**
* Fetch a byte from the ctrl Tx buffer's head.
*
* @param data pointer where the byte has to be written
* @return TRUE/FALSE if a byte could be fetched/not fetched
*/
uint8_t ctrlGetFromTxBuffer(uint8_t* data);
/**
* Check whether the ctrl Rx buffer is empty.
*
* @return TRUE/FALSE if empty/not empty
*/
uint8_t ctrlRxBufferIsEmpty(void);
/**
* Add a byte to the ctrl Rx buffer.
*
* @param data the byte to be added to the buffer's tail
* @return TRUE/FALSE if empty/not empty
*/
uint8_t ctrlAddToRxBuffer(uint8_t data);
/**
* Fetch a byte from the ctrl Rx buffer's head.
*
* @param data pointer where the byte has to be written
* @return TRUE/FALSE if a byte could be fetched/not fetched
*/
uint8_t ctrlGetFromRxBuffer(uint8_t* data);
/**
* Flush the ctrl Rx buffer.
*
*/
void ctrlFlushRxBuffer(void);
/**
* Flush the ctrl Tx buffer.
*
*/
void ctrlFlushTxBuffer(void);
/**
* Loop all bytes from the ctrl Rx to Tx buffer.
*
*/
void ctrlRxToTxLoop(void);
/**
* Calculate the CRC-8 checksum over the bytes in the buffer.
*
* @param buffer pointer to the buffer containing the data
* @param chop chop number of bytes from end of buffer for crc calc
* @return CRC-8 checksum
*/
uint8_t ctrlCalcCrc8(cBuffer* buffer, uint8_t chop);
/**
* Extract the CRC-8 checksum out of the message in the buffer.
*
* @param buffer pointer to the buffer containing the message
* @return CRC-8 checksum
*/
uint8_t ctrlExtractCrc8fromMessage(cBuffer* buffer);
/**
* Decode the message in the ctrl Rx buffer and dispatch to either ctrlCmdGet,
* ctrlCmdSet or ctrlCmdCommit.
*
*/
void ctrlDecode(void);
/**
* Execute the get command with parameters present in the ctrl Rx buffer.
* The command's reply is written to the ctrl Tx buffer.
*
* @param cmd get command issued
*/
void ctrlCmdGet(uint8_t cmd);
/**
* Execute the set command with parameters present in the ctrl Rx buffer.
* The command's reply is written to the ctrl Tx buffer. In case of a set
* command this will typically only be the two-letter command ID issued.
*
* @param cmd set command issued
*/
void ctrlCmdSet(uint8_t cmd);
/**
* Commit all previous changes by writing the datastructures to EEPROM.
*
*/
void ctrlCmdCommit(void);

View File

@ -1,20 +0,0 @@
#if DBG > 0
/* set LED pin high/low at the start/end of an ISR */
#define DBG_ISR_BEGIN() PORTB |= (1<<PB0)
#define DBG_ISR_END() PORTB &= ~(1<<PB0)
/* Set PB1=OC1A as output pin and toggle this pin on TIMER1 compare match */
#define DBG_OC1A_TOGGLE() DDRB |= (1<<DDB1); \
TCCR1A |= 1<<COM1A0
#define DBG_LED_ON() /* nothing */
#define DBG_LED_OFF() /* nothing */
#else
#define DBG_ISR_BEGIN() /* nothing */
#define DBG_ISR_END() /* nothing */
#define DBG_OC1A_TOGGLE() /* nothing */
/* LED behaviour in non-debugging mode */
#define DBG_LED_ON() PORTB &= ~(1<<PB0)
#define DBG_LED_OFF() PORTB |= (1<<PB0)
#endif

View File

@ -1,18 +0,0 @@
#include <stdint.h>
// hex to binary/byte decoding
static inline void htob(uint8_t high_hex, uint8_t low_hex, uint8_t *pbyte)
{
*pbyte = (high_hex > 0x40) ? (high_hex & 0x0F) + 9 : high_hex & 0x0F;
*pbyte = *pbyte << 4;
*pbyte |= (low_hex > 0x40) ? (low_hex & 0x0F) + 9 : low_hex & 0x0F;
}
// binary/byte to hex encoding
static inline void btoh(uint8_t byte, uint8_t *phigh_hex, uint8_t *plow_hex)
{
*plow_hex = byte & 0x0F;
*plow_hex = (*plow_hex > 0x09) ? *plow_hex - 9 + 0x60 : *plow_hex + 0x30;
*phigh_hex = (byte & 0xF0) >> 4;
*phigh_hex = (*phigh_hex > 0x09) ? *phigh_hex - 9 + 0x60 : *phigh_hex + 0x30;
}

View File

@ -1,54 +0,0 @@
//
// global.h : AVR project global include
//
// Copyright (c) 2001-2002 Pascal Stang
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
//
// $Id$
#ifndef GLOBAL_H
#define GLOBAL_H
// global AVRLIB defines
#include "avrlibdefs.h"
// global AVRLIB types definitions
#include "avrlibtypes.h"
// project/system dependent defines
// CPU clock speed
//#define F_CPU 16000000 // 16MHz processor
//#define F_CPU 14745000 // 14.745MHz processor
//#define F_CPU 8000000 // 8MHz processor
//#define F_CPU 7372800 // 7.37MHz processor
//#define F_CPU 4000000 // 4MHz processor
//#define F_CPU 3686400 // 3.69MHz processor
#define CYCLES_PER_US ((F_CPU+500000)/1000000) // cpu cycles per microsecond
#define DISABLE_PORT 0xff
#define MAX_SENSORS 6
#define MAX_ANALOG_SENSORS 3
#define ENABLE_ALL_SENSORS ((1 << MAX_SENSORS) - 1)
#define DISABLE_ALL_SENSORS 0x00
/* 0xff is the default sensor id for non-assigned ports and is disabled by default
a further check is done against the 'enabled' bitfield */
#define ENABLED(x) (x != 0xff) && (enabled & (1 << x))
#endif

View File

@ -1,433 +0,0 @@
//
// basiciotest.c : test code for the io and buffer ops of the UART and SPI ports
//
// Copyright (c) 2010 flukso.net
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
//
// $Id$
#include <stdlib.h>
#include <avr/io.h>
#include <avr/interrupt.h>
#include <avr/eeprom.h>
#include <avr/power.h>
#include <util/delay.h>
#include "debug.h"
#include "main.h"
#include "uart.h"
#include "spi.h"
#include "ctrl.h"
#include "global.h"
#include "encode.h"
register uint8_t spi_status asm("r7");
uint8_t spi_high_hex;
uint8_t EEMEM first_EEPROM_byte_not_used_to_protect_from_brownout_corruption = 0xbe;
struct version_struct EEMEM EEPROM_version =
{HW_VERSION_MAJOR, HW_VERSION_MINOR, SW_VERSION_MAJOR, SW_VERSION_MINOR};
struct version_struct version;
struct event_struct EEMEM EEPROM_event = {0, 0};
struct event_struct event;
uint8_t EEMEM EEPROM_enabled = DISABLE_ALL_SENSORS;
uint8_t enabled;
uint8_t EEMEM EEPROM_phy_to_log[MAX_SENSORS] =
{DISABLE_PORT, DISABLE_PORT, DISABLE_PORT, DISABLE_PORT, DISABLE_PORT, DISABLE_PORT};
uint8_t phy_to_log[MAX_SENSORS];
struct sensor_struct EEMEM EEPROM_sensor[MAX_SENSORS];
volatile struct sensor_struct sensor[MAX_SENSORS];
volatile struct state_struct state[MAX_SENSORS];
uint8_t muxn = 0;
uint16_t timer = 0;
struct time_struct time = {0, 0};
ISR(SPI_STC_vect)
{
uint8_t spi_rx, spi_tx, rx, tx;
DBG_ISR_BEGIN();
// the SPI is double-buffered, requiring two NO_OPs when switching from Tx to Rx
if (spi_status & (SPI_NO_OP_1 | SPI_NO_OP_2)) {
spi_status--;
DBG_LED_ON();
goto finish;
}
// do we have to transmit the first byte?
if (spi_status & SPI_START_TX) {
received_from_spi(SPI_FORWARD_TO_CTRL_PORT);
spi_status &= ~SPI_START_TX;
goto finish;
}
// are we in Tx mode?
if (spi_status & SPI_TRANSMIT) {
if (spi_status & SPI_HIGH_HEX) {
received_from_spi(spi_high_hex); /* actually low hex ! */
spi_status &= ~SPI_HIGH_HEX;
goto finish;
}
if (spi_status & SPI_TO_FROM_UART) {
if (!uartReceiveByte(&tx)) {
received_from_spi(SPI_END_OF_TX);
spi_status &= ~SPI_TRANSMIT;
spi_status |= SPI_NO_OP_2;
goto finish;
}
}
else {
if (ctrlGetFromTxBuffer(&tx)) {
received_from_spi(tx);
goto finish;
}
else {
received_from_spi(SPI_FORWARD_TO_UART_PORT);
spi_status |= SPI_TO_FROM_UART;
goto finish;
}
}
btoh(tx, &spi_tx, (uint8_t *)&spi_high_hex); /* actually low hex ! */
spi_status |= SPI_HIGH_HEX;
received_from_spi(spi_tx);
goto finish;
}
// we're in Rx mode
switch (spi_rx = received_from_spi(0x00)) {
case SPI_END_OF_TX:
spi_status |= SPI_TRANSMIT | SPI_START_TX;
spi_status &= ~(SPI_HIGH_HEX | SPI_TO_FROM_UART);
break;
case SPI_END_OF_MESSAGE:
if (!(spi_status & SPI_TO_FROM_UART)) {
spi_status |= SPI_NEW_CTRL_MSG;
}
break;
case SPI_FORWARD_TO_UART_PORT:
spi_status |= SPI_TO_FROM_UART;
DBG_LED_OFF();
break;
case SPI_FORWARD_TO_CTRL_PORT:
spi_status &= ~SPI_TO_FROM_UART;
DBG_LED_OFF();
break;
default:
if (spi_status & SPI_HIGH_HEX) {
htob(spi_high_hex, spi_rx, &rx);
uartAddToTxBuffer(rx);
}
else {
if (spi_status & SPI_TO_FROM_UART) {
spi_high_hex = spi_rx;
}
else {
ctrlAddToRxBuffer(spi_rx);
goto finish;
}
}
// toggle the HEX bit in spi_status
spi_status ^= SPI_HIGH_HEX;
}
finish:
DBG_ISR_END();
}
ISR(INT0_vect)
{
DBG_ISR_BEGIN();
uint8_t sensor_id = phy_to_log[PORT_PULSE_1];
if (ENABLED(sensor_id))
register_pulse(&sensor[sensor_id], &state[sensor_id]);
DBG_ISR_END();
}
ISR(INT1_vect)
{
DBG_ISR_BEGIN();
uint8_t sensor_id = phy_to_log[PORT_PULSE_2];
if (ENABLED(sensor_id))
register_pulse(&sensor[sensor_id], &state[sensor_id]);
DBG_ISR_END();
}
void register_pulse(volatile struct sensor_struct *psensor, volatile struct state_struct *pstate)
{
psensor->counter += psensor->meterconst;
pstate->flags |= STATE_PULSE;
pstate->timestamp = time.ms;
}
ISR(TIMER1_COMPA_vect)
{
DBG_ISR_BEGIN();
uint8_t sensor_id = phy_to_log[muxn];
if (ENABLED(sensor_id)) {
/* clear the power calculation lock when starting a new 1sec cycle */
if (timer == 0)
state[sensor_id].flags &= ~STATE_POWER_LOCK;
MacU16X16to32(state[sensor_id].nano, sensor[sensor_id].meterconst, ADC);
if (state[sensor_id].nano > WATT) {
sensor[sensor_id].counter++;
state[sensor_id].flags |= STATE_PULSE;
state[sensor_id].nano -= WATT;
state[sensor_id].pulse_count++;
}
if ((timer == SECOND) && !(state[sensor_id].flags & STATE_POWER_LOCK)) {
state[sensor_id].nano_start = state[sensor_id].nano_end;
state[sensor_id].nano_end = state[sensor_id].nano;
state[sensor_id].pulse_count_final = state[sensor_id].pulse_count;
state[sensor_id].pulse_count = 0;
state[sensor_id].flags |= STATE_POWER_CALC | STATE_POWER_LOCK;
}
}
/* Cycle through the available ADC input channels (0/1/2). */
muxn++;
if (!(muxn %= 3)) timer++;
if (timer > SECOND) timer = 0;
/* In order to map this to 1000Hz (=ms) we have to skip every second interrupt. */
if (!time.skip) time.ms++ ;
time.skip ^= 1;
ADMUX &= 0xF8;
ADMUX |= muxn;
/* Start a new ADC conversion. */
ADCSRA |= (1<<ADSC);
DBG_ISR_END();
}
ISR(TIMER1_CAPT_vect)
{
disable_led();
// throttle the cpu clock to draw less amps
// raises the number of bytes that can be written to EEPROM from 43 to 48
clock_prescale_set(clock_div_16);
event.brown_out++;
#if DBG > 0
uint8_t i;
for (i=0; i<128; i++)
eeprom_write_byte((uint8_t *)(i + 0x0100), i);
#else
eeprom_update_block((const void*)&sensor, (void*)&EEPROM_sensor, sizeof(sensor));
eeprom_update_block((const void*)&event, (void*)&EEPROM_event, sizeof(event));
#endif
// restore the original clock setting
clock_prescale_set(clock_div_1);
setup_led();
}
void setup_datastructs(void)
{
cli();
eeprom_read_block((void*)&version, (const void*)&EEPROM_version, sizeof(version));
eeprom_read_block((void*)&event, (const void*)&EEPROM_event, sizeof(event));
eeprom_read_block((void*)&enabled, (const void*)&EEPROM_enabled, sizeof(enabled));
eeprom_read_block((void*)&phy_to_log, (const void*)&EEPROM_phy_to_log, sizeof(phy_to_log));
eeprom_read_block((void*)&sensor, (const void*)&EEPROM_sensor, sizeof(sensor));
sei();
}
void setup_led(void)
{
// set output low (= LED enabled)
PORTB &= ~(1<<PB0);
// set LED pin (PB0) as output pin
DDRB |= (1<<DDB0);
}
void disable_led(void)
{
// set LED pin (PB0) as input pin
DDRB &= ~(1<<DDB0);
// disable pull-up
PORTB &= ~(1<<PB0);
}
void setup_pulse_input(void)
{
// PD2=INT0 and PD3=INT1 configuration
// set as input pin with 20k pull-up enabled
PORTD |= (1<<PD2) | (1<<PD3);
// INT0 and INT1 to trigger an interrupt on a falling edge
EICRA = (1<<ISC01) | (1<<ISC11);
// enable INT0 and INT1 interrupts
EIMSK = (1<<INT0) | (1<<INT1);
}
void setup_adc(void)
{
// disable digital input cicuitry on ADCx pins to reduce leakage current
DIDR0 |= (1<<ADC5D) | (1<<ADC4D) | (1<<ADC3D) | (1<<ADC2D) | (1<<ADC1D) | (1<<ADC0D);
// select VBG as reference for ADC
ADMUX |= (1<<REFS1) | (1<<REFS0);
// ADC prescaler set to 32 => 3686.4kHz / 32 = 115.2kHz (DS p.258)
ADCSRA |= (1<<ADPS2) | (1<<ADPS0);
// enable ADC and start a first ADC conversion
ADCSRA |= (1<<ADEN) | (1<<ADSC);
}
void setup_timer1(void)
{
// Timer1 clock prescaler set to 1 => fTOV1 = 3686.4kHz / 65536 = 56.25Hz (DS p.134)
TCCR1B |= (1<<CS10);
// Increase sampling frequency to 2kHz (= 667Hz per channel) with an error of 0.01% (DS p.122)
OCR1A = 0x0732;
// Timer1 set to CTC mode (DS p.133)
TCCR1B |= 1<<WGM12;
// Enable output compare match interrupt for timer1 (DS p.136)
TIMSK1 |= (1<<OCIE1A);
// Activate the input capture noise canceler and trigger the IC on a positive edge (DS p.133)
TCCR1B |= (1<<ICNC1) | (1<<ICES1);
// Enable input capture interrupt (DS p.136)
TIMSK1 |= (1<<ICIE1);
DBG_OC1A_TOGGLE();
}
void setup_analog_comparator(void)
{
// analog comparator setup for brown-out detection
// PD7=AIN1 configured by default as input to obtain high impedance
// disable digital input cicuitry on AIN0 and AIN1 pins to reduce leakage current
DIDR1 |= (1<<AIN1D) | (1<<AIN0D);
// comparing AIN1 (Vcc/4.4) to bandgap reference (1.1V)
// select bandgap reference and enable input capture function in timer1 (DS p.244 & 116)
ACSR |= (1<<ACBG) | (1<<ACIC);
}
void calculate_power(volatile struct state_struct *pstate)
{
int32_t rest, power = 0;
uint8_t pulse_count;
cli();
rest = pstate->nano_end - pstate->nano_start;
pulse_count = pstate->pulse_count_final;
sei();
// Since the AVR has no dedicated floating-point hardware, we need
// to resort to fixed-point calculations for converting nWh/s to W.
// 1W = 10^6/3.6 nWh/s
// power[watt] = 3.6/10^6 * rest[nWh/s]
// power[watt] = 3.6/10^6 * 65536 * (rest[nWh/s] / 65536)
// power[watt] = 3.6/10^6 * 65536 * 262144 / 262144 * (rest[nWh/s] / 65536)
// power[watt] = 61847.53 / 262144 * (rest[nWh/s] / 65536)
// We have to correct for only using 666 samples iso 2000/3, so:
// power[watt] = 61847.53 * 1/666 * 2000/3 / 262144 * (rest[nWh/s] / 65536)
// power[watt] = 61909.44 / 262144 * (rest[nWh/s] / 65536)
// We round the constant down to 61909 to prevent 'underflow' in the
// consecutive else statement.
// The error introduced in the fixed-point rounding equals 7.1*10^-6.
MacU16X16to32(power, (uint16_t)(labs(rest)/65536), 61909);
power /= 262144;
if (rest >= 0) {
power += pulse_count*3600;
}
else {
power = pulse_count*3600 - power;
}
pstate->power = power;
}
int main(void)
{
uint8_t i;
cli();
// RS-485: Configure PD5=DE as output pin with low as default
DDRD |= (1<<DDD5);
// set high to transmit
//PORTD |= (1<<PD5);
setup_datastructs();
setup_led();
setup_adc();
setup_pulse_input();
setup_analog_comparator();
setup_timer1();
// initialize the CTRL buffers
ctrlInit();
// initialize the UART hardware and buffers
uartInit();
// initialize the SPI in slave mode
setup_spi(SPI_MODE_2, SPI_MSB, SPI_INTERRUPT, SPI_SLAVE);
sei();
for(;;) {
if (spi_status & SPI_NEW_CTRL_MSG) {
ctrlDecode();
spi_status &= ~SPI_NEW_CTRL_MSG;
}
for (i = 0; i < MAX_ANALOG_SENSORS; i++) {
if (state[i].flags & STATE_POWER_CALC) {
calculate_power(&state[i]);
state[i].flags &= ~STATE_POWER_CALC;
state[i].flags |= STATE_POWER;
}
}
}
return 0;
}

View File

@ -1,101 +0,0 @@
struct version_struct {
uint16_t hw_major;
uint8_t hw_minor;
uint8_t sw_major;
uint8_t sw_minor;
};
#define PORT_PULSE_1 3
#define PORT_PULSE_2 4
#define SPI_NO_OP_1 0x01
#define SPI_NO_OP_2 0x02
#define SPI_START_TX 0x04
#define SPI_TRANSMIT 0x08
#define SPI_HIGH_HEX 0x10
#define SPI_TO_FROM_UART 0x20
#define SPI_NEW_CTRL_MSG 0x40
#define SPI_END_OF_TX 0x00
#define SPI_END_OF_MESSAGE '.'
#define SPI_FORWARD_TO_UART_PORT 'u'
#define SPI_FORWARD_TO_CTRL_PORT 'l' // 'l'ocal port
struct event_struct {
uint16_t wdt;
uint16_t brown_out;
};
struct sensor_struct {
uint32_t counter;
uint16_t meterconst;
};
# define WATT 1000000000
# define SECOND 665 // 666Hz - 1
#define STATE_PULSE 0x01
#define STATE_SKIP 0x02
#define STATE_POWER_LOCK 0x04
#define STATE_POWER_CALC 0x08
#define STATE_POWER 0x10
struct state_struct {
uint8_t flags;
uint32_t nano;
uint32_t nano_start;
uint32_t nano_end;
uint8_t pulse_count;
uint8_t pulse_count_final;
uint32_t power;
uint32_t timestamp;
};
struct time_struct {
uint8_t skip;
uint32_t ms;
};
/*
* This macro performs a 16x16 -> 32 unsigned MAC in 37 cycles with operands and results in memory
* based on http://www2.ife.ee.ethz.ch/~roggend/publications/wear/DSPMic_v1.1.pdf par 3.4 and table 31.
*/
#define MacU16X16to32(uint_32Acc, uint_16In1, uint_16In2) \
asm volatile ( \
"clr r2 \n\t" \
"mul %B2, %B1 \n\t" \
"movw r4, r0 \n\t" \
"mul %A2, %A1 \n\t" \
"add %A0, r0 \n\t" \
"adc %B0, r1 \n\t" \
"adc %C0, r4 \n\t" \
"adc %D0, r5 \n\t" \
"mul %B2, %A1 \n\t" \
"add %B0, r0 \n\t" \
"adc %C0, r1 \n\t" \
"adc %D0, r2 \n\t" \
"mul %A2, %B1 \n\t" \
"add %B0, r0 \n\t" \
"adc %C0, r1 \n\t" \
"adc %D0, r2 \n\t" \
"clr r1 \n\t" \
: \
"+r" (uint_32Acc) \
: \
"a" (uint_16In1), \
"a" (uint_16In2) \
: \
"r2", "r4", "r5" \
)
void register_pulse(volatile struct sensor_struct *psensor, volatile struct state_struct *pstate);
void setup_led(void);
void disable_led(void);
void setup_datastructs(void);
void setup_pulse_input(void);
void setup_adc(void);
void setup_timer1(void);
void setup_analog_comparator(void);
void calculate_power(volatile struct state_struct *pstate);

View File

@ -1,568 +0,0 @@
#
# makefile
#
# Copyright (c) Eric B. Weddington, Jörg Wunsch, et al.
# Peter Fleury
# Bart Van Der Meerssche
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# $Id$
#----------------------------------------------------------------------------
# On command line:
#
# make all = Make software.
#
# make clean = Clean out built project files.
#
# make coff = Convert ELF to AVR COFF.
#
# make extcoff = Convert ELF to AVR Extended COFF.
#
# make program = Download the hex file to the device, using avrdude.
# Please customize the avrdude settings below first!
#
# make rprogram = Upload the hex and eep file to the Fluksometer's /tmp.
# Then flash the fuses, hex and eep through the onboard avrdude.
#
# make debug = Start either simulavr or avarice as specified for debugging,
# with avr-gdb or avr-insight as the front end for debugging.
#
# make filename.s = Just compile filename.c into the assembler code only.
#
# make filename.i = Create a preprocessed source file for use in submitting
# bug reports to the GCC project.
#
# To rebuild project do "make clean" then "make all".
#----------------------------------------------------------------------------
# Sensor board versioning:
HW_VERSION_MAJOR = 2
HW_VERSION_MINOR = 0
SW_VERSION_MAJOR = 1
SW_VERSION_MINOR = 0
# MCU name
MCU = atmega168
# Processor frequency.
# This will define a symbol, F_CPU, in all source code files equal to the
# processor frequency. You can then use this symbol in your source code to
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
# automatically to create a 32-bit value in your source code.
F_CPU = 3686400
# Output format. (can be srec, ihex, binary)
FORMAT = ihex
# Target file name (without extension).
TARGET = main
# List C source files here. (C dependencies are automatically generated.)
SRC = $(TARGET).c buffer.c uart.c spi.c ctrl.c
# List Assembler source files here.
# Make them always end in a capital .S. Files ending in a lowercase .s
# will not be considered source files but generated files (assembler
# output from the compiler), and will be deleted upon "make clean"!
# Even though the DOS/Win* filesystem matches both .s and .S the same,
# it will preserve the spelling of the filenames, and gcc itself does
# care about how the name is spelled on its command-line.
ASRC =
# Optimization level, can be [0, 1, 2, 3, s].
# 0 = turn off optimization. s = optimize for size.
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
OPT = s
# Debugging format.
# Native formats for AVR-GCC's -g are dwarf-2 [default] or stabs.
# AVR Studio 4.10 requires dwarf-2.
# AVR [Extended] COFF format requires stabs, plus an avr-objcopy run.
DEBUG = dwarf-2
# List any extra directories to look for include files here.
# Each directory must be seperated by a space.
# Use forward slashes for directory separators.
# For a directory that has spaces, enclose it in quotes.
EXTRAINCDIRS =
# Compiler flag to set the C Standard level.
# c89 = "ANSI" C
# gnu89 = c89 plus GCC extensions
# c99 = ISO C99 standard (not yet fully implemented)
# gnu99 = c99 plus GCC extensions
CSTANDARD = -std=gnu99
# Place -D or -U options here
CDEFS = -DF_CPU=$(F_CPU)UL
# Debugging mode
DBG = 0
CDEFS += -D DBG=$(DBG)
# Warn when a function marked for inlining could not be substituted
CDEFS += -Winline
# Inline all 'simple-enough' functions (seems to be done by default in -Os)
CDEFS += -finline-functions
# Sensor board ID
CDEFS += -DBOARD_ID=$(BOARD_ID)
# Sensor board hw/sw major/minor version
CDEFS += -DHW_VERSION_MAJOR=$(HW_VERSION_MAJOR) -DHW_VERSION_MINOR=$(HW_VERSION_MINOR)
CDEFS += -DSW_VERSION_MAJOR=$(SW_VERSION_MAJOR) -DSW_VERSION_MINOR=$(SW_VERSION_MINOR)
# uncomment and adapt these line if you want different UART library buffer size
CDEFS += -DUART_RX_BUFFER_SIZE=256
CDEFS += -DUART_TX_BUFFER_SIZE=64
CDEFS += -DUART_DEFAULT_BAUD_RATE=115200
# override default CTRL buffer sizes
CDEFS += -DCTRL_RX_BUFFER_SIZE=32
CDEFS += -DCTRL_TX_BUFFER_SIZE=128
# Place -I options here
CINCS =
#---------------- Compiler Options ----------------
# -g*: generate debugging information
# -O*: optimization level
# -f...: tuning, see GCC manual and avr-libc documentation
# -Wall...: warning level
# -Wa,...: tell GCC to pass this to the assembler.
# -adhlns...: create assembler listing
CFLAGS = -g$(DEBUG)
CFLAGS += $(CDEFS) $(CINCS)
CFLAGS += -O$(OPT)
CFLAGS += -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums
CFLAGS += -Wall -Wstrict-prototypes
CFLAGS += -Wa,-adhlns=$(<:.c=.lst)
CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
CFLAGS += $(CSTANDARD)
#---------------- Assembler Options ----------------
# -Wa,...: tell GCC to pass this to the assembler.
# -ahlms: create listing
# -gstabs: have the assembler create line number information; note that
# for use in COFF files, additional information about filenames
# and function names needs to be present in the assembler source
# files -- see avr-libc docs [FIXME: not yet described there]
ASFLAGS = -Wa,-adhlns=$(<:.S=.lst),-gstabs
#---------------- Library Options ----------------
# Minimalistic printf version
PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
# Floating point printf version (requires MATH_LIB = -lm below)
PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
# If this is left blank, then it will use the Standard printf version.
#PRINTF_LIB =
PRINTF_LIB = $(PRINTF_LIB_MIN)
#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
# Minimalistic scanf version
SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
# Floating point + %[ scanf version (requires MATH_LIB = -lm below)
SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
# If this is left blank, then it will use the Standard scanf version.
#SCANF_LIB =
SCANF_LIB = $(SCANF_LIB_MIN)
#SCANF_LIB = $(SCANF_LIB_FLOAT)
MATH_LIB = -lm
#---------------- External Memory Options ----------------
# 64 KB of external RAM, starting after internal RAM (ATmega128!),
# used for variables (.data/.bss) and heap (malloc()).
#EXTMEMOPTS = -Wl,-Tdata=0x801100,--defsym=__heap_end=0x80ffff
# 64 KB of external RAM, starting after internal RAM (ATmega128!),
# only used for heap (malloc()).
#EXTMEMOPTS = -Wl,--defsym=__heap_start=0x801100,--defsym=__heap_end=0x80ffff
EXTMEMOPTS =
#---------------- Linker Options ----------------
# -Wl,...: tell GCC to pass this to linker.
# -Map: create map file
# --cref: add cross reference to map file
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
LDFLAGS += $(EXTMEMOPTS)
#LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB)
#---------------- Programming Options (avrdude) ----------------
# Programming hardware: alf avr910 avrisp bascom bsd
# dt006 pavr picoweb pony-stk200 sp12 stk200 stk500
#
# Type: avrdude -c ?
# to get a full listing.
#
AVRDUDE_PROGRAMMER = usbtiny
AVRDUDE_PROGRAMMER_R = gpio
# com1 = serial port. Use lpt1 to connect to parallel port.
AVRDUDE_PORT = /dev/ttyUSB* # programmer connected to serial device
AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep
AVRDUDE_WRITE_FUSES = -U lfuse:w:0xEC:m -U hfuse:w:0xD6:m -U efuse:w:0x01:m
# Uncomment the following if you want avrdude's erase cycle counter.
# Note that this counter needs to be initialized first using -Yn,
# see avrdude manual.
#AVRDUDE_ERASE_COUNTER = -y
# Uncomment the following if you do /not/ wish a verification to be
# performed after programming the device.
#AVRDUDE_NO_VERIFY = -V
# Increase verbosity level. Please use this when submitting bug
# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
# to submit bug reports.
#AVRDUDE_VERBOSE = -v -v
AVRDUDE_FLAGS = -p $(MCU)p -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER)
AVRDUDE_FLAGS += $(AVRDUDE_NO_VERIFY)
AVRDUDE_FLAGS += $(AVRDUDE_VERBOSE)
AVRDUDE_FLAGS += $(AVRDUDE_ERASE_COUNTER)
AVRDUDE_FLAGS_R = -p $(MCU)p -c $(AVRDUDE_PROGRAMMER_R)
AVRDUDE_FLAGS_R += $(AVRDUDE_NO_VERIFY)
AVRDUDE_FLAGS_R += $(AVRDUDE_VERBOSE)
AVRDUDE_FLAGS_R += $(AVRDUDE_ERASE_COUNTER)
#---------------- Debugging Options ----------------
# For simulavr only - target MCU frequency.
DEBUG_MFREQ = $(F_CPU)
# Set the DEBUG_UI to either gdb or insight.
# DEBUG_UI = gdb
DEBUG_UI = insight
# Set the debugging back-end to either avarice, simulavr.
DEBUG_BACKEND = avarice
#DEBUG_BACKEND = simulavr
# GDB Init Filename.
GDBINIT_FILE = __avr_gdbinit
# When using avarice settings for the JTAG
JTAG_DEV = /dev/com1
# Debugging port used to communicate between GDB / avarice / simulavr.
DEBUG_PORT = 4242
# Debugging host used to communicate between GDB / avarice / simulavr, normally
# just set to localhost unless doing some sort of crazy debugging when
# avarice is running on a different computer.
DEBUG_HOST = localhost
#============================================================================
# Define programs and commands.
SHELL = sh
CC = avr-gcc
OBJCOPY = avr-objcopy
OBJDUMP = avr-objdump
SIZE = avr-size
NM = avr-nm
AVRDUDE = avrdude
AVRDUDE_R = fdude
REMOVE = rm -f
COPY = cp
WINSHELL = cmd
# Define Messages
# English
MSG_ERRORS_NONE = Errors: none
MSG_BEGIN = -------- begin --------
MSG_END = -------- end --------
MSG_SIZE_BEFORE = Size before:
MSG_SIZE_AFTER = Size after:
MSG_COFF = Converting to AVR COFF:
MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
MSG_FLASH = Creating load file for Flash:
MSG_EEPROM = Creating load file for EEPROM:
MSG_EXTENDED_LISTING = Creating Extended Listing:
MSG_SYMBOL_TABLE = Creating Symbol Table:
MSG_LINKING = Linking:
MSG_COMPILING = Compiling:
MSG_ASSEMBLING = Assembling:
MSG_CLEANING = Cleaning project:
# Define all object files.
OBJ = $(SRC:.c=.o) $(ASRC:.S=.o)
# Define all listing files.
LST = $(SRC:.c=.lst) $(ASRC:.S=.lst)
# Compiler flags to generate dependency files.
GENDEPFLAGS = -MD -MP -MF .dep/$(@F).d
# Combine all necessary flags and optional flags.
# Add target processor to flags.
ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) $(GENDEPFLAGS)
ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS)
# Default target.
all: begin gccversion sizebefore build sizeafter end
build: elf hex eep lss sym
elf: $(TARGET).elf
hex: $(TARGET).hex
eep: $(TARGET).eep
lss: $(TARGET).lss
sym: $(TARGET).sym
# Eye candy.
# AVR Studio 3.x does not check make's exit code but relies on
# the following magic strings to be generated by the compile job.
begin:
@echo
@echo $(MSG_BEGIN)
end:
@echo $(MSG_END)
@echo
# Display size of file.
HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex
ELFSIZE = $(SIZE) -A $(TARGET).elf
AVRMEM = avr-mem.sh $(TARGET).elf $(MCU)
sizebefore:
@if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); \
$(AVRMEM) 2>/dev/null; echo; fi
sizeafter:
@if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); \
$(AVRMEM) 2>/dev/null; echo; fi
# Display compiler version information.
gccversion :
@$(CC) --version
# Program the device.
program: $(TARGET).hex $(TARGET).eep
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FUSES) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
# Program the device remotely.
FLUKSO = /etc/init.d/flukso
rprogram: $(TARGET).hex $(TARGET).eep
@scp $(TARGET).hex $(TARGET).eep root@192.168.255.1:/tmp
@ssh root@192.168.255.1 \
"echo +++ stopping the flukso daemon +++;" \
"$(FLUKSO) stop;" \
"cd /tmp;" \
"$(AVRDUDE_R) $(AVRDUDE_FLAGS_R) $(AVRDUDE_WRITE_FUSES) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM);" \
"sleep 1;" \
"echo;" \
"echo +++ starting the flukso daemon +++;" \
"$(FLUKSO) start <&- 2>&- >/dev/null"
# Generate avr-gdb config/init file which does the following:
# define the reset signal, load the target file, connect to target, and set
# a breakpoint at main().
gdb-config:
@$(REMOVE) $(GDBINIT_FILE)
@echo define reset >> $(GDBINIT_FILE)
@echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
@echo end >> $(GDBINIT_FILE)
@echo file $(TARGET).elf >> $(GDBINIT_FILE)
@echo target remote $(DEBUG_HOST):$(DEBUG_PORT) >> $(GDBINIT_FILE)
ifeq ($(DEBUG_BACKEND),simulavr)
@echo load >> $(GDBINIT_FILE)
endif
@echo break main >> $(GDBINIT_FILE)
debug: gdb-config $(TARGET).elf
ifeq ($(DEBUG_BACKEND), avarice)
@echo Starting AVaRICE - Press enter when "waiting to connect" message displays.
@$(WINSHELL) /c start avarice --jtag $(JTAG_DEV) --erase --program --file \
$(TARGET).elf $(DEBUG_HOST):$(DEBUG_PORT)
@$(WINSHELL) /c pause
else
@$(WINSHELL) /c start simulavr --gdbserver --device $(MCU) --clock-freq \
$(DEBUG_MFREQ) --port $(DEBUG_PORT)
endif
@$(WINSHELL) /c start avr-$(DEBUG_UI) --command=$(GDBINIT_FILE)
# Convert ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB.
COFFCONVERT=$(OBJCOPY) --debugging \
--change-section-address .data-0x800000 \
--change-section-address .bss-0x800000 \
--change-section-address .noinit-0x800000 \
--change-section-address .eeprom-0x810000
coff: $(TARGET).elf
@echo
@echo $(MSG_COFF) $(TARGET).cof
$(COFFCONVERT) -O coff-avr $< $(TARGET).cof
extcoff: $(TARGET).elf
@echo
@echo $(MSG_EXTENDED_COFF) $(TARGET).cof
$(COFFCONVERT) -O coff-ext-avr $< $(TARGET).cof
# Create final output files (.hex, .eep) from ELF output file.
%.hex: %.elf
@echo
@echo $(MSG_FLASH) $@
$(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@
%.eep: %.elf
@echo
@echo $(MSG_EEPROM) $@
-$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \
--change-section-lma .eeprom=0 -O $(FORMAT) $< $@
# Create extended listing file from ELF output file.
%.lss: %.elf
@echo
@echo $(MSG_EXTENDED_LISTING) $@
$(OBJDUMP) -h -S $< > $@
# Create a symbol table from ELF output file.
%.sym: %.elf
@echo
@echo $(MSG_SYMBOL_TABLE) $@
$(NM) -n $< > $@
# Link: create ELF output file from object files.
.SECONDARY : $(TARGET).elf
.PRECIOUS : $(OBJ)
%.elf: $(OBJ)
@echo
@echo $(MSG_LINKING) $@
$(CC) $(ALL_CFLAGS) $^ --output $@ $(LDFLAGS)
# Compile: create object files from C source files.
%.o : %.c
@echo
@echo $(MSG_COMPILING) $<
$(CC) -c $(ALL_CFLAGS) $< -o $@
# Compile: create assembler files from C source files.
%.s : %.c
$(CC) -S $(ALL_CFLAGS) $< -o $@
# Assemble: create object files from assembler source files.
%.o : %.S
@echo
@echo $(MSG_ASSEMBLING) $<
$(CC) -c $(ALL_ASFLAGS) $< -o $@
# Create preprocessed source for use in sending a bug report.
%.i : %.c
$(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
# Target: clean project.
clean: begin clean_list end
clean_list :
@echo
@echo $(MSG_CLEANING)
$(REMOVE) $(TARGET).hex
$(REMOVE) $(TARGET).eep
$(REMOVE) $(TARGET).cof
$(REMOVE) $(TARGET).elf
$(REMOVE) $(TARGET).map
$(REMOVE) $(TARGET).sym
$(REMOVE) $(TARGET).lss
$(REMOVE) $(OBJ)
$(REMOVE) $(LST)
$(REMOVE) $(SRC:.c=.s)
$(REMOVE) $(SRC:.c=.d)
$(REMOVE) .dep/*
# Include the dependency files.
-include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*)
# Listing of phony targets.
.PHONY : all begin finish end sizebefore sizeafter gccversion \
build elf hex eep lss sym coff extcoff \
clean clean_list program rprogram debug gdb-config

View File

@ -1,74 +0,0 @@
/*
* Copyright (c) 2009 Andrew Smallbone <andrew@rocketnumbernine.com>
*
* 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
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include <spi.h>
#ifdef __cplusplus
extern "C"{
#endif
#ifdef __ARDUINO__
#include <wiring.h>
#endif
void setup_spi(uint8_t mode, int dord, int interrupt, uint8_t clock)
{
// specify pin directions for SPI pins on port B
if (clock == SPI_SLAVE) { // if slave SS and SCK is input
DDRB &= ~(1<<SPI_MOSI_PIN); // input
DDRB |= (1<<SPI_MISO_PIN); // output
DDRB &= ~(1<<SPI_SS_PIN); // input
DDRB &= ~(1<<SPI_SCK_PIN);// input
} else {
DDRB |= (1<<SPI_MOSI_PIN); // output
DDRB &= ~(1<<SPI_MISO_PIN); // input
DDRB |= (1<<SPI_SCK_PIN);// output
DDRB |= (1<<SPI_SS_PIN);// output
}
SPCR = ((interrupt ? 1 : 0)<<SPIE) // interrupt enabled
| (1<<SPE) // enable SPI
| (dord<<DORD) // LSB or MSB
| (((clock != SPI_SLAVE) ? 1 : 0) <<MSTR) // Slave or Master
| (((mode & 0x02) == 2) << CPOL) // clock timing mode CPOL
| (((mode & 0x01)) << CPHA) // clock timing mode CPHA
| (((clock & 0x02) == 2) << SPR1) // cpu clock divisor SPR1
| ((clock & 0x01) << SPR0); // cpu clock divisor SPR0
SPSR = (((clock & 0x04) == 4) << SPI2X); // clock divisor SPI2X
}
void disable_spi()
{
SPCR = 0;
}
uint8_t send_spi(uint8_t out)
{
SPDR = out;
while (!(SPSR & (1<<SPIF)));
return SPDR;
}
uint8_t received_from_spi(uint8_t data)
{
SPDR = data;
return SPDR;
}

View File

@ -1,94 +0,0 @@
/*
* Copyright (c) 2009 Andrew Smallbone <andrew@rocketnumbernine.com>
*
* 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
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#ifndef _spi_h__
#define _spi_h__
#include <avr/io.h>
#ifdef __cplusplus
extern "C"{
#endif
// create alias for the different SPI chip pins - code assumes all on port B
#if (defined(__AVR_AT90USB82__) || defined(__AVR_AT90USB162__))
#define SPI_SS_PIN PORTB0
#define SPI_SCK_PIN PORTB1
#define SPI_MOSI_PIN PORTB2
#define SPI_MISO_PIN PORTB3
#elif (defined(__AVR_ATmega48__) || defined(_AVR_ATmega88__) || defined(__AVR_ATmega168__) || defined(__AVR_ATmega328__) || defined(__AVR_ATmega328P__))
#define SPI_SS_PIN PORTB2
#define SPI_SCK_PIN PORTB5
#define SPI_MOSI_PIN PORTB3
#define SPI_MISO_PIN PORTB4
#else
#error unknown processor - add to spi.h
#endif
// SPI clock modes
#define SPI_MODE_0 0x00 /* Sample (Rising) Setup (Falling) CPOL=0, CPHA=0 */
#define SPI_MODE_1 0x01 /* Setup (Rising) Sample (Falling) CPOL=0, CPHA=1 */
#define SPI_MODE_2 0x02 /* Sample (Falling) Setup (Rising) CPOL=1, CPHA=0 */
#define SPI_MODE_3 0x03 /* Setup (Falling) Sample (Rising) CPOL=1, CPHA=1 */
// data direction
#define SPI_LSB 1 /* send least significant bit (bit 0) first */
#define SPI_MSB 0 /* send most significant bit (bit 7) first */
// whether to raise interrupt when data received (SPIF bit received)
#define SPI_NO_INTERRUPT 0
#define SPI_INTERRUPT 1
// slave or master with clock diviser
#define SPI_SLAVE 0xF0
#define SPI_MSTR_CLK4 0x00 /* chip clock/4 */
#define SPI_MSTR_CLK16 0x01 /* chip clock/16 */
#define SPI_MSTR_CLK64 0x02 /* chip clock/64 */
#define SPI_MSTR_CLK128 0x03 /* chip clock/128 */
#define SPI_MSTR_CLK2 0x04 /* chip clock/2 */
#define SPI_MSTR_CLK8 0x05 /* chip clock/8 */
#define SPI_MSTR_CLK32 0x06 /* chip clock/32 */
// setup spi
void setup_spi(uint8_t mode, // timing mode SPI_MODE[0-4]
int dord, // data direction SPI_LSB|SPI_MSB
int interrupt, // whether to raise interrupt on recieve
uint8_t clock); // clock diviser
// disable spi
void disable_spi(void);
// send and receive a byte of data (master mode)
uint8_t send_spi(uint8_t out);
// receive the byte of data waiting on the SPI buffer and
// set the next byte to transfer - for use in slave mode
// when interrupts are enabled.
uint8_t received_from_spi(uint8_t out);
#ifdef __cplusplus
} // extern "C"
#endif
#endif

View File

@ -1,310 +0,0 @@
//
// uart.c : UART driver with buffer support
//
// Copyright (c) 2000-2002 Pascal Stang
// 2010 flukso.net
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
//
// $Id$
#include <avr/io.h>
#include <avr/interrupt.h>
#include "buffer.h"
#include "uart.h"
// UART global variables
// flag variables
volatile u08 uartReadyTx; ///< uartReadyTx flag
volatile u08 uartBufferedTx; ///< uartBufferedTx flag
// receive and transmit buffers
cBuffer uartRxBuffer; ///< uart receive buffer
cBuffer uartTxBuffer; ///< uart transmit buffer
unsigned short uartRxOverflow; ///< receive overflow counter
#ifndef UART_BUFFERS_EXTERNAL_RAM
// using internal ram,
// automatically allocate space in ram for each buffer
static char uartRxData[UART_RX_BUFFER_SIZE];
static char uartTxData[UART_TX_BUFFER_SIZE];
#endif
typedef void (*voidFuncPtru08)(unsigned char);
volatile static voidFuncPtru08 UartRxFunc;
// enable and initialize the uart
void uartInit(void)
{
// initialize the buffers
uartInitBuffers();
// initialize user receive handler
UartRxFunc = 0;
// enable RxD/TxD and interrupts
outb(UCR, BV(RXCIE)|BV(RXEN)|BV(TXEN));
// set default baud rate
uartSetBaudRate(UART_DEFAULT_BAUD_RATE);
// initialize states
uartReadyTx = TRUE;
uartBufferedTx = FALSE;
// clear overflow count
uartRxOverflow = 0;
// enable interrupts
sei();
}
// create and initialize the uart transmit and receive buffers
void uartInitBuffers(void)
{
#ifndef UART_BUFFERS_EXTERNAL_RAM
// initialize the UART receive buffer
bufferInit(&uartRxBuffer, (u08*) uartRxData, UART_RX_BUFFER_SIZE);
// initialize the UART transmit buffer
bufferInit(&uartTxBuffer, (u08*) uartTxData, UART_TX_BUFFER_SIZE);
#else
// initialize the UART receive buffer
bufferInit(&uartRxBuffer, (u08*) UART_RX_BUFFER_ADDR, UART_RX_BUFFER_SIZE);
// initialize the UART transmit buffer
bufferInit(&uartTxBuffer, (u08*) UART_TX_BUFFER_ADDR, UART_TX_BUFFER_SIZE);
#endif
}
// redirects received data to a user function
void uartSetRxHandler(void (*rx_func)(unsigned char c))
{
// set the receive interrupt to run the supplied user function
UartRxFunc = rx_func;
}
// set the uart baud rate
void uartSetBaudRate(u32 baudrate)
{
// calculate division factor for requested baud rate, and set it
u16 bauddiv = ((F_CPU+(baudrate*8L))/(baudrate*16L)-1);
outb(UBRRL, bauddiv);
#ifdef UBRRH
outb(UBRRH, bauddiv>>8);
#endif
}
// returns the receive buffer structure
cBuffer* uartGetRxBuffer(void)
{
// return rx buffer pointer
return &uartRxBuffer;
}
// returns the transmit buffer structure
cBuffer* uartGetTxBuffer(void)
{
// return tx buffer pointer
return &uartTxBuffer;
}
// transmits a byte over the uart
void uartSendByte(u08 txData)
{
// wait for the transmitter to be ready
while(!uartReadyTx);
// send byte
outb(UDR, txData);
// set ready state to FALSE
uartReadyTx = FALSE;
}
// gets a single byte from the uart receive buffer (getchar-style)
int uartGetByte(void)
{
u08 c;
if(uartReceiveByte(&c))
return c;
else
return -1;
}
// gets a byte (if available) from the uart receive buffer
u08 uartReceiveByte(u08* rxData)
{
// make sure we have a receive buffer
if(uartRxBuffer.size)
{
// make sure we have data
if(uartRxBuffer.datalength)
{
// get byte from beginning of buffer
*rxData = bufferGetFromFront(&uartRxBuffer);
return TRUE;
}
else
{
// no data
return FALSE;
}
}
else
{
// no buffer
return FALSE;
}
}
// flush all data out of the receive buffer
void uartFlushReceiveBuffer(void)
{
// flush all data from receive buffer
//bufferFlush(&uartRxBuffer);
// same effect as above
uartRxBuffer.datalength = 0;
}
// return true if uart receive buffer is empty
u08 uartReceiveBufferIsEmpty(void)
{
if(uartRxBuffer.datalength == 0)
{
return TRUE;
}
else
{
return FALSE;
}
}
// add byte to end of uart Tx buffer
u08 uartAddToTxBuffer(u08 data)
{
u08 status;
// add data byte to the end of the tx buffer
status = bufferAddToEnd(&uartTxBuffer, data);
// turn on buffered transmit
uartBufferedTx = TRUE;
// enable UDRIE0 interrupt
UCR |= 1<<UDRIE0;
return status;
}
// start transmission of the current uart Tx buffer contents
void uartSendTxBuffer(void)
{
// turn on buffered transmit
uartBufferedTx = TRUE;
// send the first byte to get things going by interrupts
uartSendByte(bufferGetFromFront(&uartTxBuffer));
}
/*
// transmit nBytes from buffer out the uart
u08 uartSendBuffer(char *buffer, u16 nBytes)
{
register u08 first;
register u16 i;
// check if there's space (and that we have any bytes to send at all)
if((uartTxBuffer.datalength + nBytes < uartTxBuffer.size) && nBytes)
{
// grab first character
first = *buffer++;
// copy user buffer to uart transmit buffer
for(i = 0; i < nBytes-1; i++)
{
// put data bytes at end of buffer
bufferAddToEnd(&uartTxBuffer, *buffer++);
}
// send the first byte to get things going by interrupts
uartBufferedTx = TRUE;
uartSendByte(first);
// return success
return TRUE;
}
else
{
// return failure
return FALSE;
}
}
*/
// UART Data Register Empty Interrupt Handler
UART_INTERRUPT_HANDLER(SIG_UART_DATA)
{
// check if buffered tx is enabled
if(uartBufferedTx)
{
// check if there's data left in the buffer
if(uartTxBuffer.datalength)
{
// set RS-485 into transmit mode
PORTD |= (1<<PD5);
// send byte from top of buffer
outb(UDR, bufferGetFromFront(&uartTxBuffer));
}
else
{
// no data left
uartBufferedTx = FALSE;
// return to ready state
uartReadyTx = TRUE;
// disable UDRIE0 interrupt
UCR &= ~(1<<UDRIE0);
// enable TXCIE0 interrupt
UCR |= (1<<TXCIE0);
}
}
else
{
// we're using single-byte tx mode
// indicate transmit complete, back to ready
uartReadyTx = TRUE;
}
}
// UART Transmit Complete Interrupt Handler
UART_INTERRUPT_HANDLER(SIG_UART_TRANS)
{
// set RS-485 into receive mode
PORTD &= ~(1<<PD5);
// disable TXCIE0 interrupt
UCR &= ~(1<<TXCIE0);
}
// UART Receive Complete Interrupt Handler
UART_INTERRUPT_HANDLER(SIG_UART_RECV)
{
u08 c;
// get received char
c = inb(UDR);
// if there's a user function to handle this receive event
if(UartRxFunc)
{
// call it and pass the received data
UartRxFunc(c);
}
else
{
// otherwise do default processing
// put received char in buffer
// check if there's space
if( !bufferAddToEnd(&uartRxBuffer, c) )
{
// no space in buffer
// count overflow
uartRxOverflow++;
}
}
}

View File

@ -1,231 +0,0 @@
//
// uart.h : UART driver with buffer support
//
// This library provides both buffered and unbuffered transmit and receive
// functions for the AVR processor UART.<2E> Buffered access means that the
// UART can transmit and receive data in the "background", while your code
// continues executing.<2E> Also included are functions to initialize the
// UART, set the baud rate, flush the buffers, and check buffer status.
//
// For full text output functionality, you may wish to use the rprintf
// functions along with this driver.
//
// Most Atmel AVR-series processors contain one or more hardware UARTs
// (aka, serial ports). UART serial ports can communicate with other
// serial ports of the same type, like those used on PCs. In general,
// UARTs are used to communicate with devices that are RS-232 compatible
// (RS-232 is a certain kind of serial port).
//
// By far, the most common use for serial communications on AVR processors
// is for sending information and data to a PC running a terminal program.
// Here is an exmaple:
// uartInit(); // initialize UART (serial port)
// uartSetBaudRate(9600); // set UART speed to 9600 baud
// rprintfInit(uartSendByte); // configure rprintf to use UART for output
// rprintf("Hello World\r\n"); // send "hello world" message via serial port
//
// The CPU frequency (F_CPU) must be set correctly in \c global.h
// for the UART library to calculate correct baud rates. Furthermore,
// certain CPU frequencies will not produce exact baud rates due to
// integer frequency division round-off. See your AVR processor's
// datasheet for full details.
//
// Copyright (c) 2000-2002 Pascal Stang
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
//
// $Id$
#ifndef UART_H
#define UART_H
#include "global.h"
#include "buffer.h"
//! Default uart baud rate.
/// This is the default speed after a uartInit() command,
/// and can be changed by using uartSetBaudRate().
#ifndef UART_DEFAULT_BAUD_RATE
#define UART_DEFAULT_BAUD_RATE 9600
#endif
// buffer memory allocation defines
// buffer sizes
#ifndef UART_TX_BUFFER_SIZE
//! Number of bytes for uart transmit buffer.
/// Do not change this value in uart.h, but rather override
/// it with the desired value defined in your project's global.h
#define UART_TX_BUFFER_SIZE 0x0040
#endif
#ifndef UART_RX_BUFFER_SIZE
//! Number of bytes for uart receive buffer.
/// Do not change this value in uart.h, but rather override
/// it with the desired value defined in your project's global.h
#define UART_RX_BUFFER_SIZE 0x0040
#endif
// define this key if you wish to use
// external RAM for the UART buffers
//#define UART_BUFFER_EXTERNAL_RAM
#ifdef UART_BUFFER_EXTERNAL_RAM
// absolute address of uart buffers
#define UART_TX_BUFFER_ADDR 0x1000
#define UART_RX_BUFFER_ADDR 0x1100
#endif
//! Type of interrupt handler to use for uart interrupts.
/// Value may be SIGNAL or INTERRUPT.
/// \warning Do not change unless you know what you're doing.
#ifndef UART_INTERRUPT_HANDLER
#define UART_INTERRUPT_HANDLER SIGNAL
#endif
// compatibility with most newer processors
#ifdef UCSRB
#define UCR UCSRB
#endif
// compatibility with old Mega processors
#if defined(UBRR) && !defined(UBRRL)
#define UBRRL UBRR
#endif
// compatibility with megaXX8 processors
#if defined(__AVR_ATmega48__) || \
defined(__AVR_ATmega88__) || \
defined(__AVR_ATmega168__) || \
defined(__AVR_ATmega644__)
#define UDR UDR0
#define UCR UCSR0B
#define RXCIE RXCIE0
#define TXCIE TXCIE0
#define RXC RXC0
#define TXC TXC0
#define RXEN RXEN0
#define TXEN TXEN0
#define UBRRL UBRR0L
#define UBRRH UBRR0H
#define SIG_UART_TRANS SIG_USART_TRANS
#define SIG_UART_RECV SIG_USART_RECV
#define SIG_UART_DATA SIG_USART_DATA
#endif
// compatibility with mega169 processors
#if defined(__AVR_ATmega169__)
#define SIG_UART_TRANS SIG_USART_TRANS
#define SIG_UART_RECV SIG_USART_RECV
#define SIG_UART_DATA SIG_USART_DATA
#endif
// compatibility with dual-uart processors
// (if you need to use both uarts, please use the uart2 library)
#if defined(__AVR_ATmega161__)
#define UDR UDR0
#define UCR UCSR0B
#define UBRRL UBRR0
#define SIG_UART_TRANS SIG_UART0_TRANS
#define SIG_UART_RECV SIG_UART0_RECV
#define SIG_UART_DATA SIG_UART0_DATA
#endif
#if defined(__AVR_ATmega128__)
#ifdef UART_USE_UART1
#define UDR UDR1
#define UCR UCSR1B
#define UBRRL UBRR1L
#define UBRRH UBRR1H
#define SIG_UART_TRANS SIG_UART1_TRANS
#define SIG_UART_RECV SIG_UART1_RECV
#define SIG_UART_DATA SIG_UART1_DATA
#else
#define UDR UDR0
#define UCR UCSR0B
#define UBRRL UBRR0L
#define UBRRH UBRR0H
#define SIG_UART_TRANS SIG_UART0_TRANS
#define SIG_UART_RECV SIG_UART0_RECV
#define SIG_UART_DATA SIG_UART0_DATA
#endif
#endif
// functions
//! Initializes uart.
/// \note After running this init function, the processor
/// I/O pins that used for uart communications (RXD, TXD)
/// are no long available for general purpose I/O.
void uartInit(void);
//! Initializes transmit and receive buffers.
/// Automatically called from uartInit()
void uartInitBuffers(void);
//! Redirects received data to a user function.
///
void uartSetRxHandler(void (*rx_func)(unsigned char c));
//! Sets the uart baud rate.
/// Argument should be in bits-per-second, like \c uartSetBaudRate(9600);
void uartSetBaudRate(u32 baudrate);
//! Returns pointer to the receive buffer structure.
///
cBuffer* uartGetRxBuffer(void);
//! Returns pointer to the transmit buffer structure.
///
cBuffer* uartGetTxBuffer(void);
//! Sends a single byte over the uart.
/// \note This function waits for the uart to be ready,
/// therefore, consecutive calls to uartSendByte() will
/// go only as fast as the data can be sent over the
/// serial port.
void uartSendByte(u08 data);
//! Gets a single byte from the uart receive buffer.
/// Returns the byte, or -1 if no byte is available (getchar-style).
int uartGetByte(void);
//! Gets a single byte from the uart receive buffer.
/// Function returns TRUE if data was available, FALSE if not.
/// Actual data is returned in variable pointed to by "data".
/// Example usage:
/// \code
/// char myReceivedByte;
/// uartReceiveByte( &myReceivedByte );
/// \endcode
u08 uartReceiveByte(u08* data);
//! Returns TRUE/FALSE if receive buffer is empty/not-empty.
///
u08 uartReceiveBufferIsEmpty(void);
//! Flushes (deletes) all data from receive buffer.
///
void uartFlushReceiveBuffer(void);
//! Add byte to end of uart Tx buffer.
/// Returns TRUE if successful, FALSE if failed (no room left in buffer).
u08 uartAddToTxBuffer(u08 data);
//! Begins transmission of the transmit buffer under interrupt control.
///
void uartSendTxBuffer(void);
//! Sends a block of data via the uart using interrupt control.
/// \param buffer pointer to data to be sent
/// \param nBytes length of data (number of bytes to sent)
u08 uartSendBuffer(char *buffer, u16 nBytes);
#endif

View File

@ -1,68 +0,0 @@
% Alter some LaTeX defaults for better treatment of figures:
% See p.105 of "TeX Unbound" for suggested values.
% See pp. 199-200 of Lamport's "LaTeX" book for details.
% General parameters, for ALL pages:
\renewcommand{\topfraction}{0.9} % max fraction of floats at top
\renewcommand{\bottomfraction}{0.8} % max fraction of floats at bottom
% Parameters for TEXT pages (not float pages):
\setcounter{topnumber}{2}
\setcounter{bottomnumber}{2}
\setcounter{totalnumber}{2} % 2 may work better
\renewcommand{\dbltopfraction}{0.9} % fit big float above 2-col. text
\renewcommand{\textfraction}{0.07} % allow minimal text w. figs
% Parameters for FLOAT pages (not text pages):
\renewcommand{\floatpagefraction}{0.7} % require fuller float pages
% N.B.: floatpagefraction MUST be less than topfraction !!
\renewcommand{\dblfloatpagefraction}{0.7} % require fuller float pages
% remember to use [htp] or [htpb] for placement
\newcommand{\versal}[1]{\noindent{\Huge #1\kern-.10em}}
\newcommand{\file}[1]{{\bf\ttfamily #1}}
\newcommand{\ident}[1]{{\it\ttfamily #1}}
\newcommand{\shell}[1]{{\it\ttfamily #1}}
\newcommand{\python}[1]{{\it\ttfamily #1}}
\newcommand{\ruby}[1]{{\it\ttfamily #1}}
\newcommand{\book}[2]{{\it\ttfamily #1} by {\it #2}}
\newcommand{\program}[1]{\it\ttfamily #1}
\newenvironment{aside}[1]
{
\begin{note}
\caption{\hfill\it #1}
\begin{quote}
\parindent 7.2pt
\parskip 5pt
}
{ \end{quote} \end{note} }
\newenvironment{code}[1]
{
\begin{source}
\caption{\hfill\it #1}
\sffamily\small
}
{\end{source}}
\floatstyle{ruled}
\newfloat{note}{thp}{lon}
\floatname{note}{Note}
\newfloat{source}{thp}{los}
\floatname{source}{Source}
\newcommand{\listofnotes}{\listof{note}{List Of Notes}}
\newcommand{\listofsource}{\listof{source}{List Of Source}}
\newcommand{\rfc}[2]
{
\begin{center}
\ovalbox{
\begin{minipage}{.8\textwidth}
\begin{center}
{\bf #1:} {\it #2}
\end{center}
\end{minipage}
}
\end{center}
}

View File

@ -1,76 +0,0 @@
\chapter{Deploying}
This chapter will guide you through the installation steps that should lead to your Fluksometer's successful deployment. Please consult the troubleshooting chapter if you experience any installation difficulties.
\section{Networking}
\label{sec:deploying_networking}
Out of the box, a Fluksometer will report to the Flukso server via the wifi interface. Please refer to section~\ref{sec:deploying_networking_wifi} if you wish to use your Fluksometer in this reporting mode. As detailed in section~\ref{sec:introduction_pushbutton}, the Fluksometer's pushbutton can be used to toggle the reporting mode to ethernet. The networking setup for this case is described in section~\ref{sec:deploying_networking_eth}.
\subsection{Wifi Mode}
\label{sec:deploying_networking_wifi}
Power up your Fluksometer and wait until the heartbeat LED starts to blink. Connect your computer to the Fluksometer's ethernet port. Then surf to \href{http://192.168.255.1}{192.168.255.1}. Configure the wifi page with the proper name and security key so that the Fluksometer gets connected with the internet via your local wifi network. After saving\footnote{While saving settings doesn't take long, restarting the whole wifi and networking stack with its dependencies can take more than a minute to complete. Be patient.} these settings, the globe LED on the Fluksometer should light up. To further test your configuration, try surfing to \href{http://www.flukso.net}{www.flukso.net} while the ethernet cable is still connected to the Fluksometer.
\begin{aside}{Art thou WAN or LAN?}
\label{note:deploying_networkig_wan_lan}
The default settings listed on the network page will mostly work just fine. Should this not be the case, it's important to understand which section on the network page applies to which interface. In wifi mode, the \emph{Local Network} or \emph{LAN} section refers to the ethernet interface while the \emph{Internet Connection} or \emph{WAN} section is associated with the wifi interface. So if you want to assign a fixed IP address to the wifi interface, then you should set the \emph{Protocol} for the \emph{Internet Connection} to \emph{manual} and fill in the additional form fields. Conversely, if you wish to change the IP settings on the ethernet interface, then the \emph{Local Network} section should be edited.
We understand this configuration aspect will be the cause of some confusion. We however cannot apply the \emph{ethernet} and \emph{wifi} naming to these sections directly since they are swapped when toggling the Fluksometer into ethernet mode. The \emph{Internet Connection} will in this case refer to the ethernet interface and the \emph{Local Network} to the wifi interface.
\end{aside}
\subsection{Ethernet Mode}
\label{sec:deploying_networking_eth}
When the reporting mode is toggled to ethernet, the ethernet interface will be set as a DHCP client. The wifi interface will be disabled. Connect the Fluksometer's ethernet port to your network and find out which IP address it has been assigned by your DHCP server. Power up your Fluksometer and wait until the heartbeat LED starts to blink. The globe LED should now be on. Surf to the Fluksometer's ethernet IP address. No further network configuration steps should be required. In case you do need to change something, you should read note~\ref{note:deploying_networkig_wan_lan} first.
\section{Configuring Sensors}
The sensor configuration will be synchronized with the Flukso server each time you save the sensor page. A synchronization can only be successful when the Fluksometer has internet connectivity. You should therefore make sure the globe LED is lit before commencing this configuration step. If not, then goto section~\ref{sec:deploying_networking}.
\subsection{Services}
Your Fluksometer will by default be configured to report its measurements to the Flukso server. Clear the checkbox if you want to stop all communication with the Flukso server. Since no HTTP calls will be initiated to the server anymore, the globe LED will be turned off.
The Fluksometer can make its sensor measurements available through a local JSON/REST API as well. While the Flukso server allows you to analyze your historical data and derive trend information, this local API is useful for monitoring your sensors in real-time. Sixty datapoints with a second resolution will be made available via the local API. No historical data is stored on the Fluksometer itself. Set the checkbox if you wish to enable the local API feature.
\subsection{Current Clamp Setup}
Select the number of phases that apply for your current clamp setup. When selecting 3 phases, the three current clamp ports will be grouped and presented as a single sensor \#1. Sensors \#2 and \#3 will be disabled automatically after saving. When selecting 1 phase, each clamp port will be sampled seperately and mapped to sensors \#1, \#2 and \#3 respectively.
\subsection{Sensors}
As already indicated in the previous section, a sensor is a \emph{logical} entity that can aggregate multiple \emph{physical} screw terminal ports as defined in section~\ref{sec:introduction_ports_screw}. Since the screw terminal contains a maximum of six ports, six sensors per Fluksometer will suffice. A sensor is defined by a unique identifier. Sensors can be enabled or disabled individually. Leave sensors in a disabled state when not in use. An enabled sensor requires a name. This name will be used in the Flukso website's charts. It's important that you assign a distinct name for each enabled sensor associated with your account. By convention, we use \emph{main} for total household electricity consumption and \emph{solar} for photo-voltaic production. When adding other users to your chart on the Flukso website, the main sensors will be the ones on display. A sensor can only contain ports of the same class. Ports that have different classes cannot be aggregated into a single sensor. We now introduce each of the three classes in turn:
\begin{description}
\item[Analog] Ports \#1, \#2 and \#3 are analog ports. They accept Flukso split-core current clamps of 50A, 100A, 250A and 500A. A three-phase setup requires all current clamps to be identical. Besides the current range, you can also specify the line voltage for each clamp. The default is 230V, which applies to the mains electricity voltage in most European countries. Australia and New-Zealand have a 240V power grid. Please consult this Wikipedia \href{http://en.wikipedia.org/wiki/Mains_electricity_by_country}{article} if you are unsure about your country's mains voltage.
\item[Pulse] Ports \#4 and \#5 on the screw terminal are pulse ports. They are mapped to sensors \#4 and \#5 respectively. A meterconstant defines the amount represented by each pulse. For electricity, the unit is Wh per pulse while water is specified in dl per pulse.
\item[Uart] The RS-485 port \#6 is mapped to sensor \#6. The baud rate is set to a fixed 115200.
\end{description}
\section{Securing the Fluksometer}
Disconnect all cables from the Fluksometer. Now find a suitable location near the fuse box to install the device. Mounting holes have been provisioned on the back of the Fluksometer. Alternatively, you can use a plastic cable tie or velcro.
\section{Attaching Current Clamps}
For safety reasons, switch off the main electricity supply when installing the current clamps. Attach a clamp to each non-neutral line in the fuse box. Close the clamps firmly. You should hear a double click. The lip should lie flush with the clamp's body.
\section{Connecting Sensor Clamp Cables}
Connect a cable from each current clamp to the Fluksometer's screw terminal. Use the red wire for positive polarity and the black one for negative polarity.
\section{Powering Up}
Switch the main electricity supply back on. Activate the Fluksometer by inserting its power plug.
\section{Registering}
Vist \href{http://www.flukso.net/user/register}{www.flukso.net/user/register} and fill in the form to create your account. Once logged in, you can associate the Fluksometer with your account. Click on the \emph{My account $\rightarrow$ Devices} tab and submit the Fluksometer's serial number. You should now see this Fluksometer added to the device list.
Point your browser to \href{http://www.flukso.net}{www.flukso.net}. A first reading should be visible on the hour chart within five minutes from powering up.
\section{Congratulations}
You are now part of the Flukso community!

View File

@ -1,47 +0,0 @@
\chapter{Introduction}
Let's kick off this manual with a short tour of a Fluksometer's externals. We will introduce each of the Fluksometer's ports, buttons and LEDs.
\section{Ports}
\subsection{Screw Terminal}
\label{sec:introduction_ports_screw}
The screw terminal contains twelve inputs. A \emph{port} on the screw terminal is defined as a \emph{pair of adjacent inputs}. We have printed the port numbers on the side of the enclosure for easy reference, with the polarity denoted by + and -. Ports 1 to 3 are analog ports that are tuned to accept Flukso split-core current clamps. Ports 4 and 5 can be used for detecting pulses. This includes support for, but is not limited to, the S0 interface\footnote{S0 is an open-collector interface standardized in DIN EN 62053-31} common to DIN-rail energy meters. Finally, port 6 offers a half-duplex RS-485 serial interface. Contrary to the other ports, the RS-485 port has its polarity indicated by the letters a and b.
\subsection{Ethernet}
The ethernet port offers support for a 10baseT/100baseTx interface with auto-negotiation and auto MDI/MDI-X crossover detection.
\subsection{Power Jack}
The center-positive power jack accepts a DC voltage between 9V and 15V. The switching adapter should have a minimum rating of 500mA output current.
\section{Pushbutton}
\label{sec:introduction_pushbutton}
The pushbutton has a dual function. Which function will be triggered depends on how long the button is pressed.
\begin{description}
\item[Toggle reporting mode] If you press the button for 2 to 5 seconds, the Fluksometer will toggle its reporting mode to the Flukso server from wifi to ethernet or vice-versa.
\item[Restore defaults] If you press the button between 10 and 30 seconds, the Fluksometer will restore its default network settings.
\end{description}
\section{LEDs}
The Fluksometer has five red LEDs on the top of its enclosure. Together these LEDs provide us with an overview of the Fluksometer's internal functioning, the status of its network interfaces and its ability to communicate with the Flukso server. From left to right, these LEDs are:
\begin{description}
\item[Wifi] If the wifi interface is enabled, the wifi LED will blink. A fast blink rate [approx. twice per second] signals that no wifi connection can be established. A slow blink rate [once every three seconds] signifies that a wifi connection has been successfully set up.
\item[Ethernet] The ethernet LED will be on when an ethernet link is established. This can either be a 10baseT or 100baseTX link in full- or half-duplex mode.
\item[Globe] After the Fluksometer has finished its boot sequence, the globe LED will be on when it can access the Flukso server. Every time the Fluksometer reports to the Flukso server, the LED will blink in case of a successful call. The globe LED will be turned off when the call is not completed successfully. A successful call has been made when either a 200 or 204 HTTP response code is returned by the Flukso server.
\item[Heartbeat] The heartbeat LED is positioned right next to the globe led. While the globe LED informs us about the status of the Fluksometer's external communication, the heartbeat LED allows us to monitor the Fluksometer's internal functioning. This LED will be on when the sensor board is running its firmware. From the moment the Flukso daemon is started during the boot sequence, it will start polling the sensor board every second for data. Each poll triggers a blink of this LED, thus mimicking a real heartbeat. Hence, a 'heartbeat' is an indication of a Fluksometer that has booted, a running Flukso daemon, a sensor board running its firmware and proper communication between the main board and sensor board.
\item[Power] The power LED is directly connected to the internal 3.3V supply. A burning LED indicates that power has been applied to the device and the internal voltage regulators are working properly.
\end{description}

View File

@ -1,28 +0,0 @@
BOOK=manual
PREFACE=preface.tex
DIR=out
COMMIT=$(shell git rev-parse HEAD | awk '{print substr($$0,1,16)}')
URL=https://github.com/icarus75/flukso/commit/$(shell git rev-parse HEAD)
SITE=$(USER)@flukso.net:~/www/public/files/
pdf:
mkdir -p $(DIR)
cp *.tex *.sty $(DIR)
sed -i 's,\\COMMIT,$(COMMIT),g' $(DIR)/$(PREFACE)
sed -i 's,\\URL,$(URL),g' $(DIR)/$(PREFACE)
pdflatex -halt-on-error -output-directory=$(DIR) $(DIR)/$(BOOK).tex
pdflatex -halt-on-error -output-directory=$(DIR) $(DIR)/$(BOOK).tex
view: pdf
evince $(DIR)/$(BOOK).pdf
publish: pdf
scp $(DIR)/$(BOOK).pdf $(SITE)
clean:
rm $(DIR).aux $(DIR).out $(DIR).toc $(DIR).log $(DIR).pdf
pristine:
rm -rf $(DIR)

View File

@ -1,31 +0,0 @@
\include{preamble}
\include{commands}
\title{
The Fluksometer Manual\\
\textit{Deploying, Troubleshooting, Hacking}\\
}
\author{Bart Van Der Meerssche}
\date{May 2011}
\begin{document}
\frontmatter
\maketitle
\tableofcontents
\include{preface}
\mainmatter
\include{introduction}
\include{deploying}
%\include{troubleshooting}
%\include{hacking}
%\include{contributing}
\appendix
\end{document}

View File

@ -1,87 +0,0 @@
\makeatletter
\def\PY@reset{\let\PY@it=\relax \let\PY@bf=\relax%
\let\PY@ul=\relax \let\PY@tc=\relax%
\let\PY@bc=\relax \let\PY@ff=\relax}
\def\PY@tok#1{\csname PY@tok@#1\endcsname}
\def\PY@toks#1+{\ifx\relax#1\empty\else%
\PY@tok{#1}\expandafter\PY@toks\fi}
\def\PY@do#1{\PY@bc{\PY@tc{\PY@ul{%
\PY@it{\PY@bf{\PY@ff{#1}}}}}}}
\def\PY#1#2{\PY@reset\PY@toks#1+\relax+\PY@do{#2}}
\def\PY@tok@gd{\def\PY@tc##1{\textcolor[rgb]{0.00,0.00,0.00}{##1}}\def\PY@bc##1{\colorbox[rgb]{1.00,0.87,0.87}{##1}}}
\def\PY@tok@gu{\def\PY@tc##1{\textcolor[rgb]{0.38,0.38,0.38}{##1}}}
\def\PY@tok@gt{\def\PY@tc##1{\textcolor[rgb]{0.67,0.00,0.00}{##1}}}
\def\PY@tok@gs{\let\PY@bf=\textbf}
\def\PY@tok@gr{\def\PY@tc##1{\textcolor[rgb]{0.67,0.00,0.00}{##1}}}
\def\PY@tok@cm{\def\PY@tc##1{\textcolor[rgb]{0.53,0.53,0.53}{##1}}}
\def\PY@tok@vg{\def\PY@tc##1{\textcolor[rgb]{0.87,0.47,0.00}{##1}}}
\def\PY@tok@m{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.00,0.87}{##1}}}
\def\PY@tok@mh{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.00,0.87}{##1}}}
\def\PY@tok@cs{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.80,0.00,0.00}{##1}}\def\PY@bc##1{\colorbox[rgb]{1.00,0.94,0.94}{##1}}}
\def\PY@tok@ge{\let\PY@it=\textit}
\def\PY@tok@vc{\def\PY@tc##1{\textcolor[rgb]{0.20,0.40,0.60}{##1}}}
\def\PY@tok@il{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.00,0.87}{##1}}}
\def\PY@tok@go{\def\PY@tc##1{\textcolor[rgb]{0.53,0.53,0.53}{##1}}}
\def\PY@tok@cp{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.80,0.00,0.00}{##1}}}
\def\PY@tok@gi{\def\PY@tc##1{\textcolor[rgb]{0.00,0.00,0.00}{##1}}\def\PY@bc##1{\colorbox[rgb]{0.87,1.00,0.87}{##1}}}
\def\PY@tok@gh{\def\PY@tc##1{\textcolor[rgb]{0.19,0.19,0.19}{##1}}}
\def\PY@tok@s2{\def\PY@tc##1{\textcolor[rgb]{0.87,0.13,0.00}{##1}}\def\PY@bc##1{\colorbox[rgb]{1.00,0.94,0.94}{##1}}}
\def\PY@tok@nl{\let\PY@it=\textit\def\PY@tc##1{\textcolor[rgb]{0.20,0.40,0.60}{##1}}}
\def\PY@tok@nn{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.73,0.00,0.40}{##1}}}
\def\PY@tok@no{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.20,0.40}{##1}}}
\def\PY@tok@na{\def\PY@tc##1{\textcolor[rgb]{0.20,0.40,0.60}{##1}}}
\def\PY@tok@nb{\def\PY@tc##1{\textcolor[rgb]{0.00,0.20,0.53}{##1}}}
\def\PY@tok@nc{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.73,0.00,0.40}{##1}}}
\def\PY@tok@nd{\def\PY@tc##1{\textcolor[rgb]{0.33,0.33,0.33}{##1}}}
\def\PY@tok@ne{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.73,0.00,0.40}{##1}}}
\def\PY@tok@nf{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.40,0.73}{##1}}}
\def\PY@tok@si{\def\PY@tc##1{\textcolor[rgb]{0.20,0.20,0.73}{##1}}\def\PY@bc##1{\colorbox[rgb]{1.00,0.94,0.94}{##1}}}
\def\PY@tok@sh{\def\PY@tc##1{\textcolor[rgb]{0.87,0.13,0.00}{##1}}\def\PY@bc##1{\colorbox[rgb]{1.00,0.94,0.94}{##1}}}
\def\PY@tok@vi{\def\PY@tc##1{\textcolor[rgb]{0.20,0.20,0.73}{##1}}}
\def\PY@tok@py{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.20,0.40,0.60}{##1}}}
\def\PY@tok@nt{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.73,0.00,0.40}{##1}}}
\def\PY@tok@nv{\def\PY@tc##1{\textcolor[rgb]{0.20,0.40,0.60}{##1}}}
\def\PY@tok@s1{\def\PY@tc##1{\textcolor[rgb]{0.87,0.13,0.00}{##1}}\def\PY@bc##1{\colorbox[rgb]{1.00,0.94,0.94}{##1}}}
\def\PY@tok@gp{\def\PY@tc##1{\textcolor[rgb]{0.33,0.33,0.33}{##1}}}
\def\PY@tok@ow{\def\PY@tc##1{\textcolor[rgb]{0.00,0.53,0.00}{##1}}}
\def\PY@tok@sx{\def\PY@tc##1{\textcolor[rgb]{0.13,0.73,0.13}{##1}}\def\PY@bc##1{\colorbox[rgb]{0.94,1.00,0.94}{##1}}}
\def\PY@tok@bp{\def\PY@tc##1{\textcolor[rgb]{0.00,0.20,0.53}{##1}}}
\def\PY@tok@c1{\def\PY@tc##1{\textcolor[rgb]{0.53,0.53,0.53}{##1}}}
\def\PY@tok@kc{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.53,0.00}{##1}}}
\def\PY@tok@c{\def\PY@tc##1{\textcolor[rgb]{0.53,0.53,0.53}{##1}}}
\def\PY@tok@mf{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.00,0.87}{##1}}}
\def\PY@tok@err{\def\PY@tc##1{\textcolor[rgb]{0.65,0.09,0.09}{##1}}\def\PY@bc##1{\colorbox[rgb]{0.89,0.82,0.82}{##1}}}
\def\PY@tok@kd{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.53,0.00}{##1}}}
\def\PY@tok@ss{\def\PY@tc##1{\textcolor[rgb]{0.67,0.40,0.00}{##1}}\def\PY@bc##1{\colorbox[rgb]{1.00,0.94,0.94}{##1}}}
\def\PY@tok@sr{\def\PY@tc##1{\textcolor[rgb]{0.00,0.53,0.00}{##1}}\def\PY@bc##1{\colorbox[rgb]{1.00,0.94,1.00}{##1}}}
\def\PY@tok@mo{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.00,0.87}{##1}}}
\def\PY@tok@mi{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.00,0.87}{##1}}}
\def\PY@tok@kn{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.53,0.00}{##1}}}
\def\PY@tok@kr{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.53,0.00}{##1}}}
\def\PY@tok@s{\def\PY@tc##1{\textcolor[rgb]{0.87,0.13,0.00}{##1}}\def\PY@bc##1{\colorbox[rgb]{1.00,0.94,0.94}{##1}}}
\def\PY@tok@kp{\def\PY@tc##1{\textcolor[rgb]{0.00,0.53,0.00}{##1}}}
\def\PY@tok@w{\def\PY@tc##1{\textcolor[rgb]{0.73,0.73,0.73}{##1}}}
\def\PY@tok@kt{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.53,0.53,0.53}{##1}}}
\def\PY@tok@sc{\def\PY@tc##1{\textcolor[rgb]{0.87,0.13,0.00}{##1}}\def\PY@bc##1{\colorbox[rgb]{1.00,0.94,0.94}{##1}}}
\def\PY@tok@sb{\def\PY@tc##1{\textcolor[rgb]{0.87,0.13,0.00}{##1}}\def\PY@bc##1{\colorbox[rgb]{1.00,0.94,0.94}{##1}}}
\def\PY@tok@k{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.53,0.00}{##1}}}
\def\PY@tok@se{\def\PY@tc##1{\textcolor[rgb]{0.00,0.27,0.87}{##1}}\def\PY@bc##1{\colorbox[rgb]{1.00,0.94,0.94}{##1}}}
\def\PY@tok@sd{\def\PY@tc##1{\textcolor[rgb]{0.87,0.13,0.00}{##1}}\def\PY@bc##1{\colorbox[rgb]{1.00,0.94,0.94}{##1}}}
\def\PYZbs{\char`\\}
\def\PYZus{\char`\_}
\def\PYZob{\char`\{}
\def\PYZcb{\char`\}}
\def\PYZca{\char`\^}
\def\PYZsh{\char`\#}
\def\PYZpc{\char`\%}
\def\PYZdl{\char`\$}
\def\PYZti{\char`\~}
% for compatibility with earlier versions
\def\PYZat{@}
\def\PYZlb{[}
\def\PYZrb{]}
\makeatother

View File

@ -1,49 +0,0 @@
\documentclass[a4paper]{book}
%\usepackage{iwona,palatino}
\usepackage{pastie}
\usepackage[
pdftitle={The Fluksometer Manual: Deploying, Troubleshooting, Hacking},
pdfauthor={Bart Van Der Meerssche},
pdfsubject={The Fluksometer Bible.},
pdfkeywords={Flukso, monitoring, energy},
bookmarks, bookmarksopen,
pdfstartview=FitH,
colorlinks,linkcolor=blue,citecolor=blue,
urlcolor=blue,
]{hyperref}
\usepackage{float}
\usepackage{fancybox}
\usepackage{fancyvrb}
\usepackage{color}
\usepackage{parskip}
\usepackage{textcomp}
\usepackage{listings}
\parskip 7.2pt
\lstset{basicstyle=\ttfamily,
upquote=true,
breaklines=true,
postbreak=\raisebox{0ex}[0ex][0ex]{\ensuremath{\hookrightarrow}},
breakatwhitespace=true
}
% taken from http://mintaka.sdsu.edu/GF/bibliog/latex/floats.html
% Alter some LaTeX defaults for better treatment of figures:
% See p.105 of "TeX Unbound" for suggested values.
% See pp. 199-200 of Lamport's "LaTeX" book for details.
% General parameters, for ALL pages:
\renewcommand{\topfraction}{0.9} % max fraction of floats at top
\renewcommand{\bottomfraction}{0.8} % max fraction of floats at bottom
% Parameters for TEXT pages (not float pages):
\setcounter{topnumber}{2}
\setcounter{bottomnumber}{2}
\setcounter{totalnumber}{4} % 2 may work better
\setcounter{dbltopnumber}{2} % for 2-column pages
\renewcommand{\dbltopfraction}{0.9} % fit big float above 2-col. text
\renewcommand{\textfraction}{0.07} % allow minimal text w. figs
% Parameters for FLOAT pages (not text pages):
\renewcommand{\floatpagefraction}{0.7} % require fuller float pages
% N.B.: floatpagefraction MUST be less than topfraction !!
\renewcommand{\dblfloatpagefraction}{0.7} % require fuller float pages
% remember to use [htp] or [htpb] for placement

View File

@ -1,3 +0,0 @@
\chapter{Preface}
This version of the Fluksometer Manual is based on commit \href{\URL}{\COMMIT} of the Flukso Git repository.

View File

@ -1,154 +0,0 @@
[CAM Processor Job]
Description[en]="<b>Generates Extended Gerber Format</b><p>\nThis CAM job consists of five sections that generate data for a two layer board.<p><p>\nYou will get five gerber files that contain data for:<br>\ncomponent side *.cmp<br>\nsolder side *.sol<br>\nsilkscreen component side *.plc<br>\nsolder stop component side *.stc<br>\nsolder stop solder sid *.sts<br>"
Section=Sec_1
Section=Sec_2
Section=Sec_3
Section=Sec_4
Section=Sec_5
Section=Sec_6
Section=Sec_7
Section=Sec_8
[Sec_1]
Name[en]="Top Copper"
Prompt[en]=""
Device="GERBER_RS274X"
Wheel=""
Rack=""
Scale=1
Output=".GTL"
Flags="0 0 0 1 0 1 1"
Emulate="0 0 0"
Offset="0.0mil 0.0mil"
Sheet=1
Tolerance="0 0 0 0 0 0"
Pen="0.0mil 0"
Page="12000.0mil 8000.0mil"
Layers=" 1 17 18 20"
Colors=" 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 6 6 4 8 8 8 8 8 8 8 8 8 8 8 8 8 4 4 1 1 1 1 3 3 1 2 6 8 8 5 8 8 8 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 4 2 4 3 6 6 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0"
[Sec_2]
Name[en]="Bottom Copper"
Prompt[en]=""
Device="GERBER_RS274X"
Wheel=".whl"
Rack=""
Scale=1
Output=".GBL"
Flags="0 0 0 1 0 1 1"
Emulate="0 0 0"
Offset="0.0mil 0.0mil"
Sheet=1
Tolerance="0 0 0 0 0 0"
Pen="0.0mil 0"
Page="12000.0mil 8000.0mil"
Layers=" 16 17 18"
Colors=" 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 6 6 4 8 8 8 8 8 8 8 8 8 8 8 8 8 4 4 1 1 1 1 3 3 1 2 6 8 8 5 8 8 8 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 4 2 4 3 6 6 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0"
[Sec_3]
Name[en]="Top Silkscreen"
Prompt[en]=""
Device="GERBER_RS274X"
Wheel=".whl"
Rack=""
Scale=1
Output=".GTO"
Flags="0 0 0 1 0 1 1"
Emulate="0 0 0"
Offset="0.0mil 0.0mil"
Sheet=1
Tolerance="0 0 0 0 0 0"
Pen="0.0mil 0"
Page="12000.0mil 8000.0mil"
Layers=" 21 25"
Colors=" 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 6 6 4 8 8 8 8 8 8 8 8 8 8 8 8 8 4 4 1 1 1 1 3 3 1 2 6 8 8 5 8 8 8 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 4 2 4 3 6 6 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0"
[Sec_4]
Name[en]="Top Paste"
Prompt[en]=""
Device="GERBER_RS274X"
Wheel=".whl"
Rack=""
Scale=1
Output=".GTP"
Flags="0 0 0 1 0 1 1"
Emulate="0 0 0"
Offset="0.0mil 0.0mil"
Sheet=1
Tolerance="0 0 0 0 0 0"
Pen="0.0mil 0"
Page="12000.0mil 8000.0mil"
Layers=" 31"
Colors=" 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 6 6 4 8 8 8 8 8 8 8 8 8 8 8 8 8 4 4 1 1 1 1 3 3 1 2 6 8 8 5 8 8 8 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 4 2 4 3 6 6 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0"
[Sec_5]
Name[en]="Bottom Silkscreen"
Prompt[en]=""
Device="GERBER_RS274X"
Wheel=""
Rack=""
Scale=1
Output=".GBO"
Flags="0 0 0 1 0 1 1"
Emulate="0 0 0"
Offset="0.0mil 0.0mil"
Sheet=1
Tolerance="0 0 0 0 0 0"
Pen="0.0mil 0"
Page="12000.0mil 8000.0mil"
Layers=" 22"
Colors=" 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 6 6 4 8 8 8 8 8 8 8 8 8 8 8 8 8 4 4 1 1 1 1 3 3 1 2 6 8 8 5 8 8 8 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 4 2 4 3 6 6 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0"
[Sec_6]
Name[en]="Top Soldermask"
Prompt[en]=""
Device="GERBER_RS274X"
Wheel=".whl"
Rack=""
Scale=1
Output=".GTS"
Flags="0 0 0 1 0 1 1"
Emulate="0 0 0"
Offset="0.0mil 0.0mil"
Sheet=1
Tolerance="0 0 0 0 0 0"
Pen="0.0mil 0"
Page="12000.0mil 8000.0mil"
Layers=" 29"
Colors=" 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 6 6 4 8 8 8 8 8 8 8 8 8 8 8 8 8 4 4 1 1 1 1 3 3 1 2 6 8 8 5 8 8 8 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 4 2 4 3 6 6 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0"
[Sec_7]
Name[en]="Bottom Soldermask"
Prompt[en]=""
Device="GERBER_RS274X"
Wheel=".whl"
Rack=""
Scale=1
Output=".GBS"
Flags="0 0 0 1 0 1 1"
Emulate="0 0 0"
Offset="0.0mil 0.0mil"
Sheet=1
Tolerance="0 0 0 0 0 0"
Pen="0.0mil 0"
Page="12000.0mil 8000.0mil"
Layers=" 30"
Colors=" 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 6 6 4 8 8 8 8 8 8 8 8 8 8 8 8 8 4 4 1 1 1 1 3 3 1 2 6 8 8 5 8 8 8 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 4 2 4 3 6 6 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0"
[Sec_8]
Name[en]="Drill File"
Prompt[en]=""
Device="EXCELLON"
Wheel=""
Rack="/Users/icarus75/Documents/eagle/flukso.sensor.board.v2.0/flukso.sensor.board.v2.0.DRL"
Scale=1
Output=".DRD"
Flags="0 0 0 1 0 1 1"
Emulate="0 0 0"
Offset="0.0mil 0.0mil"
Sheet=1
Tolerance="0 0 0 0 0 0"
Pen="0.0mil 0"
Page="12000.0mil 8000.0mil"
Layers=" 44 45"
Colors=" 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 6 6 4 8 8 8 8 8 8 8 8 8 8 8 8 8 4 4 1 1 1 1 3 3 1 2 6 8 8 5 8 8 8 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 4 2 4 3 6 6 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0"

View File

@ -1,72 +0,0 @@
description[en] = <b>EAGLE Design Rules</b>\n<p>\nThe default Design Rules have been set to cover\na wide range of applications. Your particular design\nmay have different requirements, so please make the\nnecessary adjustments and save your customized\ndesign rules under a new name.
layerSetup = (1*16)
mtCopper = 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm
mtIsolate = 1.5mm 0.15mm 0.2mm 0.15mm 0.2mm 0.15mm 0.2mm 0.15mm 0.2mm 0.15mm 0.2mm 0.15mm 0.2mm 0.15mm 0.2mm
mdWireWire = 10mil
mdWirePad = 10mil
mdWireVia = 10mil
mdPadPad = 10mil
mdPadVia = 10mil
mdViaVia = 10mil
mdSmdPad = 10mil
mdSmdVia = 10mil
mdSmdSmd = 10mil
mdViaViaSameLayer = 8mil
mnLayersViaInSmd = 2
mdCopperDimension = 40mil
mdDrill = 10mil
mdSmdStop = 0mil
msWidth = 10mil
msDrill = 24mil
msMicroVia = 9.99mm
msBlindViaRatio = 0.500000
rvPadTop = 0.250000
rvPadInner = 0.250000
rvPadBottom = 0.250000
rvViaOuter = 0.250000
rvViaInner = 0.250000
rvMicroViaOuter = 0.250000
rvMicroViaInner = 0.250000
rlMinPadTop = 10mil
rlMaxPadTop = 20mil
rlMinPadInner = 10mil
rlMaxPadInner = 20mil
rlMinPadBottom = 10mil
rlMaxPadBottom = 20mil
rlMinViaOuter = 8mil
rlMaxViaOuter = 20mil
rlMinViaInner = 8mil
rlMaxViaInner = 20mil
rlMinMicroViaOuter = 4mil
rlMaxMicroViaOuter = 20mil
rlMinMicroViaInner = 4mil
rlMaxMicroViaInner = 20mil
psTop = -1
psBottom = -1
psFirst = -1
psElongationLong = 100
psElongationOffset = 100
mvStopFrame = 0.100000
mvCreamFrame = 0.000000
mlMinStopFrame = 0mil
mlMaxStopFrame = 20mil
mlMinCreamFrame = 0mil
mlMaxCreamFrame = 0mil
mlViaStopLimit = 0mil
srRoundness = 0.000000
srMinRoundness = 0mil
srMaxRoundness = 0mil
slThermalGap = 0.500000
slMinThermalGap = 20mil
slMaxThermalGap = 100mil
slAnnulusIsolate = 20mil
slThermalIsolate = 10mil
slAnnulusRestring = 0
slThermalRestring = 1
slThermalsForVias = 0
checkGrid = 0
checkAngle = 0
checkFont = 1
checkRestrict = 1
useDiameter = 13
maxErrors = 50

View File

@ -1,72 +0,0 @@
description = <b>EAGLE Design Rules</b>\n<p>\nThe default Design Rules have been set to cover\na wide range of applications. Your particular design\nmay have different requirements, so please make the\nnecessary adjustments and save your customized\ndesign rules under a new name.
layerSetup = (1*16)
mtCopper = 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm
mtIsolate = 1.5mm 0.15mm 0.2mm 0.15mm 0.2mm 0.15mm 0.2mm 0.15mm 0.2mm 0.15mm 0.2mm 0.15mm 0.2mm 0.15mm 0.2mm
mdWireWire = 8mil
mdWirePad = 8mil
mdWireVia = 8mil
mdPadPad = 8mil
mdPadVia = 8mil
mdViaVia = 8mil
mdSmdPad = 8mil
mdSmdVia = 8mil
mdSmdSmd = 8mil
mdViaViaSameLayer = 8mil
mnLayersViaInSmd = 2
mdCopperDimension = 40mil
mdDrill = 10mil
mdSmdStop = 0mil
msWidth = 8mil
msDrill = 0.6mm
msMicroVia = 0mil
msBlindViaRatio = 0.000000
rvPadTop = 0.250000
rvPadInner = 0.250000
rvPadBottom = 0.250000
rvViaOuter = 0.250000
rvViaInner = 0.250000
rvMicroViaOuter = 0.250000
rvMicroViaInner = 0.250000
rlMinPadTop = 10mil
rlMaxPadTop = 20mil
rlMinPadInner = 10mil
rlMaxPadInner = 20mil
rlMinPadBottom = 10mil
rlMaxPadBottom = 20mil
rlMinViaOuter = 8mil
rlMaxViaOuter = 20mil
rlMinViaInner = 8mil
rlMaxViaInner = 20mil
rlMinMicroViaOuter = 8mil
rlMaxMicroViaOuter = 20mil
rlMinMicroViaInner = 8mil
rlMaxMicroViaInner = 20mil
psTop = -1
psBottom = -1
psFirst = -1
psElongationLong = 100
psElongationOffset = 100
mvStopFrame = 0.100000
mvCreamFrame = 0.000000
mlMinStopFrame = 0mil
mlMaxStopFrame = 20mil
mlMinCreamFrame = 0mil
mlMaxCreamFrame = 0mil
mlViaStopLimit = 0mil
srRoundness = 0.000000
srMinRoundness = 0mil
srMaxRoundness = 0mil
slThermalGap = 0.500000
slMinThermalGap = 20mil
slMaxThermalGap = 100mil
slAnnulusIsolate = 20mil
slThermalIsolate = 10mil
slAnnulusRestring = 0
slThermalRestring = 1
slThermalsForVias = 0
checkGrid = 0
checkAngle = 0
checkFont = 1
checkRestrict = 1
useDiameter = 13
maxErrors = 50

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -1,2 +0,0 @@
To set up a customized OpenWRT Backfire build environment for Flukso targets, just run:
. ./install.sh /your/preferred/backfire/installation/path

View File

@ -1,14 +0,0 @@
<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<service-group>
<name replace-wildcards="yes">Flukso RESTful API on %h</name>
<service>
<type>_flukso._tcp</type>
<port>8080</port>
<txt-record>id1=0123456789abcdef0123456789abcde0</txt-record>
<txt-record>id2=0123456789abcdef0123456789abcde1</txt-record>
<txt-record>id3=0123456789abcdef0123456789abcde2</txt-record>
<txt-record>path=/sensor</txt-record>
<txt-record>version=1.0</txt-record>
</service>
</service-group>

View File

@ -1,10 +0,0 @@
<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<service-group>
<name replace-wildcards="yes">Web Server on %h</name>
<service>
<type>_http._tcp</type>
<port>80</port>
<txt-record>path=/</txt-record>
</service>
</service-group>

View File

@ -1,23 +0,0 @@
config dnsmasq
option domainneeded 1
option boguspriv 1
option filterwin2k '0' #enable for dial on demand
option localise_queries 1
option local '/lan/'
option domain 'home'
option expandhosts 1
option nonegcache 0
option authoritative 1
option readethers 1
option leasefile '/tmp/dhcp.leases'
option resolvfile '/tmp/resolv.conf.auto'
config dhcp
option interface lan
option start 100
option limit 150
option leasetime 12h
config dhcp
option interface wan
option ignore 1

View File

@ -1,3 +0,0 @@
config dropbear
option PasswordAuth 'on'
option Port '22'

View File

@ -1,113 +0,0 @@
config defaults
option syn_flood 1
option input ACCEPT
option output ACCEPT
option forward REJECT
# Uncomment this line to disable ipv6 rules
# option disable_ipv6 1
config zone
option name lan
option input ACCEPT
option output ACCEPT
option forward REJECT
config zone
option name wan
option input REJECT
option output ACCEPT
option forward REJECT
option masq 1
option mtu_fix 1
config forwarding
option src lan
option dest wan
# We need to accept udp packets on port 68,
# see https://dev.openwrt.org/ticket/4108
config rule
option src wan
option proto udp
option dest_port 68
option target ACCEPT
option family ipv4
#Allow ping
config rule
option src wan
option proto icmp
option icmp_type echo-request
option target ACCEPT
#Allow access to local REST API on the wan itf
config rule
option src wan
option proto tcp
option dest_port 8080
option target ACCEPT
#Open up UDP port 5353 on the wan for avahi
config rule
option src wan
option proto udp
option dest_port 5353
option target ACCEPT
# include a file with users custom iptables rules
config include
option path /etc/firewall.user
### EXAMPLE CONFIG SECTIONS
# do not allow a specific ip to access wan
#config rule
# option src lan
# option src_ip 192.168.45.2
# option dest wan
# option proto tcp
# option target REJECT
# block a specific mac on wan
#config rule
# option dest wan
# option src_mac 00:11:22:33:44:66
# option target REJECT
# block incoming ICMP traffic on a zone
#config rule
# option src lan
# option proto ICMP
# option target DROP
# port redirect port coming in on wan to lan
#config redirect
# option src wan
# option src_dport 80
# option dest lan
# option dest_ip 192.168.16.235
# option dest_port 80
# option proto tcp
### FULL CONFIG SECTIONS
#config rule
# option src lan
# option src_ip 192.168.45.2
# option src_mac 00:11:22:33:44:55
# option src_port 80
# option dest wan
# option dest_ip 194.25.2.129
# option dest_port 120
# option proto tcp
# option target REJECT
#config redirect
# option src lan
# option src_ip 192.168.45.2
# option src_mac 00:11:22:33:44:55
# option src_port 1024
# option src_dport 80
# option dest_ip 194.25.2.129
# option dest_port 120
# option proto tcp

View File

@ -1,17 +0,0 @@
# Copyright (C) 2006 OpenWrt.org
config interface loopback
option ifname lo
option proto static
option ipaddr 127.0.0.1
option netmask 255.0.0.0
config interface wan
option ifname ath0
option proto dhcp
config interface lan
option ifname eth0
option proto static
option ipaddr 192.168.255.1
option netmask 255.255.255.0

View File

@ -1,22 +0,0 @@
config system
option timezone UTC
option hostname flukso
option device 0123456789abcdef0123456789abcdef
option key 00112233445566778899aabbccddeeff
option version 210
option firstboot 1
option cronloglevel 1
config button
option button reset
option action released
option handler net_toggle
option min 2
option max 5
config button
option button reset
option action released
option handler net_defaults
option min 10
option max 30

View File

@ -1,83 +0,0 @@
# Server configuration
config uhttpd main
# HTTP listen addresses, multiple allowed
list listen_http 0.0.0.0:80
# list listen_http [::]:80
# HTTPS listen addresses, multiple allowed
# list listen_https 0.0.0.0:443
# list listen_https [::]:443
# Server document root
option home /www
# Reject requests from RFC1918 IP addresses
# directed to the servers public IP(s).
# This is a DNS rebinding countermeasure.
option rfc1918_filter 1
# Certificate and private key for HTTPS.
# If no listen_https addresses are given,
# the key options are ignored.
option cert /etc/uhttpd.crt
option key /etc/uhttpd.key
# CGI url prefix, will be searched in docroot.
# Default is /cgi-bin
option cgi_prefix /cgi-bin
# List of extension->interpreter mappings.
# Files with an associated interpreter can
# be called outside of the CGI prefix and do
# not need to be executable.
# list interpreter ".php=/usr/bin/php-cgi"
# list interpreter ".cgi=/usr/bin/perl"
# Lua url prefix and handler script.
# Lua support is disabled if no prefix given.
# option lua_prefix /luci
# option lua_handler /usr/lib/lua/luci/sgi/uhttpd.lua
# CGI/Lua timeout, if the called script does not
# write data within the given amount of seconds,
# the server will terminate the request with
# 504 Gateway Timeout response.
option script_timeout 60
# Network timeout, if the current connection is
# blocked for the specified amount of seconds,
# the server will terminate the associated
# request process.
option network_timeout 30
# Basic auth realm, defaults to local hostname
# option realm OpenWrt
# Configuration file in busybox httpd format
# option config /etc/httpd.conf
config uhttpd restful
list listen_http 0.0.0.0:8080
option home /www
option cgi_prefix /sensor
option script_timeout 5
option network_timeout 5
# Certificate defaults for px5g key generator
config cert px5g
# Validity time
option days 730
# RSA key size
option bits 1024
# Location
option country DE
option state Berlin
option location Berlin
# Common name
option commonname OpenWrt

View File

@ -1,18 +0,0 @@
config wifi-device wifi0
option type atheros
option channel auto
option mode 11bg
option diversity 0
option txantenna 1
option rxantenna 1
option disabled 0
config wifi-iface
option device wifi0
option network wan
option mode sta
option nosbeacon 1
option hidden 0
option ssid zwaluw
option encryption wep
option key 4ae56b7820f6b6b3cba78da46b

View File

@ -1,3 +0,0 @@
root:x:0:
flukso:x:1:
nogroup:x:65534:

View File

@ -1,2 +0,0 @@
127.0.0.1 localhost
192.168.255.1 flukso

View File

@ -1,2 +0,0 @@
::sysinit:/etc/init.d/rcS S boot
::shutdown:/etc/init.d/rcS K stop

View File

@ -1,4 +0,0 @@
root:$1$VtdkJasi$HdGYp/XcbJmQ3BInhA/ki/:0:0:root:/root:/bin/ash
flukso:*:1:1:flukso:/var:/bin/false
nobody:*:65534:65534:nobody:/var:/bin/false
daemon:*:65534:65534:daemon:/var:/bin/false

View File

@ -1,11 +0,0 @@
# Put your custom commands here that should be executed once
# the system init finished. By default this file does nothing.
# set the globe led pin (=GPIO 5) direction to output
gpioctl dirout 5
# turn the globe led pin off (inverted logic)
gpioctl set 5
# set the wifi led pin (=GPIO 7) direction to output
gpioctl dirout 7
exit 0

View File

@ -1,21 +0,0 @@
-----BEGIN CERTIFICATE-----
MIIDfzCCAmegAwIBAgIJANYOkpI6yVcFMA0GCSqGSIb3DQEBBQUAMDMxCzAJBgNV
BAYTAkJFMQ8wDQYDVQQKEwZGbHVrc28xEzARBgNVBAMTCmZsdWtzby5uZXQwHhcN
MTAwNjAxMjE1ODAyWhcNMzUwNTI2MjE1ODAyWjAzMQswCQYDVQQGEwJCRTEPMA0G
A1UEChMGRmx1a3NvMRMwEQYDVQQDEwpmbHVrc28ubmV0MIIBIjANBgkqhkiG9w0B
AQEFAAOCAQ8AMIIBCgKCAQEA6CtNI3YrF/7Ak3etIe+XnL4HwJYki4PyaWI4S7W1
49C9W5AEbEd7ufnsaku3eVxMqOP6b5L7MFpCCGDiM1Zt32yYAcL65eCrofZw1DE0
SuWos0Z1P4y2rIUFHya8g8bUh7lUvq30IBgnnUh7Lo0eQT1XfnC/KMUnvseHI/iw
Y3HhYX+espsCPh1a0ATLlEk93XK99q/5mgojSGQxmwPj/91mOWmJOO4edEQAhK+u
t6wCNxZNnf9yyyzzLczwMytfrwBWJEJjJFTfr3JiEmHdl4dt7UiuElGLMr9dFhPV
12Bidxszov663ffUiIUmV/fkMWF1ZEWXFS0x+VJ52seChwIDAQABo4GVMIGSMB0G
A1UdDgQWBBQGMvERFrapN1lmOm9SVR8qB+uj/zBjBgNVHSMEXDBagBQGMvERFrap
N1lmOm9SVR8qB+uj/6E3pDUwMzELMAkGA1UEBhMCQkUxDzANBgNVBAoTBkZsdWtz
bzETMBEGA1UEAxMKZmx1a3NvLm5ldIIJANYOkpI6yVcFMAwGA1UdEwQFMAMBAf8w
DQYJKoZIhvcNAQEFBQADggEBAOZjgNoNhJLckVMEYZiYWqRDWeRPBkyGStCH93r3
42PpuKDyysxI1ldLTcUpUSrs1AtdSIEiEahWr6zVW4QW4o9iqO905E03aTO86L+P
j7SIBPP01M2f70pHpnz+uH1MDxsarI96qllslWfymYI7c6yUN/VciWfNWa38nK1l
MiQJuDvElNy8aN1JJtXHFUQK/I8ois1ATT1rGAiqrkDZIm4pdDmqB/zLI3qIJf8o
cKIo2x/YkVhuDmIpU/XVA13csXrXU+CLfFyNdY1a/6Dhv2B4wG6J5RGuxWmA+Igg
TTysD+aqqzs8XstqDu/aLjMzFKMaXNvDoCbdFQGVXfx0F1A=
-----END CERTIFICATE-----

View File

@ -1,28 +0,0 @@
kernel.panic=3
net.ipv4.conf.default.arp_ignore=1
net.ipv4.conf.all.arp_ignore=1
net.ipv4.ip_forward=1
net.ipv4.icmp_echo_ignore_broadcasts=1
net.ipv4.icmp_ignore_bogus_error_responses=1
net.ipv4.tcp_ecn=0
net.ipv4.tcp_fin_timeout=30
net.ipv4.tcp_keepalive_time=120
net.ipv4.tcp_syncookies=1
net.ipv4.tcp_timestamps=0
net.core.netdev_max_backlog=30
net.netfilter.nf_conntrack_checksum=0
net.ipv4.netfilter.ip_conntrack_checksum=0
net.ipv4.netfilter.ip_conntrack_max=16384
net.ipv4.netfilter.ip_conntrack_tcp_timeout_established=3600
net.ipv4.netfilter.ip_conntrack_udp_timeout=60
net.ipv4.netfilter.ip_conntrack_udp_timeout_stream=180
# net.ipv6.conf.all.forwarding=1
# disable bridge firewalling by default
net.bridge.bridge-nf-call-arptables=0
net.bridge.bridge-nf-call-ip6tables=0
net.bridge.bridge-nf-call-iptables=0
# blink the wifi led (= GPIO7)
dev.wifi0.softled=1
dev.wifi0.ledpin=7

View File

@ -1,87 +0,0 @@
#!/usr/bin/env bash
USAGE="Usage: . ./install /your/preferred/backfire/installation/path"
if (( $# < 1 ))
then
echo "Error. Not enough arguments."
echo $USAGE
exit 1
elif (( $# > 1 ))
then
echo "Error. Too many arguments."
echo $USAGE
exit 2
elif [ $1 == "--help" ]
then
echo $USAGE
exit 3
fi
REPO_PATH=$(pwd)
BACKFIRE_PATH=$1
# checkout the stock OpenWRT build environment to the path specified on the command line
mkdir -p $BACKFIRE_PATH
svn co svn://svn.openwrt.org/openwrt/branches/backfire $BACKFIRE_PATH
# add the specific flukso packages as a feed
echo "src-link flukso $REPO_PATH/package" > $BACKFIRE_PATH/feeds.conf
$BACKFIRE_PATH/scripts/feeds update
$BACKFIRE_PATH/scripts/feeds install -a -p flukso
# copy over the build config settings and the files directory
cp .config $BACKFIRE_PATH
cp -r files $BACKFIRE_PATH
# add patches to the toolchain
cp patches/990-add_timerfd_support.patch $BACKFIRE_PATH/toolchain/uClibc/patches-0.9.30.1
# add patches to the linux atheros target
cp patches/300-set_AR2315_RESET_GPIO_to_6.patch $BACKFIRE_PATH/target/linux/atheros/patches-2.6.30
cp patches/310-hotplug_button_jiffies_calc.patch $BACKFIRE_PATH/target/linux/atheros/patches-2.6.30
cp patches/400-spi_gpio_support.patch $BACKFIRE_PATH/target/linux/atheros/patches-2.6.30
cp patches/410-spi_gpio_enable_cs_line.patch $BACKFIRE_PATH/target/linux/atheros/patches-2.6.30
cp patches/420-tune_spi_bitbanging_for_avr.patch $BACKFIRE_PATH/target/linux/atheros/patches-2.6.30
# backport loglevel fix to busybox v1.15.3-2
# see: https://bugs.busybox.net/show_bug.cgi?id=681
cp patches/820-fix_crond_loglevel.patch $BACKFIRE_PATH/package/busybox/patches
# patch the default OpenWRT Lua package
rm $BACKFIRE_PATH/package/lua/patches/400-luaposix_5.1.4-embedded.patch
rm $BACKFIRE_PATH/package/lua/patches/500-eglibc_config.patch
cp patches/600-lua-tablecreate.patch $BACKFIRE_PATH/package/lua/patches
# copy flash utility to the tools dir
cp ../tools/ap51-flash $BACKFIRE_PATH/tools
# patch files of the OpenWRT build system
cd $BACKFIRE_PATH
patch -p0 < $REPO_PATH/patches/900-disable_console.patch
patch -p0 < $REPO_PATH/patches/910-set_ttyS0_baud_to_115200.patch
patch -p0 < $REPO_PATH/patches/920-add-make-flash-option.patch
# we don't need rdate, relying on ntpclient instead
rm $BACKFIRE_PATH/package/base-files/files/etc/hotplug.d/iface/40-rdate
# and then build the Fluksometer firmware...
echo
echo " ================================================= "
echo " To compile this custom Backfire build for Flukso, "
echo " just type make -j8 in the installation path you "
echo " selected. Use at least as many jobs as the number "
echo " of cores available on your build machine. "
echo
echo " IMPORTANT: make sure your machine has a recent "
echo " version of the gcc-avr toolchain (>= 4.3.4) and "
echo " avr-libc (>= 1.6.7) installed. "
echo
echo " To upload the firmware to the Fluksometer after "
echo " compilation, type make flash V=99. Then connect "
echo " the Fluksometer to your machine via ethernet and "
echo " power it up. "
echo
echo " Happy hacking! "
echo " ================================================= "
echo

View File

@ -1,68 +0,0 @@
10
dir
25991
svn://svn.openwrt.org/openwrt/packages/libs/avahi
svn://svn.openwrt.org/openwrt
2011-03-09T12:34:25.840259Z
25973
jow
3c298f89-4303-0410-b956-a3cf2f4a3e73
files
dir
patches
dir
Makefile
file
2011-03-10T08:41:40.084744Z
ffbac369cbd38b109da6e88e487209a2
2011-03-09T12:34:25.840259Z
25973
jow
has-props
5651

View File

@ -1,13 +0,0 @@
K 9
copyright
V 30
Copyright (C) 2006 OpenWrt.org
K 7
licence
V 5
GPLv2
K 13
svn:eol-style
V 6
native
END

View File

@ -1,196 +0,0 @@
#
# Copyright (C) 2007-2009 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=avahi
PKG_VERSION:=0.6.29
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=http://avahi.org/download/
PKG_MD5SUM:=bb9d326770689610d1dbaceab5a787fc
PKG_BUILD_DEPENDS:=libexpat libdaemon libgdbm intltool/host
PKG_FIXUP:=autoreconf
PKG_REMOVE_FILES:=autogen.sh
PKG_INSTALL:=1
PKG_BUILD_PARALLEL:=1
include $(INCLUDE_DIR)/package.mk
define Package/avahi/Default
SECTION:=net
CATEGORY:=Network
TITLE:=An mDNS/DNS-SD implementation
URL:=http://www.avahi.org/
endef
define Package/avahi/Default/description
An mDNS/DNS-SD (aka RendezVous/Bonjour/ZeroConf) implementation (library).
Avahi is a system which facilitates service discovery on a local network --
this means that you can plug your laptop or computer into a network and
instantly be able to view other people who you can chat with, find printers
to print to or find files being shared. This kind of technology is already
found in MacOS X (branded 'Rendezvous', 'Bonjour' and sometimes 'ZeroConf')
and is very convenient.
endef
define Package/libavahi
$(call Package/avahi/Default)
SECTION:=libs
CATEGORY:=Libraries
DEPENDS:=+libdaemon +libpthread +libgdbm
TITLE+= (library)
endef
define Package/libavahi/description
$(call Package/avahi/Default/description)
.
This package contains the mDNS/DNS-SD shared libraries, used by other programs.
endef
define Package/avahi-autoipd
$(call Package/avahi/Default)
DEPENDS:=+libdaemon
TITLE:=IPv4LL network address configuration daemon
endef
define Package/avahi-autoipd/description
$(call Package/avahi/Default/description)
.
This package implements IPv4LL, "Dynamic Configuration of IPv4 Link-Local
Addresses" (IETF RFC3927), a protocol for automatic IP address configuration
from the link-local 169.254.0.0/16 range without the need for a central
server. It is primarily intended to be used in ad-hoc networks which lack a
DHCP server.
endef
define Package/avahi-daemon
$(call Package/avahi/Default)
DEPENDS:=+libavahi +libexpat
TITLE+= (daemon)
endef
define Package/avahi-daemon/description
$(call Package/avahi/Default/description)
.
This package contains an mDNS/DNS-SD daemon.
endef
define Package/avahi-daemon/conffiles
/etc/avahi/avahi-daemon.conf
/etc/avahi/services/http.service
/etc/avahi/services/ssh.service
endef
define Package/avahi-dnsconfd
$(call Package/avahi/Default)
DEPENDS:=+libavahi
TITLE:=An Unicast DNS server from mDNS/DNS-SD configuration daemon
endef
define Package/avahi-dnsconfd/description
$(call Package/avahi/Default/description)
.
This package contains an Unicast DNS server from mDNS/DNS-SD configuration
daemon, which may be used to configure conventional DNS servers using mDNS
in a DHCP-like fashion. Especially useful on IPv6.
endef
TARGET_CFLAGS += $(FPIC) -DGETTEXT_PACKAGE
CONFIGURE_ARGS+= \
--enable-shared \
--enable-static \
--disable-glib \
--disable-gobject \
--disable-qt3 \
--disable-qt4 \
--disable-gtk \
--disable-gtk3 \
--disable-dbus \
--with-xml=expat \
--disable-dbm \
--enable-gdbm \
--enable-libdaemon \
--disable-python \
--disable-pygtk \
--disable-python-dbus \
--disable-mono \
--disable-monodoc \
--disable-doxygen-doc \
--disable-doxygen-dot \
--disable-doxygen-man \
--disable-doxygen-rtf \
--disable-doxygen-xml \
--disable-doxygen-chm \
--disable-doxygen-chi \
--disable-doxygen-html \
--disable-doxygen-ps \
--disable-doxygen-pdf \
--disable-xmltoman \
--with-distro=none \
--with-avahi-user=nobody \
--with-avahi-group=nogroup \
--with-autoipd-user=nobody \
--with-autoipd-group=nogroup
ifneq ($(CONFIG_SSP_SUPPORT),y)
CONFIGURE_ARGS+= \
--disable-stack-protector
endif
CONFIGURE_VARS+= \
CFLAGS="$$$$CFLAGS -DNDEBUG -DDISABLE_SYSTEMD" \
define Build/InstallDev
$(INSTALL_DIR) $(1)/usr/include
$(CP) $(PKG_INSTALL_DIR)/usr/include/avahi-{common,core} $(1)/usr/include/
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libavahi-{common,core}.{a,so*} $(1)/usr/lib/
$(INSTALL_DIR) $(1)/usr/lib/pkgconfig
$(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/avahi-core.pc $(1)/usr/lib/pkgconfig/
endef
define Package/libavahi/install
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libavahi-{common,core}.so.* $(1)/usr/lib/
endef
define Package/avahi-autoipd/install
$(INSTALL_DIR) $(1)/etc/avahi
$(CP) $(PKG_INSTALL_DIR)/etc/avahi/avahi-autoipd.action $(1)/etc/avahi/
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/avahi-autoipd $(1)/usr/sbin/
endef
define Package/avahi-daemon/install
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/avahi-daemon $(1)/usr/sbin/
$(INSTALL_DIR) $(1)/etc/avahi
$(INSTALL_DATA) ./files/avahi-daemon.conf $(1)/etc/avahi/
$(INSTALL_DIR) $(1)/etc/avahi/services
$(INSTALL_DATA) ./files/service-http $(1)/etc/avahi/services/http.service
$(INSTALL_DATA) ./files/service-ssh $(1)/etc/avahi/services/ssh.service
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) ./files/avahi-daemon.init $(1)/etc/init.d/avahi-daemon
endef
define Package/avahi-dnsconfd/install
$(INSTALL_DIR) $(1)/etc/avahi
$(CP) $(PKG_INSTALL_DIR)/etc/avahi/avahi-dnsconfd.action $(1)/etc/avahi/
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/avahi-dnsconfd $(1)/usr/sbin/
endef
$(eval $(call BuildPackage,libavahi))
$(eval $(call BuildPackage,avahi-autoipd))
$(eval $(call BuildPackage,avahi-daemon))
$(eval $(call BuildPackage,avahi-dnsconfd))

View File

@ -1,196 +0,0 @@
#
# Copyright (C) 2007-2009 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=avahi
PKG_VERSION:=0.6.29
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=http://avahi.org/download/
PKG_MD5SUM:=bb9d326770689610d1dbaceab5a787fc
PKG_BUILD_DEPENDS:=libexpat libdaemon libgdbm intltool/host
PKG_FIXUP:=autoreconf
PKG_REMOVE_FILES:=autogen.sh
PKG_INSTALL:=1
PKG_BUILD_PARALLEL:=1
include $(INCLUDE_DIR)/package.mk
define Package/avahi/Default
SECTION:=net
CATEGORY:=Network
TITLE:=An mDNS/DNS-SD implementation
URL:=http://www.avahi.org/
endef
define Package/avahi/Default/description
An mDNS/DNS-SD (aka RendezVous/Bonjour/ZeroConf) implementation (library).
Avahi is a system which facilitates service discovery on a local network --
this means that you can plug your laptop or computer into a network and
instantly be able to view other people who you can chat with, find printers
to print to or find files being shared. This kind of technology is already
found in MacOS X (branded 'Rendezvous', 'Bonjour' and sometimes 'ZeroConf')
and is very convenient.
endef
define Package/libavahi
$(call Package/avahi/Default)
SECTION:=libs
CATEGORY:=Libraries
DEPENDS:=+libdaemon +libpthread +libgdbm
TITLE+= (library)
endef
define Package/libavahi/description
$(call Package/avahi/Default/description)
.
This package contains the mDNS/DNS-SD shared libraries, used by other programs.
endef
define Package/avahi-autoipd
$(call Package/avahi/Default)
DEPENDS:=+libdaemon
TITLE:=IPv4LL network address configuration daemon
endef
define Package/avahi-autoipd/description
$(call Package/avahi/Default/description)
.
This package implements IPv4LL, "Dynamic Configuration of IPv4 Link-Local
Addresses" (IETF RFC3927), a protocol for automatic IP address configuration
from the link-local 169.254.0.0/16 range without the need for a central
server. It is primarily intended to be used in ad-hoc networks which lack a
DHCP server.
endef
define Package/avahi-daemon
$(call Package/avahi/Default)
DEPENDS:=+libavahi +libexpat
TITLE+= (daemon)
endef
define Package/avahi-daemon/description
$(call Package/avahi/Default/description)
.
This package contains an mDNS/DNS-SD daemon.
endef
define Package/avahi-daemon/conffiles
/etc/avahi/avahi-daemon.conf
/etc/avahi/services/http.service
/etc/avahi/services/ssh.service
endef
define Package/avahi-dnsconfd
$(call Package/avahi/Default)
DEPENDS:=+libavahi
TITLE:=An Unicast DNS server from mDNS/DNS-SD configuration daemon
endef
define Package/avahi-dnsconfd/description
$(call Package/avahi/Default/description)
.
This package contains an Unicast DNS server from mDNS/DNS-SD configuration
daemon, which may be used to configure conventional DNS servers using mDNS
in a DHCP-like fashion. Especially useful on IPv6.
endef
TARGET_CFLAGS += $(FPIC) -DGETTEXT_PACKAGE
CONFIGURE_ARGS+= \
--enable-shared \
--enable-static \
--disable-glib \
--disable-gobject \
--disable-qt3 \
--disable-qt4 \
--disable-gtk \
--disable-gtk3 \
--disable-dbus \
--with-xml=expat \
--disable-dbm \
--enable-gdbm \
--enable-libdaemon \
--disable-python \
--disable-pygtk \
--disable-python-dbus \
--disable-mono \
--disable-monodoc \
--disable-doxygen-doc \
--disable-doxygen-dot \
--disable-doxygen-man \
--disable-doxygen-rtf \
--disable-doxygen-xml \
--disable-doxygen-chm \
--disable-doxygen-chi \
--disable-doxygen-html \
--disable-doxygen-ps \
--disable-doxygen-pdf \
--disable-xmltoman \
--with-distro=none \
--with-avahi-user=nobody \
--with-avahi-group=nogroup \
--with-autoipd-user=nobody \
--with-autoipd-group=nogroup
ifneq ($(CONFIG_SSP_SUPPORT),y)
CONFIGURE_ARGS+= \
--disable-stack-protector
endif
CONFIGURE_VARS+= \
CFLAGS="$$$$CFLAGS -DNDEBUG -DDISABLE_SYSTEMD" \
define Build/InstallDev
$(INSTALL_DIR) $(1)/usr/include
$(CP) $(PKG_INSTALL_DIR)/usr/include/avahi-{common,core} $(1)/usr/include/
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libavahi-{common,core}.{a,so*} $(1)/usr/lib/
$(INSTALL_DIR) $(1)/usr/lib/pkgconfig
$(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/avahi-core.pc $(1)/usr/lib/pkgconfig/
endef
define Package/libavahi/install
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libavahi-{common,core}.so.* $(1)/usr/lib/
endef
define Package/avahi-autoipd/install
$(INSTALL_DIR) $(1)/etc/avahi
$(CP) $(PKG_INSTALL_DIR)/etc/avahi/avahi-autoipd.action $(1)/etc/avahi/
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/avahi-autoipd $(1)/usr/sbin/
endef
define Package/avahi-daemon/install
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/avahi-daemon $(1)/usr/sbin/
$(INSTALL_DIR) $(1)/etc/avahi
$(INSTALL_DATA) ./files/avahi-daemon.conf $(1)/etc/avahi/
$(INSTALL_DIR) $(1)/etc/avahi/services
$(INSTALL_DATA) ./files/service-http $(1)/etc/avahi/services/http.service
$(INSTALL_DATA) ./files/service-ssh $(1)/etc/avahi/services/ssh.service
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) ./files/avahi-daemon.init $(1)/etc/init.d/avahi-daemon
endef
define Package/avahi-dnsconfd/install
$(INSTALL_DIR) $(1)/etc/avahi
$(CP) $(PKG_INSTALL_DIR)/etc/avahi/avahi-dnsconfd.action $(1)/etc/avahi/
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/avahi-dnsconfd $(1)/usr/sbin/
endef
$(eval $(call BuildPackage,libavahi))
$(eval $(call BuildPackage,avahi-autoipd))
$(eval $(call BuildPackage,avahi-daemon))
$(eval $(call BuildPackage,avahi-dnsconfd))

View File

@ -1,164 +0,0 @@
10
dir
25991
svn://svn.openwrt.org/openwrt/packages/libs/avahi/files
svn://svn.openwrt.org/openwrt
2009-04-17T15:22:00.575847Z
15247
nico
3c298f89-4303-0410-b956-a3cf2f4a3e73
avahi-daemon.init
file
2010-07-24T18:00:01.268389Z
80c8607dfee5436effe2fb31ffe35368
2009-04-17T15:22:00.575847Z
15247
nico
has-props
267
service-ssh
file
2010-07-24T18:00:01.268389Z
2a3773d96969b121c3fa0988f9921b8c
2009-04-17T15:22:00.575847Z
15247
nico
has-props
265
avahi-daemon.conf
file
2010-07-24T18:00:01.272389Z
4e760dbb6d6c769316874acd7015537d
2009-04-17T15:22:00.575847Z
15247
nico
has-props
445
service-http
file
2010-07-24T18:00:01.272389Z
cad04c15d78baf565a4277f4dbbb4286
2009-04-17T15:22:00.575847Z
15247
nico
has-props
309

View File

@ -1,5 +0,0 @@
K 13
svn:eol-style
V 6
native
END

View File

@ -1,5 +0,0 @@
K 13
svn:eol-style
V 6
native
END

View File

@ -1,5 +0,0 @@
K 13
svn:eol-style
V 6
native
END

View File

@ -1,5 +0,0 @@
K 13
svn:eol-style
V 6
native
END

View File

@ -1,28 +0,0 @@
[server]
#host-name=foo
#domain-name=local
use-ipv4=yes
use-ipv6=no
check-response-ttl=no
use-iff-running=no
[publish]
publish-addresses=yes
publish-hinfo=yes
publish-workstation=no
publish-domain=yes
#publish-dns-servers=192.168.1.1
#publish-resolv-conf-dns-servers=yes
[reflector]
enable-reflector=no
reflect-ipv=no
[rlimits]
#rlimit-as=
rlimit-core=0
rlimit-data=4194304
rlimit-fsize=0
rlimit-nofile=30
rlimit-stack=4194304
rlimit-nproc=1

View File

@ -1,23 +0,0 @@
#!/bin/sh /etc/rc.common
# Copyright (C) 2006 OpenWrt.org
START=50
BIN=avahi-daemon
DEFAULT=/etc/default/$BIN
OPTIONS="-D"
RUN_D=/var/run/$BIN
start() {
[ -f $DEFAULT ] && . $DEFAULT
mkdir -p $RUN_D
$BIN $OPTIONS
}
stop() {
$BIN -k
}
reload() {
$BIN -r
}

View File

@ -1,10 +0,0 @@
<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<service-group>
<name replace-wildcards="yes">Web Server on %h</name>
<service>
<type>_http._tcp</type>
<port>80</port>
<txt-record>path=/index.html</txt-record>
</service>
</service-group>

View File

@ -1,9 +0,0 @@
<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<service-group>
<name replace-wildcards="yes">Secure Shell on %h</name>
<service>
<type>_ssh._tcp</type>
<port>22</port>
</service>
</service-group>

View File

@ -1,28 +0,0 @@
[server]
#host-name=foo
#domain-name=local
use-ipv4=yes
use-ipv6=no
check-response-ttl=no
use-iff-running=no
[publish]
publish-addresses=yes
publish-hinfo=yes
publish-workstation=no
publish-domain=yes
#publish-dns-servers=192.168.1.1
#publish-resolv-conf-dns-servers=yes
[reflector]
enable-reflector=no
reflect-ipv=no
[rlimits]
#rlimit-as=
rlimit-core=0
rlimit-data=4194304
rlimit-fsize=0
rlimit-nofile=30
rlimit-stack=4194304
rlimit-nproc=1

View File

@ -1,23 +0,0 @@
#!/bin/sh /etc/rc.common
# Copyright (C) 2006 OpenWrt.org
START=50
BIN=avahi-daemon
DEFAULT=/etc/default/$BIN
OPTIONS="-D"
RUN_D=/var/run/$BIN
start() {
[ -f $DEFAULT ] && . $DEFAULT
mkdir -p $RUN_D
$BIN $OPTIONS
}
stop() {
$BIN -k
}
reload() {
$BIN -r
}

View File

@ -1,10 +0,0 @@
<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<service-group>
<name replace-wildcards="yes">Web Server on %h</name>
<service>
<type>_http._tcp</type>
<port>80</port>
<txt-record>path=/index.html</txt-record>
</service>
</service-group>

View File

@ -1,9 +0,0 @@
<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<service-group>
<name replace-wildcards="yes">Secure Shell on %h</name>
<service>
<type>_ssh._tcp</type>
<port>22</port>
</service>
</service-group>

View File

@ -1,62 +0,0 @@
10
dir
25991
svn://svn.openwrt.org/openwrt/packages/libs/avahi/patches
svn://svn.openwrt.org/openwrt
2011-03-09T12:34:25.840259Z
25973
jow
3c298f89-4303-0410-b956-a3cf2f4a3e73
010-step_back_autotools-no-gettext.patch
file
2011-03-10T08:41:40.076744Z
1fbd7df008628912218cd4f2cdf0e00c
2011-03-09T12:34:25.840259Z
25973
jow
1983

View File

@ -1,80 +0,0 @@
--- a/Makefile.am
+++ b/Makefile.am
@@ -75,8 +75,7 @@ SUBDIRS = \
avahi-compat-howl \
avahi-autoipd \
avahi-ui \
- avahi-ui-sharp \
- po
+ avahi-ui-sharp
DX_INPUT = \
$(srcdir)/avahi-common/address.h \
--- a/avahi-python/avahi-discover/Makefile.am
+++ b/avahi-python/avahi-discover/Makefile.am
@@ -38,7 +38,6 @@ if HAVE_GDBM
pythonscripts += \
avahi-discover
desktop_DATA += avahi-discover.desktop
-@INTLTOOL_DESKTOP_RULE@
avahi_discover_PYTHON += __init__.py
endif
@@ -46,7 +45,6 @@ if HAVE_DBM
pythonscripts += \
avahi-discover
desktop_DATA += avahi-discover.desktop
-@INTLTOOL_DESKTOP_RULE@
avahi_discover_PYTHON += __init__.py
endif
--- a/avahi-ui/Makefile.am
+++ b/avahi-ui/Makefile.am
@@ -78,7 +78,6 @@ endif
bin_PROGRAMS = bssh
desktop_DATA += bssh.desktop bvnc.desktop
-@INTLTOOL_DESKTOP_RULE@
bssh_SOURCES = bssh.c
@@ -106,6 +105,4 @@ endif # HAVE_GLIB
endif
endif
-@INTLTOOL_DESKTOP_RULE@
-
CLEANFILES = $(desktop_DATA) $(desktop_DATA_in)
--- a/configure.ac
+++ b/configure.ac
@@ -23,7 +23,7 @@ AC_INIT([avahi],[0.6.29],[avahi (at) lis
AC_CONFIG_SRCDIR([avahi-core/server.c])
AC_CONFIG_MACRO_DIR([common])
AC_CONFIG_HEADERS([config.h])
-AM_INIT_AUTOMAKE([foreign 1.11 -Wall -Wno-portability silent-rules tar-pax])
+AM_INIT_AUTOMAKE([foreign 1.11 -Wall -Wno-portability tar-pax])
AC_SUBST(PACKAGE_URL, [http://avahi.org/])
@@ -43,8 +43,6 @@ AC_SUBST(HOWL_COMPAT_VERSION, [0.9.8])
AC_CANONICAL_HOST
-AM_SILENT_RULES([yes])
-
AC_CHECK_PROG([STOW], [stow], [yes], [no])
AS_IF([test "x$STOW" = "xyes" && test -d /usr/local/stow], [
@@ -412,12 +410,6 @@ if test "x$have_kqueue" = "xyes" ; then
AC_DEFINE([HAVE_KQUEUE], 1, [Enable BSD kqueue() usage])
fi
-IT_PROG_INTLTOOL([0.35.0])
-GETTEXT_PACKAGE=avahi
-AC_SUBST([GETTEXT_PACKAGE])
-AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE],["$GETTEXT_PACKAGE"],[Gettext package])
-AM_GLIB_GNU_GETTEXT
-
avahilocaledir='${prefix}/${DATADIRNAME}/locale'
AC_SUBST(avahilocaledir)

View File

@ -1,80 +0,0 @@
--- a/Makefile.am
+++ b/Makefile.am
@@ -75,8 +75,7 @@ SUBDIRS = \
avahi-compat-howl \
avahi-autoipd \
avahi-ui \
- avahi-ui-sharp \
- po
+ avahi-ui-sharp
DX_INPUT = \
$(srcdir)/avahi-common/address.h \
--- a/avahi-python/avahi-discover/Makefile.am
+++ b/avahi-python/avahi-discover/Makefile.am
@@ -38,7 +38,6 @@ if HAVE_GDBM
pythonscripts += \
avahi-discover
desktop_DATA += avahi-discover.desktop
-@INTLTOOL_DESKTOP_RULE@
avahi_discover_PYTHON += __init__.py
endif
@@ -46,7 +45,6 @@ if HAVE_DBM
pythonscripts += \
avahi-discover
desktop_DATA += avahi-discover.desktop
-@INTLTOOL_DESKTOP_RULE@
avahi_discover_PYTHON += __init__.py
endif
--- a/avahi-ui/Makefile.am
+++ b/avahi-ui/Makefile.am
@@ -78,7 +78,6 @@ endif
bin_PROGRAMS = bssh
desktop_DATA += bssh.desktop bvnc.desktop
-@INTLTOOL_DESKTOP_RULE@
bssh_SOURCES = bssh.c
@@ -106,6 +105,4 @@ endif # HAVE_GLIB
endif
endif
-@INTLTOOL_DESKTOP_RULE@
-
CLEANFILES = $(desktop_DATA) $(desktop_DATA_in)
--- a/configure.ac
+++ b/configure.ac
@@ -23,7 +23,7 @@ AC_INIT([avahi],[0.6.29],[avahi (at) lis
AC_CONFIG_SRCDIR([avahi-core/server.c])
AC_CONFIG_MACRO_DIR([common])
AC_CONFIG_HEADERS([config.h])
-AM_INIT_AUTOMAKE([foreign 1.11 -Wall -Wno-portability silent-rules tar-pax])
+AM_INIT_AUTOMAKE([foreign 1.11 -Wall -Wno-portability tar-pax])
AC_SUBST(PACKAGE_URL, [http://avahi.org/])
@@ -43,8 +43,6 @@ AC_SUBST(HOWL_COMPAT_VERSION, [0.9.8])
AC_CANONICAL_HOST
-AM_SILENT_RULES([yes])
-
AC_CHECK_PROG([STOW], [stow], [yes], [no])
AS_IF([test "x$STOW" = "xyes" && test -d /usr/local/stow], [
@@ -412,12 +410,6 @@ if test "x$have_kqueue" = "xyes" ; then
AC_DEFINE([HAVE_KQUEUE], 1, [Enable BSD kqueue() usage])
fi
-IT_PROG_INTLTOOL([0.35.0])
-GETTEXT_PACKAGE=avahi
-AC_SUBST([GETTEXT_PACKAGE])
-AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE],["$GETTEXT_PACKAGE"],[Gettext package])
-AM_GLIB_GNU_GETTEXT
-
avahilocaledir='${prefix}/${DATADIRNAME}/locale'
AC_SUBST(avahilocaledir)

View File

@ -1,58 +0,0 @@
#
# Copyright (C) 2008 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=avrdude
PKG_VERSION:=5.10
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=http://download.savannah.gnu.org/releases/avrdude
PKG_MD5SUM:=69b082683047e054348088fd63bad2ff
include $(INCLUDE_DIR)/package.mk
define Package/avrdude
SECTION:=utils
CATEGORY:=Utilities
TITLE:=AVR Downloader/UploaDEr
URL:=http://www.bsdhome.com/avrdude/
DEPENDS:=@GPIO_SUPPORT +libncurses
endef
define Package/avrdude/description
AVRDUDE is a full featured program for programming Atmel's AVR CPU's.
endef
define Build/Prepare
$(call Build/Prepare/Default)
chmod -R u+w $(PKG_BUILD_DIR)
endef
CONFIGURE_ARGS+= \
--disable-parport \
define Build/Compile
$(MAKE) -C $(PKG_BUILD_DIR) \
DESTDIR="$(PKG_INSTALL_DIR)" CFLAGS="-I$(LINUX_DIR)/include"\
install-exec
endef
define Package/avrdude/conffiles
/etc/avrdude.conf
endef
define Package/avrdude/install
$(INSTALL_DIR) $(1)/etc
$(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/avrdude.conf $(1)/etc/
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/avrdude $(1)/usr/bin/
endef
$(eval $(call BuildPackage,avrdude))

View File

@ -1,389 +0,0 @@
diff -urNad /tmp/avrdude-5.10/avrdude.conf.in avrdude-5.10/avrdude.conf.in
--- /tmp/avrdude-5.10/avrdude.conf.in 2010-08-06 13:53:20.883965102 +0200
+++ avrdude-5.10/avrdude.conf.in 2010-08-06 13:11:12.803965267 +0200
@@ -833,6 +833,16 @@
miso = 8;
;
+programmer
+ id = "gpio";
+ desc = "Use gpio_dev to bitbang GPIO lines";
+ type = gpio;
+ reset = 0;
+ sck = 3;
+ mosi = 1;
+ miso = 2;
+;
+
# Same as above, different name
# reset=!txd sck=rts mosi=dtr miso=cts
diff -urNad /tmp/avrdude-5.10/config_gram.y avrdude-5.10/config_gram.y
--- /tmp/avrdude-5.10/config_gram.y 2010-08-06 13:53:20.891969681 +0200
+++ avrdude-5.10/config_gram.y 2010-08-06 13:11:12.827964827 +0200
@@ -39,6 +39,7 @@
#include "stk500.h"
#include "arduino.h"
#include "buspirate.h"
+#include "gpio.h"
#include "stk500v2.h"
#include "stk500generic.h"
#include "avr910.h"
@@ -99,6 +100,7 @@
%token K_DRAGON_JTAG
%token K_DRAGON_PDI
%token K_DRAGON_PP
+%token K_GPIO
%token K_STK500_DEVCODE
%token K_AVR910_DEVCODE
%token K_EEPROM
@@ -437,6 +439,12 @@
buspirate_initpgm(current_prog);
}
} |
+
+ K_TYPE TKN_EQUAL K_GPIO {
+ {
+ gpio_initpgm(current_prog);
+ }
+ } |
K_TYPE TKN_EQUAL K_STK600 {
{
diff -urNad /tmp/avrdude-5.10/gpio.c avrdude-5.10/gpio.c
--- /tmp/avrdude-5.10/gpio.c 1970-01-01 01:00:00.000000000 +0100
+++ avrdude-5.10/gpio.c 2010-08-06 13:11:12.823989322 +0200
@@ -0,0 +1,181 @@
+/*
+ * avrdude - A Downloader/Uploader for AVR device programmers
+ * Support for a bitbanged GPIO programmer using gpio_dev
+ *
+ * copyright (c) 2010 flukso.net
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include "ac_cfg.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <errno.h>
+
+#include "avrdude.h"
+#include "avr.h"
+#include "pindefs.h"
+#include "pgm.h"
+#include "bitbang.h"
+
+#include <linux/gpio_dev.h>
+#include <sys/ioctl.h>
+
+#define AVRDUDE_GPIO_DIR_IN 0
+#define AVRDUDE_GPIO_DIR_OUT 1
+
+static int gpio_fd;
+
+static void _gpio_dir(int pin, int dir)
+{
+ pin &= PIN_MASK;
+
+ if (dir == AVRDUDE_GPIO_DIR_OUT)
+ ioctl(gpio_fd, GPIO_DIR_OUT, pin);
+ else
+ ioctl(gpio_fd, GPIO_DIR_IN, pin);
+
+ return;
+}
+
+static int gpio_setpin(PROGRAMMER * pgm, int pin, int value)
+{
+ if (pin & PIN_INVERSE) {
+ value = !value;
+ pin &= PIN_MASK;
+ }
+
+ if (value)
+ ioctl(gpio_fd, GPIO_SET, pin);
+ else
+ ioctl(gpio_fd, GPIO_CLEAR, pin);
+
+ if (pgm->ispdelay > 1)
+ bitbang_delay(pgm->ispdelay);
+
+ return 0;
+}
+
+static int gpio_getpin(PROGRAMMER * pgm, int pin)
+{
+ char input, inv = 0;
+
+ if (pin & PIN_INVERSE) {
+ inv = 1;
+ pin &= PIN_MASK;
+ }
+
+ input = ioctl(gpio_fd, GPIO_GET, pin);
+
+ if (inv) {
+ return input ^ 1;
+ }
+ else {
+ return input;
+ }
+}
+
+static int gpio_highpulsepin(PROGRAMMER * pgm, int pin)
+{
+ gpio_setpin(pgm, pin, 1);
+ gpio_setpin(pgm, pin, 0);
+
+ return 0;
+}
+
+
+
+static void gpio_display(PROGRAMMER *pgm, const char *p)
+{
+ /* nothing */
+}
+
+static void gpio_enable(PROGRAMMER *pgm)
+{
+ /* nothing */
+}
+
+static void gpio_disable(PROGRAMMER *pgm)
+{
+ /* nothing */
+}
+
+static void gpio_powerup(PROGRAMMER *pgm)
+{
+ /* nothing */
+}
+
+static void gpio_powerdown(PROGRAMMER *pgm)
+{
+ /* nothing */
+}
+
+static int gpio_open(PROGRAMMER *pgm, char *port)
+{
+ int i;
+
+ bitbang_check_prerequisites(pgm);
+
+ if ((gpio_fd = open("/dev/gpio", O_RDWR)) < 0) {
+ perror("cannot open /dev/gpio");
+ return -1;
+ }
+
+ for (i = 0; i < N_PINS; i++) {
+ if (i == PIN_AVR_MISO)
+ _gpio_dir(pgm->pinno[i], AVRDUDE_GPIO_DIR_IN);
+ else
+ _gpio_dir(pgm->pinno[i], AVRDUDE_GPIO_DIR_OUT);
+ }
+
+ return(0);
+}
+
+static void gpio_close(PROGRAMMER *pgm)
+{
+ gpio_setpin(pgm, pgm->pinno[PIN_AVR_RESET], 1);
+ close(gpio_fd);
+ return;
+}
+
+void gpio_initpgm(PROGRAMMER *pgm)
+{
+ strcpy(pgm->type, "GPIO");
+
+ pgm->rdy_led = bitbang_rdy_led;
+ pgm->err_led = bitbang_err_led;
+ pgm->pgm_led = bitbang_pgm_led;
+ pgm->vfy_led = bitbang_vfy_led;
+ pgm->initialize = bitbang_initialize;
+ pgm->display = gpio_display;
+ pgm->enable = gpio_enable;
+ pgm->disable = gpio_disable;
+ pgm->powerup = gpio_powerup;
+ pgm->powerdown = gpio_powerdown;
+ pgm->program_enable = bitbang_program_enable;
+ pgm->chip_erase = bitbang_chip_erase;
+ pgm->cmd = bitbang_cmd;
+ pgm->open = gpio_open;
+ pgm->close = gpio_close;
+ pgm->setpin = gpio_setpin;
+ pgm->getpin = gpio_getpin;
+ pgm->highpulsepin = gpio_highpulsepin;
+ pgm->read_byte = avr_read_byte_default;
+ pgm->write_byte = avr_write_byte_default;
+}
diff -urNad /tmp/avrdude-5.10/gpio.h avrdude-5.10/gpio.h
--- /tmp/avrdude-5.10/gpio.h 1970-01-01 01:00:00.000000000 +0100
+++ avrdude-5.10/gpio.h 2010-08-06 13:37:40.479767917 +0200
@@ -0,0 +1,33 @@
+/*
+ * avrdude - A Downloader/Uploader for AVR device programmers
+ * Copyright (C) 2000-2004 Brian S. Dean <b...@bsdhome.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef gpio_h
+#define gpio_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void gpio_initpgm (PROGRAMMER * pgm);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff -urNad /tmp/avrdude-5.10/lexer.l avrdude-5.10/lexer.l
--- /tmp/avrdude-5.10/lexer.l 2010-08-06 13:53:20.883965102 +0200
+++ avrdude-5.10/lexer.l 2010-08-06 13:11:12.803965267 +0200
@@ -146,6 +146,7 @@
enablepageprogramming { yylval=NULL; return K_ENABLEPAGEPROGRAMMING; }
errled { yylval=NULL; return K_ERRLED; }
flash { yylval=NULL; return K_FLASH; }
+gpio { yylval=NULL; return K_GPIO; }
has_jtag { yylval=NULL; return K_HAS_JTAG; }
has_debugwire { yylval=NULL; return K_HAS_DW; }
has_pdi { yylval=NULL; return K_HAS_PDI; }
diff -urNad /tmp/avrdude-5.10/Makefile.am avrdude-5.10/Makefile.am
--- /tmp/avrdude-5.10/Makefile.am 2010-08-06 13:53:20.891969681 +0200
+++ avrdude-5.10/Makefile.am 2010-08-06 13:11:12.827964827 +0200
@@ -101,6 +101,8 @@
fileio.c \
fileio.h \
freebsd_ppi.h \
+ gpio.c \
+ gpio.h \
jtagmkI.c \
jtagmkI.h \
jtagmkI_private.h \
diff -urNad /tmp/avrdude-5.10/Makefile.in avrdude-5.10/Makefile.in
--- /tmp/avrdude-5.10/Makefile.in 2010-08-06 13:53:20.887965471 +0200
+++ avrdude-5.10/Makefile.in 2010-08-06 13:11:12.811964888 +0200
@@ -1,4 +1,4 @@
-# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# Makefile.in generated by automake 1.10.2 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
@@ -87,11 +87,11 @@
libavrdude_a-buspirate.$(OBJEXT) \
libavrdude_a-butterfly.$(OBJEXT) libavrdude_a-config.$(OBJEXT) \
libavrdude_a-confwin.$(OBJEXT) libavrdude_a-crc16.$(OBJEXT) \
- libavrdude_a-fileio.$(OBJEXT) libavrdude_a-jtagmkI.$(OBJEXT) \
- libavrdude_a-jtagmkII.$(OBJEXT) libavrdude_a-lists.$(OBJEXT) \
- libavrdude_a-par.$(OBJEXT) libavrdude_a-pgm.$(OBJEXT) \
- libavrdude_a-ppi.$(OBJEXT) libavrdude_a-ppiwin.$(OBJEXT) \
- libavrdude_a-safemode.$(OBJEXT) \
+ libavrdude_a-fileio.$(OBJEXT) libavrdude_a-gpio.$(OBJEXT) \
+ libavrdude_a-jtagmkI.$(OBJEXT) libavrdude_a-jtagmkII.$(OBJEXT) \
+ libavrdude_a-lists.$(OBJEXT) libavrdude_a-par.$(OBJEXT) \
+ libavrdude_a-pgm.$(OBJEXT) libavrdude_a-ppi.$(OBJEXT) \
+ libavrdude_a-ppiwin.$(OBJEXT) libavrdude_a-safemode.$(OBJEXT) \
libavrdude_a-serbb_posix.$(OBJEXT) \
libavrdude_a-serbb_win32.$(OBJEXT) \
libavrdude_a-ser_avrdoper.$(OBJEXT) \
@@ -204,6 +204,7 @@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
@@ -323,6 +324,8 @@
fileio.c \
fileio.h \
freebsd_ppi.h \
+ gpio.c \
+ gpio.h \
jtagmkI.c \
jtagmkI.h \
jtagmkI_private.h \
@@ -493,6 +496,7 @@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libavrdude_a-confwin.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libavrdude_a-crc16.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libavrdude_a-fileio.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libavrdude_a-gpio.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libavrdude_a-jtagmkI.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libavrdude_a-jtagmkII.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libavrdude_a-lexer.Po@am__quote@
@@ -711,6 +715,20 @@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libavrdude_a_CPPFLAGS) $(CPPFLAGS) $(libavrdude_a_CFLAGS) $(CFLAGS) -c -o libavrdude_a-fileio.obj `if test -f 'fileio.c'; then $(CYGPATH_W) 'fileio.c'; else $(CYGPATH_W) '$(srcdir)/fileio.c'; fi`
+libavrdude_a-gpio.o: gpio.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libavrdude_a_CPPFLAGS) $(CPPFLAGS) $(libavrdude_a_CFLAGS) $(CFLAGS) -MT libavrdude_a-gpio.o -MD -MP -MF $(DEPDIR)/libavrdude_a-gpio.Tpo -c -o libavrdude_a-gpio.o `test -f 'gpio.c' || echo '$(srcdir)/'`gpio.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libavrdude_a-gpio.Tpo $(DEPDIR)/libavrdude_a-gpio.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gpio.c' object='libavrdude_a-gpio.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libavrdude_a_CPPFLAGS) $(CPPFLAGS) $(libavrdude_a_CFLAGS) $(CFLAGS) -c -o libavrdude_a-gpio.o `test -f 'gpio.c' || echo '$(srcdir)/'`gpio.c
+
+libavrdude_a-gpio.obj: gpio.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libavrdude_a_CPPFLAGS) $(CPPFLAGS) $(libavrdude_a_CFLAGS) $(CFLAGS) -MT libavrdude_a-gpio.obj -MD -MP -MF $(DEPDIR)/libavrdude_a-gpio.Tpo -c -o libavrdude_a-gpio.obj `if test -f 'gpio.c'; then $(CYGPATH_W) 'gpio.c'; else $(CYGPATH_W) '$(srcdir)/gpio.c'; fi`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libavrdude_a-gpio.Tpo $(DEPDIR)/libavrdude_a-gpio.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gpio.c' object='libavrdude_a-gpio.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libavrdude_a_CPPFLAGS) $(CPPFLAGS) $(libavrdude_a_CFLAGS) $(CFLAGS) -c -o libavrdude_a-gpio.obj `if test -f 'gpio.c'; then $(CYGPATH_W) 'gpio.c'; else $(CYGPATH_W) '$(srcdir)/gpio.c'; fi`
+
libavrdude_a-jtagmkI.o: jtagmkI.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libavrdude_a_CPPFLAGS) $(CPPFLAGS) $(libavrdude_a_CFLAGS) $(CFLAGS) -MT libavrdude_a-jtagmkI.o -MD -MP -MF $(DEPDIR)/libavrdude_a-jtagmkI.Tpo -c -o libavrdude_a-jtagmkI.o `test -f 'jtagmkI.c' || echo '$(srcdir)/'`jtagmkI.c
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libavrdude_a-jtagmkI.Tpo $(DEPDIR)/libavrdude_a-jtagmkI.Po
@@ -1035,8 +1053,8 @@
esac; \
done; \
for i in $$list; do \
- if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
- else file=$$i; fi; \
+ if test -f $$i; then file=$$i; \
+ else file=$(srcdir)/$$i; fi; \
ext=`echo $$i | sed -e 's/^.*\\.//'`; \
case "$$ext" in \
1*) ;; \
@@ -1162,7 +1180,7 @@
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
- $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS

View File

@ -1,771 +0,0 @@
diff -urNad /tmp/avrdude-5.10/config_gram.y avrdude-5.10/config_gram.y
--- /tmp/avrdude-5.10/config_gram.y 2010-08-06 20:32:45.039034875 +0200
+++ avrdude-5.10/config_gram.y 2010-08-06 20:30:54.071034545 +0200
@@ -386,179 +386,12 @@
}
} |
- K_TYPE TKN_EQUAL K_PAR {
- {
- par_initpgm(current_prog);
- }
- } |
-
- K_TYPE TKN_EQUAL K_SERBB {
- {
- serbb_initpgm(current_prog);
- }
- } |
-
- K_TYPE TKN_EQUAL K_STK500 {
- {
- stk500_initpgm(current_prog);
- }
- } |
-
- K_TYPE TKN_EQUAL K_STK500V2 {
- {
- stk500v2_initpgm(current_prog);
- }
- } |
-
- K_TYPE TKN_EQUAL K_STK500HVSP {
- {
- stk500hvsp_initpgm(current_prog);
- }
- } |
-
- K_TYPE TKN_EQUAL K_STK500PP {
- {
- stk500pp_initpgm(current_prog);
- }
- } |
-
- K_TYPE TKN_EQUAL K_STK500GENERIC {
- {
- stk500generic_initpgm(current_prog);
- }
- } |
-
- K_TYPE TKN_EQUAL K_ARDUINO {
- {
- arduino_initpgm(current_prog);
- }
- } |
-
- K_TYPE TKN_EQUAL K_BUSPIRATE {
- {
- buspirate_initpgm(current_prog);
- }
- } |
-
K_TYPE TKN_EQUAL K_GPIO {
{
gpio_initpgm(current_prog);
}
} |
- K_TYPE TKN_EQUAL K_STK600 {
- {
- stk600_initpgm(current_prog);
- }
- } |
-
- K_TYPE TKN_EQUAL K_STK600HVSP {
- {
- stk600hvsp_initpgm(current_prog);
- }
- } |
-
- K_TYPE TKN_EQUAL K_STK600PP {
- {
- stk600pp_initpgm(current_prog);
- }
- } |
-
- K_TYPE TKN_EQUAL K_AVR910 {
- {
- avr910_initpgm(current_prog);
- }
- } |
-
- K_TYPE TKN_EQUAL K_USBASP {
- {
- usbasp_initpgm(current_prog);
- }
- } |
-
- K_TYPE TKN_EQUAL K_USBTINY {
- {
- usbtiny_initpgm(current_prog);
- }
- } |
-
- K_TYPE TKN_EQUAL K_BUTTERFLY {
- {
- butterfly_initpgm(current_prog);
- }
- } |
-
- K_TYPE TKN_EQUAL K_JTAG_MKI {
- {
- jtagmkI_initpgm(current_prog);
- }
- } |
-
- K_TYPE TKN_EQUAL K_JTAG_MKII {
- {
- jtagmkII_initpgm(current_prog);
- }
- } |
- K_TYPE TKN_EQUAL K_JTAG_MKII_AVR32 {
- {
- jtagmkII_avr32_initpgm(current_prog);
- }
- } |
-
- K_TYPE TKN_EQUAL K_JTAG_MKII_DW {
- {
- jtagmkII_dw_initpgm(current_prog);
- }
- } |
-
- K_TYPE TKN_EQUAL K_JTAG_MKII_ISP {
- {
- stk500v2_jtagmkII_initpgm(current_prog);
- }
- } |
-
- K_TYPE TKN_EQUAL K_JTAG_MKII_PDI {
- {
- jtagmkII_pdi_initpgm(current_prog);
- }
- } |
-
- K_TYPE TKN_EQUAL K_DRAGON_DW {
- {
- jtagmkII_dragon_dw_initpgm(current_prog);
- }
- } |
-
- K_TYPE TKN_EQUAL K_DRAGON_HVSP {
- {
- stk500v2_dragon_hvsp_initpgm(current_prog);
- }
- } |
-
- K_TYPE TKN_EQUAL K_DRAGON_ISP {
- {
- stk500v2_dragon_isp_initpgm(current_prog);
- }
- } |
-
- K_TYPE TKN_EQUAL K_DRAGON_JTAG {
- {
- jtagmkII_dragon_initpgm(current_prog);
- }
- } |
-
- K_TYPE TKN_EQUAL K_DRAGON_PDI {
- {
- jtagmkII_dragon_pdi_initpgm(current_prog);
- }
- } |
-
- K_TYPE TKN_EQUAL K_DRAGON_PP {
- {
- stk500v2_dragon_pp_initpgm(current_prog);
- }
- } |
-
K_DESC TKN_EQUAL TKN_STRING {
strncpy(current_prog->desc, $3->value.string, PGM_DESCLEN);
current_prog->desc[PGM_DESCLEN-1] = 0;
diff -urNad /tmp/avrdude-5.10/avrdude.conf.in avrdude-5.10/avrdude.conf.in
--- /tmp/avrdude-5.10/avrdude.conf.in 2010-08-06 20:28:58.959965749 +0200
+++ avrdude-5.10/avrdude.conf.in 2010-08-06 20:44:19.466964893 +0200
@@ -315,525 +315,6 @@
#
programmer
- id = "arduino";
- desc = "Arduino";
- type = arduino;
-;
-
-programmer
- id = "avrisp";
- desc = "Atmel AVR ISP";
- type = stk500;
-;
-
-programmer
- id = "avrispv2";
- desc = "Atmel AVR ISP V2";
- type = stk500v2;
-;
-
-programmer
- id = "avrispmkII";
- desc = "Atmel AVR ISP mkII";
- type = stk500v2;
-;
-
-programmer
- id = "avrisp2";
- desc = "Atmel AVR ISP mkII";
- type = stk500v2;
-;
-
-programmer
- id = "buspirate";
- desc = "The Bus Pirate";
- type = buspirate;
-;
-
-# This is supposed to be the "default" STK500 entry.
-# Attempts to select the correct firmware version
-# by probing for it. Better use one of the entries
-# below instead.
-programmer
- id = "stk500";
- desc = "Atmel STK500";
- type = stk500generic;
-;
-
-programmer
- id = "stk500v1";
- desc = "Atmel STK500 Version 1.x firmware";
- type = stk500;
-;
-
-programmer
- id = "mib510";
- desc = "Crossbow MIB510 programming board";
- type = stk500;
-;
-
-programmer
- id = "stk500v2";
- desc = "Atmel STK500 Version 2.x firmware";
- type = stk500v2;
-;
-
-programmer
- id = "stk500pp";
- desc = "Atmel STK500 V2 in parallel programming mode";
- type = stk500pp;
-;
-
-programmer
- id = "stk500hvsp";
- desc = "Atmel STK500 V2 in high-voltage serial programming mode";
- type = stk500hvsp;
-;
-
-programmer
- id = "stk600";
- desc = "Atmel STK600";
- type = stk600;
-;
-
-programmer
- id = "stk600pp";
- desc = "Atmel STK600 in parallel programming mode";
- type = stk600pp;
-;
-
-programmer
- id = "stk600hvsp";
- desc = "Atmel STK600 in high-voltage serial programming mode";
- type = stk600hvsp;
-;
-
-programmer
- id = "avr910";
- desc = "Atmel Low Cost Serial Programmer";
- type = avr910;
-;
-
-programmer
- id = "usbasp";
- desc = "USBasp, http://www.fischl.de/usbasp/";
- type = usbasp;
-;
-
-programmer
- id = "usbtiny";
- desc = "USBtiny simple USB programmer, http://www.ladyada.net/make/usbtinyisp/";
- type = usbtiny;
-;
-
-programmer
- id = "butterfly";
- desc = "Atmel Butterfly Development Board";
- type = butterfly;
-;
-
-programmer
- id = "avr109";
- desc = "Atmel AppNote AVR109 Boot Loader";
- type = butterfly;
-;
-
-programmer
- id = "avr911";
- desc = "Atmel AppNote AVR911 AVROSP";
- type = butterfly;
-;
-
-programmer
- id = "jtagmkI";
- desc = "Atmel JTAG ICE (mkI)";
- baudrate = 115200; # default is 115200
- type = jtagmki;
-;
-
-# easier to type
-programmer
- id = "jtag1";
- desc = "Atmel JTAG ICE (mkI)";
- baudrate = 115200; # default is 115200
- type = jtagmki;
-;
-
-# easier to type
-programmer
- id = "jtag1slow";
- desc = "Atmel JTAG ICE (mkI)";
- baudrate = 19200;
- type = jtagmki;
-;
-
-programmer
- id = "jtagmkII";
- desc = "Atmel JTAG ICE mkII";
- baudrate = 19200; # default is 19200
- type = jtagmkii;
-;
-
-# easier to type
-programmer
- id = "jtag2slow";
- desc = "Atmel JTAG ICE mkII";
- baudrate = 19200; # default is 19200
- type = jtagmkii;
-;
-
-# JTAG ICE mkII @ 115200 Bd
-programmer
- id = "jtag2fast";
- desc = "Atmel JTAG ICE mkII";
- baudrate = 115200;
- type = jtagmkii;
-;
-
-# make the fast one the default, people will love that
-programmer
- id = "jtag2";
- desc = "Atmel JTAG ICE mkII";
- baudrate = 115200;
- type = jtagmkii;
-;
-
-# JTAG ICE mkII in ISP mode
-programmer
- id = "jtag2isp";
- desc = "Atmel JTAG ICE mkII in ISP mode";
- baudrate = 115200;
- type = jtagmkii_isp;
-;
-
-# JTAG ICE mkII in debugWire mode
-programmer
- id = "jtag2dw";
- desc = "Atmel JTAG ICE mkII in debugWire mode";
- baudrate = 115200;
- type = jtagmkii_dw;
-;
-
-# JTAG ICE mkII in AVR32 mode
-programmer
- id = "jtagmkII_avr32";
- desc = "Atmel JTAG ICE mkII im AVR32 mode";
- baudrate = 115200;
- type = jtagmkii_avr32;
-;
-
-# JTAG ICE mkII in AVR32 mode
-programmer
- id = "jtag2avr32";
- desc = "Atmel JTAG ICE mkII im AVR32 mode";
- baudrate = 115200;
- type = jtagmkii_avr32;
-;
-
-# JTAG ICE mkII in PDI mode
-programmer
- id = "jtag2pdi";
- desc = "Atmel JTAG ICE mkII PDI mode";
- baudrate = 115200;
- type = jtagmkii_pdi;
-;
-
-# AVR Dragon in JTAG mode
-programmer
- id = "dragon_jtag";
- desc = "Atmel AVR Dragon in JTAG mode";
- baudrate = 115200;
- type = dragon_jtag;
-;
-
-# AVR Dragon in ISP mode
-programmer
- id = "dragon_isp";
- desc = "Atmel AVR Dragon in ISP mode";
- baudrate = 115200;
- type = dragon_isp;
-;
-
-# AVR Dragon in PP mode
-programmer
- id = "dragon_pp";
- desc = "Atmel AVR Dragon in PP mode";
- baudrate = 115200;
- type = dragon_pp;
-;
-
-# AVR Dragon in HVSP mode
-programmer
- id = "dragon_hvsp";
- desc = "Atmel AVR Dragon in HVSP mode";
- baudrate = 115200;
- type = dragon_hvsp;
-;
-
-# AVR Dragon in debugWire mode
-programmer
- id = "dragon_dw";
- desc = "Atmel AVR Dragon in debugWire mode";
- baudrate = 115200;
- type = dragon_dw;
-;
-
-# AVR Dragon in PDI mode
-programmer
- id = "dragon_pdi";
- desc = "Atmel AVR Dragon in PDI mode";
- baudrate = 115200;
- type = dragon_pdi;
-;
-
-programmer
- id = "pavr";
- desc = "Jason Kyle's pAVR Serial Programmer";
- type = avr910;
-;
-
-@HAVE_PARPORT_BEGIN@ Inclusion of the following depends on --enable-parport
-# Parallel port programmers.
-
-programmer
- id = "bsd";
- desc = "Brian Dean's Programmer, http://www.bsdhome.com/avrdude/";
- type = par;
- vcc = 2, 3, 4, 5;
- reset = 7;
- sck = 8;
- mosi = 9;
- miso = 10;
-;
-
-programmer
- id = "stk200";
- desc = "STK200";
- type = par;
- buff = 4, 5;
- sck = 6;
- mosi = 7;
- reset = 9;
- miso = 10;
-;
-
-# The programming dongle used by the popular Ponyprog
-# utility. It is almost similar to the STK200 one,
-# except that there is a LED indicating that the
-# programming is currently in progress.
-
-programmer
- id = "pony-stk200";
- desc = "Pony Prog STK200";
- type = par;
- buff = 4, 5;
- sck = 6;
- mosi = 7;
- reset = 9;
- miso = 10;
- pgmled = 8;
-;
-
-programmer
- id = "dt006";
- desc = "Dontronics DT006";
- type = par;
- reset = 4;
- sck = 5;
- mosi = 2;
- miso = 11;
-;
-
-programmer
- id = "bascom";
- desc = "Bascom SAMPLE programming cable";
- type = par;
- reset = 4;
- sck = 5;
- mosi = 2;
- miso = 11;
-;
-
-programmer
- id = "alf";
- desc = "Nightshade ALF-PgmAVR, http://nightshade.homeip.net/";
- type = par;
- vcc = 2, 3, 4, 5;
- buff = 6;
- reset = 7;
- sck = 8;
- mosi = 9;
- miso = 10;
- errled = 1;
- rdyled = 14;
- pgmled = 16;
- vfyled = 17;
-;
-
-programmer
- id = "sp12";
- desc = "Steve Bolt's Programmer";
- type = par;
- vcc = 4,5,6,7,8;
- reset = 3;
- sck = 2;
- mosi = 9;
- miso = 11;
-;
-
-programmer
- id = "picoweb";
- desc = "Picoweb Programming Cable, http://www.picoweb.net/";
- type = par;
- reset = 2;
- sck = 3;
- mosi = 4;
- miso = 13;
-;
-
-programmer
- id = "abcmini";
- desc = "ABCmini Board, aka Dick Smith HOTCHIP";
- type = par;
- reset = 4;
- sck = 3;
- mosi = 2;
- miso = 10;
-;
-
-programmer
- id = "futurlec";
- desc = "Futurlec.com programming cable.";
- type = par;
- reset = 3;
- sck = 2;
- mosi = 1;
- miso = 10;
-;
-
-
-# From the contributor of the "xil" jtag cable:
-# The "vcc" definition isn't really vcc (the cable gets its power from
-# the programming circuit) but is necessary to switch one of the
-# buffer lines (trying to add it to the "buff" lines doesn't work).
-# With this, TMS connects to RESET, TDI to MOSI, TDO to MISO and TCK
-# to SCK (plus vcc/gnd of course)
-programmer
- id = "xil";
- desc = "Xilinx JTAG cable";
- type = par;
- mosi = 2;
- sck = 3;
- reset = 4;
- buff = 5;
- miso = 13;
- vcc = 6;
-;
-
-
-programmer
- id = "dapa";
- desc = "Direct AVR Parallel Access cable";
- type = par;
- vcc = 3;
- reset = 16;
- sck = 1;
- mosi = 2;
- miso = 11;
-;
-
-programmer
- id = "atisp";
- desc = "AT-ISP V1.1 programming cable for AVR-SDK1 from <http://micro-research.co.th/> micro-research.co.th";
- type = par;
- reset = ~6;
- sck = ~8;
- mosi = ~7;
- miso = ~10;
-;
-
-programmer
- id = "ere-isp-avr";
- desc = "ERE ISP-AVR <http://www.ere.co.th/download/sch050713.pdf>";
- type = par;
- reset = ~4;
- sck = 3;
- mosi = 2;
- miso = 10;
-;
-
-programmer
- id = "blaster";
- desc = "Altera ByteBlaster";
- type = par;
- sck = 2;
- miso = 11;
- reset = 3;
- mosi = 8;
- buff = 14;
-;
-
-# It is almost same as pony-stk200, except vcc on pin 5 to auto
-# disconnect port (download on http://electropol.free.fr)
-programmer
- id = "frank-stk200";
- desc = "Frank STK200";
- type = par;
- vcc = 5;
- sck = 6;
- mosi = 7;
- reset = 9;
- miso = 10;
- pgmled = 8;
-;
-
-# The AT98ISP Cable is a simple parallel dongle for AT89 family.
-# http://www.atmel.com/dyn/products/tools_card.asp?tool_id=2877
-programmer
-id = "89isp";
-desc = "Atmel at89isp cable";
-type = par;
-reset = 17;
-sck = 1;
-mosi = 2;
-miso = 10;
-;
-
-@HAVE_PARPORT_END@
-
-#
-# some ultra cheap programmers use bitbanging on the
-# serialport.
-#
-# PC - DB9 - Pins for RS232:
-#
-# GND 5 -- |O
-# | O| <- 9 RI
-# DTR 4 <- |O |
-# | O| <- 8 CTS
-# TXD 3 <- |O |
-# | O| -> 7 RTS
-# RXD 2 -> |O |
-# | O| <- 6 DSR
-# DCD 1 -> |O
-#
-# Using RXD is currently not supported.
-# Using RI is not supported under Win32 but is supported under Posix.
-
-# serial ponyprog design (dasa2 in uisp)
-# reset=!txd sck=rts mosi=dtr miso=cts
-
-programmer
- id = "ponyser";
- desc = "design ponyprog serial, reset=!txd sck=rts mosi=dtr miso=cts";
- type = serbb;
- reset = ~3;
- sck = 7;
- mosi = 4;
- miso = 8;
-;
-
-programmer
id = "gpio";
desc = "Use gpio_dev to bitbang GPIO lines";
type = gpio;
@@ -843,58 +324,6 @@
miso = 1;
;
-# Same as above, different name
-# reset=!txd sck=rts mosi=dtr miso=cts
-
-programmer
- id = "siprog";
- desc = "Lancos SI-Prog <http://www.lancos.com/siprogsch.html>";
- type = serbb;
- reset = ~3;
- sck = 7;
- mosi = 4;
- miso = 8;
-;
-
-# unknown (dasa in uisp)
-# reset=rts sck=dtr mosi=txd miso=cts
-
-programmer
- id = "dasa";
- desc = "serial port banging, reset=rts sck=dtr mosi=txd miso=cts";
- type = serbb;
- reset = 7;
- sck = 4;
- mosi = 3;
- miso = 8;
-;
-
-# unknown (dasa3 in uisp)
-# reset=!dtr sck=rts mosi=txd miso=cts
-
-programmer
- id = "dasa3";
- desc = "serial port banging, reset=!dtr sck=rts mosi=txd miso=cts";
- type = serbb;
- reset = ~4;
- sck = 7;
- mosi = 3;
- miso = 8;
-;
-
-# C2N232i (jumper configuration "auto")
-# reset=dtr sck=!rts mosi=!txd miso=!cts
-
-programmer
- id = "c2n232i";
- desc = "serial port banging, reset=dtr sck=!rts mosi=!txd miso=!cts";
- type = serbb;
- reset = 4;
- sck = ~7;
- mosi = ~3;
- miso = ~8;
-;
-
#
# PART DEFINITIONS
#

View File

@ -1,95 +0,0 @@
--- avrdude-5.10/config_gram.y.orig 2010-11-05 11:01:14.895247246 +0100
+++ avrdude-5.10/config_gram.y 2010-11-05 11:02:15.219259178 +0100
@@ -1212,10 +1212,10 @@
value = v->value.number;
- if ((value <= 0) || (value >= 18)) {
+ if ((value < 0) || (value >= 18)) {
fprintf(stderr,
"%s: error at line %d of %s: pin must be in the "
- "range 1-17\n",
+ "range 0-17\n",
progname, lineno, infile);
exit(1);
}
--- avrdude-5.10/gpio.c.orig 2010-11-05 20:46:03.363248072 +0100
+++ avrdude-5.10/gpio.c 2010-11-05 20:46:10.051256461 +0100
@@ -101,6 +101,26 @@
+static int gpio_rdy_led(PROGRAMMER * pgm, int value)
+{
+ /* nothing */
+}
+
+static int gpio_err_led(PROGRAMMER * pgm, int value)
+{
+ /* nothing */
+}
+
+static int gpio_pgm_led(PROGRAMMER * pgm, int value)
+{
+ /* nothing */
+}
+
+static int gpio_vfy_led(PROGRAMMER * pgm, int value)
+{
+ /* nothing */
+}
+
static void gpio_display(PROGRAMMER *pgm, const char *p)
{
/* nothing */
@@ -128,40 +148,34 @@
static int gpio_open(PROGRAMMER *pgm, char *port)
{
- int i;
-
- bitbang_check_prerequisites(pgm);
-
if ((gpio_fd = open("/dev/gpio", O_RDWR)) < 0) {
perror("cannot open /dev/gpio");
return -1;
}
- for (i = 0; i < N_PINS; i++) {
- if (i == PIN_AVR_MISO)
- _gpio_dir(pgm->pinno[i], AVRDUDE_GPIO_DIR_IN);
- else
- _gpio_dir(pgm->pinno[i], AVRDUDE_GPIO_DIR_OUT);
- }
+ _gpio_dir(pgm->pinno[PIN_AVR_RESET], AVRDUDE_GPIO_DIR_OUT);
+ _gpio_dir(pgm->pinno[PIN_AVR_SCK], AVRDUDE_GPIO_DIR_OUT);
+ _gpio_dir(pgm->pinno[PIN_AVR_MOSI], AVRDUDE_GPIO_DIR_OUT);
+ _gpio_dir(pgm->pinno[PIN_AVR_MISO], AVRDUDE_GPIO_DIR_IN);
- return(0);
+ return 0;
}
static void gpio_close(PROGRAMMER *pgm)
{
gpio_setpin(pgm, pgm->pinno[PIN_AVR_RESET], 1);
close(gpio_fd);
- return;
+ return 0;
}
void gpio_initpgm(PROGRAMMER *pgm)
{
strcpy(pgm->type, "GPIO");
- pgm->rdy_led = bitbang_rdy_led;
- pgm->err_led = bitbang_err_led;
- pgm->pgm_led = bitbang_pgm_led;
- pgm->vfy_led = bitbang_vfy_led;
+ pgm->rdy_led = gpio_rdy_led;
+ pgm->err_led = gpio_err_led;
+ pgm->pgm_led = gpio_pgm_led;
+ pgm->vfy_led = gpio_vfy_led;
pgm->initialize = bitbang_initialize;
pgm->display = gpio_display;
pgm->enable = gpio_enable;

View File

@ -1,197 +0,0 @@
--- /tmp/avrdude-5.10/avrdude.conf.in 2011-01-31 22:17:05.060017389 +0100
+++ avrdude-5.10/avrdude.conf.in 2011-01-31 22:22:03.792017389 +0100
@@ -4772,6 +4772,194 @@
;
#------------------------------------------------------------
+# ATmega168P
+#------------------------------------------------------------
+
+part
+ id = "m168p";
+ desc = "ATMEGA168P";
+ has_debugwire = yes;
+ flash_instr = 0xB6, 0x01, 0x11;
+ eeprom_instr = 0xBD, 0xF2, 0xBD, 0xE1, 0xBB, 0xCF, 0xB4, 0x00,
+ 0xBE, 0x01, 0xB6, 0x01, 0xBC, 0x00, 0xBB, 0xBF,
+ 0x99, 0xF9, 0xBB, 0xAF;
+ stk500_devcode = 0x86;
+ # avr910_devcode = 0x;
+ signature = 0x1e 0x94 0x0b;
+ pagel = 0xd7;
+ bs2 = 0xc2;
+ chip_erase_delay = 9000;
+ pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1",
+ "x x x x x x x x x x x x x x x x";
+
+ chip_erase = "1 0 1 0 1 1 0 0 1 0 0 x x x x x",
+ "x x x x x x x x x x x x x x x x";
+
+ timeout = 200;
+ stabdelay = 100;
+ cmdexedelay = 25;
+ synchloops = 32;
+ bytedelay = 0;
+ pollindex = 3;
+ pollvalue = 0x53;
+ predelay = 1;
+ postdelay = 1;
+ pollmethod = 1;
+
+ pp_controlstack =
+ 0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F,
+ 0x4E, 0x5E, 0x4F, 0x5F, 0x6E, 0x7E, 0x6F, 0x7F,
+ 0x66, 0x76, 0x67, 0x77, 0x6A, 0x7A, 0x6B, 0x7B,
+ 0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00;
+ hventerstabdelay = 100;
+ progmodedelay = 0;
+ latchcycles = 5;
+ togglevtg = 1;
+ poweroffdelay = 15;
+ resetdelayms = 1;
+ resetdelayus = 0;
+ hvleavestabdelay = 15;
+ resetdelay = 15;
+ chiperasepulsewidth = 0;
+ chiperasepolltimeout = 10;
+ programfusepulsewidth = 0;
+ programfusepolltimeout = 5;
+ programlockpulsewidth = 0;
+ programlockpolltimeout = 5;
+
+ memory "eeprom"
+ paged = no;
+ page_size = 4;
+ size = 512;
+ min_write_delay = 3600;
+ max_write_delay = 3600;
+ readback_p1 = 0xff;
+ readback_p2 = 0xff;
+ read = " 1 0 1 0 0 0 0 0",
+ " 0 0 0 x x x x a8",
+ " a7 a6 a5 a4 a3 a2 a1 a0",
+ " o o o o o o o o";
+
+ write = " 1 1 0 0 0 0 0 0",
+ " 0 0 0 x x x x a8",
+ " a7 a6 a5 a4 a3 a2 a1 a0",
+ " i i i i i i i i";
+
+ loadpage_lo = " 1 1 0 0 0 0 0 1",
+ " 0 0 0 0 0 0 0 0",
+ " 0 0 0 0 0 0 a1 a0",
+ " i i i i i i i i";
+
+ writepage = " 1 1 0 0 0 0 1 0",
+ " 0 0 x x x x x a8",
+ " a7 a6 a5 a4 a3 a2 0 0",
+ " x x x x x x x x";
+
+ mode = 0x41;
+ delay = 5;
+ blocksize = 4;
+ readsize = 256;
+ ;
+
+ memory "flash"
+ paged = yes;
+ size = 16384;
+ page_size = 128;
+ num_pages = 128;
+ min_write_delay = 4500;
+ max_write_delay = 4500;
+ readback_p1 = 0xff;
+ readback_p2 = 0xff;
+ read_lo = " 0 0 1 0 0 0 0 0",
+ " 0 0 0 a12 a11 a10 a9 a8",
+ " a7 a6 a5 a4 a3 a2 a1 a0",
+ " o o o o o o o o";
+
+ read_hi = " 0 0 1 0 1 0 0 0",
+ " 0 0 0 a12 a11 a10 a9 a8",
+ " a7 a6 a5 a4 a3 a2 a1 a0",
+ " o o o o o o o o";
+
+ loadpage_lo = " 0 1 0 0 0 0 0 0",
+ " 0 0 0 x x x x x",
+ " x x a5 a4 a3 a2 a1 a0",
+ " i i i i i i i i";
+
+ loadpage_hi = " 0 1 0 0 1 0 0 0",
+ " 0 0 0 x x x x x",
+ " x x a5 a4 a3 a2 a1 a0",
+ " i i i i i i i i";
+
+ writepage = " 0 1 0 0 1 1 0 0",
+ " 0 0 0 a12 a11 a10 a9 a8",
+ " a7 a6 x x x x x x",
+ " x x x x x x x x";
+
+ mode = 0x41;
+ delay = 6;
+ blocksize = 128;
+ readsize = 256;
+
+ ;
+
+ memory "lfuse"
+ size = 1;
+ min_write_delay = 4500;
+ max_write_delay = 4500;
+ read = "0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0",
+ "x x x x x x x x o o o o o o o o";
+
+ write = "1 0 1 0 1 1 0 0 1 0 1 0 0 0 0 0",
+ "x x x x x x x x i i i i i i i i";
+ ;
+
+ memory "hfuse"
+ size = 1;
+ min_write_delay = 4500;
+ max_write_delay = 4500;
+ read = "0 1 0 1 1 0 0 0 0 0 0 0 1 0 0 0",
+ "x x x x x x x x o o o o o o o o";
+
+ write = "1 0 1 0 1 1 0 0 1 0 1 0 1 0 0 0",
+ "x x x x x x x x i i i i i i i i";
+ ;
+
+ memory "efuse"
+ size = 1;
+ min_write_delay = 4500;
+ max_write_delay = 4500;
+ read = "0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0",
+ "x x x x x x x x x x x x x o o o";
+
+ write = "1 0 1 0 1 1 0 0 1 0 1 0 0 1 0 0",
+ "x x x x x x x x x x x x x i i i";
+ ;
+
+ memory "lock"
+ size = 1;
+ min_write_delay = 4500;
+ max_write_delay = 4500;
+ read = "0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0",
+ "x x x x x x x x x x o o o o o o";
+
+ write = "1 0 1 0 1 1 0 0 1 1 1 x x x x x",
+ "x x x x x x x x 1 1 i i i i i i";
+ ;
+
+ memory "calibration"
+ size = 1;
+ read = "0 0 1 1 1 0 0 0 0 0 0 x x x x x",
+ "0 0 0 0 0 0 0 0 o o o o o o o o";
+ ;
+
+ memory "signature"
+ size = 3;
+ read = "0 0 1 1 0 0 0 0 0 0 0 x x x x x",
+ "x x x x x x a1 a0 o o o o o o o o";
+ ;
+;
+
+#------------------------------------------------------------
# ATmega328P
#------------------------------------------------------------

View File

@ -1,13 +0,0 @@
--- /tmp/avrdude-5.10/avrdude.conf.in 2011-01-31 22:40:13.496017390 +0100
+++ avrdude-5.10/avrdude.conf.in 2011-01-31 22:41:05.824017388 +0100
@@ -318,8 +318,8 @@
id = "gpio";
desc = "Use gpio_dev to bitbang GPIO lines";
type = gpio;
- reset = 0;
- sck = 3;
+ reset = ~0;
+ sck = ~3;
mosi = 1;
miso = 2;
;

View File

@ -1,38 +0,0 @@
# Copyright (c) 2010 flukso.net
include $(TOPDIR)/rules.mk
PKG_NAME:=button
PKG_VERSION:=1.0
PKG_RELEASE:=1
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
include $(INCLUDE_DIR)/package.mk
define Package/button
SECTION:=utils
CATEGORY:=Utilities
DEPENDS:=
TITLE:=Button
endef
define Package/button/description
Helper bash scripts used as a callback for hotplug button events. net_toggle toggles between ethernet and wifi mode. net_defaults reverts all firewall, network and wireless settings to factory defaults.
endef
define Build/Prepare
mkdir -p $(PKG_BUILD_DIR)
$(CP) ./src/* $(PKG_BUILD_DIR)/
endef
define Build/Compile
endef
define Package/button/install
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/net_toggle $(1)/usr/sbin/
$(INSTALL_BIN) $(PKG_BUILD_DIR)/net_defaults $(1)/usr/sbin/
endef
$(eval $(call BuildPackage,button))

Some files were not shown because too many files have changed in this diff Show More