فهرست منبع

Added header files

Janco Kock 9 سال پیش
والد
کامیت
7f167a8139
19فایلهای تغییر یافته به همراه1958 افزوده شده و 0 حذف شده
  1. 63 0
      display.h
  2. 119 0
      fat.h
  3. 153 0
      fatdrv.h
  4. 68 0
      flash.h
  5. 112 0
      keyboard.h
  6. 49 0
      led.h
  7. 131 0
      log.h
  8. 41 0
      mmc.h
  9. 100 0
      mmcdrv.h
  10. 51 0
      platform.h
  11. 142 0
      portio.h
  12. 52 0
      remcon.h
  13. 158 0
      rtc.h
  14. 53 0
      spidrv.h
  15. 144 0
      system.h
  16. 183 0
      typedefs.h
  17. 60 0
      uart0driver.h
  18. 164 0
      vs10xx.h
  19. 115 0
      watchdog.h

+ 63 - 0
display.h

@@ -0,0 +1,63 @@
+/* ========================================================================
+ * [PROJECT]    SIR100
+ * [MODULE]     Display
+ * [TITLE]      display header file
+ * [FILE]       display.h
+ * [VSN]        1.0
+ * [CREATED]    030414
+ * [LASTCHNGD]  030414
+ * [COPYRIGHT]  Copyright (C) STREAMIT BV 2010
+ * [PURPOSE]    API and gobal defines for display module
+ * ======================================================================== */
+
+#ifndef _Display_H
+#define _Display_H
+
+
+/*-------------------------------------------------------------------------*/
+/* global defines                                                          */
+/*-------------------------------------------------------------------------*/
+#define DISPLAY_SIZE                16
+#define NROF_LINES                  2
+#define MAX_SCREEN_CHARS            (NROF_LINES*DISPLAY_SIZE)
+
+#define LINE_0                      0
+#define LINE_1                      1
+
+#define FIRSTPOS_LINE_0             0
+#define FIRSTPOS_LINE_1             0x40
+
+
+#define LCD_BACKLIGHT_ON            1
+#define LCD_BACKLIGHT_OFF           0
+
+#define ALL_ZERO          			0x00      // 0000 0000 B
+#define WRITE_COMMAND     			0x02      // 0000 0010 B
+#define WRITE_DATA        			0x03      // 0000 0011 B
+#define READ_COMMAND      			0x04      // 0000 0100 B
+#define READ_DATA         			0x06      // 0000 0110 B
+
+
+/*-------------------------------------------------------------------------*/
+/* typedefs & structs                                                      */
+/*-------------------------------------------------------------------------*/
+
+/*--------------------------------------------------------------------------*/
+/*  Global variables                                                        */
+/*--------------------------------------------------------------------------*/
+
+/*-------------------------------------------------------------------------*/
+/* export global routines (interface)                                      */
+/*-------------------------------------------------------------------------*/
+extern void LcdChar(char);
+extern void LcdBackLight(u_char);
+extern void LcdInit(void);
+extern void LcdLowLevelInit(void);
+
+#endif /* _Display_H */
+/*  ÍÍÍÍ  End Of File  ÍÍÍÍÍÍÍÍ ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ */
+
+
+
+
+

+ 119 - 0
fat.h

@@ -0,0 +1,119 @@
+/****************************************************************************
+*  This file is part of the AVRIDE device driver.
+*
+*  Copyright (c) 2002-2004 by Michael Fischer. All rights reserved.
+*
+*  Redistribution and use in source and binary forms, with or without 
+*  modification, are permitted provided that the following conditions 
+*  are met:
+*  
+*  1. Redistributions of source code must retain the above copyright 
+*     notice, this list of conditions and the following disclaimer.
+*  2. Redistributions in binary form must reproduce the above copyright
+*     notice, this list of conditions and the following disclaimer in the 
+*     documentation and/or other materials provided with the distribution.
+*  3. Neither the name of the author nor the names of its contributors may 
+*     be used to endorse or promote products derived from this software 
+*     without specific prior written permission.
+*
+*  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+*  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+*  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+*  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 
+*  THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 
+*  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 
+*  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 
+*  OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 
+*  AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 
+*  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF 
+*  THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 
+*  SUCH DAMAGE.
+*
+****************************************************************************
+*  History:
+*
+*  14.12.02  mifi   First Version 
+*  18.01.03  mifi   Change Licence from GPL to BSD
+*  25.01.03  mifi   Change FAT32Init 
+*                   New function FAT32MountDrive and FAT32UnMountDrive
+*                   Remove FAT32_MAX_FILES, a file handle will be 
+*                   allocated by NutHeapAlloc, therefore we have no
+*                   restrictions about the count of the open file handle.
+*                   (Only by available memory)
+*  27.01.03  mifi   Rename all FAT32xxx function to FATxxx.
+*
+*  28.01.03  mifi   Start porting to Nut/OS 3.X.X
+*  29.06.03  mifi   First ATAPI-Version
+*  24.07.04  mifi   Some changes to support more than one drive (datanut)
+*  25.07.04  mifi   Add support for the PCMCIA_11 hardware.
+*  27.07.04  mifi   Add support for IOCTL function
+****************************************************************************/
+#ifndef __FAT_H__
+#define __FAT_H__
+
+#include <sys/device.h>
+#include "fatdrv.h"
+
+/*-------------------------------------------------------------------------*/
+/* global defines                                                          */
+/*-------------------------------------------------------------------------*/
+
+/*
+ * Device mode
+ */
+#define FAT_MODE_IDE_HD           0x0000
+#define FAT_MODE_IDE_CF           0x0001
+#define FAT_MODE_MEM_CF           0x0002
+#define FAT_MODE_DATANUT_CF       0x0003
+#define FAT_MODE_DATANUT_IDECF    0x0004
+#define FAT_MODE_DATANUT_IDEWLAN  0x0005
+#define FAT_MODE_USB              0x0006
+#define FAT_MODE_MMC              0x0007
+
+
+/*
+ * If the function should be 
+ * supported, set it to 1
+ */
+#define FAT_SUPPORT_FORMAT        1
+
+/*
+ * IOCTL-Function
+ */
+#define FAT_IOCTL_QUICK_FORMAT    0x1000
+
+/*-------------------------------------------------------------------------*/
+/* global types                                                            */
+/*-------------------------------------------------------------------------*/
+
+/*-------------------------------------------------------------------------*/
+/* global macros                                                           */
+/*-------------------------------------------------------------------------*/
+#define FAT_IOCTL(_a,_b,_c)   ((NUTDEVICE *)_a)->dev_ioctl((_a), (_b), (_c))
+
+#define FATQuickFormat(_a)    FAT_IOCTL(_a, FAT_IOCTL_QUICK_FORMAT, NULL)
+ 
+
+/*-------------------------------------------------------------------------*/
+/* Prototypes                                                              */
+/*-------------------------------------------------------------------------*/
+extern NUTDEVICE devFAT;
+
+#if (FAT_USE_IDE_INTERFACE >= 1)
+extern NUTDEVICE devFATCF;
+extern NUTDEVICE devFATIDE0;
+extern NUTDEVICE devFATIDE1;
+#endif
+
+#if (FAT_USE_USB_INTERFACE >= 1)
+extern NUTDEVICE devFATUSB0;
+#endif
+
+#if (FAT_USE_MMC_INTERFACE >= 1)
+extern NUTDEVICE devFATMMC0;
+extern void FATRelease(void);
+
+#endif
+
+
+#endif                          /* !__FAT_H__ */

+ 153 - 0
fatdrv.h

