1、【修改】FreeModbus主机及从机485收发切换引脚配置方法,采用RTT自带设备框架,提升可移植性。

Signed-off-by: armink <armink.ztl@gmail.com>
This commit is contained in:
armink 2015-02-02 16:39:08 +08:00
parent 7b4d3c52ab
commit c15c3a4cc6
31 changed files with 4361 additions and 5240 deletions

View File

@ -64,6 +64,9 @@
// <bool name="RT_USING_SERIAL" description="Using Serial" default="true" /> // <bool name="RT_USING_SERIAL" description="Using Serial" default="true" />
#define RT_USING_SERIAL #define RT_USING_SERIAL
/* Using GPIO pin framework */
#define RT_USING_PIN
/* SECTION: Console options */ /* SECTION: Console options */
/* the buffer size of console*/ /* the buffer size of console*/
#define RT_CONSOLEBUF_SIZE 128 #define RT_CONSOLEBUF_SIZE 128

View File

@ -52,13 +52,19 @@
#define RT_USING_UART1 #define RT_USING_UART1
#define RT_UART_RX_BUFFER_SIZE 64 #define RT_UART_RX_BUFFER_SIZE 64
enum {
/* modbus slave 485 receive and transmit control pin index */
MODBUS_SLAVE_RT_CONTROL_PIN_INDEX = 0,
/* modbus master 485 receive and transmit control pin index */
MODBUS_MASTER_RT_CONTROL_PIN_INDEX = 1,
};
#define LED_LED1_ON GPIO_SetBits (GPIOA,GPIO_Pin_11) //LED1 #define LED_LED1_ON GPIO_SetBits (GPIOA,GPIO_Pin_11) //LED1
#define LED_LED1_OFF GPIO_ResetBits(GPIOA,GPIO_Pin_11) //LED1 #define LED_LED1_OFF GPIO_ResetBits(GPIOA,GPIO_Pin_11) //LED1
#define LED_LED2_ON GPIO_SetBits (GPIOA,GPIO_Pin_12) //LED1 #define LED_LED2_ON GPIO_SetBits (GPIOA,GPIO_Pin_12) //LED1
#define LED_LED2_OFF GPIO_ResetBits(GPIOA,GPIO_Pin_12) //LED2 #define LED_LED2_OFF GPIO_ResetBits(GPIOA,GPIO_Pin_12) //LED2
void rt_hw_board_init(void); void rt_hw_board_init(void);
void IWDG_Configuration(void); void IWDG_Configuration(void);

19
BSP/inc/gpio.h Normal file
View File

@ -0,0 +1,19 @@
/*
* File : gpio.h
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2015, 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://www.rt-thread.org/license/LICENSE
*
* Change Logs:
* Date Author Notes
* 2015-02-02 Armink the first version
*/
#ifndef GPIO_H__
#define GPIO_H__
int stm32_hw_pin_init(void);
#endif

View File

@ -15,12 +15,6 @@
#ifndef __USART_H__ #ifndef __USART_H__
#define __USART_H__ #define __USART_H__
#include <rthw.h> void stm32_hw_usart_init(void);
#include <rtthread.h>
#define UART_ENABLE_IRQ(n) NVIC_EnableIRQ((n))
#define UART_DISABLE_IRQ(n) NVIC_DisableIRQ((n))
void rt_hw_usart_init(void);
#endif #endif

View File

@ -47,7 +47,8 @@
void rt_hw_board_init() void rt_hw_board_init()
{ {
BSP_Init(); BSP_Init();
rt_hw_usart_init(); stm32_hw_usart_init();
stm32_hw_pin_init();
} }
/******************************************************************************* /*******************************************************************************

153
BSP/src/gpio.c Normal file
View File

@ -0,0 +1,153 @@
/*
* File : gpio.c
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2015, 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://www.rt-thread.org/license/LICENSE
*
* Change Logs:
* Date Author Notes
* 2015-02-02 Armink the first version
*/
#include <rthw.h>
#include <rtdevice.h>
#include "bsp.h"
#ifdef RT_USING_PIN
/* STM32 GPIO driver */
struct pin_index
{
int index;
uint32_t rcc;
GPIO_TypeDef *gpio;
uint32_t pin;
};
static const struct pin_index pins[] =
{
{ 0, RCC_APB2Periph_GPIOA, GPIOA, GPIO_Pin_1},
{ 1, RCC_APB2Periph_GPIOA, GPIOA, GPIO_Pin_2},
};
#define ITEM_NUM(items) sizeof(items)/sizeof(items[0])
const struct pin_index *get_pin(uint8_t pin)
{
const struct pin_index *index;
if (pin < ITEM_NUM(pins))
{
index = &pins[pin];
}
else
{
index = RT_NULL;
}
return index;
};
void stm32_pin_write(rt_device_t dev, rt_base_t pin, rt_base_t value)
{
const struct pin_index *index;
index = get_pin(pin);
if (index == RT_NULL)
{
return;
}
if (value == PIN_LOW)
{
GPIO_ResetBits(index->gpio, index->pin);
}
else
{
GPIO_SetBits(index->gpio, index->pin);
}
}
int stm32_pin_read(rt_device_t dev, rt_base_t pin)
{
int value;
const struct pin_index *index;
value = PIN_LOW;
index = get_pin(pin);
if (index == RT_NULL)
{
return value;
}
if (GPIO_ReadInputDataBit(index->gpio, index->pin) == Bit_RESET)
{
value = PIN_LOW;
}
else
{
value = PIN_HIGH;
}
return value;
}
void stm32_pin_mode(rt_device_t dev, rt_base_t pin, rt_base_t mode)
{
const struct pin_index *index;
GPIO_InitTypeDef GPIO_InitStructure;
index = get_pin(pin);
if (index == RT_NULL)
{
return;
}
/* GPIO Periph clock enable */
RCC_APB2PeriphClockCmd(index->rcc, ENABLE);
/* Configure GPIO_InitStructure */
GPIO_InitStructure.GPIO_Pin = index->pin;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
if (mode == PIN_MODE_OUTPUT)
{
/* output setting */
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
}
else if (mode == PIN_MODE_INPUT)
{
/* input setting: not pull. */
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
}
else if (mode == PIN_MODE_INPUT_PULLUP)
{
/* input setting: pull up. */
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPU;
}
else
{
/* input setting:default. */
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
}
GPIO_Init(index->gpio, &GPIO_InitStructure);
}
const static struct rt_pin_ops _stm32_pin_ops =
{
stm32_pin_mode,
stm32_pin_write,
stm32_pin_read,
};
int stm32_hw_pin_init(void)
{
rt_device_pin_register("pin", &_stm32_pin_ops, RT_NULL);
return 0;
}
INIT_BOARD_EXPORT(stm32_hw_pin_init);
#endif

View File

