#include examples/at91sam7/at91sam7s.mk
#include examples/at91sam7/at91sam7x.mk
#include examples/lm3s1968/lm3s1968.mk
+#include examples/lm3s8962/lm3s8962.mk
#include examples/develgps/develgps.mk
#include examples/lpc2378/lpc2378.mk
#include examples/avr-kern/avr-kern.mk
--- /dev/null
+/**
+ * \file
+ * <!--
+ * This file is part of BeRTOS.
+ *
+ * Bertos 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 St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * As a special exception, you may use this file as part of a free software
+ * library without restriction. Specifically, if other files instantiate
+ * templates or use macros or inline functions from this file, or you compile
+ * this file and link it with other files to produce an executable, this
+ * file does not by itself cause the resulting executable to be covered by
+ * the GNU General Public License. This exception does not however
+ * invalidate any other reasons why the executable file might be covered by
+ * the GNU General Public License.
+ *
+ * Copyright 2008 Develer S.r.l. (http://www.develer.com/)
+ * All Rights Reserved.
+ * -->
+ *
+ * \brief Configuration file for Debug module.
+ *
+ * \author Daniele Basile <asterix@develer.com>
+ */
+
+#ifndef CFG_DEBUG_H
+#define CFG_DEBUG_H
+
+/**
+ * Debug console port.
+ * $WIZ$ type = "int"; min = 0
+ */
+#define CONFIG_KDEBUG_PORT 0
+
+/**
+ * Baudrate for the debug console.
+ * $WIZ$ type = "int"; min = 300
+ */
+#define CONFIG_KDEBUG_BAUDRATE 115200UL
+
+#endif /* CFG_DEBUG_H */
--- /dev/null
+/**
+ * \file
+ * <!--
+ * This file is part of BeRTOS.
+ *
+ * Bertos 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 St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * As a special exception, you may use this file as part of a free software
+ * library without restriction. Specifically, if other files instantiate
+ * templates or use macros or inline functions from this file, or you compile
+ * this file and link it with other files to produce an executable, this
+ * file does not by itself cause the resulting executable to be covered by
+ * the GNU General Public License. This exception does not however
+ * invalidate any other reasons why the executable file might be covered by
+ * the GNU General Public License.
+ *
+ * Copyright 2008 Develer S.r.l. (http://www.develer.com/)
+ * All Rights Reserved.
+ * -->
+ *
+ * \brief Configuration file for GFX module.
+ *
+ * \version $Id$
+ *
+ * \author Daniele Basile <asterix@develer.com>
+ */
+
+#ifndef CFG_GFX_H
+#define CFG_GFX_H
+
+/// Enable line clipping algorithm.
+#define CONFIG_GFX_CLIPPING 1
+
+/// Enable text rendering in bitmaps.
+#define CONFIG_GFX_TEXT 1
+
+/// Enable virtual coordinate system.
+#define CONFIG_GFX_VCOORDS 1
+
+/// Select bitmap pixel format.
+#define CONFIG_BITMAP_FMT BITMAP_FMT_PLANAR_V_LSB
+
+
+#define CONFIG_CHART_TYPE_X uint8_t ///< Type for the chart dataset
+#define CONFIG_CHART_TYPE_Y uint8_t ///< Type for the chart dataset
+
+
+/// Enable button bar behind menus
+#define CONFIG_MENU_MENUBAR 0
+
+/// Level Edit Timeout
+#define CONFIG_LEVELEDIT_TIMEOUT 0
+
+/// Menu timeout
+#define CONFIG_MENU_TIMEOUT 0
+
+/// Enable smooth scrolling in menus
+#define CONFIG_MENU_SMOOTH 1
+
+
+#endif /* CFG_GFX_H */
+
--- /dev/null
+/**
+ * \file
+ * <!--
+ * This file is part of BeRTOS.
+ *
+ * Bertos 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 St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * As a special exception, you may use this file as part of a free software
+ * library without restriction. Specifically, if other files instantiate
+ * templates or use macros or inline functions from this file, or you compile
+ * this file and link it with other files to produce an executable, this
+ * file does not by itself cause the resulting executable to be covered by
+ * the GNU General Public License. This exception does not however
+ * invalidate any other reasons why the executable file might be covered by
+ * the GNU General Public License.
+ *
+ * Copyright 2008 Develer S.r.l. (http://www.develer.com/)
+ * All Rights Reserved.
+ * -->
+ *
+ * \brief Configuration file for heap module.
+ *
+ * \author Daniele Basile <asterix@develer.com>
+ */
+
+#ifndef CFG_HEAP_H
+#define CFG_HEAP_H
+
+/**
+ * Enable malloc/free like API.
+ * $WIZ$ type = "boolean"
+ */
+#define CONFIG_HEAP_MALLOC 1
+
+#endif /* CFG_HEAP_H */
+
+
--- /dev/null
+/**
+ * \file
+ * <!--
+ * This file is part of BeRTOS.
+ *
+ * Bertos 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 St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * As a special exception, you may use this file as part of a free software
+ * library without restriction. Specifically, if other files instantiate
+ * templates or use macros or inline functions from this file, or you compile
+ * this file and link it with other files to produce an executable, this
+ * file does not by itself cause the resulting executable to be covered by
+ * the GNU General Public License. This exception does not however
+ * invalidate any other reasons why the executable file might be covered by
+ * the GNU General Public License.
+ *
+ * Copyright 2008 Develer S.r.l. (http://www.develer.com/)
+ *
+ * -->
+ *
+ * \brief Configuration file for KFile interface module.
+ *
+ * \version $Id$
+ * \author Daniele Basile <asterix@develer.com>
+ */
+
+#ifndef CFG_KFILE_H
+#define CFG_KFILE_H
+
+/**
+ * Module logging level.
+ * $WIZ$ type = "enum"
+ * $WIZ$ value_list = "log_level"
+ */
+#define KFILE_LOG_LEVEL LOG_LVL_INFO
+
+/**
+ * Module logging format.
+ * $WIZ$ type = "enum"
+ * $WIZ$ value_list = "log_format"
+ */
+#define KFILE_LOG_FORMAT LOG_FMT_TERSE
+
+/**
+ * Enable the gets function with echo.
+ * $WIZ$ type = "boolean"
+ */
+#define CONFIG_KFILE_GETS 1
+
+#endif /* CFG_KFILE_H */
--- /dev/null
+/**
+ * \file
+ * <!--
+ * This file is part of BeRTOS.
+ *
+ * Bertos 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 St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * As a special exception, you may use this file as part of a free software
+ * library without restriction. Specifically, if other files instantiate
+ * templates or use macros or inline functions from this file, or you compile
+ * this file and link it with other files to produce an executable, this
+ * file does not by itself cause the resulting executable to be covered by
+ * the GNU General Public License. This exception does not however
+ * invalidate any other reasons why the executable file might be covered by
+ * the GNU General Public License.
+ *
+ * Copyright 2008 Develer S.r.l. (http://www.develer.com/)
+ * All Rights Reserved.
+ * -->
+ *
+ * \brief Configuration file for lcd display module.
+ */
+
+#ifndef CFG_LCD_H
+#define CFG_LCD_H
+
+/**
+ * Use 4 bit addressing mode.
+ * $WIZ$ type = "boolean"
+ */
+#define CONFIG_LCD_4BIT 0
+
+/**
+ * Use a table to speed up LCD memory addressing.
+ * This will use about 100 bytes of RAM.
+ * $WIZ$ type = "boolean"
+ */
+#define CONFIG_LCD_ADDRESS_FAST 0
+
+/**
+ * LCD setting for 32122A (AVR implementation).
+ * $WIZ$ type = "boolean"
+ * $WIZ$ supports = "avr and False"
+ */
+#define CONFIG_LCD_SOFTINT_REFRESH 0
+
+/**
+ * LCD setting for 32122A (AVR implementation).
+ * $WIZ$ type = "boolean"
+ * $WIZ$ supports = "avr and False"
+ */
+#define CONFIG_LCD_WAIT 0
+
+
+#endif /* CFG_LCD_H */
+
--- /dev/null
+/**
+ * \file
+ * <!--
+ * This file is part of BeRTOS.
+ *
+ * Bertos 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 St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * As a special exception, you may use this file as part of a free software
+ * library without restriction. Specifically, if other files instantiate
+ * templates or use macros or inline functions from this file, or you compile
+ * this file and link it with other files to produce an executable, this
+ * file does not by itself cause the resulting executable to be covered by
+ * the GNU General Public License. This exception does not however
+ * invalidate any other reasons why the executable file might be covered by
+ * the GNU General Public License.
+ *
+ * Copyright 2001, 2004 Develer S.r.l. (http://www.develer.com/)
+ * Copyright 1999, 2000, 2001, 2008 Bernie Innocenti <bernie@codewiz.org>
+ * -->
+ *
+ * \brief Kernel monitor configuration parameters
+ *
+ * \author Bernie Innocenti <bernie@codewiz.org>
+ */
+
+#ifndef CFG_MONITOR_H
+#define CFG_MONITOR_H
+
+/**
+ * Process monitor.
+ * $WIZ$ type = "autoenabled"
+ */
+#define CONFIG_KERN_MONITOR 1
+
+#endif /* CFG_MONITOR_H */
--- /dev/null
+/**
+ * \file
+ * <!--
+ * This file is part of BeRTOS.
+ *
+ * Bertos 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 St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * As a special exception, you may use this file as part of a free software
+ * library without restriction. Specifically, if other files instantiate
+ * templates or use macros or inline functions from this file, or you compile
+ * this file and link it with other files to produce an executable, this
+ * file does not by itself cause the resulting executable to be covered by
+ * the GNU General Public License. This exception does not however
+ * invalidate any other reasons why the executable file might be covered by
+ * the GNU General Public License.
+ *
+ * Copyright 2001, 2004 Develer S.r.l. (http://www.develer.com/)
+ * Copyright 1999, 2000, 2001, 2008 Bernie Innocenti <bernie@codewiz.org>
+ * -->
+ *
+ * \brief Kernel configuration parameters
+ *
+ * \author Bernie Innocenti <bernie@codewiz.org>
+ */
+
+#ifndef CFG_PROC_H
+#define CFG_PROC_H
+
+/**
+ * Enable the multithreading kernel.
+ *
+ * $WIZ$ type = "autoenabled"
+ */
+#define CONFIG_KERN 1
+
+/**
+ * Kernel interrupt supervisor. WARNING: Experimental, still incomplete!
+ * $WIZ$ type = "boolean"
+ * $WIZ$ supports = "False"
+ */
+#define CONFIG_KERN_IRQ 0
+
+/**
+ * Preemptive process scheduling.
+ *
+ * $WIZ$ type = "boolean"
+ * $WIZ$ conditional_deps = "timer"
+ */
+#define CONFIG_KERN_PREEMPT 1
+
+/**
+ * Time sharing quantum (a prime number prevents interference effects) [ms].
+ *
+ * $WIZ$ type = "int"
+ * $WIZ$ min = 1
+ */
+#define CONFIG_KERN_QUANTUM 11
+
+/**
+ * Priority-based scheduling policy.
+ * $WIZ$ type = "boolean"
+ */
+#define CONFIG_KERN_PRI 1
+
+/**
+ * Dynamic memory allocation for processes.
+ * $WIZ$ type = "boolean"
+ * $WIZ$ conditional_deps = "heap"
+ */
+#define CONFIG_KERN_HEAP 1
+
+/**
+ * Size of the dynamic memory pool used by processes.
+ * $WIZ$ type = "int"
+ * $WIZ$ min = 0
+ */
+#define CONFIG_KERN_HEAP_SIZE 16384L
+
+/**
+ * Module logging level.
+ *
+ * $WIZ$ type = "enum"
+ * $WIZ$ value_list = "log_level"
+ */
+#define KERN_LOG_LEVEL LOG_LVL_ERR
+
+/**
+ * Module logging format.
+ *
+ * $WIZ$ type = "enum"
+ * $WIZ$ value_list = "log_format"
+ */
+#define KERN_LOG_FORMAT LOG_FMT_VERBOSE
+
+#endif /* CFG_PROC_H */
--- /dev/null
+/**
+ * \file
+ * <!--
+ * This file is part of BeRTOS.
+ *
+ * Bertos 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 St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * As a special exception, you may use this file as part of a free software
+ * library without restriction. Specifically, if other files instantiate
+ * templates or use macros or inline functions from this file, or you compile
+ * this file and link it with other files to produce an executable, this
+ * file does not by itself cause the resulting executable to be covered by
+ * the GNU General Public License. This exception does not however
+ * invalidate any other reasons why the executable file might be covered by
+ * the GNU General Public License.
+ *
+ * Copyright 2001, 2004 Develer S.r.l. (http://www.develer.com/)
+ * Copyright 1999, 2000, 2001, 2008 Bernie Innocenti <bernie@codewiz.org>
+ * -->
+ *
+ * \brief Kernel semaphores configuration parameters.
+ *
+ * \author Bernie Innocenti <bernie@codewiz.org>
+ */
+
+#ifndef CFG_SEM_H
+#define CFG_SEM_H
+
+/**
+ * Re-entrant mutual exclusion primitives.
+ * $WIZ$ type = "autoenabled"
+ */
+#define CONFIG_KERN_SEMAPHORES 0
+
+#endif /* CFG_SEM_H */
--- /dev/null
+/**
+ * \file
+ * <!--
+ * This file is part of BeRTOS.
+ *
+ * Bertos 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 St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * As a special exception, you may use this file as part of a free software
+ * library without restriction. Specifically, if other files instantiate
+ * templates or use macros or inline functions from this file, or you compile
+ * this file and link it with other files to produce an executable, this
+ * file does not by itself cause the resulting executable to be covered by
+ * the GNU General Public License. This exception does not however
+ * invalidate any other reasons why the executable file might be covered by
+ * the GNU General Public License.
+ *
+ * Copyright 2008 Develer S.r.l. (http://www.develer.com/)
+ * All Rights Reserved.
+ * -->
+ *
+ * \brief Configuration file for serial module.
+ *
+ * \author Daniele Basile <asterix@develer.com>
+ */
+
+#ifndef CFG_SER_H
+#define CFG_SER_H
+
+/**
+ * Example of setting for serial port and
+ * spi port.
+ * Edit these define for your project.
+ */
+
+/**
+ * Size of the outbound FIFO buffer for port 0 [bytes].
+ * $WIZ$ type = "int"
+ * $WIZ$ min = 2
+ */
+#define CONFIG_UART0_TXBUFSIZE 32
+
+/**
+ * Size of the inbound FIFO buffer for port 0 [bytes].
+ * $WIZ$ type = "int"
+ * $WIZ$ min = 2
+ */
+#define CONFIG_UART0_RXBUFSIZE 32
+
+/**
+ * Size of the outbound FIFO buffer for port 1 [bytes].
+ * $WIZ$ type = "int"
+ * $WIZ$ min = 2
+ * $WIZ$ supports = "lm3s or lpc2 or (at91 and not atmega8 and not atmega168 and not atmega32)"
+ */
+#define CONFIG_UART1_TXBUFSIZE 32
+
+/**
+ * Size of the inbound FIFO buffer for port 1 [bytes].
+ * $WIZ$ type = "int"
+ * $WIZ$ min = 2
+ * $WIZ$ supports = "lm3s or lpc2 or (at91 and not atmega8 and not atmega168 and not atmega32)"
+ */
+#define CONFIG_UART1_RXBUFSIZE 32
+
+/**
+ * Size of the outbound FIFO buffer for port 2 [bytes].
+ * $WIZ$ type = "int"
+ * $WIZ$ min = 2
+ * $WIZ$ supports = "lm3s or lpc2"
+ */
+#define CONFIG_UART2_TXBUFSIZE 32
+
+/**
+ * Size of the inbound FIFO buffer for port 2 [bytes].
+ * $WIZ$ type = "int"
+ * $WIZ$ min = 2
+ * $WIZ$ supports = "lm3s or lpc2"
+ */
+#define CONFIG_UART2_RXBUFSIZE 32
+
+/**
+ * Size of the outbound FIFO buffer for port 3 [bytes].
+ * $WIZ$ type = "int"
+ * $WIZ$ min = 2
+ * $WIZ$ supports = "lpc2"
+ */
+#define CONFIG_UART3_TXBUFSIZE 32
+
+/**
+ * Size of the inbound FIFO buffer for port 3 [bytes].
+ * $WIZ$ type = "int"
+ * $WIZ$ min = 2
+ * $WIZ$ supports = "lpc2"
+ */
+#define CONFIG_UART3_RXBUFSIZE 32
+
+
+/**
+ * Size of the outbound FIFO buffer for SPI port [bytes].
+ * $WIZ$ type = "int"
+ * $WIZ$ min = 2
+ * $WIZ$ supports = "avr"
+ */
+#define CONFIG_SPI_TXBUFSIZE 32
+
+/**
+ * Size of the inbound FIFO buffer for SPI port [bytes].
+ * $WIZ$ type = "int"
+ * $WIZ$ min = 2
+ * $WIZ$ supports = "avr"
+ */
+#define CONFIG_SPI_RXBUFSIZE 32
+
+/**
+ * Size of the outbound FIFO buffer for SPI port 0 [bytes].
+ * $WIZ$ type = "int"
+ * $WIZ$ min = 2
+ * $WIZ$ supports = "at91"
+ */
+#define CONFIG_SPI0_TXBUFSIZE 32
+
+/**
+ * Size of the inbound FIFO buffer for SPI port 0 [bytes].
+ * $WIZ$ type = "int"
+ * $WIZ$ min = 2
+ * $WIZ$ supports = "at91"
+ */
+#define CONFIG_SPI0_RXBUFSIZE 32
+
+/**
+ * Size of the outbound FIFO buffer for SPI port 1 [bytes].
+ * $WIZ$ type = "int"
+ * $WIZ$ min = 2
+ * $WIZ$ supports = "at91"
+ */
+#define CONFIG_SPI1_TXBUFSIZE 32
+
+/**
+ * Size of the inbound FIFO buffer for SPI port 1 [bytes].
+ * $WIZ$ type = "int"
+ * $WIZ$ min = 2
+ * $WIZ$ supports = "at91"
+ */
+#define CONFIG_SPI1_RXBUFSIZE 32
+
+/**
+ * SPI data order.
+ *
+ * $WIZ$ type = "enum"
+ * $WIZ$ value_list = "ser_order_bit"
+ * $WIZ$ supports = "avr"
+ */
+#define CONFIG_SPI_DATA_ORDER SER_MSB_FIRST
+
+/**
+ * SPI clock division factor.
+ * $WIZ$ type = "int"
+ * $WIZ$ supports = "avr"
+ */
+#define CONFIG_SPI_CLOCK_DIV 16
+
+/**
+ * SPI clock polarity: normal low or normal high.
+ * $WIZ$ type = "enum"
+ * $WIZ$ value_list = "ser_spi_pol"
+ * $WIZ$ supports = "avr"
+ */
+#define CONFIG_SPI_CLOCK_POL SPI_NORMAL_LOW
+
+/**
+ * SPI clock phase you can choose sample on first edge or
+ * sample on second clock edge.
+ * $WIZ$ type = "enum"
+ * $WIZ$ value_list = "ser_spi_phase"
+ * $WIZ$ supports = "avr"
+ */
+#define CONFIG_SPI_CLOCK_PHASE SPI_SAMPLE_ON_FIRST_EDGE
+
+/**
+ * Default transmit timeout (ms). Set to -1 to disable timeout support.
+ * $WIZ$ type = "int"
+ * $WIZ$ min = -1
+ */
+#define CONFIG_SER_TXTIMEOUT -1
+
+/**
+ * Default receive timeout (ms). Set to -1 to disable timeout support.
+ * $WIZ$ type = "int"
+ * $WIZ$ min = -1
+ */
+#define CONFIG_SER_RXTIMEOUT -1
+
+/**
+ * Use RTS/CTS handshake.
+ * $WIZ$ type = "boolean"
+ * $WIZ$ supports = "False"
+ */
+#define CONFIG_SER_HWHANDSHAKE 0
+
+/**
+ * Default baudrate for all serial ports (set to 0 to disable).
+ * $WIZ$ type = "int"
+ * $WIZ$ min = 0
+ */
+#define CONFIG_SER_DEFBAUDRATE 0UL
+
+/// Enable strobe pin for debugging serial interrupt. $WIZ$ type = "boolean"
+#define CONFIG_SER_STROBE 0
+
+#endif /* CFG_SER_H */
--- /dev/null
+/**
+ * \file
+ * <!--
+ * This file is part of BeRTOS.
+ *
+ * Bertos 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 St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * As a special exception, you may use this file as part of a free software
+ * library without restriction. Specifically, if other files instantiate
+ * templates or use macros or inline functions from this file, or you compile
+ * this file and link it with other files to produce an executable, this
+ * file does not by itself cause the resulting executable to be covered by
+ * the GNU General Public License. This exception does not however
+ * invalidate any other reasons why the executable file might be covered by
+ * the GNU General Public License.
+ *
+ * Copyright 2001, 2004 Develer S.r.l. (http://www.develer.com/)
+ * Copyright 1999, 2000, 2001, 2008 Bernie Innocenti <bernie@codewiz.org>
+ * -->
+ *
+ * \brief Kernel signals configuration parameters
+ *
+ * \author Bernie Innocenti <bernie@codewiz.org>
+ */
+
+#ifndef CFG_SIGNAL_H
+#define CFG_SIGNAL_H
+
+/**
+ * Inter-process signals.
+ * $WIZ$ type = "autoenabled"
+ */
+#define CONFIG_KERN_SIGNALS 1
+
+#endif /* CFG_SIGNAL_H */
--- /dev/null
+/**
+ * \file
+ * <!--
+ * This file is part of BeRTOS.
+ *
+ * Bertos 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 St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * As a special exception, you may use this file as part of a free software
+ * library without restriction. Specifically, if other files instantiate
+ * templates or use macros or inline functions from this file, or you compile
+ * this file and link it with other files to produce an executable, this
+ * file does not by itself cause the resulting executable to be covered by
+ * the GNU General Public License. This exception does not however
+ * invalidate any other reasons why the executable file might be covered by
+ * the GNU General Public License.
+ *
+ * Copyright 2008 Develer S.r.l. (http://www.develer.com/)
+ * All Rights Reserved.
+ * -->
+ *
+ * \brief Configuration file for timer module.
+ *
+ * \author Daniele Basile <asterix@develer.com>
+ */
+
+#ifndef CFG_TIMER_H
+#define CFG_TIMER_H
+
+/**
+ * Hardware timer selection for drv/timer.c.
+ * $WIZ$ type = "enum"
+ * $WIZ$ value_list = "timer_select"
+ */
+#define CONFIG_TIMER TIMER_DEFAULT
+
+/**
+ * Debug timer interrupt using a strobe pin.
+ * $WIZ$ type = "boolean"
+ */
+#define CONFIG_TIMER_STROBE 0
+
+/**
+ * Enable asynchronous timers.
+ * $WIZ$ type = "boolean"
+ */
+#define CONFIG_TIMER_EVENTS 1
+
+/**
+ * Support hi-res timer_usleep().
+ * $WIZ$ type = "boolean"
+ */
+#define CONFIG_TIMER_UDELAY 1
+
+#endif /* CFG_TIMER_H */
--- /dev/null
+/**
+ * \file
+ * <!--
+ * This file is part of BeRTOS.
+ *
+ * Bertos 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 St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * As a special exception, you may use this file as part of a free software
+ * library without restriction. Specifically, if other files instantiate
+ * templates or use macros or inline functions from this file, or you compile
+ * this file and link it with other files to produce an executable, this
+ * file does not by itself cause the resulting executable to be covered by
+ * the GNU General Public License. This exception does not however
+ * invalidate any other reasons why the executable file might be covered by
+ * the GNU General Public License.
+ *
+ * Copyright 2010 Develer S.r.l. (http://www.develer.com/)
+ *
+ * -->
+ *
+ * \brief LM3S1968 keypad: hardware-specific definitions
+ *
+ * \author Andrea Righi <arighi@develer.com>
+ */
+
+#ifndef HW_KBD_H
+#define HW_KBD_H
+
+#include <cfg/macros.h> /* BV() */
+#include <io/lm3s.h> /* GPIO_PORTG_BASE */
+#include <drv/clock_lm3s.h> /* lm3s_busyWait() */
+#include <drv/gpio_lm3s.h> /* lm3s_gpioPinConfig() / lm3s_gpioPinRead() */
+#include "hw/kbd_map.h"
+
+#define K_RPT_MASK (K_UP | K_DOWN | K_LEFT | K_RIGHT)
+
+#define KBD_HW_INIT \
+ do { \
+ /* Enable the peripheral clock */ \
+ SYSCTL_RCGC2_R |= SYSCTL_RCGC2_GPIOE; \
+ SYSCTL_RCGC2_R |= SYSCTL_RCGC2_GPIOF; \
+ lm3s_busyWait(512); \
+ lm3s_gpioPinConfig(GPIO_PORTE_BASE, \
+ BV(3) | BV(2) | BV(1) | BV(0), \
+ GPIO_DIR_MODE_IN, \
+ GPIO_STRENGTH_2MA, \
+ GPIO_PIN_TYPE_STD_WPU); \
+ lm3s_gpioPinConfig(GPIO_PORTF_BASE, \
+ BV(1), \
+ GPIO_DIR_MODE_IN, \
+ GPIO_STRENGTH_2MA, \
+ GPIO_PIN_TYPE_STD_WPU); \
+ } while (0)
+
+/**
+ * Read the keyboard ports and return the mask of depressed keys.
+ */
+INLINE keymask_t kbd_readkeys(void)
+{
+ return ~(lm3s_gpioPinRead(GPIO_PORTE_BASE,
+ BV(3) | BV(2) | BV(1) | BV(0)) |
+ lm3s_gpioPinRead(GPIO_PORTF_BASE, BV(1)) << 3);
+
+}
+
+#endif /* HW_KBD_H */
--- /dev/null
+/**
+ * \file
+ * <!--
+ * This file is part of BeRTOS.
+ *
+ * Bertos 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 St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * As a special exception, you may use this file as part of a free software
+ * library without restriction. Specifically, if other files instantiate
+ * templates or use macros or inline functions from this file, or you compile
+ * this file and link it with other files to produce an executable, this
+ * file does not by itself cause the resulting executable to be covered by
+ * the GNU General Public License. This exception does not however
+ * invalidate any other reasons why the executable file might be covered by
+ * the GNU General Public License.
+ *
+ * Copyright 2010 Develer S.r.l. (http://www.develer.com/)
+ *
+ * -->
+ *
+ * \brief LM3S1986: OLED-RIT-128x96 (P14201) low-level hardware macros
+ *
+ * \author Andrea Righi <arighi@develer.com>
+ */
+
+#ifndef HW_RIT128x96_H
+#define HW_RIT128x96_H
+
+#include "cfg/macros.h" /* BV() */
+#include "cfg/debug.h"
+
+#include <cpu/attr.h>
+#include <cpu/irq.h>
+#include <cpu/types.h>
+
+#include <drv/clock_lm3s.h>
+#include <drv/ssi_lm3s.h>
+#include <drv/gpio_lm3s.h>
+
+/**
+ * \name LCD I/O pins/ports
+ * @{
+ */
+/* OLED Data/Command control pin */
+#define GPIO_OLEDDC_PIN BV(6)
+
+/* OLED enable pin */
+#define GPIO_OLEDEN_PIN BV(7)
+/*@}*/
+
+/**
+ * \name LCD bus control macros
+ * @{
+ */
+/* Enter command mode */
+#define LCD_SET_COMMAND() \
+ lm3s_gpioPinWrite(GPIO_PORTA_BASE, GPIO_OLEDDC_PIN, 0)
+
+/* Enter data mode */
+#define LCD_SET_DATA() \
+ lm3s_gpioPinWrite(GPIO_PORTA_BASE, GPIO_OLEDDC_PIN, GPIO_OLEDDC_PIN)
+
+/* Send data to the display */
+#define LCD_WRITE(x) \
+ { \
+ uint32_t _x; \
+ while (!lm3s_ssiWriteFrameNonBlocking(SSI0_BASE, x)); \
+ /* Dummy read to drain the FIFO */ \
+ while (!lm3s_ssiReadFrameNonBlocking(SSI0_BASE, &_x)); \
+ }
+/*@}*/
+
+INLINE void lcd_bus_init(void)
+{
+ uint32_t dummy;
+
+ /* Enable the peripheral clock */
+ SYSCTL_RCGC1_R |= SYSCTL_RCGC1_SSI0;
+ SYSCTL_RCGC2_R |= SYSCTL_RCGC2_GPIOA;
+ lm3s_busyWait(512);
+
+ /* Configure the SSI0CLK SSI0FS and SSI0TX pins for SSI operation. */
+ lm3s_gpioPinConfig(GPIO_PORTA_BASE, BV(2) | BV(3) | BV(5),
+ GPIO_DIR_MODE_HW, GPIO_STRENGTH_8MA, GPIO_PIN_TYPE_STD_WPU);
+ /*
+ * Configure the GPIO port pin used as a D/C# signal (data/command
+ * control) for OLED device, and the port pin used to enable power to
+ * the OLED panel.
+ */
+ lm3s_gpioPinConfig(GPIO_PORTA_BASE, GPIO_OLEDDC_PIN | GPIO_OLEDEN_PIN,
+ GPIO_DIR_MODE_OUT, GPIO_STRENGTH_8MA, GPIO_PIN_TYPE_STD);
+ lm3s_gpioPinWrite(GPIO_PORTA_BASE, GPIO_OLEDDC_PIN | GPIO_OLEDEN_PIN,
+ GPIO_OLEDDC_PIN | GPIO_OLEDEN_PIN);
+
+ /* Configure the SSI0 port for master mode */
+ lm3s_ssiOpen(SSI0_BASE, SSI_FRF_MOTO_MODE_2,
+ SSI_MODE_MASTER, CPU_FREQ / 2, 8);
+
+ /* Drain the SSI RX FIFO */
+ while (lm3s_ssiReadFrameNonBlocking(SSI0_BASE, &dummy));
+}
+
+/*
+ * XXX: menu stuff requires lcd_blitBimap() function to be defined.
+ * Find a better way to do this.
+ */
+#define rit128x96_blitBitmap lcd_blitBitmap
+
+#endif /* HW_RIT128x96_H */
--- /dev/null
+/**
+ * \file
+ * <!--
+ * This file is part of BeRTOS.
+ *
+ * Bertos 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 St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * As a special exception, you may use this file as part of a free software
+ * library without restriction. Specifically, if other files instantiate
+ * templates or use macros or inline functions from this file, or you compile
+ * this file and link it with other files to produce an executable, this
+ * file does not by itself cause the resulting executable to be covered by
+ * the GNU General Public License. This exception does not however
+ * invalidate any other reasons why the executable file might be covered by
+ * the GNU General Public License.
+ *
+ * Copyright 2010 Develer S.r.l. (http://www.develer.com/)
+ * -->
+ *
+ * \brief Keyboard map definitions.
+ *
+ * \author Andrea Righi <arighi@develer.com>
+ */
+
+#ifndef HW_KBD_MAP_H
+#define HW_KBD_MAP_H
+
+#include <cfg/macros.h>
+
+/**
+ * Type for keyboard mask.
+ */
+typedef uint16_t keymask_t;
+
+/**
+ * \name Keycodes.
+ */
+/*@{*/
+#define K_UP BV(0)
+#define K_DOWN BV(1)
+#define K_LEFT BV(2)
+#define K_RIGHT BV(3)
+#define K_OK BV(4)
+#define K_CANCEL BV(8)
+
+#define K_REPEAT BV(13) /**< This is a repeated keyevent. */
+#define K_TIMEOUT BV(14) /**< Fake key event for timeouts. */
+#define K_LONG BV(15)
+/*@}*/
+
+#define K_LNG_MASK 0
+
+#endif /* HW_KBD_MAP_H */
--- /dev/null
+/**
+ * \file
+ * <!--
+ * This file is part of BeRTOS.
+ *
+ * Bertos 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 St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * As a special exception, you may use this file as part of a free software
+ * library without restriction. Specifically, if other files instantiate
+ * templates or use macros or inline functions from this file, or you compile
+ * this file and link it with other files to produce an executable, this
+ * file does not by itself cause the resulting executable to be covered by
+ * the GNU General Public License. This exception does not however
+ * invalidate any other reasons why the executable file might be covered by
+ * the GNU General Public License.
+ *
+ * Copyright 2010 Develer S.r.l. (http://www.develer.com/)
+ *
+ * -->
+ *
+ * \brief LM3S8962 Cortex-M3 testcase
+ *
+ * \author Andrea Righi <arighi@develer.com>
+ */
+
+#include <cpu/irq.h>
+#include <drv/timer.h>
+#include <drv/ser.h>
+#include <drv/kbd.h>
+#include <drv/lcd_rit128x96.h>
+#include <gfx/gfx.h>
+#include <gfx/font.h>
+#include <gfx/text.h>
+#include <gui/menu.h>
+#include <icons/logo.h>
+#include <stdio.h>
+
+#include "cfg/compiler.h"
+#include "cfg/cfg_gfx.h"
+
+#include "hw/hw_rit128x96.h"
+
+#define PROC_STACK_SIZE KERN_MINSTACKSIZE * 2
+
+#if CONFIG_KERN_HEAP
+#define hp_stack NULL
+#define lp_stack NULL
+#define ser_stack NULL
+#define led_stack NULL
+#else
+static PROC_DEFINE_STACK(hp_stack, PROC_STACK_SIZE);
+static PROC_DEFINE_STACK(lp_stack, PROC_STACK_SIZE);
+static PROC_DEFINE_STACK(ser_stack, PROC_STACK_SIZE);
+static PROC_DEFINE_STACK(led_stack, PROC_STACK_SIZE);
+#endif
+
+extern Font font_gohu;
+static uint8_t raster[RAST_SIZE(LCD_WIDTH, LCD_HEIGHT)];
+static Bitmap lcd_bitmap;
+
+#define KEY_MASK (K_UP | K_DOWN | K_LEFT | K_RIGHT | K_OK)
+
+static Process *hp_proc, *lp_proc, *led_proc;
+static hptime_t start, end;
+
+static Serial ser_port;
+
+static void led_init(void)
+{
+ /* Enable the GPIO port that is used for the on-board LED */
+ SYSCTL_RCGC2_R |= SYSCTL_RCGC2_GPIOF;
+ /*
+ * Perform a dummy read to insert a few cycles delay before enabling
+ * the peripheral.
+ */
+ (void)SYSCTL_RCGC2_R;
+ /* Enable the GPIO pin for the LED */
+ GPIO_PORTF_DIR_R = 0x01;
+ GPIO_PORTF_DEN_R = 0x01;
+}
+
+INLINE void led_on(void)
+{
+ GPIO_PORTF_DATA_R |= 0x01;
+}
+
+INLINE void led_off(void)
+{
+ GPIO_PORTF_DATA_R &= ~0x01;
+}
+
+static bool led_blinking;
+
+static void NORETURN led_process(void)
+{
+ int i;
+
+ for (i = 0; ; i++)
+ {
+ if (!led_blinking)
+ {
+ led_off();
+ sig_wait(SIG_USER0);
+ }
+ if (i & 1)
+ led_on();
+ else
+ led_off();
+ timer_delay(50);
+ }
+}
+
+static void led_test(UNUSED_ARG(Bitmap *, bm))
+{
+ led_blinking = !led_blinking;
+ sig_send(led_proc, SIG_USER0);
+}
+
+static void bouncing_logo(Bitmap *bm)
+{
+ const long SPEED_SCALE = 1000;
+ const long GRAVITY_ACCEL = 100;
+ const long BOUNCE_ELASTICITY = 1;
+ long h = (long)(-bertos_logo.height) * SPEED_SCALE;
+ long speed = 0, i;
+
+ for (i = 0; ; i++)
+ {
+ /* Move */
+ h += speed;
+
+ /* Gravity acceleration */
+ speed += GRAVITY_ACCEL;
+
+ if (h > 0 && speed > 0)
+ {
+ /* Bounce */
+ speed = -(speed / BOUNCE_ELASTICITY);
+
+ }
+ /* Update graphics */
+ gfx_bitmapClear(bm);
+ gfx_blitImage(bm,
+ (LCD_WIDTH - bertos_logo.width) / 2,
+ (LCD_HEIGHT - bertos_logo.height) / 2 + h / SPEED_SCALE,
+ &bertos_logo);
+ text_xprintf(bm, 7, 0, TEXT_FILL | TEXT_CENTER, "Press SELECT to quit");
+ rit128x96_blitBitmap(bm);
+ timer_delay(5);
+ if (kbd_peek() & KEY_MASK)
+ break;
+ }
+}
+
+static void screen_saver(Bitmap *bm)
+{
+ int x1, y1, x2, y2;
+ int i;
+
+ for (i = 0; ; i++)
+ {
+ x1 = i % LCD_WIDTH;
+ y1 = i % LCD_HEIGHT;
+
+ x2 = LCD_WIDTH - i % LCD_WIDTH;
+ y2 = LCD_HEIGHT - i % LCD_HEIGHT;
+
+ gfx_bitmapClear(bm);
+ gfx_rectDraw(bm, x1, y1, x2, y2);
+ rit128x96_blitBitmap(bm);
+ if (kbd_peek() & KEY_MASK)
+ break;
+ }
+}
+
+INLINE hptime_t get_hp_ticks(void)
+{
+ return (TIMER_HW_CNT - timer_hw_hpread()) +
+ timer_clock_unlocked() * TIMER_HW_CNT;
+}
+
+static void NORETURN hp_process(void)
+{
+ while (1)
+ {
+ sig_wait(SIG_USER0);
+ end = get_hp_ticks();
+ timer_delay(100);
+ sig_send(lp_proc, SIG_USER0);
+ }
+}
+
+static void NORETURN lp_process(void)
+{
+ while (1)
+ {
+ start = get_hp_ticks();
+ sig_send(hp_proc, SIG_USER0);
+ sig_wait(SIG_USER0);
+ }
+}
+
+static void res_process(void)
+{
+ const char spinner[] = {'/', '-', '\\', '|'};
+ int i;
+ char c;
+
+ for (i = 0; ; i++)
+ {
+ /* Show context switch (in clock cycles) */
+ c = spinner[i % countof(spinner)];
+ text_xprintf(&lcd_bitmap, 3, 0, TEXT_CENTER | TEXT_FILL, "%c Context switch %c", c, c);
+ text_xprintf(&lcd_bitmap, 5, 0, TEXT_FILL, " %lu clock cycles", end - start);
+ /* Show context switch (in usec) */
+ text_xprintf(&lcd_bitmap, 6, 0, TEXT_FILL,
+ " %lu.%lu usec",
+ ((end - start) * 1000000) / CPU_FREQ,
+ ((end - start) * (100000000 / CPU_FREQ)) % 100);
+ rit128x96_blitBitmap(&lcd_bitmap);
+ timer_delay(5);
+ if (kbd_peek() & KEY_MASK)
+ break;
+ }
+}
+
+static void context_switch_test(Bitmap *bm)
+{
+ gfx_bitmapClear(bm);
+ text_xprintf(bm, 0, 0, TEXT_FILL,
+ "CPU: Cortex-M3 %luMHz", CPU_FREQ / 1000000);
+ rit128x96_blitBitmap(bm);
+ text_xprintf(bm, 1, 0, TEXT_FILL, "Board: LM3S8962 EVB");
+ rit128x96_blitBitmap(bm);
+
+ res_process();
+}
+
+static void uptime(Bitmap *bm)
+{
+ extern const Font font_luBS14;
+ const Font *old_font;
+
+ old_font = bm->font;
+
+ /* Set big font */
+ gfx_bitmapClear(bm);
+ gfx_setFont(bm, &font_luBS14);
+ text_xprintf(bm, 0, 0, TEXT_FILL | TEXT_CENTER, "Uptime");
+ while (1)
+ {
+ ticks_t clock = ticks_to_ms(timer_clock_unlocked());
+
+ /* Display uptime (in ticks) */
+ text_xprintf(&lcd_bitmap, 2, 0, TEXT_FILL | TEXT_CENTER,
+ "%lu", clock / 1000);
+ rit128x96_blitBitmap(bm);
+ timer_delay(5);
+ if (kbd_peek() & KEY_MASK)
+ break;
+ }
+ gfx_setFont(bm, old_font);
+}
+
+static void NORETURN soft_reset(Bitmap * bm)
+{
+ extern const Font font_luBS14;
+ int i;
+
+ /* Set big font */
+ gfx_bitmapClear(bm);
+ gfx_setFont(bm, &font_luBS14);
+ for (i = 5; i; --i)
+ {
+ text_xprintf(bm, 2, 0, TEXT_FILL | TEXT_CENTER, "%d", i);
+ rit128x96_blitBitmap(bm);
+ timer_delay(1000);
+ }
+ text_xprintf(bm, 2, 0, TEXT_FILL | TEXT_CENTER, "REBOOT");
+ rit128x96_blitBitmap(bm);
+ timer_delay(1000);
+
+ /* Perform a software reset request */
+ HWREG(NVIC_APINT) = NVIC_APINT_VECTKEY | NVIC_APINT_SYSRESETREQ;
+ UNREACHABLE();
+}
+
+static void NORETURN ser_process(void)
+{
+ char buf[32];
+ int i;
+
+ ser_init(&ser_port, SER_UART0);
+ ser_setbaudrate(&ser_port, 115200);
+
+ /* BeRTOS terminal */
+ for (i = 0; ; i++)
+ {
+ kfile_printf(&ser_port.fd, "\n\r[%03d] BeRTOS:~$ ", i);
+ kfile_gets_echo(&ser_port.fd, buf, sizeof(buf), true);
+ kfile_printf(&ser_port.fd, "%s", buf);
+ }
+}
+
+static struct MenuItem main_items[] =
+{
+ { (const_iptr_t)"LED blinking", 0, (MenuHook)led_test, (iptr_t)&lcd_bitmap },
+ { (const_iptr_t)"Bouncing logo", 0, (MenuHook)bouncing_logo, (iptr_t)&lcd_bitmap },
+ { (const_iptr_t)"Screen saver demo", 0, (MenuHook)screen_saver, (iptr_t)&lcd_bitmap },
+ { (const_iptr_t)"Scheduling test", 0, (MenuHook)context_switch_test, (iptr_t)&lcd_bitmap },
+ { (const_iptr_t)"Show uptime", 0, (MenuHook)uptime, (iptr_t)&lcd_bitmap },
+ { (const_iptr_t)"Reboot", 0, (MenuHook)soft_reset, (iptr_t)&lcd_bitmap },
+ { (const_iptr_t)0, 0, NULL, (iptr_t)0 }
+};
+static struct Menu main_menu = { main_items, "BeRTOS", MF_STICKY | MF_SAVESEL, &lcd_bitmap, 0 };
+
+int main(void)
+{
+ IRQ_ENABLE;
+ kdbg_init();
+
+ kputs("Init LED..");
+ led_init();
+ kputs("Done.\n");
+ kputs("Init Timer..");
+ timer_init();
+ kputs("Done.\n");
+ kputs("Init Process..");
+ proc_init();
+ kputs("Done.\n");
+
+ kputs("Init OLED display..");
+ rit128x96_init();
+ gfx_bitmapInit(&lcd_bitmap, raster, LCD_WIDTH, LCD_HEIGHT);
+ gfx_setFont(&lcd_bitmap, &font_gohu);
+ rit128x96_blitBitmap(&lcd_bitmap);
+ kputs("Done.\n");
+ kputs("Init Keypad..");
+ kbd_init();
+ kputs("Done.\n");
+ hp_proc = proc_new(hp_process, NULL, PROC_STACK_SIZE, hp_stack);
+ lp_proc = proc_new(lp_process, NULL, PROC_STACK_SIZE, lp_stack);
+ led_proc = proc_new(led_process, NULL, PROC_STACK_SIZE, led_stack);
+ /* Open a dummy echo terminal on UART0 */
+ proc_new(ser_process, NULL, PROC_STACK_SIZE, ser_stack);
+
+ proc_setPri(hp_proc, 2);
+ proc_setPri(lp_proc, 1);
+ while (1)
+ {
+ menu_handle(&main_menu);
+ cpu_relax();
+ }
+}
--- /dev/null
+# Copyright 2010 Develer S.r.l. (http://www.develer.com/)
+# All rights reserved.
+#
+# Author: Andrea Righi <arighi@develer.com>
+#
+
+# Set to 1 for debug builds
+lm3s8962_DEBUG = 0
+
+include bertos/fonts/fonts.mk
+
+# Our target application
+TRG += lm3s8962
+
+lm3s8962_CSRC = \
+ examples/lm3s8962/lm3s8962.c \
+ bertos/gfx/bitmap.c \
+ bertos/gfx/line.c \
+ bertos/gfx/win.c \
+ bertos/gfx/text.c \
+ bertos/gfx/text_format.c \
+ bertos/gui/menu.c \
+ bertos/fonts/gohu.c \
+ bertos/fonts/luBS14.c \
+ bertos/icons/logo.c \
+ bertos/mware/formatwr.c \
+ bertos/mware/hex.c \
+ bertos/mware/sprintf.c \
+ bertos/mware/event.c \
+ bertos/struct/heap.c \
+ bertos/drv/timer.c \
+ bertos/drv/ser.c \
+ bertos/drv/kbd.c \
+ bertos/drv/lcd_rit128x96.c \
+ bertos/kern/kfile.c \
+ bertos/kern/monitor.c \
+ bertos/kern/proc_test.c \
+ bertos/kern/proc.c \
+ bertos/kern/signal.c \
+ bertos/cpu/cortex-m3/drv/gpio_lm3s.c \
+ bertos/cpu/cortex-m3/drv/clock_lm3s.c \
+ bertos/cpu/cortex-m3/drv/ser_lm3s.c \
+ bertos/cpu/cortex-m3/drv/kdebug_lm3s.c \
+ bertos/cpu/cortex-m3/drv/ssi_lm3s.c \
+ bertos/cpu/cortex-m3/drv/timer_cm3.c \
+ bertos/cpu/cortex-m3/drv/irq_cm3.c \
+ bertos/cpu/cortex-m3/hw/switch_ctx_cm3.c \
+ bertos/cpu/cortex-m3/hw/init_lm3s.c
+
+lm3s8962_CPPASRC = \
+ bertos/cpu/cortex-m3/hw/vectors_cm3.S \
+ bertos/cpu/cortex-m3/hw/crt_cm3.S \
+ #
+
+# This is an hosted application
+lm3s8962_PREFIX = arm-none-eabi-
+
+lm3s8962_CPPAFLAGS = -mthumb -mno-thumb-interwork
+lm3s8962_CPPFLAGS = -D'ARCH=0' -D__ARM_LM3S8962__ -D'CPU_FREQ=(50000000L)' -D'WIZ_AUTOGEN' -mthumb -mno-thumb-interwork -Iexamples/lm3s8962 -Ibertos/cpu/cortex-m3 -fno-strict-aliasing -fwrapv
+lm3s8962_LDFLAGS = -nostartfiles -T bertos/cpu/cortex-m3/scripts/lm3s1968_rom.ld -Wl,--no-warn-mismatch -mthumb -mno-thumb-interwork
+
+lm3s8962_CPU = cortex-m3
+
+lm3s8962_PROGRAMMER_CPU = lm3s1968
+lm3s8962_PROGRAMMER_TYPE = lm3s1968
+lm3s8962_FLASH_SCRIPT = bertos/prg_scripts/arm/flash-cortex.sh
+lm3s8962_STOPFLASH_SCRIPT = bertos/prg_scripts/arm/stopopenocd.sh
+lm3s8962_DEBUG_SCRIPT = bertos/prg_scripts/arm/debug-cortex.sh
+lm3s8962_STOPDEBUG_SCRIPT = bertos/prg_scripts/arm/stopopenocd.sh
+
+ifeq ($(lm3s8962_DEBUG),0)
+ # Production options
+ lm3s8962_CFLAGS += -O2 -fomit-frame-pointer
+ lm3s8962_CXXFLAGS += -O2 -fomit-frame-pointer
+else
+ # Debug options
+ lm3s8962_CPPAFLAGS += -g -gdwarf-2
+ lm3s8962_CPPFLAGS += -O0 -g3 -gdwarf-2 -fverbose-asm
+endif