@@ -0,0 +1,153 @@
+/****************************************************************************
+*  This file is part of the FAT device driver.
+*
+*  Copyright (c) 2002-2004 by Michael Fischer. All rights reserved.
+*
+*  Redistribution and use in source and binary forms, with or without 
+*  modification, are permitted provided that the following conditions 
+*  are met:
+*  
+*  1. Redistributions of source code must retain the above copyright 
+*     notice, this list of conditions and the following disclaimer.
+*  2. Redistributions in binary form must reproduce the above copyright
+*     notice, this list of conditions and the following disclaimer in the 
+*     documentation and/or other materials provided with the distribution.
+*  3. Neither the name of the author nor the names of its contributors may 
+*     be used to endorse or promote products derived from this software 
+*     without specific prior written permission.
+*
+*  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+*  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+*  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+*  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 
+*  THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 
+*  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 
+*  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 
+*  OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 
+*  AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 
+*  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF 
+*  THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 
+*  SUCH DAMAGE.
+*
+****************************************************************************
+*  History:
+*
+*  03.08.04  mifi   First Version
+****************************************************************************/
+#ifndef __FATDRV_H__
+#define __FATDRV_H__
+
+#include "typedefs.h"
+
+/*-------------------------------------------------------------------------*/
+/* global defines                                                          */
+/*-------------------------------------------------------------------------*/
+
+/*
+ * Define the hardware here
+ */
+#define FAT_USE_IDE_INTERFACE     0 
+#define FAT_USE_USB_INTERFACE     0
+#define FAT_USE_MMC_INTERFACE     1 
+
+
+#if (FAT_USE_IDE_INTERFACE >= 1)
+#include "ide.h"
+
+#define HW_SUPPORT_WRITE  IDE_SUPPORT_WRITE
+#define HW_SUPPORT_ATAPI  IDE_SUPPORT_ATAPI
+
+#define HW_OK             IDE_OK
+#define HW_ERROR          IDE_ERROR
+
+#define HW_DRIVE_C        IDE_DRIVE_C
+#define HW_DRIVE_D        IDE_DRIVE_D
+#define HW_DRIVE_E        IDE_DRIVE_E
+
+#define HW_SECTOR_SIZE    IDE_SECTOR_SIZE
+#endif /* (FAT_USE_IDE_INTERFACE >= 1) */ 
+
+
+#if (FAT_USE_USB_INTERFACE >= 1)
+#include "usbdrv.h"
+
+#define HW_SUPPORT_WRITE  USB_SUPPORT_WRITE
+#define HW_SUPPORT_ATAPI  USB_SUPPORT_ATAPI
+
+#define HW_OK             USB_OK
+#define HW_ERROR          USB_ERROR
+
+#define HW_DRIVE_C        USB_DRIVE_C
+#define HW_DRIVE_D        USB_DRIVE_D
+#define HW_DRIVE_E        USB_DRIVE_E
+
+#define HW_SECTOR_SIZE    USB_SECTOR_SIZE
+
+#endif /* (FAT_USE_USB_INTERFACE >= 1) */
+
+
+#if (FAT_USE_MMC_INTERFACE >= 1)
+#include "mmcdrv.h"
+
+#define HW_SUPPORT_WRITE  MMC_SUPPORT_WRITE
+#define HW_SUPPORT_ATAPI  MMC_SUPPORT_ATAPI
+
+#define HW_OK             MMC_OK
+#define HW_ERROR          MMC_ERROR
+
+#define HW_DRIVE_C        MMC_DRIVE_C
+#define HW_DRIVE_D        MMC_DRIVE_C
+#define HW_DRIVE_E        MMC_DRIVE_C
+
+#define HW_SECTOR_SIZE    MMC_SECTOR_SIZE
+
+#endif /* (FAT_USE_MMC_INTERFACE >= 1) */
+
+/*-------------------------------------------------------------------------*/
+/* global types                                                            */
+/*-------------------------------------------------------------------------*/
+
+/*-------------------------------------------------------------------------*/
+/* global macros                                                           */
+/*-------------------------------------------------------------------------*/
+
+/*-------------------------------------------------------------------------*/
+/* Prototypes                                                              */
+/*-------------------------------------------------------------------------*/
+#if (FAT_USE_IDE_INTERFACE >= 1)
+#define HWInit              IDEInit
+#define HWMountAllDevices   IDEMountAllDevices
+#define HWGetSectorSize     IDEGetSectorSize
+#define HWIsCDROMDevice     IDEIsCDROMDevice
+#define HWIsZIPDevice       IDEIsZIPDevice
+#define HWUnMountDevice     IDEUnMountDevice
+#define HWGetTotalSectors   IDEGetTotalSectors
+#define HWReadSectors       IDEReadSectors  
+#define HWWriteSectors      IDEWriteSectors
+#endif /* (FAT_USE_IDE_INTERFACE >= 1) */ 
+
+#if (FAT_USE_USB_INTERFACE >= 1)
+#define HWInit              USBInit
+#define HWMountAllDevices   USBMountAllDevices
+#define HWGetSectorSize     USBGetSectorSize
+#define HWIsCDROMDevice     USBIsCDROMDevice
+#define HWIsZIPDevice       USBIsZIPDevice
+#define HWUnMountDevice     USBUnMountDevice
+#define HWGetTotalSectors   USBGetTotalSectors
+#define HWReadSectors       USBReadSectors  
+#define HWWriteSectors      USBWriteSectors
+#endif /* (FAT_USE_USB_INTERFACE == 1) */
+
+#if (FAT_USE_MMC_INTERFACE >= 1)
+#define HWInit              MMCInit
+#define HWMountAllDevices   MMCMountAllDevices
+#define HWGetSectorSize     MMCGetSectorSize
+#define HWIsCDROMDevice     MMCIsCDROMDevice
+#define HWIsZIPDevice       MMCIsZIPDevice
+#define HWUnMountDevice     MMCUnMountDevice
+#define HWGetTotalSectors   MMCGetTotalSectors
+#define HWReadSectors       MMCReadSectors  
+#define HWWriteSectors      MMCWriteSectors
+#endif /* (FAT_USE_MMC_INTERFACE == 1) */
+
+#endif /* !__FATDRV_H__ */

+ 68 - 0
flash.h

@@ -0,0 +1,68 @@
+/* ========================================================================
+ * [PROJECT]    SIR
+ * [MODULE]     Flash
+ * [TITLE]      Routines for Atmel AT45 serial dataflash memory chips.
+ * [FILE]       flash.c
+ * [VSN]        1.0
+ * [CREATED]    11042007
+ * [LASTCHNGD]  11042007
+ * [COPYRIGHT]  Copyright (C) STREAMIT BV 2010
+ * [PURPOSE]    contains all interface- and low-level routines to
+ *              read/write/delete blocks in the serial DataFlash (AT45DBXX)
+ * ======================================================================== */
+#ifndef _Flash_H
+#define _Flash_H
+
+
+#include <sys/types.h>
+
+/*-------------------------------------------------------------------------*/
+/* global defines                                                          */
+/*-------------------------------------------------------------------------*/
+
+/*
+ *  next defines have a 1-1 relationship to the index in the 'at45_devt'
+ *  array, so do not change the values
+ */
+#define AT45DB011B  0
+#define AT45DB021B  1
+#define AT45DB041B  2
+#define AT45DB081B  3
+#define AT45DB0161B 4
+#define AT45DB0321B 5
+#define AT45DB0642  6
+
+/*-------------------------------------------------------------------------*/
+/* typedefs & structs                                                      */
+/*-------------------------------------------------------------------------*/
+
+/*-------------------------------------------------------------------------*/
+/*  Global variables                                                       */
+/*-------------------------------------------------------------------------*/
+
+/*-------------------------------------------------------------------------*/
+/* export global routines (interface)                                      */
+/*-------------------------------------------------------------------------*/
+
+extern int At45dbSendCmd(u_char op, u_long parm, int len, CONST void *tdata, void *rdata, int datalen);
+extern u_char At45dbGetStatus(void);
+extern int At45dbWaitReady(u_long tmo, int poll);
+extern int At45dbInit(void);
+extern int At45dbPageErase(u_int off);
+extern int At45dbChipErase(void);
+extern int At45dbPageRead(u_long pgn, void *data, u_int len);
+extern int At45dbPageWrite(u_long pgn, CONST void *data, u_int len);
+
+#ifdef USE_FLASH_PARAM_PAGE
+extern int At45dbParamRead(u_int pos, void *data, u_int len);
+extern int At45dbParamWrite(u_int pos, CONST void *data, u_int len);
+#endif // USE_FLASH_PARAM_PAGE
+
+#endif /* _Flash_H */
+/*  ÍÍÍÍ  End Of File  ÍÍÍÍÍÍÍÍ ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ */
+
+
+
+
+
+

+ 112 - 0
keyboard.h

@@ -0,0 +1,112 @@
+/* ========================================================================
+ * [PROJECT]    SIR
+ * [MODULE]     Keyboard module
+ * [TITLE]      keyboard module source file
+ * [FILE]       keyboard.h
+ * [VSN]        1.0
+ * [CREATED]    28 july 2003
+ * [LASTCHNGD]  18 august 2003
+ * [COPYRIGHT]  Copyright (C) STREAMIT BV 2010
+ * [PURPOSE]    Keyboard routines
+ * ======================================================================== */
+
+/*-------------------------------------------------------------------------*/
+/* global defines                                                          */
+/*-------------------------------------------------------------------------*/
+#define KB_COL_0       3
+#define KB_COL_1       4
+#define KB_COL_2       3
+#define KB_COL_3       2
+
+#define KB_ROW_0       0
+#define KB_ROW_1       1
+#define KB_ROW_2       2
+#define KB_ROW_3       3
+
+#define KB_ROW_MASK    0xF0
+
+#define KB_OK          0x00
+#define KB_ERROR       0x01
+
+/* state machine defines -------------------------------------------------- */
+#define KB_IDLE        0x00
+#define KB_KEY         0x01
+#define KB_VALID       0x02
+#define KB_RELEASE     0x03
+
+#define KB_COUNTER_OK  0x03    // # a key must be seen before declared 'valid'
+#define KB_LONG_HOLD_TIME 500  // 500 x 4.4 msec = 2200 msec
+#define KB_BUFFER_SIZE 1
+
+
+/*
+ *  below are the keys after they where remapped to 8-bit values
+ *  These definitions are used by the application
+ */
+
+#define KEY_SPEC       0
+#define KEY_01         1
+#define KEY_02         2
+#define KEY_03         3
+#define KEY_04         4
+#define KEY_05         5
+#define KEY_ALT        6
+
+#define KEY_ESC        7
+#define KEY_UP         8
+#define KEY_OK         9
+#define KEY_LEFT       10
+#define KEY_DOWN       11
+#define KEY_RIGHT      12
+
+#define KEY_POWER      13
+#define KEY_SETUP      14
+#define KEY_LCD        15       // virtual key, generated when '1' is pressed and hold for > 2 secs
+
+#define KEY_07         18       // only on RC and only used for selftest
+
+#define KEY_NROF_KEYS  16
+
+// next 2 'keys' are simulated when inserting or removing a MMC
+#define KEY_MMC_IN     16
+#define KEY_MMC_OUT    17
+
+
+// remove these, not available on SIR100
+#define KEY_00         0xFC
+
+#define IS_IR_KEY(key)  (((key>=KEY_01) && (key<=KEY_09)) || (key==KEY_00))
+
+/* definition of virtual special keys ------------------------------------- */
+#define KEY_UNDEFINED  0x88
+#define KEY_TIMEOUT    0xAA
+#define KEY_NO_KEY     0xFFFF   // yes, indeed no u_char....
+
+#define KEY_REPEAT_TIME     100 // 100 * 4.48 = about half a second
+#define KEY_REPEAT          1
+#define KEY_NO_REPEAT       2
+
+/*-------------------------------------------------------------------------*/
+/* export global routines (interface)                                      */
+/*-------------------------------------------------------------------------*/
+void    KbInit(void);
+void    KbScan(void);
+int     KbWaitForKeyEvent(u_long);
+u_char  KbGetKey(void);
+void    KbSetKeyRepeating(u_char, u_char);
+void    KbInjectKey(u_char VirtualKey);
+
+/*  ÍÍÍÍ  End Of File  ÍÍÍÍÍÍÍÍ ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ */
+
+
+
+
+
+
+
+
+
+
+
+
+

+ 49 - 0
led.h

