diff options
Diffstat (limited to 'utility/demo-fw/include')
-rw-r--r-- | utility/demo-fw/include/DemobinHeader.h | 107 | ||||
-rw-r--r-- | utility/demo-fw/include/dfm_accelerometer.h | 93 | ||||
-rw-r--r-- | utility/demo-fw/include/dfm_button.h | 49 | ||||
-rw-r--r-- | utility/demo-fw/include/dfm_cmd.h | 136 | ||||
-rw-r--r-- | utility/demo-fw/include/dfm_config.h | 38 | ||||
-rw-r--r-- | utility/demo-fw/include/dfm_console.h | 55 | ||||
-rw-r--r-- | utility/demo-fw/include/dfm_dispboxmgr.h | 125 | ||||
-rw-r--r-- | utility/demo-fw/include/dfm_entry.h | 67 | ||||
-rw-r--r-- | utility/demo-fw/include/dfm_fatfs.h | 96 | ||||
-rw-r--r-- | utility/demo-fw/include/dfm_init.h | 70 | ||||
-rw-r--r-- | utility/demo-fw/include/dfm_it.h | 47 | ||||
-rw-r--r-- | utility/demo-fw/include/dfm_lcd_tsd.h | 77 | ||||
-rw-r--r-- | utility/demo-fw/include/dfm_varloc.h | 49 | ||||
-rw-r--r-- | utility/demo-fw/include/fatfs_config.h | 220 |
14 files changed, 1229 insertions, 0 deletions
diff --git a/utility/demo-fw/include/DemobinHeader.h b/utility/demo-fw/include/DemobinHeader.h new file mode 100644 index 0000000..e3d5b5c --- /dev/null +++ b/utility/demo-fw/include/DemobinHeader.h @@ -0,0 +1,107 @@ +/* ----------------------------------------------------------------------------
+ * ATMEL Microcontroller Software Support
+ * ----------------------------------------------------------------------------
+ * Copyright (c) 2008, Atmel Corporation
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * - Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the disclaimer below.
+ *
+ * Atmel's name may not be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
+ * DISCLAIMED. IN NO EVENT SHALL ATMEL 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.
+ * ----------------------------------------------------------------------------
+ */
+
+#ifndef DEMOBINHEADER_H_
+#define DEMOBINHEADER_H_
+
+#include <string.h>
+
+//------------------------------------------------------------------------------
+// Definitions
+//------------------------------------------------------------------------------
+
+#define MAXSCRIPTSTRINGLINE 128
+
+#define MAXSLIDESPERBIN 50
+
+#define MAXLINKLEN 50
+
+#define MAX_LINK_PER_SLIDE 10
+
+#define MAX_DISPBOX_PER_SLIDE 4
+
+#define DEMOSLIDEWIDTH 240
+
+#define DEMOSLIDEHEIGHT 320
+
+#define ClearDemoBINHeader(pHead) memset((pHead), 0xFF, sizeof(DemoBINHeader))
+
+#define ClearSlideINFOHeader(pHead) memset((pHead), 0xFF, sizeof(SlideINFOHeader))
+
+/// ATMEL DEMO BIN tag value
+#define ATMLBINTAG 0x4C4D5441
+
+/// demo bin file header
+typedef struct {
+ unsigned int tag;///demo bin head,'A','T','M','L'
+ unsigned int filesize;///bin file size
+ unsigned int headersize;///headsize including all SlideINFOHeader fields
+ unsigned int slidecount;///slide numbers
+} DemoBINHeader;
+
+typedef struct {
+ ///value are converted from slides script. noted BMP anticlockwise rotated 90 degree
+ unsigned int linkboxbottom;
+ unsigned int linkboxleft;
+ unsigned int linkboxwidth;
+ unsigned int linkboxheight;
+ ///link string
+ char linkstring[MAXLINKLEN];
+}SlideLinkINFO;
+
+typedef struct {
+ ///value are converted from slides script. noted BMP anticlockwise rotated 90 degree
+ unsigned int dispboxbottom;
+ unsigned int dispboxleft;
+ unsigned int dispboxwidth;
+ unsigned int dispboxheight;
+} SlideDispINFO;
+
+typedef struct {
+ //properties for each slide, command string line supported only now.
+ unsigned int propcnt; //numbers of properties
+ char onInitCmds[MAXLINKLEN];
+ char onRefreshCmds[MAXLINKLEN];
+ char onCloseCmds[MAXLINKLEN];
+} SlidePropINFO;
+
+typedef struct {
+ unsigned int slideoffset;
+ unsigned int slidedatalength;
+ unsigned int slidewidth;
+ unsigned int slideheight;
+ unsigned int dispboxcount;//0 means no display box, others mean yes
+ SlideDispINFO dispboxinfo[MAX_DISPBOX_PER_SLIDE];
+ unsigned int linkcount;
+ SlideLinkINFO linkinfo[MAX_LINK_PER_SLIDE];
+ unsigned int propyes;// 0 means no property settings, 1 or others mean yes
+ SlidePropINFO propinfo;
+} SlideINFOHeader;
+
+#endif /// DEMOBINHEADER_H_
diff --git a/utility/demo-fw/include/dfm_accelerometer.h b/utility/demo-fw/include/dfm_accelerometer.h new file mode 100644 index 0000000..9e7a9ab --- /dev/null +++ b/utility/demo-fw/include/dfm_accelerometer.h @@ -0,0 +1,93 @@ +/* ----------------------------------------------------------------------------
+ * ATMEL Microcontroller Software Support
+ * ----------------------------------------------------------------------------
+ * Copyright (c) 2008, Atmel Corporation
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * - Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the disclaimer below.
+ *
+ * Atmel's name may not be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
+ * DISCLAIMED. IN NO EVENT SHALL ATMEL 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.
+ * ----------------------------------------------------------------------------
+ */
+
+//------------------------------------------------------------------------------
+/// \unit
+///
+/// This file contains apis and definitions for tilt sensing.
+///
+//------------------------------------------------------------------------------
+
+#ifndef DV_ACCELEROMETER_H
+#define DV_ACCELEROMETER_H
+
+#include "dfm_entry.h"
+
+#define ACC_SHIFT 0 //!< Accelerometer filtering value
+#define ACC_ZERO (0x7FF >> ACC_SHIFT) //!< Accelerometer 0 value 0x1000/2
+#define ACC_1G (0x223 >> ACC_SHIFT) //!< Accelerometer 1G value 2.09/3.3 * 0x1000 delta 1g
+
+#define ACC_ZERO_X ACC_ZERO
+#define ACC_ZERO_Y ACC_ZERO
+#define ACC_ZERO_Z ACC_ZERO
+
+#define ACC_AMPLITUDE_UPPER (ACC_1G*ACC_1G*1.01)
+#define ACC_AMPLITUDE_LOWER (ACC_1G*ACC_1G*0.99)
+
+#define DV_Accelerometer_Unchanged 0 //!< default unchanged direction
+#define DV_Accelerometer_normal_up 1 //!< normal up
+#define DV_Accelerometer_up 2 //!< up
+#define DV_Accelerometer_down 3 //!< down
+#define DV_Accelerometer_left 4 //!< left
+#define DV_Accelerometer_right 5 //!< right
+
+#define DV_Accelerometer_up_right 6 //!< up and right
+#define DV_Accelerometer_up_left 7 //!< up and left
+#define DV_Accelerometer_down_left 8 //!< down and left
+#define DV_Accelerometer_down_right 9 //!< down and right
+
+#define DIR_UNCHANGED 0
+#define DIR_HORIZIONTAL_UP 1
+#define DIR_HORIZIONTAL_DOWN 2
+#define DIR_VERTICAL_UP 3
+#define DIR_VERTICAL_DOWN 4
+
+typedef struct {
+ int x;
+ int y;
+ int z;
+} xyz_t;
+
+
+typedef struct {
+ xyz_t m; //!< immediate acceleration
+ xyz_t k; //!< calibration basis
+ xyz_t ak; //!< acceleration difference
+ } acc_t;
+
+extern int gDir;
+
+extern TInputEntry gAccEntry ;
+extern unsigned int gLcdRefreshFlag;
+extern int DV_ACCELEROMETER_Init(void);
+extern void DV_Accelerometer_Turn();
+extern int DV_Check_AccStatus();
+extern void DV_ACCELEROMETER_Measure(void);
+
+#endif
diff --git a/utility/demo-fw/include/dfm_button.h b/utility/demo-fw/include/dfm_button.h new file mode 100644 index 0000000..e109405 --- /dev/null +++ b/utility/demo-fw/include/dfm_button.h @@ -0,0 +1,49 @@ +/* ----------------------------------------------------------------------------
+ * ATMEL Microcontroller Software Support
+ * ----------------------------------------------------------------------------
+ * Copyright (c) 2008, Atmel Corporation
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * - Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the disclaimer below.
+ *
+ * Atmel's name may not be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
+ * DISCLAIMED. IN NO EVENT SHALL ATMEL 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.
+ * ----------------------------------------------------------------------------
+ */
+
+#ifndef __DFM_BUTTON_H_
+#define __DFM_BUTTON_H_
+
+#include "dfm_lcd_tsd.h"
+#include "dfm_entry.h"
+
+// input entry for register
+extern TInputEntry gButtonEntry;
+
+//draw a focus circle on current active icon
+int BTN_ShowPrompt();
+
+//check if button is pressed
+unsigned int BTN_CommandIsReady();
+
+//get command string for pressed button
+const char * BTN_GetCommand();
+
+#endif //end of __DFM_JOYSTICK_H_
+
diff --git a/utility/demo-fw/include/dfm_cmd.h b/utility/demo-fw/include/dfm_cmd.h new file mode 100644 index 0000000..c1bde68 --- /dev/null +++ b/utility/demo-fw/include/dfm_cmd.h @@ -0,0 +1,136 @@ +/* ----------------------------------------------------------------------------
+ * ATMEL Microcontroller Software Support
+ * ----------------------------------------------------------------------------
+ * Copyright (c) 2008, Atmel Corporation
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * - Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the disclaimer below.
+ *
+ * Atmel's name may not be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
+ * DISCLAIMED. IN NO EVENT SHALL ATMEL 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.
+ * ----------------------------------------------------------------------------
+ */
+
+#ifndef __DFM_CMD_H
+#define __DFM_CMD_H
+
+//------------------------------------------------------------------------------
+// Definitions
+//------------------------------------------------------------------------------
+
+///limits definition
+#define MAX_LIST_GROUP 100
+/// max active groups
+#define MAX_ACT_GROUP 10
+/// max active commands
+#define MAX_ACT_CMD 255
+/// max command arguments
+#define MAX_CMD_ARGS 10
+/// max command number concatenated in one line
+#define MAX_MULTI_CMD 5
+
+///define NULL
+#ifndef NULL
+#define NULL 0
+#endif
+
+/// structure for describe function
+struct _FStruct {
+ char *pGrpName;
+ char *pCmdName;
+ int (*cmdProcess)(int argc, char **argv);
+#ifdef USAGE_HELP
+ char *pUsage;
+#endif
+};
+
+typedef struct _FStruct FStruct;
+
+
+/// max group numbers allowed to build in
+#define MAX_BUILDIN_GROUP 32
+
+/// section to put all commands
+#define GSHELL_SECTION ".gs_section"
+
+/// system group name, will be always active at the first priority
+#define SYS_GROUP "default"
+
+/// section macro definition
+#if defined(__GNUC__)
+
+#define CMD_OBJ const
+#define INSECTION(secname) __attribute__ ((unused, section(secname)))
+
+#elif defined(__ICCARM__)
+
+#pragma section = GSHELL_SECTION
+
+#define CMD_OBJ __root const
+#define INSECTION(secname) @ secname
+
+#else
+
+#error "unsupported tool chain"
+
+#endif
+
+
+/// usage help compiled
+#ifdef USAGE_HELP
+
+#define DFM_CMD(cmdString, procFunc, hlpString, grpName) \
+ CMD_OBJ FStruct GS_Func_##cmdString INSECTION(GSHELL_SECTION) = {\
+ grpName,\
+ #cmdString,\
+ procFunc,\
+ hlpString\
+ }
+
+#else
+
+#define DFM_CMD(cmdString, procFunc, hlpString, grpName) \
+ CMD_OBJ FStruct GS_Func_##cmdString INSECTION(GSHELL_SECTION)= {\
+ grpName,\
+ #cmdString,\
+ procFunc,\
+ }
+
+#endif
+
+//------------------------------------------------------------------------------
+// Exported Functions
+//------------------------------------------------------------------------------
+
+// Parse a command string and search in active groups, run if matched
+int ParseAndRunCmd(const char * pCmdString);
+
+// Parse a string line containing multi commands and arguments, then
+// search in active groups, run if matched
+int ParseAndRunMultiCmds(const char * pMultiCmdStr);
+
+//------------------------------------------------------------------------------
+/// Run batch command
+//------------------------------------------------------------------------------
+int RunScript(int argc, char *argv[]);
+
+// // Main portal function of gshell
+// void Gshell_MainProcess(int argc, char *argv[]);
+
+#endif /// end of __DFM_CMD_H
diff --git a/utility/demo-fw/include/dfm_config.h b/utility/demo-fw/include/dfm_config.h new file mode 100644 index 0000000..874d7c4 --- /dev/null +++ b/utility/demo-fw/include/dfm_config.h @@ -0,0 +1,38 @@ +#ifndef __DFM_CONFIG_H__
+#define __DFM_CONFIG_H__
+
+//enable fatfs on SDCard
+#define DFM_FATFS_SDCARD
+
+//enable fatfs on Nandflash
+#define DFM_FATFS_NANDFLASH
+
+//enable fatfs on SDRAM
+//#define DFM_FATFS_SDRAM
+
+//enable LCD and touchscreen
+#define USE_LCD_TSD
+
+//define file buffer size, used to read bitmap data
+//note: this config make var relocated to PSRAM,so size is ok.
+#define FILE_BUF_SIZE 0x40000U
+
+//enable interrupt chain management
+#define USE_IT_CHAIN_MGR
+
+//LCD controller
+#define LCDC_HX8347
+
+#ifndef LCDSLIDEIMAGEFILE
+#define LCDSLIDEIMAGEFILE "sam3demo.bin"
+#define LCDSLIDEVIMAGEFILE "SamDEMOV.bin"
+#endif
+
+//enable variable relocation
+#define VAR_RELOCATION
+
+//variable relocation memory base
+#define RELOC_VAR_MEM_BASE BOARD_EBI_PSRAM
+
+#endif // end of __DFM_CONFIG_H__
+
diff --git a/utility/demo-fw/include/dfm_console.h b/utility/demo-fw/include/dfm_console.h new file mode 100644 index 0000000..39935ef --- /dev/null +++ b/utility/demo-fw/include/dfm_console.h @@ -0,0 +1,55 @@ +/* ----------------------------------------------------------------------------
+ * ATMEL Microcontroller Software Support
+ * ----------------------------------------------------------------------------
+ * Copyright (c) 2008, Atmel Corporation
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * - Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the disclaimer below.
+ *
+ * Atmel's name may not be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
+ * DISCLAIMED. IN NO EVENT SHALL ATMEL 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.
+ * ----------------------------------------------------------------------------
+ */
+
+#ifndef __DBGU_CONSOLE_H
+#define __DBGU_CONSOLE_H
+
+#include "dfm_entry.h"
+
+#define DBGU_CMDBUFSIZE 256
+
+#ifndef GS_SHELL_PROMPT
+#define GS_SHELL_PROMPT "DFM_DBGU:>"
+#endif
+
+extern TInputEntry gDBGUEntry;
+
+//Get input command and argument string from console
+//extern int DBGU_GetCmdString(const char *const prompt);
+
+//Show DBGU console prompt information
+extern int DBGU_ShowPrompt();
+
+//Check if command is ready on DBGU console
+extern unsigned int DBGU_CommandIsReady();
+
+//Get the pointer to DBGU console input buffer
+extern const char * DBGU_GetCommand();
+
+#endif
diff --git a/utility/demo-fw/include/dfm_dispboxmgr.h b/utility/demo-fw/include/dfm_dispboxmgr.h new file mode 100644 index 0000000..9920eed --- /dev/null +++ b/utility/demo-fw/include/dfm_dispboxmgr.h @@ -0,0 +1,125 @@ +/* ----------------------------------------------------------------------------
+ * ATMEL Microcontroller Software Support
+ * ----------------------------------------------------------------------------
+ * Copyright (c) 2008, Atmel Corporation
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * - Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the disclaimer below.
+ *
+ * Atmel's name may not be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
+ * DISCLAIMED. IN NO EVENT SHALL ATMEL 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.
+ * ----------------------------------------------------------------------------
+ */
+
+#ifndef __LCD_DISPBOX_H_
+#define __LCD_DISPBOX_H_
+
+#include "DemobinHeader.h"
+
+//------------------------------------------------------------------------------
+// Definitions
+//------------------------------------------------------------------------------
+
+///display margin in pixel in dispbox area
+#define DISPMARGIN 2
+///line distance in pixel in dispbox area
+#define LINEDISTANCE 2
+///char distance in pixel, actually this is used to meet API LIB DrawString(...)
+#define CHARDISTANCE 2
+///status of enable display box
+#define DISPBOX_ENABLE 1
+///status of disable display box
+#define DISPBOX_DISABLE 0
+
+typedef struct _DISPBOX_ZONE {
+ /// display box top
+ unsigned int top;
+ /// display box left
+ unsigned int left;
+ /// display box width
+ unsigned int width;
+ /// display box height
+ unsigned int height;
+} TDISPBOX_ZONE;
+
+typedef struct _DISPBOX_INFO {
+ unsigned int dispBoxEnable;
+ TDISPBOX_ZONE dispBoxZone;
+ unsigned int bgColor;// background color
+ unsigned int fontColor;// font color of display box
+ unsigned int xCursor;
+ unsigned int yCursor;
+} TDISPBOX_INFO;
+
+typedef struct _DISPBOX_MGR {
+ unsigned int dispBoxCount;
+ TDISPBOX_INFO dispBoxInfo[MAX_DISPBOX_PER_SLIDE];
+} TDISPBOX_MGR;
+
+//------------------------------------------------------------------------------
+// Exported functions
+//------------------------------------------------------------------------------
+
+//set display box position info
+extern void SetDispBoxPos(
+ unsigned int dispBoxID,
+ unsigned int enabledispbox,
+ unsigned int top,
+ unsigned int left,
+ unsigned int width,
+ unsigned int height);
+
+//Draw a string in display box with
+extern void DrawStringInDispBox(
+ // lcd frame buffer address
+ void *pBuffer,
+ // display box ID, starting from 1
+ unsigned int dispBoxID,
+ //pointer to string for show
+ const char *pStr,
+ //display string font color,
+ unsigned int fontColor,
+ //display string background color, 0xFFFFFFFF means no need to set bgColor
+ unsigned int bgColor,
+ //flag for scroll way, current only support 'clear or not clear display box'
+ //when display string reach end and roll back to show.
+ //0 means clear, 1 means don't clear.
+ unsigned int scrollFlag);
+
+//Draw a string in display box with default font color
+extern void DrawStrInDispBoxDefault(void *pBuffer, unsigned int dispBoxID, const char *pStr);
+
+//Draw a string in display box with default font and background color
+//if scroll back, don't clear
+void DrawStrInDispBoxScrollNoClear(void *pBuffer, unsigned int dispBoxID, const char *pStr);
+
+//clear display box zone with 'color'
+extern void ClearDispBoxZoneColor(unsigned int dispBoxID, unsigned int color);
+
+//Clear display box with default background color
+extern void ClearDispBoxZoneDefault(unsigned int dispBoxID);
+
+//disable display box
+extern void DisableDispBox(unsigned int dispBoxID);
+
+//enable display box
+extern void EnableDispBox(unsigned int dispBoxID);
+
+#endif
+
diff --git a/utility/demo-fw/include/dfm_entry.h b/utility/demo-fw/include/dfm_entry.h new file mode 100644 index 0000000..fcfab64 --- /dev/null +++ b/utility/demo-fw/include/dfm_entry.h @@ -0,0 +1,67 @@ +/* ----------------------------------------------------------------------------
+ * ATMEL Microcontroller Software Support
+ * ----------------------------------------------------------------------------
+ * Copyright (c) 2008, Atmel Corporation
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * - Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the disclaimer below.
+ *
+ * Atmel's name may not be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
+ * DISCLAIMED. IN NO EVENT SHALL ATMEL 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.
+ * ----------------------------------------------------------------------------
+ */
+
+#ifndef __DFM_ENTRY_H_
+#define __DFM_ENTRY_H_
+
+//structure for command queue
+typedef struct _tCmdQueue {
+ const char * command;
+ struct _tCmdQueue * next;
+} TCmdQueue;
+
+//structure for prompt registry definition
+typedef struct _tInputEntry {
+ unsigned int readyFlag;
+ TCmdQueue CmdElement;
+ int (*Prompt)(void);
+ unsigned int (*CommandIsReady)(void);
+ const char *(*GetCommand)(void);
+ struct _tInputEntry *next;
+} TInputEntry;
+
+
+
+//Register input entry
+extern int RegisterInputEntry(TInputEntry *pEntryStruct);
+
+//Show prompt registered
+extern int ShowPrompt();
+
+//Check if any command is ready
+extern unsigned int CommandIsReady();
+
+//Get command queue
+extern TCmdQueue * GetCommandQueue();
+
+//Run command queue
+extern int RunCommandQueue(TCmdQueue *pCmdQueue);
+
+#endif // end of __DFM_ENTRY_H_
+
diff --git a/utility/demo-fw/include/dfm_fatfs.h b/utility/demo-fw/include/dfm_fatfs.h new file mode 100644 index 0000000..3803d0c --- /dev/null +++ b/utility/demo-fw/include/dfm_fatfs.h @@ -0,0 +1,96 @@ +/* ----------------------------------------------------------------------------
+ * ATMEL Microcontroller Software Support
+ * ----------------------------------------------------------------------------
+ * Copyright (c) 2008, Atmel Corporation
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * - Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the disclaimer below.
+ *
+ * Atmel's name may not be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
+ * DISCLAIMED. IN NO EVENT SHALL ATMEL 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.
+ * ----------------------------------------------------------------------------
+ */
+
+#ifndef __DFM_FATFS_H__
+#define __DFM_FATFS_H__
+
+#if defined(PINS_NANDFLASH)
+#include <memories/MEDNandFlash.h>
+#include <memories/nandflash/RawNandFlash.h>
+#include <memories/nandflash/TranslatedNandFlash.h>
+#endif
+
+#include "fatfs_config.h"
+#include "dfm_config.h"
+#include <usb/device/massstorage/MSDLun.h>
+#include <pio/pio.h>
+#include "Media.h"
+
+//Assign storage drive name
+#if _FS_TINY == 0
+#define SDCARD_ROOT_DIRECTORY "0:"
+#define NAND_ROOT_DIRECTORY "1:"
+#else
+#define SDCARD_ROOT_DIRECTORY ""
+#define NAND_ROOT_DIRECTORY ""
+#endif
+
+#if defined(at91cap9stk)
+#define MCI_ID 1 //no connector for MCIO/SPI0
+#else
+#define MCI_ID 0
+#endif
+
+#if defined(PINS_NANDFLASH)
+/// Pins used to access to nandflash.
+extern const Pin gpPinsNf[];// = {PINS_NANDFLASH};
+/// Nandflash device structure.
+extern struct TranslatedNandFlash gTranslatedNf;
+/// Address for transferring command bytes to the nandflash.
+extern unsigned int gNFCmdBytesAddr;// = BOARD_NF_COMMAND_ADDR;
+/// Address for transferring address bytes to the nandflash.
+extern unsigned int gNFAddrBytesAddr;// = BOARD_NF_ADDRESS_ADDR;
+/// Address for transferring data bytes to the nandflash.
+extern unsigned int gNFDataBytesAddr;// = BOARD_NF_DATA_ADDR;
+/// Nandflash chip enable pin.
+extern const Pin gNFCePin;// = BOARD_NF_CE_PIN;
+/// Nandflash ready/busy pin.
+extern const Pin gNFRbPin;// = BOARD_NF_RB_PIN;
+#endif
+
+///// Maximum number of LUNs which can be defined.
+///// (Logical drive = physical drive = medium number)
+#define MAX_LUNS 3
+
+/// Size of one block in bytes.
+#define BLOCK_SIZE 512
+
+/// Size of the reserved Nand Flash (4M)
+#define NF_RESERVE_SIZE (4*1024*1024)
+
+/// Size of the managed Nand Flash (128M)
+#define NF_MANAGED_SIZE (128*1024*1024)
+
+/// Size of the MSD IO buffer in bytes (6K, more the better).
+#define MSD_BUFFER_SIZE (12*BLOCK_SIZE)
+
+extern void ConfigureNandFlashEBI(unsigned int mck);
+
+#endif // end of __DFM_FATFS_H__
+
diff --git a/utility/demo-fw/include/dfm_init.h b/utility/demo-fw/include/dfm_init.h new file mode 100644 index 0000000..5e63318 --- /dev/null +++ b/utility/demo-fw/include/dfm_init.h @@ -0,0 +1,70 @@ +/* ----------------------------------------------------------------------------
+ * ATMEL Microcontroller Software Support
+ * ----------------------------------------------------------------------------
+ * Copyright (c) 2008, Atmel Corporation
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * - Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the disclaimer below.
+ *
+ * Atmel's name may not be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
+ * DISCLAIMED. IN NO EVENT SHALL ATMEL 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.
+ * ----------------------------------------------------------------------------
+ */
+
+#ifndef __DFM_INIT_
+#define __DFM_INIT_
+
+//struct definition for init interface
+typedef struct _t_init {
+ unsigned int initlvl;
+ int (*pfInitFunc)(void);
+} T_INIT;
+
+
+#if defined(__GNUC__) //GNU C compiler, Keil also supported if --gnu is defined in CFLAG
+
+#define OBJ_HEAD const
+#define INSECTION(secname) __attribute__ ((unused, section(secname)))
+
+#elif defined(__ICCARM__) //ICCARM compiler
+
+#pragma section = ".gs_initsection"
+
+#define OBJ_HEAD __root const
+#define INSECTION(secname) @ secname
+
+#else
+
+/// current only GNUC(keil MDK), IAR EWARM compiler are supported!
+#error "unsupported tool chain"
+
+#endif
+
+/// define a general macro for init function operation management
+#define DFM_INIT(initlvl, initFunc) \
+ OBJ_HEAD T_INIT _gs_init_##initFunc##initlvl INSECTION(".gs_initsection") = {\
+ initlvl, \
+ initFunc\
+ }
+
+//run all init handler from starting from level 1
+unsigned int RunAllInit();
+
+#endif
+
diff --git a/utility/demo-fw/include/dfm_it.h b/utility/demo-fw/include/dfm_it.h new file mode 100644 index 0000000..e23476d --- /dev/null +++ b/utility/demo-fw/include/dfm_it.h @@ -0,0 +1,47 @@ +/* ----------------------------------------------------------------------------
+ * ATMEL Microcontroller Software Support
+ * ----------------------------------------------------------------------------
+ * Copyright (c) 2008, Atmel Corporation
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * - Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the disclaimer below.
+ *
+ * Atmel's name may not be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
+ * DISCLAIMED. IN NO EVENT SHALL ATMEL 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.
+ * ----------------------------------------------------------------------------
+ */
+
+#ifndef __DFM_IT_H_
+#define __DFM_IT_H_
+
+#ifndef NULL
+#define NULL 0
+#endif
+
+typedef struct _DFM_ItServList {
+ unsigned int itID;
+ void (*ItHandler)(void);
+ struct _DFM_ItServList * next;
+} TDFM_ItServList;
+
+int DFM_RegisterItHandler(TDFM_ItServList *pItHandler);
+
+int DFM_UnRegisterItHandler(TDFM_ItServList *pItHandler);
+
+#endif
diff --git a/utility/demo-fw/include/dfm_lcd_tsd.h b/utility/demo-fw/include/dfm_lcd_tsd.h new file mode 100644 index 0000000..d37e4fc --- /dev/null +++ b/utility/demo-fw/include/dfm_lcd_tsd.h @@ -0,0 +1,77 @@ +/* ----------------------------------------------------------------------------
+ * ATMEL Microcontroller Software Support
+ * ----------------------------------------------------------------------------
+ * Copyright (c) 2008, Atmel Corporation
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * - Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the disclaimer below.
+ *
+ * Atmel's name may not be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
+ * DISCLAIMED. IN NO EVENT SHALL ATMEL 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.
+ * ----------------------------------------------------------------------------
+ */
+
+#ifndef __DFM_LCD_TSD_H__
+#define __DFM_LCD_TSD_H__
+
+#include "dfm_entry.h"
+#include "DemobinHeader.h"
+
+//for LCD prompt register entry
+extern TInputEntry gLCDEntry;
+
+//for change of display slide on lcd
+extern unsigned short gActiveSlideIndex;
+
+#define GLOBALSLIDEINFO
+
+#if defined(GLOBALSLIDEINFO)
+extern SlideINFOHeader gActiveSlideHeader;
+#endif
+
+/// Get link string from link index on active slide
+extern char * GetLinkStrFromActiveSlide(unsigned int linkIdx);
+
+// Show pic on LCD as prompt
+extern int LCD_ShowPrompt();
+
+// Check if hotzones have been hit on touchscreen
+extern unsigned int TSD_CommandIsReady();
+
+// Get hotzone command hyperlink string
+extern const char * TSD_GetCommand();
+
+// Set LCD fresh show flag
+extern void LCD_SetRefreshFlag();
+
+// Clear LCD fresh show flag
+extern void LCD_ClearRefreshFlag();
+
+// Get last pen press position
+extern void TSD_GetPenLastPosition(unsigned int *pX, unsigned int *pY);
+
+/// Set touched flag
+void TSD_SetTouched(void);
+/// Clear touched flag
+void TSD_ClearTouched(void);
+/// Get touched flag
+unsigned char TSD_GetTouched(void);
+
+#endif
+
diff --git a/utility/demo-fw/include/dfm_varloc.h b/utility/demo-fw/include/dfm_varloc.h new file mode 100644 index 0000000..48c118d --- /dev/null +++ b/utility/demo-fw/include/dfm_varloc.h @@ -0,0 +1,49 @@ +#ifndef __DFM_VARLOC_H_
+#define __DFM_VARLOC_H
+
+#include "dfm_fatfs.h"
+#include "dfm_config.h"
+
+// relocation variables that size is bigger to space start from RELOC_VAR_MEM_BASE
+#ifdef VAR_RELOCATION
+
+ #if defined(__ICCARM__)
+
+ #define RLOC_OBJ __no_init
+ #define _AT(addr) @ (addr)
+
+ #elif defined(__CC_ARM)
+
+ #define RLOC_OBJ
+ #define _AT(addr) __attribute__ ((at(_addr)))
+
+ #elif defined(__GNUC__)
+
+ #define RLOC_OBJ
+ #define _AT(addr)
+ #else
+ #error "Unsupported tool chain"
+ #endif
+
+#else
+ #define RLOC_OBJ
+ #define _AT(addr)
+#endif
+
+#if defined(VAR_RELOCATION) && !defined(RELOC_VAR_MEM_BASE)
+ #error "Enable variables relocation, but not give RELOC_VAR_MEM_BASE"
+#endif
+
+#define FATFS_MEDIA_OBJ_ADDR RELOC_VAR_MEM_BASE
+#define FATFS_SDCARD_OBJ_ADDR (FATFS_MEDIA_OBJ_ADDR + sizeof(Media) * MAX_LUNS)
+#define FATFS_NANDFLASH_OBJ_ADDR (FATFS_SDCARD_OBJ_ADDR + sizeof(FATFS))
+#define NANDFLASH_TRANS_TAB_ADDR (FATFS_NANDFLASH_OBJ_ADDR + sizeof(FATFS))
+#define ACTIVESLIDE_INFOHEAD_ADDR (NANDFLASH_TRANS_TAB_ADDR + sizeof(struct TranslatedNandFlash))
+#define FILE_BUFFER_ADDR (ACTIVESLIDE_INFOHEAD_ADDR + sizeof(SlideINFOHeader))
+
+#define MSDD_LUN_OBJ_ADDR (FILE_BUFFER_ADDR + FILE_BUF_SIZE)
+#define MSDD_BUF_OBJ_ADDR (MSDD_LUN_OBJ_ADDR + sizeof(MSDLun) * MAX_LUNS)
+#define RELOC_VAR_MEM_END (MSDD_BUF_OBJ_ADDR + MSD_BUFFER_SIZE)
+#define RELOC_VAR_MEM_SIZE (RELOC_VAR_MEM_END - RELOC_VAR_MEM_BASE)
+
+#endif // end of _DFM_VARLOC_H_
diff --git a/utility/demo-fw/include/fatfs_config.h b/utility/demo-fw/include/fatfs_config.h new file mode 100644 index 0000000..45d0bba --- /dev/null +++ b/utility/demo-fw/include/fatfs_config.h @@ -0,0 +1,220 @@ +/* ----------------------------------------------------------------------------
+ * ATMEL Microcontroller Software Support
+ * ----------------------------------------------------------------------------
+ * Copyright (c) 2008, Atmel Corporation
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * - Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the disclaimer below.
+ *
+ * Atmel's name may not be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
+ * DISCLAIMED. IN NO EVENT SHALL ATMEL 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.
+ * ----------------------------------------------------------------------------
+ */
+
+#ifndef FATFS_CONFIG_H
+#define FATFS_CONFIG_H
+#include "integer.h"
+
+/*-----------------------------------------------------------------------*/
+/* Correspondence between drive number and physical drive */
+/* Note that Tiny-FatFs supports only single drive and always */
+/* accesses drive number 0. */
+
+#define DRV_MMC 0
+#define DRV_SDRAM 2
+#define DRV_ATA 4
+#define DRV_USB 3
+#define DRV_NAND 1
+
+
+#define SECTOR_SIZE_DEFAULT 512
+#define SECTOR_SIZE_SDRAM 512
+#define SECTOR_SIZE_SDCARD 512
+
+/*---------------------------------------------------------------------------/
+/ FatFs Configuration Options
+/
+/ CAUTION! Do not forget to make clean the project after any changes to
+/ the configuration options.
+/
+/----------------------------------------------------------------------------*/
+#define _FFCONFIG 0x007E
+
+/*---------------------------------------------------------------------------/
+/ Function and Buffer Configurations
+/----------------------------------------------------------------------------*/
+
+#define _FS_TINY 0 /* 0 or 1 */
+/* When _FS_TINY is set to 1, FatFs uses the sector buffer in the file system
+/ object instead of the sector buffer in the individual file object for file
+/ data transfer. This reduces memory consumption 512 bytes each file object. */
+
+#if _FS_TINY != 1
+#define _FS_READONLY 0
+/* Setting _FS_READONLY to 1 defines read only configuration. This removes
+/ writing functions, f_write, f_sync, f_unlink, f_mkdir, f_chmod, f_rename,
+/ f_truncate and useless f_getfree. */
+#else
+#define _FS_READONLY 1
+/* Setting _FS_READONLY to 1 defines read only configuration. This removes
+/ writing functions, f_write, f_sync, f_unlink, f_mkdir, f_chmod, f_rename,
+/ f_truncate and useless f_getfree. */
+#endif
+
+#define _FS_MINIMIZE 0 /* 0, 1, 2 or 3 */
+/* The _FS_MINIMIZE option defines minimization level to remove some functions.
+/
+/ 0: Full function.
+/ 1: f_stat, f_getfree, f_unlink, f_mkdir, f_chmod, f_truncate and f_rename
+/ are removed.
+/ 2: f_opendir and f_readdir are removed in addition to level 1.
+/ 3: f_lseek is removed in addition to level 2. */
+
+
+#define _USE_STRFUNC 0 /* 0, 1 or 2 */
+/* To enable string functions, set _USE_STRFUNC to 1 or 2. */
+
+
+#define _USE_MKFS 1 /* 0 or 1 */
+/* To enable f_mkfs function, set _USE_MKFS to 1 and set _FS_READONLY to 0 */
+
+
+#define _USE_FORWARD 0 /* 0 or 1 */
+/* To enable f_forward function, set _USE_FORWARD to 1 and set _FS_TINY to 1. */
+
+
+
+/*---------------------------------------------------------------------------/
+/ Locale and Namespace Configurations
+/----------------------------------------------------------------------------*/
+
+#define _CODE_PAGE 850
+/* The _CODE_PAGE specifies the OEM code page to be used on the target system.
+/ Incorrect setting of the code page can cause a file open failure.
+/
+/ 932 - Japanese Shift-JIS (DBCS, OEM, Windows)
+/ 936 - Simplified Chinese GBK (DBCS, OEM, Windows)
+/ 949 - Korean (DBCS, OEM, Windows)
+/ 950 - Traditional Chinese Big5 (DBCS, OEM, Windows)
+/ 1250 - Central Europe (Windows)
+/ 1251 - Cyrillic (Windows)
+/ 1252 - Latin 1 (Windows)
+/ 1253 - Greek (Windows)
+/ 1254 - Turkish (Windows)
+/ 1255 - Hebrew (Windows)
+/ 1256 - Arabic (Windows)
+/ 1257 - Baltic (Windows)
+/ 1258 - Vietnam (OEM, Windows)
+/ 437 - U.S. (OEM)
+/ 720 - Arabic (OEM)
+/ 737 - Greek (OEM)
+/ 775 - Baltic (OEM)
+/ 850 - Multilingual Latin 1 (OEM)
+/ 858 - Multilingual Latin 1 + Euro (OEM)
+/ 852 - Latin 2 (OEM)
+/ 855 - Cyrillic (OEM)
+/ 866 - Russian (OEM)
+/ 857 - Turkish (OEM)
+/ 862 - Hebrew (OEM)
+/ 874 - Thai (OEM, Windows)
+/ 1 - ASCII only (Valid for non LFN cfg.)
+*/
+
+
+#define _USE_LFN 0 /* 0, 1 or 2 */
+#define _MAX_LFN 255 /* Maximum LFN length to handle (12 to 255) */
+/* The _USE_LFN option switches the LFN support.
+/
+/ 0: Disable LFN. _MAX_LFN and _LFN_UNICODE have no effect.
+/ 1: Enable LFN with static working buffer on the bss. NOT REENTRANT.
+/ 2: Enable LFN with dynamic working buffer on the STACK.
+/
+/ The LFN working buffer occupies (_MAX_LFN + 1) * 2 bytes. When enable LFN,
+/ two Unicode handling functions ff_convert() and ff_wtoupper() must be added
+/ to the project. */
+
+
+#define _LFN_UNICODE 0 /* 0 or 1 */
+/* To switch the character code set on FatFs API to Unicode,
+/ enable LFN feature and set _LFN_UNICODE to 1.
+*/
+
+
+#define _FS_RPATH 0 /* 0 or 1 */
+/* When _FS_RPATH is set to 1, relative path feature is enabled and f_chdir,
+/ f_chdrive function are available.
+/ Note that output of the f_readdir fnction is affected by this option. */
+
+
+
+/*---------------------------------------------------------------------------/
+/ Physical Drive Configurations
+/----------------------------------------------------------------------------*/
+
+#define _DRIVES 2
+/* Number of volumes (logical drives) to be used. */
+
+
+#define _MAX_SS 512 /* 512, 1024, 2048 or 4096 */
+/* Maximum sector size to be handled.
+/ Always set 512 for memory card and hard disk but a larger value may be
+/ required for floppy disk (512/1024) and optical disk (512/2048).
+/ When _MAX_SS is larger than 512, GET_SECTOR_SIZE command must be implememted
+/ to the disk_ioctl function. */
+
+
+#define _MULTI_PARTITION 0 /* 0 or 1 */
+/* When _MULTI_PARTITION is set to 0, each volume is bound to the same physical
+/ drive number and can mount only first primaly partition. When it is set to 1,
+/ each volume is tied to the partitions listed in Drives[]. */
+
+
+
+/*---------------------------------------------------------------------------/
+/ System Configurations
+/----------------------------------------------------------------------------*/
+
+#define _WORD_ACCESS 0 /* 0 or 1 */
+
+/* The _WORD_ACCESS option defines which access method is used to the word
+/ data on the FAT volume.
+/
+/ 0: Byte-by-byte access. Always compatible with all platforms.
+/ 1: Word access. Do not choose this unless following condition is met.
+/
+/ When the byte order on the memory is big-endian or address miss-aligned
+/ word access results incorrect behavior, the _WORD_ACCESS must be set to 0.
+/ If it is not the case, the value can also be set to 1 to improve the
+/ performance and code size. */
+
+
+#define _FS_REENTRANT 0 /* 0 or 1 */
+#define _FS_TIMEOUT 1000 /* Timeout period in unit of time ticks */
+#define _SYNC_t HANDLE /* O/S dependent type of sync object. e.g. HANDLE, OS_EVENT*, ID and etc.. */
+/* The _FS_REENTRANT option switches the reentrancy of the FatFs module.
+/
+/ 0: Disable reentrancy. _SYNC_t and _FS_TIMEOUT have no effect.
+/ 1: Enable reentrancy. Also user provided synchronization handlers,
+/ ff_req_grant, ff_rel_grant, ff_del_syncobj and ff_cre_syncobj
+/ function must be added to the project. */
+
+#include "diskio.h"
+#include "ff.h"
+
+#endif // FATFS_CONFIG_H
|