完成flash的擦除以及写入的验证

This commit is contained in:
forbelief 2016-04-22 14:10:43 +08:00
parent 0cb04e9b90
commit 168e97ebe8
81 changed files with 13873 additions and 814 deletions

View file

@ -16,10 +16,14 @@
/*
* µ÷ÊÔÄ£¿é
* 8266
*/
#define DEBUG_UARTX UART1
#define WIFI_UARTX UART0 // PTA1,PTA2
/*
* ,
*/
#define DEBUG_UARTX UART1 // PTC3,PTC4
/*
@ -34,10 +38,10 @@
#define MR_KEY_PINX PTE30
#define MB_KEY_PINX PTA16
#define MUVB_KEY_PINX PTD6
// knob用必须是PTA或PTD端口的
#define KNOB_A_PINX PTD6
#define KNOB_B_PINX PTD7
#define KNOB_KEY_PINX PTD4 // PTD5
#define KNOB_KEY_PINX PTD4
@ -54,5 +58,17 @@
#define DS1302_CLK_PINX PTB1
#define DS1302_IO_PINX PTB0
/*
*
*
*/
#define LGRED_PINX PTC12
#define LGBLUE_PINX PTC13
#define LGUVB_PINX PTC15
#define WATER_PINX PTC16
/*
* led控制
*/
#endif // CONFIG_H

View file

@ -0,0 +1,85 @@
/****************************************************************************
Copyright (c) 2013-2014 Freescale Semiconductor, Inc.
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 following disclaimer.
* 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.
* Neither the name of the <organization> 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 <COPYRIGHT HOLDER> 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.
*****************************************************************************
*************************************************************************
* *
* Standard Software Flash Driver For FTFL *
* *
* FILE NAME : demo_cfg.h *
* DATE : April 08, 2014 *
* *
* AUTHOR : FPT Team *
* E-mail : r56611@freescale.com *
* *
*************************************************************************/
/************************** CHANGES *************************************
0.1.0 04.23.2013 FPT Team Initial Version
1.0.0 12.25.2013 FPT Team Finalize to version 1.0.0
1.0.2 08.04.2014 FPT Team Update to follow SDK convention(MISRA-C)
*************************************************************************/
#ifndef FLASH_H
#define FLASH_H
#include "common.h"
#define BUFFER_SIZE_BYTE 0x100U
#define EE_ENABLE 0x00U
#define RAM_ENABLE 0xFFU
#define DEBUGENABLE 0x00U
#define PSECTOR_SIZE 0x00000400U /* 1 KB size */
#define DSECTOR_SIZE 0x00000000U
/* FTFL module base */
#define FTFx_REG_BASE 0x40020000U
#define PFLASH_BLOCK_BASE 0x00000000U
#define DEFLASH_BLOCK_BASE 0xFFFFFFFFU
#define EERAM_BLOCK_BASE 0xFFFFFFFFU
#define PBLOCK_SIZE 0x00020000U /* 128KB size */
#define EERAM_BLOCK_SIZE 0x00000000U
#define PBLOCK_NUM 1 /* number of individual Pflash block */
/* destination to program security key back to flash location */
#define SECURITY_LOCATION 0x40CU
#define BACKDOOR_KEY_LOCATION 0x400U
#define PFLASH_IFR 0xC0U /*Program flash IFR map*/
#define CC_RDCOL_ISR_NUM 21
//#define CACHE_DISABLE
#define CACHE_DISABLE MCM_PLACR |= MCM_PLACR_DFCDA_MASK;
void ErrorTrap(uint32_t returnCode);
#endif /* FLASH_H */

View file

@ -0,0 +1,13 @@
/*
* plan_handle.h -
*/
void plan_handle_init(void);
void plan_handle(void);

View file

@ -0,0 +1,37 @@
/*
* time.h -
*/
#include <stdint.h>
typedef struct calendar_info_
{
uint8_t sec;
uint8_t min;
uint8_t hour;
uint8_t mday;
uint8_t month;
uint16_t year;
uint8_t wday;
uint16_t yday;
} calendar_info;
uint8_t is_leapyear(uint16_t year);
uint8_t get_month_days(uint16_t year, uint8_t month);
void ds1302_init(void);
void ds1302_set_time(calendar_info *cal);
void ds1302_read_time(calendar_info *cal);
void maintain_system_time(void);
calendar_info get_system_time(void);
uint32_t calendar_to_sec(calendar_info *cal);
calendar_info sec_to_calendar(uint32_t sec);

View file

@ -6,6 +6,7 @@
#ifndef TFT_H
#define TFT_H
enum { PLAN_DATA_NUM = 19 };
typedef struct input_limit_
{
@ -35,7 +36,9 @@ int16_t *get_value_of_kvp(char *name, uint8_t objn);
input_limit tft_input_limit(char *name);
//const kv_pair *get_plan_data(uint8_t objn)[][PLAN_DATA_NUM];
void tft_to_plan_input(uint8_t objn);

View file

@ -1,28 +0,0 @@
/*
* time.h -
*/
#include <stdint.h>
typedef struct time_info_
{
uint16_t year;
uint8_t month;
uint8_t week;
uint8_t day;
uint8_t hour;
uint8_t minute;
uint8_t sec;
} time_info;
uint8_t is_leapyear(uint16_t year);
uint8_t get_month_days(uint16_t year, uint8_t month);
void ds1302_init(void);
void ds1302_set_time(time_info time);
void ds1302_read_time(time_info *time);