@@ -0,0 +1,49 @@
+/* ========================================================================
+ * [PROJECT]    SIR
+ * [MODULE]     LED
+ * [TITLE]      LED control header file
+ * [FILE]       led.h
+ * [VSN]        1.0
+ * [CREATED]    1 augustus 2003
+ * [LASTCHNGD]  23 augustus 2003
+ * [COPYRIGHT]  Copyright (C) STREAMIT BV 2010
+ * [PURPOSE]    LED control routines for SIR
+ * ======================================================================== */
+
+/*-------------------------------------------------------------------------*/
+/* global defines                                                          */
+/*-------------------------------------------------------------------------*/
+
+#define LED_OFF         0
+#define LED_ON          1
+#define LED_POWER_ON    2
+#define LED_POWER_OFF   3
+#define LED_TOGGLE      4
+#define LED_FLASH_ON    5
+#define LED_FLASH_OFF   6
+
+/*-------------------------------------------------------------------------*/
+/* typedefs & structs                                                      */
+/*-------------------------------------------------------------------------*/
+
+/*-------------------------------------------------------------------------*/
+/* export global routines (interface)                                      */
+/*-------------------------------------------------------------------------*/
+void LedInit(void);
+void LedControl(u_char);
+u_char LedGetStatus(void);
+
+/*  ÍÍÍÍ  End Of File  ÍÍÍÍÍÍÍÍ ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ */
+
+
+
+
+
+
+
+
+
+
+
+
+

+ 131 - 0
log.h

@@ -0,0 +1,131 @@
+#ifndef _Log_H
+#define _Log_H
+/*
+ *  Copyright STREAMIT BV, 2010.
+ *
+ *  Project             : SIR
+ *  Module              : Log
+ *  File name  $Workfile: Log.h  $
+ *       Last Save $Date: 2003/08/16 15:01:36  $
+ *             $Revision: 0.1  $
+ *  Creation Date       : 2003/08/16 15:01:36
+ *
+ *  Description         :
+ *
+ */
+
+/*!
+ *\ brief Define this to output raw unformatted output.
+ *
+ * Advantage of RAW is you can use fprintf(stdout, "format", ...) anywhere.
+ * Disadvantage is that there is no selection on loglevel and that there
+ * is no indication whether it is a warning, error, etc.
+ */
+//#define LOG_RAW
+
+/*--------------------------------------------------------------------------*/
+/*  Include files                                                           */
+/*--------------------------------------------------------------------------*/
+#include <stdio.h>
+
+/*--------------------------------------------------------------------------*/
+/*  Constant definitions                                                    */
+/*--------------------------------------------------------------------------*/
+#ifdef LOG_RAW
+#define LogMsg_P            fputc('\n', stdout);fprintf_P
+#endif
+
+/*--------------------------------------------------------------------------*/
+/*  Type declarations                                                       */
+/*--------------------------------------------------------------------------*/
+/*! \brief The log priority levels
+ * The first entry has the highest priority
+ */
+#ifdef LOG_RAW
+#define LOG_EMERG stdout
+#define LOG_ALERT stdout
+#define LOG_CRIT stdout
+#define LOG_ERR stdout
+#define LOG_WARNING stdout
+#define LOG_NOTICE stdout
+#define LOG_INFO stdout
+#define LOG_DEBUG stdout
+typedef FILE * TLogLevel;
+#else
+typedef u_char TLogLevel;
+#endif
+
+// bit 0..2 for LEVEL
+#define LOG_EMERG_LEV   0x00
+#define LOG_ALERT_LEV   0x01
+#define LOG_CRIT_LEV    0x02
+#define LOG_ERR_LEV     0x03
+#define LOG_WARNING_LEV 0x04
+#define LOG_NOTICE_LEV  0x05
+#define LOG_INFO_LEV    0x06
+#define LOG_DEBUG_LEV   0x07
+
+// bit 3..7 for MODULE
+#define LOG_AUDIO_MODULE        0x10
+#define LOG_CHANNEL_MODULE      0x20
+#define LOG_COMAND_MODULE       0x30
+#define LOG_DISPLAY_MODULE      0x40
+#define LOG_FAT_MODULE          0x50
+#define LOG_FLASH_MODULE        0x60
+#define LOG_HTTP_MODULE         0x70
+#define LOG_INET_MODULE         0x80
+#define LOG_KEYBOARD_MODULE     0x90
+#define LOG_LED_MODULE          0xA0
+#define LOG_LOG_MODULE          0xB0
+#define LOG_MAIN_MODULE         0xC0
+#define LOG_MENU_MODULE         0xD0
+#define LOG_MMC_MODULE          0xE0
+#define LOG_MMCDRV_MODULE       0xF0
+#define LOG_PARSE_MODULE        0x08
+#define LOG_PLAYER_MODULE       0x18
+#define LOG_REMCON_MODULE       0x28
+#define LOG_RTC_MODULE          0x38
+#define LOG_SELFTEST_MODULE     0x48
+#define LOG_SESSION_MODULE      0x58
+#define LOG_SETTINGS_MODULE     0x68
+#define LOG_SPIDRV_MODULE       0x78
+#define LOG_STREAMER_MODULE     0x88
+#define LOG_UART0DRIVER_MODULE  0x98
+#define LOG_UPDATE_MODULE       0xA8
+#define LOG_UTIL_MODULE         0xB8
+#define LOG_VERSION_MODULE      0xC8
+#define LOG_VS10XX_MODULE       0xD8
+#define LOG_WATCHDOG_MODULE     0xE8
+
+// note that LOG_MODULE must be defined before including this "log.h"
+#define LOG_EMERG       (TLogLevel)(LOG_EMERG_LEV   | LOG_MODULE)
+#define LOG_ALERT       (TLogLevel)(LOG_ALERT_LEV   | LOG_MODULE)
+#define LOG_CRIT        (TLogLevel)(LOG_CRIT_LEV    | LOG_MODULE)
+#define LOG_ERR         (TLogLevel)(LOG_ERR_LEV     | LOG_MODULE)
+#define LOG_WARNING     (TLogLevel)(LOG_WARNING_LEV | LOG_MODULE)
+#define LOG_NOTICE      (TLogLevel)(LOG_NOTICE_LEV  | LOG_MODULE)
+#define LOG_INFO        (TLogLevel)(LOG_INFO_LEV    | LOG_MODULE)
+#define LOG_DEBUG       (TLogLevel)(LOG_DEBUG_LEV   | LOG_MODULE)
+
+/*--------------------------------------------------------------------------*/
+/*  Global variables                                                        */
+/*--------------------------------------------------------------------------*/
+
+/*--------------------------------------------------------------------------*/
+/*  Global functions                                                        */
+/*--------------------------------------------------------------------------*/
+extern void LogInit(void);
+
+extern void LogOpen(void);
+extern void LogClose(void);
+
+#ifndef LOG_RAW
+extern void LogMsg_P(TLogLevel tLevel, PGM_P szMsg, ...);
+extern void LogChar_P(const char bChar);
+#endif
+
+extern TLogLevel LogSetLevel(TLogLevel tLevel);
+
+extern void HexDump(FILE *stream, CONST unsigned char *cp, size_t length);
+
+#endif /* _Log_H */

+ 41 - 0
mmc.h

@@ -0,0 +1,41 @@
+/* ========================================================================
+ * [PROJECT]    SIR100
+ * [MODULE]     MMC driver
+ * [TITLE]      Media Card driver include file
+ * [FILE]       mmc.h
+ * [VSN]        1.0
+ * [CREATED]    02 october 2006
+ * [LASTCHNGD]  02 october 2006
+ * [COPYRIGHT]  Copyright (C) STREAMIT BV 2010
+ * [PURPOSE]    routines and API to support MMC-application
+ * ======================================================================== */
+
+/*-------------------------------------------------------------------------*/
+/* global defines                                                          */
+/*-------------------------------------------------------------------------*/
+#define CARD_IS_NOT_PRESENT           0
+#define CARD_IS_PRESENT               1
+#define CARD_NO_CHANGE                2       // no change since last event occured
+
+/*-------------------------------------------------------------------------*/
+/* export global routines (interface)                                      */
+/*-------------------------------------------------------------------------*/
+extern void CardInit(void);
+extern int CardInitCard(void);
+extern TError CardOpen(u_char);
+extern void CardClose(void);
+extern TError CardStatus(void);
+extern unsigned int CardGetCurrentSong(void);
+extern char* CardGetCurrentSongName(unsigned int *punLength);
+
+extern u_char CardCheckCard(void);          // check by examining physical PIN
+extern u_char CardCheckPresent(void);       // check by examining administration
+extern TError CardPlayMp3File(char *path);
+extern void CardStopMp3File(void);
+extern void CardUpdateTicks(void);
+extern u_char CardGetNumberOfPlayLists(void);
+
+       //
+/*  ÍÍÍÍ  End Of File  ÍÍÍÍÍÍÍÍ ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ */
+
+

+ 100 - 0
mmcdrv.h