@ -15,11 +15,12 @@
* 2015-01-31 armink make sure the serial transmit complete in putc() * 2015-01-31 armink make sure the serial transmit complete in putc()
*/ */
#include "stm32f10x.h" #include <rthw.h>
#include "usart.h"
#include "bsp.h"
#include <rtdevice.h> #include <rtdevice.h>
#include "bsp.h"
#define UART_ENABLE_IRQ(n) NVIC_EnableIRQ((n))
#define UART_DISABLE_IRQ(n) NVIC_DisableIRQ((n))
/* USART1 */ /* USART1 */
#define UART1_GPIO_TX GPIO_Pin_9 #define UART1_GPIO_TX GPIO_Pin_9
@ -360,7 +361,7 @@ static void NVIC_Configuration(struct stm32_uart* uart)
NVIC_Init(&NVIC_InitStructure); NVIC_Init(&NVIC_InitStructure);
} }
void rt_hw_usart_init(void) void stm32_hw_usart_init(void)
{ {
struct stm32_uart* uart; struct stm32_uart* uart;
struct serial_configure config = RT_SERIAL_CONFIG_DEFAULT; struct serial_configure config = RT_SERIAL_CONFIG_DEFAULT;

File diff suppressed because it is too large Load Diff

View File

@ -1871,6 +1871,9 @@
<file> <file>
<name>$PROJ_DIR$\..\RT-Thread-1.2.2\libcpu\arm\cortex-m3\cpuport.c</name> <name>$PROJ_DIR$\..\RT-Thread-1.2.2\libcpu\arm\cortex-m3\cpuport.c</name>
</file> </file>
<file>
<name>$PROJ_DIR$\..\BSP\src\gpio.c</name>
</file>
<file> <file>
<name>$PROJ_DIR$\..\BSP\src\usart.c</name> <name>$PROJ_DIR$\..\BSP\src\usart.c</name>
</file> </file>
@ -1958,7 +1961,7 @@
<group> <group>
<name>Port</name> <name>Port</name>
<file> <file>
<name>$PROJ_DIR$\..\FreeModbus\port\port.c</name> <name>$PROJ_DIR$\..\FreeModbus\port\rtt\port.c</name>
</file> </file>
<file> <file>
<name>$PROJ_DIR$\..\FreeModbus\port\rtt\portevent.c</name> <name>$PROJ_DIR$\..\FreeModbus\port\rtt\portevent.c</name>
@ -1984,6 +1987,9 @@
<file> <file>
<name>$PROJ_DIR$\..\RT-Thread-1.2.2\components\drivers\src\dataqueue.c</name> <name>$PROJ_DIR$\..\RT-Thread-1.2.2\components\drivers\src\dataqueue.c</name>
</file> </file>
<file>
<name>$PROJ_DIR$\..\RT-Thread-1.2.2\components\drivers\misc\pin.c</name>
</file>
<file> <file>
<name>$PROJ_DIR$\..\RT-Thread-1.2.2\components\drivers\src\pipe.c</name> <name>$PROJ_DIR$\..\RT-Thread-1.2.2\components\drivers\src\pipe.c</name>
</file> </file>

View File

@ -39,7 +39,7 @@
<Wnd2> <Wnd0>
<Tabs> <Tabs>
<Tab> <Tab>
<Identity>TabID-27820-6871</Identity> <Identity>TabID-27820-6871</Identity>
@ -55,7 +55,7 @@
</Tab> </Tab>
<Tab><Identity>TabID-23458-14555</Identity><TabName>Find All Declarations</TabName><Factory>Find-All-Declarations</Factory><Session/></Tab></Tabs> <Tab><Identity>TabID-23458-14555</Identity><TabName>Find All Declarations</TabName><Factory>Find-All-Declarations</Factory><Session/></Tab></Tabs>
<SelectedTab>0</SelectedTab></Wnd2><Wnd4> <SelectedTab>0</SelectedTab></Wnd0><Wnd1>
<Tabs> <Tabs>
<Tab> <Tab>
<Identity>TabID-5800-6874</Identity> <Identity>TabID-5800-6874</Identity>
@ -63,24 +63,24 @@
<Factory>Workspace</Factory> <Factory>Workspace</Factory>
<Session> <Session>
<NodeDict><ExpandedNode>FreeModbus_Slave&amp;Master+RTT+STM32</ExpandedNode><ExpandedNode>FreeModbus_Slave&amp;Master+RTT+STM32/APP</ExpandedNode><ExpandedNode>FreeModbus_Slave&amp;Master+RTT+STM32/FreeModbusMaster</ExpandedNode><ExpandedNode>FreeModbus_Slave&amp;Master+RTT+STM32/FreeModbusMaster/Modbus</ExpandedNode><ExpandedNode>FreeModbus_Slave&amp;Master+RTT+STM32/FreeModbusSlave</ExpandedNode><ExpandedNode>FreeModbus_Slave&amp;Master+RTT+STM32/FreeModbusSlave/Modbus</ExpandedNode></NodeDict></Session> <NodeDict><ExpandedNode>FreeModbus_Slave&amp;Master+RTT+STM32</ExpandedNode></NodeDict></Session>
</Tab> </Tab>
</Tabs> </Tabs>
<SelectedTab>0</SelectedTab></Wnd4><Wnd5><Tabs><Tab><Identity>TabID-15165-9557</Identity><TabName>Live Watch</TabName><Factory>StaticWatch</Factory></Tab></Tabs><SelectedTab>0</SelectedTab></Wnd5></Windows> <SelectedTab>0</SelectedTab></Wnd1><Wnd3><Tabs><Tab><Identity>TabID-15165-9557</Identity><TabName>Live Watch</TabName><Factory>StaticWatch</Factory></Tab></Tabs><SelectedTab>0</SelectedTab></Wnd3></Windows>
<Editor> <Editor>
<Pane><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\..\APP\src\app_task.c</Filename><XPos>0</XPos><YPos>0</YPos><SelStart>0</SelStart><SelEnd>0</SelEnd><XPos2>0</XPos2><YPos2>0</YPos2><SelStart2>1492</SelStart2><SelEnd2>1492</SelEnd2></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\..\APP\src\app.c</Filename><XPos>0</XPos><YPos>0</YPos><SelStart>0</SelStart><SelEnd>0</SelEnd><XPos2>0</XPos2><YPos2>0</YPos2><SelStart2>25</SelStart2><SelEnd2>25</SelEnd2></Tab><ActiveTab>1</ActiveTab></Pane><ActivePane>0</ActivePane><Sizes><Pane><X>1000000</X><Y>1000000</Y></Pane></Sizes><SplitMode>1</SplitMode></Editor> <Pane><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\..\APP\src\app_task.c</Filename><XPos>0</XPos><YPos>0</YPos><SelStart>0</SelStart><SelEnd>0</SelEnd><XPos2>0</XPos2><YPos2>0</YPos2><SelStart2>852</SelStart2><SelEnd2>852</SelEnd2></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\..\BSP\src\gpio.c</Filename><XPos>0</XPos><YPos>0</YPos><SelStart>0</SelStart><SelEnd>0</SelEnd><XPos2>0</XPos2><YPos2>0</YPos2><SelStart2>457</SelStart2><SelEnd2>457</SelEnd2></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\..\BSP\src\usart.c</Filename><XPos>0</XPos><YPos>0</YPos><SelStart>0</SelStart><SelEnd>0</SelEnd><XPos2>0</XPos2><YPos2>0</YPos2><SelStart2>1150</SelStart2><SelEnd2>1150</SelEnd2></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\..\APP\src\app.c</Filename><XPos>0</XPos><YPos>0</YPos><SelStart>0</SelStart><SelEnd>0</SelEnd><XPos2>0</XPos2><YPos2>0</YPos2><SelStart2>25</SelStart2><SelEnd2>25</SelEnd2></Tab><ActiveTab>3</ActiveTab></Pane><ActivePane>0</ActivePane><Sizes><Pane><X>1000000</X><Y>1000000</Y></Pane></Sizes><SplitMode>1</SplitMode></Editor>
<Positions> <Positions>
<Top><Row0><Sizes><Toolbar-01215d00><key>iaridepm.enu1</key></Toolbar-01215d00></Sizes></Row0><Row1><Sizes><Toolbar-062b6f30><key>debuggergui.enu1</key></Toolbar-062b6f30></Sizes></Row1></Top><Left><Row0><Sizes><Wnd4><Rect><Top>-2</Top><Left>-2</Left><Bottom>703</Bottom><Right>241</Right><x>-2</x><y>-2</y><xscreen>99</xscreen><yscreen>197</yscreen><sizeHorzCX>58929</sizeHorzCX><sizeHorzCY>203723</sizeHorzCY><sizeVertCX>144643</sizeVertCX><sizeVertCY>729059</sizeVertCY></Rect></Wnd4></Sizes></Row0></Left><Right><Row0><Sizes><Wnd5><Rect><Top>-2</Top><Left>-2</Left><Bottom>703</Bottom><Right>477</Right><x>-2</x><y>-2</y><xscreen>200</xscreen><yscreen>200</yscreen><sizeHorzCX>119048</sizeHorzCX><sizeHorzCY>206825</sizeHorzCY><sizeVertCX>285119</sizeVertCX><sizeVertCY>729059</sizeVertCY></Rect></Wnd5></Sizes></Row0></Right><Bottom><Row0><Sizes><Wnd2><Rect><Top>-2</Top><Left>-2</Left><Bottom>195</Bottom><Right>1682</Right><x>-2</x><y>-2</y><xscreen>1684</xscreen><yscreen>197</yscreen><sizeHorzCX>1002381</sizeHorzCX><sizeHorzCY>203723</sizeHorzCY><sizeVertCX>58929</sizeVertCX><sizeVertCY>203723</sizeVertCY></Rect></Wnd2></Sizes></Row0></Bottom><Float><Sizes/></Float></Positions> <Top><Row0><Sizes><Toolbar-03574f20><key>iaridepm.enu1</key></Toolbar-03574f20></Sizes></Row0><Row1><Sizes><Toolbar-169f1038><key>debuggergui.enu1</key></Toolbar-169f1038></Sizes></Row1></Top><Left><Row0><Sizes><Wnd1><Rect><Top>-2</Top><Left>-2</Left><Bottom>703</Bottom><Right>241</Right><x>-2</x><y>-2</y><xscreen>99</xscreen><yscreen>197</yscreen><sizeHorzCX>58929</sizeHorzCX><sizeHorzCY>203723</sizeHorzCY><sizeVertCX>144643</sizeVertCX><sizeVertCY>729059</sizeVertCY></Rect></Wnd1></Sizes></Row0></Left><Right><Row0><Sizes><Wnd3><Rect><Top>-2</Top><Left>-2</Left><Bottom>703</Bottom><Right>477</Right><x>-2</x><y>-2</y><xscreen>200</xscreen><yscreen>200</yscreen><sizeHorzCX>119048</sizeHorzCX><sizeHorzCY>206825</sizeHorzCY><sizeVertCX>285119</sizeVertCX><sizeVertCY>729059</sizeVertCY></Rect></Wnd3></Sizes></Row0></Right><Bottom><Row0><Sizes><Wnd0><Rect><Top>-2</Top><Left>-2</Left><Bottom>195</Bottom><Right>1682</Right><x>-2</x><y>-2</y><xscreen>1684</xscreen><yscreen>197</yscreen><sizeHorzCX>1002381</sizeHorzCX><sizeHorzCY>203723</sizeHorzCY><sizeVertCX>58929</sizeVertCX><sizeVertCY>203723</sizeVertCY></Rect></Wnd0></Sizes></Row0></Bottom><Float><Sizes/></Float></Positions>
</Desktop> </Desktop>
</Project> </Project>

View File

@ -9,7 +9,7 @@ TriggerName=main
LimitSize=0 LimitSize=0
ByteLimit=50 ByteLimit=50
[DebugChecksum] [DebugChecksum]
Checksum=-1153624826 Checksum=340144999
[Exceptions] [Exceptions]
StopOnUncaught=_ 0 StopOnUncaught=_ 0
StopOnThrow=_ 0 StopOnThrow=_ 0

View File

@ -17,7 +17,7 @@
<Build><ColumnWidth0>20</ColumnWidth0><ColumnWidth1>1215</ColumnWidth1><ColumnWidth2>324</ColumnWidth2><ColumnWidth3>81</ColumnWidth3></Build><TerminalIO/><Debug-Log><ColumnWidth0>19</ColumnWidth0><ColumnWidth1>1622</ColumnWidth1></Debug-Log><Find-All-Declarations><ColumnWidth0>580</ColumnWidth0><ColumnWidth1>82</ColumnWidth1><ColumnWidth2>994</ColumnWidth2></Find-All-Declarations></Static> <Build><ColumnWidth0>20</ColumnWidth0><ColumnWidth1>1215</ColumnWidth1><ColumnWidth2>324</ColumnWidth2><ColumnWidth3>81</ColumnWidth3></Build><TerminalIO/><Debug-Log><ColumnWidth0>19</ColumnWidth0><ColumnWidth1>1622</ColumnWidth1></Debug-Log><Find-All-Declarations><ColumnWidth0>580</ColumnWidth0><ColumnWidth1>82</ColumnWidth1><ColumnWidth2>994</ColumnWidth2></Find-All-Declarations></Static>
<Windows> <Windows>
<Wnd2> <Wnd0>
<Tabs> <Tabs>
<Tab> <Tab>
<Identity>TabID-30370-1297</Identity> <Identity>TabID-30370-1297</Identity>
@ -29,20 +29,20 @@
</Tab> </Tab>
</Tabs> </Tabs>
<SelectedTab>0</SelectedTab></Wnd2><Wnd3><Tabs><Tab><Identity>TabID-24390-6730</Identity><TabName>Build</TabName><Factory>Build</Factory><Session/></Tab><Tab><Identity>TabID-3984-13619</Identity><TabName>Find All Declarations</TabName><Factory>Find-All-Declarations</Factory><Session/></Tab></Tabs><SelectedTab>0</SelectedTab></Wnd3></Windows> <SelectedTab>0</SelectedTab></Wnd0><Wnd1><Tabs><Tab><Identity>TabID-24390-6730</Identity><TabName>Build</TabName><Factory>Build</Factory><Session/></Tab><Tab><Identity>TabID-3984-13619</Identity><TabName>Find All Declarations</TabName><Factory>Find-All-Declarations</Factory><Session/></Tab></Tabs><SelectedTab>0</SelectedTab></Wnd1></Windows>
<Editor> <Editor>
<Pane><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\..\APP\src\app_task.c</Filename><XPos>0</XPos><YPos>0</YPos><SelStart>0</SelStart><SelEnd>0</SelEnd><XPos2>0</XPos2><YPos2>0</YPos2><SelStart2>1492</SelStart2><SelEnd2>1492</SelEnd2></Tab><ActiveTab>0</ActiveTab></Pane><ActivePane>0</ActivePane><Sizes><Pane><X>1000000</X><Y>1000000</Y></Pane></Sizes><SplitMode>1</SplitMode></Editor> <Pane><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\..\APP\src\app_task.c</Filename><XPos>0</XPos><YPos>0</YPos><SelStart>0</SelStart><SelEnd>0</SelEnd><XPos2>0</XPos2><YPos2>0</YPos2><SelStart2>160</SelStart2><SelEnd2>160</SelEnd2></Tab><ActiveTab>0</ActiveTab></Pane><ActivePane>0</ActivePane><Sizes><Pane><X>1000000</X><Y>1000000</Y></Pane></Sizes><SplitMode>1</SplitMode></Editor>
<Positions> <Positions>
<Top><Row0><Sizes><Toolbar-01215d00><key>iaridepm.enu1</key></Toolbar-01215d00></Sizes></Row0><Row1><Sizes/></Row1></Top><Left><Row0><Sizes><Wnd2><Rect><Top>-2</Top><Left>-2</Left><Bottom>738</Bottom><Right>270</Right><x>-2</x><y>-2</y><xscreen>338</xscreen><yscreen>71</yscreen><sizeHorzCX>201190</sizeHorzCX><sizeHorzCY>73423</sizeHorzCY><sizeVertCX>161905</sizeVertCX><sizeVertCY>765253</sizeVertCY></Rect></Wnd2></Sizes></Row0></Left><Right><Row0><Sizes/></Row0></Right><Bottom><Row0><Sizes><Wnd3><Rect><Top>-2</Top><Left>-2</Left><Bottom>184</Bottom><Right>1682</Right><x>-2</x><y>-2</y><xscreen>1684</xscreen><yscreen>186</yscreen><sizeHorzCX>1002381</sizeHorzCX><sizeHorzCY>192347</sizeHorzCY><sizeVertCX>201190</sizeVertCX><sizeVertCY>73423</sizeVertCY></Rect></Wnd3></Sizes></Row0></Bottom><Float><Sizes/></Float></Positions> <Top><Row0><Sizes><Toolbar-03574f20><key>iaridepm.enu1</key></Toolbar-03574f20></Sizes></Row0><Row1><Sizes/></Row1></Top><Left><Row0><Sizes><Wnd0><Rect><Top>-2</Top><Left>-2</Left><Bottom>718</Bottom><Right>270</Right><x>-2</x><y>-2</y><xscreen>338</xscreen><yscreen>71</yscreen><sizeHorzCX>201190</sizeHorzCX><sizeHorzCY>73423</sizeHorzCY><sizeVertCX>161905</sizeVertCX><sizeVertCY>744571</sizeVertCY></Rect></Wnd0></Sizes></Row0></Left><Right><Row0><Sizes/></Row0></Right><Bottom><Row0><Sizes><Wnd1><Rect><Top>-2</Top><Left>-2</Left><Bottom>204</Bottom><Right>1682</Right><x>-2</x><y>-2</y><xscreen>1684</xscreen><yscreen>206</yscreen><sizeHorzCX>1002381</sizeHorzCX><sizeHorzCY>213030</sizeHorzCY><sizeVertCX>201190</sizeVertCX><sizeVertCY>73423</sizeVertCY></Rect></Wnd1></Sizes></Row0></Bottom><Float><Sizes/></Float></Positions>
</Desktop> </Desktop>
</Workspace> </Workspace>

View File

@ -34,12 +34,6 @@
#define PR_BEGIN_EXTERN_C extern "C" { #define PR_BEGIN_EXTERN_C extern "C" {
#define PR_END_EXTERN_C } #define PR_END_EXTERN_C }
//TODO 暂时先写B13引脚等组网测试时再确认
#define SLAVE_RS485_TRANS_MODE GPIO_SetBits(GPIOB,GPIO_Pin_13)
#define SLAVE_RS485_RECEIVE_MODE GPIO_ResetBits(GPIOB,GPIO_Pin_13)
#define MASTER_RS485_TRANS_MODE GPIO_SetBits(GPIOB,GPIO_Pin_13)
#define MASTER_RS485_RECEIVE_MODE GPIO_ResetBits(GPIOB,GPIO_Pin_13)
#define ENTER_CRITICAL_SECTION() EnterCriticalSection() #define ENTER_CRITICAL_SECTION() EnterCriticalSection()
#define EXIT_CRITICAL_SECTION() ExitCriticalSection() #define EXIT_CRITICAL_SECTION() ExitCriticalSection()

View File

@ -1,5 +1,5 @@
/* /*
* FreeModbus Libary: STM32 Port * FreeModbus Libary: RT-Thread Port
* Copyright (C) 2013 Armink <armink.ztl@gmail.com> * Copyright (C) 2013 Armink <armink.ztl@gmail.com>
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
@ -16,7 +16,7 @@
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
* *
* File: $Id: portevent.c,v 1.60 2013/12/28 9:18:05 Armink $ * File: $Id: portevent.c,v 1.60 2015/02/01 9:18:05 Armink $
*/ */
/* ----------------------- System includes --------------------------------*/ /* ----------------------- System includes --------------------------------*/
@ -24,21 +24,15 @@
/* ----------------------- Modbus includes ----------------------------------*/ /* ----------------------- Modbus includes ----------------------------------*/
#include "port.h" #include "port.h"
/* ----------------------- Variables ----------------------------------------*/ /* ----------------------- Variables ----------------------------------------*/
static rt_base_t level;
/* ----------------------- Start implementation -----------------------------*/ /* ----------------------- Start implementation -----------------------------*/
void EnterCriticalSection(void) void EnterCriticalSection(void)
{ {
//关闭全局中断 level = rt_hw_interrupt_disable();
__disable_irq();
} }
void ExitCriticalSection(void) void ExitCriticalSection(void)
{ {
//开启全局中断 rt_hw_interrupt_enable(level);
__enable_irq();
} }
void vMBDelay(ULONG nCount)
{
for(; nCount > 0;nCount--);
}

View File

@ -52,13 +52,11 @@ static void serial_soft_trans_irq(void* parameter);
BOOL xMBPortSerialInit(UCHAR ucPORT, ULONG ulBaudRate, UCHAR ucDataBits, BOOL xMBPortSerialInit(UCHAR ucPORT, ULONG ulBaudRate, UCHAR ucDataBits,
eMBParity eParity) eMBParity eParity)
{ {
GPIO_InitTypeDef GPIO_InitStructure; /**
* set 485 mode receive and transmit control IO
/* set 485 model receive and transmit control IO */ * @note MODBUS_SLAVE_RT_CONTROL_PIN_INDEX need be defined by user
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; */
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; rt_pin_mode(MODBUS_SLAVE_RT_CONTROL_PIN_INDEX, PIN_MODE_OUTPUT);
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_13;
GPIO_Init(GPIOB, &GPIO_InitStructure);
/* set serial name */ /* set serial name */
if (ucPORT == 1) { if (ucPORT == 1) {
@ -97,13 +95,9 @@ BOOL xMBPortSerialInit(UCHAR ucPORT, ULONG ulBaudRate, UCHAR ucDataBits,
break; break;
} }
} }
/* disable all interrupt */
ENTER_CRITICAL_SECTION();
/* set serial configure */ /* set serial configure */
serial->ops->configure(serial, &(serial->config)); serial->ops->configure(serial, &(serial->config));
/* resume all interrupt */
EXIT_CRITICAL_SECTION();
/* open serial device */ /* open serial device */
if (!serial->parent.open(&serial->parent, if (!serial->parent.open(&serial->parent,
RT_DEVICE_OFLAG_RDWR | RT_DEVICE_FLAG_INT_RX )) { RT_DEVICE_OFLAG_RDWR | RT_DEVICE_FLAG_INT_RX )) {
@ -134,12 +128,12 @@ void vMBPortSerialEnable(BOOL xRxEnable, BOOL xTxEnable)
/* enable RX interrupt */ /* enable RX interrupt */
serial->ops->control(serial, RT_DEVICE_CTRL_SET_INT, (void *)RT_DEVICE_FLAG_INT_RX); serial->ops->control(serial, RT_DEVICE_CTRL_SET_INT, (void *)RT_DEVICE_FLAG_INT_RX);
/* switch 485 to receive mode */ /* switch 485 to receive mode */
SLAVE_RS485_RECEIVE_MODE; rt_pin_write(MODBUS_SLAVE_RT_CONTROL_PIN_INDEX, PIN_LOW);
} }
else else
{ {
/* switch 485 to transmit mode */ /* switch 485 to transmit mode */
SLAVE_RS485_TRANS_MODE; rt_pin_write(MODBUS_SLAVE_RT_CONTROL_PIN_INDEX, PIN_HIGH);
/* disable RX interrupt */ /* disable RX interrupt */
serial->ops->control(serial, RT_DEVICE_CTRL_CLR_INT, (void *)RT_DEVICE_FLAG_INT_RX); serial->ops->control(serial, RT_DEVICE_CTRL_CLR_INT, (void *)RT_DEVICE_FLAG_INT_RX);
} }

View File

@ -53,13 +53,11 @@ static void serial_soft_trans_irq(void* parameter);
BOOL xMBMasterPortSerialInit(UCHAR ucPORT, ULONG ulBaudRate, UCHAR ucDataBits, BOOL xMBMasterPortSerialInit(UCHAR ucPORT, ULONG ulBaudRate, UCHAR ucDataBits,
eMBParity eParity) eMBParity eParity)
{ {
GPIO_InitTypeDef GPIO_InitStructure; /**
* set 485 mode receive and transmit control IO
/* set 485 model receive and transmit control IO */ * @note MODBUS_MASTER_RT_CONTROL_PIN_INDEX need be defined by user
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; */
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; rt_pin_mode(MODBUS_MASTER_RT_CONTROL_PIN_INDEX, PIN_MODE_OUTPUT);
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_13;
GPIO_Init(GPIOB, &GPIO_InitStructure);
/* set serial name */ /* set serial name */
if (ucPORT == 1) { if (ucPORT == 1) {
@ -98,13 +96,9 @@ BOOL xMBMasterPortSerialInit(UCHAR ucPORT, ULONG ulBaudRate, UCHAR ucDataBits,
break; break;
} }
} }
/* disable all interrupt */
ENTER_CRITICAL_SECTION();
/* set serial configure */ /* set serial configure */
serial->ops->configure(serial, &(serial->config)); serial->ops->configure(serial, &(serial->config));
/* resume all interrupt */
EXIT_CRITICAL_SECTION();
/* open serial device */ /* open serial device */
if (!serial->parent.open(&serial->parent, if (!serial->parent.open(&serial->parent,
RT_DEVICE_OFLAG_RDWR | RT_DEVICE_FLAG_INT_RX )) { RT_DEVICE_OFLAG_RDWR | RT_DEVICE_FLAG_INT_RX )) {
@ -135,12 +129,12 @@ void vMBMasterPortSerialEnable(BOOL xRxEnable, BOOL xTxEnable)
/* enable RX interrupt */ /* enable RX interrupt */
serial->ops->control(serial, RT_DEVICE_CTRL_SET_INT, (void *)RT_DEVICE_FLAG_INT_RX); serial->ops->control(serial, RT_DEVICE_CTRL_SET_INT, (void *)RT_DEVICE_FLAG_INT_RX);
/* switch 485 to receive mode */ /* switch 485 to receive mode */
SLAVE_RS485_RECEIVE_MODE; rt_pin_write(MODBUS_MASTER_RT_CONTROL_PIN_INDEX, PIN_LOW);
} }
else else
{ {
/* switch 485 to transmit mode */ /* switch 485 to transmit mode */
SLAVE_RS485_TRANS_MODE; rt_pin_write(MODBUS_MASTER_RT_CONTROL_PIN_INDEX, PIN_HIGH);
/* disable RX interrupt */ /* disable RX interrupt */
serial->ops->control(serial, RT_DEVICE_CTRL_CLR_INT, (void *)RT_DEVICE_FLAG_INT_RX); serial->ops->control(serial, RT_DEVICE_CTRL_CLR_INT, (void *)RT_DEVICE_FLAG_INT_RX);
} }

View File

@ -0,0 +1,79 @@
/*
* File : pin.h
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2015, RT-Thread Development Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Change Logs:
* Date Author Notes
* 2015-01-20 Bernard the first version
*/
#ifndef PIN_H__
#define PIN_H__
#include <rtthread.h>
#include <rtdevice.h>
#ifdef __cplusplus
extern "C" {
#endif
/* pin device and operations for RT-Thread */
struct rt_device_pin
{
struct rt_device parent;
const struct rt_pin_ops *ops;
};
#define PIN_LOW 0x00
#define PIN_HIGH 0x01
#define PIN_MODE_OUTPUT 0x00
#define PIN_MODE_INPUT 0x01
#define PIN_MODE_INPUT_PULLUP 0x02
struct rt_device_pin_mode
{
rt_uint16_t pin;
rt_uint16_t mode;
};
struct rt_device_pin_status
{
rt_uint16_t pin;
rt_uint16_t status;
};
struct rt_pin_ops
{
void (*pin_mode)(struct rt_device *device, rt_base_t pin, rt_base_t mode);
void (*pin_write)(struct rt_device *device, rt_base_t pin, rt_base_t value);
int (*pin_read)(struct rt_device *device, rt_base_t pin);
/* TODO: add GPIO interrupt */
};
int rt_device_pin_register(const char *name, const struct rt_pin_ops *ops, void *user_data);
void rt_pin_mode(rt_base_t pin, rt_base_t mode);
void rt_pin_write(rt_base_t pin, rt_base_t value);
int rt_pin_read(rt_base_t pin);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -179,3 +179,4 @@ rt_err_t rt_hw_serial_register(struct rt_serial_device *serial,
void *data); void *data);
#endif #endif

View File

@ -20,6 +20,7 @@
* Change Logs: * Change Logs:
* Date Author Notes * Date Author Notes
* 2012-10-01 Yi Qiu first version * 2012-10-01 Yi Qiu first version
* 2013-04-26 aozima add DEVICEQUALIFIER support.
*/ */
#ifndef __USB_COMMON_H__ #ifndef __USB_COMMON_H__
@ -148,13 +149,22 @@ extern "C" {
#define USB_EPNO_MASK 0x7f #define USB_EPNO_MASK 0x7f
#define USB_DIR_OUT 0x00 #define USB_DIR_OUT 0x00
#define USB_DIR_IN 0x80 #define USB_DIR_IN 0x80
#define USB_DIR_INOUT 0x40
#define USB_DIR_MASK 0x80 #define USB_DIR_MASK 0x80
#define ID_UNASSIGNED 0
#define ID_ASSIGNED 1
#define RH_GET_PORT_STATUS 0 #define RH_GET_PORT_STATUS 0
#define RH_SET_PORT_STATUS 1 #define RH_SET_PORT_STATUS 1
#define RH_CLEAR_PORT_FEATURE 2 #define RH_CLEAR_PORT_FEATURE 2
#define RH_SET_PORT_FEATURE 3 #define RH_SET_PORT_FEATURE 3
#define USB_BUS_POWERED 0
#define USB_SELF_POWERED 1
#define USB_REMOTE_WAKEUP 1
#define USB_EP_HALT 0
/* /*
* Port feature numbers * Port feature numbers
*/ */
@ -205,6 +215,7 @@ extern "C" {
#define USB_EP_ATTR(attr) (attr & USB_EP_ATTR_TYPE_MASK) #define USB_EP_ATTR(attr) (attr & USB_EP_ATTR_TYPE_MASK)
#define USB_EP_DESC_NUM(addr) (addr & USB_EP_DESC_NUM_MASK) #define USB_EP_DESC_NUM(addr) (addr & USB_EP_DESC_NUM_MASK)
#define USB_EP_DIR(addr) ((addr & USB_DIR_MASK)>>7)
#define uswap_32(x) \ #define uswap_32(x) \
((((x) & 0xff000000) >> 24) | \ ((((x) & 0xff000000) >> 24) | \
@ -332,6 +343,21 @@ struct uhub_descriptor
}; };
typedef struct uhub_descriptor* uhub_desc_t; typedef struct uhub_descriptor* uhub_desc_t;
/* USB_DESC_TYPE_DEVICEQUALIFIER: Device Qualifier descriptor */
struct usb_qualifier_descriptor
{
rt_uint8_t bLength;
rt_uint8_t bDescriptorType;
rt_uint16_t bcdUSB; // TODO: big-endian.
rt_uint8_t bDeviceClass;
rt_uint8_t bDeviceSubClass;
rt_uint8_t bDeviceProtocol;
rt_uint8_t bMaxPacketSize0;
rt_uint8_t bNumConfigurations;
rt_uint8_t bRESERVED;
} __attribute__ ((packed));
struct uhid_descriptor struct uhid_descriptor
{ {
rt_uint8_t bLength; rt_uint8_t bLength;
@ -347,7 +373,7 @@ struct uhid_descriptor
}; };
typedef struct uhid_descriptor* uhid_desc_t; typedef struct uhid_descriptor* uhid_desc_t;
struct ureqest struct urequest
{ {
rt_uint8_t request_type; rt_uint8_t request_type;
rt_uint8_t request; rt_uint8_t request;
@ -355,10 +381,12 @@ struct ureqest
rt_uint16_t index; rt_uint16_t index;
rt_uint16_t length; rt_uint16_t length;
}; };
typedef struct ureqest* ureq_t; typedef struct urequest* ureq_t;
#ifndef MIN
#define MIN(a, b) (a < b ? a : b) #define MIN(a, b) (a < b ? a : b)
#define MAX(a, b) (a > b ? a : b) #define MAX(a, b) (a > b ? a : b)
#endif
/* /*
* the define related to mass storage * the define related to mass storage
@ -368,6 +396,11 @@ typedef struct ureqest* ureq_t;
#define SIZEOF_CSW 0x0d #define SIZEOF_CSW 0x0d
#define SIZEOF_CBW 0x1f #define SIZEOF_CBW 0x1f
#define SIZEOF_INQUIRY_CMD 0x24
#define SIZEOF_MODE_SENSE_6 0x4
#define SIZEOF_READ_CAPACITIES 0xc
#define SIZEOF_READ_CAPACITY 0x8
#define SIZEOF_REQUEST_SENSE 0x12
#define CBWFLAGS_DIR_M 0x80 #define CBWFLAGS_DIR_M 0x80
#define CBWFLAGS_DIR_IN 0x80 #define CBWFLAGS_DIR_IN 0x80
@ -376,7 +409,7 @@ typedef struct ureqest* ureq_t;
#define SCSI_TEST_UNIT_READY 0x00 #define SCSI_TEST_UNIT_READY 0x00
#define SCSI_REQUEST_SENSE 0x03 #define SCSI_REQUEST_SENSE 0x03
#define SCSI_INQUIRY_CMD 0x12 #define SCSI_INQUIRY_CMD 0x12
#define SCSI_ALLOW_MEDIUM_REMOVAL 0x1e #define SCSI_ALLOW_REMOVAL 0x1e
#define SCSI_MODE_SENSE_6 0x1a #define SCSI_MODE_SENSE_6 0x1a
#define SCSI_START_STOP 0x1b #define SCSI_START_STOP 0x1b
#define SCSI_READ_CAPACITIES 0x23 #define SCSI_READ_CAPACITIES 0x23
@ -405,7 +438,7 @@ struct ustorage_csw
{ {
rt_uint32_t signature; rt_uint32_t signature;
rt_uint32_t tag; rt_uint32_t tag;
rt_uint32_t data_reside; rt_int32_t data_reside;
rt_uint8_t status; rt_uint8_t status;
}; };
typedef struct ustorage_csw* ustorage_csw_t; typedef struct ustorage_csw* ustorage_csw_t;

View File

@ -20,7 +20,8 @@
* Change Logs: * Change Logs:
* Date Author Notes * Date Author Notes
* 2012-10-01 Yi Qiu first version * 2012-10-01 Yi Qiu first version
* 2012-12-12 heyuanjie87 change endpoint and class handler * 2012-12-12 heyuanjie87 change endpoint and function handler
* 2013-04-26 aozima add DEVICEQUALIFIER support.
*/ */
#ifndef __USB_DEVICE_H__ #ifndef __USB_DEVICE_H__
@ -31,59 +32,115 @@
/* Vendor ID */ /* Vendor ID */
#ifdef USB_VENDOR_ID #ifdef USB_VENDOR_ID
#define _VENDOR_ID USB_VENDOR_ID #define _VENDOR_ID USB_VENDOR_ID
#else #else
#define _VENDOR_ID 0x0EFF #define _VENDOR_ID 0x0EFF
#endif #endif
/* Product ID */ /* Product ID */
#ifdef USB_PRODUCT_ID #ifdef USB_PRODUCT_ID
#define _PRODUCT_ID USB_PRODUCT_ID #define _PRODUCT_ID USB_PRODUCT_ID
#else #else
#define _PRODUCT_ID 0x0001 #define _PRODUCT_ID 0x0001
#endif #endif
#define USB_BCD_DEVICE 0x0200 /* USB Specification Release Number in Binary-Coded Decimal */ #define USB_BCD_DEVICE 0x0200 /* USB Specification Release Number in Binary-Coded Decimal */
#define USB_BCD_VERSION 0x0200 /* USB 2.0 */ #define USB_BCD_VERSION 0x0200 /* USB 2.0 */
#define EP0_IN_ADDR 0x80
#define EP0_OUT_ADDR 0x00
#define EP_HANDLER(ep, func, size) RT_ASSERT(ep != RT_NULL); ep->handler(func, size)
#define EP_ADDRESS(ep) ep->ep_desc->bEndpointAddress
#define EP_MAXPACKET(ep) ep->ep_desc->wMaxPacketSize
#define FUNC_ENABLE(func) do{ \
if(func->ops->enable != RT_NULL && \
func->enabled == RT_FALSE) \
{ \
if(func->ops->enable(func) == RT_EOK) \
func->enabled = RT_TRUE; \
} \
}while(0)
#define FUNC_DISABLE(func) do{ \
if(func->ops->disable != RT_NULL && \
func->enabled == RT_TRUE) \
{ \
func->enabled = RT_FALSE; \
func->ops->disable(func); \
} \
}while(0)
struct uclass; struct ufunction;
struct udevice; struct udevice;
struct uendpoint; struct uendpoint;
typedef enum
{
/* request to read full count */
UIO_REQUEST_READ_FULL,
/* request to read any count */
UIO_REQUEST_READ_MOST,
/* request to write full count */
UIO_REQUEST_WRITE,
}UIO_REQUEST_TYPE;
struct udcd_ops struct udcd_ops
{ {
rt_err_t (*set_address)(rt_uint8_t value); rt_err_t (*set_address)(rt_uint8_t address);
rt_err_t (*clear_feature)(rt_uint16_t value, rt_uint16_t index); rt_err_t (*set_config)(rt_uint8_t address);
rt_err_t (*set_feature)(rt_uint16_t value, rt_uint16_t index); rt_err_t (*ep_set_stall)(rt_uint8_t address);
rt_err_t (*ep_alloc)(struct uendpoint* ep); rt_err_t (*ep_clear_stall)(rt_uint8_t address);
rt_err_t (*ep_free)(struct uendpoint* ep); rt_err_t (*ep_enable)(struct uendpoint* ep);
rt_err_t (*ep_stall)(struct uendpoint* ep); rt_err_t (*ep_disable)(struct uendpoint* ep);
rt_err_t (*ep_run)(struct uendpoint* ep); rt_size_t (*ep_read_prepare)(rt_uint8_t address, void *buffer, rt_size_t size);
rt_err_t (*ep_stop)(struct uendpoint* ep); rt_size_t (*ep_read)(rt_uint8_t address, void *buffer);
rt_err_t (*ep_read)(struct uendpoint* ep, void *buffer, rt_size_t size); rt_size_t (*ep_write)(rt_uint8_t address, void *buffer, rt_size_t size);
rt_size_t (*ep_write)(struct uendpoint* ep, void *buffer, rt_size_t size); rt_err_t (*ep0_send_status)(void);
rt_err_t (*send_status)(void); rt_err_t (*suspend)(void);
rt_err_t (*wakeup)(void);
}; };
struct udcd struct ep_id
{ {
struct rt_device parent; rt_uint8_t addr;
struct udcd_ops* ops; rt_uint8_t type;
struct rt_completion completion; rt_uint8_t dir;
rt_uint8_t maxpacket;
rt_uint8_t status;
}; };
typedef struct udcd* udcd_t;
typedef rt_err_t (*udep_handler_t)(struct udevice* device, struct uclass* cls, rt_size_t size); typedef rt_err_t (*udep_handler_t)(struct ufunction* func, rt_size_t size);
struct uio_request
{
rt_list_t list;
UIO_REQUEST_TYPE req_type;
rt_uint8_t* buffer;
rt_size_t size;
rt_size_t remain_size;
};
typedef struct uio_request* uio_request_t;
struct uendpoint struct uendpoint
{ {
rt_list_t list; rt_list_t list;
rt_uint8_t* buffer;
uep_desc_t ep_desc; uep_desc_t ep_desc;
rt_list_t request_list;
struct uio_request request;
rt_uint8_t* buffer;
rt_bool_t stalled;
struct ep_id* id;
udep_handler_t handler; udep_handler_t handler;
rt_bool_t is_stall; rt_err_t (*rx_indicate)(struct udevice* dev, rt_size_t size);
}; };
typedef struct uendpoint* uep_t; typedef struct uendpoint* uep_t;
struct udcd
{
struct rt_device parent;
const struct udcd_ops* ops;
struct uendpoint ep0;
struct ep_id* ep_pool;
};
typedef struct udcd* udcd_t;
struct ualtsetting struct ualtsetting
{ {
rt_list_t list; rt_list_t list;
@ -94,7 +151,7 @@ struct ualtsetting
}; };
typedef struct ualtsetting* ualtsetting_t; typedef struct ualtsetting* ualtsetting_t;
typedef rt_err_t (*uintf_handler_t)(struct udevice* device, struct uclass* cls, ureq_t setup); typedef rt_err_t (*uintf_handler_t)(struct ufunction* func, ureq_t setup);
struct uinterface struct uinterface
{ {
@ -106,32 +163,32 @@ struct uinterface
}; };
typedef struct uinterface* uintf_t; typedef struct uinterface* uintf_t;
struct uclass_ops struct ufunction_ops
{ {
rt_err_t (*run)(struct udevice* device, struct uclass* cls); rt_err_t (*enable)(struct ufunction* func);
rt_err_t (*stop)(struct udevice* device, struct uclass* cls); rt_err_t (*disable)(struct ufunction* func);
rt_err_t (*sof_handler)(struct udevice* device, struct uclass* cls); rt_err_t (*sof_handler)(struct ufunction* func);
}; };
typedef struct uclass_ops* uclass_ops_t; typedef struct ufunction_ops* ufunction_ops_t;
struct uclass struct ufunction
{ {
rt_list_t list; rt_list_t list;
uclass_ops_t ops; ufunction_ops_t ops;
void* eps;
struct udevice* device; struct udevice* device;
udev_desc_t dev_desc; udev_desc_t dev_desc;
void* user_data; void* user_data;
rt_bool_t enabled;
rt_list_t intf_list; rt_list_t intf_list;
}; };
typedef struct uclass* uclass_t; typedef struct ufunction* ufunction_t;
struct uconfig struct uconfig
{ {
rt_list_t list; rt_list_t list;
struct uconfig_descriptor cfg_desc; struct uconfig_descriptor cfg_desc;
rt_list_t cls_list; rt_list_t func_list;
}; };
typedef struct uconfig* uconfig_t; typedef struct uconfig* uconfig_t;
@ -139,6 +196,8 @@ struct udevice
{ {
rt_list_t list; rt_list_t list;
struct udevice_descriptor dev_desc; struct udevice_descriptor dev_desc;
struct usb_qualifier_descriptor * dev_qualifier;
const char** str; const char** str;
udevice_state_t state; udevice_state_t state;
@ -154,8 +213,11 @@ enum udev_msg_type
{ {
USB_MSG_SETUP_NOTIFY, USB_MSG_SETUP_NOTIFY,
USB_MSG_DATA_NOTIFY, USB_MSG_DATA_NOTIFY,
USB_MSG_EP0_OUT,
USB_MSG_EP_CLEAR_FEATURE,
USB_MSG_SOF, USB_MSG_SOF,
USB_MSG_RESET, USB_MSG_RESET,
USB_MSG_PLUG_IN,
/* we don't need to add a "PLUG_IN" event because after the cable is /* we don't need to add a "PLUG_IN" event because after the cable is
* plugged in(before any SETUP) the classed have nothing to do. If the host * plugged in(before any SETUP) the classed have nothing to do. If the host
* is ready, it will send RESET and we will have USB_MSG_RESET. So, a RESET * is ready, it will send RESET and we will have USB_MSG_RESET. So, a RESET
@ -164,153 +226,184 @@ enum udev_msg_type
}; };
typedef enum udev_msg_type udev_msg_type; typedef enum udev_msg_type udev_msg_type;
struct ep_msg
{
rt_size_t size;
rt_uint8_t ep_addr;
};
struct udev_msg struct udev_msg
{ {
udev_msg_type type; udev_msg_type type;
udcd_t dcd; udcd_t dcd;
union union
{ {
struct struct ep_msg ep_msg;
{ struct urequest setup;
rt_size_t size;
rt_uint8_t ep_addr;
} ep_msg;
struct
{
rt_uint32_t* packet;
} setup_msg;
} content; } content;
}; };
typedef struct udev_msg* udev_msg_t; typedef struct udev_msg* udev_msg_t;
udevice_t rt_usbd_device_create(void); udevice_t rt_usbd_device_new(void);
uconfig_t rt_usbd_config_create(void); uconfig_t rt_usbd_config_new(void);
uclass_t rt_usbd_class_create(udevice_t device, ufunction_t rt_usbd_function_new(udevice_t device, udev_desc_t dev_desc,
udev_desc_t dev_desc, ufunction_ops_t ops);
uclass_ops_t ops); uintf_t rt_usbd_interface_new(udevice_t device, uintf_handler_t handler);
uintf_t rt_usbd_interface_create(udevice_t device, uintf_handler_t handler); uep_t rt_usbd_endpoint_new(uep_desc_t ep_desc, udep_handler_t handler);
uep_t rt_usbd_endpoint_create(uep_desc_t ep_desc, udep_handler_t handler); ualtsetting_t rt_usbd_altsetting_new(rt_size_t desc_size);
ualtsetting_t rt_usbd_altsetting_create(rt_size_t desc_size);
rt_err_t rt_usbd_core_init(void); rt_err_t rt_usbd_core_init(void);
rt_err_t rt_usb_device_init(const char *udc_name); rt_err_t rt_usb_device_init(void);
rt_err_t rt_usbd_post_event(struct udev_msg *msg, rt_size_t size); rt_err_t rt_usbd_event_signal(struct udev_msg* msg);
rt_err_t rt_usbd_free_device(udevice_t device);
rt_err_t rt_usbd_device_set_controller(udevice_t device, udcd_t dcd); rt_err_t rt_usbd_device_set_controller(udevice_t device, udcd_t dcd);
rt_err_t rt_usbd_device_set_descriptor(udevice_t device, udev_desc_t dev_desc); rt_err_t rt_usbd_device_set_descriptor(udevice_t device, udev_desc_t dev_desc);
rt_err_t rt_usbd_device_set_string(udevice_t device, const char** ustring); rt_err_t rt_usbd_device_set_string(udevice_t device, const char** ustring);
rt_err_t rt_usbd_device_set_qualifier(udevice_t device, struct usb_qualifier_descriptor* qualifier);
rt_err_t rt_usbd_device_add_config(udevice_t device, uconfig_t cfg); rt_err_t rt_usbd_device_add_config(udevice_t device, uconfig_t cfg);
rt_err_t rt_usbd_config_add_class(uconfig_t cfg, uclass_t cls); rt_err_t rt_usbd_config_add_function(uconfig_t cfg, ufunction_t func);
rt_err_t rt_usbd_class_add_interface(uclass_t cls, uintf_t intf); rt_err_t rt_usbd_function_add_interface(ufunction_t func, uintf_t intf);
rt_err_t rt_usbd_interface_add_altsetting(uintf_t intf, ualtsetting_t setting); rt_err_t rt_usbd_interface_add_altsetting(uintf_t intf, ualtsetting_t setting);
rt_err_t rt_usbd_altsetting_add_endpoint(ualtsetting_t setting, uep_t ep); rt_err_t rt_usbd_altsetting_add_endpoint(ualtsetting_t setting, uep_t ep);
rt_err_t rt_usbd_altsetting_config_descriptor(ualtsetting_t setting, rt_err_t rt_usbd_altsetting_config_descriptor(ualtsetting_t setting, const void* desc, rt_off_t intf_pos);
const void *desc,
rt_off_t intf_pos);
rt_err_t rt_usbd_set_config(udevice_t device, rt_uint8_t value); rt_err_t rt_usbd_set_config(udevice_t device, rt_uint8_t value);
rt_err_t rt_usbd_set_altsetting(uintf_t intf, rt_uint8_t value); rt_err_t rt_usbd_set_altsetting(uintf_t intf, rt_uint8_t value);
udevice_t rt_usbd_find_device(udcd_t dcd); udevice_t rt_usbd_find_device(udcd_t dcd);
uconfig_t rt_usbd_find_config(udevice_t device, rt_uint8_t value); uconfig_t rt_usbd_find_config(udevice_t device, rt_uint8_t value);
uintf_t rt_usbd_find_interface(udevice_t device, uintf_t rt_usbd_find_interface(udevice_t device, rt_uint8_t value, ufunction_t *pfunc);
rt_uint8_t value, uep_t rt_usbd_find_endpoint(udevice_t device, ufunction_t* pfunc, rt_uint8_t ep_addr);
uclass_t *pcls); rt_size_t rt_usbd_io_request(udevice_t device, uep_t ep, uio_request_t req);
uep_t rt_usbd_find_endpoint(udevice_t device, rt_size_t rt_usbd_ep0_write(udevice_t device, void *buffer, rt_size_t size);
uclass_t *pcls, rt_size_t rt_usbd_ep0_read(udevice_t device, void *buffer, rt_size_t size,
rt_uint8_t ep_addr); rt_err_t (*rx_ind)(udevice_t device, rt_size_t size));
uclass_t rt_usbd_class_mstorage_create(udevice_t device); ufunction_t rt_usbd_function_mstorage_create(udevice_t device);
uclass_t rt_usbd_class_cdc_create(udevice_t device); ufunction_t rt_usbd_function_cdc_create(udevice_t device);
uclass_t rt_usbd_class_rndis_create(udevice_t device); ufunction_t rt_usbd_function_rndis_create(udevice_t device);
uclass_t rt_usbd_class_dap_create(udevice_t device); ufunction_t rt_usbd_function_dap_create(udevice_t device);
#ifdef RT_USB_DEVICE_COMPOSITE #ifdef RT_USB_DEVICE_COMPOSITE
rt_err_t rt_usbd_class_set_iad(uclass_t cls, uiad_desc_t iad_desc); rt_err_t rt_usbd_function_set_iad(ufunction_t func, uiad_desc_t iad_desc);
#endif #endif
rt_inline rt_err_t dcd_set_address(udcd_t dcd, rt_uint8_t value) rt_err_t rt_usbd_set_feature(udevice_t device, rt_uint16_t value, rt_uint16_t index);
rt_err_t rt_usbd_clear_feature(udevice_t device, rt_uint16_t value, rt_uint16_t index);
rt_err_t rt_usbd_ep_set_stall(udevice_t device, uep_t ep);
rt_err_t rt_usbd_ep_clear_stall(udevice_t device, uep_t ep);
rt_err_t rt_usbd_ep0_set_stall(udevice_t device);
rt_err_t rt_usbd_ep0_clear_stall(udevice_t device);
rt_err_t rt_usbd_ep0_setup_handler(udcd_t dcd, struct urequest* setup);
rt_err_t rt_usbd_ep0_in_handler(udcd_t dcd);
rt_err_t rt_usbd_ep0_out_handler(udcd_t dcd, rt_size_t size);
rt_err_t rt_usbd_ep_in_handler(udcd_t dcd, rt_uint8_t address);
rt_err_t rt_usbd_ep_out_handler(udcd_t dcd, rt_uint8_t address, rt_size_t size);
rt_err_t rt_usbd_reset_handler(udcd_t dcd);
rt_err_t rt_usbd_connect_handler(udcd_t dcd);
rt_err_t rt_usbd_disconnect_handler(udcd_t dcd);
rt_err_t rt_usbd_sof_handler(udcd_t dcd);
rt_inline rt_err_t dcd_set_address(udcd_t dcd, rt_uint8_t address)
{ {
RT_ASSERT(dcd != RT_NULL); RT_ASSERT(dcd != RT_NULL);
RT_ASSERT(dcd->ops != RT_NULL);
RT_ASSERT(dcd->ops->set_address != RT_NULL);
return dcd->ops->set_address(value); return dcd->ops->set_address(address);
} }
rt_inline rt_err_t dcd_clear_feature(udcd_t dcd, rt_inline rt_err_t dcd_set_config(udcd_t dcd, rt_uint8_t address)
rt_uint16_t value,
rt_uint16_t index)
{ {
RT_ASSERT(dcd != RT_NULL); RT_ASSERT(dcd != RT_NULL);
RT_ASSERT(dcd->ops != RT_NULL);
RT_ASSERT(dcd->ops->set_config != RT_NULL);
return dcd->ops->clear_feature(value, index); return dcd->ops->set_config(address);
} }
rt_inline rt_err_t dcd_set_feature(udcd_t dcd, rt_inline rt_err_t dcd_ep_enable(udcd_t dcd, uep_t ep)
rt_uint8_t value,
rt_uint16_t index)
{ {
RT_ASSERT(dcd != RT_NULL); RT_ASSERT(dcd != RT_NULL);
RT_ASSERT(dcd->ops != RT_NULL);
RT_ASSERT(dcd->ops->ep_enable != RT_NULL);
return dcd->ops->set_feature(value, index); return dcd->ops->ep_enable(ep);
} }
rt_inline rt_err_t dcd_ep_stall(udcd_t dcd, uep_t ep) rt_inline rt_err_t dcd_ep_disable(udcd_t dcd, uep_t ep)
{ {
RT_ASSERT(dcd != RT_NULL); RT_ASSERT(dcd != RT_NULL);
RT_ASSERT(dcd->ops != RT_NULL);
RT_ASSERT(dcd->ops->ep_disable != RT_NULL);
return dcd->ops->ep_stall(ep); return dcd->ops->ep_disable(ep);
} }
rt_inline rt_uint8_t dcd_ep_alloc(udcd_t dcd, uep_t ep) rt_inline rt_size_t dcd_ep_read_prepare(udcd_t dcd, rt_uint8_t address, void *buffer,
{
RT_ASSERT(dcd != RT_NULL);
return dcd->ops->ep_alloc(ep);
}
rt_inline rt_err_t dcd_ep_free(udcd_t dcd, uep_t ep)
{
RT_ASSERT(dcd != RT_NULL);
return dcd->ops->ep_free(ep);
}
rt_inline rt_err_t dcd_ep_run(udcd_t dcd, uep_t ep)
{
RT_ASSERT(dcd != RT_NULL);
return dcd->ops->ep_run(ep);
}
rt_inline rt_err_t dcd_ep_stop(udcd_t dcd, uep_t ep)
{
RT_ASSERT(dcd != RT_NULL);
return dcd->ops->ep_stop(ep);
}
rt_inline rt_err_t dcd_ep_read(udcd_t dcd, uep_t ep, void *buffer,
rt_size_t size) rt_size_t size)
{ {
RT_ASSERT(dcd != RT_NULL); RT_ASSERT(dcd != RT_NULL);
RT_ASSERT(dcd->ops != RT_NULL);
return dcd->ops->ep_read(ep, buffer, size); if(dcd->ops->ep_read_prepare != RT_NULL)
{
return dcd->ops->ep_read_prepare(address, buffer, size);
}
else
{
return 0;
}
} }
rt_inline rt_size_t dcd_ep_write(udcd_t dcd, rt_inline rt_size_t dcd_ep_read(udcd_t dcd, rt_uint8_t address, void *buffer)
uep_t ep, {
void *buffer, RT_ASSERT(dcd != RT_NULL);
RT_ASSERT(dcd->ops != RT_NULL);
if(dcd->ops->ep_read != RT_NULL)
{
return dcd->ops->ep_read(address, buffer);
}
else
{
return 0;
}
}
rt_inline rt_size_t dcd_ep_write(udcd_t dcd, rt_uint8_t address, void *buffer,
rt_size_t size) rt_size_t size)
{ {
RT_ASSERT(dcd != RT_NULL); RT_ASSERT(dcd != RT_NULL);
RT_ASSERT(dcd->ops != RT_NULL);
RT_ASSERT(dcd->ops->ep_write != RT_NULL);
return dcd->ops->ep_write(ep, buffer, size); return dcd->ops->ep_write(address, buffer, size);
} }
rt_inline rt_err_t dcd_send_status(udcd_t dcd) rt_inline rt_err_t dcd_ep0_send_status(udcd_t dcd)
{ {
RT_ASSERT(dcd != RT_NULL); RT_ASSERT(dcd != RT_NULL);
RT_ASSERT(dcd->ops != RT_NULL);
RT_ASSERT(dcd->ops->ep0_send_status != RT_NULL);
return dcd->ops->send_status(); return dcd->ops->ep0_send_status();
}
rt_inline rt_err_t dcd_ep_set_stall(udcd_t dcd, rt_uint8_t address)
{
RT_ASSERT(dcd != RT_NULL);
RT_ASSERT(dcd->ops != RT_NULL);
RT_ASSERT(dcd->ops->ep_set_stall != RT_NULL);
return dcd->ops->ep_set_stall(address);
}
rt_inline rt_err_t dcd_ep_clear_stall(udcd_t dcd, rt_uint8_t address)
{
RT_ASSERT(dcd != RT_NULL);
RT_ASSERT(dcd->ops != RT_NULL);
RT_ASSERT(dcd->ops->ep_clear_stall != RT_NULL);
return dcd->ops->ep_clear_stall(address);
} }
#endif #endif

View File

@ -37,17 +37,17 @@ extern "C" {
#define USB_HUB_PORT_NUM 0x04 #define USB_HUB_PORT_NUM 0x04
#define SIZEOF_USB_REQUEST 0x08 #define SIZEOF_USB_REQUEST 0x08
#define UINST_STATUS_IDLE 0x00 #define DEV_STATUS_IDLE 0x00
#define UINST_STATUS_BUSY 0x01 #define DEV_STATUS_BUSY 0x01
#define UINST_STATUS_ERROR 0x02 #define DEV_STATUS_ERROR 0x02
#define UPIPE_STATUS_OK 0x00 #define UPIPE_STATUS_OK 0x00
#define UPIPE_STATUS_STALL 0x01 #define UPIPE_STATUS_STALL 0x01
#define UPIPE_STATUS_ERROR 0x02 #define UPIPE_STATUS_ERROR 0x02
struct uhcd; struct uhcd;
struct uifinst; struct uintf;
struct uhubinst; struct uhub;
struct uclass_driver struct uclass_driver
{ {
@ -55,8 +55,8 @@ struct uclass_driver
int class_code; int class_code;
int subclass_code; int subclass_code;
rt_err_t (*run)(void* arg); rt_err_t (*enable)(void* arg);
rt_err_t (*stop)(void* arg); rt_err_t (*disable)(void* arg);
void* user_data; void* user_data;
}; };
@ -86,32 +86,31 @@ struct uinstance
rt_uint8_t max_packet_size; rt_uint8_t max_packet_size;
rt_uint8_t port; rt_uint8_t port;
struct uhubinst* parent; struct uhub* parent;
struct uifinst* ifinst[USB_MAX_INTERFACE]; struct uintf* intf[USB_MAX_INTERFACE];
}; };
typedef struct uinstance* uinst_t; typedef struct uinstance* uinst_t;
struct uifinst struct uintf
{ {
uinst_t uinst; struct uinstance* device;
uintf_desc_t intf_desc; uintf_desc_t intf_desc;
ucd_t drv; ucd_t drv;
void *user_data; void *user_data;
}; };
typedef struct uifinst* uifinst_t;
struct upipe struct upipe
{ {
rt_uint32_t status; rt_uint32_t status;
struct uendpoint_descriptor ep; struct uendpoint_descriptor ep;
uifinst_t ifinst; struct uintf* intf;
func_callback callback; func_callback callback;
void* user_data; void* user_data;
}; };
typedef struct upipe* upipe_t; typedef struct upipe* upipe_t;
struct uhubinst struct uhub
{ {
struct uhub_descriptor hub_desc; struct uhub_descriptor hub_desc;
rt_uint8_t num_ports; rt_uint8_t num_ports;
@ -124,17 +123,17 @@ struct uhubinst
struct uinstance* self; struct uinstance* self;
struct uhcd *hcd; struct uhcd *hcd;
}; };
typedef struct uhubinst* uhubinst_t; typedef struct uhub* uhub_t;
struct uhcd_ops struct uhcd_ops
{ {
int (*ctl_xfer)(uinst_t inst, ureq_t setup, void* buffer, int nbytes, int (*ctl_xfer)(struct uinstance* inst, ureq_t setup, void* buffer, int nbytes,
int timeout); int timeout);
int (*bulk_xfer)(upipe_t pipe, void* buffer, int nbytes, int timeout); int (*bulk_xfer)(upipe_t pipe, void* buffer, int nbytes, int timeout);
int (*int_xfer)(upipe_t pipe, void* buffer, int nbytes, int timeout); int (*int_xfer)(upipe_t pipe, void* buffer, int nbytes, int timeout);
int (*iso_xfer)(upipe_t pipe, void* buffer, int nbytes, int timeout); int (*iso_xfer)(upipe_t pipe, void* buffer, int nbytes, int timeout);
rt_err_t (*alloc_pipe)(struct upipe** pipe, uifinst_t ifinst, uep_desc_t ep, rt_err_t (*alloc_pipe)(struct upipe** pipe, struct uintf* intf, uep_desc_t ep,
func_callback callback); func_callback callback);
rt_err_t (*free_pipe)(upipe_t pipe); rt_err_t (*free_pipe)(upipe_t pipe);
rt_err_t (*hub_ctrl)(rt_uint16_t port, rt_uint8_t cmd, void *args); rt_err_t (*hub_ctrl)(rt_uint16_t port, rt_uint8_t cmd, void *args);
@ -144,6 +143,7 @@ struct uhcd
{ {
struct rt_device parent; struct rt_device parent;
struct uhcd_ops* ops; struct uhcd_ops* ops;
struct uhub* roothub;
}; };
typedef struct uhcd* uhcd_t; typedef struct uhcd* uhcd_t;
@ -159,7 +159,7 @@ struct uhost_msg
uhost_msg_type type; uhost_msg_type type;
union union
{ {
struct uhubinst* uhub; struct uhub* hub;
struct struct
{ {
func_callback function; func_callback function;
@ -170,82 +170,67 @@ struct uhost_msg
typedef struct uhost_msg* uhost_msg_t; typedef struct uhost_msg* uhost_msg_t;
/* usb host system interface */ /* usb host system interface */
void rt_usb_host_init(void); rt_err_t rt_usb_host_init(void);
void rt_usb_hub_thread(void); void rt_usbh_hub_init(void);
/* usb host core interface */ /* usb host core interface */
uinst_t rt_usb_alloc_instance(void); struct uinstance* rt_usbh_alloc_instance(void);
rt_err_t rt_usb_attatch_instance(uinst_t uinst); rt_err_t rt_usbh_attatch_instance(struct uinstance* device);
rt_err_t rt_usb_detach_instance(uinst_t uinst); rt_err_t rt_usbh_detach_instance(struct uinstance* device);
rt_err_t rt_usb_get_descriptor(uinst_t uinst, rt_err_t rt_usbh_get_descriptor(struct uinstance* device, rt_uint8_t type, void* buffer,
rt_uint8_t type, int nbytes);
void *buffer, rt_err_t rt_usbh_set_configure(struct uinstance* device, int config);
int nbytes); rt_err_t rt_usbh_set_address(struct uinstance* device);
rt_err_t rt_usb_set_configure(uinst_t uinst, int config); rt_err_t rt_usbh_set_interface(struct uinstance* device, int intf);
rt_err_t rt_usb_set_address(uinst_t uinst); rt_err_t rt_usbh_clear_feature(struct uinstance* device, int endpoint, int feature);
rt_err_t rt_usb_set_interface(uinst_t uinst, int intf); rt_err_t rt_usbh_get_interface_descriptor(ucfg_desc_t cfg_desc, int num,
rt_err_t rt_usb_clear_feature(uinst_t uinst, int endpoint, int feature); uintf_desc_t* intf_desc);
rt_err_t rt_usb_get_interface_descriptor(ucfg_desc_t cfg_desc, rt_err_t rt_usbh_get_endpoint_descriptor(uintf_desc_t intf_desc, int num,
int num, uep_desc_t* ep_desc);
uintf_desc_t *intf_desc);
rt_err_t rt_usb_get_endpoint_descriptor(uintf_desc_t intf_desc,
int num,
uep_desc_t *ep_desc);
/* usb class driver interface */ /* usb class driver interface */
rt_err_t rt_usb_class_driver_init(void); rt_err_t rt_usbh_class_driver_init(void);
rt_err_t rt_usb_class_driver_register(ucd_t drv); rt_err_t rt_usbh_class_driver_register(ucd_t drv);
rt_err_t rt_usb_class_driver_unregister(ucd_t drv); rt_err_t rt_usbh_class_driver_unregister(ucd_t drv);
rt_err_t rt_usb_class_driver_run(ucd_t drv, void *args); rt_err_t rt_usbh_class_driver_enable(ucd_t drv, void* args);
rt_err_t rt_usb_class_driver_stop(ucd_t drv, void *args); rt_err_t rt_usbh_class_driver_disable(ucd_t drv, void* args);
ucd_t rt_usb_class_driver_find(int class_code, int subclass_code); ucd_t rt_usbh_class_driver_find(int class_code, int subclass_code);
/* usb class driver implement */ /* usb class driver implement */
ucd_t rt_usb_class_driver_hid(void); ucd_t rt_usbh_class_driver_hid(void);
ucd_t rt_usb_class_driver_hub(void); ucd_t rt_usbh_class_driver_hub(void);
ucd_t rt_usb_class_driver_storage(void); ucd_t rt_usbh_class_driver_storage(void);
ucd_t rt_usb_class_driver_adk(void); ucd_t rt_usbh_class_driver_adk(void);
/* usb hid protocal implement */ /* usb hid protocal implement */
uprotocal_t rt_usb_hid_protocal_kbd(void); uprotocal_t rt_usbh_hid_protocal_kbd(void);
uprotocal_t rt_usb_hid_protocal_mouse(void); uprotocal_t rt_usbh_hid_protocal_mouse(void);
/* usb adk class driver interface */ /* usb adk class driver interface */
rt_err_t rt_usb_adk_set_string(const char *manufacturer, rt_err_t rt_usbh_adk_set_string(const char* manufacturer, const char* model,
const char *model, const char* description, const char* version, const char* uri,
const char *description, const char* serial);
const char *version,
const char *uri,
const char *serial);
/* usb hub interface */ /* usb hub interface */
rt_err_t rt_usb_hub_get_descriptor(uinst_t uinst, rt_err_t rt_usbh_hub_get_descriptor(struct uinstance* device, rt_uint8_t *buffer,
rt_uint8_t *buffer, rt_size_t size);
rt_size_t size); rt_err_t rt_usbh_hub_get_status(struct uinstance* device, rt_uint8_t* buffer);
rt_err_t rt_usb_hub_get_status(uinst_t uinst, rt_uint8_t *buffer); rt_err_t rt_usbh_hub_get_port_status(uhub_t uhub, rt_uint16_t port,
rt_err_t rt_usb_hub_get_port_status(uhubinst_t uhub, rt_uint8_t* buffer);
rt_uint16_t port, rt_err_t rt_usbh_hub_clear_port_feature(uhub_t uhub, rt_uint16_t port,
rt_uint8_t *buffer); rt_uint16_t feature);
rt_err_t rt_usb_hub_clear_port_feature(uhubinst_t uhub, rt_err_t rt_usbh_hub_set_port_feature(uhub_t uhub, rt_uint16_t port,
rt_uint16_t port, rt_uint16_t feature);
rt_uint16_t feature); rt_err_t rt_usbh_hub_reset_port(uhub_t uhub, rt_uint16_t port);
rt_err_t rt_usb_hub_set_port_feature(uhubinst_t uhub, rt_err_t rt_usbh_event_signal(struct uhost_msg* msg);
rt_uint16_t port,
rt_uint16_t feature);
rt_err_t rt_usb_hub_reset_port(uhubinst_t uhub, rt_uint16_t port);
rt_err_t rt_usb_post_event(struct uhost_msg* msg, rt_size_t size);
/* usb host controller driver interface */ /* usb host controller driver interface */
rt_inline rt_err_t rt_usb_hcd_alloc_pipe(uhcd_t hcd, rt_inline rt_err_t rt_usb_hcd_alloc_pipe(uhcd_t hcd, upipe_t* pipe,
upipe_t *pipe, struct uintf* intf, uep_desc_t ep, func_callback callback)
uifinst_t ifinst,
uep_desc_t ep,
func_callback callback)
{ {
if (ifinst == RT_NULL) if(intf == RT_NULL) return -RT_EIO;
return -RT_EIO;
return hcd->ops->alloc_pipe(pipe, ifinst, ep, callback); return hcd->ops->alloc_pipe(pipe, intf, ep, callback);
} }
rt_inline rt_err_t rt_usb_hcd_free_pipe(uhcd_t hcd, upipe_t pipe) rt_inline rt_err_t rt_usb_hcd_free_pipe(uhcd_t hcd, upipe_t pipe)
@ -255,59 +240,40 @@ rt_inline rt_err_t rt_usb_hcd_free_pipe(uhcd_t hcd, upipe_t pipe)
return hcd->ops->free_pipe(pipe); return hcd->ops->free_pipe(pipe);
} }
rt_inline int rt_usb_hcd_bulk_xfer(uhcd_t hcd, rt_inline int rt_usb_hcd_bulk_xfer(uhcd_t hcd, upipe_t pipe, void* buffer,
upipe_t pipe, int nbytes, int timeout)
void *buffer,
int nbytes,
int timeout)
{ {
if (pipe == RT_NULL) if(pipe == RT_NULL) return -1;
return -1; if(pipe->intf == RT_NULL) return -1;
if (pipe->ifinst == RT_NULL) if(pipe->intf->device == RT_NULL) return -1;
return -1; if(pipe->intf->device->status == DEV_STATUS_IDLE)
if (pipe->ifinst->uinst == RT_NULL)
return -1;
if (pipe->ifinst->uinst->status == UINST_STATUS_IDLE)
return -1; return -1;
return hcd->ops->bulk_xfer(pipe, buffer, nbytes, timeout); return hcd->ops->bulk_xfer(pipe, buffer, nbytes, timeout);
} }
rt_inline int rt_usb_hcd_control_xfer(uhcd_t hcd, rt_inline int rt_usb_hcd_control_xfer(uhcd_t hcd, struct uinstance* device, ureq_t setup,
uinst_t uinst, void* buffer, int nbytes, int timeout)
ureq_t setup,
void *buffer,
int nbytes,
int timeout)
{ {
if (uinst->status == UINST_STATUS_IDLE) if(device->status == DEV_STATUS_IDLE) return -1;
return -1;
return hcd->ops->ctl_xfer(uinst, setup, buffer, nbytes, timeout); return hcd->ops->ctl_xfer(device, setup, buffer, nbytes, timeout);
} }
rt_inline int rt_usb_hcd_int_xfer(uhcd_t hcd, rt_inline int rt_usb_hcd_int_xfer(uhcd_t hcd, upipe_t pipe, void* buffer,
upipe_t pipe, int nbytes, int timeout)
void *buffer,
int nbytes,
int timeout)
{ {
if (pipe == RT_NULL) if(pipe == RT_NULL) return -1;
return -1; if(pipe->intf == RT_NULL) return -1;
if (pipe->ifinst == RT_NULL) if(pipe->intf->device == RT_NULL) return -1;
return -1; if(pipe->intf->device->status == DEV_STATUS_IDLE)
if (pipe->ifinst->uinst == RT_NULL)
return -1;
if (pipe->ifinst->uinst->status == UINST_STATUS_IDLE)
return -1; return -1;
return hcd->ops->int_xfer(pipe, buffer, nbytes, timeout); return hcd->ops->int_xfer(pipe, buffer, nbytes, timeout);
} }
rt_inline rt_err_t rt_usb_hcd_hub_control(uhcd_t hcd, rt_inline rt_err_t rt_usb_hcd_hub_control(uhcd_t hcd, rt_uint16_t port,
rt_uint16_t port, rt_uint8_t cmd, void *args)
rt_uint8_t cmd,
void *args)
{ {
return hcd->ops->hub_ctrl(port, cmd, args); return hcd->ops->hub_ctrl(port, cmd, args);
} }

View File

@ -0,0 +1,56 @@
/*
* File : watchdog.h
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2012-2014, Shanghai Real-Thread Electronic Technology Co.,Ltd
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Change Logs:
* Date Author Notes
* 2012-09-12 heyuanjie87 first version.
*/
#ifndef __WATCHDOG_H__
#define __WATCHDOG_H__
#include <rtthread.h>
#define RT_DEVICE_CTRL_WDT_GET_TIMEOUT (1) /* get timeout(in seconds) */
#define RT_DEVICE_CTRL_WDT_SET_TIMEOUT (2) /* set timeout(in seconds) */
#define RT_DEVICE_CTRL_WDT_GET_TIMELEFT (3) /* get the left time before reboot(in seconds) */
#define RT_DEVICE_CTRL_WDT_KEEPALIVE (4) /* refresh watchdog */
#define RT_DEVICE_CTRL_WDT_START (5) /* start watchdog */
#define RT_DEVICE_CTRL_WDT_STOP (6) /* stop watchdog */
struct rt_watchdog_ops;
struct rt_watchdog_device
{
struct rt_device parent;
struct rt_watchdog_ops *ops;
};
typedef struct rt_watchdog_device rt_watchdog_t;
struct rt_watchdog_ops
{
rt_err_t (*init)(rt_watchdog_t *wdt);
rt_err_t (*control)(rt_watchdog_t *wdt, int cmd, void *arg);
};
rt_err_t rt_hw_watchdog_register(rt_watchdog_t *wdt,
const char *name,
rt_uint32_t flag,
void *data);
#endif /* __WATCHDOG_H__ */

View File

@ -358,4 +358,9 @@ rt_inline void rt_work_init(struct rt_work* work, void (*work_func)(struct rt_wo
#include "drivers/watchdog.h" #include "drivers/watchdog.h"
#endif #endif
#ifdef RT_USING_PIN
#include "drivers/pin.h"
#endif
#endif /* __RT_DEVICE_H__ */ #endif /* __RT_DEVICE_H__ */

View File

@ -0,0 +1,14 @@
from building import *
cwd = GetCurrentDir()
src = []
CPPPATH = [cwd + '/../include']
group = []
if GetDepend(['RT_USING_PIN']):
src = src + ['pin.c']
if len(src):
group = DefineGroup('DeviceDrivers', src, depend = [''], CPPPATH = CPPPATH)
Return('group')

View File

@ -0,0 +1,118 @@
/*
* File : pin.c
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2015, RT-Thread Development Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Change Logs:
* Date Author Notes
* 2015-01-20 Bernard the first version
*/
#include <drivers/pin.h>
#ifdef RT_USING_FINSH
#include <finsh.h>
#endif
static struct rt_device_pin _hw_pin;
static rt_size_t _pin_read(rt_device_t dev, rt_off_t pos, void *buffer, rt_size_t size)
{
struct rt_device_pin_status *status;
struct rt_device_pin *pin = (struct rt_device_pin *)dev;
/* check parameters */
RT_ASSERT(pin != RT_NULL);
status = (struct rt_device_pin_status *) buffer;
if (status == RT_NULL || size != sizeof(*status)) return 0;
status->status = pin->ops->pin_read(dev, status->pin);
return size;
}
static rt_size_t _pin_write(rt_device_t dev, rt_off_t pos, const void *buffer, rt_size_t size)
{
struct rt_device_pin_status *status;
struct rt_device_pin *pin = (struct rt_device_pin *)dev;
/* check parameters */
RT_ASSERT(pin != RT_NULL);
status = (struct rt_device_pin_status *) buffer;
if (status == RT_NULL || size != sizeof(*status)) return 0;
pin->ops->pin_write(dev, (rt_base_t)status->pin, (rt_base_t)status->status);
return size;
}
static rt_err_t _pin_control(rt_device_t dev, rt_uint8_t cmd, void *args)
{
struct rt_device_pin_mode *mode;
struct rt_device_pin *pin = (struct rt_device_pin *)dev;
/* check parameters */
RT_ASSERT(pin != RT_NULL);
mode = (struct rt_device_pin_mode *) args;
if (mode == RT_NULL) return -RT_ERROR;
pin->ops->pin_mode(dev, (rt_base_t)mode->pin, (rt_base_t)mode->mode);
return 0;
}
int rt_device_pin_register(const char *name, const struct rt_pin_ops *ops, void *user_data)
{
_hw_pin.parent.type = RT_Device_Class_Miscellaneous;
_hw_pin.parent.rx_indicate = RT_NULL;
_hw_pin.parent.tx_complete = RT_NULL;
_hw_pin.parent.init = RT_NULL;
_hw_pin.parent.open = RT_NULL;
_hw_pin.parent.close = RT_NULL;
_hw_pin.parent.read = _pin_read;
_hw_pin.parent.write = _pin_write;
_hw_pin.parent.control = _pin_control;
_hw_pin.ops = ops;
_hw_pin.parent.user_data = user_data;
/* register a character device */
rt_device_register(&_hw_pin.parent, "pin", RT_DEVICE_FLAG_RDWR);
return 0;
}
/* RT-Thread Hardware PIN APIs */
void rt_pin_mode(rt_base_t pin, rt_base_t mode)
{
_hw_pin.ops->pin_mode(&_hw_pin.parent, pin, mode);
}
FINSH_FUNCTION_EXPORT_ALIAS(rt_pin_mode, pinMode, set hardware pin mode);
void rt_pin_write(rt_base_t pin, rt_base_t value)
{
_hw_pin.ops->pin_write(&_hw_pin.parent, pin, value);
}
FINSH_FUNCTION_EXPORT_ALIAS(rt_pin_write, pinWrite, write value to hardware pin);
int rt_pin_read(rt_base_t pin)
{
return _hw_pin.ops->pin_read(&_hw_pin.parent, pin);
}
FINSH_FUNCTION_EXPORT_ALIAS(rt_pin_read, pinRead, read status from hardware pin);

View File

@ -472,10 +472,10 @@
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<Focus>0</Focus> <Focus>0</Focus>
<ColumnNumber>70</ColumnNumber> <ColumnNumber>71</ColumnNumber>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
<TopLine>1</TopLine> <TopLine>19</TopLine>
<CurrentLine>1</CurrentLine> <CurrentLine>50</CurrentLine>
<bDave2>0</bDave2> <bDave2>0</bDave2>
<PathWithFileName>..\APP\src\app_task.c</PathWithFileName> <PathWithFileName>..\APP\src\app_task.c</PathWithFileName>
<FilenameWithoutPath>app_task.c</FilenameWithoutPath> <FilenameWithoutPath>app_task.c</FilenameWithoutPath>
@ -587,7 +587,7 @@
</File> </File>
<File> <File>
<GroupNumber>2</GroupNumber> <GroupNumber>2</GroupNumber>
<FileNumber>0</FileNumber> <FileNumber>10</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<Focus>0</Focus> <Focus>0</Focus>
@ -599,6 +599,20 @@
<PathWithFileName>..\BSP\src\usart.c</PathWithFileName> <PathWithFileName>..\BSP\src\usart.c</PathWithFileName>
<FilenameWithoutPath>usart.c</FilenameWithoutPath> <FilenameWithoutPath>usart.c</FilenameWithoutPath>
</File> </File>
<File>
<GroupNumber>2</GroupNumber>
<FileNumber>11</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<Focus>0</Focus>
<ColumnNumber>0</ColumnNumber>
<tvExpOptDlg>0</tvExpOptDlg>
<TopLine>0</TopLine>
<CurrentLine>0</CurrentLine>
<bDave2>0</bDave2>
<PathWithFileName>..\BSP\src\gpio.c</PathWithFileName>
<FilenameWithoutPath>gpio.c</FilenameWithoutPath>
</File>
</Group> </Group>
<Group> <Group>
@ -608,7 +622,7 @@
<cbSel>0</cbSel> <cbSel>0</cbSel>
<File> <File>
<GroupNumber>3</GroupNumber> <GroupNumber>3</GroupNumber>
<FileNumber>10</FileNumber> <FileNumber>12</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<Focus>0</Focus> <Focus>0</Focus>
@ -622,7 +636,7 @@
</File> </File>
<File> <File>
<GroupNumber>3</GroupNumber> <GroupNumber>3</GroupNumber>
<FileNumber>11</FileNumber> <FileNumber>13</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<Focus>0</Focus> <Focus>0</Focus>
@ -636,7 +650,7 @@
</File> </File>
<File> <File>
<GroupNumber>3</GroupNumber> <GroupNumber>3</GroupNumber>
<FileNumber>12</FileNumber> <FileNumber>14</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<Focus>0</Focus> <Focus>0</Focus>
@ -650,7 +664,7 @@
</File> </File>
<File> <File>
<GroupNumber>3</GroupNumber> <GroupNumber>3</GroupNumber>
<FileNumber>13</FileNumber> <FileNumber>15</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<Focus>0</Focus> <Focus>0</Focus>
@ -664,7 +678,7 @@
</File> </File>
<File> <File>
<GroupNumber>3</GroupNumber> <GroupNumber>3</GroupNumber>
<FileNumber>14</FileNumber> <FileNumber>16</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<Focus>0</Focus> <Focus>0</Focus>
@ -678,7 +692,7 @@
</File> </File>
<File> <File>
<GroupNumber>3</GroupNumber> <GroupNumber>3</GroupNumber>
<FileNumber>15</FileNumber> <FileNumber>17</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<Focus>0</Focus> <Focus>0</Focus>
@ -692,7 +706,7 @@
</File> </File>
<File> <File>
<GroupNumber>3</GroupNumber> <GroupNumber>3</GroupNumber>
<FileNumber>16</FileNumber> <FileNumber>18</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<Focus>0</Focus> <Focus>0</Focus>
@ -706,7 +720,7 @@
</File> </File>
<File> <File>
<GroupNumber>3</GroupNumber> <GroupNumber>3</GroupNumber>
<FileNumber>17</FileNumber> <FileNumber>19</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<Focus>0</Focus> <Focus>0</Focus>
@ -720,7 +734,7 @@
</File> </File>
<File> <File>
<GroupNumber>3</GroupNumber> <GroupNumber>3</GroupNumber>
<FileNumber>18</FileNumber> <FileNumber>20</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<Focus>0</Focus> <Focus>0</Focus>
@ -734,7 +748,7 @@
</File> </File>
<File> <File>
<GroupNumber>3</GroupNumber> <GroupNumber>3</GroupNumber>
<FileNumber>19</FileNumber> <FileNumber>21</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<Focus>0</Focus> <Focus>0</Focus>
@ -748,7 +762,7 @@
</File> </File>
<File> <File>
<GroupNumber>3</GroupNumber> <GroupNumber>3</GroupNumber>
<FileNumber>20</FileNumber> <FileNumber>22</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<Focus>0</Focus> <Focus>0</Focus>
@ -762,7 +776,7 @@
</File> </File>
<File> <File>
<GroupNumber>3</GroupNumber> <GroupNumber>3</GroupNumber>
<FileNumber>21</FileNumber> <FileNumber>23</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<Focus>0</Focus> <Focus>0</Focus>
@ -776,7 +790,7 @@
</File> </File>
<File> <File>
<GroupNumber>3</GroupNumber> <GroupNumber>3</GroupNumber>
<FileNumber>22</FileNumber> <FileNumber>24</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<Focus>0</Focus> <Focus>0</Focus>
@ -790,7 +804,7 @@
</File> </File>
<File> <File>
<GroupNumber>3</GroupNumber> <GroupNumber>3</GroupNumber>
<FileNumber>23</FileNumber> <FileNumber>25</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<Focus>0</Focus> <Focus>0</Focus>
@ -804,7 +818,7 @@
</File> </File>
<File> <File>
<GroupNumber>3</GroupNumber> <GroupNumber>3</GroupNumber>
<FileNumber>24</FileNumber> <FileNumber>26</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<Focus>0</Focus> <Focus>0</Focus>
@ -818,7 +832,7 @@
</File> </File>
<File> <File>
<GroupNumber>3</GroupNumber> <GroupNumber>3</GroupNumber>
<FileNumber>25</FileNumber> <FileNumber>27</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<Focus>0</Focus> <Focus>0</Focus>
@ -832,7 +846,7 @@
</File> </File>
<File> <File>
<GroupNumber>3</GroupNumber> <GroupNumber>3</GroupNumber>
<FileNumber>26</FileNumber> <FileNumber>28</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<Focus>0</Focus> <Focus>0</Focus>
@ -846,7 +860,7 @@
</File> </File>
<File> <File>
<GroupNumber>3</GroupNumber> <GroupNumber>3</GroupNumber>
<FileNumber>27</FileNumber> <FileNumber>29</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<Focus>0</Focus> <Focus>0</Focus>
@ -860,7 +874,7 @@
</File> </File>
<File> <File>
<GroupNumber>3</GroupNumber> <GroupNumber>3</GroupNumber>
<FileNumber>28</FileNumber> <FileNumber>30</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<Focus>0</Focus> <Focus>0</Focus>
@ -874,7 +888,7 @@
</File> </File>
<File> <File>
<GroupNumber>3</GroupNumber> <GroupNumber>3</GroupNumber>
<FileNumber>29</FileNumber> <FileNumber>31</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<Focus>0</Focus> <Focus>0</Focus>
@ -888,7 +902,7 @@
</File> </File>
<File> <File>
<GroupNumber>3</GroupNumber> <GroupNumber>3</GroupNumber>
<FileNumber>30</FileNumber> <FileNumber>32</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<Focus>0</Focus> <Focus>0</Focus>
@ -902,7 +916,7 @@
</File> </File>
<File> <File>
<GroupNumber>3</GroupNumber> <GroupNumber>3</GroupNumber>
<FileNumber>31</FileNumber> <FileNumber>33</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<Focus>0</Focus> <Focus>0</Focus>
@ -916,7 +930,7 @@
</File> </File>
<File> <File>
<GroupNumber>3</GroupNumber> <GroupNumber>3</GroupNumber>
<FileNumber>32</FileNumber> <FileNumber>34</FileNumber>
<FileType>2</FileType> <FileType>2</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<Focus>0</Focus> <Focus>0</Focus>
@ -937,7 +951,7 @@
<cbSel>0</cbSel> <cbSel>0</cbSel>
<File> <File>
<GroupNumber>4</GroupNumber> <GroupNumber>4</GroupNumber>
<FileNumber>33</FileNumber> <FileNumber>35</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<Focus>0</Focus> <Focus>0</Focus>
@ -951,7 +965,7 @@
</File> </File>
<File> <File>
<GroupNumber>4</GroupNumber> <GroupNumber>4</GroupNumber>
<FileNumber>34</FileNumber> <FileNumber>36</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<Focus>0</Focus> <Focus>0</Focus>
@ -972,7 +986,7 @@
<cbSel>0</cbSel> <cbSel>0</cbSel>
<File> <File>
<GroupNumber>5</GroupNumber> <GroupNumber>5</GroupNumber>
<FileNumber>35</FileNumber> <FileNumber>37</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<Focus>0</Focus> <Focus>0</Focus>
@ -986,7 +1000,7 @@
</File> </File>
<File> <File>
<GroupNumber>5</GroupNumber> <GroupNumber>5</GroupNumber>
<FileNumber>36</FileNumber> <FileNumber>38</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<Focus>0</Focus> <Focus>0</Focus>
@ -1000,7 +1014,7 @@
</File> </File>
<File> <File>
<GroupNumber>5</GroupNumber> <GroupNumber>5</GroupNumber>
<FileNumber>37</FileNumber> <FileNumber>39</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<Focus>0</Focus> <Focus>0</Focus>
@ -1014,7 +1028,7 @@
</File> </File>
<File> <File>
<GroupNumber>5</GroupNumber> <GroupNumber>5</GroupNumber>
<FileNumber>38</FileNumber> <FileNumber>40</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<Focus>0</Focus> <Focus>0</Focus>
@ -1028,7 +1042,7 @@
</File> </File>
<File> <File>
<GroupNumber>5</GroupNumber> <GroupNumber>5</GroupNumber>
<FileNumber>39</FileNumber> <FileNumber>41</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<Focus>0</Focus> <Focus>0</Focus>
@ -1042,7 +1056,7 @@
</File> </File>
<File> <File>
<GroupNumber>5</GroupNumber> <GroupNumber>5</GroupNumber>
<FileNumber>40</FileNumber> <FileNumber>42</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<Focus>0</Focus> <Focus>0</Focus>
@ -1056,7 +1070,7 @@
</File> </File>
<File> <File>
<GroupNumber>5</GroupNumber> <GroupNumber>5</GroupNumber>
<FileNumber>41</FileNumber> <FileNumber>43</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<Focus>0</Focus> <Focus>0</Focus>
@ -1070,7 +1084,7 @@
</File> </File>
<File> <File>
<GroupNumber>5</GroupNumber> <GroupNumber>5</GroupNumber>
<FileNumber>42</FileNumber> <FileNumber>44</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<Focus>0</Focus> <Focus>0</Focus>
@ -1084,7 +1098,7 @@
</File> </File>
<File> <File>
<GroupNumber>5</GroupNumber> <GroupNumber>5</GroupNumber>
<FileNumber>43</FileNumber> <FileNumber>45</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<Focus>0</Focus> <Focus>0</Focus>
@ -1098,7 +1112,7 @@
</File> </File>
<File> <File>
<GroupNumber>5</GroupNumber> <GroupNumber>5</GroupNumber>
<FileNumber>44</FileNumber> <FileNumber>46</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<Focus>0</Focus> <Focus>0</Focus>
@ -1112,7 +1126,7 @@
</File> </File>
<File> <File>
<GroupNumber>5</GroupNumber> <GroupNumber>5</GroupNumber>
<FileNumber>45</FileNumber> <FileNumber>47</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<Focus>0</Focus> <Focus>0</Focus>
@ -1126,7 +1140,7 @@
</File> </File>
<File> <File>
<GroupNumber>5</GroupNumber> <GroupNumber>5</GroupNumber>
<FileNumber>46</FileNumber> <FileNumber>48</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<Focus>0</Focus> <Focus>0</Focus>
@ -1140,7 +1154,7 @@
</File> </File>
<File> <File>
<GroupNumber>5</GroupNumber> <GroupNumber>5</GroupNumber>
<FileNumber>47</FileNumber> <FileNumber>49</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<Focus>0</Focus> <Focus>0</Focus>
@ -1154,7 +1168,7 @@
</File> </File>
<File> <File>
<GroupNumber>5</GroupNumber> <GroupNumber>5</GroupNumber>
<FileNumber>48</FileNumber> <FileNumber>50</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<Focus>0</Focus> <Focus>0</Focus>
@ -1168,7 +1182,7 @@
</File> </File>
<File> <File>
<GroupNumber>5</GroupNumber> <GroupNumber>5</GroupNumber>
<FileNumber>49</FileNumber> <FileNumber>51</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<Focus>0</Focus> <Focus>0</Focus>
@ -1182,7 +1196,7 @@
</File> </File>
<File> <File>
<GroupNumber>5</GroupNumber> <GroupNumber>5</GroupNumber>
<FileNumber>50</FileNumber> <FileNumber>52</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<Focus>0</Focus> <Focus>0</Focus>
@ -1203,7 +1217,7 @@
<cbSel>0</cbSel> <cbSel>0</cbSel>
<File> <File>
<GroupNumber>6</GroupNumber> <GroupNumber>6</GroupNumber>
<FileNumber>51</FileNumber> <FileNumber>53</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<Focus>0</Focus> <Focus>0</Focus>
@ -1217,7 +1231,7 @@
</File> </File>
<File> <File>
<GroupNumber>6</GroupNumber> <GroupNumber>6</GroupNumber>
<FileNumber>52</FileNumber> <FileNumber>54</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<Focus>0</Focus> <Focus>0</Focus>
@ -1231,7 +1245,7 @@
</File> </File>
<File> <File>
<GroupNumber>6</GroupNumber> <GroupNumber>6</GroupNumber>
<FileNumber>53</FileNumber> <FileNumber>55</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<Focus>0</Focus> <Focus>0</Focus>
@ -1245,7 +1259,7 @@
</File> </File>
<File> <File>
<GroupNumber>6</GroupNumber> <GroupNumber>6</GroupNumber>
<FileNumber>54</FileNumber> <FileNumber>56</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<Focus>0</Focus> <Focus>0</Focus>
@ -1259,7 +1273,7 @@
</File> </File>
<File> <File>
<GroupNumber>6</GroupNumber> <GroupNumber>6</GroupNumber>
<FileNumber>55</FileNumber> <FileNumber>57</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<Focus>0</Focus> <Focus>0</Focus>
@ -1273,7 +1287,7 @@
</File> </File>
<File> <File>
<GroupNumber>6</GroupNumber> <GroupNumber>6</GroupNumber>
<FileNumber>56</FileNumber> <FileNumber>58</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<Focus>0</Focus> <Focus>0</Focus>
@ -1287,7 +1301,7 @@
</File> </File>
<File> <File>
<GroupNumber>6</GroupNumber> <GroupNumber>6</GroupNumber>
<FileNumber>0</FileNumber> <FileNumber>59</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<Focus>0</Focus> <Focus>0</Focus>
@ -1299,6 +1313,20 @@
<PathWithFileName>..\RT-Thread-1.2.2\components\drivers\serial\serial.c</PathWithFileName> <PathWithFileName>..\RT-Thread-1.2.2\components\drivers\serial\serial.c</PathWithFileName>
<FilenameWithoutPath>serial.c</FilenameWithoutPath> <FilenameWithoutPath>serial.c</FilenameWithoutPath>
</File> </File>
<File>
<GroupNumber>6</GroupNumber>
<FileNumber>60</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<Focus>0</Focus>
<ColumnNumber>0</ColumnNumber>
<tvExpOptDlg>0</tvExpOptDlg>
<TopLine>0</TopLine>
<CurrentLine>0</CurrentLine>
<bDave2>0</bDave2>
<PathWithFileName>..\RT-Thread-1.2.2\components\drivers\misc\pin.c</PathWithFileName>
<FilenameWithoutPath>pin.c</FilenameWithoutPath>
</File>
</Group> </Group>
<Group> <Group>
@ -1308,7 +1336,7 @@
<cbSel>0</cbSel> <cbSel>0</cbSel>
<File> <File>
<GroupNumber>7</GroupNumber> <GroupNumber>7</GroupNumber>
<FileNumber>57</FileNumber> <FileNumber>61</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<Focus>0</Focus> <Focus>0</Focus>
@ -1322,7 +1350,7 @@
</File> </File>
<File> <File>
<GroupNumber>7</GroupNumber> <GroupNumber>7</GroupNumber>
<FileNumber>58</FileNumber> <FileNumber>62</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<Focus>0</Focus> <Focus>0</Focus>
@ -1336,7 +1364,7 @@
</File> </File>
<File> <File>
<GroupNumber>7</GroupNumber> <GroupNumber>7</GroupNumber>
<FileNumber>59</FileNumber> <FileNumber>63</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<Focus>0</Focus> <Focus>0</Focus>
@ -1350,7 +1378,7 @@
</File> </File>
<File> <File>
<GroupNumber>7</GroupNumber> <GroupNumber>7</GroupNumber>
<FileNumber>60</FileNumber> <FileNumber>64</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<Focus>0</Focus> <Focus>0</Focus>
@ -1364,7 +1392,7 @@
</File> </File>
<File> <File>
<GroupNumber>7</GroupNumber> <GroupNumber>7</GroupNumber>
<FileNumber>61</FileNumber> <FileNumber>65</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<Focus>0</Focus> <Focus>0</Focus>
@ -1378,7 +1406,7 @@
</File> </File>
<File> <File>
<GroupNumber>7</GroupNumber> <GroupNumber>7</GroupNumber>
<FileNumber>62</FileNumber> <FileNumber>66</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<Focus>0</Focus> <Focus>0</Focus>
@ -1392,7 +1420,7 @@
</File> </File>
<File> <File>
<GroupNumber>7</GroupNumber> <GroupNumber>7</GroupNumber>
<FileNumber>63</FileNumber> <FileNumber>67</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<Focus>0</Focus> <Focus>0</Focus>
@ -1406,7 +1434,7 @@
</File> </File>
<File> <File>
<GroupNumber>7</GroupNumber> <GroupNumber>7</GroupNumber>
<FileNumber>64</FileNumber> <FileNumber>68</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<Focus>0</Focus> <Focus>0</Focus>
@ -1420,7 +1448,7 @@
</File> </File>
<File> <File>
<GroupNumber>7</GroupNumber> <GroupNumber>7</GroupNumber>
<FileNumber>65</FileNumber> <FileNumber>69</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<Focus>0</Focus> <Focus>0</Focus>
@ -1434,7 +1462,7 @@
</File> </File>
<File> <File>
<GroupNumber>7</GroupNumber> <GroupNumber>7</GroupNumber>
<FileNumber>66</FileNumber> <FileNumber>70</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<Focus>0</Focus> <Focus>0</Focus>
@ -1448,7 +1476,7 @@
</File> </File>
<File> <File>
<GroupNumber>7</GroupNumber> <GroupNumber>7</GroupNumber>
<FileNumber>67</FileNumber> <FileNumber>71</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<Focus>0</Focus> <Focus>0</Focus>
@ -1457,12 +1485,12 @@
<TopLine>0</TopLine> <TopLine>0</TopLine>
<CurrentLine>0</CurrentLine> <CurrentLine>0</CurrentLine>
<bDave2>0</bDave2> <bDave2>0</bDave2>
<PathWithFileName>..\FreeModbus\port\port.c</PathWithFileName> <PathWithFileName>..\FreeModbus\port\rtt\port.c</PathWithFileName>
<FilenameWithoutPath>port.c</FilenameWithoutPath> <FilenameWithoutPath>port.c</FilenameWithoutPath>
</File> </File>
<File> <File>
<GroupNumber>7</GroupNumber> <GroupNumber>7</GroupNumber>
<FileNumber>0</FileNumber> <FileNumber>72</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<Focus>0</Focus> <Focus>0</Focus>
@ -1476,21 +1504,21 @@
</File> </File>
<File> <File>
<GroupNumber>7</GroupNumber> <GroupNumber>7</GroupNumber>
<FileNumber>0</FileNumber> <FileNumber>73</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<Focus>0</Focus> <Focus>0</Focus>
<ColumnNumber>12</ColumnNumber> <ColumnNumber>0</ColumnNumber>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
<TopLine>55</TopLine> <TopLine>0</TopLine>
<CurrentLine>61</CurrentLine> <CurrentLine>0</CurrentLine>
<bDave2>0</bDave2> <bDave2>0</bDave2>
<PathWithFileName>..\FreeModbus\port\rtt\portserial.c</PathWithFileName> <PathWithFileName>..\FreeModbus\port\rtt\portserial.c</PathWithFileName>
<FilenameWithoutPath>portserial.c</FilenameWithoutPath> <FilenameWithoutPath>portserial.c</FilenameWithoutPath>
</File> </File>
<File> <File>
<GroupNumber>7</GroupNumber> <GroupNumber>7</GroupNumber>
<FileNumber>0</FileNumber> <FileNumber>74</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<Focus>0</Focus> <Focus>0</Focus>
@ -1504,7 +1532,7 @@
</File> </File>
<File> <File>
<GroupNumber>7</GroupNumber> <GroupNumber>7</GroupNumber>
<FileNumber>71</FileNumber> <FileNumber>75</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<Focus>0</Focus> <Focus>0</Focus>
@ -1525,7 +1553,7 @@
<cbSel>0</cbSel> <cbSel>0</cbSel>
<File> <File>
<GroupNumber>8</GroupNumber> <GroupNumber>8</GroupNumber>
<FileNumber>72</FileNumber> <FileNumber>76</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<Focus>0</Focus> <Focus>0</Focus>
@ -1539,7 +1567,7 @@
</File> </File>
<File> <File>
<GroupNumber>8</GroupNumber> <GroupNumber>8</GroupNumber>
<FileNumber>73</FileNumber> <FileNumber>77</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<Focus>0</Focus> <Focus>0</Focus>
@ -1553,7 +1581,7 @@
</File> </File>
<File> <File>
<GroupNumber>8</GroupNumber> <GroupNumber>8</GroupNumber>
<FileNumber>74</FileNumber> <FileNumber>78</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<Focus>0</Focus> <Focus>0</Focus>
@ -1567,7 +1595,7 @@
</File> </File>
<File> <File>
<GroupNumber>8</GroupNumber> <GroupNumber>8</GroupNumber>
<FileNumber>75</FileNumber> <FileNumber>79</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<Focus>0</Focus> <Focus>0</Focus>
@ -1581,7 +1609,7 @@
</File> </File>
<File> <File>
<GroupNumber>8</GroupNumber> <GroupNumber>8</GroupNumber>
<FileNumber>76</FileNumber> <FileNumber>80</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<Focus>0</Focus> <Focus>0</Focus>
@ -1595,7 +1623,7 @@
</File> </File>
<File> <File>
<GroupNumber>8</GroupNumber> <GroupNumber>8</GroupNumber>
<FileNumber>77</FileNumber> <FileNumber>81</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<Focus>0</Focus> <Focus>0</Focus>
@ -1609,7 +1637,7 @@
</File> </File>
<File> <File>
<GroupNumber>8</GroupNumber> <GroupNumber>8</GroupNumber>
<FileNumber>0</FileNumber> <FileNumber>82</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<Focus>0</Focus> <Focus>0</Focus>
@ -1623,7 +1651,7 @@
</File> </File>
<File> <File>
<GroupNumber>8</GroupNumber> <GroupNumber>8</GroupNumber>
<FileNumber>0</FileNumber> <FileNumber>83</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<Focus>0</Focus> <Focus>0</Focus>
@ -1637,7 +1665,7 @@
</File> </File>
<File> <File>
<GroupNumber>8</GroupNumber> <GroupNumber>8</GroupNumber>
<FileNumber>0</FileNumber> <FileNumber>84</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<Focus>0</Focus> <Focus>0</Focus>
@ -1651,7 +1679,7 @@
</File> </File>
<File> <File>
<GroupNumber>8</GroupNumber> <GroupNumber>8</GroupNumber>
<FileNumber>81</FileNumber> <FileNumber>85</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<Focus>0</Focus> <Focus>0</Focus>
@ -1689,8 +1717,8 @@
<MDIClientArea> <MDIClientArea>
<RegID>0</RegID> <RegID>0</RegID>
<MDITabState> <MDITabState>
<Len>274</Len> <Len>60</Len>
<Data>01000000040000000100000001000000010000000100000001000000FFFFFFFF000000000100000001000000000000002800000028000000010000000100000000000000010000004A443A5C50726F6772616D5C5265706F7369746F72795C467265654D6F646275735F536C6176652D4D61737465722D5254542D53544D33325C4150505C7372635C6170705F7461736B2E63000000000A6170705F7461736B2E6300000000FFDC7800FFFFFFFF0100000010000000C5D4F200FFDC7800BECEA100F0A0A100BCA8E1009CC1B600F7B88600D9ADC200A5C2D700B3A6BE00EAD6A300F6FA7D00B5E99D005FC3CF00C1838300CACAD500010000000100000002000000E6000000660000009006000016030000</Data> <Data>01000000040000000100000001000000010000000100000001000000FFFFFFFF00000000010000000100000000000000280000002800000000000000</Data>
</MDITabState> </MDITabState>
</MDIClientArea> </MDIClientArea>
<ViewEx> <ViewEx>
@ -3585,7 +3613,7 @@
<Name>File</Name> <Name>File</Name>
<Buttons> <Buttons>
<Len>2002</Len> <Len>2002</Len>
<Data>00200000010000002800FFFF01001100434D4643546F6F6C426172427574746F6E00E100000000000000000000000000000000000000000000000100000001000000018001E100000000000001000000000000000000000000000000000100000001000000018003E1000000000000020000000000000000000000000000000001000000010000000180CD7F0000000000000300000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF000000000000000000000000000100000001000000018023E100000000040004000000000000000000000000000000000100000001000000018022E100000000000005000000000000000000000000000000000100000001000000018025E10000000000000600000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF00000000000000000000000000010000000100000001802BE10000000004000700000000000000000000000000000000010000000100000001802CE10000000004000800000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF00000000000000000000000000010000000100000001807A8A0000000000000900000000000000000000000000000000010000000100000001807B8A0000000004000A00000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF0000000000000000000000000001000000010000000180D3B00000000000000B000000000000000000000000000000000100000001000000018015B10000000004000C0000000000000000000000000000000001000000010000000180F4B00000000004000D000000000000000000000000000000000100000001000000018036B10000000004000E00000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF0000000000000000000000000001000000010000000180FF88000000000400460000000000000000000000000000000001000000010000000180FE880000000004004500000000000000000000000000000000010000000100000001800B810000000004001300000000000000000000000000000000010000000100000001800C810000000004001400000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF0000000000000000000000000001000000010000000180F0880000020000000F000000000000000000000000000000000100000001000000FFFF0100120043555646696E64436F6D626F427574746F6EE803000000000000000000000000000000000000000000000001000000010000009600000002002050FFFFFFFF0096000000000000000000018024E10000000000001100000000000000000000000000000000010000000100000001800A810000000000001200000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF000000000000000000000000000100000001000000018022800000020000001500000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF0000000000000000000000000001000000010000000180C488000000000400160000000000000000000000000000000001000000010000000180C988000000000400180000000000000000000000000000000001000000010000000180C788000000000000190000000000000000000000000000000001000000010000000180C8880000000000001700000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF000000000000000000000000000100000001000000FFFF01001500434D4643546F6F6C4261724D656E75427574746F6E4C010000020001001A0000000F50726F6A6563742057696E646F7773000000000000000000000000010000000100000000000000000000000100000008002880DD880000000000001A0000000750726F6A656374000000000000000000000000010000000100000000000000000000000100000000002880DC8B0000000000003A00000005426F6F6B73000000000000000000000000010000000100000000000000000000000100000000002880E18B0000000000003B0000000946756E6374696F6E73000000000000000000000000010000000100000000000000000000000100000000002880E28B000000000000400000000954656D706C6174657300000000000000000000000001000000010000000000000000000000010000000000288018890000000000003D0000000E536F757263652042726F777365720000000000000000000000000100000001000000000000000000000001000000000028800000000000000400FFFFFFFF00000000000000000001000000000000000100000000000000000000000100000000002880D988000000000000390000000C4275696C64204F7574707574000000000000000000000000010000000100000000000000000000000100000000002880E38B000000000000410000000B46696E64204F75747075740000000000000000000000000100000001000000000000000000000001000000000001800000000001000000FFFFFFFF0000000000000000000000000001000000010000000180FB7F0000000000001B000000000000000000000000000000000100000001000000000000000446696C65AC030000</Data> <Data>00200000010000002800FFFF01001100434D4643546F6F6C426172427574746F6E00E100000000000000000000000000000000000000000000000100000001000000018001E100000000000001000000000000000000000000000000000100000001000000018003E1000000000400020000000000000000000000000000000001000000010000000180CD7F0000000000000300000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF000000000000000000000000000100000001000000018023E100000000040004000000000000000000000000000000000100000001000000018022E100000000040005000000000000000000000000000000000100000001000000018025E10000000004000600000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF00000000000000000000000000010000000100000001802BE10000000004000700000000000000000000000000000000010000000100000001802CE10000000004000800000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF00000000000000000000000000010000000100000001807A8A0000000004000900000000000000000000000000000000010000000100000001807B8A0000000004000A00000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF0000000000000000000000000001000000010000000180D3B00000000004000B000000000000000000000000000000000100000001000000018015B10000000004000C0000000000000000000000000000000001000000010000000180F4B00000000004000D000000000000000000000000000000000100000001000000018036B10000000004000E00000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF0000000000000000000000000001000000010000000180FF88000000000400460000000000000000000000000000000001000000010000000180FE880000000004004500000000000000000000000000000000010000000100000001800B810000000004001300000000000000000000000000000000010000000100000001800C810000000004001400000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF0000000000000000000000000001000000010000000180F0880000020000000F000000000000000000000000000000000100000001000000FFFF0100120043555646696E64436F6D626F427574746F6EE803000000000400000000000000000000000000000000000001000000010000009600000002002050FFFFFFFF0096000000000000000000018024E10000000004001100000000000000000000000000000000010000000100000001800A810000000004001200000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF000000000000000000000000000100000001000000018022800000020000001500000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF0000000000000000000000000001000000010000000180C488000000000400160000000000000000000000000000000001000000010000000180C988000000000400180000000000000000000000000000000001000000010000000180C788000000000000190000000000000000000000000000000001000000010000000180C8880000000000001700000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF000000000000000000000000000100000001000000FFFF01001500434D4643546F6F6C4261724D656E75427574746F6E4C010000020001001A0000000F50726F6A6563742057696E646F7773000000000000000000000000010000000100000000000000000000000100000008002880DD880000000000001A0000000750726F6A656374000000000000000000000000010000000100000000000000000000000100000000002880DC8B0000000000003A00000005426F6F6B73000000000000000000000000010000000100000000000000000000000100000000002880E18B0000000000003B0000000946756E6374696F6E73000000000000000000000000010000000100000000000000000000000100000000002880E28B000000000000400000000954656D706C6174657300000000000000000000000001000000010000000000000000000000010000000000288018890000000000003D0000000E536F757263652042726F777365720000000000000000000000000100000001000000000000000000000001000000000028800000000000000400FFFFFFFF00000000000000000001000000000000000100000000000000000000000100000000002880D988000000000000390000000C4275696C64204F7574707574000000000000000000000000010000000100000000000000000000000100000000002880E38B000000000000410000000B46696E64204F75747075740000000000000000000000000100000001000000000000000000000001000000000001800000000001000000FFFFFFFF0000000000000000000000000001000000010000000180FB7F0000000000001B000000000000000000000000000000000100000001000000000000000446696C65AC030000</Data>
</Buttons> </Buttons>
<OriginalItems> <OriginalItems>
<Len>1423</Len> <Len>1423</Len>
@ -3601,7 +3629,7 @@
<Name>Build</Name> <Name>Build</Name>
<Buttons> <Buttons>
<Len>619</Len> <Len>619</Len>
<Data>00200000010000000D00FFFF01001100434D4643546F6F6C426172427574746F6ECF7F0000000000001C0000000000000000000000000000000001000000010000000180D07F0000000000001D000000000000000000000000000000000100000001000000018030800000000000001E00000000000000000000000000000000010000000100000001809E8A0000000004001F0000000000000000000000000000000001000000010000000180D17F0000000004002000000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF00000000000000000000000000010000000100000001804C8A0000000000002100000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF000000000000000000000000000100000001000000FFFF01001900434D4643546F6F6C426172436F6D626F426F78427574746F6EBA00000000000000000000000000000000000000000000000001000000010000009600000003002050010000001353544D333246313033434254365F464C415348960000000000000002001353544D3332463130335A4554365F464C4153481353544D333246313033434254365F464C41534800000000000000000180EB880000000000002200000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF0000000000000000000000000001000000010000000180C07F000000000000230000000000000000000000000000000001000000010000000180B08A0000000004002400000000000000000000000000000000010000000100000000000000054275696C6487010000</Data> <Data>00200000010000000D00FFFF01001100434D4643546F6F6C426172427574746F6ECF7F0000000004001C0000000000000000000000000000000001000000010000000180D07F0000000000001D000000000000000000000000000000000100000001000000018030800000000000001E00000000000000000000000000000000010000000100000001809E8A0000000004001F0000000000000000000000000000000001000000010000000180D17F0000000004002000000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF00000000000000000000000000010000000100000001804C8A0000000000002100000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF000000000000000000000000000100000001000000FFFF01001900434D4643546F6F6C426172436F6D626F426F78427574746F6EBA00000000000000000000000000000000000000000000000001000000010000009600000003002050010000001353544D333246313033434254365F464C415348960000000000000002001353544D3332463130335A4554365F464C4153481353544D333246313033434254365F464C41534800000000000000000180EB880000000000002200000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF0000000000000000000000000001000000010000000180C07F000000000000230000000000000000000000000000000001000000010000000180B08A0000000004002400000000000000000000000000000000010000000100000000000000054275696C6487010000</Data>
</Buttons> </Buttons>
<OriginalItems> <OriginalItems>
<Len>478</Len> <Len>478</Len>
@ -5197,21 +5225,4 @@
</ViewEx> </ViewEx>
</WinLayoutEx> </WinLayoutEx>
<MDIGroups>
<Orientation>1</Orientation>
<ActiveMDIGroup>0</ActiveMDIGroup>
<MDIGroup>
<Size>100</Size>
<ActiveTab>0</ActiveTab>
<Documents>
<Doc>
<Name>..\APP\src\app_task.c</Name>
<ColumnNumber>70</ColumnNumber>
<TopLine>1</TopLine>
<CurrentLine>1</CurrentLine>
</Doc>
</Documents>
</MDIGroup>
</MDIGroups>
</ProjectOpt> </ProjectOpt>

View File

@ -440,6 +440,11 @@
<FileType>1</FileType> <FileType>1</FileType>
<FilePath>..\BSP\src\usart.c</FilePath> <FilePath>..\BSP\src\usart.c</FilePath>
</File> </File>
<File>
<FileName>gpio.c</FileName>
<FileType>1</FileType>
<FilePath>..\BSP\src\gpio.c</FilePath>
</File>
</Files> </Files>
</Group> </Group>
<Group> <Group>
@ -700,6 +705,11 @@
<FileType>1</FileType> <FileType>1</FileType>
<FilePath>..\RT-Thread-1.2.2\components\drivers\serial\serial.c</FilePath> <FilePath>..\RT-Thread-1.2.2\components\drivers\serial\serial.c</FilePath>
</File> </File>
<File>
<FileName>pin.c</FileName>
<FileType>1</FileType>
<FilePath>..\RT-Thread-1.2.2\components\drivers\misc\pin.c</FilePath>
</File>
</Files> </Files>
</Group> </Group>
<Group> <Group>
@ -758,7 +768,7 @@
<File> <File>
<FileName>port.c</FileName> <FileName>port.c</FileName>
<FileType>1</FileType> <FileType>1</FileType>
<FilePath>..\FreeModbus\port\port.c</FilePath> <FilePath>..\FreeModbus\port\rtt\port.c</FilePath>
</File> </File>
<File> <File>
<FileName>portevent.c</FileName> <FileName>portevent.c</FileName>
@ -1273,6 +1283,11 @@
<FileType>1</FileType> <FileType>1</FileType>
<FilePath>..\BSP\src\usart.c</FilePath> <FilePath>..\BSP\src\usart.c</FilePath>
</File> </File>
<File>
<FileName>gpio.c</FileName>
<FileType>1</FileType>
<FilePath>..\BSP\src\gpio.c</FilePath>
</File>
</Files> </Files>
</Group> </Group>
<Group> <Group>
@ -1533,6 +1548,11 @@
<FileType>1</FileType> <FileType>1</FileType>
<FilePath>..\RT-Thread-1.2.2\components\drivers\serial\serial.c</FilePath> <FilePath>..\RT-Thread-1.2.2\components\drivers\serial\serial.c</FilePath>
</File> </File>
<File>
<FileName>pin.c</FileName>
<FileType>1</FileType>
<FilePath>..\RT-Thread-1.2.2\components\drivers\misc\pin.c</FilePath>
</File>
</Files> </Files>
</Group> </Group>
<Group> <Group>
@ -1591,7 +1611,7 @@
<File> <File>
<FileName>port.c</FileName> <FileName>port.c</FileName>
<FileType>1</FileType> <FileType>1</FileType>
<FilePath>..\FreeModbus\port\port.c</FilePath> <FilePath>..\FreeModbus\port\rtt\port.c</FilePath>
</File> </File>
<File> <File>
<FileName>portevent.c</FileName> <FileName>portevent.c</FileName>

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -435,6 +435,11 @@
<FileType>1</FileType> <FileType>1</FileType>
<FilePath>..\RT-Thread-1.2.2\libcpu\arm\cortex-m3\cpuport.c</FilePath> <FilePath>..\RT-Thread-1.2.2\libcpu\arm\cortex-m3\cpuport.c</FilePath>
</File> </File>
<File>
<FileName>usart.c</FileName>
<FileType>1</FileType>
<FilePath>..\BSP\src\usart.c</FilePath>
</File>
</Files> </Files>
</Group> </Group>
<Group> <Group>
@ -690,6 +695,11 @@
<FileType>1</FileType> <FileType>1</FileType>
<FilePath>..\RT-Thread-1.2.2\components\drivers\src\wrokqueue.c</FilePath> <FilePath>..\RT-Thread-1.2.2\components\drivers\src\wrokqueue.c</FilePath>
</File> </File>
<File>
<FileName>serial.c</FileName>
<FileType>1</FileType>
<FilePath>..\RT-Thread-1.2.2\components\drivers\serial\serial.c</FilePath>
</File>
</Files> </Files>
</Group> </Group>
<Group> <Group>
@ -753,17 +763,17 @@
<File> <File>
<FileName>portevent.c</FileName> <FileName>portevent.c</FileName>
<FileType>1</FileType> <FileType>1</FileType>
<FilePath>..\FreeModbus\port\portevent.c</FilePath> <FilePath>..\FreeModbus\port\rtt\portevent.c</FilePath>
</File> </File>
<File> <File>
<FileName>portserial.c</FileName> <FileName>portserial.c</FileName>
<FileType>1</FileType> <FileType>1</FileType>
<FilePath>..\FreeModbus\port\portserial.c</FilePath> <FilePath>..\FreeModbus\port\rtt\portserial.c</FilePath>
</File> </File>
<File> <File>
<FileName>porttimer.c</FileName> <FileName>porttimer.c</FileName>
<FileType>1</FileType> <FileType>1</FileType>
<FilePath>..\FreeModbus\port\porttimer.c</FilePath> <FilePath>..\FreeModbus\port\rtt\porttimer.c</FilePath>
</File> </File>
<File> <File>
<FileName>user_mb_app.c</FileName> <FileName>user_mb_app.c</FileName>
@ -808,17 +818,17 @@
<File> <File>
<FileName>portevent_m.c</FileName> <FileName>portevent_m.c</FileName>
<FileType>1</FileType> <FileType>1</FileType>
<FilePath>..\FreeModbus\port\portevent_m.c</FilePath> <FilePath>..\FreeModbus\port\rtt\portevent_m.c</FilePath>
</File> </File>
<File> <File>
<FileName>portserial_m.c</FileName> <FileName>portserial_m.c</FileName>
<FileType>1</FileType> <FileType>1</FileType>
<FilePath>..\FreeModbus\port\portserial_m.c</FilePath> <FilePath>..\FreeModbus\port\rtt\portserial_m.c</FilePath>
</File> </File>
<File> <File>
<FileName>porttimer_m.c</FileName> <FileName>porttimer_m.c</FileName>
<FileType>1</FileType> <FileType>1</FileType>
<FilePath>..\FreeModbus\port\porttimer_m.c</FilePath> <FilePath>..\FreeModbus\port\rtt\porttimer_m.c</FilePath>
</File> </File>
<File> <File>
<FileName>user_mb_app_m.c</FileName> <FileName>user_mb_app_m.c</FileName>
@ -1258,6 +1268,11 @@
<FileType>1</FileType> <FileType>1</FileType>
<FilePath>..\RT-Thread-1.2.2\libcpu\arm\cortex-m3\cpuport.c</FilePath> <FilePath>..\RT-Thread-1.2.2\libcpu\arm\cortex-m3\cpuport.c</FilePath>
</File> </File>
<File>
<FileName>usart.c</FileName>
<FileType>1</FileType>
<FilePath>..\BSP\src\usart.c</FilePath>
</File>
</Files> </Files>
</Group> </Group>
<Group> <Group>
@ -1513,6 +1528,11 @@
<FileType>1</FileType> <FileType>1</FileType>
<FilePath>..\RT-Thread-1.2.2\components\drivers\src\wrokqueue.c</FilePath> <FilePath>..\RT-Thread-1.2.2\components\drivers\src\wrokqueue.c</FilePath>
</File> </File>
<File>
<FileName>serial.c</FileName>
<FileType>1</FileType>
<FilePath>..\RT-Thread-1.2.2\components\drivers\serial\serial.c</FilePath>
</File>
</Files> </Files>
</Group> </Group>
<Group> <Group>
@ -1576,17 +1596,17 @@
<File> <File>
<FileName>portevent.c</FileName> <FileName>portevent.c</FileName>
<FileType>1</FileType> <FileType>1</FileType>
<FilePath>..\FreeModbus\port\portevent.c</FilePath> <FilePath>..\FreeModbus\port\rtt\portevent.c</FilePath>
</File> </File>
<File> <File>
<FileName>portserial.c</FileName> <FileName>portserial.c</FileName>
<FileType>1</FileType> <FileType>1</FileType>
<FilePath>..\FreeModbus\port\portserial.c</FilePath> <FilePath>..\FreeModbus\port\rtt\portserial.c</FilePath>
</File> </File>
<File> <File>
<FileName>porttimer.c</FileName> <FileName>porttimer.c</FileName>
<FileType>1</FileType> <FileType>1</FileType>
<FilePath>..\FreeModbus\port\porttimer.c</FilePath> <FilePath>..\FreeModbus\port\rtt\porttimer.c</FilePath>
</File> </File>
<File> <File>
<FileName>user_mb_app.c</FileName> <FileName>user_mb_app.c</FileName>
@ -1631,17 +1651,17 @@
<File> <File>
<FileName>portevent_m.c</FileName> <FileName>portevent_m.c</FileName>
<FileType>1</FileType> <FileType>1</FileType>
<FilePath>..\FreeModbus\port\portevent_m.c</FilePath> <FilePath>..\FreeModbus\port\rtt\portevent_m.c</FilePath>
</File> </File>
<File> <File>
<FileName>portserial_m.c</FileName> <FileName>portserial_m.c</FileName>
<FileType>1</FileType> <FileType>1</FileType>
<FilePath>..\FreeModbus\port\portserial_m.c</FilePath> <FilePath>..\FreeModbus\port\rtt\portserial_m.c</FilePath>
</File> </File>
<File> <File>
<FileName>porttimer_m.c</FileName> <FileName>porttimer_m.c</FileName>
<FileType>1</FileType> <FileType>1</FileType>
<FilePath>..\FreeModbus\port\porttimer_m.c</FilePath> <FilePath>..\FreeModbus\port\rtt\porttimer_m.c</FilePath>
</File> </File>
<File> <File>
<FileName>user_mb_app_m.c</FileName> <FileName>user_mb_app_m.c</FileName>

File diff suppressed because it is too large Load Diff