From e0960b1b787503b712e42776f980d792836992fd Mon Sep 17 00:00:00 2001 From: asterix Date: Mon, 26 May 2008 17:21:22 +0000 Subject: [PATCH] Add configuration module for each bertos driver. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@1378 38d2e660-2303-0410-9eaa-f027e97ec537 --- bertos/cfg/cfg_adc.h | 66 +++++++++++++++++++++++ bertos/cfg/cfg_attr.h | 47 ++++++++++++++++ bertos/cfg/cfg_dc_motor.h | 44 +++++++++++++++ bertos/cfg/cfg_debug.h | 49 +++++++++++++++++ bertos/cfg/cfg_eeprom.h | 49 +++++++++++++++++ bertos/cfg/cfg_flash25.h | 47 ++++++++++++++++ bertos/cfg/cfg_kbd.h | 56 +++++++++++++++++++ bertos/cfg/cfg_lcd.h | 55 +++++++++++++++++++ bertos/cfg/cfg_md2.h | 50 +++++++++++++++++ bertos/cfg/cfg_pocketbus.h | 46 ++++++++++++++++ bertos/cfg/cfg_randpool.h | 52 ++++++++++++++++++ bertos/cfg/cfg_ser.h | 108 +++++++++++++++++++++++++++++++++++++ bertos/cfg/cfg_stepper.h | 47 ++++++++++++++++ bertos/cfg/cfg_timer.h | 49 +++++++++++++++++ bertos/cfg/cfg_wdt.h | 48 +++++++++++++++++ bertos/cfg/cfg_xmodem.h | 53 ++++++++++++++++++ 16 files changed, 866 insertions(+) create mode 100644 bertos/cfg/cfg_adc.h create mode 100644 bertos/cfg/cfg_attr.h create mode 100644 bertos/cfg/cfg_dc_motor.h create mode 100644 bertos/cfg/cfg_debug.h create mode 100644 bertos/cfg/cfg_eeprom.h create mode 100644 bertos/cfg/cfg_flash25.h create mode 100644 bertos/cfg/cfg_kbd.h create mode 100644 bertos/cfg/cfg_lcd.h create mode 100644 bertos/cfg/cfg_md2.h create mode 100644 bertos/cfg/cfg_pocketbus.h create mode 100644 bertos/cfg/cfg_randpool.h create mode 100644 bertos/cfg/cfg_ser.h create mode 100644 bertos/cfg/cfg_stepper.h create mode 100644 bertos/cfg/cfg_timer.h create mode 100644 bertos/cfg/cfg_wdt.h create mode 100644 bertos/cfg/cfg_xmodem.h diff --git a/bertos/cfg/cfg_adc.h b/bertos/cfg/cfg_adc.h new file mode 100644 index 00000000..201616e7 --- /dev/null +++ b/bertos/cfg/cfg_adc.h @@ -0,0 +1,66 @@ +/** + * \file + * + * + * \brief Configuration file for ADC module. + * + * \version $Id$ + * + * \author Daniele Basile + */ + +#ifndef CFG_ADC_H +#define CFG_ADC_H + +/** + * ADC timing setting parameter + * + * - CONFIG_ADC_CLOCK is frequency clock for ADC conversion. + * - CONFIG_ADC_STARTUP_TIME minimum time for startup a conversion in micro second. + * - CONFIG_ADC_SHTIME minimum time for sample and hold in nano second. + * \{ + */ +#define CONFIG_ADC_CLOCK 4800000UL +#define CONFIG_ADC_STARTUP_TIME 20 +#define CONFIG_ADC_SHTIME 834 +/* \ * } */ + +/// ADC setting for AVR target +#define CONFIG_ADC_AVR_REF 1 +#define CONFIG_ADC_AVR_DIVISOR 2 + + + +/// Enable ADS strobe. +#define CONFIG_ADC_STROBE 0 + +#endif /* CFG_ADC_H */ + diff --git a/bertos/cfg/cfg_attr.h b/bertos/cfg/cfg_attr.h new file mode 100644 index 00000000..2bd23fbc --- /dev/null +++ b/bertos/cfg/cfg_attr.h @@ -0,0 +1,47 @@ +/** + * \file + * + * + * \brief Configuration file for Debug module. + * + * \version $Id$ + * + * \author Daniele Basile + */ + +#ifndef CFG_ATTR_H +#define CFG_ATTR_H + +/// Put a function or critical code in fast memory. +#define CONFIG_FAST_MEM 0 + + +#endif /* CFG_ATTR_H */ diff --git a/bertos/cfg/cfg_dc_motor.h b/bertos/cfg/cfg_dc_motor.h new file mode 100644 index 00000000..baa09796 --- /dev/null +++ b/bertos/cfg/cfg_dc_motor.h @@ -0,0 +1,44 @@ +/** + * \file + * + * + * \brief Configuration file for DC motor module. + * + * \version $Id$ + * + * \author Daniele Basile + */ + +#ifndef CFG_DC_MOTOR_H +#define CFG_DC_MOTOR_H + + +#endif /* CFG_DC_MOTOR_H */ diff --git a/bertos/cfg/cfg_debug.h b/bertos/cfg/cfg_debug.h new file mode 100644 index 00000000..539772af --- /dev/null +++ b/bertos/cfg/cfg_debug.h @@ -0,0 +1,49 @@ +/** + * \file + * + * + * \brief Configuration file for Debug module. + * + * \version $Id$ + * + * \author Daniele Basile + */ + +#ifndef CFG_DEBUG_H +#define CFG_DEBUG_H + +/// kdebug console. +#define CONFIG_KDEBUG_PORT 0 + +/// Baud-rate for the kdebug console. +#define CONFIG_KDEBUG_BAUDRATE 19200 + +#endif /* CFG_DEBUG_H */ diff --git a/bertos/cfg/cfg_eeprom.h b/bertos/cfg/cfg_eeprom.h new file mode 100644 index 00000000..d56dbece --- /dev/null +++ b/bertos/cfg/cfg_eeprom.h @@ -0,0 +1,49 @@ +/** + * \file + * + * + * \brief Configuration file for eeprom memory module. + * + * \version $Id$ + * + * \author Daniele Basile + */ + +#ifndef CFG_EEPROM_H +#define CFG_EEPROM_H + +/// EEPROM type. +#define CONFIG_EEPROM_TYPE EEPROM_24XX256 + +/// Sanity check for eeprom memory. +#define CONFIG_EEPROM_VERIFY 0 + +#endif /* CFG_EEPROM_H */ diff --git a/bertos/cfg/cfg_flash25.h b/bertos/cfg/cfg_flash25.h new file mode 100644 index 00000000..361277a1 --- /dev/null +++ b/bertos/cfg/cfg_flash25.h @@ -0,0 +1,47 @@ +/** + * \file + * + * + * \brief Configuration file for flash25 module. + * + * \version $Id$ + * + * \author Daniele Basile + */ + +#ifndef CFG_FLASH25_H +#define CFG_FLASH25_H + +/// Eeprom memory type. +#define CONFIG_FLASH25 FLASH25_AT25F2048 + +#endif /* CFG_FALSH25_H */ + diff --git a/bertos/cfg/cfg_kbd.h b/bertos/cfg/cfg_kbd.h new file mode 100644 index 00000000..2913b235 --- /dev/null +++ b/bertos/cfg/cfg_kbd.h @@ -0,0 +1,56 @@ +/** + * \file + * + * + * \brief Configuration file for keyboard module. + * + * \version $Id$ + * + * \author Daniele Basile + */ + +#ifndef CFG_KBD_H +#define CFG_KBD_H + +/// Keyboard polling method +#define CONFIG_KBD_POLL KBD_POLL_SOFTINT + +/// Enable keyboard event delivery to observers +#define CONFIG_KBD_OBSERVER 0 + +/// Enable key beeps +#define CONFIG_KBD_BEEP 1 + +/// Enable long pression handler for keys +#define CONFIG_KBD_LONGPRESS 0 + +#endif /* CFG_KBD_H */ + diff --git a/bertos/cfg/cfg_lcd.h b/bertos/cfg/cfg_lcd.h new file mode 100644 index 00000000..c4974b04 --- /dev/null +++ b/bertos/cfg/cfg_lcd.h @@ -0,0 +1,55 @@ +/** + * \file + * + * + * \brief Configuration file for lcd display module. + * + * \version $Id$ + * + * \author Daniele Basile + */ + +#ifndef CFG_LCD_H +#define CFG_LCD_H + +/// Number bit for lcd bus +#define CONFIG_LCD_4BIT 1 + +/// TODO: +#define CONFIG_LCD_ADDRESS_FAST 1 + +/// LCD setting for 32122A (AVR implementation) +#define CONFIG_LCD_SOFTINT_REFRESH 0 +#define CONFIG_LCD_WAIT 1 + + +#endif /* CFG_LCD_H */ + diff --git a/bertos/cfg/cfg_md2.h b/bertos/cfg/cfg_md2.h new file mode 100644 index 00000000..be427ec7 --- /dev/null +++ b/bertos/cfg/cfg_md2.h @@ -0,0 +1,50 @@ +/** + * \file + * + * + * \brief Configuration file for MD2 module. + * + * \version $Id$ + * + * \author Daniele Basile + */ + +#ifndef CFG_MD2_H +#define CFG_MD2_H + +/// Size of block for MD2 algorithm. +#define CONFIG_MD2_BLOCK_LEN 16 + +/// Use standard permutation in MD2 algorithm. +#define CONFIG_MD2_STD_PERM 0 + +#endif /* CFG_MD2_H */ + diff --git a/bertos/cfg/cfg_pocketbus.h b/bertos/cfg/cfg_pocketbus.h new file mode 100644 index 00000000..f3f5fbca --- /dev/null +++ b/bertos/cfg/cfg_pocketbus.h @@ -0,0 +1,46 @@ +/** + * \file + * + * + * \brief Configuration file for pocketbus module. + * + * \version $Id$ + * + * \author Daniele Basile + */ + +#ifndef CFG_POCKETBUS_H +#define CFG_POCKETBUS_H + +/// Buffer len for pockebus protocol. +#define CONFIG_POCKETBUS_BUFLEN 128 + +#endif /* CFG_POCKETBUS_H */ diff --git a/bertos/cfg/cfg_randpool.h b/bertos/cfg/cfg_randpool.h new file mode 100644 index 00000000..e7c6a075 --- /dev/null +++ b/bertos/cfg/cfg_randpool.h @@ -0,0 +1,52 @@ +/** + * \file + * + * + * \brief Configuration file for randpool module. + * + * \version $Id$ + * + * \author Daniele Basile + */ + +#ifndef CFG_RANDPOOL_H +#define CFG_RANDPOOL_H + + +/// Define a size, in byte, of entropy pool. +#define CONFIG_SIZE_ENTROPY_POOL 64 + +/// Turn on or off timer support in Randpool. +#define CONFIG_RANDPOOL_TIMER 1 + +#endif /* CFG_RANDPOOL_H */ + + diff --git a/bertos/cfg/cfg_ser.h b/bertos/cfg/cfg_ser.h new file mode 100644 index 00000000..5d5f0ffc --- /dev/null +++ b/bertos/cfg/cfg_ser.h @@ -0,0 +1,108 @@ +/** + * \file + * + * + * \brief Configuration file for serial module. + * + * \version $Id$ + * + * \author Daniele Basile + */ + +#ifndef CFG_SER_H +#define CFG_SER_H + + +/// [bytes] Size of the outbound FIFO buffer for port 0. +#define CONFIG_UART0_TXBUFSIZE 32 + +/// [bytes] Size of the inbound FIFO buffer for port 0. +#define CONFIG_UART0_RXBUFSIZE 32 + +/// [bytes] Size of the outbound FIFO buffer for port 1. +#define CONFIG_UART1_TXBUFSIZE 32 + +/// [bytes] Size of the inbound FIFO buffer for port 1. +#define CONFIG_UART1_RXBUFSIZE 32 + +/// [bytes] Size of the outbound FIFO buffer for SPI port 0. +#define CONFIG_SPI0_TXBUFSIZE 32 + +/// [bytes] Size of the inbound FIFO buffer for SPI port 0. +#define CONFIG_SPI0_RXBUFSIZE 32 + +/// [bytes] Size of the outbound FIFO buffer for SPI port 1. +#define CONFIG_SPI1_TXBUFSIZE 32 + +/// [bytes] Size of the inbound FIFO buffer for SPI port 1. +#define CONFIG_SPI1_RXBUFSIZE 32 + +/// SPI data order (AVR only). +#define CONFIG_SPI_DATA_ORDER SER_MSB_FIRST + +/// SPI clock division factor (AVR only). +#define CONFIG_SPI_CLOCK_DIV 16 + +/// SPI clock polarity: 0 = normal low, 1 = normal high (AVR only). +#define CONFIG_SPI_CLOCK_POL 0 + +/// SPI clock phase: 0 = sample on first edge, 1 = sample on second clock edge (AVR only). +#define CONFIG_SPI_CLOCK_PHASE 0 + +/// Default transmit timeout (ms). Set to -1 to disable timeout support. +#define CONFIG_SER_TXTIMEOUT -1 + +/// Default receive timeout (ms). Set to -1 to disable timeout support. +#define CONFIG_SER_RXTIMEOUT -1 + +/// Use RTS/CTS handshake +#define CONFIG_SER_HWHANDSHAKE 0 + +/// Default baud rate (set to 0 to disable). +#define CONFIG_SER_DEFBAUDRATE 0 + +/// Enable ser_gets() and ser_gets_echo(). +#define CONFIG_SER_GETS 0 + +/// Enable second serial port in emulator. +#define CONFIG_EMUL_UART1 0 + +/** + * Transmit always something on serial port 0 TX + * to avoid interference when sending burst of data, + * using AVR multiprocessor serial mode + */ +#define CONFIG_SER_TXFILL 0 + +/// For serial debug. +#define CONFIG_SER_STROBE 0 + +#endif /* CFG_SER_H */ diff --git a/bertos/cfg/cfg_stepper.h b/bertos/cfg/cfg_stepper.h new file mode 100644 index 00000000..fbe7a3e8 --- /dev/null +++ b/bertos/cfg/cfg_stepper.h @@ -0,0 +1,47 @@ +/** + * \file + * + * + * \brief Configuration file for stepper motor module. + * + * \version $Id$ + * + * \author Daniele Basile + */ + +#ifndef CFG_STEPPER_H +#define CFG_STEPPER_H + +/// Number of usable stepper motor. +#define CONFIG_NUM_STEPPER_MOTORS 1 + +#endif /* CFG_STEPPER_H */ + diff --git a/bertos/cfg/cfg_timer.h b/bertos/cfg/cfg_timer.h new file mode 100644 index 00000000..9333e6e3 --- /dev/null +++ b/bertos/cfg/cfg_timer.h @@ -0,0 +1,49 @@ +/** + * \file + * + * + * \brief Configuration file for timer module. + * + * \version $Id$ + * + * \author Daniele Basile + */ + +#ifndef CFG_TIMER_H +#define CFG_TIMER_H + +/// Hardware timer selection for drv/timer.c +#define CONFIG_TIMER TIMER_DEFAULT + +/// Debug timer interrupt using a strobe pin. +#define CONFIG_TIMER_STROBE 0 + +#endif /* CFG_TIMER_H */ diff --git a/bertos/cfg/cfg_wdt.h b/bertos/cfg/cfg_wdt.h new file mode 100644 index 00000000..79a35d49 --- /dev/null +++ b/bertos/cfg/cfg_wdt.h @@ -0,0 +1,48 @@ +/** + * \file + * + * + * \brief Configuration file for watchdog module. + * + * \version $Id$ + * + * \author Daniele Basile + */ + +#ifndef CFG_WDT_H +#define CFG_WDT_H + +/// Enable watchdog timer. +#define CONFIG_WATCHDOG 0 + +#endif /* CFG_WDT_H */ + + diff --git a/bertos/cfg/cfg_xmodem.h b/bertos/cfg/cfg_xmodem.h new file mode 100644 index 00000000..71ced64a --- /dev/null +++ b/bertos/cfg/cfg_xmodem.h @@ -0,0 +1,53 @@ +/** + * \file + * + * + * \brief Configuration file for xmodem module. + * + * \version $Id$ + * + * \author Daniele Basile + */ + +#ifndef CFG_XMODEM_H +#define CFG_XMODEM_H + +/// Enable Rx +#define CONFIG_XMODEM_RECV 1 + +/// Enable TX +#define CONFIG_XMODEM_SEND 1 + +/// Allow a Rx/Tx of 1Kbyte block +#define CONFIG_XMODEM_1KCRC 1 + +#endif /* CFG_XMODEM_H */ + -- 2.25.1