@@ -0,0 +1,100 @@
+/****************************************************************************
+*  This file is part of the MMC device driver.
+*
+*  Copyright (c) 2002-2004 by Michael Fischer. All rights reserved.
+*
+*  Redistribution and use in source and binary forms, with or without 
+*  modification, are permitted provided that the following conditions 
+*  are met:
+*  
+*  1. Redistributions of source code must retain the above copyright 
+*     notice, this list of conditions and the following disclaimer.
+*  2. Redistributions in binary form must reproduce the above copyright
+*     notice, this list of conditions and the following disclaimer in the 
+*     documentation and/or other materials provided with the distribution.
+*  3. Neither the name of the author nor the names of its contributors may 
+*     be used to endorse or promote products derived from this software 
+*     without specific prior written permission.
+*
+*  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+*  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+*  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+*  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 
+*  THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 
+*  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 
+*  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 
+*  OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 
+*  AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 
+*  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF 
+*  THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 
+*  SUCH DAMAGE.
+*
+****************************************************************************
+*  History:
+*
+*  10.10.04  mifi   First Version
+****************************************************************************/
+#ifndef __MMCDRV_H__
+#define __MMCDRV_H__
+
+#include "typedefs.h"
+
+/*-------------------------------------------------------------------------*/
+/* global defines                                                          */
+/*-------------------------------------------------------------------------*/
+//
+// Here we can switch on/off some
+// feature of the software
+//
+#define MMC_SUPPORT_WRITE               1
+
+#define MMC_OK                          0x00
+#define MMC_ERROR                       0x01
+#define MMC_DRIVE_NOT_FOUND             0x02
+#define MMC_PARAM_ERROR                 0x03
+#define MMC_BUSY                        0x04
+#define MMC_NOT_SUPPORTED               0x08
+
+#define MMC_DRIVE_C                     0
+
+//
+// Sector size
+//
+#define MMC_SECTOR_SIZE                 512
+#define MAX_SECTOR_SIZE                 MMC_SECTOR_SIZE
+
+/*-------------------------------------------------------------------------*/
+/* global types                                                            */
+/*-------------------------------------------------------------------------*/
+typedef void MMC_MOUNT_FUNC(int nDevice);
+
+/*-------------------------------------------------------------------------*/
+/* global macros                                                           */
+/*-------------------------------------------------------------------------*/
+
+/*-------------------------------------------------------------------------*/
+/* Prototypes                                                              */
+/*-------------------------------------------------------------------------*/
+int MMCInit(int nMMCMode, MMC_MOUNT_FUNC * pMountFunc, MMC_MOUNT_FUNC * pUnMountFunc);
+
+int MMCMountAllDevices(int nMMCMode, BYTE *pSectorBuffer);
+
+int MMCGetSectorSize(BYTE bDevice);
+
+int MMCIsCDROMDevice(BYTE bDevice);
+
+int MMCIsZIPDevice(BYTE bDevice);
+
+int MMCUnMountDevice(BYTE bDevice);
+
+DWORD MMCGetTotalSectors(BYTE bDevice);
+
+int MMCReadSectors(BYTE bDevice, void *pData, DWORD dwStartSector, WORD wSectorCount);
+
+#if (MMC_SUPPORT_WRITE == 1)
+
+int MMCWriteSectors(BYTE bDevice, void *pData, DWORD dwStartSector, WORD wSectorCount);
+
+#endif
+
+#endif /* !__MMCDRV_H__ */

+ 51 - 0
platform.h

@@ -0,0 +1,51 @@
+#ifndef _Platform_H
+#define _Platform_H
+/*
+ *  Copyright STREAMIT BV, 2010.
+ *
+ *  Project             : SIR
+ *  Module              : Platform
+ *  File name  $Workfile: Platform.h  $
+ *       Last Save $Date: 2003/08/18 10:09:48  $
+ *             $Revision: 0.1  $
+ *  Creation Date       : 2003/08/18 10:09:48
+ *
+ *  Description         : Definitions which are dependent on the compiler and
+ *                        or processor.
+ */
+
+/*--------------------------------------------------------------------------*/
+/*  Include files                                                           */
+/*--------------------------------------------------------------------------*/
+
+/*--------------------------------------------------------------------------*/
+/*  Constant definitions                                                    */
+/*--------------------------------------------------------------------------*/
+#define LOBYTE(w)           ((u_char) ((w) & 0xFF))
+#define HIBYTE(w)           ((u_char) (((u_short) (w) >> 8) & 0xFF))
+#define LOWORD(l)           ((u_short) ((l) & 0xFFFF))
+#define HIWORD(l)           ((u_short) (((u_long) (l) >> 16) & 0xFFFF))
+
+#define MAKEWORD(bLow, bHigh) \
+    ((u_short) (((u_char) (bLow)) | ((u_short) ((u_char) (bHigh))) << 8))
+#define MAKEULONG(wLow, wHigh) \
+    ((u_long) (((u_short) (wLow)) | ((u_long) ((u_short) (wHigh))) << 16))
+
+/*--------------------------------------------------------------------------*/
+/*  Type declarations                                                       */
+/*--------------------------------------------------------------------------*/
+
+#ifndef prog_int
+#define prog_int        prog_int16_t
+#endif /* #ifndef prog_int */
+
+/*--------------------------------------------------------------------------*/
+/*  Global variables                                                        */
+/*--------------------------------------------------------------------------*/
+
+/*--------------------------------------------------------------------------*/
+/*  Global functions                                                        */
+/*--------------------------------------------------------------------------*/
+#define PRG_RDW(addr)   pgm_read_word(addr)
+
+#endif /* _Platform_H */

+ 142 - 0
portio.h

@@ -0,0 +1,142 @@
+/* ========================================================================
+ * [PROJECT]    SIR
+ * [MODULE]     PortIO
+ * [TITLE]      Port IO header file
+ * [FILE]       portio.h
+ * [VSN]        2.0
+ * [CREATED]    030414
+ * [LASTCHNGD]  072405
+ * [COPYRIGHT]  Copyright (C) STREAMIT BV 2010
+ * [PURPOSE]    support for low-level pinning
+ * ======================================================================== */
+
+/*-------------------------------------------------------------------------*/
+/* global defines                                                          */
+/*-------------------------------------------------------------------------*/
+
+//      ********* PORT B ************
+
+//     7   6   5   4   3   2   1   0
+//   ÚÄÄÄÂÄÄÄÂÄÄÄÂÄÄÄÂÄÄÄÂÄÄÄÂÄÄÄÂÄÄÄ¿
+//  ³RES³CEN³CSC³XCS³SO ³ SI³CLK³CWP³
+// ÀÄÄÄÁÄÄÄÁÄÄÄÁÄÄÄÁÄÄÄÁÄÄÄÁÄÄÄÁÄÄÄÙ
+
+#define MMC_ENABLE      5           // active LOW!
+#define VS_ENABLE       6           // note that logic has changed since SIR80 V1
+
+#define MMCVS_OUT_DDR   DDRB        // data-direction of MMC/VS functions
+#define MMCVS_OUT_WRITE PORTB       // write PORTB (B as output)
+
+//      ********* PORT D ************
+
+//     7   6   5   4   3   2   1   0
+//   ÚÄÄÄÂÄÄÄÂÄÄÄÂÄÄÄÂÄÄÄÂÄÄÄÂÄÄÄÂÄÄÄ¿
+//  ³LD7³LD6³LD5³LD4³KC2³KC3³ EN³ - ³
+// ÀÄÄÄÁÄÄÄÁÄÄÄÁÄÄÄÁÄÄÄÁÄÄÄÁÄÄÄÁÄÄÄÙ
+
+#define LCD_EN          2           // LCD chip Enable (or: chip select)
+
+#define LCD_DATA_4      4
+#define LCD_DATA_5      5
+#define LCD_DATA_6      6
+#define LCD_DATA_7      7
+
+#define LCD_DATA_DDR    DDRD        // data-direction of LCD-data port
+#define LCD_DATA_PORT   PORTD       // port to write LCD-data
+#define LCD_IN_PORT     PIND        // port to read LCD-data
+
+#define LCD_EN_DDR      DDRE        // data-direction of LCD-control port
+#define LCD_EN_PORT     PORTE       // data of LCD-control port
+
+#define KB_OUT_DDR_B    DDRD        // data-direction of KB_OUT (second part)
+#define KB_OUT_WRITE_B  PORTD       // write PORTD (D as output)
+
+//      ********* PORT E ************
+
+//     7   6   5   4   3   2   1   0
+//   ÚÄÄÄÂÄÄÄÂÄÄÄÂÄÄÄÂÄÄÄÂÄÄÄÂÄÄÄÂÄÄÄ¿
+//  ³CSF³REQ³ETH³IR ³BL ³ - ³TXD³RXD³
+// ÀÄÄÄÁÄÄÄÁÄÄÄÁÄÄÄÁÄÄÄÁÄÄÄÁÄÄÄÁÄÄÄÙ
+
+#define FLASH_ENABLE    7       // active LOW!
+#define LCD_BL_BIT      3       // Backlight LCD
+#define IR_PIN          4       // Infrared receive PIN
+
+#define FLASH_OUT_WRITE PORTE   // write PORTE for Flash CS
+#define LCD_BL_PORT     PORTE
+
+
+
+//      ********* PORT F ************
+
+//     7   6   5   4   3   2   1   0
+//   ÚÄÄÄÂÄÄÄÂÄÄÄÂÄÄÄÂÄÄÄÂÄÄÄÂÄÄÄÂÄÄÄ¿
+//  ³KR3³KR2³KR1³KR0³LED³LRS³LRW³CRD³        // note TDI ( JTAG-pin) is shared with KR3
+// ÀÄÄÄÁÄÄÄÁÄÄÄÁÄÄÄÁÄÄÄÁÄÄÄÁÄÄÄÁÄÄÄÙ
+
+#define MMC_CDETECT         0       // signal card inserted/removed
+#define LCD_RW              1       // R/W LCD
+#define LCD_RS              2       // Register select LCD
+#define LED_PIN             3       // LED
+
+
+#define LCD_RS_DDR          DDRF    // data-direction of LCD-control port
+#define LCD_RS_PORT         PORTF   // data of LCD-control port
+#define LCD_RW_DDR          DDRF    // data-direction of LCD-control port
+#define LCD_RW_PORT         PORTF   // data of LCD-control port
+
+#define LED_OUT_DDR         DDRF    // data-direction of LED control pin
+#define LED_OUT_WRITE       PORTF   // write PORTF
+
+#define KB_IN_DDR           DDRF    // data-direction of KB_IN
+#define KB_IN_WRITE         PORTF   // write PORTF (F as output)
+#define KB_IN_READ          PINF    // read PINF (F as input)
+
+#define MMC_IN_DDR          DDRF    // data-direction of MMC_CDETECT
+#define MMC_IN_READ         PINF    // read PINF (F as input)
+
+
+//     7   6   5   4   3   2   1   0
+//   ÚÄÄÄÂÄÄÄÂÄÄÄÂÄÄÄÂÄÄÄÂÄÄÄÂÄÄÄÂÄÄÄ¿
+//  ³ - ³ - ³ - ³KC1³KC0³ - ³ - ³ - ³
+// ÀÄÄÄÁÄÄÄÁÄÄÄÁÄÄÄÁÄÄÄÁÄÄÄÁÄÄÄÁÄÄÄÙ
+
+#define KB_OUT_DDR_A    DDRG        // data-direction of KB_OUT (first part)
+#define KB_OUT_WRITE_A  PORTG       // write PORTG (G as output)
+
+
+#define JTAG_REG            MCUCR
+#define OVERFLOW_SIGNAL     sig_OVERFLOW0
+
+#define init_8_bit_timer()  \
+{                           \
+    TCCR0B |= (1<<CS02);    \
+    TIFR0 |= 1<<TOV0;       \
+    TIMSK0 |= 1<<TOIE0;     \
+}
+
+#define disable_8_bit_timer_ovfl_int()  \
+{                                       \
+    TIMSK0 &= ~(1<<TOIE0);              \
+}
+
+//      ********* PORT G ************
+
+/*-------------------------------------------------------------------------*/
+/* export global routines (interface)                                      */
+/*-------------------------------------------------------------------------*/
+
+/*  ÍÍÍÍ  End Of File  ÍÍÍÍÍÍÍÍ ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ */
+
+
+
+
+
+
+
+
+
+
+
+
+

