mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-10-02 14:23:19 +08:00
import RT-Thread RTOS 0.3.x to Google SVN
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@2 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
Kernel Design & Implementation
|
||||
- Bernard Xiong <bernard.xiong@gmail.com>
|
||||
|
||||
LwIP 1.3.0
|
||||
- Porting
|
||||
Qiu Yi
|
||||
- Testing
|
||||
Layer2, Bernard Xiong
|
||||
|
||||
Filesystem
|
||||
- Porting and Add Virtual Filesystem
|
||||
- Testing
|
||||
Qiu Yi
|
||||
|
||||
RTGUI
|
||||
- Design and Implemenation
|
||||
Bernard Xiong
|
||||
|
||||
newlib
|
||||
- Porting
|
||||
Qiu Yi
|
||||
|
||||
BSP Porting
|
||||
Bernard Xiong
|
||||
- AMTEL AT91SAM7S64 & AT91SAM7X256 Porting
|
||||
- STM32 Porting
|
||||
- S3C4510 Porting
|
||||
- LPC2148 Porting
|
||||
- PXA270 Porting
|
||||
- AT91RM9200 Porting
|
||||
|
||||
Aozima
|
||||
- LPC 2148 Porting
|
||||
|
||||
Qiu Yi
|
||||
- S3C2410 & S3C2440 Porting
|
||||
- IA32 Porting
|
||||
- PXA270 Porting
|
||||
|
||||
Xu Xinming
|
||||
- S3C44b0 Porting
|
||||
- LPC2478 Porting
|
||||
|
||||
Wang Gang
|
||||
- NDS Porting
|
||||
|
||||
Trissel
|
||||
- AT91RM9200 Porting
|
||||
|
||||
Layer2
|
||||
- AT91RM9200 Porting
|
||||
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* File : app.c
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://openlab.rt-thread.com/license/LICENSE
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2009-05-24 Bernard Add lwip init
|
||||
*/
|
||||
|
||||
/**
|
||||
* @addtogroup STM32
|
||||
*/
|
||||
/*@{*/
|
||||
|
||||
#include <rtthread.h>
|
||||
|
||||
#ifdef RT_USING_LWIP
|
||||
#include <lwip/sys.h>
|
||||
#endif
|
||||
|
||||
/* thread phase init */
|
||||
void rt_init_thread_entry(void *parameter)
|
||||
{
|
||||
/* LwIP Initialization */
|
||||
#ifdef RT_USING_LWIP
|
||||
{
|
||||
extern void lwip_sys_init(void);
|
||||
extern void httpd_init(void);
|
||||
|
||||
/* init lwip system */
|
||||
lwip_sys_init();
|
||||
rt_kprintf("TCP/IP initialized!\n");
|
||||
|
||||
httpd_init();
|
||||
rt_kprintf("httpd initialized!\n");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
int rt_application_init()
|
||||
{
|
||||
rt_thread_t init_thread;
|
||||
|
||||
init_thread = rt_thread_create("init",
|
||||
rt_init_thread_entry, RT_NULL,
|
||||
2048, 8, 20);
|
||||
rt_thread_startup(init_thread);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*@}*/
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* File : board.h
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006, RT-Thread Develop Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://openlab.rt-thread.com/license/LICENSE
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2006-10-08 Bernard add board.h to this bsp
|
||||
*/
|
||||
|
||||
#ifndef __BOARD_H__
|
||||
#define __BOARD_H__
|
||||
|
||||
void rt_hw_board_led_on(int n);
|
||||
void rt_hw_board_led_off(int n);
|
||||
void rt_hw_board_init(void);
|
||||
|
||||
void rt_hw_usart_init(void);
|
||||
void rt_hw_sdcard_init(void);
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,75 @@
|
||||
#include "lwip/opt.h"
|
||||
#include "lwip/arch.h"
|
||||
#include "lwip/api.h"
|
||||
|
||||
const static char http_html_hdr[] = "HTTP/1.1 200 OK\r\nContent-type: text/html\r\n\r\n";
|
||||
const static char http_index_html[] = "<html><head><title>Congrats!</title></head><body><h1>Welcome to our lwIP HTTP server!</h1><p>This is a small test page.</body></html>";
|
||||
|
||||
void http_server_serve(struct netconn *conn) {
|
||||
struct netbuf *inbuf;
|
||||
char *buf;
|
||||
u16_t buflen;
|
||||
|
||||
/* Read the data from the port, blocking if nothing yet there.
|
||||
We assume the request (the part we care about) is in one netbuf */
|
||||
inbuf = netconn_recv(conn);
|
||||
|
||||
if (netconn_err(conn) == ERR_OK) {
|
||||
netbuf_data(inbuf, &buf, &buflen);
|
||||
|
||||
/* Is this an HTTP GET command? (only check the first 5 chars, since
|
||||
there are other formats for GET, and we're keeping it very simple )*/
|
||||
if (buflen>=5 &&
|
||||
buf[0]=='G' &&
|
||||
buf[1]=='E' &&
|
||||
buf[2]=='T' &&
|
||||
buf[3]==' ' &&
|
||||
buf[4]=='/' ) {
|
||||
|
||||
/* Send the HTML header
|
||||
* subtract 1 from the size, since we dont send the \0 in the string
|
||||
* NETCONN_NOCOPY: our data is const static, so no need to copy it
|
||||
*/
|
||||
netconn_write(conn, http_html_hdr, sizeof(http_html_hdr)-1, NETCONN_NOCOPY);
|
||||
|
||||
/* Send our HTML page */
|
||||
netconn_write(conn, http_index_html, sizeof(http_index_html)-1, NETCONN_NOCOPY);
|
||||
}
|
||||
}
|
||||
/* Close the connection (server closes in HTTP) */
|
||||
netconn_close(conn);
|
||||
|
||||
/* Delete the buffer (netconn_recv gives us ownership,
|
||||
so we have to make sure to deallocate the buffer) */
|
||||
netbuf_delete(inbuf);
|
||||
}
|
||||
|
||||
void http_server(void* parameter) {
|
||||
struct netconn *conn, *newconn;
|
||||
|
||||
/* Create a new TCP connection handle */
|
||||
conn = netconn_new(NETCONN_TCP);
|
||||
LWIP_ERROR("http_server: invalid conn", (conn != NULL), );
|
||||
|
||||
/* Bind to port 80 (HTTP) with default IP address */
|
||||
netconn_bind(conn, NULL, 80);
|
||||
|
||||
/* Put the connection into LISTEN state */
|
||||
netconn_listen(conn);
|
||||
|
||||
while(1) {
|
||||
newconn = netconn_accept(conn);
|
||||
http_server_serve(newconn);
|
||||
netconn_delete(newconn);
|
||||
}
|
||||
}
|
||||
|
||||
void httpd_init()
|
||||
{
|
||||
rt_thread_t httpd = rt_thread_create("web",
|
||||
http_server, RT_NULL,
|
||||
1024, 20, 8);
|
||||
|
||||
if (httpd != RT_NULL)
|
||||
rt_thread_startup(httpd);
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
/******************** (C) COPYRIGHT 2008 STMicroelectronics ********************
|
||||
* File Name : cortexm3_macro.h
|
||||
* Author : MCD Application Team
|
||||
* Version : V2.0.3
|
||||
* Date : 09/22/2008
|
||||
* Description : Header file for cortexm3_macro.s.
|
||||
********************************************************************************
|
||||
* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
|
||||
* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
|
||||
* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
|
||||
* CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
|
||||
* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
|
||||
*******************************************************************************/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __CORTEXM3_MACRO_H
|
||||
#define __CORTEXM3_MACRO_H
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32f10x_type.h"
|
||||
|
||||
/* Exported types ------------------------------------------------------------*/
|
||||
/* Exported constants --------------------------------------------------------*/
|
||||
/* Exported macro ------------------------------------------------------------*/
|
||||
/* Exported functions ------------------------------------------------------- */
|
||||
void __WFI(void);
|
||||
void __WFE(void);
|
||||
void __SEV(void);
|
||||
void __ISB(void);
|
||||
void __DSB(void);
|
||||
void __DMB(void);
|
||||
void __SVC(void);
|
||||
u32 __MRS_CONTROL(void);
|
||||
void __MSR_CONTROL(u32 Control);
|
||||
u32 __MRS_PSP(void);
|
||||
void __MSR_PSP(u32 TopOfProcessStack);
|
||||
u32 __MRS_MSP(void);
|
||||
void __MSR_MSP(u32 TopOfMainStack);
|
||||
void __RESETPRIMASK(void);
|
||||
void __SETPRIMASK(void);
|
||||
u32 __READ_PRIMASK(void);
|
||||
void __RESETFAULTMASK(void);
|
||||
void __SETFAULTMASK(void);
|
||||
u32 __READ_FAULTMASK(void);
|
||||
void __BASEPRICONFIG(u32 NewPriority);
|
||||
u32 __GetBASEPRI(void);
|
||||
u16 __REV_HalfWord(u16 Data);
|
||||
u32 __REV_Word(u32 Data);
|
||||
|
||||
#endif /* __CORTEXM3_MACRO_H */
|
||||
|
||||
/******************* (C) COPYRIGHT 2008 STMicroelectronics *****END OF FILE****/
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,122 @@
|
||||
/******************** (C) COPYRIGHT 2008 STMicroelectronics ********************
|
||||
* File Name : stm32f10x_bkp.h
|
||||
* Author : MCD Application Team
|
||||
* Version : V2.0.3
|
||||
* Date : 09/22/2008
|
||||
* Description : This file contains all the functions prototypes for the
|
||||
* BKP firmware library.
|
||||
********************************************************************************
|
||||
* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
|
||||
* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
|
||||
* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
|
||||
* CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
|
||||
* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
|
||||
*******************************************************************************/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __STM32F10x_BKP_H
|
||||
#define __STM32F10x_BKP_H
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32f10x_map.h"
|
||||
|
||||
/* Exported types ------------------------------------------------------------*/
|
||||
/* Exported constants --------------------------------------------------------*/
|
||||
/* Tamper Pin active level */
|
||||
#define BKP_TamperPinLevel_High ((u16)0x0000)
|
||||
#define BKP_TamperPinLevel_Low ((u16)0x0001)
|
||||
|
||||
#define IS_BKP_TAMPER_PIN_LEVEL(LEVEL) (((LEVEL) == BKP_TamperPinLevel_High) || \
|
||||
((LEVEL) == BKP_TamperPinLevel_Low))
|
||||
|
||||
/* RTC output source to output on the Tamper pin */
|
||||
#define BKP_RTCOutputSource_None ((u16)0x0000)
|
||||
#define BKP_RTCOutputSource_CalibClock ((u16)0x0080)
|
||||
#define BKP_RTCOutputSource_Alarm ((u16)0x0100)
|
||||
#define BKP_RTCOutputSource_Second ((u16)0x0300)
|
||||
|
||||
#define IS_BKP_RTC_OUTPUT_SOURCE(SOURCE) (((SOURCE) == BKP_RTCOutputSource_None) || \
|
||||
((SOURCE) == BKP_RTCOutputSource_CalibClock) || \
|
||||
((SOURCE) == BKP_RTCOutputSource_Alarm) || \
|
||||
((SOURCE) == BKP_RTCOutputSource_Second))
|
||||
|
||||
/* Data Backup Register */
|
||||
#define BKP_DR1 ((u16)0x0004)
|
||||
#define BKP_DR2 ((u16)0x0008)
|
||||
#define BKP_DR3 ((u16)0x000C)
|
||||
#define BKP_DR4 ((u16)0x0010)
|
||||
#define BKP_DR5 ((u16)0x0014)
|
||||
#define BKP_DR6 ((u16)0x0018)
|
||||
#define BKP_DR7 ((u16)0x001C)
|
||||
#define BKP_DR8 ((u16)0x0020)
|
||||
#define BKP_DR9 ((u16)0x0024)
|
||||
#define BKP_DR10 ((u16)0x0028)
|
||||
#define BKP_DR11 ((u16)0x0040)
|
||||
#define BKP_DR12 ((u16)0x0044)
|
||||
#define BKP_DR13 ((u16)0x0048)
|
||||
#define BKP_DR14 ((u16)0x004C)
|
||||
#define BKP_DR15 ((u16)0x0050)
|
||||
#define BKP_DR16 ((u16)0x0054)
|
||||
#define BKP_DR17 ((u16)0x0058)
|
||||
#define BKP_DR18 ((u16)0x005C)
|
||||
#define BKP_DR19 ((u16)0x0060)
|
||||
#define BKP_DR20 ((u16)0x0064)
|
||||
#define BKP_DR21 ((u16)0x0068)
|
||||
#define BKP_DR22 ((u16)0x006C)
|
||||
#define BKP_DR23 ((u16)0x0070)
|
||||
#define BKP_DR24 ((u16)0x0074)
|
||||
#define BKP_DR25 ((u16)0x0078)
|
||||
#define BKP_DR26 ((u16)0x007C)
|
||||
#define BKP_DR27 ((u16)0x0080)
|
||||
#define BKP_DR28 ((u16)0x0084)
|
||||
#define BKP_DR29 ((u16)0x0088)
|
||||
#define BKP_DR30 ((u16)0x008C)
|
||||
#define BKP_DR31 ((u16)0x0090)
|
||||
#define BKP_DR32 ((u16)0x0094)
|
||||
#define BKP_DR33 ((u16)0x0098)
|
||||
#define BKP_DR34 ((u16)0x009C)
|
||||
#define BKP_DR35 ((u16)0x00A0)
|
||||
#define BKP_DR36 ((u16)0x00A4)
|
||||
#define BKP_DR37 ((u16)0x00A8)
|
||||
#define BKP_DR38 ((u16)0x00AC)
|
||||
#define BKP_DR39 ((u16)0x00B0)
|
||||
#define BKP_DR40 ((u16)0x00B4)
|
||||
#define BKP_DR41 ((u16)0x00B8)
|
||||
#define BKP_DR42 ((u16)0x00BC)
|
||||
|
||||
#define IS_BKP_DR(DR) (((DR) == BKP_DR1) || ((DR) == BKP_DR2) || ((DR) == BKP_DR3) || \
|
||||
((DR) == BKP_DR4) || ((DR) == BKP_DR5) || ((DR) == BKP_DR6) || \
|
||||
((DR) == BKP_DR7) || ((DR) == BKP_DR8) || ((DR) == BKP_DR9) || \
|
||||
((DR) == BKP_DR10) || ((DR) == BKP_DR11) || ((DR) == BKP_DR12) || \
|
||||
((DR) == BKP_DR13) || ((DR) == BKP_DR14) || ((DR) == BKP_DR15) || \
|
||||
((DR) == BKP_DR16) || ((DR) == BKP_DR17) || ((DR) == BKP_DR18) || \
|
||||
((DR) == BKP_DR19) || ((DR) == BKP_DR20) || ((DR) == BKP_DR21) || \
|
||||
((DR) == BKP_DR22) || ((DR) == BKP_DR23) || ((DR) == BKP_DR24) || \
|
||||
((DR) == BKP_DR25) || ((DR) == BKP_DR26) || ((DR) == BKP_DR27) || \
|
||||
((DR) == BKP_DR28) || ((DR) == BKP_DR29) || ((DR) == BKP_DR30) || \
|
||||
((DR) == BKP_DR31) || ((DR) == BKP_DR32) || ((DR) == BKP_DR33) || \
|
||||
((DR) == BKP_DR34) || ((DR) == BKP_DR35) || ((DR) == BKP_DR36) || \
|
||||
((DR) == BKP_DR37) || ((DR) == BKP_DR38) || ((DR) == BKP_DR39) || \
|
||||
((DR) == BKP_DR40) || ((DR) == BKP_DR41) || ((DR) == BKP_DR42))
|
||||
|
||||
#define IS_BKP_CALIBRATION_VALUE(VALUE) ((VALUE) <= 0x7F)
|
||||
|
||||
/* Exported macro ------------------------------------------------------------*/
|
||||
/* Exported functions ------------------------------------------------------- */
|
||||
void BKP_DeInit(void);
|
||||
void BKP_TamperPinLevelConfig(u16 BKP_TamperPinLevel);
|
||||
void BKP_TamperPinCmd(FunctionalState NewState);
|
||||
void BKP_ITConfig(FunctionalState NewState);
|
||||
void BKP_RTCOutputConfig(u16 BKP_RTCOutputSource);
|
||||
void BKP_SetRTCCalibrationValue(u8 CalibrationValue);
|
||||
void BKP_WriteBackupRegister(u16 BKP_DR, u16 Data);
|
||||
u16 BKP_ReadBackupRegister(u16 BKP_DR);
|
||||
FlagStatus BKP_GetFlagStatus(void);
|
||||
void BKP_ClearFlag(void);
|
||||
ITStatus BKP_GetITStatus(void);
|
||||
void BKP_ClearITPendingBit(void);
|
||||
|
||||
#endif /* __STM32F10x_BKP_H */
|
||||
|
||||
/******************* (C) COPYRIGHT 2008 STMicroelectronics *****END OF FILE****/
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,37 @@
|
||||
/******************** (C) COPYRIGHT 2008 STMicroelectronics ********************
|
||||
* File Name : stm32f10x_crc.h
|
||||
* Author : MCD Application Team
|
||||
* Version : V2.0.3
|
||||
* Date : 09/22/2008
|
||||
* Description : This file contains all the functions prototypes for the
|
||||
* CRC firmware library.
|
||||
********************************************************************************
|
||||
* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
|
||||
* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
|
||||
* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
|
||||
* CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
|
||||
* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
|
||||
*******************************************************************************/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __STM32F10x_CRC_H
|
||||
#define __STM32F10x_CRC_H
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32f10x_map.h"
|
||||
|
||||
/* Exported types ------------------------------------------------------------*/
|
||||
/* Exported constants --------------------------------------------------------*/
|
||||
/* Exported macro ------------------------------------------------------------*/
|
||||
/* Exported functions ------------------------------------------------------- */
|
||||
void CRC_ResetDR(void);
|
||||
u32 CRC_CalcCRC(u32 Data);
|
||||
u32 CRC_CalcBlockCRC(u32 pBuffer[], u32 BufferLength);
|
||||
u32 CRC_GetCRC(void);
|
||||
void CRC_SetIDRegister(u8 IDValue);
|
||||
u8 CRC_GetIDRegister(void);
|
||||
|
||||
#endif /* __STM32F10x_CRC_H */
|
||||
|
||||
/******************* (C) COPYRIGHT 2008 STMicroelectronics *****END OF FILE****/
|
||||
@@ -0,0 +1,167 @@
|
||||
/******************** (C) COPYRIGHT 2008 STMicroelectronics ********************
|
||||
* File Name : stm32f10x_dac.h
|
||||
* Author : MCD Application Team
|
||||
* Version : V2.0.3
|
||||
* Date : 09/22/2008
|
||||
* Description : This file contains all the functions prototypes for the
|
||||
* DAC firmware library.
|
||||
********************************************************************************
|
||||
* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
|
||||
* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
|
||||
* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
|
||||
* CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
|
||||
* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
|
||||
*******************************************************************************/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __STM32F10x_DAC_H
|
||||
#define __STM32F10x_DAC_H
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32f10x_map.h"
|
||||
|
||||
/* Exported types ------------------------------------------------------------*/
|
||||
/* DAC Init structure definition */
|
||||
typedef struct
|
||||
{
|
||||
u32 DAC_Trigger;
|
||||
u32 DAC_WaveGeneration;
|
||||
u32 DAC_LFSRUnmask_TriangleAmplitude;
|
||||
u32 DAC_OutputBuffer;
|
||||
}DAC_InitTypeDef;
|
||||
|
||||
/* Exported constants --------------------------------------------------------*/
|
||||
/* DAC trigger selection */
|
||||
#define DAC_Trigger_None ((u32)0x00000000)
|
||||
#define DAC_Trigger_T6_TRGO ((u32)0x00000004)
|
||||
#define DAC_Trigger_T8_TRGO ((u32)0x0000000C)
|
||||
#define DAC_Trigger_T7_TRGO ((u32)0x00000014)
|
||||
#define DAC_Trigger_T5_TRGO ((u32)0x0000001C)
|
||||
#define DAC_Trigger_T2_TRGO ((u32)0x00000024)
|
||||
#define DAC_Trigger_T4_TRGO ((u32)0x0000002C)
|
||||
#define DAC_Trigger_Ext_IT9 ((u32)0x00000034)
|
||||
#define DAC_Trigger_Software ((u32)0x0000003C)
|
||||
|
||||
#define IS_DAC_TRIGGER(TRIGGER) (((TRIGGER) == DAC_Trigger_None) || \
|
||||
((TRIGGER) == DAC_Trigger_T6_TRGO) || \
|
||||
((TRIGGER) == DAC_Trigger_T8_TRGO) || \
|
||||
((TRIGGER) == DAC_Trigger_T7_TRGO) || \
|
||||
((TRIGGER) == DAC_Trigger_T5_TRGO) || \
|
||||
((TRIGGER) == DAC_Trigger_T2_TRGO) || \
|
||||
((TRIGGER) == DAC_Trigger_T4_TRGO) || \
|
||||
((TRIGGER) == DAC_Trigger_Ext_IT9) || \
|
||||
((TRIGGER) == DAC_Trigger_Software))
|
||||
|
||||
/* DAC wave generation */
|
||||
#define DAC_WaveGeneration_None ((u32)0x00000000)
|
||||
#define DAC_WaveGeneration_Noise ((u32)0x00000040)
|
||||
#define DAC_WaveGeneration_Triangle ((u32)0x00000080)
|
||||
|
||||
#define IS_DAC_GENERATE_WAVE(WAVE) (((WAVE) == DAC_WaveGeneration_None) || \
|
||||
((WAVE) == DAC_WaveGeneration_Noise) || \
|
||||
((WAVE) == DAC_WaveGeneration_Triangle))
|
||||
|
||||
/* DAC noise wave generation mask / triangle wave generation max amplitude */
|
||||
#define DAC_LFSRUnmask_Bit0 ((u32)0x00000000)
|
||||
#define DAC_LFSRUnmask_Bits1_0 ((u32)0x00000100)
|
||||
#define DAC_LFSRUnmask_Bits2_0 ((u32)0x00000200)
|
||||
#define DAC_LFSRUnmask_Bits3_0 ((u32)0x00000300)
|
||||
#define DAC_LFSRUnmask_Bits4_0 ((u32)0x00000400)
|
||||
#define DAC_LFSRUnmask_Bits5_0 ((u32)0x00000500)
|
||||
#define DAC_LFSRUnmask_Bits6_0 ((u32)0x00000600)
|
||||
#define DAC_LFSRUnmask_Bits7_0 ((u32)0x00000700)
|
||||
#define DAC_LFSRUnmask_Bits8_0 ((u32)0x00000800)
|
||||
#define DAC_LFSRUnmask_Bits9_0 ((u32)0x00000900)
|
||||
#define DAC_LFSRUnmask_Bits10_0 ((u32)0x00000A00)
|
||||
#define DAC_LFSRUnmask_Bits11_0 ((u32)0x00000B00)
|
||||
|
||||
#define DAC_TriangleAmplitude_1 ((u32)0x00000000)
|
||||
#define DAC_TriangleAmplitude_3 ((u32)0x00000100)
|
||||
#define DAC_TriangleAmplitude_7 ((u32)0x00000200)
|
||||
#define DAC_TriangleAmplitude_15 ((u32)0x00000300)
|
||||
#define DAC_TriangleAmplitude_31 ((u32)0x00000400)
|
||||
#define DAC_TriangleAmplitude_63 ((u32)0x00000500)
|
||||
#define DAC_TriangleAmplitude_127 ((u32)0x00000600)
|
||||
#define DAC_TriangleAmplitude_255 ((u32)0x00000700)
|
||||
#define DAC_TriangleAmplitude_511 ((u32)0x00000800)
|
||||
#define DAC_TriangleAmplitude_1023 ((u32)0x00000900)
|
||||
#define DAC_TriangleAmplitude_2047 ((u32)0x00000A00)
|
||||
#define DAC_TriangleAmplitude_4095 ((u32)0x00000B00)
|
||||
|
||||
#define IS_DAC_LFSR_UNMASK_TRIANGLE_AMPLITUDE(VALUE) (((VALUE) == DAC_LFSRUnmask_Bit0) || \
|
||||
((VALUE) == DAC_LFSRUnmask_Bits1_0) || \
|
||||
((VALUE) == DAC_LFSRUnmask_Bits2_0) || \
|
||||
((VALUE) == DAC_LFSRUnmask_Bits3_0) || \
|
||||
((VALUE) == DAC_LFSRUnmask_Bits4_0) || \
|
||||
((VALUE) == DAC_LFSRUnmask_Bits5_0) || \
|
||||
((VALUE) == DAC_LFSRUnmask_Bits6_0) || \
|
||||
((VALUE) == DAC_LFSRUnmask_Bits7_0) || \
|
||||
((VALUE) == DAC_LFSRUnmask_Bits8_0) || \
|
||||
((VALUE) == DAC_LFSRUnmask_Bits9_0) || \
|
||||
((VALUE) == DAC_LFSRUnmask_Bits10_0) || \
|
||||
((VALUE) == DAC_LFSRUnmask_Bits11_0) || \
|
||||
((VALUE) == DAC_TriangleAmplitude_1) || \
|
||||
((VALUE) == DAC_TriangleAmplitude_3) || \
|
||||
((VALUE) == DAC_TriangleAmplitude_7) || \
|
||||
((VALUE) == DAC_TriangleAmplitude_15) || \
|
||||
((VALUE) == DAC_TriangleAmplitude_31) || \
|
||||
((VALUE) == DAC_TriangleAmplitude_63) || \
|
||||
((VALUE) == DAC_TriangleAmplitude_127) || \
|
||||
((VALUE) == DAC_TriangleAmplitude_255) || \
|
||||
((VALUE) == DAC_TriangleAmplitude_511) || \
|
||||
((VALUE) == DAC_TriangleAmplitude_1023) || \
|
||||
((VALUE) == DAC_TriangleAmplitude_2047) || \
|
||||
((VALUE) == DAC_TriangleAmplitude_4095))
|
||||
|
||||
/* DAC output buffer */
|
||||
#define DAC_OutputBuffer_Enable ((u32)0x00000000)
|
||||
#define DAC_OutputBuffer_Disable ((u32)0x00000002)
|
||||
|
||||
#define IS_DAC_OUTPUT_BUFFER_STATE(STATE) (((STATE) == DAC_OutputBuffer_Enable) || \
|
||||
((STATE) == DAC_OutputBuffer_Disable))
|
||||
|
||||
/* DAC Channel selection */
|
||||
#define DAC_Channel_1 ((u32)0x00000000)
|
||||
#define DAC_Channel_2 ((u32)0x00000010)
|
||||
|
||||
#define IS_DAC_CHANNEL(CHANNEL) (((CHANNEL) == DAC_Channel_1) || \
|
||||
((CHANNEL) == DAC_Channel_2))
|
||||
|
||||
/* DAC data alignement */
|
||||
#define DAC_Align_12b_R ((u32)0x00000000)
|
||||
#define DAC_Align_12b_L ((u32)0x00000004)
|
||||
#define DAC_Align_8b_R ((u32)0x00000008)
|
||||
|
||||
#define IS_DAC_ALIGN(ALIGN) (((ALIGN) == DAC_Align_12b_R) || \
|
||||
((ALIGN) == DAC_Align_12b_L) || \
|
||||
((ALIGN) == DAC_Align_8b_R))
|
||||
|
||||
/* DAC wave generation */
|
||||
#define DAC_Wave_Noise ((u32)0x00000040)
|
||||
#define DAC_Wave_Triangle ((u32)0x00000080)
|
||||
|
||||
#define IS_DAC_WAVE(WAVE) (((WAVE) == DAC_Wave_Noise) || \
|
||||
((WAVE) == DAC_Wave_Triangle))
|
||||
|
||||
/* DAC data ------------------------------------------------------------------*/
|
||||
#define IS_DAC_DATA(DATA) ((DATA) <= 0xFFF0)
|
||||
|
||||
/* Exported macro ------------------------------------------------------------*/
|
||||
/* Exported functions --------------------------------------------------------*/
|
||||
void DAC_DeInit(void);
|
||||
void DAC_Init(u32 DAC_Channel, DAC_InitTypeDef* DAC_InitStruct);
|
||||
void DAC_StructInit(DAC_InitTypeDef* DAC_InitStruct);
|
||||
void DAC_Cmd(u32 DAC_Channel, FunctionalState NewState);
|
||||
void DAC_DMACmd(u32 DAC_Channel, FunctionalState NewState);
|
||||
void DAC_SoftwareTriggerCmd(u32 DAC_Channel, FunctionalState NewState);
|
||||
void DAC_DualSoftwareTriggerCmd(FunctionalState NewState);
|
||||
void DAC_WaveGenerationCmd(u32 DAC_Channel, u32 DAC_Wave, FunctionalState NewState);
|
||||
void DAC_SetChannel1Data(u32 DAC_Align, u16 Data);
|
||||
void DAC_SetChannel2Data(u32 DAC_Align, u16 Data);
|
||||
void DAC_SetDualChannelData(u32 DAC_Align, u16 Data2, u16 Data1);
|
||||
u16 DAC_GetDataOutputValue(u32 DAC_Channel);
|
||||
|
||||
#endif /*__STM32F10x_DAC_H */
|
||||
|
||||
/******************* (C) COPYRIGHT 2008 STMicroelectronics *****END OF FILE****/
|
||||
@@ -0,0 +1,55 @@
|
||||
/******************** (C) COPYRIGHT 2009 STMicroelectronics ********************
|
||||
* File Name : stm32f10x_dbgmcu.h
|
||||
* Author : MCD Application Team
|
||||
* Version : V2.0.3Patch1
|
||||
* Date : 04/06/2009
|
||||
* Description : This file contains all the functions prototypes for the
|
||||
* DBGMCU firmware library.
|
||||
********************************************************************************
|
||||
* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
|
||||
* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
|
||||
* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
|
||||
* CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
|
||||
* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
|
||||
*******************************************************************************/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __STM32F10x_DBGMCU_H
|
||||
#define __STM32F10x_DBGMCU_H
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32f10x_map.h"
|
||||
|
||||
/* Exported types ------------------------------------------------------------*/
|
||||
/* Exported constants --------------------------------------------------------*/
|
||||
#define DBGMCU_SLEEP ((u32)0x00000001)
|
||||
#define DBGMCU_STOP ((u32)0x00000002)
|
||||
#define DBGMCU_STANDBY ((u32)0x00000004)
|
||||
#define DBGMCU_IWDG_STOP ((u32)0x00000100)
|
||||
#define DBGMCU_WWDG_STOP ((u32)0x00000200)
|
||||
#define DBGMCU_TIM1_STOP ((u32)0x00000400)
|
||||
#define DBGMCU_TIM2_STOP ((u32)0x00000800)
|
||||
#define DBGMCU_TIM3_STOP ((u32)0x00001000)
|
||||
#define DBGMCU_TIM4_STOP ((u32)0x00002000)
|
||||
#define DBGMCU_CAN_STOP ((u32)0x00004000)
|
||||
#define DBGMCU_I2C1_SMBUS_TIMEOUT ((u32)0x00008000)
|
||||
#define DBGMCU_I2C2_SMBUS_TIMEOUT ((u32)0x00010000)
|
||||
#define DBGMCU_TIM8_STOP ((u32)0x00020000)
|
||||
#define DBGMCU_TIM5_STOP ((u32)0x00040000)
|
||||
#define DBGMCU_TIM6_STOP ((u32)0x00080000)
|
||||
#define DBGMCU_TIM7_STOP ((u32)0x00100000)
|
||||
|
||||
#define IS_DBGMCU_PERIPH(PERIPH) ((((PERIPH) & 0xFFE000F8) == 0x00) && ((PERIPH) != 0x00))
|
||||
|
||||
/* Exported macro ------------------------------------------------------------*/
|
||||
/* Exported functions ------------------------------------------------------- */
|
||||
u32 DBGMCU_GetREVID(void);
|
||||
u32 DBGMCU_GetDEVID(void);
|
||||
void DBGMCU_Config(u32 DBGMCU_Periph, FunctionalState NewState);
|
||||
|
||||
#endif /* __STM32F10x_DBGMCU_H */
|
||||
|
||||
/******************* (C) COPYRIGHT 2009 STMicroelectronics *****END OF FILE****/
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,107 @@
|
||||
/******************** (C) COPYRIGHT 2008 STMicroelectronics ********************
|
||||
* File Name : stm32f10x_exti.h
|
||||
* Author : MCD Application Team
|
||||
* Version : V2.0.3
|
||||
* Date : 09/22/2008
|
||||
* Description : This file contains all the functions prototypes for the
|
||||
* EXTI firmware library.
|
||||
********************************************************************************
|
||||
* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
|
||||
* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
|
||||
* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
|
||||
* CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
|
||||
* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
|
||||
*******************************************************************************/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __STM32F10x_EXTI_H
|
||||
#define __STM32F10x_EXTI_H
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32f10x_map.h"
|
||||
|
||||
/* Exported types ------------------------------------------------------------*/
|
||||
/* EXTI mode enumeration -----------------------------------------------------*/
|
||||
typedef enum
|
||||
{
|
||||
EXTI_Mode_Interrupt = 0x00,
|
||||
EXTI_Mode_Event = 0x04
|
||||
}EXTIMode_TypeDef;
|
||||
|
||||
#define IS_EXTI_MODE(MODE) (((MODE) == EXTI_Mode_Interrupt) || ((MODE) == EXTI_Mode_Event))
|
||||
|
||||
/* EXTI Trigger enumeration --------------------------------------------------*/
|
||||
typedef enum
|
||||
{
|
||||
EXTI_Trigger_Rising = 0x08,
|
||||
EXTI_Trigger_Falling = 0x0C,
|
||||
EXTI_Trigger_Rising_Falling = 0x10
|
||||
}EXTITrigger_TypeDef;
|
||||
|
||||
#define IS_EXTI_TRIGGER(TRIGGER) (((TRIGGER) == EXTI_Trigger_Rising) || \
|
||||
((TRIGGER) == EXTI_Trigger_Falling) || \
|
||||
((TRIGGER) == EXTI_Trigger_Rising_Falling))
|
||||
|
||||
/* EXTI Init Structure definition --------------------------------------------*/
|
||||
typedef struct
|
||||
{
|
||||
u32 EXTI_Line;
|
||||
EXTIMode_TypeDef EXTI_Mode;
|
||||
EXTITrigger_TypeDef EXTI_Trigger;
|
||||
FunctionalState EXTI_LineCmd;
|
||||
}EXTI_InitTypeDef;
|
||||
|
||||
/* Exported constants --------------------------------------------------------*/
|
||||
/* EXTI Lines ----------------------------------------------------------------*/
|
||||
#define EXTI_Line0 ((u32)0x00001) /* External interrupt line 0 */
|
||||
#define EXTI_Line1 ((u32)0x00002) /* External interrupt line 1 */
|
||||
#define EXTI_Line2 ((u32)0x00004) /* External interrupt line 2 */
|
||||
#define EXTI_Line3 ((u32)0x00008) /* External interrupt line 3 */
|
||||
#define EXTI_Line4 ((u32)0x00010) /* External interrupt line 4 */
|
||||
#define EXTI_Line5 ((u32)0x00020) /* External interrupt line 5 */
|
||||
#define EXTI_Line6 ((u32)0x00040) /* External interrupt line 6 */
|
||||
#define EXTI_Line7 ((u32)0x00080) /* External interrupt line 7 */
|
||||
#define EXTI_Line8 ((u32)0x00100) /* External interrupt line 8 */
|
||||
#define EXTI_Line9 ((u32)0x00200) /* External interrupt line 9 */
|
||||
#define EXTI_Line10 ((u32)0x00400) /* External interrupt line 10 */
|
||||
#define EXTI_Line11 ((u32)0x00800) /* External interrupt line 11 */
|
||||
#define EXTI_Line12 ((u32)0x01000) /* External interrupt line 12 */
|
||||
#define EXTI_Line13 ((u32)0x02000) /* External interrupt line 13 */
|
||||
#define EXTI_Line14 ((u32)0x04000) /* External interrupt line 14 */
|
||||
#define EXTI_Line15 ((u32)0x08000) /* External interrupt line 15 */
|
||||
#define EXTI_Line16 ((u32)0x10000) /* External interrupt line 16
|
||||
Connected to the PVD Output */
|
||||
#define EXTI_Line17 ((u32)0x20000) /* External interrupt line 17
|
||||
Connected to the RTC Alarm event */
|
||||
#define EXTI_Line18 ((u32)0x40000) /* External interrupt line 18
|
||||
Connected to the USB Wakeup from
|
||||
suspend event */
|
||||
|
||||
#define IS_EXTI_LINE(LINE) ((((LINE) & (u32)0xFFF80000) == 0x00) && ((LINE) != (u16)0x00))
|
||||
|
||||
#define IS_GET_EXTI_LINE(LINE) (((LINE) == EXTI_Line0) || ((LINE) == EXTI_Line1) || \
|
||||
((LINE) == EXTI_Line2) || ((LINE) == EXTI_Line3) || \
|
||||
((LINE) == EXTI_Line4) || ((LINE) == EXTI_Line5) || \
|
||||
((LINE) == EXTI_Line6) || ((LINE) == EXTI_Line7) || \
|
||||
((LINE) == EXTI_Line8) || ((LINE) == EXTI_Line9) || \
|
||||
((LINE) == EXTI_Line10) || ((LINE) == EXTI_Line11) || \
|
||||
((LINE) == EXTI_Line12) || ((LINE) == EXTI_Line13) || \
|
||||
((LINE) == EXTI_Line14) || ((LINE) == EXTI_Line15) || \
|
||||
((LINE) == EXTI_Line16) || ((LINE) == EXTI_Line17) || \
|
||||
((LINE) == EXTI_Line18))
|
||||
|
||||
/* Exported macro ------------------------------------------------------------*/
|
||||
/* Exported functions ------------------------------------------------------- */
|
||||
void EXTI_DeInit(void);
|
||||
void EXTI_Init(EXTI_InitTypeDef* EXTI_InitStruct);
|
||||
void EXTI_StructInit(EXTI_InitTypeDef* EXTI_InitStruct);
|
||||
void EXTI_GenerateSWInterrupt(u32 EXTI_Line);
|
||||
FlagStatus EXTI_GetFlagStatus(u32 EXTI_Line);
|
||||
void EXTI_ClearFlag(u32 EXTI_Line);
|
||||
ITStatus EXTI_GetITStatus(u32 EXTI_Line);
|
||||
void EXTI_ClearITPendingBit(u32 EXTI_Line);
|
||||
|
||||
#endif /* __STM32F10x_EXTI_H */
|
||||
|
||||
/******************* (C) COPYRIGHT 2008 STMicroelectronics *****END OF FILE****/
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,69 @@
|
||||
/******************** (C) COPYRIGHT 2008 STMicroelectronics ********************
|
||||
* File Name : stm32f10x_iwdg.h
|
||||
* Author : MCD Application Team
|
||||
* Version : V2.0.3
|
||||
* Date : 09/22/2008
|
||||
* Description : This file contains all the functions prototypes for the
|
||||
* IWDG firmware library.
|
||||
********************************************************************************
|
||||
* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
|
||||
* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
|
||||
* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
|
||||
* CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
|
||||
* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
|
||||
*******************************************************************************/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __STM32F10x_IWDG_H
|
||||
#define __STM32F10x_IWDG_H
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32f10x_map.h"
|
||||
|
||||
/* Exported types ------------------------------------------------------------*/
|
||||
/* Exported constants --------------------------------------------------------*/
|
||||
/* Write access to IWDG_PR and IWDG_RLR registers */
|
||||
#define IWDG_WriteAccess_Enable ((u16)0x5555)
|
||||
#define IWDG_WriteAccess_Disable ((u16)0x0000)
|
||||
|
||||
#define IS_IWDG_WRITE_ACCESS(ACCESS) (((ACCESS) == IWDG_WriteAccess_Enable) || \
|
||||
((ACCESS) == IWDG_WriteAccess_Disable))
|
||||
|
||||
/* IWDG prescaler */
|
||||
#define IWDG_Prescaler_4 ((u8)0x00)
|
||||
#define IWDG_Prescaler_8 ((u8)0x01)
|
||||
#define IWDG_Prescaler_16 ((u8)0x02)
|
||||
#define IWDG_Prescaler_32 ((u8)0x03)
|
||||
#define IWDG_Prescaler_64 ((u8)0x04)
|
||||
#define IWDG_Prescaler_128 ((u8)0x05)
|
||||
#define IWDG_Prescaler_256 ((u8)0x06)
|
||||
|
||||
#define IS_IWDG_PRESCALER(PRESCALER) (((PRESCALER) == IWDG_Prescaler_4) || \
|
||||
((PRESCALER) == IWDG_Prescaler_8) || \
|
||||
((PRESCALER) == IWDG_Prescaler_16) || \
|
||||
((PRESCALER) == IWDG_Prescaler_32) || \
|
||||
((PRESCALER) == IWDG_Prescaler_64) || \
|
||||
((PRESCALER) == IWDG_Prescaler_128)|| \
|
||||
((PRESCALER) == IWDG_Prescaler_256))
|
||||
|
||||
/* IWDG Flag */
|
||||
#define IWDG_FLAG_PVU ((u16)0x0001)
|
||||
#define IWDG_FLAG_RVU ((u16)0x0002)
|
||||
|
||||
#define IS_IWDG_FLAG(FLAG) (((FLAG) == IWDG_FLAG_PVU) || ((FLAG) == IWDG_FLAG_RVU))
|
||||
|
||||
#define IS_IWDG_RELOAD(RELOAD) ((RELOAD) <= 0xFFF)
|
||||
|
||||
/* Exported macro ------------------------------------------------------------*/
|
||||
/* Exported functions ------------------------------------------------------- */
|
||||
void IWDG_WriteAccessCmd(u16 IWDG_WriteAccess);
|
||||
void IWDG_SetPrescaler(u8 IWDG_Prescaler);
|
||||
void IWDG_SetReload(u16 Reload);
|
||||
void IWDG_ReloadCounter(void);
|
||||
void IWDG_Enable(void);
|
||||
FlagStatus IWDG_GetFlagStatus(u16 IWDG_FLAG);
|
||||
|
||||
#endif /* __STM32F10x_IWDG_H */
|
||||
|
||||
/******************* (C) COPYRIGHT 2008 STMicroelectronics *****END OF FILE****/
|
||||
@@ -0,0 +1,124 @@
|
||||
/******************** (C) COPYRIGHT 2008 STMicroelectronics ********************
|
||||
* File Name : stm32f10x_lib.h
|
||||
* Author : MCD Application Team
|
||||
* Version : V2.0.3
|
||||
* Date : 09/22/2008
|
||||
* Description : This file includes the peripherals header files in the
|
||||
* user application.
|
||||
********************************************************************************
|
||||
* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
|
||||
* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
|
||||
* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
|
||||
* CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
|
||||
* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
|
||||
*******************************************************************************/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __STM32F10x_LIB_H
|
||||
#define __STM32F10x_LIB_H
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32f10x_map.h"
|
||||
|
||||
#ifdef _ADC
|
||||
#include "stm32f10x_adc.h"
|
||||
#endif /*_ADC */
|
||||
|
||||
#ifdef _BKP
|
||||
#include "stm32f10x_bkp.h"
|
||||
#endif /*_BKP */
|
||||
|
||||
#ifdef _CAN
|
||||
#include "stm32f10x_can.h"
|
||||
#endif /*_CAN */
|
||||
|
||||
#ifdef _CRC
|
||||
#include "stm32f10x_crc.h"
|
||||
#endif /*_CRC */
|
||||
|
||||
#ifdef _DAC
|
||||
#include "stm32f10x_dac.h"
|
||||
#endif /*_DAC */
|
||||
|
||||
#ifdef _DBGMCU
|
||||
#include "stm32f10x_dbgmcu.h"
|
||||
#endif /*_DBGMCU */
|
||||
|
||||
#ifdef _DMA
|
||||
#include "stm32f10x_dma.h"
|
||||
#endif /*_DMA */
|
||||
|
||||
#ifdef _EXTI
|
||||
#include "stm32f10x_exti.h"
|
||||
#endif /*_EXTI */
|
||||
|
||||
#ifdef _FLASH
|
||||
#include "stm32f10x_flash.h"
|
||||
#endif /*_FLASH */
|
||||
|
||||
#ifdef _FSMC
|
||||
#include "stm32f10x_fsmc.h"
|
||||
#endif /*_FSMC */
|
||||
|
||||
#ifdef _GPIO
|
||||
#include "stm32f10x_gpio.h"
|
||||
#endif /*_GPIO */
|
||||
|
||||
#ifdef _I2C
|
||||
#include "stm32f10x_i2c.h"
|
||||
#endif /*_I2C */
|
||||
|
||||
#ifdef _IWDG
|
||||
#include "stm32f10x_iwdg.h"
|
||||
#endif /*_IWDG */
|
||||
|
||||
#ifdef _NVIC
|
||||
#include "stm32f10x_nvic.h"
|
||||
#endif /*_NVIC */
|
||||
|
||||
#ifdef _PWR
|
||||
#include "stm32f10x_pwr.h"
|
||||
#endif /*_PWR */
|
||||
|
||||
#ifdef _RCC
|
||||
#include "stm32f10x_rcc.h"
|
||||
#endif /*_RCC */
|
||||
|
||||
#ifdef _RTC
|
||||
#include "stm32f10x_rtc.h"
|
||||
#endif /*_RTC */
|
||||
|
||||
#ifdef _SDIO
|
||||
#include "stm32f10x_sdio.h"
|
||||
#endif /*_SDIO */
|
||||
|
||||
#ifdef _SPI
|
||||
#include "stm32f10x_spi.h"
|
||||
#endif /*_SPI */
|
||||
|
||||
#ifdef _SysTick
|
||||
#include "stm32f10x_systick.h"
|
||||
#endif /*_SysTick */
|
||||
|
||||
#ifdef _TIM
|
||||
#include "stm32f10x_tim.h"
|
||||
#endif /*_TIM */
|
||||
|
||||
#ifdef _USART
|
||||
#include "stm32f10x_usart.h"
|
||||
#endif /*_USART */
|
||||
|
||||
#ifdef _WWDG
|
||||
#include "stm32f10x_wwdg.h"
|
||||
#endif /*_WWDG */
|
||||
|
||||
/* Exported types ------------------------------------------------------------*/
|
||||
/* Exported constants --------------------------------------------------------*/
|
||||
/* Exported macro ------------------------------------------------------------*/
|
||||
/* Exported functions ------------------------------------------------------- */
|
||||
void debug(void);
|
||||
|
||||
#endif /* __STM32F10x_LIB_H */
|
||||
|
||||
/******************* (C) COPYRIGHT 2008 STMicroelectronics *****END OF FILE****/
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,77 @@
|
||||
/******************** (C) COPYRIGHT 2008 STMicroelectronics ********************
|
||||
* File Name : stm32f10x_pwr.h
|
||||
* Author : MCD Application Team
|
||||
* Version : V2.0.3
|
||||
* Date : 09/22/2008
|
||||
* Description : This file contains all the functions prototypes for the
|
||||
* PWR firmware library.
|
||||
********************************************************************************
|
||||
* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
|
||||
* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
|
||||
* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
|
||||
* CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
|
||||
* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
|
||||
*******************************************************************************/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __STM32F10x_PWR_H
|
||||
#define __STM32F10x_PWR_H
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32f10x_map.h"
|
||||
|
||||
/* Exported types ------------------------------------------------------------*/
|
||||
/* Exported constants --------------------------------------------------------*/
|
||||
/* PVD detection level */
|
||||
#define PWR_PVDLevel_2V2 ((u32)0x00000000)
|
||||
#define PWR_PVDLevel_2V3 ((u32)0x00000020)
|
||||
#define PWR_PVDLevel_2V4 ((u32)0x00000040)
|
||||
#define PWR_PVDLevel_2V5 ((u32)0x00000060)
|
||||
#define PWR_PVDLevel_2V6 ((u32)0x00000080)
|
||||
#define PWR_PVDLevel_2V7 ((u32)0x000000A0)
|
||||
#define PWR_PVDLevel_2V8 ((u32)0x000000C0)
|
||||
#define PWR_PVDLevel_2V9 ((u32)0x000000E0)
|
||||
|
||||
#define IS_PWR_PVD_LEVEL(LEVEL) (((LEVEL) == PWR_PVDLevel_2V2) || ((LEVEL) == PWR_PVDLevel_2V3)|| \
|
||||
((LEVEL) == PWR_PVDLevel_2V4) || ((LEVEL) == PWR_PVDLevel_2V5)|| \
|
||||
((LEVEL) == PWR_PVDLevel_2V6) || ((LEVEL) == PWR_PVDLevel_2V7)|| \
|
||||
((LEVEL) == PWR_PVDLevel_2V8) || ((LEVEL) == PWR_PVDLevel_2V9))
|
||||
|
||||
/* Regulator state is STOP mode */
|
||||
#define PWR_Regulator_ON ((u32)0x00000000)
|
||||
#define PWR_Regulator_LowPower ((u32)0x00000001)
|
||||
|
||||
#define IS_PWR_REGULATOR(REGULATOR) (((REGULATOR) == PWR_Regulator_ON) || \
|
||||
((REGULATOR) == PWR_Regulator_LowPower))
|
||||
|
||||
/* STOP mode entry */
|
||||
#define PWR_STOPEntry_WFI ((u8)0x01)
|
||||
#define PWR_STOPEntry_WFE ((u8)0x02)
|
||||
|
||||
#define IS_PWR_STOP_ENTRY(ENTRY) (((ENTRY) == PWR_STOPEntry_WFI) || ((ENTRY) == PWR_STOPEntry_WFE))
|
||||
|
||||
/* PWR Flag */
|
||||
#define PWR_FLAG_WU ((u32)0x00000001)
|
||||
#define PWR_FLAG_SB ((u32)0x00000002)
|
||||
#define PWR_FLAG_PVDO ((u32)0x00000004)
|
||||
|
||||
#define IS_PWR_GET_FLAG(FLAG) (((FLAG) == PWR_FLAG_WU) || ((FLAG) == PWR_FLAG_SB) || \
|
||||
((FLAG) == PWR_FLAG_PVDO))
|
||||
#define IS_PWR_CLEAR_FLAG(FLAG) (((FLAG) == PWR_FLAG_WU) || ((FLAG) == PWR_FLAG_SB))
|
||||
|
||||
/* Exported macro ------------------------------------------------------------*/
|
||||
/* Exported functions ------------------------------------------------------- */
|
||||
void PWR_DeInit(void);
|
||||
void PWR_BackupAccessCmd(FunctionalState NewState);
|
||||
void PWR_PVDCmd(FunctionalState NewState);
|
||||
void PWR_PVDLevelConfig(u32 PWR_PVDLevel);
|
||||
void PWR_WakeUpPinCmd(FunctionalState NewState);
|
||||
void PWR_EnterSTOPMode(u32 PWR_Regulator, u8 PWR_STOPEntry);
|
||||
void PWR_EnterSTANDBYMode(void);
|
||||
FlagStatus PWR_GetFlagStatus(u32 PWR_FLAG);
|
||||
void PWR_ClearFlag(u32 PWR_FLAG);
|
||||
|
||||
#endif /* __STM32F10x_PWR_H */
|
||||
|
||||
/******************* (C) COPYRIGHT 2008 STMicroelectronics *****END OF FILE****/
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,70 @@
|
||||
/******************** (C) COPYRIGHT 2008 STMicroelectronics ********************
|
||||
* File Name : stm32f10x_rtc.h
|
||||
* Author : MCD Application Team
|
||||
* Version : V2.0.3
|
||||
* Date : 09/22/2008
|
||||
* Description : This file contains all the functions prototypes for the
|
||||
* RTC firmware library.
|
||||
********************************************************************************
|
||||
* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
|
||||
* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
|
||||
* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
|
||||
* CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
|
||||
* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
|
||||
*******************************************************************************/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __STM32F10x_RTC_H
|
||||
#define __STM32F10x_RTC_H
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32f10x_map.h"
|
||||
|
||||
/* Exported types ------------------------------------------------------------*/
|
||||
/* Exported constants --------------------------------------------------------*/
|
||||
/* RTC interrupts define -----------------------------------------------------*/
|
||||
#define RTC_IT_OW ((u16)0x0004) /* Overflow interrupt */
|
||||
#define RTC_IT_ALR ((u16)0x0002) /* Alarm interrupt */
|
||||
#define RTC_IT_SEC ((u16)0x0001) /* Second interrupt */
|
||||
|
||||
#define IS_RTC_IT(IT) ((((IT) & (u16)0xFFF8) == 0x00) && ((IT) != 0x00))
|
||||
|
||||
#define IS_RTC_GET_IT(IT) (((IT) == RTC_IT_OW) || ((IT) == RTC_IT_ALR) || \
|
||||
((IT) == RTC_IT_SEC))
|
||||
|
||||
/* RTC interrupts flags ------------------------------------------------------*/
|
||||
#define RTC_FLAG_RTOFF ((u16)0x0020) /* RTC Operation OFF flag */
|
||||
#define RTC_FLAG_RSF ((u16)0x0008) /* Registers Synchronized flag */
|
||||
#define RTC_FLAG_OW ((u16)0x0004) /* Overflow flag */
|
||||
#define RTC_FLAG_ALR ((u16)0x0002) /* Alarm flag */
|
||||
#define RTC_FLAG_SEC ((u16)0x0001) /* Second flag */
|
||||
|
||||
#define IS_RTC_CLEAR_FLAG(FLAG) ((((FLAG) & (u16)0xFFF0) == 0x00) && ((FLAG) != 0x00))
|
||||
|
||||
#define IS_RTC_GET_FLAG(FLAG) (((FLAG) == RTC_FLAG_RTOFF) || ((FLAG) == RTC_FLAG_RSF) || \
|
||||
((FLAG) == RTC_FLAG_OW) || ((FLAG) == RTC_FLAG_ALR) || \
|
||||
((FLAG) == RTC_FLAG_SEC))
|
||||
|
||||
#define IS_RTC_PRESCALER(PRESCALER) ((PRESCALER) <= 0xFFFFF)
|
||||
|
||||
/* Exported macro ------------------------------------------------------------*/
|
||||
/* Exported functions ------------------------------------------------------- */
|
||||
void RTC_ITConfig(u16 RTC_IT, FunctionalState NewState);
|
||||
void RTC_EnterConfigMode(void);
|
||||
void RTC_ExitConfigMode(void);
|
||||
u32 RTC_GetCounter(void);
|
||||
void RTC_SetCounter(u32 CounterValue);
|
||||
void RTC_SetPrescaler(u32 PrescalerValue);
|
||||
void RTC_SetAlarm(u32 AlarmValue);
|
||||
u32 RTC_GetDivider(void);
|
||||
void RTC_WaitForLastTask(void);
|
||||
void RTC_WaitForSynchro(void);
|
||||
FlagStatus RTC_GetFlagStatus(u16 RTC_FLAG);
|
||||
void RTC_ClearFlag(u16 RTC_FLAG);
|
||||
ITStatus RTC_GetITStatus(u16 RTC_IT);
|
||||
void RTC_ClearITPendingBit(u16 RTC_IT);
|
||||
|
||||
#endif /* __STM32F10x_RTC_H */
|
||||
|
||||
/******************* (C) COPYRIGHT 2008 STMicroelectronics *****END OF FILE****/
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,64 @@
|
||||
/******************** (C) COPYRIGHT 2008 STMicroelectronics ********************
|
||||
* File Name : stm32f10x_systick.h
|
||||
* Author : MCD Application Team
|
||||
* Version : V2.0.3
|
||||
* Date : 09/22/2008
|
||||
* Description : This file contains all the functions prototypes for the
|
||||
* SysTick firmware library.
|
||||
********************************************************************************
|
||||
* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
|
||||
* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
|
||||
* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
|
||||
* CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
|
||||
* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
|
||||
*******************************************************************************/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __STM32F10x_SYSTICK_H
|
||||
#define __STM32F10x_SYSTICK_H
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32f10x_map.h"
|
||||
|
||||
/* Exported types ------------------------------------------------------------*/
|
||||
/* Exported constants --------------------------------------------------------*/
|
||||
/* SysTick clock source */
|
||||
#define SysTick_CLKSource_HCLK_Div8 ((u32)0xFFFFFFFB)
|
||||
#define SysTick_CLKSource_HCLK ((u32)0x00000004)
|
||||
|
||||
#define IS_SYSTICK_CLK_SOURCE(SOURCE) (((SOURCE) == SysTick_CLKSource_HCLK) || \
|
||||
((SOURCE) == SysTick_CLKSource_HCLK_Div8))
|
||||
|
||||
/* SysTick counter state */
|
||||
#define SysTick_Counter_Disable ((u32)0xFFFFFFFE)
|
||||
#define SysTick_Counter_Enable ((u32)0x00000001)
|
||||
#define SysTick_Counter_Clear ((u32)0x00000000)
|
||||
|
||||
#define IS_SYSTICK_COUNTER(COUNTER) (((COUNTER) == SysTick_Counter_Disable) || \
|
||||
((COUNTER) == SysTick_Counter_Enable) || \
|
||||
((COUNTER) == SysTick_Counter_Clear))
|
||||
|
||||
/* SysTick Flag */
|
||||
#define SysTick_FLAG_COUNT ((u32)0x00000010)
|
||||
#define SysTick_FLAG_SKEW ((u32)0x0000001E)
|
||||
#define SysTick_FLAG_NOREF ((u32)0x0000001F)
|
||||
|
||||
#define IS_SYSTICK_FLAG(FLAG) (((FLAG) == SysTick_FLAG_COUNT) || \
|
||||
((FLAG) == SysTick_FLAG_SKEW) || \
|
||||
((FLAG) == SysTick_FLAG_NOREF))
|
||||
|
||||
#define IS_SYSTICK_RELOAD(RELOAD) (((RELOAD) > 0) && ((RELOAD) <= 0xFFFFFF))
|
||||
|
||||
/* Exported macro ------------------------------------------------------------*/
|
||||
/* Exported functions ------------------------------------------------------- */
|
||||
void SysTick_CLKSourceConfig(u32 SysTick_CLKSource);
|
||||
void SysTick_SetReload(u32 Reload);
|
||||
void SysTick_CounterCmd(u32 SysTick_Counter);
|
||||
void SysTick_ITConfig(FunctionalState NewState);
|
||||
u32 SysTick_GetCounter(void);
|
||||
FlagStatus SysTick_GetFlagStatus(u8 SysTick_FLAG);
|
||||
|
||||
#endif /* __STM32F10x_SYSTICK_H */
|
||||
|
||||
/******************* (C) COPYRIGHT 2008 STMicroelectronics *****END OF FILE****/
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,80 @@
|
||||
/******************** (C) COPYRIGHT 2008 STMicroelectronics ********************
|
||||
* File Name : stm32f10x_type.h
|
||||
* Author : MCD Application Team
|
||||
* Version : V2.0.3
|
||||
* Date : 09/22/2008
|
||||
* Description : This file contains all the common data types used for the
|
||||
* STM32F10x firmware library.
|
||||
********************************************************************************
|
||||
* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
|
||||
* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
|
||||
* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
|
||||
* CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
|
||||
* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
|
||||
*******************************************************************************/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __STM32F10x_TYPE_H
|
||||
#define __STM32F10x_TYPE_H
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
/* Exported types ------------------------------------------------------------*/
|
||||
typedef signed long s32;
|
||||
typedef signed short s16;
|
||||
typedef signed char s8;
|
||||
|
||||
typedef signed long const sc32; /* Read Only */
|
||||
typedef signed short const sc16; /* Read Only */
|
||||
typedef signed char const sc8; /* Read Only */
|
||||
|
||||
typedef volatile signed long vs32;
|
||||
typedef volatile signed short vs16;
|
||||
typedef volatile signed char vs8;
|
||||
|
||||
typedef volatile signed long const vsc32; /* Read Only */
|
||||
typedef volatile signed short const vsc16; /* Read Only */
|
||||
typedef volatile signed char const vsc8; /* Read Only */
|
||||
|
||||
typedef unsigned long u32;
|
||||
typedef unsigned short u16;
|
||||
typedef unsigned char u8;
|
||||
|
||||
typedef unsigned long const uc32; /* Read Only */
|
||||
typedef unsigned short const uc16; /* Read Only */
|
||||
typedef unsigned char const uc8; /* Read Only */
|
||||
|
||||
typedef volatile unsigned long vu32;
|
||||
typedef volatile unsigned short vu16;
|
||||
typedef volatile unsigned char vu8;
|
||||
|
||||
typedef volatile unsigned long const vuc32; /* Read Only */
|
||||
typedef volatile unsigned short const vuc16; /* Read Only */
|
||||
typedef volatile unsigned char const vuc8; /* Read Only */
|
||||
|
||||
typedef enum {FALSE = 0, TRUE = !FALSE} bool;
|
||||
|
||||
typedef enum {RESET = 0, SET = !RESET} FlagStatus, ITStatus;
|
||||
|
||||
typedef enum {DISABLE = 0, ENABLE = !DISABLE} FunctionalState;
|
||||
#define IS_FUNCTIONAL_STATE(STATE) (((STATE) == DISABLE) || ((STATE) == ENABLE))
|
||||
|
||||
typedef enum {ERROR = 0, SUCCESS = !ERROR} ErrorStatus;
|
||||
|
||||
#define U8_MAX ((u8)255)
|
||||
#define S8_MAX ((s8)127)
|
||||
#define S8_MIN ((s8)-128)
|
||||
#define U16_MAX ((u16)65535u)
|
||||
#define S16_MAX ((s16)32767)
|
||||
#define S16_MIN ((s16)-32768)
|
||||
#define U32_MAX ((u32)4294967295uL)
|
||||
#define S32_MAX ((s32)2147483647)
|
||||
#define S32_MIN ((s32)-2147483648)
|
||||
|
||||
/* Exported constants --------------------------------------------------------*/
|
||||
/* Exported macro ------------------------------------------------------------*/
|
||||
/* Exported functions ------------------------------------------------------- */
|
||||
|
||||
#endif /* __STM32F10x_TYPE_H */
|
||||
|
||||
/******************* (C) COPYRIGHT 2008 STMicroelectronics *****END OF FILE****/
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,54 @@
|
||||
/******************** (C) COPYRIGHT 2008 STMicroelectronics ********************
|
||||
* File Name : stm32f10x_wwdg.h
|
||||
* Author : MCD Application Team
|
||||
* Version : V2.0.3
|
||||
* Date : 09/22/2008
|
||||
* Description : This file contains all the functions prototypes for the
|
||||
* WWDG firmware library.
|
||||
********************************************************************************
|
||||
* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
|
||||
* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
|
||||
* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
|
||||
* CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
|
||||
* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
|
||||
*******************************************************************************/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __STM32F10x_WWDG_H
|
||||
#define __STM32F10x_WWDG_H
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32f10x_map.h"
|
||||
|
||||
/* Exported types ------------------------------------------------------------*/
|
||||
/* Exported constants --------------------------------------------------------*/
|
||||
/* WWDG Prescaler */
|
||||
#define WWDG_Prescaler_1 ((u32)0x00000000)
|
||||
#define WWDG_Prescaler_2 ((u32)0x00000080)
|
||||
#define WWDG_Prescaler_4 ((u32)0x00000100)
|
||||
#define WWDG_Prescaler_8 ((u32)0x00000180)
|
||||
|
||||
#define IS_WWDG_PRESCALER(PRESCALER) (((PRESCALER) == WWDG_Prescaler_1) || \
|
||||
((PRESCALER) == WWDG_Prescaler_2) || \
|
||||
((PRESCALER) == WWDG_Prescaler_4) || \
|
||||
((PRESCALER) == WWDG_Prescaler_8))
|
||||
|
||||
#define IS_WWDG_WINDOW_VALUE(VALUE) ((VALUE) <= 0x7F)
|
||||
|
||||
#define IS_WWDG_COUNTER(COUNTER) (((COUNTER) >= 0x40) && ((COUNTER) <= 0x7F))
|
||||
|
||||
/* Exported macro ------------------------------------------------------------*/
|
||||
/* Exported functions ------------------------------------------------------- */
|
||||
void WWDG_DeInit(void);
|
||||
void WWDG_SetPrescaler(u32 WWDG_Prescaler);
|
||||
void WWDG_SetWindowValue(u8 WindowValue);
|
||||
void WWDG_EnableIT(void);
|
||||
void WWDG_SetCounter(u8 Counter);
|
||||
void WWDG_Enable(u8 Counter);
|
||||
FlagStatus WWDG_GetFlagStatus(void);
|
||||
void WWDG_ClearFlag(void);
|
||||
|
||||
#endif /* __STM32F10x_WWDG_H */
|
||||
|
||||
/******************* (C) COPYRIGHT 2008 STMicroelectronics *****END OF FILE****/
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,114 @@
|
||||
/******************** (C) COPYRIGHT 2008 STMicroelectronics ********************
|
||||
* File Name : stm32f10x_crc.c
|
||||
* Author : MCD Application Team
|
||||
* Version : V2.0.3
|
||||
* Date : 09/22/2008
|
||||
* Description : This file provides all the CRC firmware functions.
|
||||
********************************************************************************
|
||||
* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
|
||||
* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
|
||||
* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
|
||||
* CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
|
||||
* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
|
||||
*******************************************************************************/
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32f10x_crc.h"
|
||||
|
||||
/* Private typedef -----------------------------------------------------------*/
|
||||
/* Private define ------------------------------------------------------------*/
|
||||
|
||||
/* CR register bit mask */
|
||||
#define CR_RESET_Set ((u32)0x00000001)
|
||||
|
||||
/* Private macro -------------------------------------------------------------*/
|
||||
/* Private variables ---------------------------------------------------------*/
|
||||
/* Private function prototypes -----------------------------------------------*/
|
||||
/* Private functions ---------------------------------------------------------*/
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : CRC_ResetDR
|
||||
* Description : Resets the CRC Data register (DR).
|
||||
* Input : None
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void CRC_ResetDR(void)
|
||||
{
|
||||
/* Reset CRC generator */
|
||||
CRC->CR = CR_RESET_Set;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : CRC_CalcCRC
|
||||
* Description : Computes the 32-bit CRC of a given data word(32-bit).
|
||||
* Input : - Data: data word(32-bit) to compute its CRC
|
||||
* Output : None
|
||||
* Return : 32-bit CRC
|
||||
*******************************************************************************/
|
||||
u32 CRC_CalcCRC(u32 Data)
|
||||
{
|
||||
CRC->DR = Data;
|
||||
|
||||
return (CRC->DR);
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : CRC_CalcBlockCRC
|
||||
* Description : Computes the 32-bit CRC of a given buffer of data word(32-bit).
|
||||
* Input : - pBuffer: pointer to the buffer containing the data to be
|
||||
* computed
|
||||
* - BufferLength: length of the buffer to be computed
|
||||
* Output : None
|
||||
* Return : 32-bit CRC
|
||||
*******************************************************************************/
|
||||
u32 CRC_CalcBlockCRC(u32 pBuffer[], u32 BufferLength)
|
||||
{
|
||||
u32 index = 0;
|
||||
|
||||
for(index = 0; index < BufferLength; index++)
|
||||
{
|
||||
CRC->DR = pBuffer[index];
|
||||
}
|
||||
|
||||
return (CRC->DR);
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : CRC_GetCRC
|
||||
* Description : Returns the current CRC value.
|
||||
* Input : None
|
||||
* Output : None
|
||||
* Return : 32-bit CRC
|
||||
*******************************************************************************/
|
||||
u32 CRC_GetCRC(void)
|
||||
{
|
||||
return (CRC->DR);
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : CRC_SetIDRegister
|
||||
* Description : Stores a 8-bit data in the Independent Data(ID) register.
|
||||
* Input : - IDValue: 8-bit value to be stored in the ID register
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void CRC_SetIDRegister(u8 IDValue)
|
||||
{
|
||||
CRC->IDR = IDValue;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : CRC_GetIDRegister
|
||||
* Description : Returns the 8-bit data stored in the Independent Data(ID) register
|
||||
* Input : None
|
||||
* Output : None
|
||||
* Return : 8-bit value of the ID register
|
||||
*******************************************************************************/
|
||||
u8 CRC_GetIDRegister(void)
|
||||
{
|
||||
return (CRC->IDR);
|
||||
}
|
||||
|
||||
/******************* (C) COPYRIGHT 2008 STMicroelectronics *****END OF FILE****/
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,97 @@
|
||||
/******************** (C) COPYRIGHT 2008 STMicroelectronics ********************
|
||||
* File Name : stm32f10x_dbgmcu.c
|
||||
* Author : MCD Application Team
|
||||
* Version : V2.0.3
|
||||
* Date : 09/22/2008
|
||||
* Description : This file provides all the DBGMCU firmware functions.
|
||||
********************************************************************************
|
||||
* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
|
||||
* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
|
||||
* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
|
||||
* CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
|
||||
* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
|
||||
*******************************************************************************/
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32f10x_dbgmcu.h"
|
||||
|
||||
/* Private typedef -----------------------------------------------------------*/
|
||||
/* Private define ------------------------------------------------------------*/
|
||||
#define IDCODE_DEVID_Mask ((u32)0x00000FFF)
|
||||
|
||||
/* Private macro -------------------------------------------------------------*/
|
||||
/* Private variables ---------------------------------------------------------*/
|
||||
/* Private function prototypes -----------------------------------------------*/
|
||||
/* Private functions ---------------------------------------------------------*/
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : DBGMCU_GetREVID
|
||||
* Description : Returns the device revision identifier.
|
||||
* Input : None
|
||||
* Output : None
|
||||
* Return : Device revision identifier
|
||||
*******************************************************************************/
|
||||
u32 DBGMCU_GetREVID(void)
|
||||
{
|
||||
return(DBGMCU->IDCODE >> 16);
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : DBGMCU_GetDEVID
|
||||
* Description : Returns the device identifier.
|
||||
* Input : None
|
||||
* Output : None
|
||||
* Return : Device identifier
|
||||
*******************************************************************************/
|
||||
u32 DBGMCU_GetDEVID(void)
|
||||
{
|
||||
return(DBGMCU->IDCODE & IDCODE_DEVID_Mask);
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : DBGMCU_Config
|
||||
* Description : Configures the specified peripheral and low power mode behavior
|
||||
* when the MCU under Debug mode.
|
||||
* Input : - DBGMCU_Periph: specifies the peripheral and low power mode.
|
||||
* This parameter can be any combination of the following values:
|
||||
* - DBGMCU_SLEEP: Keep debugger connection during SLEEP mode
|
||||
* - DBGMCU_STOP: Keep debugger connection during STOP mode
|
||||
* - DBGMCU_STANDBY: Keep debugger connection during STANDBY mode
|
||||
* - DBGMCU_IWDG_STOP: Debug IWDG stopped when Core is halted
|
||||
* - DBGMCU_WWDG_STOP: Debug WWDG stopped when Core is halted
|
||||
* - DBGMCU_TIM1_STOP: TIM1 counter stopped when Core is halted
|
||||
* - DBGMCU_TIM2_STOP: TIM2 counter stopped when Core is halted
|
||||
* - DBGMCU_TIM3_STOP: TIM3 counter stopped when Core is halted
|
||||
* - DBGMCU_TIM4_STOP: TIM4 counter stopped when Core is halted
|
||||
* - DBGMCU_CAN_STOP: Debug CAN stopped when Core is halted
|
||||
* - DBGMCU_I2C1_SMBUS_TIMEOUT: I2C1 SMBUS timeout mode stopped
|
||||
* when Core is halted
|
||||
* - DBGMCU_I2C2_SMBUS_TIMEOUT: I2C2 SMBUS timeout mode stopped
|
||||
* when Core is halted
|
||||
* - DBGMCU_TIM5_STOP: TIM5 counter stopped when Core is halted
|
||||
* - DBGMCU_TIM6_STOP: TIM6 counter stopped when Core is halted
|
||||
* - DBGMCU_TIM7_STOP: TIM7 counter stopped when Core is halted
|
||||
* - DBGMCU_TIM8_STOP: TIM8 counter stopped when Core is halted
|
||||
* - NewState: new state of the specified peripheral in Debug mode.
|
||||
* This parameter can be: ENABLE or DISABLE.
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void DBGMCU_Config(u32 DBGMCU_Periph, FunctionalState NewState)
|
||||
{
|
||||
/* Check the parameters */
|
||||
assert_param(IS_DBGMCU_PERIPH(DBGMCU_Periph));
|
||||
assert_param(IS_FUNCTIONAL_STATE(NewState));
|
||||
|
||||
if (NewState != DISABLE)
|
||||
{
|
||||
DBGMCU->CR |= DBGMCU_Periph;
|
||||
}
|
||||
else
|
||||
{
|
||||
DBGMCU->CR &= ~DBGMCU_Periph;
|
||||
}
|
||||
}
|
||||
|
||||
/******************* (C) COPYRIGHT 2008 STMicroelectronics *****END OF FILE****/
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,148 @@
|
||||
/******************** (C) COPYRIGHT 2008 STMicroelectronics ********************
|
||||
* File Name : stm32f10x_iwdg.c
|
||||
* Author : MCD Application Team
|
||||
* Version : V2.0.3
|
||||
* Date : 09/22/2008
|
||||
* Description : This file provides all the IWDG firmware functions.
|
||||
********************************************************************************
|
||||
* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
|
||||
* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
|
||||
* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
|
||||
* CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
|
||||
* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
|
||||
*******************************************************************************/
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32f10x_iwdg.h"
|
||||
|
||||
/* Private typedef -----------------------------------------------------------*/
|
||||
/* Private define ------------------------------------------------------------*/
|
||||
/* ---------------------- IWDG registers bit mask ------------------------ */
|
||||
/* KR register bit mask */
|
||||
#define KR_KEY_Reload ((u16)0xAAAA)
|
||||
#define KR_KEY_Enable ((u16)0xCCCC)
|
||||
|
||||
/* Private macro -------------------------------------------------------------*/
|
||||
/* Private variables ---------------------------------------------------------*/
|
||||
/* Private function prototypes -----------------------------------------------*/
|
||||
/* Private functions ---------------------------------------------------------*/
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : IWDG_WriteAccessCmd
|
||||
* Description : Enables or disables write access to IWDG_PR and IWDG_RLR
|
||||
* registers.
|
||||
* Input : - IWDG_WriteAccess: new state of write access to IWDG_PR and
|
||||
* IWDG_RLR registers.
|
||||
* This parameter can be one of the following values:
|
||||
* - IWDG_WriteAccess_Enable: Enable write access to
|
||||
* IWDG_PR and IWDG_RLR registers
|
||||
* - IWDG_WriteAccess_Disable: Disable write access to
|
||||
* IWDG_PR and IWDG_RLR registers
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void IWDG_WriteAccessCmd(u16 IWDG_WriteAccess)
|
||||
{
|
||||
/* Check the parameters */
|
||||
assert_param(IS_IWDG_WRITE_ACCESS(IWDG_WriteAccess));
|
||||
|
||||
IWDG->KR = IWDG_WriteAccess;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : IWDG_SetPrescaler
|
||||
* Description : Sets IWDG Prescaler value.
|
||||
* Input : - IWDG_Prescaler: specifies the IWDG Prescaler value.
|
||||
* This parameter can be one of the following values:
|
||||
* - IWDG_Prescaler_4: IWDG prescaler set to 4
|
||||
* - IWDG_Prescaler_8: IWDG prescaler set to 8
|
||||
* - IWDG_Prescaler_16: IWDG prescaler set to 16
|
||||
* - IWDG_Prescaler_32: IWDG prescaler set to 32
|
||||
* - IWDG_Prescaler_64: IWDG prescaler set to 64
|
||||
* - IWDG_Prescaler_128: IWDG prescaler set to 128
|
||||
* - IWDG_Prescaler_256: IWDG prescaler set to 256
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void IWDG_SetPrescaler(u8 IWDG_Prescaler)
|
||||
{
|
||||
/* Check the parameters */
|
||||
assert_param(IS_IWDG_PRESCALER(IWDG_Prescaler));
|
||||
|
||||
IWDG->PR = IWDG_Prescaler;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : IWDG_SetReload
|
||||
* Description : Sets IWDG Reload value.
|
||||
* Input : - Reload: specifies the IWDG Reload value.
|
||||
* This parameter must be a number between 0 and 0x0FFF.
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void IWDG_SetReload(u16 Reload)
|
||||
{
|
||||
/* Check the parameters */
|
||||
assert_param(IS_IWDG_RELOAD(Reload));
|
||||
|
||||
IWDG->RLR = Reload;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : IWDG_ReloadCounter
|
||||
* Description : Reloads IWDG counter with value defined in the reload register
|
||||
* (write access to IWDG_PR and IWDG_RLR registers disabled).
|
||||
* Input : None
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void IWDG_ReloadCounter(void)
|
||||
{
|
||||
IWDG->KR = KR_KEY_Reload;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : IWDG_Enable
|
||||
* Description : Enables IWDG (write access to IWDG_PR and IWDG_RLR registers
|
||||
* disabled).
|
||||
* Input : None
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void IWDG_Enable(void)
|
||||
{
|
||||
IWDG->KR = KR_KEY_Enable;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : IWDG_GetFlagStatus
|
||||
* Description : Checks whether the specified IWDG flag is set or not.
|
||||
* Input : - IWDG_FLAG: specifies the flag to check.
|
||||
* This parameter can be one of the following values:
|
||||
* - IWDG_FLAG_PVU: Prescaler Value Update on going
|
||||
* - IWDG_FLAG_RVU: Reload Value Update on going
|
||||
* Output : None
|
||||
* Return : The new state of IWDG_FLAG (SET or RESET).
|
||||
*******************************************************************************/
|
||||
FlagStatus IWDG_GetFlagStatus(u16 IWDG_FLAG)
|
||||
{
|
||||
FlagStatus bitstatus = RESET;
|
||||
|
||||
/* Check the parameters */
|
||||
assert_param(IS_IWDG_FLAG(IWDG_FLAG));
|
||||
|
||||
if ((IWDG->SR & IWDG_FLAG) != (u32)RESET)
|
||||
{
|
||||
bitstatus = SET;
|
||||
}
|
||||
else
|
||||
{
|
||||
bitstatus = RESET;
|
||||
}
|
||||
|
||||
/* Return the flag status */
|
||||
return bitstatus;
|
||||
}
|
||||
|
||||
/******************* (C) COPYRIGHT 2008 STMicroelectronics *****END OF FILE****/
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,181 @@
|
||||
/******************** (C) COPYRIGHT 2008 STMicroelectronics ********************
|
||||
* File Name : stm32f10x_systick.c
|
||||
* Author : MCD Application Team
|
||||
* Version : V2.0.3
|
||||
* Date : 09/22/2008
|
||||
* Description : This file provides all the SysTick firmware functions.
|
||||
********************************************************************************
|
||||
* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
|
||||
* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
|
||||
* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
|
||||
* CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
|
||||
* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
|
||||
*******************************************************************************/
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32f10x_systick.h"
|
||||
|
||||
/* Private typedef -----------------------------------------------------------*/
|
||||
/* Private define ------------------------------------------------------------*/
|
||||
/* ---------------------- SysTick registers bit mask -------------------- */
|
||||
/* CTRL TICKINT Mask */
|
||||
#define CTRL_TICKINT_Set ((u32)0x00000002)
|
||||
#define CTRL_TICKINT_Reset ((u32)0xFFFFFFFD)
|
||||
|
||||
/* Private macro -------------------------------------------------------------*/
|
||||
/* Private variables ---------------------------------------------------------*/
|
||||
/* Private function prototypes -----------------------------------------------*/
|
||||
/* Private functions ---------------------------------------------------------*/
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : SysTick_CLKSourceConfig
|
||||
* Description : Configures the SysTick clock source.
|
||||
* Input : - SysTick_CLKSource: specifies the SysTick clock source.
|
||||
* This parameter can be one of the following values:
|
||||
* - SysTick_CLKSource_HCLK_Div8: AHB clock divided by 8
|
||||
* selected as SysTick clock source.
|
||||
* - SysTick_CLKSource_HCLK: AHB clock selected as
|
||||
* SysTick clock source.
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void SysTick_CLKSourceConfig(u32 SysTick_CLKSource)
|
||||
{
|
||||
/* Check the parameters */
|
||||
assert_param(IS_SYSTICK_CLK_SOURCE(SysTick_CLKSource));
|
||||
|
||||
if (SysTick_CLKSource == SysTick_CLKSource_HCLK)
|
||||
{
|
||||
SysTick->CTRL |= SysTick_CLKSource_HCLK;
|
||||
}
|
||||
else
|
||||
{
|
||||
SysTick->CTRL &= SysTick_CLKSource_HCLK_Div8;
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : SysTick_SetReload
|
||||
* Description : Sets SysTick Reload value.
|
||||
* Input : - Reload: SysTick Reload new value.
|
||||
* This parameter must be a number between 1 and 0xFFFFFF.
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void SysTick_SetReload(u32 Reload)
|
||||
{
|
||||
/* Check the parameters */
|
||||
assert_param(IS_SYSTICK_RELOAD(Reload));
|
||||
|
||||
SysTick->LOAD = Reload;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : SysTick_CounterCmd
|
||||
* Description : Enables or disables the SysTick counter.
|
||||
* Input : - SysTick_Counter: new state of the SysTick counter.
|
||||
* This parameter can be one of the following values:
|
||||
* - SysTick_Counter_Disable: Disable counter
|
||||
* - SysTick_Counter_Enable: Enable counter
|
||||
* - SysTick_Counter_Clear: Clear counter value to 0
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void SysTick_CounterCmd(u32 SysTick_Counter)
|
||||
{
|
||||
/* Check the parameters */
|
||||
assert_param(IS_SYSTICK_COUNTER(SysTick_Counter));
|
||||
|
||||
if (SysTick_Counter == SysTick_Counter_Enable)
|
||||
{
|
||||
SysTick->CTRL |= SysTick_Counter_Enable;
|
||||
}
|
||||
else if (SysTick_Counter == SysTick_Counter_Disable)
|
||||
{
|
||||
SysTick->CTRL &= SysTick_Counter_Disable;
|
||||
}
|
||||
else /* SysTick_Counter == SysTick_Counter_Clear */
|
||||
{
|
||||
SysTick->VAL = SysTick_Counter_Clear;
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : SysTick_ITConfig
|
||||
* Description : Enables or disables the SysTick Interrupt.
|
||||
* Input : - NewState: new state of the SysTick Interrupt.
|
||||
* This parameter can be: ENABLE or DISABLE.
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void SysTick_ITConfig(FunctionalState NewState)
|
||||
{
|
||||
/* Check the parameters */
|
||||
assert_param(IS_FUNCTIONAL_STATE(NewState));
|
||||
|
||||
if (NewState != DISABLE)
|
||||
{
|
||||
SysTick->CTRL |= CTRL_TICKINT_Set;
|
||||
}
|
||||
else
|
||||
{
|
||||
SysTick->CTRL &= CTRL_TICKINT_Reset;
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : SysTick_GetCounter
|
||||
* Description : Gets SysTick counter value.
|
||||
* Input : None
|
||||
* Output : None
|
||||
* Return : SysTick current value
|
||||
*******************************************************************************/
|
||||
u32 SysTick_GetCounter(void)
|
||||
{
|
||||
return(SysTick->VAL);
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : SysTick_GetFlagStatus
|
||||
* Description : Checks whether the specified SysTick flag is set or not.
|
||||
* Input : - SysTick_FLAG: specifies the flag to check.
|
||||
* This parameter can be one of the following values:
|
||||
* - SysTick_FLAG_COUNT
|
||||
* - SysTick_FLAG_SKEW
|
||||
* - SysTick_FLAG_NOREF
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
FlagStatus SysTick_GetFlagStatus(u8 SysTick_FLAG)
|
||||
{
|
||||
u32 statusreg = 0, tmp = 0 ;
|
||||
FlagStatus bitstatus = RESET;
|
||||
|
||||
/* Check the parameters */
|
||||
assert_param(IS_SYSTICK_FLAG(SysTick_FLAG));
|
||||
|
||||
/* Get the SysTick register index */
|
||||
tmp = SysTick_FLAG >> 3;
|
||||
|
||||
if (tmp == 2) /* The flag to check is in CTRL register */
|
||||
{
|
||||
statusreg = SysTick->CTRL;
|
||||
}
|
||||
else /* The flag to check is in CALIB register */
|
||||
{
|
||||
statusreg = SysTick->CALIB;
|
||||
}
|
||||
|
||||
if ((statusreg & ((u32)1 << SysTick_FLAG)) != (u32)RESET)
|
||||
{
|
||||
bitstatus = SET;
|
||||
}
|
||||
else
|
||||
{
|
||||
bitstatus = RESET;
|
||||
}
|
||||
return bitstatus;
|
||||
}
|
||||
|
||||
/******************* (C) COPYRIGHT 2008 STMicroelectronics *****END OF FILE****/
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,185 @@
|
||||
/******************** (C) COPYRIGHT 2008 STMicroelectronics ********************
|
||||
* File Name : stm32f10x_wwdg.c
|
||||
* Author : MCD Application Team
|
||||
* Version : V2.0.3
|
||||
* Date : 09/22/2008
|
||||
* Description : This file provides all the WWDG firmware functions.
|
||||
********************************************************************************
|
||||
* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
|
||||
* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
|
||||
* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
|
||||
* CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
|
||||
* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
|
||||
*******************************************************************************/
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32f10x_wwdg.h"
|
||||
#include "stm32f10x_rcc.h"
|
||||
|
||||
/* Private typedef -----------------------------------------------------------*/
|
||||
/* Private define ------------------------------------------------------------*/
|
||||
/* ----------- WWDG registers bit address in the alias region ----------- */
|
||||
#define WWDG_OFFSET (WWDG_BASE - PERIPH_BASE)
|
||||
|
||||
/* Alias word address of EWI bit */
|
||||
#define CFR_OFFSET (WWDG_OFFSET + 0x04)
|
||||
#define EWI_BitNumber 0x09
|
||||
#define CFR_EWI_BB (PERIPH_BB_BASE + (CFR_OFFSET * 32) + (EWI_BitNumber * 4))
|
||||
|
||||
/* --------------------- WWDG registers bit mask ------------------------ */
|
||||
/* CR register bit mask */
|
||||
#define CR_WDGA_Set ((u32)0x00000080)
|
||||
|
||||
/* CFR register bit mask */
|
||||
#define CFR_WDGTB_Mask ((u32)0xFFFFFE7F)
|
||||
#define CFR_W_Mask ((u32)0xFFFFFF80)
|
||||
|
||||
#define BIT_Mask ((u8)0x7F)
|
||||
|
||||
/* Private macro -------------------------------------------------------------*/
|
||||
/* Private variables ---------------------------------------------------------*/
|
||||
/* Private function prototypes -----------------------------------------------*/
|
||||
/* Private functions ---------------------------------------------------------*/
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : WWDG_DeInit
|
||||
* Description : Deinitializes the WWDG peripheral registers to their default
|
||||
* reset values.
|
||||
* Input : None
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void WWDG_DeInit(void)
|
||||
{
|
||||
RCC_APB1PeriphResetCmd(RCC_APB1Periph_WWDG, ENABLE);
|
||||
RCC_APB1PeriphResetCmd(RCC_APB1Periph_WWDG, DISABLE);
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : WWDG_SetPrescaler
|
||||
* Description : Sets the WWDG Prescaler.
|
||||
* Input : - WWDG_Prescaler: specifies the WWDG Prescaler.
|
||||
* This parameter can be one of the following values:
|
||||
* - WWDG_Prescaler_1: WWDG counter clock = (PCLK1/4096)/1
|
||||
* - WWDG_Prescaler_2: WWDG counter clock = (PCLK1/4096)/2
|
||||
* - WWDG_Prescaler_4: WWDG counter clock = (PCLK1/4096)/4
|
||||
* - WWDG_Prescaler_8: WWDG counter clock = (PCLK1/4096)/8
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void WWDG_SetPrescaler(u32 WWDG_Prescaler)
|
||||
{
|
||||
u32 tmpreg = 0;
|
||||
|
||||
/* Check the parameters */
|
||||
assert_param(IS_WWDG_PRESCALER(WWDG_Prescaler));
|
||||
|
||||
/* Clear WDGTB[1:0] bits */
|
||||
tmpreg = WWDG->CFR & CFR_WDGTB_Mask;
|
||||
|
||||
/* Set WDGTB[1:0] bits according to WWDG_Prescaler value */
|
||||
tmpreg |= WWDG_Prescaler;
|
||||
|
||||
/* Store the new value */
|
||||
WWDG->CFR = tmpreg;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : WWDG_SetWindowValue
|
||||
* Description : Sets the WWDG window value.
|
||||
* Input : - WindowValue: specifies the window value to be compared to
|
||||
* the downcounter.
|
||||
* This parameter value must be lower than 0x80.
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void WWDG_SetWindowValue(u8 WindowValue)
|
||||
{
|
||||
u32 tmpreg = 0;
|
||||
|
||||
/* Check the parameters */
|
||||
assert_param(IS_WWDG_WINDOW_VALUE(WindowValue));
|
||||
|
||||
/* Clear W[6:0] bits */
|
||||
tmpreg = WWDG->CFR & CFR_W_Mask;
|
||||
|
||||
/* Set W[6:0] bits according to WindowValue value */
|
||||
tmpreg |= WindowValue & BIT_Mask;
|
||||
|
||||
/* Store the new value */
|
||||
WWDG->CFR = tmpreg;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : WWDG_EnableIT
|
||||
* Description : Enables the WWDG Early Wakeup interrupt(EWI).
|
||||
* Input : None
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void WWDG_EnableIT(void)
|
||||
{
|
||||
*(vu32 *) CFR_EWI_BB = (u32)ENABLE;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : WWDG_SetCounter
|
||||
* Description : Sets the WWDG counter value.
|
||||
* Input : - Counter: specifies the watchdog counter value.
|
||||
* This parameter must be a number between 0x40 and 0x7F.
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void WWDG_SetCounter(u8 Counter)
|
||||
{
|
||||
/* Check the parameters */
|
||||
assert_param(IS_WWDG_COUNTER(Counter));
|
||||
|
||||
/* Write to T[6:0] bits to configure the counter value, no need to do
|
||||
a read-modify-write; writing a 0 to WDGA bit does nothing */
|
||||
WWDG->CR = Counter & BIT_Mask;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : WWDG_Enable
|
||||
* Description : Enables WWDG and load the counter value.
|
||||
* - Counter: specifies the watchdog counter value.
|
||||
* This parameter must be a number between 0x40 and 0x7F.
|
||||
* Input : None
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void WWDG_Enable(u8 Counter)
|
||||
{
|
||||
/* Check the parameters */
|
||||
assert_param(IS_WWDG_COUNTER(Counter));
|
||||
|
||||
WWDG->CR = CR_WDGA_Set | Counter;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : WWDG_GetFlagStatus
|
||||
* Description : Checks whether the Early Wakeup interrupt flag is set or not.
|
||||
* Input : None
|
||||
* Output : None
|
||||
* Return : The new state of the Early Wakeup interrupt flag (SET or RESET)
|
||||
*******************************************************************************/
|
||||
FlagStatus WWDG_GetFlagStatus(void)
|
||||
{
|
||||
return (FlagStatus)(WWDG->SR);
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : WWDG_ClearFlag
|
||||
* Description : Clears Early Wakeup interrupt flag.
|
||||
* Input : None
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void WWDG_ClearFlag(void)
|
||||
{
|
||||
WWDG->SR = (u32)RESET;
|
||||
}
|
||||
|
||||
/******************* (C) COPYRIGHT 2008 STMicroelectronics *****END OF FILE****/
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,173 @@
|
||||
/******************** (C) COPYRIGHT 2008 STMicroelectronics ********************
|
||||
* File Name : msd.h
|
||||
* Author : MCD Application Team
|
||||
* Version : V2.1
|
||||
* Date : 05/30/2008
|
||||
* Description : Header for msd.c file.
|
||||
********************************************************************************
|
||||
* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
|
||||
* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
|
||||
* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
|
||||
* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
|
||||
* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
|
||||
* FOR MORE INFORMATION PLEASE CAREFULLY READ THE LICENSE AGREEMENT FILE LOCATED
|
||||
* IN THE ROOT DIRECTORY OF THIS FIRMWARE PACKAGE.
|
||||
*******************************************************************************/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __MSD_H
|
||||
#define __MSD_H
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32f10x_lib.h"
|
||||
|
||||
/* Private define ------------------------------------------------------------*/
|
||||
/* Block Size */
|
||||
#define BLOCK_SIZE 512
|
||||
|
||||
/* Dummy byte */
|
||||
#define DUMMY 0xFF
|
||||
|
||||
/* Start Data tokens */
|
||||
/* Tokens (necessary because at nop/idle (and CS active) only 0xff is on the data/command line) */
|
||||
#define MSD_START_DATA_SINGLE_BLOCK_READ 0xFE /* Data token start byte, Start Single Block Read */
|
||||
#define MSD_START_DATA_MULTIPLE_BLOCK_READ 0xFE /* Data token start byte, Start Multiple Block Read */
|
||||
#define MSD_START_DATA_SINGLE_BLOCK_WRITE 0xFE /* Data token start byte, Start Single Block Write */
|
||||
#define MSD_START_DATA_MULTIPLE_BLOCK_WRITE 0xFD /* Data token start byte, Start Multiple Block Write */
|
||||
#define MSD_STOP_DATA_MULTIPLE_BLOCK_WRITE 0xFD /* Data toke stop byte, Stop Multiple Block Write */
|
||||
|
||||
/* MSD functions return */
|
||||
#define MSD_SUCCESS 0x00
|
||||
#define MSD_FAIL 0xFF
|
||||
|
||||
/* MSD reponses and error flags */
|
||||
#define MSD_RESPONSE_NO_ERROR 0x00
|
||||
#define MSD_IN_IDLE_STATE 0x01
|
||||
#define MSD_ERASE_RESET 0x02
|
||||
#define MSD_ILLEGAL_COMMAND 0x04
|
||||
#define MSD_COM_CRC_ERROR 0x08
|
||||
#define MSD_ERASE_SEQUENCE_ERROR 0x10
|
||||
#define MSD_ADDRESS_ERROR 0x20
|
||||
#define MSD_PARAMETER_ERROR 0x40
|
||||
#define MSD_RESPONSE_FAILURE 0xFF
|
||||
|
||||
/* Data response error */
|
||||
#define MSD_DATA_OK 0x05
|
||||
#define MSD_DATA_CRC_ERROR 0x0B
|
||||
#define MSD_DATA_WRITE_ERROR 0x0D
|
||||
#define MSD_DATA_OTHER_ERROR 0xFF
|
||||
|
||||
/* Commands: CMDxx = CMD-number | 0x40 */
|
||||
#define MSD_GO_IDLE_STATE 0 /* CMD0=0x40 */
|
||||
#define MSD_SEND_OP_COND 1 /* CMD1=0x41 */
|
||||
#define MSD_SEND_CSD 9 /* CMD9=0x49 */
|
||||
#define MSD_SEND_CID 10 /* CMD10=0x4A */
|
||||
#define MSD_STOP_TRANSMISSION 12 /* CMD12=0x4C */
|
||||
#define MSD_SEND_STATUS 13 /* CMD13=0x4D */
|
||||
#define MSD_SET_BLOCKLEN 16 /* CMD16=0x50 */
|
||||
#define MSD_READ_SINGLE_BLOCK 17 /* CMD17=0x51 */
|
||||
#define MSD_READ_MULTIPLE_BLOCK 18 /* CMD18=0x52 */
|
||||
#define MSD_SET_BLOCK_COUNT 23 /* CMD23=0x57 */
|
||||
#define MSD_WRITE_BLOCK 24 /* CMD24=0x58 */
|
||||
#define MSD_WRITE_MULTIPLE_BLOCK 25 /* CMD25=0x59 */
|
||||
#define MSD_PROGRAM_CSD 27 /* CMD27=0x5B */
|
||||
#define MSD_SET_WRITE_PROT 28 /* CMD28=0x5C */
|
||||
#define MSD_CLR_WRITE_PROT 29 /* CMD29=0x5D */
|
||||
#define MSD_SEND_WRITE_PROT 30 /* CMD30=0x5E */
|
||||
#define MSD_TAG_SECTOR_START 32 /* CMD32=0x60 */
|
||||
#define MSD_TAG_SECTOR_END 33 /* CMD33=0x61 */
|
||||
#define MSD_UNTAG_SECTOR 34 /* CMD34=0x62 */
|
||||
#define MSD_TAG_ERASE_GROUP_START 35 /* CMD35=0x63 */
|
||||
#define MSD_TAG_ERASE_GROUP_END 36 /* CMD36=0x64 */
|
||||
#define MSD_UNTAG_ERASE_GROUP 37 /* CMD37=0x65 */
|
||||
#define MSD_ERASE 38 /* CMD38=0x66 */
|
||||
#define MSD_READ_OCR 39 /* CMD39=0x67 */
|
||||
#define MSD_CRC_ON_OFF 40 /* CMD40=0x68 */
|
||||
|
||||
/* Exported types ------------------------------------------------------------*/
|
||||
/* Private variables ---------------------------------------------------------*/
|
||||
typedef struct _MSD_CSD /*Card Specific Data*/
|
||||
{
|
||||
vu8 CSDStruct; /* CSD structure */
|
||||
vu8 SysSpecVersion; /* System specification version */
|
||||
vu8 Reserved1; /* Reserved */
|
||||
vu8 TAAC; /* Data read access-time 1 */
|
||||
vu8 NSAC; /* Data read access-time 2 in CLK cycles */
|
||||
vu8 MaxBusClkFrec; /* Max. bus clock frequency */
|
||||
vu16 CardComdClasses; /* Card command classes */
|
||||
vu8 RdBlockLen; /* Max. read data block length */
|
||||
vu8 PartBlockRead; /* Partial blocks for read allowed */
|
||||
vu8 WrBlockMisalign; /* Write block misalignment */
|
||||
vu8 RdBlockMisalign; /* Read block misalignment */
|
||||
vu8 DSRImpl; /* DSR implemented */
|
||||
vu8 Reserved2; /* Reserved */
|
||||
vu16 DeviceSize; /* Device Size */
|
||||
vu8 MaxRdCurrentVDDMin; /* Max. read current @ VDD min */
|
||||
vu8 MaxRdCurrentVDDMax; /* Max. read current @ VDD max */
|
||||
vu8 MaxWrCurrentVDDMin; /* Max. write current @ VDD min */
|
||||
vu8 MaxWrCurrentVDDMax; /* Max. write current @ VDD max */
|
||||
vu8 DeviceSizeMul; /* Device size multiplier */
|
||||
vu8 EraseGrSize; /* Erase group size */
|
||||
vu8 EraseGrMul; /* Erase group size multiplier */
|
||||
vu8 WrProtectGrSize; /* Write protect group size */
|
||||
vu8 WrProtectGrEnable; /* Write protect group enable */
|
||||
vu8 ManDeflECC; /* Manufacturer default ECC */
|
||||
vu8 WrSpeedFact; /* Write speed factor */
|
||||
vu8 MaxWrBlockLen; /* Max. write data block length */
|
||||
vu8 WriteBlockPaPartial; /* Partial blocks for write allowed */
|
||||
vu8 Reserved3; /* Reserded */
|
||||
vu8 ContentProtectAppli; /* Content protection application */
|
||||
vu8 FileFormatGrouop; /* File format group */
|
||||
vu8 CopyFlag; /* Copy flag (OTP) */
|
||||
vu8 PermWrProtect; /* Permanent write protection */
|
||||
vu8 TempWrProtect; /* Temporary write protection */
|
||||
vu8 FileFormat; /* File Format */
|
||||
vu8 ECC; /* ECC code */
|
||||
vu8 msd_CRC; /* CRC */
|
||||
vu8 Reserved4; /* always 1*/
|
||||
}
|
||||
sMSD_CSD;
|
||||
|
||||
typedef struct _MSD_CID /*Card Identification Data*/
|
||||
{
|
||||
vu8 ManufacturerID; /* ManufacturerID */
|
||||
vu16 OEM_AppliID; /* OEM/Application ID */
|
||||
vu32 ProdName1; /* Product Name part1 */
|
||||
vu8 ProdName2; /* Product Name part2*/
|
||||
vu8 ProdRev; /* Product Revision */
|
||||
vu32 ProdSN; /* Product Serial Number */
|
||||
vu8 Reserved1; /* Reserved1 */
|
||||
vu16 ManufactDate; /* Manufacturing Date */
|
||||
vu8 msd_CRC; /* CRC */
|
||||
vu8 Reserved2; /* always 1*/
|
||||
}
|
||||
sMSD_CID;
|
||||
|
||||
/* Exported constants --------------------------------------------------------*/
|
||||
/* Exported macro ------------------------------------------------------------*/
|
||||
/* Exported functions ------------------------------------------------------- */
|
||||
|
||||
/*----- High layer function -----*/
|
||||
u8 MSD_Init(void);
|
||||
u8 MSD_WriteBlock(u8* pBuffer, u32 WriteAddr, u16 NumByteToWrite);
|
||||
u8 MSD_ReadBlock(u8* pBuffer, u32 ReadAddr, u16 NumByteToRead);
|
||||
u8 MSD_WriteBuffer(u8* pBuffer, u32 WriteAddr, u32 NumByteToWrite);
|
||||
u8 MSD_ReadBuffer(u8* pBuffer, u32 ReadAddr, u32 NumByteToRead);
|
||||
u8 MSD_GetCSDRegister(sMSD_CSD* MSD_csd);
|
||||
u8 MSD_GetCIDRegister(sMSD_CID* MSD_cid);
|
||||
|
||||
/*----- Medium layer function -----*/
|
||||
void MSD_SendCmd(u8 Cmd, u32 Arg, u8 Crc);
|
||||
u8 MSD_GetResponse(u8 Response);
|
||||
u8 MSD_GetDataResponse(void);
|
||||
u8 MSD_GoIdleState(void);
|
||||
u16 MSD_GetStatus(void);
|
||||
|
||||
/*----- Low layer function -----*/
|
||||
void MSD_WriteByte(u8 byte);
|
||||
u8 MSD_ReadByte(void);
|
||||
|
||||
#endif /* __MSD_H */
|
||||
|
||||
/******************* (C) COPYRIGHT 2008 STMicroelectronics *****END OF FILE****/
|
||||
@@ -0,0 +1,158 @@
|
||||
### uVision2 Project, (C) Keil Software
|
||||
### Do not modify !
|
||||
|
||||
cExt (*.c)
|
||||
aExt (*.s*; *.src; *.a*)
|
||||
oExt (*.obj)
|
||||
lExt (*.lib)
|
||||
tExt (*.txt; *.h; *.inc)
|
||||
pExt (*.plm)
|
||||
CppX (*.cpp)
|
||||
DaveTm { 0,0,0,0,0,0,0,0 }
|
||||
|
||||
Target (RT-Thread/STM32), 0x0004 // Tools: 'ARM-ADS'
|
||||
GRPOPT 1,(Startup),1,0,0
|
||||
GRPOPT 2,(Library),0,0,0
|
||||
GRPOPT 3,(Kernel),0,0,0
|
||||
GRPOPT 4,(STM32),0,0,0
|
||||
GRPOPT 5,(LwIP),0,0,0
|
||||
GRPOPT 6,(finsh),0,0,0
|
||||
GRPOPT 7,(Filesystem),0,0,0
|
||||
|
||||
OPTFFF 1,1,1,0,0,0,0,0,<.\application.c><application.c>
|
||||
OPTFFF 1,2,1,0,0,0,0,0,<.\board.c><board.c>
|
||||
OPTFFF 1,3,1,0,0,0,0,0,<.\startup.c><startup.c>
|
||||
OPTFFF 1,4,2,234881024,0,0,0,0,<.\cortexm3_macro.s><cortexm3_macro.s>
|
||||
OPTFFF 1,5,1,0,0,0,0,0,<.\stm32f10x_it.c><stm32f10x_it.c>
|
||||
OPTFFF 1,6,5,0,0,0,0,0,<.\stm32f10x_conf.h><stm32f10x_conf.h>
|
||||
OPTFFF 1,7,5,0,0,0,0,0,<.\rtconfig.h><rtconfig.h>
|
||||
OPTFFF 1,8,1,0,0,0,0,0,<.\usart.c><usart.c>
|
||||
OPTFFF 1,9,1,0,0,0,0,0,<.\enc28j60.c><enc28j60.c>
|
||||
OPTFFF 1,10,1,0,0,0,0,0,<.\httpserver-netconn.c><httpserver-netconn.c>
|
||||
OPTFFF 1,11,1,0,0,0,0,0,<.\rtc.c><rtc.c>
|
||||
OPTFFF 1,12,1,0,0,0,0,0,<.\msd.c><msd.c>
|
||||
OPTFFF 2,13,1,0,0,0,0,0,<.\library\src\stm32f10x_wwdg.c><stm32f10x_wwdg.c>
|
||||
OPTFFF 2,14,1,0,0,0,0,0,<.\library\src\stm32f10x_adc.c><stm32f10x_adc.c>
|
||||
OPTFFF 2,15,1,0,0,0,0,0,<.\library\src\stm32f10x_bkp.c><stm32f10x_bkp.c>
|
||||
OPTFFF 2,16,1,0,0,0,0,0,<.\library\src\stm32f10x_can.c><stm32f10x_can.c>
|
||||
OPTFFF 2,17,1,0,0,0,0,0,<.\library\src\stm32f10x_crc.c><stm32f10x_crc.c>
|
||||
OPTFFF 2,18,1,0,0,0,0,0,<.\library\src\stm32f10x_dac.c><stm32f10x_dac.c>
|
||||
OPTFFF 2,19,1,0,0,0,0,0,<.\library\src\stm32f10x_dbgmcu.c><stm32f10x_dbgmcu.c>
|
||||
OPTFFF 2,20,1,0,0,0,0,0,<.\library\src\stm32f10x_dma.c><stm32f10x_dma.c>
|
||||
OPTFFF 2,21,1,0,0,0,0,0,<.\library\src\stm32f10x_exti.c><stm32f10x_exti.c>
|
||||
OPTFFF 2,22,1,0,0,0,0,0,<.\library\src\stm32f10x_flash.c><stm32f10x_flash.c>
|
||||
OPTFFF 2,23,1,0,0,0,0,0,<.\library\src\stm32f10x_gpio.c><stm32f10x_gpio.c>
|
||||
OPTFFF 2,24,1,0,0,0,0,0,<.\library\src\stm32f10x_i2c.c><stm32f10x_i2c.c>
|
||||
OPTFFF 2,25,1,0,0,0,0,0,<.\library\src\stm32f10x_iwdg.c><stm32f10x_iwdg.c>
|
||||
OPTFFF 2,26,1,0,0,0,0,0,<.\library\src\stm32f10x_lib.c><stm32f10x_lib.c>
|
||||
OPTFFF 2,27,1,0,0,0,0,0,<.\library\src\stm32f10x_nvic.c><stm32f10x_nvic.c>
|
||||
OPTFFF 2,28,1,0,0,0,0,0,<.\library\src\stm32f10x_pwr.c><stm32f10x_pwr.c>
|
||||
OPTFFF 2,29,1,0,0,0,0,0,<.\library\src\stm32f10x_rcc.c><stm32f10x_rcc.c>
|
||||
OPTFFF 2,30,1,0,0,0,0,0,<.\library\src\stm32f10x_rtc.c><stm32f10x_rtc.c>
|
||||
OPTFFF 2,31,1,0,0,0,0,0,<.\library\src\stm32f10x_spi.c><stm32f10x_spi.c>
|
||||
OPTFFF 2,32,1,0,0,0,0,0,<.\library\src\stm32f10x_systick.c><stm32f10x_systick.c>
|
||||
OPTFFF 2,33,1,0,0,0,0,0,<.\library\src\stm32f10x_tim.c><stm32f10x_tim.c>
|
||||
OPTFFF 2,34,1,0,0,0,0,0,<.\library\src\stm32f10x_usart.c><stm32f10x_usart.c>
|
||||
OPTFFF 3,35,1,0,0,0,0,0,<..\..\src\clock.c><clock.c>
|
||||
OPTFFF 3,36,1,0,0,0,0,0,<..\..\src\idle.c><idle.c>
|
||||
OPTFFF 3,37,1,0,0,0,0,0,<..\..\src\ipc.c><ipc.c>
|
||||
OPTFFF 3,38,1,0,0,0,0,0,<..\..\src\mem.c><mem.c>
|
||||
OPTFFF 3,39,1,0,0,0,0,0,<..\..\src\mempool.c><mempool.c>
|
||||
OPTFFF 3,40,1,0,0,0,0,0,<..\..\src\object.c><object.c>
|
||||
OPTFFF 3,41,1,0,0,0,0,0,<..\..\src\scheduler.c><scheduler.c>
|
||||
OPTFFF 3,42,1,201326592,0,0,0,0,<..\..\src\thread.c><thread.c>
|
||||
OPTFFF 3,43,1,0,0,0,0,0,<..\..\src\timer.c><timer.c>
|
||||
OPTFFF 3,44,1,0,0,0,0,0,<..\..\src\irq.c><irq.c>
|
||||
OPTFFF 3,45,1,0,0,0,0,0,<..\..\src\kservice.c><kservice.c>
|
||||
OPTFFF 3,46,1,0,0,0,0,0,<..\..\src\device.c><device.c>
|
||||
OPTFFF 3,47,1,0,0,0,0,0,<..\..\src\slab.c><slab.c>
|
||||
OPTFFF 4,48,1,0,0,0,0,0,<..\..\libcpu\arm\stm32\stack.c><stack.c>
|
||||
OPTFFF 4,49,1,0,0,0,0,0,<..\..\libcpu\arm\stm32\interrupt.c><interrupt.c>
|
||||
OPTFFF 4,50,1,0,0,0,0,0,<..\..\libcpu\arm\stm32\cpu.c><cpu.c>
|
||||
OPTFFF 4,51,1,0,0,0,0,0,<..\..\libcpu\arm\stm32\serial.c><serial.c>
|
||||
OPTFFF 4,52,2,0,0,0,0,0,<..\..\libcpu\arm\stm32\context_rvds.S><context_rvds.S>
|
||||
OPTFFF 4,53,2,0,0,0,0,0,<..\..\libcpu\arm\stm32\start_rvds.s><start_rvds.s>
|
||||
OPTFFF 4,54,2,0,0,0,0,0,<..\..\libcpu\arm\stm32\fault_rvds.S><fault_rvds.S>
|
||||
OPTFFF 4,55,1,0,0,0,0,0,<..\..\libcpu\arm\stm32\fault.c><fault.c>
|
||||
OPTFFF 5,56,1,0,0,0,0,0,<..\..\net\lwip\src\core\dhcp.c><dhcp.c>
|
||||
OPTFFF 5,57,1,0,0,0,0,0,<..\..\net\lwip\src\core\dns.c><dns.c>
|
||||
OPTFFF 5,58,1,0,0,0,0,0,<..\..\net\lwip\src\core\init.c><init.c>
|
||||
OPTFFF 5,59,1,0,0,0,0,0,<..\..\net\lwip\src\core\memp_tiny.c><memp_tiny.c>
|
||||
OPTFFF 5,60,1,0,0,0,0,0,<..\..\net\lwip\src\core\netif.c><netif.c>
|
||||
OPTFFF 5,61,1,0,0,0,0,0,<..\..\net\lwip\src\core\pbuf.c><pbuf.c>
|
||||
OPTFFF 5,62,1,0,0,0,0,0,<..\..\net\lwip\src\core\raw.c><raw.c>
|
||||
OPTFFF 5,63,1,0,0,0,0,0,<..\..\net\lwip\src\core\stats.c><stats.c>
|
||||
OPTFFF 5,64,1,0,0,0,0,0,<..\..\net\lwip\src\core\sys.c><sys.c>
|
||||
OPTFFF 5,65,1,0,0,0,0,0,<..\..\net\lwip\src\core\tcp.c><tcp.c>
|
||||
OPTFFF 5,66,1,0,0,0,0,0,<..\..\net\lwip\src\core\tcp_in.c><tcp_in.c>
|
||||
OPTFFF 5,67,1,0,0,0,0,0,<..\..\net\lwip\src\core\tcp_out.c><tcp_out.c>
|
||||
OPTFFF 5,68,1,0,0,0,0,0,<..\..\net\lwip\src\core\udp.c><udp.c>
|
||||
OPTFFF 5,69,1,0,0,0,0,0,<..\..\net\lwip\src\core\ipv4\ip_frag.c><ip_frag.c>
|
||||
OPTFFF 5,70,1,0,0,0,0,0,<..\..\net\lwip\src\core\ipv4\autoip.c><autoip.c>
|
||||
OPTFFF 5,71,1,0,0,0,0,0,<..\..\net\lwip\src\core\ipv4\icmp.c><icmp.c>
|
||||
OPTFFF 5,72,1,0,0,0,0,0,<..\..\net\lwip\src\core\ipv4\igmp.c><igmp.c>
|
||||
OPTFFF 5,73,1,0,0,0,0,0,<..\..\net\lwip\src\core\ipv4\inet.c><inet.c>
|
||||
OPTFFF 5,74,1,0,0,0,0,0,<..\..\net\lwip\src\core\ipv4\inet_chksum.c><inet_chksum.c>
|
||||
OPTFFF 5,75,1,0,0,0,0,0,<..\..\net\lwip\src\core\ipv4\ip.c><ip.c>
|
||||
OPTFFF 5,76,1,0,0,0,0,0,<..\..\net\lwip\src\core\ipv4\ip_addr.c><ip_addr.c>
|
||||
OPTFFF 5,77,1,0,0,0,0,0,<..\..\net\lwip\src\netif\ethernetif.c><ethernetif.c>
|
||||
OPTFFF 5,78,1,0,0,0,0,0,<..\..\net\lwip\src\netif\etharp.c><etharp.c>
|
||||
OPTFFF 5,79,1,0,0,0,0,0,<..\..\net\lwip\src\arch\sys_arch_init.c><sys_arch_init.c>
|
||||
OPTFFF 5,80,1,0,0,0,0,0,<..\..\net\lwip\src\arch\sys_arch.c><sys_arch.c>
|
||||
OPTFFF 5,81,1,0,0,0,0,0,<..\..\net\lwip\src\api\tcpip.c><tcpip.c>
|
||||
OPTFFF 5,82,1,0,0,0,0,0,<..\..\net\lwip\src\api\api_lib.c><api_lib.c>
|
||||
OPTFFF 5,83,1,0,0,0,0,0,<..\..\net\lwip\src\api\api_msg.c><api_msg.c>
|
||||
OPTFFF 5,84,1,0,0,0,0,0,<..\..\net\lwip\src\api\err.c><err.c>
|
||||
OPTFFF 5,85,1,0,0,0,0,0,<..\..\net\lwip\src\api\netbuf.c><netbuf.c>
|
||||
OPTFFF 5,86,1,0,0,0,0,0,<..\..\net\lwip\src\api\netdb.c><netdb.c>
|
||||
OPTFFF 5,87,1,0,0,0,0,0,<..\..\net\lwip\src\api\netifapi.c><netifapi.c>
|
||||
OPTFFF 5,88,1,150994944,0,0,0,0,<..\..\net\lwip\src\api\sockets.c><sockets.c>
|
||||
OPTFFF 6,89,1,0,0,0,0,0,<..\..\finsh\cmd.c><cmd.c>
|
||||
OPTFFF 6,90,1,0,0,0,0,0,<..\..\finsh\finsh_compiler.c><finsh_compiler.c>
|
||||
OPTFFF 6,91,1,0,0,0,0,0,<..\..\finsh\finsh_error.c><finsh_error.c>
|
||||
OPTFFF 6,92,1,0,0,0,0,0,<..\..\finsh\finsh_heap.c><finsh_heap.c>
|
||||
OPTFFF 6,93,1,0,0,0,0,0,<..\..\finsh\finsh_init.c><finsh_init.c>
|
||||
OPTFFF 6,94,1,0,0,0,0,0,<..\..\finsh\finsh_node.c><finsh_node.c>
|
||||
OPTFFF 6,95,1,0,0,0,0,0,<..\..\finsh\finsh_ops.c><finsh_ops.c>
|
||||
OPTFFF 6,96,1,0,0,0,0,0,<..\..\finsh\finsh_parser.c><finsh_parser.c>
|
||||
OPTFFF 6,97,1,0,0,0,0,0,<..\..\finsh\finsh_token.c><finsh_token.c>
|
||||
OPTFFF 6,98,1,0,0,0,0,0,<..\..\finsh\finsh_var.c><finsh_var.c>
|
||||
OPTFFF 6,99,1,0,0,0,0,0,<..\..\finsh\finsh_vm.c><finsh_vm.c>
|
||||
OPTFFF 6,100,1,0,0,0,0,0,<..\..\finsh\shell.c><shell.c>
|
||||
OPTFFF 6,101,1,0,0,0,0,0,<..\..\finsh\symbol.c><symbol.c>
|
||||
OPTFFF 7,102,1,0,0,0,0,0,<..\..\filesystem\dfs\src\dfs_cache.c><dfs_cache.c>
|
||||
OPTFFF 7,103,1,0,0,0,0,0,<..\..\filesystem\dfs\src\dfs_fs.c><dfs_fs.c>
|
||||
OPTFFF 7,104,1,0,0,0,0,0,<..\..\filesystem\dfs\src\dfs_init.c><dfs_init.c>
|
||||
OPTFFF 7,105,1,268435456,0,0,0,0,<..\..\filesystem\dfs\src\dfs_posix.c><dfs_posix.c>
|
||||
OPTFFF 7,106,1,0,0,0,0,0,<..\..\filesystem\dfs\src\dfs_raw.c><dfs_raw.c>
|
||||
OPTFFF 7,107,1,0,0,0,0,0,<..\..\filesystem\dfs\src\dfs_util.c><dfs_util.c>
|
||||
OPTFFF 7,108,1,0,0,0,0,0,<..\..\filesystem\dfs\filesystems\efsl\src\base\efs.c><efs.c>
|
||||
OPTFFF 7,109,1,0,0,0,0,0,<..\..\filesystem\dfs\filesystems\efsl\src\base\extract.c><extract.c>
|
||||
OPTFFF 7,110,1,0,0,0,0,0,<..\..\filesystem\dfs\filesystems\efsl\src\base\partition.c><partition.c>
|
||||
OPTFFF 7,111,1,0,0,0,0,0,<..\..\filesystem\dfs\filesystems\efsl\src\base\plibc.c><plibc.c>
|
||||
OPTFFF 7,112,1,0,0,0,0,0,<..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\dir.c><dir.c>
|
||||
OPTFFF 7,113,1,0,0,0,0,0,<..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\fat.c><fat.c>
|
||||
OPTFFF 7,114,1,0,0,0,0,0,<..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\file.c><file.c>
|
||||
OPTFFF 7,115,1,0,0,0,0,0,<..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\fs.c><fs.c>
|
||||
OPTFFF 7,116,1,0,0,0,0,0,<..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\ls.c><ls.c>
|
||||
OPTFFF 7,117,1,0,0,0,0,0,<..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\time.c><time.c>
|
||||
OPTFFF 7,118,1,0,0,0,0,0,<..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\ui.c><ui.c>
|
||||
|
||||
|
||||
TARGOPT 1, (RT-Thread/STM32)
|
||||
ADSCLK=8000000
|
||||
OPTTT 1,1,1,0
|
||||
OPTHX 1,65535,0,0,0
|
||||
OPTLX 79,66,8,<.\obj\>
|
||||
OPTOX 16
|
||||
OPTLT 1,1,1,0,1,1,0,1,0,0,0,0
|
||||
OPTXL 1,1,1,1,1,1,1,0,0
|
||||
OPTFL 1,0,1
|
||||
OPTAX 0
|
||||
OPTDL (SARMCM3.DLL)()(DARMSTM.DLL)(-pSTM32F103VB)(SARMCM3.DLL)()(TARMSTM.DLL)(-pSTM32F103VB)
|
||||
OPTDBG 49149,6,()()()()()()()()()() (Segger\JLTAgdi.dll)()()()
|
||||
OPTDF 0x0
|
||||
OPTLE <>
|
||||
OPTLC <>
|
||||
EndOpt
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,6 @@
|
||||
#ifndef __RTC_H__
|
||||
#define __RTC_H__
|
||||
|
||||
void rt_hw_rtc_init(void);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,145 @@
|
||||
/* RT-Thread config file */
|
||||
#ifndef __RTTHREAD_CFG_H__
|
||||
#define __RTTHREAD_CFG_H__
|
||||
|
||||
/* RT_NAME_MAX*/
|
||||
#define RT_NAME_MAX 8
|
||||
|
||||
/* RT_ALIGN_SIZE*/
|
||||
#define RT_ALIGN_SIZE 4
|
||||
|
||||
/* PRIORITY_MAX*/
|
||||
#define RT_THREAD_PRIORITY_MAX 32
|
||||
|
||||
/* Tick per Second*/
|
||||
#define RT_TICK_PER_SECOND 100
|
||||
|
||||
/* SECTION: RT_DEBUG */
|
||||
/* Thread Debug*/
|
||||
/* #define RT_DEBUG */
|
||||
/* #define RT_THREAD_DEBUG */
|
||||
|
||||
/* Using Hook*/
|
||||
#define RT_USING_HOOK
|
||||
|
||||
/* SECTION: IPC */
|
||||
/* Using Semaphore*/
|
||||
#define RT_USING_SEMAPHORE
|
||||
|
||||
/* Using Mutex*/
|
||||
#define RT_USING_MUTEX
|
||||
|
||||
/* Using Event*/
|
||||
#define RT_USING_EVENT
|
||||
|
||||
/* Using Faset Event*/
|
||||
/* #define RT_USING_FASTEVENT */
|
||||
|
||||
/* Using MailBox*/
|
||||
#define RT_USING_MAILBOX
|
||||
|
||||
/* Using Message Queue*/
|
||||
#define RT_USING_MESSAGEQUEUE
|
||||
|
||||
/* SECTION: Memory Management */
|
||||
/* Using Memory Pool Management*/
|
||||
#define RT_USING_MEMPOOL
|
||||
|
||||
/* Using Dynamic Heap Management*/
|
||||
#define RT_USING_HEAP
|
||||
|
||||
/* Using Small MM*/
|
||||
#define RT_USING_SMALL_MEM
|
||||
|
||||
/* Using SLAB Allocator*/
|
||||
/* #define RT_USING_SLAB */
|
||||
|
||||
/* SECTION: Device System */
|
||||
/* Using Device System*/
|
||||
#define RT_USING_DEVICE
|
||||
#define RT_USING_UART1
|
||||
/* #define RT_USING_UART2 */
|
||||
/* #define RT_USING_UART3 */
|
||||
|
||||
/* SECTION: Console options */
|
||||
/* the buffer size of console*/
|
||||
#define RT_CONSOLEBUF_SIZE 128
|
||||
|
||||
/* SECTION: FinSH shell options */
|
||||
/* Using FinSH as Shell*/
|
||||
#define RT_USING_FINSH
|
||||
/* Using symbol table */
|
||||
#define FINSH_USING_SYMTAB
|
||||
#define FINSH_USING_DESCRIPTION
|
||||
|
||||
/* SECTION: a mini libc */
|
||||
/* Using mini libc library*/
|
||||
/* #define RT_USING_MINILIBC */
|
||||
|
||||
/* SECTION: C++ support */
|
||||
/* Using C++ support*/
|
||||
/* #define RT_USING_CPLUSPLUS */
|
||||
|
||||
/* SECTION: DFS options */
|
||||
#define RT_USING_DFS
|
||||
/* the max number of mounted filesystem */
|
||||
#define DFS_FILESYSTEMS_MAX 1
|
||||
/* the max number of opened files */
|
||||
#define DFS_FD_MAX 2
|
||||
/* the max number of cached sector */
|
||||
#define DFS_CACHE_MAX_NUM 4
|
||||
|
||||
/* SECTION: lwip, a lighwight TCP/IP protocol stack */
|
||||
/* Using lighweight TCP/IP protocol stack*/
|
||||
/* #define RT_USING_LWIP */
|
||||
|
||||
/* Trace LwIP protocol*/
|
||||
/* #define RT_LWIP_DEBUG */
|
||||
|
||||
/* Enable ICMP protocol*/
|
||||
#define RT_LWIP_ICMP
|
||||
|
||||
/* Enable IGMP protocol*/
|
||||
#define RT_LWIP_IGMP
|
||||
|
||||
/* Enable UDP protocol*/
|
||||
#define RT_LWIP_UDP
|
||||
|
||||
/* Enable TCP protocol*/
|
||||
#define RT_LWIP_TCP
|
||||
|
||||
/* Enable SNMP protocol*/
|
||||
/* #define RT_LWIP_SNMP */
|
||||
|
||||
/* Using DHCP*/
|
||||
/* #define RT_LWIP_DHCP */
|
||||
|
||||
/* ip address of target*/
|
||||
#define RT_LWIP_IPADDR0 192
|
||||
#define RT_LWIP_IPADDR1 168
|
||||
#define RT_LWIP_IPADDR2 1
|
||||
#define RT_LWIP_IPADDR3 30
|
||||
|
||||
/* gateway address of target*/
|
||||
#define RT_LWIP_GWADDR0 192
|
||||
#define RT_LWIP_GWADDR1 168
|
||||
#define RT_LWIP_GWADDR2 1
|
||||
#define RT_LWIP_GWADDR3 1
|
||||
|
||||
/* mask address of target*/
|
||||
#define RT_LWIP_MSKADDR0 255
|
||||
#define RT_LWIP_MSKADDR1 255
|
||||
#define RT_LWIP_MSKADDR2 255
|
||||
#define RT_LWIP_MSKADDR3 0
|
||||
|
||||
/* tcp thread options */
|
||||
#define RT_LWIP_TCPTHREAD_PRIORITY 12
|
||||
#define RT_LWIP_TCPTHREAD_MBOX_SIZE 4
|
||||
#define RT_LWIP_TCPTHREAD_STACKSIZE 1024
|
||||
|
||||
/* ethernet if thread options */
|
||||
#define RT_LWIP_ETHTHREAD_PRIORITY 15
|
||||
#define RT_LWIP_ETHTHREAD_MBOX_SIZE 4
|
||||
#define RT_LWIP_ETHTHREAD_STACKSIZE 1024
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,147 @@
|
||||
/*
|
||||
* File : startup.c
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006, RT-Thread Develop Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://openlab.rt-thread.com/license/LICENSE
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2006-08-31 Bernard first implementation
|
||||
*/
|
||||
|
||||
#include <rthw.h>
|
||||
#include <rtthread.h>
|
||||
|
||||
#include "board.h"
|
||||
#include "rtc.h"
|
||||
|
||||
#ifdef RT_USING_LWIP
|
||||
#include <netif/ethernetif.h>
|
||||
#include "enc28j60.h"
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @addtogroup STM32
|
||||
*/
|
||||
|
||||
/*@{*/
|
||||
#ifdef RT_USING_FINSH
|
||||
extern void finsh_system_init(void);
|
||||
extern void finsh_set_device(char* device);
|
||||
#endif
|
||||
|
||||
extern int rt_application_init(void);
|
||||
|
||||
#ifdef __CC_ARM
|
||||
extern int Image$$RW_IRAM1$$ZI$$Limit;
|
||||
#elif __ICCARM__
|
||||
#pragma section="HEAP"
|
||||
#else
|
||||
extern int __bss_end;
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
/*******************************************************************************
|
||||
* Function Name : assert_failed
|
||||
* Description : Reports the name of the source file and the source line number
|
||||
* where the assert error has occurred.
|
||||
* Input : - file: pointer to the source file name
|
||||
* - line: assert error line source number
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void assert_failed(u8* file, u32 line)
|
||||
{
|
||||
rt_kprintf("\n\r Wrong parameter value detected on\r\n");
|
||||
rt_kprintf(" file %s\r\n", file);
|
||||
rt_kprintf(" line %d\r\n", line);
|
||||
|
||||
while (1) ;
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* This function will startup RT-Thread RTOS.
|
||||
*/
|
||||
void rtthread_startup(void)
|
||||
{
|
||||
/* init board */
|
||||
rt_hw_board_init();
|
||||
|
||||
/* show version */
|
||||
rt_show_version();
|
||||
|
||||
/* init tick */
|
||||
rt_system_tick_init();
|
||||
|
||||
/* init kernel object */
|
||||
rt_system_object_init();
|
||||
|
||||
/* init timer system */
|
||||
rt_system_timer_init();
|
||||
|
||||
#ifdef RT_USING_HEAP
|
||||
#ifdef __CC_ARM
|
||||
rt_system_heap_init((void*)&Image$$RW_IRAM1$$ZI$$Limit, (void*)0x20005000);
|
||||
#elif __ICCARM__
|
||||
rt_system_heap_init(__segment_end("HEAP"), (void*)0x20005000);
|
||||
#else
|
||||
/* init memory system */
|
||||
rt_system_heap_init((void*)&__bss_end, (void*)0x20005000);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* init scheduler system */
|
||||
rt_system_scheduler_init();
|
||||
|
||||
#ifdef RT_USING_LWIP
|
||||
eth_system_device_init();
|
||||
/* register ethernetif device */
|
||||
rt_hw_enc28j60_init();
|
||||
#endif
|
||||
|
||||
rt_hw_rtc_init();
|
||||
|
||||
/* init hardware serial device */
|
||||
rt_hw_usart_init();
|
||||
#ifdef RT_USING_DFS
|
||||
rt_hw_sdcard_init();
|
||||
#endif
|
||||
|
||||
/* init all device */
|
||||
rt_device_init_all();
|
||||
|
||||
/* init application */
|
||||
rt_application_init();
|
||||
|
||||
#ifdef RT_USING_FINSH
|
||||
/* init finsh */
|
||||
finsh_system_init();
|
||||
finsh_set_device("uart1");
|
||||
#endif
|
||||
|
||||
/* init idle thread */
|
||||
rt_thread_idle_init();
|
||||
|
||||
/* start scheduler */
|
||||
rt_system_scheduler_start();
|
||||
|
||||
/* never reach here */
|
||||
return ;
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
rt_uint32_t UNUSED level;
|
||||
|
||||
/* disable interrupt first */
|
||||
level = rt_hw_interrupt_disable();
|
||||
rtthread_startup();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*@}*/
|
||||
@@ -0,0 +1,154 @@
|
||||
/******************** (C) COPYRIGHT 2008 STMicroelectronics ********************
|
||||
* File Name : stm32f10x_conf.h
|
||||
* Author : MCD Application Team
|
||||
* Version : V1.1.2
|
||||
* Date : 09/22/2008
|
||||
* Description : Library configuration file.
|
||||
********************************************************************************
|
||||
* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
|
||||
* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
|
||||
* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
|
||||
* CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
|
||||
* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
|
||||
*******************************************************************************/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __STM32F10x_CONF_H
|
||||
#define __STM32F10x_CONF_H
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32f10x_type.h"
|
||||
|
||||
/* Exported types ------------------------------------------------------------*/
|
||||
/* Exported constants --------------------------------------------------------*/
|
||||
/* Uncomment the line below to compile the library in DEBUG mode, this will expanse
|
||||
the "assert_param" macro in the firmware library code (see "Exported macro"
|
||||
section below) */
|
||||
/* #define DEBUG 1*/
|
||||
|
||||
/* Comment the line below to disable the specific peripheral inclusion */
|
||||
/************************************* ADC ************************************/
|
||||
#define _ADC
|
||||
#define _ADC1
|
||||
|
||||
/************************************* BKP ************************************/
|
||||
#define _BKP
|
||||
|
||||
/************************************* CAN ************************************/
|
||||
#define _CAN
|
||||
|
||||
/************************************* CRC ************************************/
|
||||
#define _CRC
|
||||
|
||||
/************************************* DAC ************************************/
|
||||
#define _DAC
|
||||
|
||||
/************************************* DBGMCU *********************************/
|
||||
#define _DBGMCU
|
||||
|
||||
/************************************* DMA ************************************/
|
||||
#define _DMA
|
||||
#define _DMA1_Channel1
|
||||
#define _DMA1_Channel2
|
||||
#define _DMA1_Channel3
|
||||
#define _DMA1_Channel4
|
||||
#define _DMA1_Channel5
|
||||
#define _DMA1_Channel6
|
||||
#define _DMA1_Channel7
|
||||
|
||||
/************************************* EXTI ***********************************/
|
||||
#define _EXTI
|
||||
|
||||
/************************************* FLASH and Option Bytes *****************/
|
||||
#define _FLASH
|
||||
/* Uncomment the line below to enable FLASH program/erase/protections functions,
|
||||
otherwise only FLASH configuration (latency, prefetch, half cycle) functions
|
||||
are enabled */
|
||||
/* #define _FLASH_PROG */
|
||||
|
||||
/************************************* GPIO ***********************************/
|
||||
#define _GPIO
|
||||
#define _GPIOA
|
||||
#define _GPIOB
|
||||
#define _GPIOC
|
||||
#define _GPIOD
|
||||
#define _GPIOE
|
||||
#define _GPIOF
|
||||
#define _GPIOG
|
||||
#define _AFIO
|
||||
|
||||
/************************************* I2C ************************************/
|
||||
#define _I2C
|
||||
#define _I2C1
|
||||
#define _I2C2
|
||||
|
||||
/************************************* IWDG ***********************************/
|
||||
#define _IWDG
|
||||
|
||||
/************************************* NVIC ***********************************/
|
||||
#define _NVIC
|
||||
|
||||
/************************************* PWR ************************************/
|
||||
#define _PWR
|
||||
|
||||
/************************************* RCC ************************************/
|
||||
#define _RCC
|
||||
|
||||
/************************************* RTC ************************************/
|
||||
#define _RTC
|
||||
|
||||
/************************************* SPI ************************************/
|
||||
#define _SPI
|
||||
#define _SPI1
|
||||
#define _SPI2
|
||||
|
||||
/************************************* SysTick ********************************/
|
||||
#define _SysTick
|
||||
|
||||
/************************************* TIM ************************************/
|
||||
#define _TIM
|
||||
#define _TIM1
|
||||
#define _TIM2
|
||||
#define _TIM3
|
||||
#define _TIM4
|
||||
|
||||
/************************************* USART **********************************/
|
||||
#define _USART
|
||||
#define _USART1
|
||||
#define _USART2
|
||||
#define _USART3
|
||||
|
||||
/************************************* WWDG ***********************************/
|
||||
#define _WWDG
|
||||
|
||||
/* In the following line adjust the value of External High Speed oscillator (HSE)
|
||||
used in your application */
|
||||
#define HSE_Value ((u32)8000000) /* Value of the External oscillator in Hz*/
|
||||
|
||||
/* In the following line adjust the External High Speed oscillator (HSE) Startup
|
||||
Timeout value */
|
||||
#define HSEStartUp_TimeOut ((u16)0x0500) /* Time out for HSE start up */
|
||||
|
||||
/* Exported macro ------------------------------------------------------------*/
|
||||
#ifdef DEBUG
|
||||
/*******************************************************************************
|
||||
* Macro Name : assert_param
|
||||
* Description : The assert_param macro is used for function's parameters check.
|
||||
* It is used only if the library is compiled in DEBUG mode.
|
||||
* Input : - expr: If expr is false, it calls assert_failed function
|
||||
* which reports the name of the source file and the source
|
||||
* line number of the call that failed.
|
||||
* If expr is true, it returns no value.
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
#define assert_param(expr) ((expr) ? (void)0 : assert_failed((u8 *)__FILE__, __LINE__))
|
||||
/* Exported functions ------------------------------------------------------- */
|
||||
void assert_failed(u8* file, u32 line);
|
||||
#else
|
||||
#define assert_param(expr) ((void)0)
|
||||
#endif /* DEBUG */
|
||||
|
||||
#endif /* __STM32F10x_CONF_H */
|
||||
|
||||
/******************* (C) COPYRIGHT 2008 STMicroelectronics *****END OF FILE****/
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,100 @@
|
||||
/******************** (C) COPYRIGHT 2008 STMicroelectronics ********************
|
||||
* File Name : stm32f10x_it.h
|
||||
* Author : MCD Application Team
|
||||
* Version : V2.0.3
|
||||
* Date : 09/22/2008
|
||||
* Description : This file contains the headers of the interrupt handlers.
|
||||
********************************************************************************
|
||||
* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
|
||||
* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
|
||||
* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
|
||||
* CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
|
||||
* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
|
||||
*******************************************************************************/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __STM32F10x_IT_H
|
||||
#define __STM32F10x_IT_H
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32f10x_lib.h"
|
||||
|
||||
/* Exported types ------------------------------------------------------------*/
|
||||
/* Exported constants --------------------------------------------------------*/
|
||||
/* Exported macro ------------------------------------------------------------*/
|
||||
/* Exported functions ------------------------------------------------------- */
|
||||
|
||||
void NMIException(void);
|
||||
void HardFaultException(void);
|
||||
void MemManageException(void);
|
||||
void BusFaultException(void);
|
||||
void UsageFaultException(void);
|
||||
void DebugMonitor(void);
|
||||
void SVCHandler(void);
|
||||
void rt_hw_pend_sv(void);
|
||||
void SysTickHandler(void);
|
||||
void WWDG_IRQHandler(void);
|
||||
void PVD_IRQHandler(void);
|
||||
void TAMPER_IRQHandler(void);
|
||||
void RTC_IRQHandler(void);
|
||||
void FLASH_IRQHandler(void);
|
||||
void RCC_IRQHandler(void);
|
||||
void EXTI0_IRQHandler(void);
|
||||
void EXTI1_IRQHandler(void);
|
||||
void EXTI2_IRQHandler(void);
|
||||
void EXTI3_IRQHandler(void);
|
||||
void EXTI4_IRQHandler(void);
|
||||
void DMA1_Channel1_IRQHandler(void);
|
||||
void DMA1_Channel2_IRQHandler(void);
|
||||
void DMA1_Channel3_IRQHandler(void);
|
||||
void DMA1_Channel4_IRQHandler(void);
|
||||
void DMA1_Channel5_IRQHandler(void);
|
||||
void DMA1_Channel6_IRQHandler(void);
|
||||
void DMA1_Channel7_IRQHandler(void);
|
||||
void ADC1_2_IRQHandler(void);
|
||||
void USB_HP_CAN_TX_IRQHandler(void);
|
||||
void USB_LP_CAN_RX0_IRQHandler(void);
|
||||
void CAN_RX1_IRQHandler(void);
|
||||
void CAN_SCE_IRQHandler(void);
|
||||
void EXTI9_5_IRQHandler(void);
|
||||
void TIM1_BRK_IRQHandler(void);
|
||||
void TIM1_UP_IRQHandler(void);
|
||||
void TIM1_TRG_COM_IRQHandler(void);
|
||||
void TIM1_CC_IRQHandler(void);
|
||||
void TIM2_IRQHandler(void);
|
||||
void TIM3_IRQHandler(void);
|
||||
void TIM4_IRQHandler(void);
|
||||
void I2C1_EV_IRQHandler(void);
|
||||
void I2C1_ER_IRQHandler(void);
|
||||
void I2C2_EV_IRQHandler(void);
|
||||
void I2C2_ER_IRQHandler(void);
|
||||
void SPI1_IRQHandler(void);
|
||||
void SPI2_IRQHandler(void);
|
||||
void USART1_IRQHandler(void);
|
||||
void USART2_IRQHandler(void);
|
||||
void USART3_IRQHandler(void);
|
||||
void EXTI15_10_IRQHandler(void);
|
||||
void RTCAlarm_IRQHandler(void);
|
||||
void USBWakeUp_IRQHandler(void);
|
||||
void TIM8_BRK_IRQHandler(void);
|
||||
void TIM8_UP_IRQHandler(void);
|
||||
void TIM8_TRG_COM_IRQHandler(void);
|
||||
void TIM8_CC_IRQHandler(void);
|
||||
void ADC3_IRQHandler(void);
|
||||
void FSMC_IRQHandler(void);
|
||||
void SDIO_IRQHandler(void);
|
||||
void TIM5_IRQHandler(void);
|
||||
void SPI3_IRQHandler(void);
|
||||
void UART4_IRQHandler(void);
|
||||
void UART5_IRQHandler(void);
|
||||
void TIM6_IRQHandler(void);
|
||||
void TIM7_IRQHandler(void);
|
||||
void DMA2_Channel1_IRQHandler(void);
|
||||
void DMA2_Channel2_IRQHandler(void);
|
||||
void DMA2_Channel3_IRQHandler(void);
|
||||
void DMA2_Channel4_5_IRQHandler(void);
|
||||
|
||||
#endif /* __STM32F10x_IT_H */
|
||||
|
||||
/******************* (C) COPYRIGHT 2008 STMicroelectronics *****END OF FILE****/
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,9 @@
|
||||
#ifndef __USART_H__
|
||||
#define __USART_H__
|
||||
|
||||
#include <rthw.h>
|
||||
#include <rtthread.h>
|
||||
|
||||
void rt_hw_usart_init(void);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,40 @@
|
||||
#+------------------------------------------------------------------------------
|
||||
#| Device FileSystem
|
||||
#+------------------------------------------------------------------------------
|
||||
#| Copyright 2004, 2005 www.fayfayspace.org.
|
||||
#| All rights reserved.
|
||||
#+------------------------------------------------------------------------------
|
||||
#| File : config.mk, the configuration of makefile
|
||||
#+------------------------------------------------------------------------------
|
||||
#| Chang Logs:
|
||||
#| Date Author notes
|
||||
#| 2005-01-22 ffxz The first version.
|
||||
#+------------------------------------------------------------------------------
|
||||
|
||||
KERNEL_ROOT=$(DFS_ROOT_DIR)/../..
|
||||
include $(KERNEL_ROOT)/config.mk
|
||||
|
||||
CFLAGS +=-I$(KERNEL_ROOT)/include -I$(DFS_ROOT_DIR)/include -I.
|
||||
|
||||
# Source and objects
|
||||
DFS_SRC = $(DFS_ROOT_DIR)/src/dfs_fs.c $(DFS_ROOT_DIR)/src/dfs_init.c \
|
||||
$(DFS_ROOT_DIR)/src/dfs_util.c $(DFS_ROOT_DIR)/src/dfs_raw.c \
|
||||
$(DFS_ROOT_DIR)/src/dfs_api.c $(DFS_ROOT_DIR)/src/dfs_task.c \
|
||||
$(DFS_ROOT_DIR)/src/dfs_cache.c
|
||||
|
||||
ifneq ($(RT_USING_NEWLIB), 1)
|
||||
DFS_SRC += $(DFS_ROOT_DIR)/src/dfs_posix.c
|
||||
endif
|
||||
|
||||
DFS_OBJS= $(DFS_SRC:.c=.o)
|
||||
|
||||
FAT_SRC = $(DFS_ROOT_DIR)/filesystems/fatfs/fatfs_init.c \
|
||||
$(DFS_ROOT_DIR)/filesystems/fatfs/fatfs_mount.c \
|
||||
$(DFS_ROOT_DIR)/filesystems/fatfs/fatfs_fat.c \
|
||||
$(DFS_ROOT_DIR)/filesystems/fatfs/fatfs_misc.c \
|
||||
$(DFS_ROOT_DIR)/filesystems/fatfs/fatfs_file.c \
|
||||
$(DFS_ROOT_DIR)/filesystems/fatfs/fatfs_cache.c \
|
||||
$(DFS_ROOT_DIR)/filesystems/fatfs/fatfs_filename.c \
|
||||
$(DFS_ROOT_DIR)/filesystems/fatfs/fatfs_direntry.c \
|
||||
$(DFS_ROOT_DIR)/filesystems/fatfs/fatfs_mkfs.c
|
||||
FAT_OBJS = $(FAT_SRC:.c=.o)
|
||||
@@ -0,0 +1,100 @@
|
||||
/*
|
||||
+------------------------------------------------------------------------------
|
||||
| Project : Device Filesystem
|
||||
+------------------------------------------------------------------------------
|
||||
| Copyright 2004, 2005 www.fayfayspace.org.
|
||||
| All rights reserved.
|
||||
|------------------------------------------------------------------------------
|
||||
| File : dfs_opts.h, the option definitions of Device FileSystem
|
||||
|------------------------------------------------------------------------------
|
||||
| Chang Logs:
|
||||
| Date Author Notes
|
||||
| 2005-01-22 ffxz The first version.
|
||||
+------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef __DFS_CONFIG_H__
|
||||
#define __DFS_CONFIG_H__
|
||||
|
||||
/*
|
||||
+------------------------------------------------------------------------------
|
||||
| Device Manager options
|
||||
+------------------------------------------------------------------------------
|
||||
*/
|
||||
/* Device Options parameters */
|
||||
#define DEVICES_MAX 8
|
||||
#define DEVICE_NAME_MAX 8
|
||||
|
||||
/*
|
||||
+------------------------------------------------------------------------------
|
||||
| Device Filesystem options
|
||||
+------------------------------------------------------------------------------
|
||||
*/
|
||||
/* the max length of filesystem name */
|
||||
#define DFS_FS_NAME_MAX 4
|
||||
/* the max type of filesystem */
|
||||
#define DFS_FILESYSTEM_TYPES_MAX 2
|
||||
|
||||
/* the max length of path name */
|
||||
#define DFS_PATH_MAX 256
|
||||
/* the max length of file name */
|
||||
#define DFS_FILE_MAX 256
|
||||
|
||||
/* options for server task */
|
||||
#define DFS_MBOX_NUMBER 32
|
||||
#define DFS_SERVER_STACK 1024
|
||||
#define DFS_SERVER_PRI 110
|
||||
#define DFS_SERVER_SLICE 20
|
||||
|
||||
/*
|
||||
+------------------------------------------------------------------------------
|
||||
| FAT filesystem options
|
||||
+------------------------------------------------------------------------------
|
||||
*/
|
||||
/* file name max length */
|
||||
#define FAT_NAME_MAX 256
|
||||
/* max number of FAT filesystem */
|
||||
#define FATFS_MAX 2
|
||||
|
||||
/* the size of sector */
|
||||
#define SECTOR_SIZE 512
|
||||
|
||||
/* FAT table sector cache options */
|
||||
#define FAT_CACHE_SIZE 0x10 /* config parameter */
|
||||
#define FAT_CACHE_MASK (FAT_CACHE_SIZE-1)
|
||||
|
||||
#define GET16(x) (*(x)) | (*((x)+1) << 8)
|
||||
#define GET32(x) (*(x)) | (*((x)+1) << 8) | (*((x)+2) << 16) | (*((x)+3) << 24)
|
||||
|
||||
#define SET16(x, v) \
|
||||
do \
|
||||
{ \
|
||||
*(x) = (v) & 0x00ff; \
|
||||
(*((x)+1)) = (v) >> 8; \
|
||||
} while ( 0 )
|
||||
|
||||
#define SET32(x, v) \
|
||||
do \
|
||||
{ \
|
||||
*(x) = (v) & 0x000000ff; \
|
||||
(*((x)+1)) = ((v) >> 8) & 0x000000ff; \
|
||||
(*((x)+2)) = ((v) >> 16) & 0x000000ff; \
|
||||
(*((x)+3)) = ((v) >> 24); \
|
||||
} while ( 0 )
|
||||
|
||||
#define DFS_DEBUG_INFO 0x01
|
||||
#define DFS_DEBUG_WARNING 0x02
|
||||
#define DFS_DEBUG_ERROR 0x04
|
||||
|
||||
#define DFS_DEBUG_LEVEL (DFS_DEBUG_INFO | DFS_DEBUG_WARNING | DFS_DEBUG_ERROR)
|
||||
|
||||
/* #define DFS_DEBUG */
|
||||
#ifdef DFS_DEBUG
|
||||
#define dfs_log(level, x) do { if (level & DFS_DEBUG_LEVEL) \
|
||||
{rt_kprintf("DFS %s, %d:", __FILE__, __LINE__); rt_kprintf x; \
|
||||
rt_kprintf ("\n");}}while (0)
|
||||
#else
|
||||
#define dfs_log(level, x)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,39 @@
|
||||
CHANGEFILE
|
||||
----------
|
||||
|
||||
This is the Changefile for the development 0.3 branch of EFSL.
|
||||
Recording began with EFSL-0.3.3
|
||||
|
||||
0.3.5
|
||||
-----
|
||||
* Added warning in documentation that it is outdated
|
||||
* Changed structure definitions
|
||||
* Implemnted full-feature cp
|
||||
* Renamed some efsl-functions (all starting with EFSL_)
|
||||
* Added another example for AVR.
|
||||
* Updated docs on getting started on AVR.
|
||||
|
||||
0.3.4
|
||||
-----
|
||||
* Fixed avr support
|
||||
* Created new avr example + makefile
|
||||
* Some more work on new fsutils
|
||||
|
||||
0.3.3
|
||||
-----
|
||||
|
||||
* Renamed src/core to src/base
|
||||
* Implemented new hwInterface structure
|
||||
Support for multiple hwEndpoints in one project
|
||||
* Modified SD_SPI to work as a general protocol
|
||||
* Modified Linuxfile to the new hwInterface model
|
||||
* Created a new efs_configger, now supports every
|
||||
combination of partitions/disc
|
||||
* Implemented full support for little and big endian
|
||||
machines, as well as for little and big endian
|
||||
filesystems
|
||||
* Created new build system, for multiple platforms,
|
||||
configurable from one file
|
||||
* Changes cpo to use the new library functions
|
||||
* Broke both dsp & atmega support
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
efsl-0.3.6
|
||||
|
||||
[Embedded Filesystems Library]
|
||||
@@ -0,0 +1,182 @@
|
||||
/*****************************************************************************\
|
||||
* EFSL - Embedded Filesystems Library *
|
||||
* ----------------------------------- *
|
||||
* *
|
||||
* Filename : debug.c *
|
||||
* Release : 0.3 - devel *
|
||||
* Description : These functions are used for debugging output on different *
|
||||
* environments *
|
||||
* *
|
||||
* 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; version 2 *
|
||||
* of the License. *
|
||||
* *
|
||||
* 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. *
|
||||
* *
|
||||
* As a special exception, if other files instantiate templates or *
|
||||
* use macros or inline functions from this file, or you compile this *
|
||||
* file and link it with other works to produce a work based on this file, *
|
||||
* this file does not by itself cause the resulting work to be covered *
|
||||
* by the GNU General Public License. However the source code for this *
|
||||
* file must still be made available in accordance with section (3) of *
|
||||
* the GNU General Public License. *
|
||||
* *
|
||||
* This exception does not invalidate any other reasons why a work based *
|
||||
* on this file might be covered by the GNU General Public License. *
|
||||
* *
|
||||
* (c)2006 Lennart Yseboodt *
|
||||
* (c)2006 Michael De Nil *
|
||||
\*****************************************************************************/
|
||||
|
||||
/* COMMENT REGARDING FUNCTION COMMENTS IN THIS FILE
|
||||
* Only the linuxfile debug functions are commented since all functions
|
||||
* perform the same logical task.
|
||||
*/
|
||||
|
||||
/*****************************************************************************/
|
||||
#include "debug.h"
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
#ifdef DEBUG
|
||||
#ifdef HW_ENDPOINT_LINUX_ALL
|
||||
/*****************************************************************************/
|
||||
|
||||
/* ****************************************************************************
|
||||
* void debug(const eint8 *format, ...)
|
||||
* Description: This function prints debug output to the screen (target dependant)
|
||||
* and if DO_FUNC_DEBUG is defined also to a localfile.
|
||||
* Return value: void
|
||||
*/
|
||||
|
||||
void debug(const eint8 *format, ...)
|
||||
{
|
||||
va_list ap;
|
||||
#ifdef DO_FUNC_DEBUG
|
||||
euint8 c;
|
||||
extern FILE* debugfile;
|
||||
extern volatile euint8 tw;
|
||||
#endif
|
||||
|
||||
va_start(ap, format);
|
||||
vprintf(format,ap);
|
||||
#ifdef DO_FUNC_DEBUG
|
||||
for(c=0;c<tw+1;c++)
|
||||
{
|
||||
fprintf(debugfile," ");
|
||||
}
|
||||
vfprintf(debugfile,format,ap);
|
||||
#endif
|
||||
va_end(ap);
|
||||
}
|
||||
/*****************************************************************************/
|
||||
|
||||
/* ****************************************************************************
|
||||
* void debug_funcin(const eint8 *format, ...)
|
||||
* Description: This function marks the entrance of a function, which
|
||||
* increments a tabfieldcounter. A tree like structure can the be found in the
|
||||
* debugging file.
|
||||
* Return value: void
|
||||
*/
|
||||
|
||||
void debug_funcin(const eint8 *format, ...)
|
||||
{
|
||||
#ifdef DO_FUNC_DEBUG
|
||||
eint8 c;
|
||||
va_list ap;
|
||||
extern FILE* debugfile;
|
||||
extern volatile unsigned char tw;
|
||||
|
||||
if(debugfile==RT_NULL)return;
|
||||
|
||||
for(c=0;c<tw;c++){
|
||||
fprintf(debugfile," ");
|
||||
}
|
||||
|
||||
va_start(ap, format);
|
||||
vfprintf(debugfile,format,ap);
|
||||
va_end(ap);
|
||||
fprintf(debugfile,"\n");
|
||||
|
||||
tw++;
|
||||
#endif
|
||||
}
|
||||
/*****************************************************************************/
|
||||
|
||||
/* ****************************************************************************
|
||||
* void debug_funcout(const eint8 *format, ...)
|
||||
* Description: Decrements the tabfieldcounter. This function is called everywhere
|
||||
* a function is left.
|
||||
* Return value: void
|
||||
*/
|
||||
|
||||
void debug_funcout(const eint8 *format, ...)
|
||||
{
|
||||
#ifdef DO_FUNC_DEBUG
|
||||
eint8 c;
|
||||
va_list ap;
|
||||
extern FILE* debugfile;
|
||||
extern volatile euint8 tw;
|
||||
|
||||
if(debugfile==RT_NULL)return;
|
||||
|
||||
if(tw>0)tw--;
|
||||
|
||||
for(c=0;c<tw;c++){
|
||||
fprintf(debugfile," ");
|
||||
}
|
||||
|
||||
va_start(ap, format);
|
||||
vfprintf(debugfile,format,ap);
|
||||
va_end(ap);
|
||||
fprintf(debugfile,"\n");
|
||||
#endif
|
||||
}
|
||||
/*****************************************************************************/
|
||||
|
||||
/* ****************************************************************************
|
||||
* void debug_init()
|
||||
* Description: This function optionally opens the debugfile, or does any other
|
||||
* initialisation to enable debugoutput.
|
||||
* Return value: void
|
||||
*/
|
||||
void debug_init()
|
||||
{
|
||||
#ifdef DO_FUNC_DEBUG
|
||||
extern FILE* debugfile;
|
||||
extern volatile unsigned char tw;
|
||||
|
||||
debugfile=RT_NULL;
|
||||
tw=0;
|
||||
|
||||
debugfile=fopen("DBG.OUT","w");
|
||||
#endif
|
||||
}
|
||||
/*****************************************************************************/
|
||||
|
||||
/* ****************************************************************************
|
||||
* void debug_end()
|
||||
* Description: This function closes the debugfile.
|
||||
* Return value: void
|
||||
*/
|
||||
void debug_end()
|
||||
{
|
||||
#ifdef DO_FUNC_DEBUG
|
||||
extern FILE* debugfile;
|
||||
|
||||
fflush(debugfile);
|
||||
fclose(debugfile);
|
||||
#endif
|
||||
}
|
||||
/*****************************************************************************/
|
||||
|
||||
/*****************************************************************************/
|
||||
#endif
|
||||
#endif
|
||||
/*****************************************************************************/
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,57 @@
|
||||
/*****************************************************************************\
|
||||
* EFSL - Embedded Filesystems Library *
|
||||
* ----------------------------------- *
|
||||
* *
|
||||
* Filename : extract.c *
|
||||
* Release : 0.3 - devel *
|
||||
* Description : This file contains functions to copy structures that get *
|
||||
* corrupted when using direct memory copy *
|
||||
* *
|
||||
* 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; version 2 *
|
||||
* of the License. *
|
||||
* *
|
||||
* 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. *
|
||||
* *
|
||||
* As a special exception, if other files instantiate templates or *
|
||||
* use macros or inline functions from this file, or you compile this *
|
||||
* file and link it with other works to produce a work based on this file, *
|
||||
* this file does not by itself cause the resulting work to be covered *
|
||||
* by the GNU General Public License. However the source code for this *
|
||||
* file must still be made available in accordance with section (3) of *
|
||||
* the GNU General Public License. *
|
||||
* *
|
||||
* This exception does not invalidate any other reasons why a work based *
|
||||
* on this file might be covered by the GNU General Public License. *
|
||||
* *
|
||||
* (c)2006 Lennart Yseboodt *
|
||||
* (c)2006 Michael De Nil *
|
||||
\*****************************************************************************/
|
||||
|
||||
/*****************************************************************************/
|
||||
#include "extract.h"
|
||||
/*****************************************************************************/
|
||||
|
||||
#if !(defined(BYTE_ALIGNMENT))
|
||||
#warning "Compiling f_setbxx"
|
||||
void ex_setb16(euint8* buf,euint16 data)
|
||||
{
|
||||
buf[1] = data>>8;
|
||||
buf[0] = data>>0;
|
||||
}
|
||||
|
||||
void ex_setb32(euint8* buf,euint32 data)
|
||||
{
|
||||
buf[3] = data>>24;
|
||||
buf[2] = data>>16;
|
||||
buf[1] = data>>8;
|
||||
buf[0] = data>>0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
/*****************************************************************************\
|
||||
* EFSL - Embedded Filesystems Library *
|
||||
* ----------------------------------- *
|
||||
* *
|
||||
* Filename : debug.h *
|
||||
* Release : 0.3 - devel *
|
||||
* Description : These functions are used for debugging output on different *
|
||||
* environments *
|
||||
* *
|
||||
* 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; version 2 *
|
||||
* of the License. *
|
||||
* *
|
||||
* 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. *
|
||||
* *
|
||||
* As a special exception, if other files instantiate templates or *
|
||||
* use macros or inline functions from this file, or you compile this *
|
||||
* file and link it with other works to produce a work based on this file, *
|
||||
* this file does not by itself cause the resulting work to be covered *
|
||||
* by the GNU General Public License. However the source code for this *
|
||||
* file must still be made available in accordance with section (3) of *
|
||||
* the GNU General Public License. *
|
||||
* *
|
||||
* This exception does not invalidate any other reasons why a work based *
|
||||
* on this file might be covered by the GNU General Public License. *
|
||||
* *
|
||||
* (c)2006 Lennart Yseboodt *
|
||||
* (c)2006 Michael De Nil *
|
||||
\*****************************************************************************/
|
||||
|
||||
#ifndef __DEBUG_H__
|
||||
#define __DEBUG_H__
|
||||
|
||||
/*****************************************************************************/
|
||||
#include "types.h"
|
||||
#include "config.h"
|
||||
/*****************************************************************************/
|
||||
|
||||
#ifndef DEBUG
|
||||
#define TXT(x) ;
|
||||
#define DBG(x) ;
|
||||
#define FUNC_IN(x) ;
|
||||
#define FUNC_OUT(x) ;
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
|
||||
#ifdef HW_ENDPOINT_LINUX
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#define TXT(x) x
|
||||
#define DBG(x) debug x
|
||||
#define FUNC_IN(x) debug_funcin(x)
|
||||
#define FUNC_OUT(x) debug_funcout(x)
|
||||
#endif
|
||||
|
||||
void debug(const eint8 *format, ...);
|
||||
void debug_init();
|
||||
void debug_end();
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,89 @@
|
||||
/*****************************************************************************\
|
||||
* EFSL - Embedded Filesystems Library *
|
||||
* ----------------------------------- *
|
||||
* *
|
||||
* Filename : efs.c *
|
||||
* Release : 0.3 - devel *
|
||||
* Description : This should become the wrapper around efs. It will contain *
|
||||
* functions like efs_init etc. *
|
||||
* *
|
||||
* 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; version 2 *
|
||||
* of the License. *
|
||||
* *
|
||||
* 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. *
|
||||
* *
|
||||
* As a special exception, if other files instantiate templates or *
|
||||
* use macros or inline functions from this file, or you compile this *
|
||||
* file and link it with other works to produce a work based on this file, *
|
||||
* this file does not by itself cause the resulting work to be covered *
|
||||
* by the GNU General Public License. However the source code for this *
|
||||
* file must still be made available in accordance with section (3) of *
|
||||
* the GNU General Public License. *
|
||||
* *
|
||||
* This exception does not invalidate any other reasons why a work based *
|
||||
* on this file might be covered by the GNU General Public License. *
|
||||
* *
|
||||
* (c)2006 Lennart Yseboodt *
|
||||
* (c)2006 Michael De Nil *
|
||||
\*****************************************************************************/
|
||||
|
||||
#ifndef __EFS_H__
|
||||
#define __EFS_H__
|
||||
|
||||
/*****************************************************************************/
|
||||
#include <dfs_fs.h>
|
||||
|
||||
#include "types.h"
|
||||
#include "config.h"
|
||||
#include "extract.h"
|
||||
#include "partition.h"
|
||||
|
||||
/* WARNING !!!!
|
||||
* These includes DO NOT BELONG HERE,
|
||||
* remove them when the VFS layer is implemented !!!!
|
||||
*/
|
||||
#include "fs.h"
|
||||
#include "file.h"
|
||||
#include "tm.h"
|
||||
#include "ui.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
#define LINUX_FILE_CONFIG 0x00
|
||||
#define AVR_SD_CONFIG 0x01
|
||||
/*****************************************************************************/
|
||||
|
||||
#define efs_read_sectors(device, start, count, buf) rt_device_read(device, \
|
||||
(start) * SECTOR_SIZE, (buf), (count) * SECTOR_SIZE) / SECTOR_SIZE
|
||||
#define efs_write_sectors(device, start, count, buf) rt_device_write(device, \
|
||||
(start) * SECTOR_SIZE, (buf), (count) * SECTOR_SIZE) / SECTOR_SIZE
|
||||
|
||||
struct _efsl_fs {
|
||||
Partition partition;
|
||||
FileSystem filesystem;
|
||||
};
|
||||
typedef struct _efsl_fs efsl_fs;
|
||||
|
||||
/* EFS filesystem file operations */
|
||||
int efs_mount(struct dfs_filesystem* fs);
|
||||
int efs_unmount(struct dfs_filesystem* fs);
|
||||
int efs_open(struct dfs_fd* file);
|
||||
int efs_close(struct dfs_fd* file);
|
||||
int efs_ioctl(struct dfs_fd* file, int cmd, void* args);
|
||||
int efs_read(struct dfs_fd* file, void* buf, rt_size_t len);
|
||||
int efs_write(struct dfs_fd* file, const void* buf, rt_size_t len);
|
||||
int efs_lseek(struct dfs_fd* file, rt_off_t offset);
|
||||
int efs_getdents(struct dfs_fd* file, struct dfs_dirent* dirp, rt_uint32_t count);
|
||||
int efs_unlink(struct dfs_filesystem* fs, const char* path);
|
||||
int efs_stat(struct dfs_filesystem* fs, const char *path, struct dfs_stat *st);
|
||||
int efs_rename(struct dfs_filesystem* fs, const char* oldpath, const char* newpath);
|
||||
|
||||
/*****************************************************************************/
|
||||
int efsl_init(void);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,101 @@
|
||||
/*****************************************************************************\
|
||||
* EFSL - Embedded Filesystems Library *
|
||||
* ----------------------------------- *
|
||||
* *
|
||||
* Filename : extract.h *
|
||||
* Release : 0.3 - devel *
|
||||
* Description : This file contains functions to copy structures that get *
|
||||
* corrupted when using direct memory copy *
|
||||
* *
|
||||
* 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; version 2 *
|
||||
* of the License. *
|
||||
* *
|
||||
* 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. *
|
||||
* *
|
||||
* As a special exception, if other files instantiate templates or *
|
||||
* use macros or inline functions from this file, or you compile this *
|
||||
* file and link it with other works to produce a work based on this file, *
|
||||
* this file does not by itself cause the resulting work to be covered *
|
||||
* by the GNU General Public License. However the source code for this *
|
||||
* file must still be made available in accordance with section (3) of *
|
||||
* the GNU General Public License. *
|
||||
* *
|
||||
* This exception does not invalidate any other reasons why a work based *
|
||||
* on this file might be covered by the GNU General Public License. *
|
||||
* *
|
||||
* (c)2006 Lennart Yseboodt *
|
||||
* (c)2006 Michael De Nil *
|
||||
\*****************************************************************************/
|
||||
|
||||
#ifndef __EXTRACT_H_
|
||||
#define __EXTRACT_H_
|
||||
|
||||
/*****************************************************************************/
|
||||
#include "config.h"
|
||||
#include "types.h"
|
||||
/*****************************************************************************/
|
||||
|
||||
#if !(defined(HOST_LITTLE_ENDIAN)) && !(defined(HOST_BIG_ENDIAN))
|
||||
#error Endianess undefined, see config.h
|
||||
#elif defined(HOST_LITTLE_ENDIAN) && (defined(HOST_BIG_ENDIAN))
|
||||
#error Endianess defined as little and big, see config.h
|
||||
#endif
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
#define end_conv16(x) ((((euint16)(x) & 0xff00) >> 8) | \
|
||||
(((euint16)(x) & 0x00ff) << 8))
|
||||
#define end_conv32(x) ((((euint32)(x) & 0xff000000) >> 24) | \
|
||||
(((euint32)(x) & 0x00ff0000) >> 8) | \
|
||||
(((euint32)(x) & 0x0000ff00) << 8) | \
|
||||
(((euint32)(x) & 0x000000ff) << 24))
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
#if defined(BYTE_ALIGNMENT)
|
||||
#define ex_getb16(buf) (*((euint16*)(buf)))
|
||||
#define ex_setb16(buf,data) *((euint16*)(buf))=(data)
|
||||
#define ex_getb32(buf) (*((euint32*)(buf)))
|
||||
#define ex_setb32(buf,data) *((euint32*)(buf))=(data)
|
||||
#else
|
||||
#define ex_getb16(buf) \
|
||||
((euint16)(*((euint8*)(buf)+1)<<8) + \
|
||||
(euint16)(*((euint8*)(buf)+0)<<0))
|
||||
void ex_setb16(euint8* buf,euint16 data);
|
||||
#define ex_getb32(buf) \
|
||||
((euint32)(*((euint8*)(buf)+3)<<24) + \
|
||||
(euint32)(*((euint8*)(buf)+2)<<16) + \
|
||||
(euint32)(*((euint8*)(buf)+1)<<8) + \
|
||||
(euint32)(*((euint8*)(buf)+0)<<0))
|
||||
void ex_setb32(euint8* buf,euint32 data);
|
||||
#endif
|
||||
|
||||
#if defined(HOST_LITTLE_ENDIAN)
|
||||
#define ex_lth16(buf) ex_getb16(buf)
|
||||
#define ex_lth32(buf) ex_getb32(buf)
|
||||
#define ex_bth16(buf) end_conv16(ex_getb16(buf))
|
||||
#define ex_bth32(buf) end_conv32(ex_getb32(buf))
|
||||
|
||||
#define ex_htl16(buf) ex_setb16(buf)
|
||||
#define ex_htl32(buf) ex_setb32(buf)
|
||||
#define ex_htb16(buf) ex_setb16(end_conv16(buf))
|
||||
#define ex_htb32(buf) ex_setb32(end_conv32(buf))
|
||||
#elif defined(HOST_BIG_ENDIAN)
|
||||
#define ex_lth16(buf) end_conv16(ex_getb16(buf))
|
||||
#define ex_lth32(buf) end_conv32(ex_getb32(buf))
|
||||
#define ex_bth16(buf) ex_getb16(buf)
|
||||
#define ex_bth32(buf) ex_getb32(buf)
|
||||
|
||||
#define ex_htl16(buf) ex_setb16(end_conv16(buf))
|
||||
#define ex_htl32(buf) ex_setb32(end_conv32(buf))
|
||||
#define ex_htb16(buf) ex_setb16(buf)
|
||||
#define ex_htb32(buf) ex_setb32(buf)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,140 @@
|
||||
/*****************************************************************************\
|
||||
* EFSL - Embedded Filesystems Library *
|
||||
* ----------------------------------- *
|
||||
* *
|
||||
* Filename : ioman.c *
|
||||
* Release : 0.3 - devel *
|
||||
* Description : The IO Manager receives all requests for sectors in a central *
|
||||
* allowing it to make smart decision regarding caching. *
|
||||
* The IOMAN_NUMBUFFER parameter determines how many sectors *
|
||||
* ioman can cache. ioman also supports overallocating and *
|
||||
* backtracking sectors. *
|
||||
* *
|
||||
* 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; version 2 *
|
||||
* of the License. *
|
||||
* *
|
||||
* 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. *
|
||||
* *
|
||||
* As a special exception, if other files instantiate templates or *
|
||||
* use macros or inline functions from this file, or you compile this *
|
||||
* file and link it with other works to produce a work based on this file, *
|
||||
* this file does not by itself cause the resulting work to be covered *
|
||||
* by the GNU General Public License. However the source code for this *
|
||||
* file must still be made available in accordance with section (3) of *
|
||||
* the GNU General Public License. *
|
||||
* *
|
||||
* This exception does not invalidate any other reasons why a work based *
|
||||
* on this file might be covered by the GNU General Public License. *
|
||||
* *
|
||||
* (c)2006 Lennart Yseboodt *
|
||||
* (c)2006 Michael De Nil *
|
||||
\*****************************************************************************/
|
||||
|
||||
#ifndef __IOMAN_H__
|
||||
#define __IOMAN_H__
|
||||
|
||||
/*****************************************************************************/
|
||||
#include <rtthread.h>
|
||||
|
||||
#include "error.h"
|
||||
#include "plibc.h"
|
||||
#include "debug.h"
|
||||
#include "types.h"
|
||||
#include "config.h"
|
||||
/*****************************************************************************/
|
||||
|
||||
#define IOMAN_STATUS_ATTR_VALIDDATA 0
|
||||
#define IOMAN_STATUS_ATTR_USERBUFFER 1
|
||||
#define IOMAN_STATUS_ATTR_WRITE 2
|
||||
|
||||
#define IOM_MODE_READONLY 1
|
||||
#define IOM_MODE_READWRITE 2
|
||||
#define IOM_MODE_EXP_REQ 4
|
||||
|
||||
struct _IOManStack{
|
||||
euint32 sector;
|
||||
euint8 status;
|
||||
euint8 usage;
|
||||
};
|
||||
typedef struct _IOManStack IOManStack;
|
||||
|
||||
struct _IOManager{
|
||||
rt_device_t device;
|
||||
euint8 *bufptr;
|
||||
euint16 numbuf;
|
||||
euint16 numit;
|
||||
|
||||
IOMAN_ERR_EUINT8
|
||||
|
||||
IOManStack stack[IOMAN_NUMBUFFER][IOMAN_NUMITERATIONS];
|
||||
|
||||
euint32 sector[IOMAN_NUMBUFFER];
|
||||
euint8 status[IOMAN_NUMBUFFER];
|
||||
euint8 usage[IOMAN_NUMBUFFER];
|
||||
euint8 reference[IOMAN_NUMBUFFER];
|
||||
euint8 itptr[IOMAN_NUMBUFFER];
|
||||
#ifdef IOMAN_DO_MEMALLOC
|
||||
euint8 cache_mem[IOMAN_NUMBUFFER * 512];
|
||||
#endif
|
||||
};
|
||||
typedef struct _IOManager IOManager;
|
||||
|
||||
#define IOBJ ioman
|
||||
|
||||
#define ioman_isValid(bp) ioman_getAttr(IOBJ,bp,IOMAN_STATUS_ATTR_VALIDDATA)
|
||||
#define ioman_isUserBuf(bp) ioman_getAttr(IOBJ,bp,IOMAN_STATUS_ATTR_USERBUFFER)
|
||||
#define ioman_isWritable(bp) ioman_getAttr(IOBJ,bp,IOMAN_STATUS_ATTR_WRITE)
|
||||
|
||||
#define ioman_setValid(bp) ioman_setAttr(IOBJ,bp,IOMAN_STATUS_ATTR_VALIDDATA,1)
|
||||
#define ioman_setUserBuf(bp) ioman_setAttr(IOBJ,bp,IOMAN_STATUS_ATTR_USERBUFFER,1)
|
||||
#define ioman_setWritable(bp) ioman_setAttr(IOBJ,bp,IOMAN_STATUS_ATTR_WRITE,1)
|
||||
|
||||
#define ioman_setNotValid(bp) ioman_setAttr(IOBJ,bp,IOMAN_STATUS_ATTR_VALIDDATA,0)
|
||||
#define ioman_setNotUserBuf(bp) ioman_setAttr(IOBJ,bp,IOMAN_STATUS_ATTR_USERBUFFER,0)
|
||||
#define ioman_setNotWritable(bp) ioman_setAttr(IOBJ,bp,IOMAN_STATUS_ATTR_WRITE,0)
|
||||
|
||||
#define ioman_isReqRo(mode) ((mode)&(IOM_MODE_READONLY))
|
||||
#define ioman_isReqRw(mode) ((mode)&(IOM_MODE_READWRITE))
|
||||
#define ioman_isReqExp(mode) ((mode)&(IOM_MODE_EXP_REQ))
|
||||
|
||||
esint8 ioman_init(IOManager *ioman, euint8* bufferarea);
|
||||
void ioman_reset(IOManager *ioman);
|
||||
euint8* ioman_getBuffer(IOManager *ioman,euint8* bufferarea);
|
||||
void ioman_setAttr(IOManager *ioman,euint16 bufplace,euint8 attribute,euint8 val);
|
||||
euint8 ioman_getAttr(IOManager *ioman,euint16 bufplace,euint8 attribute);
|
||||
euint8 ioman_getUseCnt(IOManager *ioman,euint16 bufplace);
|
||||
void ioman_incUseCnt(IOManager *ioman,euint16 bufplace);
|
||||
void ioman_decUseCnt(IOManager *ioman,euint16 bufplace);
|
||||
void ioman_resetUseCnt(IOManager *ioman,euint16 bufplace);
|
||||
euint8 ioman_getRefCnt(IOManager *ioman,euint16 bufplace);
|
||||
void ioman_incRefCnt(IOManager *ioman,euint16 bufplace);
|
||||
void ioman_decRefCnt(IOManager *ioman,euint16 bufplace);
|
||||
void ioman_resetRefCnt(IOManager *ioman,euint16 bufplace);
|
||||
esint8 ioman_pop(IOManager *ioman,euint16 bufplace);
|
||||
esint8 ioman_push(IOManager *ioman,euint16 bufplace);
|
||||
euint8* ioman_getPtr(IOManager *ioman,euint16 bufplace);
|
||||
esint16 ioman_getBp(IOManager *ioman,euint8* buf);
|
||||
esint8 ioman_readSector(IOManager *ioman,euint32 address,euint8* buf);
|
||||
esint8 ioman_writeSector(IOManager *ioman, euint32 address, euint8* buf);
|
||||
void ioman_resetCacheItem(IOManager *ioman,euint16 bufplace);
|
||||
esint32 ioman_findSectorInCache(IOManager *ioman, euint32 address);
|
||||
esint32 ioman_findFreeSpot(IOManager *ioman);
|
||||
esint32 ioman_findUnusedSpot(IOManager *ioman);
|
||||
esint32 ioman_findOverallocableSpot(IOManager *ioman);
|
||||
esint8 ioman_putSectorInCache(IOManager *ioman,euint32 address, euint16 bufplace);
|
||||
esint8 ioman_flushSector(IOManager *ioman, euint16 bufplace);
|
||||
euint8* ioman_getSector(IOManager *ioman,euint32 address, euint8 mode);
|
||||
esint8 ioman_releaseSector(IOManager *ioman,euint8* buf);
|
||||
esint8 ioman_directSectorRead(IOManager *ioman,euint32 address, euint8* buf);
|
||||
esint8 ioman_directSectorWrite(IOManager *ioman,euint32 address, euint8* buf);
|
||||
esint8 ioman_flushRange(IOManager *ioman,euint32 address_low, euint32 address_high);
|
||||
esint8 ioman_flushAll(IOManager *ioman);
|
||||
|
||||
void ioman_printStatus(IOManager *ioman);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,93 @@
|
||||
/*****************************************************************************\
|
||||
* EFSL - Embedded Filesystems Library *
|
||||
* ----------------------------------- *
|
||||
* *
|
||||
* Filename : ioman_small.c *
|
||||
* Release : 0.3 - devel *
|
||||
* Description : The IO Manager receives all requests for sectors in a central *
|
||||
* allowing it to make smart decision regarding caching. *
|
||||
* The IOMAN_NUMBUFFER parameter determines how many sectors *
|
||||
* ioman can cache. ioman also supports overallocating and *
|
||||
* backtracking sectors. *
|
||||
* This is the small version of IOMan, for systems with limited *
|
||||
* resources. It features only one fixed buffer, and has *
|
||||
* simplified operation *
|
||||
* *
|
||||
* 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; version 2 *
|
||||
* of the License. *
|
||||
* *
|
||||
* 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. *
|
||||
* *
|
||||
* As a special exception, if other files instantiate templates or *
|
||||
* use macros or inline functions from this file, or you compile this *
|
||||
* file and link it with other works to produce a work based on this file, *
|
||||
* this file does not by itself cause the resulting work to be covered *
|
||||
* by the GNU General Public License. However the source code for this *
|
||||
* file must still be made available in accordance with section (3) of *
|
||||
* the GNU General Public License. *
|
||||
* *
|
||||
* This exception does not invalidate any other reasons why a work based *
|
||||
* on this file might be covered by the GNU General Public License. *
|
||||
* *
|
||||
* (c)2006 Lennart Yseboodt *
|
||||
* (c)2006 Michael De Nil *
|
||||
\*****************************************************************************/
|
||||
|
||||
#include "error.h"
|
||||
#include "plibc.h"
|
||||
#include "debug.h"
|
||||
#include "types.h"
|
||||
#include "config.h"
|
||||
|
||||
#define IOMAN_STATUS_ATTR_VALIDDATA 0
|
||||
#define IOMAN_STATUS_ATTR_USERBUFFER 1
|
||||
#define IOMAN_STATUS_ATTR_WRITE 2
|
||||
|
||||
#define IOM_MODE_READONLY 1
|
||||
#define IOM_MODE_READWRITE 2
|
||||
#define IOM_MODE_EXP_REQ 4
|
||||
|
||||
struct _IOManStack{
|
||||
euint32 sector;
|
||||
euint8 status;
|
||||
};
|
||||
typedef struct _IOManStack IOManStack;
|
||||
|
||||
struct _IOManager{
|
||||
rt_device_t device; /* device handler */
|
||||
euint8 bufptr[512];
|
||||
IOMAN_ERR_EUINT8
|
||||
euint32 sector;
|
||||
euint8 status;
|
||||
euint8 itptr;
|
||||
IOManStack stack;
|
||||
};
|
||||
typedef struct _IOManager IOManager;
|
||||
|
||||
#define IOBJ ioman
|
||||
|
||||
#define ioman_isValid() ioman_getAttr(IOBJ,IOMAN_STATUS_ATTR_VALIDDATA)
|
||||
#define ioman_isUserBuf() ioman_getAttr(IOBJ,IOMAN_STATUS_ATTR_USERBUFFER)
|
||||
#define ioman_isWritable() ioman_getAttr(IOBJ,IOMAN_STATUS_ATTR_WRITE)
|
||||
|
||||
#define ioman_setValid() ioman_setAttr(IOBJ,IOMAN_STATUS_ATTR_VALIDDATA,1)
|
||||
#define ioman_setUserBuf() ioman_setAttr(IOBJ,IOMAN_STATUS_ATTR_USERBUFFER,1)
|
||||
#define ioman_setWritable() ioman_setAttr(IOBJ,IOMAN_STATUS_ATTR_WRITE,1)
|
||||
|
||||
#define ioman_setNotValid() ioman_setAttr(IOBJ,IOMAN_STATUS_ATTR_VALIDDATA,0)
|
||||
#define ioman_setNotUserBuf() ioman_setAttr(IOBJ,IOMAN_STATUS_ATTR_USERBUFFER,0)
|
||||
#define ioman_setNotWritable() ioman_setAttr(IOBJ,IOMAN_STATUS_ATTR_WRITE,0)
|
||||
|
||||
#define ioman_isReqRo(mode) ((mode)&(IOM_MODE_READONLY))
|
||||
#define ioman_isReqRw(mode) ((mode)&(IOM_MODE_READWRITE))
|
||||
#define ioman_isReqExp(mode) ((mode)&(IOM_MODE_EXP_REQ))
|
||||
|
||||
esint8 ioman_init(IOManager *ioman, euint8* bufferarea);
|
||||
void ioman_reset(IOManager *ioman);
|
||||
void ioman_setAttr(IOManager *ioman,euint8 attribute,euint8 val);
|
||||
euint8 ioman_getAttr(IOManager *ioman,euint8 attribute);
|
||||
@@ -0,0 +1,73 @@
|
||||
/*****************************************************************************\
|
||||
* EFSL - Embedded Filesystems Library *
|
||||
* ----------------------------------- *
|
||||
* *
|
||||
* Filename : partition.c *
|
||||
* Release : 0.3 - devel *
|
||||
* Description : These functions are partition specific. Searching FAT type *
|
||||
* partitions and read/write functions to partitions. *
|
||||
* *
|
||||
* 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; version 2 *
|
||||
* of the License. *
|
||||
* *
|
||||
* 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. *
|
||||
* *
|
||||
* As a special exception, if other files instantiate templates or *
|
||||
* use macros or inline functions from this file, or you compile this *
|
||||
* file and link it with other works to produce a work based on this file, *
|
||||
* this file does not by itself cause the resulting work to be covered *
|
||||
* by the GNU General Public License. However the source code for this *
|
||||
* file must still be made available in accordance with section (3) of *
|
||||
* the GNU General Public License. *
|
||||
* *
|
||||
* This exception does not invalidate any other reasons why a work based *
|
||||
* on this file might be covered by the GNU General Public License. *
|
||||
* *
|
||||
* (c)2006 Lennart Yseboodt *
|
||||
* (c)2006 Michael De Nil *
|
||||
\*****************************************************************************/
|
||||
|
||||
#ifndef __PARTITION_H__
|
||||
#define __PARTITION_H__
|
||||
|
||||
/*****************************************************************************/
|
||||
#include "config.h"
|
||||
#include "error.h"
|
||||
#include "types.h"
|
||||
// #include "ioman.h"
|
||||
#include <dfs_cache.h>
|
||||
/*****************************************************************************/
|
||||
|
||||
#define PT_FAT12 0x01
|
||||
#define PT_FAT16A 0x04
|
||||
#define PT_FAT16 0x06
|
||||
#define PT_FAT32 0x0B
|
||||
#define PT_FAT32A 0x5C
|
||||
#define PT_FAT16B 0x5E
|
||||
|
||||
struct _Partition{
|
||||
IOManager *ioman;
|
||||
};
|
||||
typedef struct _Partition Partition;
|
||||
|
||||
void part_initPartition(Partition *part);
|
||||
eint16 part_isFatPart(euint8 type);
|
||||
esint8 part_readBuf(Partition *part, euint32 address, euint8* buf);
|
||||
esint8 part_readPartBuf(Partition *part, euint32 address, euint8* buf, euint32 offset, euint16 len);
|
||||
eint16 part_writeBuf(Partition *part,euint32 address,euint8* buf);
|
||||
euint8* part_getSect(Partition *part, euint32 address,euint8 mode);
|
||||
esint8 part_relSect(Partition *part, euint8* buf);
|
||||
|
||||
esint8 part_flushPart(Partition *part,euint32 addr_l, euint32 addr_h);
|
||||
|
||||
esint8 part_directSectorRead(Partition *part, euint32 address, euint8* buf, euint32 numsector);
|
||||
esint8 part_directSectorWrite(Partition *part, euint32 address, euint8* buf, euint32 numsector);
|
||||
|
||||
#include "extract.h"
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,49 @@
|
||||
/*****************************************************************************\
|
||||
* EFSL - Embedded Filesystems Library *
|
||||
* ----------------------------------- *
|
||||
* *
|
||||
* Filename : plibc.c *
|
||||
* Release : 0.3 - devel *
|
||||
* Description : This file contains replacements of common c library functions *
|
||||
* *
|
||||
* 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; version 2 *
|
||||
* of the License. *
|
||||
* *
|
||||
* 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. *
|
||||
* *
|
||||
* As a special exception, if other files instantiate templates or *
|
||||
* use macros or inline functions from this file, or you compile this *
|
||||
* file and link it with other works to produce a work based on this file, *
|
||||
* this file does not by itself cause the resulting work to be covered *
|
||||
* by the GNU General Public License. However the source code for this *
|
||||
* file must still be made available in accordance with section (3) of *
|
||||
* the GNU General Public License. *
|
||||
* *
|
||||
* This exception does not invalidate any other reasons why a work based *
|
||||
* on this file might be covered by the GNU General Public License. *
|
||||
* *
|
||||
* (c)2006 Lennart Yseboodt *
|
||||
* (c)2006 Michael De Nil *
|
||||
\*****************************************************************************/
|
||||
|
||||
#ifndef __PLIBC_H__
|
||||
#define __PLIBC_H__
|
||||
|
||||
/*****************************************************************************/
|
||||
#include "debug.h"
|
||||
#include "types.h"
|
||||
#include "config.h"
|
||||
/*****************************************************************************/
|
||||
|
||||
euint16 strMatch(eint8* bufa, eint8*bufb,euint32 n);
|
||||
void memCpy(void* psrc, void* pdest, euint32 size);
|
||||
void memClr(void *pdest,euint32 size);
|
||||
void memSet(void *pdest,euint32 size,euint8 data);
|
||||
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,120 @@
|
||||
/*****************************************************************************\
|
||||
* EFSL - Embedded Filesystems Library *
|
||||
* ----------------------------------- *
|
||||
* *
|
||||
* Filename : ioman_small.c *
|
||||
* Release : 0.3 - devel *
|
||||
* Description : The IO Manager receives all requests for sectors in a central *
|
||||
* allowing it to make smart decision regarding caching. *
|
||||
* The IOMAN_NUMBUFFER parameter determines how many sectors *
|
||||
* ioman can cache. ioman also supports overallocating and *
|
||||
* backtracking sectors. *
|
||||
* This is the small version of IOMan, for systems with limited *
|
||||
* resources. It features only one fixed buffer, and has *
|
||||
* simplified operation *
|
||||
* *
|
||||
* 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; version 2 *
|
||||
* of the License. *
|
||||
* *
|
||||
* 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. *
|
||||
* *
|
||||
* As a special exception, if other files instantiate templates or *
|
||||
* use macros or inline functions from this file, or you compile this *
|
||||
* file and link it with other works to produce a work based on this file, *
|
||||
* this file does not by itself cause the resulting work to be covered *
|
||||
* by the GNU General Public License. However the source code for this *
|
||||
* file must still be made available in accordance with section (3) of *
|
||||
* the GNU General Public License. *
|
||||
* *
|
||||
* This exception does not invalidate any other reasons why a work based *
|
||||
* on this file might be covered by the GNU General Public License. *
|
||||
* *
|
||||
* (c)2006 Lennart Yseboodt *
|
||||
* (c)2006 Michael De Nil *
|
||||
\*****************************************************************************/
|
||||
|
||||
#include "ioman_small.h"
|
||||
|
||||
esint8 ioman_init(IOManager *ioman, euint8* bufferarea)
|
||||
{
|
||||
ioman_reset(ioman);
|
||||
return(0);
|
||||
}
|
||||
/*****************************************************************************/
|
||||
|
||||
void ioman_reset(IOManager *ioman)
|
||||
{
|
||||
ioman->sector=ioman->status=ioman->itptr=0;
|
||||
ioman->stack.sector=ioman->stack.status=0;
|
||||
|
||||
ioman_setError(ioman,IOMAN_NOERROR);
|
||||
|
||||
}
|
||||
/*****************************************************************************/
|
||||
|
||||
void ioman_setAttr(IOManager *ioman,euint8 attribute,euint8 val)
|
||||
{
|
||||
if(val){
|
||||
ioman->status|=1<<attribute;
|
||||
}else{
|
||||
ioman->status&=~(1<<attribute);
|
||||
}
|
||||
}
|
||||
/*****************************************************************************/
|
||||
|
||||
euint8 ioman_getAttr(IOManager *ioman,euint8 attribute)
|
||||
{
|
||||
return(ioman->status&(1<<attribute));
|
||||
}
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
euint8* ioman_getSector(IOManager *ioman,euint32 address, euint8 mode)
|
||||
{
|
||||
if(address==ioman->sector){
|
||||
if(mode==IOM_MODE_READWRITE)ioman_setWritable();
|
||||
return(ioman->bufptr);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
esint8 ioman_readSector(IOManager *ioman,euint32 address,euint8* buf)
|
||||
{
|
||||
esint8 r;
|
||||
|
||||
if(buf==0){
|
||||
return(-1);
|
||||
}
|
||||
|
||||
//r=if_readBuf(ioman->iface,address,buf);
|
||||
r = efs_read_sectors(ioman->device, address, 1, buf);
|
||||
|
||||
if(r!=0){
|
||||
ioman_setError(ioman,IOMAN_ERR_READFAIL);
|
||||
return(-1);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
/*****************************************************************************/
|
||||
|
||||
esint8 ioman_writeSector(IOManager *ioman, euint32 address, euint8* buf)
|
||||
{
|
||||
esint8 r;
|
||||
|
||||
if(buf==0)return(-1);
|
||||
|
||||
//r=if_writeBuf(ioman->iface,address,buf);
|
||||
r = efs_write_sectors(ioman->device, address, 1, buf);
|
||||
|
||||
if(r<=0){
|
||||
ioman_setError(ioman,IOMAN_ERR_WRITEFAIL);
|
||||
return(-1);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
/*****************************************************************************/
|
||||
@@ -0,0 +1,125 @@
|
||||
/*****************************************************************************\
|
||||
* EFSL - Embedded Filesystems Library *
|
||||
* ----------------------------------- *
|
||||
* *
|
||||
* Filename : partition.c *
|
||||
* Release : 0.3 - devel *
|
||||
* Description : These functions are partition specific. Searching FAT type *
|
||||
* partitions and read/write functions to partitions. *
|
||||
* *
|
||||
* 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; version 2 *
|
||||
* of the License. *
|
||||
* *
|
||||
* 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. *
|
||||
* *
|
||||
* As a special exception, if other files instantiate templates or *
|
||||
* use macros or inline functions from this file, or you compile this *
|
||||
* file and link it with other works to produce a work based on this file, *
|
||||
* this file does not by itself cause the resulting work to be covered *
|
||||
* by the GNU General Public License. However the source code for this *
|
||||
* file must still be made available in accordance with section (3) of *
|
||||
* the GNU General Public License. *
|
||||
* *
|
||||
* This exception does not invalidate any other reasons why a work based *
|
||||
* on this file might be covered by the GNU General Public License. *
|
||||
* *
|
||||
* (c)2006 Lennart Yseboodt *
|
||||
* (c)2006 Michael De Nil *
|
||||
\*****************************************************************************/
|
||||
|
||||
/*****************************************************************************/
|
||||
#include "partition.h"
|
||||
#include "efs.h"
|
||||
/*****************************************************************************/
|
||||
|
||||
/* ****************************************************************************
|
||||
* void part_initPartition(Partition *part,Disc* refDisc)
|
||||
* Description: This function searches the 4 partitions for a FAT class partition
|
||||
* and marks the first one found as the active to be used partition.
|
||||
*/
|
||||
void part_initPartition(Partition *part)
|
||||
{
|
||||
part_setError(part,PART_NOERROR);
|
||||
}
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
/* ****************************************************************************
|
||||
* eint16 part_isFatPart(euint8 type)
|
||||
* Description: This functions checks if a partitiontype (eint8) is of the FAT
|
||||
* type in the broadest sense. I
|
||||
* Return value: If it is FAT, returns 1, otherwise 0.
|
||||
*/
|
||||
eint16 part_isFatPart(euint8 type)
|
||||
{
|
||||
if(type == PT_FAT12 ||
|
||||
type == PT_FAT16A ||
|
||||
type == PT_FAT16 ||
|
||||
type == PT_FAT32 ||
|
||||
type == PT_FAT32A ||
|
||||
type == PT_FAT16B )
|
||||
{
|
||||
return(1);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
/*****************************************************************************/
|
||||
|
||||
esint8 part_readBuf(Partition *part, euint32 address, euint8* buf)
|
||||
{
|
||||
return efs_read_sectors(part->ioman->device, address, 1, buf);
|
||||
}
|
||||
|
||||
/* ****************************************************************************
|
||||
* eint16 part_writeBuf(Partition *part,euint32 address,euint8* buf)
|
||||
* Description: This function writes 512 bytes, from buf. It's offset is address
|
||||
* sectors from the beginning of the partition.
|
||||
* Return value: It returns whatever the hardware function returns. (-1=error)
|
||||
*/
|
||||
eint16 part_writeBuf(Partition *part,euint32 address,euint8* buf)
|
||||
{
|
||||
/*DBG((TXT("part_writeBuf :: %li\n"),address));*/
|
||||
return efs_write_sectors(part->ioman->device, address, 1, buf);
|
||||
}
|
||||
/*****************************************************************************/
|
||||
|
||||
/* ****************************************************************************
|
||||
* euint8* part_getSect(Partition *part, euint32 address, euint8 mode)
|
||||
* Description: This function calls ioman_getSector, but recalculates the sector
|
||||
* address to be partition relative.
|
||||
* Return value: Whatever getSector returns. (pointer or 0)
|
||||
*/
|
||||
euint8* part_getSect(Partition *part, euint32 address, euint8 mode)
|
||||
{
|
||||
return(ioman_getSector(part->ioman,address,mode));
|
||||
}
|
||||
|
||||
/* ****************************************************************************
|
||||
* esint8 part_relSect(Partition *part, euint8* buf)
|
||||
* Description: This function calls ioman_releaseSector.
|
||||
* Return value: Whatever releaseSector returns.
|
||||
*/
|
||||
esint8 part_relSect(Partition *part, euint8* buf)
|
||||
{
|
||||
return(ioman_releaseSector(part->ioman,buf));
|
||||
}
|
||||
|
||||
esint8 part_flushPart(Partition *part,euint32 addr_l, euint32 addr_h)
|
||||
{
|
||||
return ioman_flushRange(part->ioman,addr_l,addr_h);
|
||||
}
|
||||
|
||||
esint8 part_directSectorRead(Partition *part, euint32 address, euint8* buf, euint32 numsector)
|
||||
{
|
||||
return ioman_directSectorRead(part->ioman, address, buf, numsector);
|
||||
}
|
||||
|
||||
esint8 part_directSectorWrite(Partition *part,euint32 address, euint8* buf, euint32 numsector)
|
||||
{
|
||||
return ioman_directSectorWrite(part->ioman, address, buf, numsector);
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
/*****************************************************************************\
|
||||
* EFSL - Embedded Filesystems Library *
|
||||
* ----------------------------------- *
|
||||
* *
|
||||
* Filename : plibc.c *
|
||||
* Release : 0.3 - devel *
|
||||
* Description : This file contains replacements of common c library functions *
|
||||
* *
|
||||
* 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; version 2 *
|
||||
* of the License. *
|
||||
* *
|
||||
* 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. *
|
||||
* *
|
||||
* As a special exception, if other files instantiate templates or *
|
||||
* use macros or inline functions from this file, or you compile this *
|
||||
* file and link it with other works to produce a work based on this file, *
|
||||
* this file does not by itself cause the resulting work to be covered *
|
||||
* by the GNU General Public License. However the source code for this *
|
||||
* file must still be made available in accordance with section (3) of *
|
||||
* the GNU General Public License. *
|
||||
* *
|
||||
* This exception does not invalidate any other reasons why a work based *
|
||||
* on this file might be covered by the GNU General Public License. *
|
||||
* *
|
||||
* (c)2006 Lennart Yseboodt *
|
||||
* (c)2006 Michael De Nil *
|
||||
\*****************************************************************************/
|
||||
|
||||
/*****************************************************************************/
|
||||
#include "plibc.h"
|
||||
/*****************************************************************************/
|
||||
|
||||
/* ****************************************************************************
|
||||
* unsigned short strMatch(char* bufa, char*bufb, unsigned long n)
|
||||
* Description: Compares bufa and bufb for a length of n bytes.
|
||||
* Return value: Returns the number of character NOT matching.
|
||||
*/
|
||||
euint16 strMatch(eint8* bufa, eint8*bufb,euint32 n)
|
||||
{
|
||||
euint32 c;
|
||||
euint16 res=0;
|
||||
for(c=0;c<n;c++)if(bufa[c]!=bufb[c])res++;
|
||||
return(res);
|
||||
}
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
/* ****************************************************************************
|
||||
* void memCpy(void* psrc, void* pdest, unsigned long size)
|
||||
* Description: Copies the contents of psrc into pdest on a byte per byte basis.
|
||||
* The total number of bytes copies is size.
|
||||
*/
|
||||
void memCpy(void* psrc, void* pdest, euint32 size)
|
||||
{
|
||||
while(size>0){
|
||||
*((eint8*)pdest+size-1)=*((eint8*)psrc+size-1);
|
||||
size--;
|
||||
}
|
||||
}
|
||||
/*****************************************************************************/
|
||||
|
||||
void memClr(void *pdest,euint32 size)
|
||||
{
|
||||
while(size>0){
|
||||
*(((eint8*)pdest)+size-1)=0x00;
|
||||
size--;
|
||||
}
|
||||
}
|
||||
|
||||
void memSet(void *pdest,euint32 size,euint8 data)
|
||||
{
|
||||
while(size>0){
|
||||
*(((eint8*)pdest)+size-1)=data;
|
||||
size--;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,86 @@
|
||||
/*****************************************************************************\
|
||||
* EFSL - Embedded Filesystems Library *
|
||||
* ----------------------------------- *
|
||||
* *
|
||||
* Filename : dir.h *
|
||||
* Release : 0.3 - devel *
|
||||
* Description : The functions of dir.c are part of fs.c, they deal with all *
|
||||
* the directory specific stuff. *
|
||||
* *
|
||||
* 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; version 2 *
|
||||
* of the License. *
|
||||
* *
|
||||
* 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. *
|
||||
* *
|
||||
* As a special exception, if other files instantiate templates or *
|
||||
* use macros or inline functions from this file, or you compile this *
|
||||
* file and link it with other works to produce a work based on this file, *
|
||||
* this file does not by itself cause the resulting work to be covered *
|
||||
* by the GNU General Public License. However the source code for this *
|
||||
* file must still be made available in accordance with section (3) of *
|
||||
* the GNU General Public License. *
|
||||
* *
|
||||
* This exception does not invalidate any other reasons why a work based *
|
||||
* on this file might be covered by the GNU General Public License. *
|
||||
* *
|
||||
* (c)2006 Lennart Yseboodt *
|
||||
* (c)2006 Michael De Nil *
|
||||
\*****************************************************************************/
|
||||
|
||||
#ifndef __DDIR_H__
|
||||
#define __DDIR_H__
|
||||
|
||||
/*****************************************************************************/
|
||||
#include "config.h"
|
||||
#include "error.h"
|
||||
#include "fat.h"
|
||||
#include "plibc.h"
|
||||
#include "types.h"
|
||||
// #include "ioman.h"
|
||||
#include "tm.h"
|
||||
#include "fs.h"
|
||||
#include <dfs_cache.h>
|
||||
/*****************************************************************************/
|
||||
|
||||
#define ATTR_READ_ONLY 0x01
|
||||
#define ATTR_HIDDEN 0x02
|
||||
#define ATTR_SYSTEM 0x04
|
||||
#define ATTR_VOLUME_ID 0x08
|
||||
#define ATTR_DIRECTORY 0x10
|
||||
#define ATTR_ARCHIVE 0x20
|
||||
|
||||
#define OFFSET_DE_FILENAME 0
|
||||
#define OFFSET_DE_ATTRIBUTE 11
|
||||
#define OFFSET_DE_NTRESERVED 12
|
||||
#define OFFSET_DE_CRTIMETNT 13
|
||||
#define OFFSET_DE_CREATETIME 14
|
||||
#define OFFSET_DE_CREATEDATE 16
|
||||
#define OFFSET_DE_LASTACCESSDATE 18
|
||||
#define OFFSET_DE_FIRSTCLUSTERHIGH 20
|
||||
#define OFFSET_DE_WRITETIME 22
|
||||
#define OFFSET_DE_WRITEDATE 24
|
||||
#define OFFSET_DE_FIRSTCLUSTERLOW 26
|
||||
#define OFFSET_DE_FILESIZE 28
|
||||
|
||||
#define DIRFIND_FILE 0
|
||||
#define DIRFIND_FREE 1
|
||||
|
||||
void dir_getFileStructure(FileSystem *fs,FileRecord *filerec,FileLocation *loc);
|
||||
void dir_createDirectoryEntry(FileSystem *fs,FileRecord *filerec,FileLocation *loc);
|
||||
void dir_createDefaultEntry(FileSystem *fs,FileRecord *filerec,eint8* fatfilename);
|
||||
void dir_setFirstCluster(FileSystem *fs,FileLocation *loc,euint32 cluster_addr);
|
||||
void dir_setFileSize(FileSystem *fs,FileLocation *loc,euint32 numbytes);
|
||||
euint32 dir_findinRoot(FileSystem *fs,eint8 * fatname, FileLocation *loc);
|
||||
euint32 dir_findinDir(FileSystem *fs, eint8 * fatname, euint32 startCluster, FileLocation *loc, euint8 mode);
|
||||
euint32 dir_findinBuf(euint8 *buf,eint8 *fatname, FileLocation *loc, euint8 mode);
|
||||
euint32 dir_findinCluster(FileSystem *fs,euint32 cluster,eint8 *fatname, FileLocation *loc, euint8 mode);
|
||||
euint32 dir_findinRootArea(FileSystem *fs,eint8* fatname, FileLocation *loc, euint8 mode);
|
||||
esint8 dir_getFatFileName(eint8* filename, eint8* fatfilename);
|
||||
esint8 dir_updateDirectoryEntry(FileSystem *fs,FileRecord *entry,FileLocation *loc);
|
||||
esint8 dir_addCluster(FileSystem *fs,euint32 firstCluster);
|
||||
#endif
|
||||
@@ -0,0 +1,64 @@
|
||||
/*****************************************************************************\
|
||||
* EFSL - Embedded Filesystems Library *
|
||||
* ----------------------------------- *
|
||||
* *
|
||||
* Filename : fat.h *
|
||||
* Release : 0.3 - devel *
|
||||
* Description : This file contains all the functions dealing with the FAT *
|
||||
* in a Microsoft FAT filesystem. It belongs under fs.c *
|
||||
* *
|
||||
* 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; version 2 *
|
||||
* of the License. *
|
||||
* *
|
||||
* 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. *
|
||||
* *
|
||||
* As a special exception, if other files instantiate templates or *
|
||||
* use macros or inline functions from this file, or you compile this *
|
||||
* file and link it with other works to produce a work based on this file, *
|
||||
* this file does not by itself cause the resulting work to be covered *
|
||||
* by the GNU General Public License. However the source code for this *
|
||||
* file must still be made available in accordance with section (3) of *
|
||||
* the GNU General Public License. *
|
||||
* *
|
||||
* This exception does not invalidate any other reasons why a work based *
|
||||
* on this file might be covered by the GNU General Public License. *
|
||||
* *
|
||||
* (c)2006 Lennart Yseboodt *
|
||||
* (c)2006 Michael De Nil *
|
||||
\*****************************************************************************/
|
||||
|
||||
#ifndef __FAT_H_
|
||||
#define __FAT_H_
|
||||
|
||||
/*****************************************************************************/
|
||||
#include "config.h"
|
||||
#include "error.h"
|
||||
#include "file.h"
|
||||
#include "debug.h"
|
||||
#include "types.h"
|
||||
/*****************************************************************************/
|
||||
|
||||
euint32 fat_getSectorAddressFatEntry(FileSystem *fs,euint32 cluster_addr);
|
||||
euint32 fat_getNextClusterAddress(FileSystem *fs, euint32 cluster_addr, euint16 *linear);
|
||||
void fat_setNextClusterAddress(FileSystem *fs,euint32 cluster_addr,euint32 next_cluster_addr);
|
||||
eint16 fat_isEocMarker(FileSystem *fs,euint32 fat_entry);
|
||||
euint32 fat_giveEocMarker(FileSystem *fs);
|
||||
euint32 fat_findClusterAddress(FileSystem *fs,euint32 cluster,euint32 offset, euint8 *linear);
|
||||
euint32 fat_getNextClusterAddressWBuf(FileSystem *fs,euint32 cluster_addr, euint8 * buf);
|
||||
void fat_setNextClusterAddressWBuf(FileSystem *fs,euint32 cluster_addr,euint32 next_cluster_addr,euint8 * buf);
|
||||
esint16 fat_getNextClusterChain(FileSystem *fs, ClusterChain *Cache);
|
||||
void fat_bogus(void);
|
||||
esint16 fat_LogicToDiscCluster(FileSystem *fs, ClusterChain *Cache,euint32 logiccluster);
|
||||
eint16 fat_allocClusterChain(FileSystem *fs,ClusterChain *Cache,euint32 num_clusters);
|
||||
eint16 fat_unlinkClusterChain(FileSystem *fs,ClusterChain *Cache);
|
||||
euint32 fat_countClustersInChain(FileSystem *fs,euint32 firstcluster);
|
||||
euint32 fat_DiscToLogicCluster(FileSystem *fs,euint32 firstcluster,euint32 disccluster);
|
||||
void fat_ShortnameToString(const euint8* src, eint8* nm);
|
||||
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,100 @@
|
||||
/*****************************************************************************\
|
||||
* EFSL - Embedded Filesystems Library *
|
||||
* ----------------------------------- *
|
||||
* *
|
||||
* Filename : file.h *
|
||||
* Release : 0.3 - devel *
|
||||
* Description : This file contains functions dealing with files such as: *
|
||||
* fopen, fread and fwrite. *
|
||||
* *
|
||||
* 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; version 2 *
|
||||
* of the License. *
|
||||
* *
|
||||
* 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. *
|
||||
* *
|
||||
* As a special exception, if other files instantiate templates or *
|
||||
* use macros or inline functions from this file, or you compile this *
|
||||
* file and link it with other works to produce a work based on this file, *
|
||||
* this file does not by itself cause the resulting work to be covered *
|
||||
* by the GNU General Public License. However the source code for this *
|
||||
* file must still be made available in accordance with section (3) of *
|
||||
* the GNU General Public License. *
|
||||
* *
|
||||
* This exception does not invalidate any other reasons why a work based *
|
||||
* on this file might be covered by the GNU General Public License. *
|
||||
* *
|
||||
* (c)2006 Lennart Yseboodt *
|
||||
* (c)2006 Michael De Nil *
|
||||
\*****************************************************************************/
|
||||
|
||||
#ifndef __FILE_H_
|
||||
#define __FILE_H_
|
||||
|
||||
/*****************************************************************************/
|
||||
#include "config.h"
|
||||
#include "error.h"
|
||||
#include "tm.h"
|
||||
#include "fs.h"
|
||||
#include "dir.h"
|
||||
#include "plibc.h"
|
||||
#include "debug.h"
|
||||
#include "types.h"
|
||||
#include "fat.h"
|
||||
/*****************************************************************************/
|
||||
|
||||
/* Operation flags */
|
||||
#define EFSL_O_RDONLY 0
|
||||
#define EFSL_O_WRONLY 1
|
||||
#define EFSL_O_RDWR 2
|
||||
#define EFSL_O_APPEND 8
|
||||
|
||||
#define FILE_STATUS_OPEN 0
|
||||
#define FILE_STATUS_WRITE 1
|
||||
|
||||
/*****************************************************************************\
|
||||
* File
|
||||
* ------
|
||||
* FileRecord DirEntry Copy of the FileRecord for this file
|
||||
* FileLocation Location Location of the direntry
|
||||
* FileSystem *fs Pointer to the filesystem this file is on
|
||||
* FileCache Cache Pointer to the cache object of the file
|
||||
* euint8 FileStatus Contains bitfield regarding filestatus
|
||||
* euint32 FilePtr Offsetpointer for fread/fwrite functions
|
||||
* euint32 FileSize Working copy of the filesize, always use this,
|
||||
it is more up to date than DirEntry->FileSize,
|
||||
which is only updated when flushing to disc.
|
||||
\*****************************************************************************/
|
||||
struct _File{
|
||||
FileRecord DirEntry;
|
||||
FileLocation Location; /* Location in directory!! */
|
||||
FileSystem *fs;
|
||||
ClusterChain Cache;
|
||||
euint8 FileStatus;
|
||||
euint32 FilePtr;
|
||||
euint32 FileSize;
|
||||
euint32 ref_count; /* Descriptor reference count */
|
||||
};
|
||||
typedef struct _File File;
|
||||
|
||||
|
||||
esint8 file_fopen(File *file, FileSystem *fs,eint8 *filename, eint32 mode);
|
||||
esint8 file_fclose(File *file);
|
||||
esint32 file_setpos(File *file,euint32 pos);
|
||||
euint32 file_fread(File *file,euint32 offset, euint32 size,euint8 *buf);
|
||||
euint32 file_read (File *file,euint32 size,euint8 *buf);
|
||||
euint32 file_fwrite(File* file,euint32 offset,euint32 size,euint8* buf);
|
||||
euint32 file_write (File* file,euint32 size,euint8* buf);
|
||||
eint8* file_normalToFatName(eint8* filename,eint8* fatfilename);
|
||||
euint8 file_validateChar(euint8 c);
|
||||
void file_initFile(File *file, FileSystem *fs, FileLocation *loc);
|
||||
eint16 file_allocClusterChain(File *file,euint32 num_clusters);
|
||||
void file_setAttr(File* file,euint8 attribute,euint8 val);
|
||||
euint8 file_getAttr(File* file,euint8 attribute);
|
||||
euint32 file_requiredCluster(File *file,euint32 offset, euint32 size);
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,69 @@
|
||||
/*****************************************************************************\
|
||||
* EFSL - Embedded Filesystems Library *
|
||||
* ----------------------------------- *
|
||||
* *
|
||||
* Filename : ls.h *
|
||||
* Release : 0.3 - devel *
|
||||
* Description : This file contains functions to list the files in a directory *
|
||||
* *
|
||||
* 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; version 2 *
|
||||
* of the License. *
|
||||
* *
|
||||
* 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. *
|
||||
* *
|
||||
* As a special exception, if other files instantiate templates or *
|
||||
* use macros or inline functions from this file, or you compile this *
|
||||
* file and link it with other works to produce a work based on this file, *
|
||||
* this file does not by itself cause the resulting work to be covered *
|
||||
* by the GNU General Public License. However the source code for this *
|
||||
* file must still be made available in accordance with section (3) of *
|
||||
* the GNU General Public License. *
|
||||
* *
|
||||
* This exception does not invalidate any other reasons why a work based *
|
||||
* on this file might be covered by the GNU General Public License. *
|
||||
* *
|
||||
* (c)2006 Lennart Yseboodt *
|
||||
* (c)2006 Michael De Nil *
|
||||
\*****************************************************************************/
|
||||
|
||||
#ifndef __LS_H__
|
||||
#define __LS_H__
|
||||
|
||||
/*****************************************************************************/
|
||||
#include "config.h"
|
||||
#include "fs.h"
|
||||
#include "dir.h"
|
||||
#include "fat.h"
|
||||
/*****************************************************************************/
|
||||
|
||||
struct _ListDirEntry{
|
||||
euint8 FileName[LIST_MAXLENFILENAME];
|
||||
euint32 FileSize;
|
||||
euint8 Attribute;
|
||||
};
|
||||
typedef struct _ListDirEntry ListDirEntry;
|
||||
|
||||
struct _DirList{
|
||||
FileSystem *fs;
|
||||
euint16 cEntry,rEntry;
|
||||
/*FileRecord currentEntry;*/
|
||||
ListDirEntry currentEntry;
|
||||
ClusterChain Cache;
|
||||
};
|
||||
typedef struct _DirList DirList;
|
||||
|
||||
esint8 ls_openDir(DirList *dlist,FileSystem *fs,eint8* dirname);
|
||||
esint8 ls_getNext(DirList *dlist);
|
||||
|
||||
esint8 ls_getDirEntry(DirList *dlist);
|
||||
esint8 ls_getRealDirEntry(DirList *dlist);
|
||||
esint8 ls_getRootAreaEntry(DirList *dlist);
|
||||
esint8 ls_isValidFileEntry(ListDirEntry *entry);
|
||||
void ls_fileEntryToDirListEntry(DirList *dlist, euint8* buf, euint16 offset);
|
||||
|
||||
#endif
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user