+ 52 - 0
remcon.h

@@ -0,0 +1,52 @@
+/* ========================================================================
+ * [PROJECT]    SIR
+ * [MODULE]     Remote Control
+ * [TITLE]      remote control header file
+ * [FILE]       remcon.h
+ * [VSN]        1.0
+ * [CREATED]    1 july 2003
+ * [LASTCHNGD]  1 july 2003
+ * [COPYRIGHT]  Copyright (C) STREAMIT BV 2010
+ * [PURPOSE]    remote control routines for SIR
+ * ======================================================================== */
+
+/*-------------------------------------------------------------------------*/
+/* global defines                                                          */
+/*-------------------------------------------------------------------------*/
+#define RC_OK                 0x00
+#define RC_ERROR              0x01
+#define RC_BUSY               0x04
+
+#define RCST_IDLE             0x00
+#define RCST_WAITFORLEADER    0x01
+#define RCST_SCANADDRESS      0x02
+#define RCST_SCANDATA         0x03
+
+#define RC_INT_SENS_MASK      0x03
+#define RC_INT_FALLING_EDGE   0x02
+#define RC_INT_RISING_EDGE    0x03
+
+#define IR_RECEIVE            4
+#define IR_BUFFER_SIZE        1
+
+
+/*-------------------------------------------------------------------------*/
+/* export global routines (interface)                                      */
+/*-------------------------------------------------------------------------*/
+void    RcInit(void);
+
+
+/*  ÍÍÍÍ  End Of File  ÍÍÍÍÍÍÍÍ ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ */
+
+
+
+
+
+
+
+
+
+
+
+
+

+ 158 - 0
rtc.h

@@ -0,0 +1,158 @@
+#ifndef _RTC_H_
+#define	_RTC_H_
+
+/* ========================================================================
+ * [PROJECT]    SIR
+ * [MODULE]     Real Time Clock
+ * [TITLE]      High- and low level Routines for INtersil X1205 RTC chip
+ * [FILE]       rtc.c
+ * [VSN]        1.0
+ * [CREATED]    13042007
+ * [LASTCHNGD]  131042007
+ * [COPYRIGHT]  Copyright (C) STREAMIT BV 2010
+ * [PURPOSE]    contains all interface- and low-level routines to
+ *              read/write date/time/status strings from the X1205
+ * ======================================================================== */
+#include <time.h>           // for tm-struct
+                            //
+/*! \name Non-Volatile Alarm Registers */
+/*@{*/
+#define X12RTC_SCA0         0x00    /*!< \brief Alarm 0 second. */
+#define X12RTC_SCA1         0x08    /*!< \brief Alarm 1 second. */
+#define X12RTC_SCA_ESC      0x80    /*!< \brief Second alarm enabled. */
+
+#define X12RTC_MNA0         0x01    /*!< \brief Alarm 0 minute. */
+#define X12RTC_MNA1         0x09    /*!< \brief Alarm 1 minute. */
+#define X12RTC_MNA_EMN      0x80    /*!< \brief Minute alarm enabled. */
+
+#define X12RTC_HRA0         0x02    /*!< \brief Alarm 0 hour. */
+#define X12RTC_HRA1         0x0A    /*!< \brief Alarm 1 hour. */
+#define X12RTC_HRA_EHR      0x80    /*!< \brief Hour alarm enabled. */
+
+#define X12RTC_DTA0         0x03    /*!< \brief Alarm 0 day of month. */
+#define X12RTC_DTA1         0x0B    /*!< \brief Alarm 1 day of month. */
+#define X12RTC_DTA_EDT      0x80    /*!< \brief Day of month alarm enabled. */
+
+#define X12RTC_MOA0         0x04    /*!< \brief Alarm 0 month. */
+#define X12RTC_MOA1         0x0C    /*!< \brief Alarm 1 month. */
+#define X12RTC_MOA_EMO      0x80    /*!< \brief Month alarm enabled. */
+
+#define X12RTC_YRA0         0x05    /*!< \brief Currently unused alarm 0 register. */
+#define X12RTC_YRA1         0x0D    /*!< \brief Currently unused alarm 1 register. */
+
+#define X12RTC_DWA0         0x06    /*!< \brief Alarm 0 weekday. */
+#define X12RTC_DWA1         0x0E    /*!< \brief Alarm 1 weekday. */
+#define X12RTC_DWA_EDW      0x80    /*!< \brief Weekday alarm enabled. */
+
+#define X12RTC_Y2K0         0x07    /*!< \brief Alarm 0 . */
+#define X12RTC_Y2K1         0x0F    /*!< \brief Alarm 1 . */
+/*@}*/
+
+/*! \name Non-Volatile Control Registers */
+/*@{*/
+#define X12RTC_BL           0x10    /*!< \brief Block protection and watchdog register. */
+
+#define X12RTC_BL_WD        0x14    /*!< \brief Watchdog configuration. */
+#define X12RTC_BL_WD_1750   0x00    /*!< \brief Timeout after 1.75 seconds. */
+#define X12RTC_BL_WD_750    0x04    /*!< \brief Timeout after 750 milliseconds. */
+#define X12RTC_BL_WD_250    0x10    /*!< \brief Timeout after 250 milliseconds. */
+#define X12RTC_BL_WD_OFF    0x14    /*!< \brief Disabled. */
+
+#define X12RTC_BL_BP        0xE0    /*!< \brief Block protection. */
+#define X12RTC_BL_BP_NONE   0x00    /*!< \brief No protection. */
+#define X12RTC_BL_BP_UQUAD  0x20    /*!< \brief Upper quarter protected. */
+#define X12RTC_BL_BP_UHALF  0x40    /*!< \brief Upper half protected. */
+#define X12RTC_BL_BP_FULL   0x60    /*!< \brief Full array protected. */
+#define X12RTC_BL_BP_FIRST1 0x80    /*!< \brief First page protected. */
+#define X12RTC_BL_BP_FIRST2 0xA0    /*!< \brief First 2 pages protected. */
+#define X12RTC_BL_BP_FIRST3 0xC0    /*!< \brief First 4 pages protected. */
+#define X12RTC_BL_BP_FIRST8 0xE0    /*!< \brief First 8 pages protected. */
+
+#define X12RTC_INT          0x11    /*!< \brief Interrupt control and freq. output register. */
+
+#define X12RTC_INT_FO       0x14    /*!< \brief Programmable frequency output bits. */
+#define X12RTC_INT_FO_IRQ   0x00    /*!< \brief Alarm interrupt. */
+#define X12RTC_INT_FO_32KHZ 0x04    /*!< \brief 32.768kHz. */
+#define X12RTC_INT_FO_100HZ 0x10    /*!< \brief 100Hz. */
+#define X12RTC_INT_FO_1HZ   0x14    /*!< \brief 1Hz. */
+
+#define X12RTC_INT_AL0E     0x20    /*!< \brief Alarm 0 interrupt enable. */
+#define X12RTC_INT_AL1E     0x40    /*!< \brief Alarm 1 interrupt enable. */
+#define X12RTC_INT_IM       0x80    /*!< \brief Repetitive alarm. */
+
+#define X12RTC_ATR          0x12    /*!< \brief Analog trimming register. */
+
+#define X12RTC_DTR          0x13    /*!< \brief Digital trimming register. */
+#define X12RTC_DTR_NONE     0x00    /*!< \brief 0 PPM. */
+#define X12RTC_DTR_PLUS10   0x02    /*!< \brief +10 PPM. */
+#define X12RTC_DTR_PLUS20   0x01    /*!< \brief +20 PPM. */
+#define X12RTC_DTR_PLUS30   0x03    /*!< \brief +30 PPM. */
+#define X12RTC_DTR_MINUS10  0x06    /*!< \brief -10 PPM. */
+#define X12RTC_DTR_MINUS20  0x05    /*!< \brief -20 PPM. */
+#define X12RTC_DTR_MINUS30  0x07    /*!< \brief -30 PPM. */
+/*@}*/
+
+/*! \name Volatile Date and Time Registers */
+/*@{*/
+#define X12RTC_SC           0x30    /*!< Seconds register, 0 - 59. */
+#define X12RTC_MN           0x31    /*!< Minutes register, 0 - 59. */
+#define X12RTC_HR           0x32    /*!< Hours register, 0 - 23. */
+#define X12RTC_HR_MIL       0x80    /*!< Use 24h format. */
+#define X12RTC_DT           0x33    /*!< Day register, 1 - 31. */
+#define X12RTC_MO           0x34    /*!< Month register, 1 - 12. */
+#define X12RTC_YR           0x35    /*!< Year register, 0 - 99. */
+#define X12RTC_DW           0x36    /*!< Day of the weeks register, 0 - 6. */
+#define X128xRTC_SSEC       0x37    /*!< X1286 1/100 second register, 0 - 99 (read only). */
+#define X122xRTC_Y2K        0x37    /*!< X1226 epoch register, 19 or 20. */
+/*@}*/
+
+/*! \name Volatile Status Register */
+/*@{*/
+#define X12RTC_SR           0x3F    /*!< Status register. */
+#define X12RTC_SR_RTCF      0x01    /*!< Power failure. */
+#define X12RTC_SR_WEL       0x02    /*!< Memory write enable. */
+#define X12RTC_SR_RWEL      0x04    /*!< Register write enable. */
+#define X12RTC_SR_AL0       0x20    /*!< Alarm 0 indicator. */
+#define X12RTC_SR_AL1       0x40    /*!< Alarm 1 indicator. */
+#define X12RTC_SR_BAT       0x80    /*!< Operating from battery. */
+/*@}*/
+
+#define RTC_STATUS_PF       0x00000001
+#define RTC_STATUS_AL0      0x00000020
+#define RTC_STATUS_AL1      0x00000040
+
+#define RTC_ALARM_SECOND    0x00000001
+#define RTC_ALARM_MINUTE    0x00000002
+#define RTC_ALARM_HOUR      0x00000004
+#define RTC_ALARM_MDAY      0x00000008
+#define RTC_ALARM_MONTH     0x00000010
+#define RTC_ALARM_WDAY      0x00000080
+
+/*!
+ * \brief Convert binary coded decimal to binary value.
+ */
+#define BCD2BIN(x) ((((u_char)(x)) >> 4) * 10 + ((x) & 0x0F))
+
+/*!
+ * \brief Convert binary to binary coded decimal value.
+ */
+#define BIN2BCD(x) (((((u_char)(x)) / 10) << 4) + (x) % 10)
+
+
+/* Prototypes */
+extern int X12Init(void);
+
+extern int X12RtcGetClock(tm *tm);
+extern int X12RtcSetClock(CONST tm *tm);
+extern int X12RtcGetAlarm(int idx, tm *tm, int *aflgs);
+extern int X12RtcSetAlarm(int idx, CONST tm *tm, int aflgs);
+extern int X12RtcGetStatus(u_long *sflgs);
+extern int X12RtcClearStatus(u_long sflgs);
+extern int X12RtcReadRegs(u_char addr, u_char *buff, size_t len);
+extern int X12RtcWrite(int nv, CONST u_char *buff, size_t len);
+
+extern int X12EepromRead(u_int addr, void *buff, size_t len);
+extern int X12EepromWrite(u_int addr, CONST void *buff, size_t len);
+
+/* End of prototypes */
+#endif

+ 53 - 0
spidrv.h

@@ -0,0 +1,53 @@
+/* ========================================================================
+ * [PROJECT]    SIR100
+ * [MODULE]     SPI
+ * [TITLE]      spi header file
+ * [FILE]       spi.h
+ * [VSN]        1.0
+ * [CREATED]    12052007
+ * [LASTCHNGD]  12052007
+ * [COPYRIGHT]  Copyright (C) STREAMIT BV 2010
+ * [PURPOSE]    API and global defines for SPI module
+ * ======================================================================== */
+
+#ifndef _SPI_H
+#define _SPI_H
+
+
+/*-------------------------------------------------------------------------*/
+/* global defines                                                          */
+/*-------------------------------------------------------------------------*/
+#define SPEED_SLOW         0
+#define SPEED_FAST         1
+#define SPEED_ULTRA_FAST   2
+
+/*-------------------------------------------------------------------------*/
+/* typedefs & structs                                                      */
+/*-------------------------------------------------------------------------*/
+typedef enum
+{
+    SPI_DEV_VS10XX=0,
+    SPI_DEV_FLASH,
+    SPI_DEV_MMC,
+
+    SPI_NROF_DEVICES        // keep last
+}TSPIDevice;
+/*--------------------------------------------------------------------------*/
+/*  Global variables                                                        */
+/*--------------------------------------------------------------------------*/
+
+/*-------------------------------------------------------------------------*/
+/* export global routines (interface)                                      */
+/*-------------------------------------------------------------------------*/
+extern void SPIselect(TSPIDevice Device);
+extern void SPIdeselect(void);
+extern void SPIputByte(u_char bByte);       // send byte using SPI, ignore result
+extern u_char SPIgetByte(void);             // read byte using SPI, don't use any input
+extern u_char SPItransferByte(u_char);      // send byte using SPI, return result
+extern void SPIinit(void);                  // initialise SPI-registers (speed, mode)
+extern void SPImode(u_char data);
+extern u_char SPIgetmode(void);
+
+#endif /* _SPI_H */
+/*  ÍÍÍÍ  End Of File  ÍÍÍÍÍÍÍÍ ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ */
+

+ 144 - 0
system.h

@@ -0,0 +1,144 @@
+/* ========================================================================
+ * [PROJECT]    SIR
+ * [MODULE]     global module
+ * [TITLE]      system header file
+ * [FILE]       system.h
+ * [VSN]        1.0
+ * [CREATED]    18 august 2003
+ * [LASTCHNGD]  18 august 2003
+ * [COPYRIGHT]  Copyright (C) STREAMIT BV 2010
+ * [PURPOSE]    global defines and prototypes for Lucas project
+ * ======================================================================== */
+
+/*--------------------------------------------------------------------------*/
+/*  Include files                                                           */
+/*--------------------------------------------------------------------------*/
+#include "typedefs.h"
+/*-------------------------------------------------------------------------*/
+/* global defines                                                          */
+/*-------------------------------------------------------------------------*/
+#define ON    (1)
+#define OFF   (0)
+
+#define NO_CHANNEL      200     // make sure this is > SETTINGS_NROF_CHANNELS
+#define NO_PLAYLIST     200     // make sure this is > SETTINGS_NROF_PLAYLISTS
+
+
+/*!\brief System status bit definitions */
+#define STATUS_STARTING_UP              0x01        // true during startup and Setup Wizzard
+#define STATUS_IP_MODE                  0x02        // do we use DHCP or Static IP?
+#define STATUS_POWER                    0x04        // if set, we are on
+#define STATUS_SELFTEST                 0x08        // switch to re-direct keys from Menu to Selftest module
+#define STATUS_CONFIGURED               0x10        // if set, we are configured
+#define STATUS_GPB_INVALID              0x20        // if set, we cannot rely on Productcode, Remote Updatemode, etc
+#define STATUS_FALLBACK_ACTIVE          0x40        // if set, we cannot play from the internet and if a card is present, we play from card
+
+#define STATUS_STARTING_UP_MASK         0x01
+#define STATUS_IP_MODE_MASK             0x02
+#define STATUS_POWER_MASK               0x04
+#define STATUS_SELFTEST_MASK            0x08
+#define STATUS_CONFIGURED_MASK          0x10
+#define STATUS_GPB_INVALID_MASK         0x20
+#define STATUS_FALLBACK_ACTIVE_MASK     0x40
+
+#define ONE_SECOND      225             // 225 times 4,44 msecs makes 1 second
+#define ONE_MINUTE      60
+#define ONE_HOUR        60
+
+
+/*!\brief define possible languages */
+#define LANGUAGE_NL     0
+#define LANGUAGE_EN     1
+#define LANGUAGE_DE     2
+
+/*!\brief define possible IP_Modes */
+#define IP_MODE_DHCP    0
+#define IP_MODE_STATIC  1
+
+/*!\brief define possible countrycodes (mainly used for the modem) */
+#define COUNTRY_US      0
+#define COUNTRY_UK      1
+#define COUNTRY_SA      2
+#define COUNTRY_NL_V92  3
+#define COUNTRY_NL_V34  4
+#define COUNTRY_NROF    5
+
+/*!\brief Maximum size to use for threadnames */
+#define THREADNAME_SIZE 9
+
+enum
+{
+        IRQ_INT0,
+        IRQ_INT1,
+        IRQ_INT2,
+        IRQ_INT3,
+        IRQ_INT4,
+        IRQ_INT5,
+        IRQ_INT6,
+        IRQ_INT7,
+        IRQ_TIMER2_COMP,
+        IRQ_TIMER2_OVF,
+        IRQ_TIMER1_CAPT,
+        IRQ_TIMER1_COMPA,
+        IRQ_TIMER1_COMPB,
+        IRQ_TIMER1_OVF,
+        IRQ_TIMER0_COMP,
+        IRQ_TIMER0_OVF,
+        IRQ_SPI_STC,
+        IRQ_UART_RX,
+        IRQ_UART_UDRE,
+        IRQ_UART_TX,
+        IRQ_ADC,
+        IRQ_EE_RDY,
+        IRQ_ANA_COMP,
+        IRQ_TIMER1_COMPC,
+        IRQ_TIMER3_CAP,
+        IRQ_TIMER3_COMPA,
+        IRQ_TIMER3_COMPB,
+        IRQ_TIMER3_COMPC,
+        IRQ_TIMER3_OVF,
+        IRQ_UART1_RX,
+        IRQ_UART1_UDRE,
+        IRQ_UART1_TX,
+        IRQ_I2C,
+        IRQ_SPM_RDY,
+        IRQ_MAX
+};
+
+
+/*-------------------------------------------------------------------------*/
+/* typedefs & structs                                                      */
+/*-------------------------------------------------------------------------*/
+typedef struct
+{
+    u_char KeyLockStatus;               // overall lock, if ACTIVE, keyboard is locked
+    u_char KeyLockEditStatus;           // used when user wants to change the status of the Keylock
+    u_char KeyLockTempStatus;           // after entering a valid PIN, this goes to INACTIVE for 30 secs
+    u_short KeyLockPIN;                 // range = [0]..[5555]
+} TKeyLock;
+
+typedef u_char TIPMode;
+typedef u_char TLanguage;
+
+/*-------------------------------------------------------------------------*/
+/* export global variables                                                 */
+/*-------------------------------------------------------------------------*/
+extern u_char           SystemStatus;
+
+extern TLanguage        SystemLanguage;
+extern TIPMode          SystemIPMode;
+extern TKeyLock         SystemKeyLock;
+
+/*-------------------------------------------------------------------------*/
+/* export global routines (interface)                                      */
+/*-------------------------------------------------------------------------*/
+extern void SysInitVars(void);
+extern void SysPowerOn(void);
+extern void SysPowerOff(void);
+extern void SysInitIO(void);
+extern void SystemShowSysInfo(void);
+
+
+/*  ÍÍÍÍ  End Of File  ÍÍÍÍÍÍÍÍ ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ */
+
+

+ 183 - 0
typedefs.h

@@ -0,0 +1,183 @@
+#ifndef _Typedefs_H
+#define _Typedefs_H
+/* ========================================================================
+ * [PROJECT]    SIR
+ * [MODULE]     global module
+ * [TITLE]      system header file
+ * [FILE]       typedefs.h
+ * [VSN]        1.0
+ * [CREATED]    09 november 2003
+ * [LASTCHNGD]  09 november 2003
+ * [COPYRIGHT]  Copyright (C) STREAMIT BV 2010
+ * [PURPOSE]    global typedefs
+ * ======================================================================== */
+
+
+/*--------------------------------------------------------------------------*/
+/*  Include files                                                           */
+/*--------------------------------------------------------------------------*/
+#include <fs/typedefs.h>
+
+/*--------------------------------------------------------------------------*/
+/*  Constant definitions                                                    */
+/*--------------------------------------------------------------------------*/
+
+/*--------------------------------------------------------------------------*/
+/*  Type declarations                                                       */
+/*--------------------------------------------------------------------------*/
+/* RL: this 'table' has now a mirror table in 'Display.c' (LcdErrorStrings) */
+/*     Make sure that any modification made to this table are reflected by  */
+/*     the LcdErrorStirngs table! (an error is bad but showing the wrong    */
+/*     error is too much....) */
+typedef enum _TERRORCODE
+{
+    OK = 0,                             /* All ok */
+
+    /*
+     * Status messages
+     */
+    CHANNEL_CONNECTING,                 /* Channel connecting */
+    CHANNEL_RETRIEVING,                 /* Retrieving channels */
+    STREAMER_CONNECTING,                /* Connecting to stream */
+    STREAMER_BUFFERING,                 /* Buffering audio */
+    STREAMER_PLAYING,                   /* Playing audio from a stream */
+    STREAMER_FALLBACK,                  /* trying card now, inet failed*/
+    UPDATE_CONNECTING,                  /* connecting to update server */
+    CARD_BUFFERING,                     /* Buffering audio */
+    CARD_PLAYING,                       /* Playing audio from a card */
+
+    USER_ABORT,                         /* User abort */
+
+    /*
+     * Warnings. In other words, problems that are
+     * probably recoverable by a retry
+     */
+    PLAYER_WARNINGS = 200,
+    CHANNEL_HOSTNOTFOUND,               /* Could not resolve hostname */
+    CHANNEL_NEW_ISP,                    /* New ISP settings received */
+    CHANNEL_NEW_DB,                     /* New DB URL info received */
+    CHANNEL_NEW_CHANNEL,                /* New channel info received */
+    CHANNEL_NOCONNECT,                  /* Could not connect (will retry) */
+
+    CHANNEL_TOO_MANY_NOCONNECTS,        /* Could not connect */
+    CHANNEL_REDIRECT,                   /* Redirect (will retry) */
+    CHANNEL_TOO_MANY_REDIRECTS,         /* Too many redirects */
+    CHANNEL_BADRESPONSE,                /* Bad server response (will retry) */
+    CHANNEL_TOO_MANY_BADRESPONSES,      /* Bad server response */
+
+    STREAM_HOSTNOTFOUND,                /* Could not resolve hostname */
+    STREAM_NOCONNECT,                   /* Could not connect (will retry) */
+    STREAM_REDIRECT,                    /* Redirect (will retry) */
+    STREAM_BADRESPONSE,                 /* Bad server response (will retry) */
+
+    INET_HOSTNOTFOUND,                  /* Could not resolve hostname (will retry) */
+    INET_NOCONNECT,                     /* Could not connect (will retry) */
+    INET_BADRESPONSE,                   /* Bad server response (will retry) */
+    INET_REDIRECT,                      /* Redirect (will retry) */
+    INET_ACCESS_RESTRICTED,             /* Access needs login info (will retry) */
+
+    STREAM_TIMEOUT,                     /* Network timeout */
+    STREAM_BADAUDIO,                    /* Audio data seems invalid */
+    STREAM_DISCONNECTED,                /* Server closed the connection */
+    STREAM_BUFFEREMPTY,                 /* Audio buffer ran out of data */
+    STREAM_BADCHANNEL,                  /* Bad channel number */
+
+    UPDATE_NEEDED,                      /* Firmware update is needed */
+
+    PLAYER_WAITPLAY,                    /* Player has nothing to do */
+    PLAYER_STARTING,
+
+    CARD_BUFFEREMPTY,                   /* Audio buffer ran out of data */
+    CARD_BADPLAYLIST,                   /* non-existing or invalid playlist requested */
+    CARD_BADAUDIO,                      /* Audio data seems invalid */
+
+    /*
+     * Errors.
+     * User interaction (e.g. select a different channel) can solve these
+     */
+    PLAYER_ERRORS = 400,
+    BADCHANNEL,                         /* Bad channel number                   - no longer used */
+    STREAM_TOO_MANY_NOCONNECTS,         /* Too many no connects */
+    STREAM_TOO_MANY_BADRESPONSES,       /* Too many bad server responses */
+    STREAM_TOO_MANY_REDIRECTS,          /* Too many redirects */
+    UPDATE_FAILED,                      /* not specified, just failed */
+
+    CHANNEL_NODATA,                     /* Didn't receive any data */
+
+    STREAM_BAD_FILETYPE,                /* Bad type of file */
+    STREAM_BAD_NETWORK,                 /* Too many network failures            - no longer used */
+    STREAM_DISCONNECTED_UNUSED,         /* Server closed the connection         - no longer used */
+    STREAM_BUFFEREMPTY_UNUSED,          /* Audio buffer ran out of data         - no longer used */
+
+    INET_HOST_NONEXISTANT,              /* Hostname unknown */
+    INET_TOO_MANY_NOCONNECTS,           /* Too many no connects */
+    INET_TOO_MANY_REDIRECTS,            /* Too many redirects */
+    INET_TOO_MANY_BADRESPONSES,         /* Too many bad server responses */
+    INET_ACCESS_DENIED,                 /* Access to the server was denied */
+
+    CARD_NO_SONG,                       /* no (more) songs found on this card */
+    CARD_PLAYLIST_IN_USE,               /* trying to open a playlist that was open already */
+    CARD_CREATE_STREAM,                 /* Failed to create a stream */
+    CARD_NO_CARD,                       /* card not present to perfom desired action */
+    CARD_NO_HEAP,                       /* unable to allocate RAM */
+    CARD_NOT_REGISTERED,                /* card present but not know in the system */
+    CARD_WRONG_HASH,                    /* hash results in a non-valid flash-address */
+    /*
+     * System Errors.
+     * These include programming errors but also:
+     * errors that may (or may not..) be solved by a reboot (indicated by REBOOT)
+     */
+    PLAYER_SYSTEMERRORS = 500,
+    PLAYER_NOTREADY,                    /* Player was not successfully initialised */
+    SESSION_NODEVICE,                   /* Could not register devices */
+    SESSION_NODHCP_NOEEPROM,            /* No DHCP and no previous IP address. REBOOT */
+    SESSION_MDMNOINIT,                  /* Could not initialise modem. REBOOT */
+    SESSION_MDMNODISCONNECT,            /* Modem is still connected. REBOOT */
+
+    SESSION_PPPINIT,                    /* Could not initialise PPP */
+    SESSION_PPPSTART,                   /* Could not start PPP (username/password incorrect?)
+                                           Note that NutOs ALWAYS requires a REBOOT in this case! */
+    SESSION_NOROUTEADD,                 /* Could not add route to routetable */
+    CHANNEL_NOMEM,                      /* Not enough memory for channel */
+    CHANNEL_CREATE_SOCKET,              /* Failed to create a socket */
+
+    CHANNEL_SOCK_RCVTO,                 /* Could not set socket option RCVTO */
+    CHANNEL_CREATE_STREAM,              /* Failed to create a stream */
+    STREAM_NOTHREAD,                    /* Could not start streamer thread */
+    STREAM_NOMEM,                       /* Not enough memory for streamer */
+    STREAM_CREATE_SOCKET,               /* Failed to create a socket */
+
+    STREAM_CREATE_STREAM,               /* Failed to create a stream */
+    STREAM_SOCK_MSS,                    /* Could not set socket option MSS */
+    STREAM_SOCK_RCVTO,                  /* Could not set socket option RCVTO */
+    STREAM_SOCK_RXBUF,                  /* Could not set socket option RXBUF */
+
+    UPDATE_WRONG_NROF_BYTES,            /* nrof bytes not as specified in 'update.inf' */
+    UPDATE_CODESIZE_OVERFLOW,           /* codesize exceeds 126KB (note: 2KB needed for bootloader) */
+    UPDATE_CRC_ERROR,                   /* CRC of downloaded code in RAM incorrect */
+    UPDATE_NOT_ALLOWED,                 /* either ISP or bootloader prohibits Remote Update functionality */
+
+    INET_NOMEM,                         /* Not enough memory */
+    INET_CREATE_SOCKET,                 /* Failed to create a socket */
+    INET_SOCK_MSS,                      /* Could not set socket option MSS */
+    INET_SOCK_RCVTO,                    /* Could not set socket option RCVTO */
+    INET_SOCK_RXBUF,                    /* Could not set socket option RXBUF */
+    INET_CREATE_STREAM,                 /* Failed to create a stream */
+    INET_SEND_FAIL,                     /* Failed to send data */
+
+    STREAM_TOO_MANY_ERRORS,             /* Seen too many errors */
+
+    PLAYER_NO_THREAD,                   /* Could not start player thread */
+    PLAYER_NO_SOURCE,                   /* No source to play audio from */
+} TError;
+
+
+/*--------------------------------------------------------------------------*/
+/*  Global variables                                                        */
+/*--------------------------------------------------------------------------*/
+
+/*--------------------------------------------------------------------------*/
+/*  Global functions                                                        */
+/*--------------------------------------------------------------------------*/
+
+#endif /* _Typedefs_H */

+ 60 - 0
uart0driver.h

@@ -0,0 +1,60 @@
+#ifndef _UART0DRIVER_H_
+#define _UART0DRIVER_H_
+/*!
+ * Copyright (C) 2003 by Streamit All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this
+ *    software must display the following acknowledgement:
+ *
+  *    This product includes software developed by Streamit
+ *    and its contributors.
+ *
+ * THIS SOFTWARE IS PROVIDED BY STREAMIT AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL CALL DIRECT
+ * CELLULAR SOLUTIONS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
+ * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * For additional information see http://www.streamit.eu/
+ */
+/*!
+ *
+ * COPYRIGHT STREAMIT BV 2010
+ * Created
+ *
+ *
+ */
+/*--------------------------------------------------------------------------*/
+/*  Include files                                                           */
+/*--------------------------------------------------------------------------*/
+#include <stdio.h>
+
+#define UART_COOKEDMODE_RAW    0L
+#define UART_COOKEDMODE_EOL    1L
+
+extern void  Uart0DriverInit(void);
+extern void  Uart0DriverStart(void);
+extern void  Uart0DriverStop(void);
+extern FILE *Uart0DriverGetStream(void);
+extern int   Uart0DriverGetNumber(PGM_P prompt, int dflt);
+extern int   Uart0DriverKey(void);
+extern void  Uart0DriverSetCookedMode(u_long Mode);
+
+
+#endif

+ 164 - 0
vs10xx.h

@@ -0,0 +1,164 @@
+/*
+ * Copyright (C) 2001-2003 by egnite Software GmbH. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the copyright holders nor the names of
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY EGNITE SOFTWARE GMBH AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL EGNITE
+ * SOFTWARE GMBH OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
+ * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * For additional information see http://www.ethernut.de/
+ *
+ * -
+ * Portions Copyright (C) 2001 Jesper Hansen <jesperh@telia.com>.
+ *
+ * This file is part of the yampp system.
+ *
+ * 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.
+ */
+
+/*
+ *
+ * Revision 2.0  2004/09/30 19:37:39  johan van der stoel
+ * Fully rewritten to support VS1011 / VS1003. For VS1001: use driver from
+ * Ethernut distribution
+ *
+ * Revision 1.2  2003/07/13 19:37:39  haraldkipp
+ * Enable application to control decoder interrupts.
+ *
+ *
+ */
+
+#include <sys/nutconfig.h>
+#include <sys/types.h>
+
+/*-------------------------------------------------------------------------*/
+/* global defines                                                          */
+/*-------------------------------------------------------------------------*/
+
+// Instruction opcodes
+#define VS_OPCODE_READ      3
+#define VS_OPCODE_WRITE     2
+
+// Decoder registers VS1011/VS1003
+#define VS_MODE_REG         0
+#define VS_STATUS_REG       1
+#define VS_BASS_REG         2
+#define VS_CLOCKF_REG       3
+#define VS_DECODE_TIME_REG  4
+#define VS_AUDATA_REG       5
+#define VS_WRAM_REG         6
+#define VS_WRAMADDR_REG     7
+#define VS_HDAT0_REG        8
+#define VS_HDAT1_REG        9
+#define VS_AIADDR_REG      10
+#define VS_VOL_REG         11
+#define VS_AICTRL0_REG     12
+#define VS_AICTRL1_REG     13
+#define VS_AICTRL2_REG     14
+#define VS_AICTRL3_REG     15
+
+#define NROF_VS_REGS       (VS_AICTRL3_REG+1)
+
+// SCI Mode register bits VS1011/VS1003
+#define VS_SM_DIFF          0x0001
+#define VS_SM_JUMP          0x0002 /* VS1011 */
+#define VS_SM_SETTOZERO     0x0002 /* VS1003 */
+#define VS_SM_RESET         0x0004
+#define VS_SM_OUTOFWAV      0x0008
+#define VS_SM_PDOWN         0x0010
+#define VS_SM_TESTS         0x0020
+#define VS_SM_STREAM        0x0040
+#define VS_SM_SETTOZERO1    0x0080 /* VS1011 */
+#define VS_SM_PLUSV         0x0080 /* VS1003 */
+#define VS_SM_DACT          0x0100
+#define VS_SM_SDIORD        0x0200 /* VS1011 */
+#define VS_SM_SDISHARE      0x0400 /* VS1011 */
+#define VS_SM_SDINEW        0x0800 /* VS1011 */
+#define VS_SM_SETTOZERO2    0x1000 /* VS1011 */
+#define VS_SM_ADPCM         0x1000 /* VS1003 */
+#define VS_SM_SETTOZERO3    0x2000 /* VS1011 */
+#define VS_SM_ADPCM_HP      0x2000 /* VS1003 */
+#define VS_SM_LINE_IN       0x4000 /* VS1003 */
+
+// SCI Status register bits 6-4 contains the ID number of the chip
+#define VS_VS1001           0   /* not supported by this driver */
+#define VS_VS1011           1
+#define VS_VS1011e          2   /* VS1002 also returns this, but is not supported by this driver */
+#define VS_VS1003           3
+#define VS_VS1053           4
+#define VS_VS1033           5
+
+
+// Status of the decoder
+#define VS_STATUS_STOPPED   0
+#define VS_STATUS_RUNNING   1
+#define VS_STATUS_EOF       2
+#define VS_STATUS_EMPTY     4
+
+/*-------------------------------------------------------------------------*/
+/* typedefs & structs                                                      */
+/*-------------------------------------------------------------------------*/
+
+/*-------------------------------------------------------------------------*/
+/* export global variables                                                 */
+/*-------------------------------------------------------------------------*/
+
+/*-------------------------------------------------------------------------*/
+/* export global routines (interface)                                      */
+/*-------------------------------------------------------------------------*/
+extern int VsPlayerInit(void);
+extern int VsPlayerReset(u_short mode);
+extern int VsPlayerSetMode(u_short mode);
+extern int VsPlayerKick(void);
+extern int VsPlayerStop(void);
+extern u_char VsPlayerInterrupts(u_char enable);
+
+extern u_char VsGetStatus(void);
+extern u_short VsMemoryTest(void);
+extern u_short VsGetType(void);
+extern u_short VsGetTypeHex(void);
+extern int VsSetVolume(u_char left, u_char right);
+extern u_short VsGetVolume(void);
+extern int VsBeep(u_char fsin, u_short ms);
+extern int VsBeepStart(u_char fsin);
+extern int VsBeepStartRaw(u_char Raw);
+extern int VsBeepStop(void);
+extern u_short VsRegInfo(u_char reg);
+extern void VsRegWrite(u_char reg, u_short data);
+extern u_short VsStreamValid(void);
+
+
+/*@}*/

+ 115 - 0
watchdog.h

@@ -0,0 +1,115 @@
+#ifndef _watchdog_H
+#define _watchdog_H
+/*
+ *  Copyright STREAMIT BV, 2010.
+ *
+ *  Project             : SIR
+ *  Module              : watchdog
+ *  File name  $Workfile: watchdog.h  $
+ *       Last Save $Date: 2007/01/16 11:13:53  $
+ *             $Revision: 0.1  $
+ *  Creation Date       : 2007/01/16 11:13:53
+ *
+ *  Description         : Watchdog routines for the ATMega128/256
+ *                        Inspired by the arch/xxx/dev/watchdog routines in
+ *                        NutOS 4.2.1 and higher.
+ *
+ */
+
+/*--------------------------------------------------------------------------*/
+/*  Include files                                                           */
+/*--------------------------------------------------------------------------*/
+
+/*--------------------------------------------------------------------------*/
+/*  Constant definitions                                                    */
+/*--------------------------------------------------------------------------*/
+
+/*--------------------------------------------------------------------------*/
+/*  Type declarations                                                       */
+/*--------------------------------------------------------------------------*/
+
+/*--------------------------------------------------------------------------*/
+/*  Global variables                                                        */
+/*--------------------------------------------------------------------------*/
+
+/*--------------------------------------------------------------------------*/
+/*  Global functions                                                        */
+/*--------------------------------------------------------------------------*/
+
+/*!
+ * \brief Start the watch dog timer.
+ *
+ * This function can be used by applications to prevent hang-ups.
+ * The watch dog timer will be automatically enabled on return.
+ *
+ * \param   ms [in] Watch dog time out in milliseconds.
+ *
+ * \return  -
+ *
+ * The following code fragment starts the watch timer with a time out
+ * of 550 milliseconds and restarts it every 500 milliseconds.
+ *
+ * \code
+ * #include <sys/timer.h>
+ * #include "watchdog.h"
+ *
+ * WatchDogStart(550);
+ * for(;;)
+ * {
+ *     WatchDogRestart();
+ *     NutSleep(500);
+ * }
+ *
+ * \endcode
+ */
+extern void WatchDogStart(unsigned long ms);
+
+
+/*!
+ * \brief Restart the watch dog timer.
+ */
+extern void WatchDogRestart(void);
+
+/*!
+ * \brief Disables the watch dog timer.
+ *
+ * Applications should call this function to temporarily disable the
+ * watch dog timer. To re-enable it, call WatchDogEnable().
+ *
+ * \code
+ * #include <dev/watchdog.h>
+ *
+ * WatchDogStart(100, 0);
+ *
+ * //Some code here.
+ *
+ * WatchDogRestart();
+ *
+ * //Some code here.
+ *
+ * WatchDogDisable();
+ *
+ * //Some lengthy code here, like writing to flash memory.
+ *
+ * WatchDogEnable();
+ *
+ * \endcode
+ */
+extern void WatchDogDisable(void);
+
+/*!
+ * \brief Enables the watch dog timer.
+ *
+ * The function can be safely used within nested subroutines.
+ * The watch dog will be enabled only, if this function is called
+ * the same number of times as WatchDogDisable(). If enabled,
+ * the watch dog timer will also have been re-started and the
+ * full time out value is available before another WatchDogRestart()
+ * is required.
+ *
+ * If the watch has not been started by WatchDogStart(), then this
+ * function does nothing.
+ */
+extern void WatchDogEnable(void);
+
+#endif /* _watchdog_H */