mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2025-11-16 12:34:33 +00:00
Compare commits
35 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8e439999e8 | ||
|
|
7e871b0ddd | ||
|
|
a00cc57487 | ||
|
|
c7ee7f9858 | ||
|
|
4d2972a85f | ||
|
|
8b8d69f66e | ||
|
|
84dcd2c313 | ||
|
|
80b66ae25e | ||
|
|
7354a9fb78 | ||
|
|
d57e880444 | ||
|
|
f6c8e39167 | ||
|
|
ea598b9ac8 | ||
|
|
8336654059 | ||
|
|
277325c39e | ||
|
|
fe2047ba11 | ||
|
|
a2e074e02b | ||
|
|
5ccf1d4452 | ||
|
|
4e96775e89 | ||
|
|
7c2c3ddc34 | ||
|
|
350b1080ea | ||
|
|
50e7ae7e87 | ||
|
|
61712bbd13 | ||
|
|
3ea936e80c | ||
|
|
b2f35dcf3f | ||
|
|
412d548f9c | ||
|
|
54326fcb82 | ||
|
|
db900ce5c0 | ||
|
|
95f4228da1 | ||
|
|
f07bb06437 | ||
|
|
625c8f2126 | ||
|
|
6d20d222b8 | ||
|
|
2c55f26f00 | ||
|
|
5f26d0e1f8 | ||
|
|
ed2d2b0d70 | ||
|
|
17ef8ff63e |
@@ -35,27 +35,7 @@
|
||||
|
||||
void rt_init_thread_entry(void* parameter)
|
||||
{
|
||||
/* LwIP Initialization */
|
||||
#ifdef RT_USING_LWIP
|
||||
{
|
||||
extern void lwip_sys_init(void);
|
||||
|
||||
/* register ethernetif device */
|
||||
eth_system_device_init();
|
||||
|
||||
rt_hw_stm32_eth_init();
|
||||
/* re-init device driver */
|
||||
rt_device_init_all();
|
||||
|
||||
/* init lwip system */
|
||||
lwip_sys_init();
|
||||
rt_kprintf("TCP/IP initialized!\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
//FS
|
||||
|
||||
//GUI
|
||||
/* nothing */
|
||||
}
|
||||
|
||||
float f_var1;
|
||||
@@ -70,7 +50,7 @@ static void rt_thread_entry_led1(void* parameter)
|
||||
{
|
||||
int n = 0;
|
||||
rt_hw_led_init();
|
||||
|
||||
|
||||
while (1)
|
||||
{
|
||||
//rt_kprintf("LED\t%d\tis shining\r\n",n);
|
||||
@@ -92,16 +72,9 @@ int rt_application_init()
|
||||
{
|
||||
rt_thread_t init_thread;
|
||||
|
||||
#if (RT_THREAD_PRIORITY_MAX == 32)
|
||||
init_thread = rt_thread_create("init",
|
||||
rt_init_thread_entry, RT_NULL,
|
||||
2048, 8, 20);
|
||||
#else
|
||||
init_thread = rt_thread_create("init",
|
||||
rt_init_thread_entry, RT_NULL,
|
||||
2048, 80, 20);
|
||||
#endif
|
||||
|
||||
2048, RT_THREAD_PRIORITY_MAX/3, 20);
|
||||
if (init_thread != RT_NULL)
|
||||
rt_thread_startup(init_thread);
|
||||
|
||||
|
||||
@@ -85,9 +85,6 @@ void rtthread_startup(void)
|
||||
/* init scheduler system */
|
||||
rt_system_scheduler_init();
|
||||
|
||||
/* init all device */
|
||||
rt_device_init_all();
|
||||
|
||||
/* init application */
|
||||
rt_application_init();
|
||||
|
||||
@@ -112,7 +109,7 @@ void rtthread_startup(void)
|
||||
|
||||
int main(void)
|
||||
{
|
||||
|
||||
|
||||
/* disable interrupt first */
|
||||
rt_hw_interrupt_disable();
|
||||
|
||||
|
||||
@@ -138,8 +138,6 @@ void rt_init_thread_entry(void* parameter)
|
||||
/* register ethernetif device */
|
||||
eth_system_device_init();
|
||||
rt_hw_macb_init();
|
||||
/* re-init device driver */
|
||||
rt_device_init_all();
|
||||
/* init lwip system */
|
||||
lwip_sys_init();
|
||||
}
|
||||
@@ -176,7 +174,7 @@ void rt_led_thread_entry(void* parameter)
|
||||
led_on(3);
|
||||
else
|
||||
led_off(3);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -197,7 +195,7 @@ int rt_application_init()
|
||||
rt_led_thread_entry, RT_NULL,
|
||||
512, 20, 20);
|
||||
#endif
|
||||
|
||||
|
||||
#else
|
||||
init_thread = rt_thread_create("init",
|
||||
rt_init_thread_entry, RT_NULL,
|
||||
@@ -207,7 +205,7 @@ int rt_application_init()
|
||||
rt_led_thread_entry, RT_NULL,
|
||||
512, 200, 20);
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
if (init_thread != RT_NULL)
|
||||
|
||||
@@ -39,7 +39,6 @@ int main(void)
|
||||
#endif
|
||||
|
||||
rt_system_scheduler_init();
|
||||
rt_device_init_all();
|
||||
rt_application_init();
|
||||
|
||||
#ifdef RT_USING_FINSH
|
||||
|
||||
@@ -426,7 +426,7 @@ int rt_hw_serial_init(void)
|
||||
config.stop_bits = STOP_BITS_1;
|
||||
config.invert = NRZ_NORMAL;
|
||||
serial3.ops = &am33xx_uart_ops;
|
||||
serial3.int_rx = &uart_3_int_rx;
|
||||
serial3.int_rx = &uart3_int_rx;
|
||||
serial3.config = config;
|
||||
/* enable RX interrupt */
|
||||
UART_IER_REG(uart3.base) = 0x01;
|
||||
@@ -470,7 +470,7 @@ int rt_hw_serial_init(void)
|
||||
config.parity = PARITY_NONE;
|
||||
config.stop_bits = STOP_BITS_1;
|
||||
config.invert = NRZ_NORMAL;
|
||||
|
||||
|
||||
serial5.ops = &am33xx_uart_ops;
|
||||
serial5.int_rx = &uart5_int_rx;
|
||||
serial5.config = config;
|
||||
|
||||
@@ -62,9 +62,6 @@ void rtthread_startup(void)
|
||||
RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX | RT_DEVICE_FLAG_STREAM,
|
||||
&uart0);
|
||||
|
||||
/* init all device */
|
||||
rt_device_init_all();
|
||||
|
||||
rt_console_set_device("uart0");
|
||||
#endif
|
||||
|
||||
|
||||
@@ -65,11 +65,6 @@ void rtthread_startup(void)
|
||||
/* init scheduler system */
|
||||
rt_system_scheduler_init();
|
||||
|
||||
#ifdef RT_USING_DEVICE
|
||||
/* init all device */
|
||||
rt_device_init_all();
|
||||
#endif
|
||||
|
||||
/* init application */
|
||||
rt_application_init();
|
||||
|
||||
|
||||
@@ -114,9 +114,6 @@ void rtthread_startup(void)
|
||||
/* init scheduler system */
|
||||
rt_system_scheduler_init();
|
||||
|
||||
/* init all devices */
|
||||
rt_device_init_all();
|
||||
|
||||
/* init finsh */
|
||||
#ifdef RT_USING_FINSH
|
||||
finsh_system_init();
|
||||
|
||||
@@ -55,11 +55,6 @@ void rtthread_startup(void)
|
||||
/* init scheduler system */
|
||||
rt_system_scheduler_init();
|
||||
|
||||
#ifdef RT_USING_DEVICE
|
||||
/* init all device */
|
||||
rt_device_init_all();
|
||||
#endif
|
||||
|
||||
/* init application */
|
||||
rt_application_init();
|
||||
|
||||
|
||||
@@ -97,7 +97,7 @@ void rtthread_startup(void)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef RT_USING_MODULE
|
||||
#ifdef RT_USING_MODULE
|
||||
/* init module system */
|
||||
rt_system_module_init();
|
||||
#endif
|
||||
@@ -118,8 +118,6 @@ void rtthread_startup(void)
|
||||
/* init sd card device */
|
||||
rt_hw_sdcard_init();
|
||||
#endif
|
||||
/* init all device */
|
||||
rt_device_init_all();
|
||||
|
||||
/* init application */
|
||||
rt_application_init();
|
||||
@@ -149,7 +147,7 @@ int main(void)
|
||||
/* disable interrupt first */
|
||||
level = rt_hw_interrupt_disable();
|
||||
rtthread_startup();
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -118,8 +118,6 @@ void rtthread_startup(void)
|
||||
/* init sd card device */
|
||||
rt_hw_sdcard_init();
|
||||
#endif
|
||||
/* init all device */
|
||||
rt_device_init_all();
|
||||
|
||||
/* init application */
|
||||
rt_application_init();
|
||||
|
||||
@@ -118,8 +118,6 @@ void rtthread_startup(void)
|
||||
/* init sd card device */
|
||||
rt_hw_sdcard_init();
|
||||
#endif
|
||||
/* init all device */
|
||||
rt_device_init_all();
|
||||
|
||||
/* init application */
|
||||
rt_application_init();
|
||||
|
||||
@@ -76,11 +76,6 @@ void rtthread_startup(void)
|
||||
rt_thread_idle_sethook(rt_hw_led_flash);
|
||||
#endif
|
||||
|
||||
#ifdef RT_USING_DEVICE
|
||||
/* init all device */
|
||||
rt_device_init_all();
|
||||
#endif
|
||||
|
||||
/* init application */
|
||||
rt_application_init();
|
||||
|
||||
@@ -109,7 +104,7 @@ int main (void)
|
||||
|
||||
/* invoke rtthread_startup */
|
||||
rtthread_startup();
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -76,11 +76,6 @@ void rtthread_startup(void)
|
||||
rt_thread_idle_sethook(rt_hw_led_flash);
|
||||
#endif
|
||||
|
||||
#ifdef RT_USING_DEVICE
|
||||
/* init all device */
|
||||
rt_device_init_all();
|
||||
#endif
|
||||
|
||||
/* init application */
|
||||
rt_application_init();
|
||||
|
||||
@@ -109,7 +104,7 @@ int main (void)
|
||||
|
||||
/* invoke rtthread_startup */
|
||||
rtthread_startup();
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -19,14 +19,20 @@
|
||||
#include <rtthread.h>
|
||||
#include "platform.h"
|
||||
|
||||
#ifdef RT_USING_COMPONENTS_INIT
|
||||
#include <components.h>
|
||||
#endif
|
||||
#ifdef RT_USING_LWIP
|
||||
#include <emac.h>
|
||||
#include <netif/ethernetif.h>
|
||||
extern int lwip_system_init(void);
|
||||
#endif
|
||||
|
||||
#ifdef RT_USING_DFS
|
||||
#include <dfs_fs.h>
|
||||
#include <sd.h>
|
||||
#endif
|
||||
|
||||
#ifdef RT_USING_FINSH
|
||||
#include <shell.h>
|
||||
#include <finsh.h>
|
||||
#endif
|
||||
|
||||
/* thread phase init */
|
||||
@@ -38,21 +44,40 @@ void rt_init_thread_entry(void *parameter)
|
||||
#ifdef RT_USING_LWIP
|
||||
/* register Ethernet interface device */
|
||||
lpc17xx_emac_hw_init();
|
||||
#endif
|
||||
|
||||
#ifdef RT_USING_COMPONENTS_INIT
|
||||
/* initialization RT-Thread Components */
|
||||
rt_components_init();
|
||||
/* initialize lwip stack */
|
||||
/* register ethernetif device */
|
||||
eth_system_device_init();
|
||||
|
||||
/* initialize lwip system */
|
||||
lwip_system_init();
|
||||
rt_kprintf("TCP/IP initialized!\n");
|
||||
#endif
|
||||
|
||||
/* Filesystem Initialization */
|
||||
#ifdef RT_USING_DFS
|
||||
rt_hw_sdcard_init();
|
||||
|
||||
/* initialize the device file system */
|
||||
dfs_init();
|
||||
|
||||
#ifdef RT_USING_DFS_ELMFAT
|
||||
/* initialize the elm chan FatFS file system*/
|
||||
elm_init();
|
||||
#endif
|
||||
|
||||
/* mount sd card fat partition 1 as root directory */
|
||||
if (dfs_mount("sd0", "/", "elm", 0, 0) == 0)
|
||||
rt_kprintf("File System initialized!\n");
|
||||
else
|
||||
rt_kprintf("File System init failed!\n");
|
||||
#endif
|
||||
|
||||
#ifdef RT_USING_FINSH
|
||||
/* initialize finsh */
|
||||
finsh_system_init();
|
||||
finsh_set_device(RT_CONSOLE_DEVICE_NAME);
|
||||
#endif
|
||||
}
|
||||
|
||||
int rt_application_init()
|
||||
|
||||
@@ -16,20 +16,13 @@
|
||||
#include <rthw.h>
|
||||
#include <rtthread.h>
|
||||
|
||||
#include "LPC17xx.h"
|
||||
#include "board.h"
|
||||
|
||||
#ifdef RT_USING_DFS
|
||||
#include "sd.h"
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @addtogroup LPC17
|
||||
* @addtogroup LPC176x
|
||||
*/
|
||||
|
||||
/*@{*/
|
||||
|
||||
extern int rt_application_init(void);
|
||||
#include <board.h>
|
||||
extern int rt_application_init(void);
|
||||
|
||||
#ifdef __CC_ARM
|
||||
extern int Image$$RW_IRAM1$$ZI$$Limit;
|
||||
@@ -84,14 +77,6 @@ void rtthread_startup(void)
|
||||
/* initialize scheduler system */
|
||||
rt_system_scheduler_init();
|
||||
|
||||
#ifdef RT_USING_DEVICE
|
||||
#ifdef RT_USING_DFS
|
||||
rt_hw_sdcard_init();
|
||||
#endif
|
||||
/* initialize all device */
|
||||
rt_device_init_all();
|
||||
#endif
|
||||
|
||||
/* initialize application */
|
||||
rt_application_init();
|
||||
|
||||
|
||||
@@ -397,7 +397,19 @@ static rt_size_t rt_sdcard_write (rt_device_t dev, rt_off_t pos, const void* buf
|
||||
|
||||
static rt_err_t rt_sdcard_control(rt_device_t dev, rt_uint8_t cmd, void *args)
|
||||
{
|
||||
return RT_EOK;
|
||||
if (cmd == RT_DEVICE_CTRL_BLK_GETGEOME)
|
||||
{
|
||||
struct rt_device_blk_geometry *geometry;
|
||||
|
||||
geometry = (struct rt_device_blk_geometry *)args;
|
||||
if (geometry == RT_NULL) return -RT_ERROR;
|
||||
|
||||
geometry->bytes_per_sector = SDCfg.sectorsize;
|
||||
geometry->block_size = SDCfg.blocksize;
|
||||
geometry->sector_count = SDCfg.sectorcnt;
|
||||
}
|
||||
|
||||
return RT_EOK;
|
||||
}
|
||||
|
||||
void rt_hw_sdcard_init()
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -30,6 +30,7 @@
|
||||
<SLE66AMisc></SLE66AMisc>
|
||||
<SLE66LinkerMisc></SLE66LinkerMisc>
|
||||
<SFDFile></SFDFile>
|
||||
<bCustSvd>0</bCustSvd>
|
||||
<UseEnv>0</UseEnv>
|
||||
<BinPath></BinPath>
|
||||
<IncludePath></IncludePath>
|
||||
@@ -43,14 +44,14 @@
|
||||
<NotGenerated>0</NotGenerated>
|
||||
<InvalidFlash>1</InvalidFlash>
|
||||
</TargetStatus>
|
||||
<OutputDirectory>.\obj\</OutputDirectory>
|
||||
<OutputDirectory>.\build\</OutputDirectory>
|
||||
<OutputName>rtthread-lpc</OutputName>
|
||||
<CreateExecutable>1</CreateExecutable>
|
||||
<CreateLib>0</CreateLib>
|
||||
<CreateHexFile>0</CreateHexFile>
|
||||
<DebugInformation>1</DebugInformation>
|
||||
<BrowseInformation>1</BrowseInformation>
|
||||
<ListingPath>.\obj\</ListingPath>
|
||||
<ListingPath>.\build\</ListingPath>
|
||||
<HexFormatSelection>1</HexFormatSelection>
|
||||
<Merge32K>0</Merge32K>
|
||||
<CreateBatchFile>0</CreateBatchFile>
|
||||
@@ -97,6 +98,7 @@
|
||||
<StopOnExitCode>3</StopOnExitCode>
|
||||
<CustomArgument></CustomArgument>
|
||||
<IncludeLibraryModules></IncludeLibraryModules>
|
||||
<ComprImg>1</ComprImg>
|
||||
</CommonProperty>
|
||||
<DllOption>
|
||||
<SimDllName>SARMCM3.DLL</SimDllName>
|
||||
@@ -136,6 +138,7 @@
|
||||
<RestoreMemoryDisplay>1</RestoreMemoryDisplay>
|
||||
<RestoreFunctions>0</RestoreFunctions>
|
||||
<RestoreToolbox>1</RestoreToolbox>
|
||||
<RestoreTracepoints>0</RestoreTracepoints>
|
||||
</Target>
|
||||
<RunDebugAfterBuild>0</RunDebugAfterBuild>
|
||||
<TargetSelection>7</TargetSelection>
|
||||
@@ -164,9 +167,14 @@
|
||||
<Capability>1</Capability>
|
||||
<DriverSelection>4099</DriverSelection>
|
||||
</Flash1>
|
||||
<bUseTDR>1</bUseTDR>
|
||||
<Flash2>Segger\JL2CM3.dll</Flash2>
|
||||
<Flash3>"" ()</Flash3>
|
||||
<Flash4></Flash4>
|
||||
<pFcarmOut></pFcarmOut>
|
||||
<pFcarmGrp></pFcarmGrp>
|
||||
<pFcArmRoot></pFcArmRoot>
|
||||
<FcArmLst>0</FcArmLst>
|
||||
</Utilities>
|
||||
<TargetArmAds>
|
||||
<ArmAdsMisc>
|
||||
@@ -344,11 +352,12 @@
|
||||
<Rwpi>0</Rwpi>
|
||||
<wLevel>0</wLevel>
|
||||
<uThumb>0</uThumb>
|
||||
<uSurpInc>0</uSurpInc>
|
||||
<VariousControls>
|
||||
<MiscControls></MiscControls>
|
||||
<Define></Define>
|
||||
<Undefine></Undefine>
|
||||
<IncludePath>.;..\..\components\CMSIS\Include;..\..\components\finsh;..\..\components\init;..\..\components\net\lwip\src;..\..\components\net\lwip\src\arch\include;..\..\components\net\lwip\src\include;..\..\components\net\lwip\src\include\ipv4;..\..\components\net\lwip\src\include\netif;..\..\include;..\..\libcpu\arm\common;..\..\libcpu\arm\cortex-m3;CMSIS\CM3\DeviceSupport\NXP\LPC17xx;applications;drivers</IncludePath>
|
||||
<IncludePath>.;..\..\components\CMSIS\Include;..\..\components\finsh;..\..\components\net\lwip-1.4.1\src;..\..\components\net\lwip-1.4.1\src\arch\include;..\..\components\net\lwip-1.4.1\src\include;..\..\components\net\lwip-1.4.1\src\include\ipv4;..\..\components\net\lwip-1.4.1\src\include\netif;..\..\include;..\..\libcpu\arm\common;..\..\libcpu\arm\cortex-m3;CMSIS\CM3\DeviceSupport\NXP\LPC17xx;applications;drivers</IncludePath>
|
||||
</VariousControls>
|
||||
</Cads>
|
||||
<Aads>
|
||||
@@ -359,6 +368,7 @@
|
||||
<SplitLS>0</SplitLS>
|
||||
<SwStkChk>0</SwStkChk>
|
||||
<NoWarn>0</NoWarn>
|
||||
<uSurpInc>0</uSurpInc>
|
||||
<VariousControls>
|
||||
<MiscControls></MiscControls>
|
||||
<Define></Define>
|
||||
@@ -385,6 +395,21 @@
|
||||
</TargetArmAds>
|
||||
</TargetOption>
|
||||
<Groups>
|
||||
<Group>
|
||||
<GroupName>CMSIS</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>system_LPC17xx.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>CMSIS\CM3\DeviceSupport\NXP\LPC17xx\system_LPC17xx.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>startup_LPC17xx.s</FileName>
|
||||
<FileType>2</FileType>
|
||||
<FilePath>CMSIS\CM3\DeviceSupport\NXP\LPC17xx\startup\arm\startup_LPC17xx.s</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>Applications</GroupName>
|
||||
<Files>
|
||||
@@ -405,21 +430,6 @@
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>CMSIS</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>system_LPC17xx.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>CMSIS\CM3\DeviceSupport\NXP\LPC17xx\system_LPC17xx.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>startup_LPC17xx.s</FileName>
|
||||
<FileType>2</FileType>
|
||||
<FilePath>CMSIS\CM3\DeviceSupport\NXP\LPC17xx\startup\arm\startup_LPC17xx.s</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>Drivers</GroupName>
|
||||
<Files>
|
||||
@@ -553,6 +563,16 @@
|
||||
<Group>
|
||||
<GroupName>finsh</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>shell.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\components\finsh\shell.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>symbol.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\components\finsh\symbol.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>cmd.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
@@ -593,11 +613,6 @@
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\components\finsh\finsh_parser.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>finsh_token.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\components\finsh\finsh_token.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>finsh_var.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
@@ -609,24 +624,9 @@
|
||||
<FilePath>..\..\components\finsh\finsh_vm.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>shell.c</FileName>
|
||||
<FileName>finsh_token.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\components\finsh\shell.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>symbol.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\components\finsh\symbol.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>Components</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>components.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\components\init\components.c</FilePath>
|
||||
<FilePath>..\..\components\finsh\finsh_token.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
@@ -636,177 +636,177 @@
|
||||
<File>
|
||||
<FileName>api_lib.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\components\net\lwip\src\api\api_lib.c</FilePath>
|
||||
<FilePath>..\..\components\net\lwip-1.4.1\src\api\api_lib.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>api_msg.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\components\net\lwip\src\api\api_msg.c</FilePath>
|
||||
<FilePath>..\..\components\net\lwip-1.4.1\src\api\api_msg.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>err.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\components\net\lwip\src\api\err.c</FilePath>
|
||||
<FilePath>..\..\components\net\lwip-1.4.1\src\api\err.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>netbuf.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\components\net\lwip\src\api\netbuf.c</FilePath>
|
||||
<FilePath>..\..\components\net\lwip-1.4.1\src\api\netbuf.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>netdb.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\components\net\lwip\src\api\netdb.c</FilePath>
|
||||
<FilePath>..\..\components\net\lwip-1.4.1\src\api\netdb.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>netifapi.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\components\net\lwip\src\api\netifapi.c</FilePath>
|
||||
<FilePath>..\..\components\net\lwip-1.4.1\src\api\netifapi.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>sockets.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\components\net\lwip\src\api\sockets.c</FilePath>
|
||||
<FilePath>..\..\components\net\lwip-1.4.1\src\api\sockets.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>tcpip.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\components\net\lwip\src\api\tcpip.c</FilePath>
|
||||
<FilePath>..\..\components\net\lwip-1.4.1\src\api\tcpip.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>sys_arch.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\components\net\lwip\src\arch\sys_arch.c</FilePath>
|
||||
<FilePath>..\..\components\net\lwip-1.4.1\src\arch\sys_arch.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>def.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\components\net\lwip\src\core\def.c</FilePath>
|
||||
<FilePath>..\..\components\net\lwip-1.4.1\src\core\def.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>dhcp.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\components\net\lwip\src\core\dhcp.c</FilePath>
|
||||
<FilePath>..\..\components\net\lwip-1.4.1\src\core\dhcp.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>dns.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\components\net\lwip\src\core\dns.c</FilePath>
|
||||
<FilePath>..\..\components\net\lwip-1.4.1\src\core\dns.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>init.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\components\net\lwip\src\core\init.c</FilePath>
|
||||
<FilePath>..\..\components\net\lwip-1.4.1\src\core\init.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>memp.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\components\net\lwip\src\core\memp.c</FilePath>
|
||||
<FilePath>..\..\components\net\lwip-1.4.1\src\core\memp.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>netif.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\components\net\lwip\src\core\netif.c</FilePath>
|
||||
<FilePath>..\..\components\net\lwip-1.4.1\src\core\netif.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>pbuf.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\components\net\lwip\src\core\pbuf.c</FilePath>
|
||||
<FilePath>..\..\components\net\lwip-1.4.1\src\core\pbuf.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>raw.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\components\net\lwip\src\core\raw.c</FilePath>
|
||||
<FilePath>..\..\components\net\lwip-1.4.1\src\core\raw.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>stats.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\components\net\lwip\src\core\stats.c</FilePath>
|
||||
<FilePath>..\..\components\net\lwip-1.4.1\src\core\stats.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>sys.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\components\net\lwip\src\core\sys.c</FilePath>
|
||||
<FilePath>..\..\components\net\lwip-1.4.1\src\core\sys.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>tcp.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\components\net\lwip\src\core\tcp.c</FilePath>
|
||||
<FilePath>..\..\components\net\lwip-1.4.1\src\core\tcp.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>tcp_in.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\components\net\lwip\src\core\tcp_in.c</FilePath>
|
||||
<FilePath>..\..\components\net\lwip-1.4.1\src\core\tcp_in.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>tcp_out.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\components\net\lwip\src\core\tcp_out.c</FilePath>
|
||||
<FilePath>..\..\components\net\lwip-1.4.1\src\core\tcp_out.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>timers.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\components\net\lwip\src\core\timers.c</FilePath>
|
||||
<FilePath>..\..\components\net\lwip-1.4.1\src\core\timers.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>udp.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\components\net\lwip\src\core\udp.c</FilePath>
|
||||
<FilePath>..\..\components\net\lwip-1.4.1\src\core\udp.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>autoip.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\components\net\lwip\src\core\ipv4\autoip.c</FilePath>
|
||||
<FilePath>..\..\components\net\lwip-1.4.1\src\core\ipv4\autoip.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>icmp.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\components\net\lwip\src\core\ipv4\icmp.c</FilePath>
|
||||
<FilePath>..\..\components\net\lwip-1.4.1\src\core\ipv4\icmp.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>igmp.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\components\net\lwip\src\core\ipv4\igmp.c</FilePath>
|
||||
<FilePath>..\..\components\net\lwip-1.4.1\src\core\ipv4\igmp.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>inet.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\components\net\lwip\src\core\ipv4\inet.c</FilePath>
|
||||
<FilePath>..\..\components\net\lwip-1.4.1\src\core\ipv4\inet.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>inet_chksum.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\components\net\lwip\src\core\ipv4\inet_chksum.c</FilePath>
|
||||
<FilePath>..\..\components\net\lwip-1.4.1\src\core\ipv4\inet_chksum.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>ip.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\components\net\lwip\src\core\ipv4\ip.c</FilePath>
|
||||
<FilePath>..\..\components\net\lwip-1.4.1\src\core\ipv4\ip.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>ip_addr.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\components\net\lwip\src\core\ipv4\ip_addr.c</FilePath>
|
||||
<FilePath>..\..\components\net\lwip-1.4.1\src\core\ipv4\ip_addr.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>ip_frag.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\components\net\lwip\src\core\ipv4\ip_frag.c</FilePath>
|
||||
<FilePath>..\..\components\net\lwip-1.4.1\src\core\ipv4\ip_frag.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>etharp.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\components\net\lwip\src\netif\etharp.c</FilePath>
|
||||
<FilePath>..\..\components\net\lwip-1.4.1\src\netif\etharp.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>ethernetif.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\components\net\lwip\src\netif\ethernetif.c</FilePath>
|
||||
<FilePath>..\..\components\net\lwip-1.4.1\src\netif\ethernetif.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>slipif.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\components\net\lwip\src\netif\slipif.c</FilePath>
|
||||
<FilePath>..\..\components\net\lwip-1.4.1\src\netif\slipif.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
|
||||
@@ -77,8 +77,8 @@
|
||||
#define RT_CONSOLE_DEVICE_NAME "uart0"
|
||||
// </section>
|
||||
|
||||
// <bool name="RT_USING_COMPONENTS_INIT" description="Using RT-Thread components initialization" default="true" />
|
||||
#define RT_USING_COMPONENTS_INIT
|
||||
// <bool name="RT_USING_COMPONENTS_INIT" description="Using RT-Thread components initialization" default="false" />
|
||||
// #define RT_USING_COMPONENTS_INIT
|
||||
// <section name="RT_USING_FINSH" description="Using finsh as shell, which is a C-Express shell" default="true" >
|
||||
#define RT_USING_FINSH
|
||||
// <bool name="FINSH_USING_SYMTAB" description="Using symbol table in finsh shell" default="true" />
|
||||
@@ -99,7 +99,7 @@
|
||||
// <section name="RT_USING_DFS" description="Device file system" default="true" >
|
||||
// #define RT_USING_DFS
|
||||
// <bool name="DFS_USING_WORKDIR" description="Using working directory" default="true" />
|
||||
// #define DFS_USING_WORKDIR
|
||||
#define DFS_USING_WORKDIR
|
||||
// <integer name="DFS_FILESYSTEMS_MAX" description="The maximal number of mounted file system" default="4" />
|
||||
#define DFS_FILESYSTEMS_MAX 2
|
||||
// <integer name="DFS_FD_MAX" description="The maximal number of opened files" default="4" />
|
||||
@@ -107,12 +107,14 @@
|
||||
// <bool name="RT_USING_DFS_ELMFAT" description="Using ELM FatFs" default="true" />
|
||||
#define RT_USING_DFS_ELMFAT
|
||||
// <integer name="RT_DFS_ELM_USE_LFN" description="Support long file name" default="0">
|
||||
// <item description="Disable">0</item>
|
||||
// <item description="LFN1">1</item>
|
||||
// <item description="LFN1">2</item>
|
||||
// <item description="LFN3">3</item>
|
||||
// </integer>
|
||||
#define RT_DFS_ELM_USE_LFN 1
|
||||
#define RT_DFS_ELM_USE_LFN 0
|
||||
// <integer name="RT_DFS_ELM_MAX_LFN" description="Maximal size of file name length" default="256" />
|
||||
#define RT_DFS_ELM_MAX_LFN 64
|
||||
#define RT_DFS_ELM_MAX_LFN 256
|
||||
// <bool name="RT_USING_DFS_YAFFS2" description="Using YAFFS2" default="false" />
|
||||
// #define RT_USING_DFS_YAFFS2
|
||||
// <bool name="RT_USING_DFS_UFFS" description="Using UFFS" default="false" />
|
||||
@@ -149,8 +151,6 @@
|
||||
// #define RT_LWIP_SNMP
|
||||
// <bool name="RT_LWIP_DHCP" description="Enable DHCP client to get IP address" default="false" />
|
||||
// #define RT_LWIP_DHCP
|
||||
// <integer name="RT_LWIP_TCP_SEG_NUM" description="the number of simultaneously queued TCP" default="4" />
|
||||
#define RT_LWIP_TCP_SEG_NUM 4
|
||||
// <integer name="RT_LWIP_TCPTHREAD_PRIORITY" description="the thread priority of TCP thread" default="128" />
|
||||
#define RT_LWIP_TCPTHREAD_PRIORITY 12
|
||||
// <integer name="RT_LWIP_TCPTHREAD_MBOX_SIZE" description="the mail box size of TCP thread to wait for" default="32" />
|
||||
|
||||
169
bsp/lpc176x/template.uvopt
Normal file
169
bsp/lpc176x/template.uvopt
Normal file
@@ -0,0 +1,169 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||
<ProjectOpt xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="project_opt.xsd">
|
||||
|
||||
<SchemaVersion>1.0</SchemaVersion>
|
||||
|
||||
<Header>### uVision Project, (C) Keil Software</Header>
|
||||
|
||||
<Extensions>
|
||||
<cExt>*.c</cExt>
|
||||
<aExt>*.s*; *.src; *.a*</aExt>
|
||||
<oExt>*.obj</oExt>
|
||||
<lExt>*.lib</lExt>
|
||||
<tExt>*.txt; *.h; *.inc</tExt>
|
||||
<pExt>*.plm</pExt>
|
||||
<CppX>*.cpp</CppX>
|
||||
</Extensions>
|
||||
|
||||
<DaveTm>
|
||||
<dwLowDateTime>0</dwLowDateTime>
|
||||
<dwHighDateTime>0</dwHighDateTime>
|
||||
</DaveTm>
|
||||
|
||||
<Target>
|
||||
<TargetName>RT-Thread LPC17xx</TargetName>
|
||||
<ToolsetNumber>0x4</ToolsetNumber>
|
||||
<ToolsetName>ARM-ADS</ToolsetName>
|
||||
<TargetOption>
|
||||
<CLKADS>12000000</CLKADS>
|
||||
<OPTTT>
|
||||
<gFlags>1</gFlags>
|
||||
<BeepAtEnd>1</BeepAtEnd>
|
||||
<RunSim>1</RunSim>
|
||||
<RunTarget>0</RunTarget>
|
||||
</OPTTT>
|
||||
<OPTHX>
|
||||
<HexSelection>1</HexSelection>
|
||||
<FlashByte>65535</FlashByte>
|
||||
<HexRangeLowAddress>0</HexRangeLowAddress>
|
||||
<HexRangeHighAddress>0</HexRangeHighAddress>
|
||||
<HexOffset>0</HexOffset>
|
||||
</OPTHX>
|
||||
<OPTLEX>
|
||||
<PageWidth>79</PageWidth>
|
||||
<PageLength>66</PageLength>
|
||||
<TabStop>8</TabStop>
|
||||
<ListingPath>.\build\</ListingPath>
|
||||
</OPTLEX>
|
||||
<ListingPage>
|
||||
<CreateCListing>1</CreateCListing>
|
||||
<CreateAListing>1</CreateAListing>
|
||||
<CreateLListing>1</CreateLListing>
|
||||
<CreateIListing>0</CreateIListing>
|
||||
<AsmCond>1</AsmCond>
|
||||
<AsmSymb>1</AsmSymb>
|
||||
<AsmXref>0</AsmXref>
|
||||
<CCond>1</CCond>
|
||||
<CCode>0</CCode>
|
||||
<CListInc>0</CListInc>
|
||||
<CSymb>0</CSymb>
|
||||
<LinkerCodeListing>0</LinkerCodeListing>
|
||||
</ListingPage>
|
||||
<OPTXL>
|
||||
<LMap>1</LMap>
|
||||
<LComments>1</LComments>
|
||||
<LGenerateSymbols>1</LGenerateSymbols>
|
||||
<LLibSym>1</LLibSym>
|
||||
<LLines>1</LLines>
|
||||
<LLocSym>1</LLocSym>
|
||||
<LPubSym>1</LPubSym>
|
||||
<LXref>0</LXref>
|
||||
<LExpSel>0</LExpSel>
|
||||
</OPTXL>
|
||||
<OPTFL>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<IsCurrentTarget>1</IsCurrentTarget>
|
||||
</OPTFL>
|
||||
<CpuCode>8</CpuCode>
|
||||
<DllOpt>
|
||||
<SimDllName>SARMCM3.DLL</SimDllName>
|
||||
<SimDllArguments>-MPU</SimDllArguments>
|
||||
<SimDlgDllName>DARMP1.DLL</SimDlgDllName>
|
||||
<SimDlgDllArguments>-pLPC1768</SimDlgDllArguments>
|
||||
<TargetDllName>SARMCM3.DLL</TargetDllName>
|
||||
<TargetDllArguments>-MPU</TargetDllArguments>
|
||||
<TargetDlgDllName>TARMP1.DLL</TargetDlgDllName>
|
||||
<TargetDlgDllArguments>-pLPC1768</TargetDlgDllArguments>
|
||||
</DllOpt>
|
||||
<DebugOpt>
|
||||
<uSim>0</uSim>
|
||||
<uTrg>1</uTrg>
|
||||
<sLdApp>1</sLdApp>
|
||||
<sGomain>1</sGomain>
|
||||
<sRbreak>1</sRbreak>
|
||||
<sRwatch>1</sRwatch>
|
||||
<sRmem>1</sRmem>
|
||||
<sRfunc>1</sRfunc>
|
||||
<sRbox>1</sRbox>
|
||||
<tLdApp>1</tLdApp>
|
||||
<tGomain>1</tGomain>
|
||||
<tRbreak>1</tRbreak>
|
||||
<tRwatch>1</tRwatch>
|
||||
<tRmem>1</tRmem>
|
||||
<tRfunc>0</tRfunc>
|
||||
<tRbox>1</tRbox>
|
||||
<tRtrace>0</tRtrace>
|
||||
<sRunDeb>0</sRunDeb>
|
||||
<sLrtime>0</sLrtime>
|
||||
<nTsel>7</nTsel>
|
||||
<sDll></sDll>
|
||||
<sDllPa></sDllPa>
|
||||
<sDlgDll></sDlgDll>
|
||||
<sDlgPa></sDlgPa>
|
||||
<sIfile></sIfile>
|
||||
<tDll></tDll>
|
||||
<tDllPa></tDllPa>
|
||||
<tDlgDll></tDlgDll>
|
||||
<tDlgPa></tDlgPa>
|
||||
<tIfile></tIfile>
|
||||
<pMon>Segger\JL2CM3.dll</pMon>
|
||||
</DebugOpt>
|
||||
<TargetDriverDllRegistry>
|
||||
<SetRegEntry>
|
||||
<Number>0</Number>
|
||||
<Key>JL2CM3</Key>
|
||||
<Name>-U20090928 -O78 -S0 -A0 -C0 -JU1 -JI127.0.0.1 -JP0 -RST0 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -TB1 -TFE0 -FO15 -FD10000000 -FC800 -FN1 -FF0LPC_IAP_512 -FS00 -FL080000</Name>
|
||||
</SetRegEntry>
|
||||
<SetRegEntry>
|
||||
<Number>0</Number>
|
||||
<Key>UL2CM3</Key>
|
||||
<Name>UL2CM3(-O463 -S0 -C0 -FO7 -FD10000000 -FC800 -FN1 -FF0LPC_IAP_512 -FS00 -FL080000)</Name>
|
||||
</SetRegEntry>
|
||||
</TargetDriverDllRegistry>
|
||||
<Breakpoint/>
|
||||
<Tracepoint>
|
||||
<THDelay>0</THDelay>
|
||||
</Tracepoint>
|
||||
<DebugFlag>
|
||||
<trace>0</trace>
|
||||
<periodic>0</periodic>
|
||||
<aLwin>0</aLwin>
|
||||
<aCover>0</aCover>
|
||||
<aSer1>0</aSer1>
|
||||
<aSer2>0</aSer2>
|
||||
<aPa>0</aPa>
|
||||
<viewmode>0</viewmode>
|
||||
<vrSel>0</vrSel>
|
||||
<aSym>0</aSym>
|
||||
<aTbox>0</aTbox>
|
||||
<AscS1>0</AscS1>
|
||||
<AscS2>0</AscS2>
|
||||
<AscS3>0</AscS3>
|
||||
<aSer3>0</aSer3>
|
||||
<eProf>0</eProf>
|
||||
<aLa>0</aLa>
|
||||
<aPa1>0</aPa1>
|
||||
<AscS4>0</AscS4>
|
||||
<aSer4>0</aSer4>
|
||||
<StkLoc>0</StkLoc>
|
||||
<TrcWin>0</TrcWin>
|
||||
<newCpu>0</newCpu>
|
||||
<uProt>0</uProt>
|
||||
</DebugFlag>
|
||||
<LintExecutable></LintExecutable>
|
||||
<LintConfigFile></LintConfigFile>
|
||||
</TargetOption>
|
||||
</Target>
|
||||
|
||||
</ProjectOpt>
|
||||
@@ -30,6 +30,7 @@
|
||||
<SLE66AMisc></SLE66AMisc>
|
||||
<SLE66LinkerMisc></SLE66LinkerMisc>
|
||||
<SFDFile></SFDFile>
|
||||
<bCustSvd>0</bCustSvd>
|
||||
<UseEnv>0</UseEnv>
|
||||
<BinPath></BinPath>
|
||||
<IncludePath></IncludePath>
|
||||
@@ -43,14 +44,14 @@
|
||||
<NotGenerated>0</NotGenerated>
|
||||
<InvalidFlash>1</InvalidFlash>
|
||||
</TargetStatus>
|
||||
<OutputDirectory>.\obj\</OutputDirectory>
|
||||
<OutputDirectory>.\build\</OutputDirectory>
|
||||
<OutputName>rtthread-lpc</OutputName>
|
||||
<CreateExecutable>1</CreateExecutable>
|
||||
<CreateLib>0</CreateLib>
|
||||
<CreateHexFile>0</CreateHexFile>
|
||||
<DebugInformation>1</DebugInformation>
|
||||
<BrowseInformation>1</BrowseInformation>
|
||||
<ListingPath>.\obj\</ListingPath>
|
||||
<ListingPath>.\build\</ListingPath>
|
||||
<HexFormatSelection>1</HexFormatSelection>
|
||||
<Merge32K>0</Merge32K>
|
||||
<CreateBatchFile>0</CreateBatchFile>
|
||||
@@ -61,6 +62,8 @@
|
||||
<UserProg2Name></UserProg2Name>
|
||||
<UserProg1Dos16Mode>0</UserProg1Dos16Mode>
|
||||
<UserProg2Dos16Mode>0</UserProg2Dos16Mode>
|
||||
<nStopU1X>0</nStopU1X>
|
||||
<nStopU2X>0</nStopU2X>
|
||||
</BeforeCompile>
|
||||
<BeforeMake>
|
||||
<RunUserProg1>0</RunUserProg1>
|
||||
@@ -95,6 +98,7 @@
|
||||
<StopOnExitCode>3</StopOnExitCode>
|
||||
<CustomArgument></CustomArgument>
|
||||
<IncludeLibraryModules></IncludeLibraryModules>
|
||||
<ComprImg>1</ComprImg>
|
||||
</CommonProperty>
|
||||
<DllOption>
|
||||
<SimDllName>SARMCM3.DLL</SimDllName>
|
||||
@@ -115,7 +119,7 @@
|
||||
<Oh166RecLen>16</Oh166RecLen>
|
||||
</OPTHX>
|
||||
<Simulator>
|
||||
<UseSimulator>1</UseSimulator>
|
||||
<UseSimulator>0</UseSimulator>
|
||||
<LoadApplicationAtStartup>1</LoadApplicationAtStartup>
|
||||
<RunToMain>1</RunToMain>
|
||||
<RestoreBreakpoints>1</RestoreBreakpoints>
|
||||
@@ -126,17 +130,18 @@
|
||||
<LimitSpeedToRealTime>0</LimitSpeedToRealTime>
|
||||
</Simulator>
|
||||
<Target>
|
||||
<UseTarget>0</UseTarget>
|
||||
<UseTarget>1</UseTarget>
|
||||
<LoadApplicationAtStartup>1</LoadApplicationAtStartup>
|
||||
<RunToMain>0</RunToMain>
|
||||
<RunToMain>1</RunToMain>
|
||||
<RestoreBreakpoints>1</RestoreBreakpoints>
|
||||
<RestoreWatchpoints>1</RestoreWatchpoints>
|
||||
<RestoreMemoryDisplay>1</RestoreMemoryDisplay>
|
||||
<RestoreFunctions>0</RestoreFunctions>
|
||||
<RestoreToolbox>1</RestoreToolbox>
|
||||
<RestoreTracepoints>0</RestoreTracepoints>
|
||||
</Target>
|
||||
<RunDebugAfterBuild>0</RunDebugAfterBuild>
|
||||
<TargetSelection>5</TargetSelection>
|
||||
<TargetSelection>7</TargetSelection>
|
||||
<SimDlls>
|
||||
<CpuDll></CpuDll>
|
||||
<CpuDllArguments></CpuDllArguments>
|
||||
@@ -162,9 +167,14 @@
|
||||
<Capability>1</Capability>
|
||||
<DriverSelection>4099</DriverSelection>
|
||||
</Flash1>
|
||||
<bUseTDR>1</bUseTDR>
|
||||
<Flash2>Segger\JL2CM3.dll</Flash2>
|
||||
<Flash3>"" ()</Flash3>
|
||||
<Flash4></Flash4>
|
||||
<pFcarmOut></pFcarmOut>
|
||||
<pFcarmGrp></pFcarmGrp>
|
||||
<pFcArmRoot></pFcArmRoot>
|
||||
<FcArmLst>0</FcArmLst>
|
||||
</Utilities>
|
||||
<TargetArmAds>
|
||||
<ArmAdsMisc>
|
||||
@@ -342,6 +352,7 @@
|
||||
<Rwpi>0</Rwpi>
|
||||
<wLevel>0</wLevel>
|
||||
<uThumb>0</uThumb>
|
||||
<uSurpInc>0</uSurpInc>
|
||||
<VariousControls>
|
||||
<MiscControls></MiscControls>
|
||||
<Define></Define>
|
||||
@@ -357,6 +368,7 @@
|
||||
<SplitLS>0</SplitLS>
|
||||
<SwStkChk>0</SwStkChk>
|
||||
<NoWarn>0</NoWarn>
|
||||
<uSurpInc>0</uSurpInc>
|
||||
<VariousControls>
|
||||
<MiscControls></MiscControls>
|
||||
<Define></Define>
|
||||
|
||||
@@ -65,8 +65,6 @@ void rt_init_thread_entry(void *parameter)
|
||||
|
||||
/* register ethernetif device */
|
||||
lpc17xx_emac_hw_init();
|
||||
/* init all device */
|
||||
rt_device_init_all();
|
||||
|
||||
/* init lwip system */
|
||||
lwip_sys_init();
|
||||
@@ -78,13 +76,11 @@ void rt_init_thread_entry(void *parameter)
|
||||
{
|
||||
extern void rtgui_system_server_init(void);
|
||||
extern void application_init(void);
|
||||
|
||||
|
||||
rt_device_t lcd;
|
||||
|
||||
/* init lcd */
|
||||
rt_hw_lcd_init();
|
||||
/* re-init device driver */
|
||||
rt_device_init_all();
|
||||
|
||||
/* find lcd device */
|
||||
lcd = rt_device_find("lcd");
|
||||
|
||||
932
bsp/lpc178x/project.uvopt
Normal file
932
bsp/lpc178x/project.uvopt
Normal file
@@ -0,0 +1,932 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||
<ProjectOpt xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="project_opt.xsd">
|
||||
|
||||
<SchemaVersion>1.0</SchemaVersion>
|
||||
|
||||
<Header>### uVision Project, (C) Keil Software</Header>
|
||||
|
||||
<Extensions>
|
||||
<cExt>*.c</cExt>
|
||||
<aExt>*.s*; *.src; *.a*</aExt>
|
||||
<oExt>*.obj</oExt>
|
||||
<lExt>*.lib</lExt>
|
||||
<tExt>*.txt; *.h; *.inc</tExt>
|
||||
<pExt>*.plm</pExt>
|
||||
<CppX>*.cpp</CppX>
|
||||
</Extensions>
|
||||
|
||||
<DaveTm>
|
||||
<dwLowDateTime>0</dwLowDateTime>
|
||||
<dwHighDateTime>0</dwHighDateTime>
|
||||
</DaveTm>
|
||||
|
||||
<Target>
|
||||
<TargetName>RT-Thread LPC17xx</TargetName>
|
||||
<ToolsetNumber>0x4</ToolsetNumber>
|
||||
<ToolsetName>ARM-ADS</ToolsetName>
|
||||
<TargetOption>
|
||||
<CLKADS>12000000</CLKADS>
|
||||
<OPTTT>
|
||||
<gFlags>1</gFlags>
|
||||
<BeepAtEnd>1</BeepAtEnd>
|
||||
<RunSim>1</RunSim>
|
||||
<RunTarget>0</RunTarget>
|
||||
</OPTTT>
|
||||
<OPTHX>
|
||||
<HexSelection>1</HexSelection>
|
||||
<FlashByte>65535</FlashByte>
|
||||
<HexRangeLowAddress>0</HexRangeLowAddress>
|
||||
<HexRangeHighAddress>0</HexRangeHighAddress>
|
||||
<HexOffset>0</HexOffset>
|
||||
</OPTHX>
|
||||
<OPTLEX>
|
||||
<PageWidth>79</PageWidth>
|
||||
<PageLength>66</PageLength>
|
||||
<TabStop>8</TabStop>
|
||||
<ListingPath>.\build\</ListingPath>
|
||||
</OPTLEX>
|
||||
<ListingPage>
|
||||
<CreateCListing>1</CreateCListing>
|
||||
<CreateAListing>1</CreateAListing>
|
||||
<CreateLListing>1</CreateLListing>
|
||||
<CreateIListing>0</CreateIListing>
|
||||
<AsmCond>1</AsmCond>
|
||||
<AsmSymb>1</AsmSymb>
|
||||
<AsmXref>0</AsmXref>
|
||||
<CCond>1</CCond>
|
||||
<CCode>0</CCode>
|
||||
<CListInc>0</CListInc>
|
||||
<CSymb>0</CSymb>
|
||||
<LinkerCodeListing>0</LinkerCodeListing>
|
||||
</ListingPage>
|
||||
<OPTXL>
|
||||
<LMap>1</LMap>
|
||||
<LComments>1</LComments>
|
||||
<LGenerateSymbols>1</LGenerateSymbols>
|
||||
<LLibSym>1</LLibSym>
|
||||
<LLines>1</LLines>
|
||||
<LLocSym>1</LLocSym>
|
||||
<LPubSym>1</LPubSym>
|
||||
<LXref>0</LXref>
|
||||
<LExpSel>0</LExpSel>
|
||||
</OPTXL>
|
||||
<OPTFL>
|
||||
<tvExp>1</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<IsCurrentTarget>1</IsCurrentTarget>
|
||||
</OPTFL>
|
||||
<CpuCode>8</CpuCode>
|
||||
<DllOpt>
|
||||
<SimDllName>SARMCM3.DLL</SimDllName>
|
||||
<SimDllArguments>-MPU</SimDllArguments>
|
||||
<SimDlgDllName>DARMP1.DLL</SimDlgDllName>
|
||||
<SimDlgDllArguments>-pLPC1788</SimDlgDllArguments>
|
||||
<TargetDllName>SARMCM3.DLL</TargetDllName>
|
||||
<TargetDllArguments>-MPU</TargetDllArguments>
|
||||
<TargetDlgDllName>TARMP1.DLL</TargetDlgDllName>
|
||||
<TargetDlgDllArguments>-pLPC1788</TargetDlgDllArguments>
|
||||
</DllOpt>
|
||||
<DebugOpt>
|
||||
<uSim>0</uSim>
|
||||
<uTrg>1</uTrg>
|
||||
<sLdApp>1</sLdApp>
|
||||
<sGomain>1</sGomain>
|
||||
<sRbreak>1</sRbreak>
|
||||
<sRwatch>1</sRwatch>
|
||||
<sRmem>1</sRmem>
|
||||
<sRfunc>1</sRfunc>
|
||||
<sRbox>1</sRbox>
|
||||
<tLdApp>1</tLdApp>
|
||||
<tGomain>1</tGomain>
|
||||
<tRbreak>1</tRbreak>
|
||||
<tRwatch>1</tRwatch>
|
||||
<tRmem>1</tRmem>
|
||||
<tRfunc>0</tRfunc>
|
||||
<tRbox>1</tRbox>
|
||||
<tRtrace>0</tRtrace>
|
||||
<sRunDeb>0</sRunDeb>
|
||||
<sLrtime>0</sLrtime>
|
||||
<nTsel>7</nTsel>
|
||||
<sDll></sDll>
|
||||
<sDllPa></sDllPa>
|
||||
<sDlgDll></sDlgDll>
|
||||
<sDlgPa></sDlgPa>
|
||||
<sIfile></sIfile>
|
||||
<tDll></tDll>
|
||||
<tDllPa></tDllPa>
|
||||
<tDlgDll></tDlgDll>
|
||||
<tDlgPa></tDlgPa>
|
||||
<tIfile></tIfile>
|
||||
<pMon>Segger\JL2CM3.dll</pMon>
|
||||
</DebugOpt>
|
||||
<TargetDriverDllRegistry>
|
||||
<SetRegEntry>
|
||||
<Number>0</Number>
|
||||
<Key>UL2CM3</Key>
|
||||
<Name>UL2CM3(-O463 -S0 -C0 -FO7 -FD10000000 -FC800 -FN1 -FF0LPC_IAP_512 -FS00 -FL080000)</Name>
|
||||
</SetRegEntry>
|
||||
</TargetDriverDllRegistry>
|
||||
<Breakpoint/>
|
||||
<Tracepoint>
|
||||
<THDelay>0</THDelay>
|
||||
</Tracepoint>
|
||||
<DebugFlag>
|
||||
<trace>0</trace>
|
||||
<periodic>0</periodic>
|
||||
<aLwin>0</aLwin>
|
||||
<aCover>0</aCover>
|
||||
<aSer1>0</aSer1>
|
||||
<aSer2>0</aSer2>
|
||||
<aPa>0</aPa>
|
||||
<viewmode>0</viewmode>
|
||||
<vrSel>0</vrSel>
|
||||
<aSym>0</aSym>
|
||||
<aTbox>0</aTbox>
|
||||
<AscS1>0</AscS1>
|
||||
<AscS2>0</AscS2>
|
||||
<AscS3>0</AscS3>
|
||||
<aSer3>0</aSer3>
|
||||
<eProf>0</eProf>
|
||||
<aLa>0</aLa>
|
||||
<aPa1>0</aPa1>
|
||||
<AscS4>0</AscS4>
|
||||
<aSer4>0</aSer4>
|
||||
<StkLoc>0</StkLoc>
|
||||
<TrcWin>0</TrcWin>
|
||||
<newCpu>0</newCpu>
|
||||
<uProt>0</uProt>
|
||||
</DebugFlag>
|
||||
<LintExecutable></LintExecutable>
|
||||
<LintConfigFile></LintConfigFile>
|
||||
</TargetOption>
|
||||
</Target>
|
||||
|
||||
<Group>
|
||||
<GroupName>CMSIS</GroupName>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<cbSel>0</cbSel>
|
||||
<RteFlg>0</RteFlg>
|
||||
<File>
|
||||
<GroupNumber>1</GroupNumber>
|
||||
<FileNumber>1</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>CMSIS\CM3\CoreSupport\core_cm3.c</PathWithFileName>
|
||||
<FilenameWithoutPath>core_cm3.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>1</GroupNumber>
|
||||
<FileNumber>2</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>CMSIS\CM3\DeviceSupport\NXP\LPC177x_8x\system_LPC177x_8x.c</PathWithFileName>
|
||||
<FilenameWithoutPath>system_LPC177x_8x.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>1</GroupNumber>
|
||||
<FileNumber>3</FileNumber>
|
||||
<FileType>2</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<Focus>0</Focus>
|
||||
<ColumnNumber>0</ColumnNumber>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<TopLine>0</TopLine>
|
||||
<CurrentLine>0</CurrentLine>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>CMSIS\CM3\DeviceSupport\NXP\LPC177x_8x\startup\arm\startup_LPC177x_8x.s</PathWithFileName>
|
||||
<FilenameWithoutPath>startup_LPC177x_8x.s</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
</Group>
|
||||
|
||||
<Group>
|
||||
<GroupName>Applications</GroupName>
|
||||
<tvExp>1</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<cbSel>0</cbSel>
|
||||
<RteFlg>0</RteFlg>
|
||||
<File>
|
||||
<GroupNumber>2</GroupNumber>
|
||||
<FileNumber>4</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<Focus>0</Focus>
|
||||
<ColumnNumber>0</ColumnNumber>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<TopLine>153</TopLine>
|
||||
<CurrentLine>33</CurrentLine>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>applications\application.c</PathWithFileName>
|
||||
<FilenameWithoutPath>application.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>2</GroupNumber>
|
||||
<FileNumber>5</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>applications\startup.c</PathWithFileName>
|
||||
<FilenameWithoutPath>startup.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
</Group>
|
||||
|
||||
<Group>
|
||||
<GroupName>Drivers</GroupName>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<cbSel>0</cbSel>
|
||||
<RteFlg>0</RteFlg>
|
||||
<File>
|
||||
<GroupNumber>3</GroupNumber>
|
||||
<FileNumber>6</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>drivers\board.c</PathWithFileName>
|
||||
<FilenameWithoutPath>board.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>3</GroupNumber>
|
||||
<FileNumber>7</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>drivers\drv_glcd.c</PathWithFileName>
|
||||
<FilenameWithoutPath>drv_glcd.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>3</GroupNumber>
|
||||
<FileNumber>8</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>drivers\lpc177x_8x_clkpwr.c</PathWithFileName>
|
||||
<FilenameWithoutPath>lpc177x_8x_clkpwr.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>3</GroupNumber>
|
||||
<FileNumber>9</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>drivers\lpc177x_8x_emc.c</PathWithFileName>
|
||||
<FilenameWithoutPath>lpc177x_8x_emc.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>3</GroupNumber>
|
||||
<FileNumber>10</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>drivers\lpc177x_8x_pinsel.c</PathWithFileName>
|
||||
<FilenameWithoutPath>lpc177x_8x_pinsel.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>3</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>drivers\lpc177x_8x_uart.c</PathWithFileName>
|
||||
<FilenameWithoutPath>lpc177x_8x_uart.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>3</GroupNumber>
|
||||
<FileNumber>12</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>drivers\lpc17xx_lcd.c</PathWithFileName>
|
||||
<FilenameWithoutPath>lpc17xx_lcd.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>3</GroupNumber>
|
||||
<FileNumber>13</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>drivers\sdram.c</PathWithFileName>
|
||||
<FilenameWithoutPath>sdram.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>3</GroupNumber>
|
||||
<FileNumber>14</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>drivers\uart.c</PathWithFileName>
|
||||
<FilenameWithoutPath>uart.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
</Group>
|
||||
|
||||
<Group>
|
||||
<GroupName>Kernel</GroupName>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<cbSel>0</cbSel>
|
||||
<RteFlg>0</RteFlg>
|
||||
<File>
|
||||
<GroupNumber>4</GroupNumber>
|
||||
<FileNumber>15</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>..\..\src\clock.c</PathWithFileName>
|
||||
<FilenameWithoutPath>clock.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>4</GroupNumber>
|
||||
<FileNumber>16</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>..\..\src\device.c</PathWithFileName>
|
||||
<FilenameWithoutPath>device.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>4</GroupNumber>
|
||||
<FileNumber>17</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>..\..\src\idle.c</PathWithFileName>
|
||||
<FilenameWithoutPath>idle.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>4</GroupNumber>
|
||||
<FileNumber>18</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>..\..\src\ipc.c</PathWithFileName>
|
||||
<FilenameWithoutPath>ipc.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>4</GroupNumber>
|
||||
<FileNumber>19</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>..\..\src\irq.c</PathWithFileName>
|
||||
<FilenameWithoutPath>irq.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>4</GroupNumber>
|
||||
<FileNumber>20</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>..\..\src\kservice.c</PathWithFileName>
|
||||
<FilenameWithoutPath>kservice.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>4</GroupNumber>
|
||||
<FileNumber>21</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>..\..\src\mem.c</PathWithFileName>
|
||||
<FilenameWithoutPath>mem.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>4</GroupNumber>
|
||||
<FileNumber>22</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>..\..\src\memheap.c</PathWithFileName>
|
||||
<FilenameWithoutPath>memheap.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>4</GroupNumber>
|
||||
<FileNumber>23</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>..\..\src\mempool.c</PathWithFileName>
|
||||
<FilenameWithoutPath>mempool.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>4</GroupNumber>
|
||||
<FileNumber>24</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>..\..\src\object.c</PathWithFileName>
|
||||
<FilenameWithoutPath>object.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>4</GroupNumber>
|
||||
<FileNumber>25</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>..\..\src\scheduler.c</PathWithFileName>
|
||||
<FilenameWithoutPath>scheduler.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>4</GroupNumber>
|
||||
<FileNumber>26</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>..\..\src\thread.c</PathWithFileName>
|
||||
<FilenameWithoutPath>thread.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>4</GroupNumber>
|
||||
<FileNumber>27</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>..\..\src\timer.c</PathWithFileName>
|
||||
<FilenameWithoutPath>timer.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
</Group>
|
||||
|
||||
<Group>
|
||||
<GroupName>CORTEX-M3</GroupName>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<cbSel>0</cbSel>
|
||||
<RteFlg>0</RteFlg>
|
||||
<File>
|
||||
<GroupNumber>5</GroupNumber>
|
||||
<FileNumber>28</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>..\..\libcpu\arm\cortex-m3\cpuport.c</PathWithFileName>
|
||||
<FilenameWithoutPath>cpuport.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>5</GroupNumber>
|
||||
<FileNumber>29</FileNumber>
|
||||
<FileType>2</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<Focus>0</Focus>
|
||||
<ColumnNumber>0</ColumnNumber>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<TopLine>0</TopLine>
|
||||
<CurrentLine>0</CurrentLine>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\libcpu\arm\cortex-m3\context_rvds.S</PathWithFileName>
|
||||
<FilenameWithoutPath>context_rvds.S</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>5</GroupNumber>
|
||||
<FileNumber>30</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>..\..\libcpu\arm\common\backtrace.c</PathWithFileName>
|
||||
<FilenameWithoutPath>backtrace.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>5</GroupNumber>
|
||||
<FileNumber>31</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>..\..\libcpu\arm\common\div0.c</PathWithFileName>
|
||||
<FilenameWithoutPath>div0.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>5</GroupNumber>
|
||||
<FileNumber>32</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>..\..\libcpu\arm\common\showmem.c</PathWithFileName>
|
||||
<FilenameWithoutPath>showmem.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
</Group>
|
||||
|
||||
<Group>
|
||||
<GroupName>finsh</GroupName>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<cbSel>0</cbSel>
|
||||
<RteFlg>0</RteFlg>
|
||||
<File>
|
||||
<GroupNumber>6</GroupNumber>
|
||||
<FileNumber>33</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>..\..\components\finsh\shell.c</PathWithFileName>
|
||||
<FilenameWithoutPath>shell.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>6</GroupNumber>
|
||||
<FileNumber>34</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>..\..\components\finsh\symbol.c</PathWithFileName>
|
||||
<FilenameWithoutPath>symbol.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>6</GroupNumber>
|
||||
<FileNumber>35</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>..\..\components\finsh\cmd.c</PathWithFileName>
|
||||
<FilenameWithoutPath>cmd.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>6</GroupNumber>
|
||||
<FileNumber>36</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>..\..\components\finsh\finsh_compiler.c</PathWithFileName>
|
||||
<FilenameWithoutPath>finsh_compiler.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>6</GroupNumber>
|
||||
<FileNumber>37</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>..\..\components\finsh\finsh_error.c</PathWithFileName>
|
||||
<FilenameWithoutPath>finsh_error.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>6</GroupNumber>
|
||||
<FileNumber>38</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>..\..\components\finsh\finsh_heap.c</PathWithFileName>
|
||||
<FilenameWithoutPath>finsh_heap.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>6</GroupNumber>
|
||||
<FileNumber>39</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>..\..\components\finsh\finsh_init.c</PathWithFileName>
|
||||
<FilenameWithoutPath>finsh_init.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>6</GroupNumber>
|
||||
<FileNumber>40</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>..\..\components\finsh\finsh_node.c</PathWithFileName>
|
||||
<FilenameWithoutPath>finsh_node.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>6</GroupNumber>
|
||||
<FileNumber>41</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>..\..\components\finsh\finsh_ops.c</PathWithFileName>
|
||||
<FilenameWithoutPath>finsh_ops.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>6</GroupNumber>
|
||||
<FileNumber>42</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>..\..\components\finsh\finsh_parser.c</PathWithFileName>
|
||||
<FilenameWithoutPath>finsh_parser.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>6</GroupNumber>
|
||||
<FileNumber>43</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>..\..\components\finsh\finsh_var.c</PathWithFileName>
|
||||
<FilenameWithoutPath>finsh_var.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>6</GroupNumber>
|
||||
<FileNumber>44</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>..\..\components\finsh\finsh_vm.c</PathWithFileName>
|
||||
<FilenameWithoutPath>finsh_vm.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>6</GroupNumber>
|
||||
<FileNumber>45</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>..\..\components\finsh\finsh_token.c</PathWithFileName>
|
||||
<FilenameWithoutPath>finsh_token.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
</Group>
|
||||
|
||||
</ProjectOpt>
|
||||
@@ -30,6 +30,7 @@
|
||||
<SLE66AMisc></SLE66AMisc>
|
||||
<SLE66LinkerMisc></SLE66LinkerMisc>
|
||||
<SFDFile></SFDFile>
|
||||
<bCustSvd>0</bCustSvd>
|
||||
<UseEnv>0</UseEnv>
|
||||
<BinPath></BinPath>
|
||||
<IncludePath></IncludePath>
|
||||
@@ -43,14 +44,14 @@
|
||||
<NotGenerated>0</NotGenerated>
|
||||
<InvalidFlash>1</InvalidFlash>
|
||||
</TargetStatus>
|
||||
<OutputDirectory>.\obj\</OutputDirectory>
|
||||
<OutputDirectory>.\build\</OutputDirectory>
|
||||
<OutputName>rtthread-lpc</OutputName>
|
||||
<CreateExecutable>1</CreateExecutable>
|
||||
<CreateLib>0</CreateLib>
|
||||
<CreateHexFile>0</CreateHexFile>
|
||||
<DebugInformation>1</DebugInformation>
|
||||
<BrowseInformation>1</BrowseInformation>
|
||||
<ListingPath>.\obj\</ListingPath>
|
||||
<ListingPath>.\build\</ListingPath>
|
||||
<HexFormatSelection>1</HexFormatSelection>
|
||||
<Merge32K>0</Merge32K>
|
||||
<CreateBatchFile>0</CreateBatchFile>
|
||||
@@ -97,6 +98,7 @@
|
||||
<StopOnExitCode>3</StopOnExitCode>
|
||||
<CustomArgument></CustomArgument>
|
||||
<IncludeLibraryModules></IncludeLibraryModules>
|
||||
<ComprImg>1</ComprImg>
|
||||
</CommonProperty>
|
||||
<DllOption>
|
||||
<SimDllName>SARMCM3.DLL</SimDllName>
|
||||
@@ -130,7 +132,7 @@
|
||||
<Target>
|
||||
<UseTarget>1</UseTarget>
|
||||
<LoadApplicationAtStartup>1</LoadApplicationAtStartup>
|
||||
<RunToMain>0</RunToMain>
|
||||
<RunToMain>1</RunToMain>
|
||||
<RestoreBreakpoints>1</RestoreBreakpoints>
|
||||
<RestoreWatchpoints>1</RestoreWatchpoints>
|
||||
<RestoreMemoryDisplay>1</RestoreMemoryDisplay>
|
||||
@@ -165,9 +167,14 @@
|
||||
<Capability>1</Capability>
|
||||
<DriverSelection>4099</DriverSelection>
|
||||
</Flash1>
|
||||
<bUseTDR>1</bUseTDR>
|
||||
<Flash2>Segger\JL2CM3.dll</Flash2>
|
||||
<Flash3>"" ()</Flash3>
|
||||
<Flash4></Flash4>
|
||||
<pFcarmOut></pFcarmOut>
|
||||
<pFcarmGrp></pFcarmGrp>
|
||||
<pFcArmRoot></pFcArmRoot>
|
||||
<FcArmLst>0</FcArmLst>
|
||||
</Utilities>
|
||||
<TargetArmAds>
|
||||
<ArmAdsMisc>
|
||||
@@ -388,21 +395,6 @@
|
||||
</TargetArmAds>
|
||||
</TargetOption>
|
||||
<Groups>
|
||||
<Group>
|
||||
<GroupName>Applications</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>application.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>applications\application.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>startup.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>applications\startup.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>CMSIS</GroupName>
|
||||
<Files>
|
||||
@@ -423,6 +415,21 @@
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>Applications</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>application.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>applications\application.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>startup.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>applications\startup.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>Drivers</GroupName>
|
||||
<Files>
|
||||
@@ -576,6 +583,16 @@
|
||||
<Group>
|
||||
<GroupName>finsh</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>shell.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\components\finsh\shell.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>symbol.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\components\finsh\symbol.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>cmd.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
@@ -616,11 +633,6 @@
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\components\finsh\finsh_parser.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>finsh_token.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\components\finsh\finsh_token.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>finsh_var.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
@@ -632,24 +644,9 @@
|
||||
<FilePath>..\..\components\finsh\finsh_vm.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>msh.c</FileName>
|
||||
<FileName>finsh_token.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\components\finsh\msh.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>msh_cmd.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\components\finsh\msh_cmd.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>shell.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\components\finsh\shell.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>symbol.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\components\finsh\symbol.c</FilePath>
|
||||
<FilePath>..\..\components\finsh\finsh_token.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
|
||||
164
bsp/lpc178x/template.uvopt
Normal file
164
bsp/lpc178x/template.uvopt
Normal file
@@ -0,0 +1,164 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||
<ProjectOpt xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="project_opt.xsd">
|
||||
|
||||
<SchemaVersion>1.0</SchemaVersion>
|
||||
|
||||
<Header>### uVision Project, (C) Keil Software</Header>
|
||||
|
||||
<Extensions>
|
||||
<cExt>*.c</cExt>
|
||||
<aExt>*.s*; *.src; *.a*</aExt>
|
||||
<oExt>*.obj</oExt>
|
||||
<lExt>*.lib</lExt>
|
||||
<tExt>*.txt; *.h; *.inc</tExt>
|
||||
<pExt>*.plm</pExt>
|
||||
<CppX>*.cpp</CppX>
|
||||
</Extensions>
|
||||
|
||||
<DaveTm>
|
||||
<dwLowDateTime>0</dwLowDateTime>
|
||||
<dwHighDateTime>0</dwHighDateTime>
|
||||
</DaveTm>
|
||||
|
||||
<Target>
|
||||
<TargetName>RT-Thread LPC17xx</TargetName>
|
||||
<ToolsetNumber>0x4</ToolsetNumber>
|
||||
<ToolsetName>ARM-ADS</ToolsetName>
|
||||
<TargetOption>
|
||||
<CLKADS>12000000</CLKADS>
|
||||
<OPTTT>
|
||||
<gFlags>1</gFlags>
|
||||
<BeepAtEnd>1</BeepAtEnd>
|
||||
<RunSim>1</RunSim>
|
||||
<RunTarget>0</RunTarget>
|
||||
</OPTTT>
|
||||
<OPTHX>
|
||||
<HexSelection>1</HexSelection>
|
||||
<FlashByte>65535</FlashByte>
|
||||
<HexRangeLowAddress>0</HexRangeLowAddress>
|
||||
<HexRangeHighAddress>0</HexRangeHighAddress>
|
||||
<HexOffset>0</HexOffset>
|
||||
</OPTHX>
|
||||
<OPTLEX>
|
||||
<PageWidth>79</PageWidth>
|
||||
<PageLength>66</PageLength>
|
||||
<TabStop>8</TabStop>
|
||||
<ListingPath>.\build\</ListingPath>
|
||||
</OPTLEX>
|
||||
<ListingPage>
|
||||
<CreateCListing>1</CreateCListing>
|
||||
<CreateAListing>1</CreateAListing>
|
||||
<CreateLListing>1</CreateLListing>
|
||||
<CreateIListing>0</CreateIListing>
|
||||
<AsmCond>1</AsmCond>
|
||||
<AsmSymb>1</AsmSymb>
|
||||
<AsmXref>0</AsmXref>
|
||||
<CCond>1</CCond>
|
||||
<CCode>0</CCode>
|
||||
<CListInc>0</CListInc>
|
||||
<CSymb>0</CSymb>
|
||||
<LinkerCodeListing>0</LinkerCodeListing>
|
||||
</ListingPage>
|
||||
<OPTXL>
|
||||
<LMap>1</LMap>
|
||||
<LComments>1</LComments>
|
||||
<LGenerateSymbols>1</LGenerateSymbols>
|
||||
<LLibSym>1</LLibSym>
|
||||
<LLines>1</LLines>
|
||||
<LLocSym>1</LLocSym>
|
||||
<LPubSym>1</LPubSym>
|
||||
<LXref>0</LXref>
|
||||
<LExpSel>0</LExpSel>
|
||||
</OPTXL>
|
||||
<OPTFL>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<IsCurrentTarget>1</IsCurrentTarget>
|
||||
</OPTFL>
|
||||
<CpuCode>0</CpuCode>
|
||||
<DllOpt>
|
||||
<SimDllName>SARMCM3.DLL</SimDllName>
|
||||
<SimDllArguments>-MPU</SimDllArguments>
|
||||
<SimDlgDllName>DARMP1.DLL</SimDlgDllName>
|
||||
<SimDlgDllArguments>-pLPC1788</SimDlgDllArguments>
|
||||
<TargetDllName>SARMCM3.DLL</TargetDllName>
|
||||
<TargetDllArguments>-MPU</TargetDllArguments>
|
||||
<TargetDlgDllName>TARMP1.DLL</TargetDlgDllName>
|
||||
<TargetDlgDllArguments>-pLPC1788</TargetDlgDllArguments>
|
||||
</DllOpt>
|
||||
<DebugOpt>
|
||||
<uSim>0</uSim>
|
||||
<uTrg>1</uTrg>
|
||||
<sLdApp>1</sLdApp>
|
||||
<sGomain>1</sGomain>
|
||||
<sRbreak>1</sRbreak>
|
||||
<sRwatch>1</sRwatch>
|
||||
<sRmem>1</sRmem>
|
||||
<sRfunc>1</sRfunc>
|
||||
<sRbox>1</sRbox>
|
||||
<tLdApp>1</tLdApp>
|
||||
<tGomain>1</tGomain>
|
||||
<tRbreak>1</tRbreak>
|
||||
<tRwatch>1</tRwatch>
|
||||
<tRmem>1</tRmem>
|
||||
<tRfunc>0</tRfunc>
|
||||
<tRbox>1</tRbox>
|
||||
<tRtrace>0</tRtrace>
|
||||
<sRunDeb>0</sRunDeb>
|
||||
<sLrtime>0</sLrtime>
|
||||
<nTsel>7</nTsel>
|
||||
<sDll></sDll>
|
||||
<sDllPa></sDllPa>
|
||||
<sDlgDll></sDlgDll>
|
||||
<sDlgPa></sDlgPa>
|
||||
<sIfile></sIfile>
|
||||
<tDll></tDll>
|
||||
<tDllPa></tDllPa>
|
||||
<tDlgDll></tDlgDll>
|
||||
<tDlgPa></tDlgPa>
|
||||
<tIfile></tIfile>
|
||||
<pMon>Segger\JL2CM3.dll</pMon>
|
||||
</DebugOpt>
|
||||
<TargetDriverDllRegistry>
|
||||
<SetRegEntry>
|
||||
<Number>0</Number>
|
||||
<Key>UL2CM3</Key>
|
||||
<Name>UL2CM3(-O463 -S0 -C0 -FO7 -FD10000000 -FC800 -FN1 -FF0LPC_IAP_512 -FS00 -FL080000)</Name>
|
||||
</SetRegEntry>
|
||||
</TargetDriverDllRegistry>
|
||||
<Breakpoint/>
|
||||
<Tracepoint>
|
||||
<THDelay>0</THDelay>
|
||||
</Tracepoint>
|
||||
<DebugFlag>
|
||||
<trace>0</trace>
|
||||
<periodic>0</periodic>
|
||||
<aLwin>0</aLwin>
|
||||
<aCover>0</aCover>
|
||||
<aSer1>0</aSer1>
|
||||
<aSer2>0</aSer2>
|
||||
<aPa>0</aPa>
|
||||
<viewmode>0</viewmode>
|
||||
<vrSel>0</vrSel>
|
||||
<aSym>0</aSym>
|
||||
<aTbox>0</aTbox>
|
||||
<AscS1>0</AscS1>
|
||||
<AscS2>0</AscS2>
|
||||
<AscS3>0</AscS3>
|
||||
<aSer3>0</aSer3>
|
||||
<eProf>0</eProf>
|
||||
<aLa>0</aLa>
|
||||
<aPa1>0</aPa1>
|
||||
<AscS4>0</AscS4>
|
||||
<aSer4>0</aSer4>
|
||||
<StkLoc>0</StkLoc>
|
||||
<TrcWin>0</TrcWin>
|
||||
<newCpu>0</newCpu>
|
||||
<uProt>0</uProt>
|
||||
</DebugFlag>
|
||||
<LintExecutable></LintExecutable>
|
||||
<LintConfigFile></LintConfigFile>
|
||||
</TargetOption>
|
||||
</Target>
|
||||
|
||||
</ProjectOpt>
|
||||
@@ -30,6 +30,7 @@
|
||||
<SLE66AMisc></SLE66AMisc>
|
||||
<SLE66LinkerMisc></SLE66LinkerMisc>
|
||||
<SFDFile></SFDFile>
|
||||
<bCustSvd>0</bCustSvd>
|
||||
<UseEnv>0</UseEnv>
|
||||
<BinPath></BinPath>
|
||||
<IncludePath></IncludePath>
|
||||
@@ -43,14 +44,14 @@
|
||||
<NotGenerated>0</NotGenerated>
|
||||
<InvalidFlash>1</InvalidFlash>
|
||||
</TargetStatus>
|
||||
<OutputDirectory>.\obj\</OutputDirectory>
|
||||
<OutputDirectory>.\build\</OutputDirectory>
|
||||
<OutputName>rtthread-lpc</OutputName>
|
||||
<CreateExecutable>1</CreateExecutable>
|
||||
<CreateLib>0</CreateLib>
|
||||
<CreateHexFile>0</CreateHexFile>
|
||||
<DebugInformation>1</DebugInformation>
|
||||
<BrowseInformation>1</BrowseInformation>
|
||||
<ListingPath>.\obj\</ListingPath>
|
||||
<ListingPath>.\build\</ListingPath>
|
||||
<HexFormatSelection>1</HexFormatSelection>
|
||||
<Merge32K>0</Merge32K>
|
||||
<CreateBatchFile>0</CreateBatchFile>
|
||||
@@ -61,6 +62,8 @@
|
||||
<UserProg2Name></UserProg2Name>
|
||||
<UserProg1Dos16Mode>0</UserProg1Dos16Mode>
|
||||
<UserProg2Dos16Mode>0</UserProg2Dos16Mode>
|
||||
<nStopU1X>0</nStopU1X>
|
||||
<nStopU2X>0</nStopU2X>
|
||||
</BeforeCompile>
|
||||
<BeforeMake>
|
||||
<RunUserProg1>0</RunUserProg1>
|
||||
@@ -95,6 +98,7 @@
|
||||
<StopOnExitCode>3</StopOnExitCode>
|
||||
<CustomArgument></CustomArgument>
|
||||
<IncludeLibraryModules></IncludeLibraryModules>
|
||||
<ComprImg>1</ComprImg>
|
||||
</CommonProperty>
|
||||
<DllOption>
|
||||
<SimDllName>SARMCM3.DLL</SimDllName>
|
||||
@@ -128,12 +132,13 @@
|
||||
<Target>
|
||||
<UseTarget>1</UseTarget>
|
||||
<LoadApplicationAtStartup>1</LoadApplicationAtStartup>
|
||||
<RunToMain>0</RunToMain>
|
||||
<RunToMain>1</RunToMain>
|
||||
<RestoreBreakpoints>1</RestoreBreakpoints>
|
||||
<RestoreWatchpoints>1</RestoreWatchpoints>
|
||||
<RestoreMemoryDisplay>1</RestoreMemoryDisplay>
|
||||
<RestoreFunctions>0</RestoreFunctions>
|
||||
<RestoreToolbox>1</RestoreToolbox>
|
||||
<RestoreTracepoints>0</RestoreTracepoints>
|
||||
</Target>
|
||||
<RunDebugAfterBuild>0</RunDebugAfterBuild>
|
||||
<TargetSelection>7</TargetSelection>
|
||||
@@ -162,9 +167,14 @@
|
||||
<Capability>1</Capability>
|
||||
<DriverSelection>4099</DriverSelection>
|
||||
</Flash1>
|
||||
<bUseTDR>1</bUseTDR>
|
||||
<Flash2>Segger\JL2CM3.dll</Flash2>
|
||||
<Flash3>"" ()</Flash3>
|
||||
<Flash4></Flash4>
|
||||
<pFcarmOut></pFcarmOut>
|
||||
<pFcarmGrp></pFcarmGrp>
|
||||
<pFcArmRoot></pFcArmRoot>
|
||||
<FcArmLst>0</FcArmLst>
|
||||
</Utilities>
|
||||
<TargetArmAds>
|
||||
<ArmAdsMisc>
|
||||
@@ -342,6 +352,7 @@
|
||||
<Rwpi>0</Rwpi>
|
||||
<wLevel>0</wLevel>
|
||||
<uThumb>0</uThumb>
|
||||
<uSurpInc>0</uSurpInc>
|
||||
<VariousControls>
|
||||
<MiscControls></MiscControls>
|
||||
<Define></Define>
|
||||
@@ -357,6 +368,7 @@
|
||||
<SplitLS>0</SplitLS>
|
||||
<SwStkChk>0</SwStkChk>
|
||||
<NoWarn>0</NoWarn>
|
||||
<uSurpInc>0</uSurpInc>
|
||||
<VariousControls>
|
||||
<MiscControls></MiscControls>
|
||||
<Define></Define>
|
||||
|
||||
@@ -100,9 +100,6 @@ void rtthread_startup(void)
|
||||
|
||||
/* init hardware serial device */
|
||||
rt_hw_serial_init();
|
||||
|
||||
/*init all registed devices*/
|
||||
rt_device_init_all();
|
||||
#endif
|
||||
|
||||
/* init application */
|
||||
|
||||
@@ -102,18 +102,18 @@ __cs3_interrupt_vector_cortex_m:
|
||||
.long DMA_IRQHandler /* 42: General Purpose DMA */
|
||||
.long I2S_IRQHandler /* 43: I2S */
|
||||
.long ENET_IRQHandler /* 44: Ethernet */
|
||||
.long MCI_IRQHandler /* 45: SD/MMC Card */
|
||||
.long MCI_IRQHandler /* 45: SD/MMC Card */
|
||||
.long MCPWM_IRQHandler /* 46: Motor Control PWM */
|
||||
.long QEI_IRQHandler /* 47: Quadrature Encoder Interface */
|
||||
.long PLL1_IRQHandler /* 48: PLL1 Lock (USB PLL) */
|
||||
.long USBActivity_IRQHandler /* 49: USB Activity */
|
||||
.long CANActivity_IRQHandler /* 50: CAN Activity */
|
||||
.long UART4_IRQHandler /* 51: UART4 */
|
||||
.long SSP2_IRQHandler /* 52: SSP2 */
|
||||
.long LCD_IRQHandler /* 53: LCD */
|
||||
.long GPIO_IRQHandler /* 54: GPIO */
|
||||
.long PWM0_IRQHandler /* 55: PWM0 */
|
||||
.long EEPROM_IRQHandler /* 56: EEPROM */
|
||||
.long USBActivity_IRQHandler /* 49: USB Activity */
|
||||
.long CANActivity_IRQHandler /* 50: CAN Activity */
|
||||
.long UART4_IRQHandler /* 51: UART4 */
|
||||
.long SSP2_IRQHandler /* 52: SSP2 */
|
||||
.long LCD_IRQHandler /* 53: LCD */
|
||||
.long GPIO_IRQHandler /* 54: GPIO */
|
||||
.long PWM0_IRQHandler /* 55: PWM0 */
|
||||
.long EEPROM_IRQHandler /* 56: EEPROM */
|
||||
|
||||
.size __cs3_interrupt_vector_cortex_m, . - __cs3_interrupt_vector_cortex_m
|
||||
|
||||
@@ -130,22 +130,24 @@ CRP_Value:
|
||||
.section .cs3.reset,"x",%progbits
|
||||
.thumb_func
|
||||
.globl __cs3_reset_cortex_m
|
||||
.globl Reset_Handler
|
||||
.type __cs3_reset_cortex_m, %function
|
||||
__cs3_reset_cortex_m:
|
||||
Reset_Handler:
|
||||
.fnstart
|
||||
.ifdef RAM_MODE
|
||||
/* Clear .bss section (Zero init) */
|
||||
MOV R0, #0
|
||||
LDR R1, =__bss_start__
|
||||
LDR R2, =__bss_end__
|
||||
CMP R1,R2
|
||||
BEQ BSSIsEmpty
|
||||
MOV R0, #0
|
||||
LDR R1, =__bss_start__
|
||||
LDR R2, =__bss_end__
|
||||
CMP R1,R2
|
||||
BEQ BSSIsEmpty
|
||||
LoopZI:
|
||||
CMP R1, R2
|
||||
BHS BSSIsEmpty
|
||||
STR R0, [R1]
|
||||
ADD R1, #4
|
||||
BLO LoopZI
|
||||
CMP R1, R2
|
||||
BHS BSSIsEmpty
|
||||
STR R0, [R1]
|
||||
ADD R1, #4
|
||||
BLO LoopZI
|
||||
BSSIsEmpty:
|
||||
LDR R0, =SystemInit
|
||||
BLX R0
|
||||
@@ -154,7 +156,7 @@ BSSIsEmpty:
|
||||
.else
|
||||
LDR R0, =SystemInit
|
||||
BLX R0
|
||||
LDR R0,=_start
|
||||
LDR R0,=main
|
||||
BX R0
|
||||
.endif
|
||||
.pool
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
#include <rtthread.h>
|
||||
#include "board.h"
|
||||
#include "drv_led.h"
|
||||
|
||||
#define RT_DEVICE_CTRL_RTC_GET_COUNT 0x81 /**< get count */
|
||||
#define LED_DEVICE_CTRL 0x01 /*LED control command*/
|
||||
|
||||
#define LED_NUM 4
|
||||
struct led_ctrl
|
||||
@@ -92,11 +93,11 @@ static rt_size_t rt_led_write(rt_device_t dev, rt_off_t pos,
|
||||
{
|
||||
if (*value++)
|
||||
{
|
||||
led.ctrl[pos + index].port->CLR |= (1 << led.ctrl[pos + index].num);
|
||||
led.ctrl[pos + index].port->CLR = (1 << led.ctrl[pos + index].num);
|
||||
}
|
||||
else
|
||||
{
|
||||
led.ctrl[pos + index].port->SET |= (1 << led.ctrl[pos + index].num);
|
||||
led.ctrl[pos + index].port->SET = (1 << led.ctrl[pos + index].num);
|
||||
}
|
||||
}
|
||||
return index;
|
||||
@@ -106,7 +107,7 @@ static rt_err_t rt_led_control(rt_device_t dev, rt_uint8_t cmd, void *args)
|
||||
{
|
||||
RT_ASSERT(dev == &led.parent);
|
||||
|
||||
if (cmd == RT_DEVICE_CTRL_RTC_GET_COUNT)
|
||||
if (cmd == LED_DEVICE_CTRL)
|
||||
{
|
||||
rt_uint32_t *led_num = args;
|
||||
*led_num = LED_NUM;
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
#ifndef __DRV_LED_H
|
||||
#define __DRV_LED_H
|
||||
|
||||
#define LED_DEVICE_CTRL 0x01 /*LED control command*/
|
||||
|
||||
void rt_led_hw_init(void);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -33,14 +33,11 @@ void rt_init_thread_entry(void *parameter)
|
||||
|
||||
/* init Display Controller */
|
||||
rt_hw_dc_init();
|
||||
|
||||
/* re-init device driver */
|
||||
rt_device_init_all();
|
||||
|
||||
|
||||
/* find Display Controller device */
|
||||
dc = rt_device_find("dc");
|
||||
|
||||
/* set Display Controller device as rtgui graphic driver */
|
||||
|
||||
/* set Display Controller device as rtgui graphic driver */
|
||||
rtgui_graphic_set_device(dc);
|
||||
}
|
||||
#endif
|
||||
@@ -59,7 +56,7 @@ int rt_application_init(void)
|
||||
tid = rt_thread_create("init",
|
||||
rt_init_thread_entry, RT_NULL,
|
||||
4096, 8, 20);
|
||||
if (tid != RT_NULL)
|
||||
if (tid != RT_NULL)
|
||||
rt_thread_startup(tid);
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -64,11 +64,6 @@ void rtthread_startup(void)
|
||||
/* init scheduler system */
|
||||
rt_system_scheduler_init();
|
||||
|
||||
#ifdef RT_USING_DEVICE
|
||||
/* init all device */
|
||||
rt_device_init_all();
|
||||
#endif
|
||||
|
||||
/* init application */
|
||||
rt_application_init();
|
||||
|
||||
|
||||
@@ -46,6 +46,12 @@ SECTIONS
|
||||
KEEP(*(VSymTab))
|
||||
__vsymtab_end = .;
|
||||
. = ALIGN(4);
|
||||
|
||||
. = ALIGN(4);
|
||||
__rt_init_start = .;
|
||||
KEEP(*(SORT(.rti_fn*)))
|
||||
__rt_init_end = .;
|
||||
. = ALIGN(4);
|
||||
}
|
||||
|
||||
. = ALIGN(4);
|
||||
|
||||
@@ -42,7 +42,7 @@ void rtthread_startup(void)
|
||||
{
|
||||
/* init hardware interrupt */
|
||||
rt_hw_interrupt_init();
|
||||
|
||||
|
||||
/* init board */
|
||||
rt_hw_board_init();
|
||||
|
||||
@@ -51,13 +51,13 @@ void rtthread_startup(void)
|
||||
|
||||
/* init tick */
|
||||
rt_system_tick_init();
|
||||
|
||||
|
||||
/* init kernel object */
|
||||
rt_system_object_init();
|
||||
|
||||
|
||||
/* init timer system */
|
||||
rt_system_timer_init();
|
||||
|
||||
|
||||
#ifdef RT_USING_HEAP
|
||||
#ifdef __ICCM16C__
|
||||
rt_system_heap_init(__segment_begin("DATA16_HEAP"), __segment_end("DATA16_HEAP"));
|
||||
@@ -68,11 +68,6 @@ void rtthread_startup(void)
|
||||
|
||||
/* init scheduler system */
|
||||
rt_system_scheduler_init();
|
||||
|
||||
#ifdef RT_USING_DEVICE
|
||||
/* init all device */
|
||||
rt_device_init_all();
|
||||
#endif
|
||||
|
||||
/* init application */
|
||||
rt_application_init();
|
||||
@@ -88,10 +83,10 @@ void rtthread_startup(void)
|
||||
|
||||
/* init idle thread */
|
||||
rt_thread_idle_init();
|
||||
|
||||
|
||||
/* start scheduler */
|
||||
rt_system_scheduler_start();
|
||||
|
||||
|
||||
/* never reach here */
|
||||
return ;
|
||||
}
|
||||
@@ -103,7 +98,7 @@ int main(void)
|
||||
|
||||
/* init system setting */
|
||||
system_init();
|
||||
|
||||
|
||||
/* startup RT-Thread RTOS */
|
||||
rtthread_startup();
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
/**
|
||||
* @addtogroup FM3
|
||||
*/
|
||||
|
||||
|
||||
/*@{*/
|
||||
|
||||
#include <rtthread.h>
|
||||
@@ -37,48 +37,45 @@ static char msg_pool[2048];
|
||||
|
||||
void rt_init_thread_entry(void *parameter)
|
||||
{
|
||||
rt_device_t lcd;
|
||||
|
||||
rt_device_t lcd;
|
||||
|
||||
rt_hw_led_init();
|
||||
rt_hw_key_init();
|
||||
rt_hw_adc_init();
|
||||
rt_hw_lcd_init();
|
||||
rt_hw_lcd_init();
|
||||
rt_hw_cpu_init();
|
||||
|
||||
/* re-init device driver */
|
||||
rt_device_init_all();
|
||||
|
||||
|
||||
#ifdef RT_USING_RTGUI
|
||||
extern void rtgui_system_server_init(void);
|
||||
|
||||
/* find lcd device */
|
||||
lcd = rt_device_find("lcd");
|
||||
|
||||
/* set lcd device as rtgui graphic driver */
|
||||
lcd = rt_device_find("lcd");
|
||||
|
||||
/* set lcd device as rtgui graphic driver */
|
||||
rtgui_graphic_set_device(lcd);
|
||||
|
||||
/* init rtgui system server */
|
||||
rtgui_system_server_init();
|
||||
|
||||
|
||||
/* startup rtgui */
|
||||
rtgui_startup();
|
||||
#else
|
||||
{
|
||||
char buf[20] = {'\0'};
|
||||
struct lcd_msg msg;
|
||||
rt_device_t device;
|
||||
rt_device_t device;
|
||||
device = rt_device_find("lcd");
|
||||
rt_device_control(device, RT_DEVICE_CTRL_LCD_CLEAR_SCR, RT_NULL);
|
||||
x = 1;
|
||||
y = 1;
|
||||
rt_device_control(device, RT_DEVICE_CTRL_LCD_PUT_STRING, "ADC");
|
||||
rt_device_control(device, RT_DEVICE_CTRL_LCD_PUT_STRING, "ADC");
|
||||
x = 1;
|
||||
y = 20;
|
||||
rt_device_control(device, RT_DEVICE_CTRL_LCD_PUT_STRING, "CPU");
|
||||
x = 1;
|
||||
y = 40;
|
||||
rt_device_control(device, RT_DEVICE_CTRL_LCD_PUT_STRING, "KEY");
|
||||
|
||||
|
||||
while(1)
|
||||
{
|
||||
if (rt_mq_recv(&mq, &msg, sizeof(msg), RT_WAITING_FOREVER) == RT_EOK)
|
||||
@@ -90,14 +87,14 @@ void rt_init_thread_entry(void *parameter)
|
||||
y = 1;
|
||||
rt_memset(buf, 0, sizeof(buf));
|
||||
rt_sprintf(buf, "%04d", msg.adc_value);
|
||||
rt_device_control(device, RT_DEVICE_CTRL_LCD_PUT_STRING, buf);
|
||||
rt_device_control(device, RT_DEVICE_CTRL_LCD_PUT_STRING, buf);
|
||||
break;
|
||||
case CPU_MSG:
|
||||
x = 40;
|
||||
y = 20;
|
||||
rt_memset(buf, 0, sizeof(buf));
|
||||
rt_sprintf(buf, "%03d %03d", msg.major, msg.minor);
|
||||
rt_device_control(device, RT_DEVICE_CTRL_LCD_PUT_STRING, buf);
|
||||
rt_device_control(device, RT_DEVICE_CTRL_LCD_PUT_STRING, buf);
|
||||
break;
|
||||
case KEY_MSG:
|
||||
x = 40;
|
||||
@@ -110,22 +107,22 @@ void rt_init_thread_entry(void *parameter)
|
||||
break;
|
||||
case KEY_UP:
|
||||
rt_sprintf(buf, "UP KEY ");
|
||||
break;
|
||||
break;
|
||||
case KEY_RIGHT:
|
||||
rt_sprintf(buf, "RIGHT KEY");
|
||||
break;
|
||||
case KEY_LEFT:
|
||||
rt_sprintf(buf, "LEFT KEY ");
|
||||
break;
|
||||
break;
|
||||
case KEY_ENTER:
|
||||
rt_sprintf(buf, "ENTER KEY");
|
||||
break;
|
||||
default:
|
||||
rt_sprintf(buf, "NO KEY ");
|
||||
break;
|
||||
break;
|
||||
}
|
||||
rt_device_control(device, RT_DEVICE_CTRL_LCD_PUT_STRING, buf);
|
||||
break;
|
||||
rt_device_control(device, RT_DEVICE_CTRL_LCD_PUT_STRING, buf);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -138,11 +135,11 @@ int rt_application_init(void)
|
||||
rt_thread_t init_thread;
|
||||
|
||||
rt_mq_init(&mq, "mqt", &msg_pool[0], 128 - sizeof(void*), sizeof(msg_pool), RT_IPC_FLAG_FIFO);
|
||||
|
||||
|
||||
init_thread = rt_thread_create("init", rt_init_thread_entry, RT_NULL, 1024, 21, 20);
|
||||
if(init_thread != RT_NULL)
|
||||
rt_thread_startup(init_thread);
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -67,11 +67,6 @@ void rtthread_startup(void)
|
||||
/* init scheduler system */
|
||||
rt_system_scheduler_init();
|
||||
|
||||
#ifdef RT_USING_DEVICE
|
||||
/* init all device */
|
||||
rt_device_init_all();
|
||||
#endif
|
||||
|
||||
/* init application */
|
||||
rt_application_init();
|
||||
|
||||
@@ -97,7 +92,7 @@ int main(void)
|
||||
|
||||
/* init system setting */
|
||||
SystemInit();
|
||||
|
||||
|
||||
/* startup RT-Thread RTOS */
|
||||
rtthread_startup();
|
||||
|
||||
|
||||
@@ -59,13 +59,9 @@ void rtthread_startup(void)
|
||||
rt_system_scheduler_init();
|
||||
|
||||
#ifdef RT_USING_DEVICE
|
||||
#ifdef RT_USING_DFS
|
||||
#ifdef RT_USING_DFS_UFFS
|
||||
#if defined(RT_USING_DFS) && defined(RT_USING_DFS_UFFS)
|
||||
rt_hw_nand_init();
|
||||
#endif
|
||||
#endif
|
||||
/* initialize all device */
|
||||
rt_device_init_all();
|
||||
#endif
|
||||
|
||||
/* initialize application */
|
||||
@@ -91,7 +87,7 @@ int main(void)
|
||||
{
|
||||
/* disable interrupt first */
|
||||
rt_hw_interrupt_disable();
|
||||
|
||||
|
||||
/* startup RT-Thread RTOS */
|
||||
rtthread_startup();
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ void rtthread_startup(void)
|
||||
|
||||
/* init board */
|
||||
rt_hw_board_init();
|
||||
|
||||
|
||||
rt_show_version();
|
||||
|
||||
/* init tick */
|
||||
@@ -86,8 +86,6 @@ void rtthread_startup(void)
|
||||
#ifdef RT_USING_DEVICE
|
||||
/* init hardware serial device */
|
||||
rt_hw_serial_init();
|
||||
/* init all device */
|
||||
rt_device_init_all();
|
||||
#endif
|
||||
|
||||
/* init application */
|
||||
@@ -113,7 +111,7 @@ int main (void)
|
||||
{
|
||||
/* invoke rtthread_startup */
|
||||
rtthread_startup();
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
/**
|
||||
* @addtogroup mini2440
|
||||
*/
|
||||
|
||||
|
||||
/*@{*/
|
||||
|
||||
#include <rtthread.h>
|
||||
@@ -142,23 +142,20 @@ void rt_init_thread_entry(void *parameter)
|
||||
extern void rtgui_system_server_init(void);
|
||||
|
||||
rt_device_t lcd;
|
||||
|
||||
|
||||
/* init lcd */
|
||||
rt_hw_lcd_init();
|
||||
|
||||
|
||||
/* init touch panel */
|
||||
rtgui_touch_hw_init();
|
||||
rtgui_touch_hw_init();
|
||||
|
||||
/* init keypad */
|
||||
rt_hw_key_init();
|
||||
|
||||
/* re-init device driver */
|
||||
rt_device_init_all();
|
||||
|
||||
/* find lcd device */
|
||||
lcd = rt_device_find("lcd");
|
||||
|
||||
/* set lcd device as rtgui graphic driver */
|
||||
/* set lcd device as rtgui graphic driver */
|
||||
rtgui_graphic_set_device(lcd);
|
||||
|
||||
/* initalize rtgui system server */
|
||||
@@ -175,9 +172,6 @@ void rt_init_thread_entry(void *parameter)
|
||||
/* register ethernetif device */
|
||||
rt_hw_dm9000_init();
|
||||
|
||||
/* re-init device driver */
|
||||
rt_device_init_all();
|
||||
|
||||
/* init lwip system */
|
||||
lwip_sys_init();
|
||||
rt_kprintf("TCP/IP initialized!\n");
|
||||
@@ -192,22 +186,19 @@ void rt_init_thread_entry(void *parameter)
|
||||
rt_hw_lcd_init();
|
||||
|
||||
/* init touch panel */
|
||||
rtgui_touch_hw_init();
|
||||
rtgui_touch_hw_init();
|
||||
|
||||
/* init keypad */
|
||||
rt_hw_key_init();
|
||||
|
||||
/* re-init device driver */
|
||||
rt_device_init_all();
|
||||
|
||||
/* create ftk thread */
|
||||
ftk_thread = rt_thread_create("ftk",
|
||||
rt_ftk_thread_entry, RT_NULL,
|
||||
10 * 1024, 8, 20);
|
||||
10 * 1024, 8, 20);
|
||||
|
||||
/* startup ftk thread */
|
||||
if (ftk_thread != RT_NULL)
|
||||
rt_thread_startup(ftk_thread);
|
||||
rt_thread_startup(ftk_thread);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -126,9 +126,6 @@ void rtthread_startup(void)
|
||||
|
||||
/* rtc init */
|
||||
rt_hw_rtc_init();
|
||||
|
||||
/*init all registed devices */
|
||||
rt_device_init_all();
|
||||
#endif
|
||||
|
||||
/* init application */
|
||||
|
||||
@@ -48,7 +48,7 @@ void rtthread_startup()
|
||||
|
||||
/* show version */
|
||||
rt_show_version();
|
||||
|
||||
|
||||
/* init tick */
|
||||
rt_system_tick_init();
|
||||
|
||||
@@ -65,12 +65,10 @@ void rtthread_startup()
|
||||
rt_system_heap_init(&__bss_end, (void*)0x34000000);
|
||||
#endif
|
||||
|
||||
|
||||
/* init scheduler system */
|
||||
rt_system_scheduler_init();
|
||||
|
||||
#ifdef RT_USING_DEVICE
|
||||
|
||||
#ifdef RT_USING_DFS
|
||||
rt_hw_sdcard_init();
|
||||
#endif
|
||||
@@ -79,9 +77,6 @@ void rtthread_startup()
|
||||
eth_system_device_init();
|
||||
rt_hw_dm9161_init();
|
||||
#endif
|
||||
|
||||
/*init all registed devices */
|
||||
rt_device_init_all();
|
||||
#endif
|
||||
|
||||
/* init application */
|
||||
@@ -103,21 +98,15 @@ void rtthread_startup()
|
||||
|
||||
/* never reach here */
|
||||
return ;
|
||||
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
rt_uint32_t UNUSED level;
|
||||
|
||||
/* disable interrupt first */
|
||||
level = rt_hw_interrupt_disable();
|
||||
rt_hw_interrupt_disable();
|
||||
|
||||
/* startup RT-Thread RTOS */
|
||||
rtthread_startup();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -71,11 +71,6 @@ void rtthread_startup(void)
|
||||
rt_thread_idle_sethook(rt_hw_led_flash);
|
||||
#endif
|
||||
|
||||
#ifdef RT_USING_DEVICE
|
||||
/* init all device */
|
||||
rt_device_init_all();
|
||||
#endif
|
||||
|
||||
/* init application */
|
||||
rt_application_init();
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ void rtthread_startup(void)
|
||||
|
||||
/* init board */
|
||||
rt_hw_board_init();
|
||||
|
||||
|
||||
rt_show_version();
|
||||
|
||||
/* init tick */
|
||||
@@ -86,8 +86,6 @@ void rtthread_startup(void)
|
||||
#ifdef RT_USING_DEVICE
|
||||
/* init hardware serial device */
|
||||
rt_hw_serial_init();
|
||||
/* init all device */
|
||||
rt_device_init_all();
|
||||
#endif
|
||||
|
||||
/* init application */
|
||||
@@ -113,7 +111,7 @@ int main (void)
|
||||
{
|
||||
/* invoke rtthread_startup */
|
||||
rtthread_startup();
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -116,9 +116,6 @@ void rtthread_startup(void)
|
||||
#ifdef RT_USING_DFS
|
||||
rt_hw_sdcard_init();
|
||||
#endif
|
||||
|
||||
/*init all registed devices*/
|
||||
rt_device_init_all();
|
||||
#endif
|
||||
|
||||
/* init application */
|
||||
|
||||
@@ -78,20 +78,6 @@ void rtthread_startup()
|
||||
/* init scheduler system */
|
||||
rt_system_scheduler_init();
|
||||
|
||||
#ifdef RT_USING_DEVICE
|
||||
|
||||
#ifdef RT_USING_DFS
|
||||
/* Not implemented */
|
||||
#endif
|
||||
|
||||
#ifdef RT_USING_LWIP
|
||||
/* Not implemented */
|
||||
#endif
|
||||
|
||||
/*init all registed devices */
|
||||
rt_device_init_all();
|
||||
#endif
|
||||
|
||||
/* init application */
|
||||
rt_application_init();
|
||||
|
||||
|
||||
@@ -58,10 +58,6 @@ void rtthread_startup(void)
|
||||
/* init scheduler system */
|
||||
rt_system_scheduler_init();
|
||||
|
||||
/* init all device */
|
||||
#ifdef RT_USING_DEVICE
|
||||
rt_device_init_all();
|
||||
#endif
|
||||
/* init application */
|
||||
rt_application_init();
|
||||
|
||||
|
||||
@@ -86,11 +86,6 @@ void rtthread_startup(void)
|
||||
/* init scheduler system */
|
||||
rt_system_scheduler_init();
|
||||
|
||||
#ifdef RT_USING_DEVICE
|
||||
/* init all device */
|
||||
rt_device_init_all();
|
||||
#endif
|
||||
|
||||
/* init application */
|
||||
rt_application_init();
|
||||
|
||||
|
||||
@@ -22,11 +22,20 @@
|
||||
|
||||
#ifdef RT_USING_DFS
|
||||
#include <dfs_fs.h>
|
||||
#include <dfs_init.h>
|
||||
#include <dfs_elm.h>
|
||||
#endif
|
||||
|
||||
#ifdef RT_USING_COMPONENTS_INIT
|
||||
#include <components.h>
|
||||
#endif /* RT_USING_COMPONENTS_INIT */
|
||||
#ifdef RT_USING_LWIP
|
||||
#include <stm32_eth.h>
|
||||
#include <netif/ethernetif.h>
|
||||
extern int lwip_system_init(void);
|
||||
#endif
|
||||
|
||||
#ifdef RT_USING_FINSH
|
||||
#include <shell.h>
|
||||
#include <finsh.h>
|
||||
#endif
|
||||
|
||||
void rt_init_thread_entry(void* parameter)
|
||||
{
|
||||
@@ -35,45 +44,50 @@ void rt_init_thread_entry(void* parameter)
|
||||
rt_platform_init();
|
||||
}
|
||||
|
||||
#ifdef RT_USING_COMPONENTS_INIT
|
||||
/* initialization RT-Thread Components */
|
||||
rt_components_init();
|
||||
#endif
|
||||
|
||||
/* Filesystem Initialization */
|
||||
#if defined(RT_USING_DFS) && defined(RT_USING_DFS_ELMFAT)
|
||||
/* initialize the device file system */
|
||||
dfs_init();
|
||||
|
||||
/* initialize the elm chan FatFS file system*/
|
||||
elm_init();
|
||||
|
||||
/* mount sd card fat partition 1 as root directory */
|
||||
if (dfs_mount("sd0", "/", "elm", 0, 0) == 0)
|
||||
{
|
||||
/* mount sd card fat partition 1 as root directory */
|
||||
if (dfs_mount("sd0", "/", "elm", 0, 0) == 0)
|
||||
{
|
||||
rt_kprintf("File System initialized!\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
rt_kprintf("File System initialzation failed!\n");
|
||||
}
|
||||
rt_kprintf("File System initialized!\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
rt_kprintf("File System initialzation failed!\n");
|
||||
}
|
||||
#endif /* RT_USING_DFS && RT_USING_DFS_ELMFAT */
|
||||
|
||||
#ifdef RT_USING_LWIP
|
||||
/* initialize lwip stack */
|
||||
/* register ethernetif device */
|
||||
eth_system_device_init();
|
||||
|
||||
/* initialize lwip system */
|
||||
lwip_system_init();
|
||||
rt_kprintf("TCP/IP initialized!\n");
|
||||
#endif
|
||||
|
||||
#ifdef RT_USING_FINSH
|
||||
/* initialize finsh */
|
||||
finsh_system_init();
|
||||
finsh_set_device(RT_CONSOLE_DEVICE_NAME);
|
||||
#endif
|
||||
}
|
||||
|
||||
int rt_application_init(void)
|
||||
{
|
||||
rt_thread_t init_thread;
|
||||
rt_thread_t tid;
|
||||
|
||||
#if (RT_THREAD_PRIORITY_MAX == 32)
|
||||
init_thread = rt_thread_create("init",
|
||||
rt_init_thread_entry, RT_NULL,
|
||||
2048, 8, 20);
|
||||
#else
|
||||
init_thread = rt_thread_create("init",
|
||||
rt_init_thread_entry, RT_NULL,
|
||||
2048, 80, 20);
|
||||
#endif
|
||||
|
||||
if (init_thread != RT_NULL)
|
||||
{
|
||||
rt_thread_startup(init_thread);
|
||||
}
|
||||
tid = rt_thread_create("init",
|
||||
rt_init_thread_entry, RT_NULL,
|
||||
2048, RT_THREAD_PRIORITY_MAX/3, 20);
|
||||
if (tid != RT_NULL) rt_thread_startup(tid);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -81,9 +81,6 @@ void rtthread_startup(void)
|
||||
/* init scheduler system */
|
||||
rt_system_scheduler_init();
|
||||
|
||||
/* init all device */
|
||||
rt_device_init_all();
|
||||
|
||||
/* init application */
|
||||
rt_application_init();
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -30,6 +30,7 @@
|
||||
<SLE66AMisc></SLE66AMisc>
|
||||
<SLE66LinkerMisc></SLE66LinkerMisc>
|
||||
<SFDFile>SFD\ST\STM32F107x\STM32F107.sfr</SFDFile>
|
||||
<bCustSvd>0</bCustSvd>
|
||||
<UseEnv>0</UseEnv>
|
||||
<BinPath></BinPath>
|
||||
<IncludePath></IncludePath>
|
||||
@@ -97,6 +98,7 @@
|
||||
<StopOnExitCode>3</StopOnExitCode>
|
||||
<CustomArgument></CustomArgument>
|
||||
<IncludeLibraryModules></IncludeLibraryModules>
|
||||
<ComprImg>1</ComprImg>
|
||||
</CommonProperty>
|
||||
<DllOption>
|
||||
<SimDllName>SARMCM3.DLL</SimDllName>
|
||||
@@ -161,13 +163,18 @@
|
||||
<UseTargetDll>1</UseTargetDll>
|
||||
<UseExternalTool>0</UseExternalTool>
|
||||
<RunIndependent>0</RunIndependent>
|
||||
<UpdateFlashBeforeDebugging>0</UpdateFlashBeforeDebugging>
|
||||
<UpdateFlashBeforeDebugging>1</UpdateFlashBeforeDebugging>
|
||||
<Capability>1</Capability>
|
||||
<DriverSelection>4099</DriverSelection>
|
||||
</Flash1>
|
||||
<bUseTDR>1</bUseTDR>
|
||||
<Flash2>Segger\JL2CM3.dll</Flash2>
|
||||
<Flash3>"" ()</Flash3>
|
||||
<Flash4></Flash4>
|
||||
<pFcarmOut></pFcarmOut>
|
||||
<pFcarmGrp></pFcarmGrp>
|
||||
<pFcArmRoot></pFcArmRoot>
|
||||
<FcArmLst>0</FcArmLst>
|
||||
</Utilities>
|
||||
<TargetArmAds>
|
||||
<ArmAdsMisc>
|
||||
@@ -350,7 +357,7 @@
|
||||
<MiscControls></MiscControls>
|
||||
<Define>STM32F10X_CL, USE_STDPERIPH_DRIVER</Define>
|
||||
<Undefine></Undefine>
|
||||
<IncludePath>.;..\..\components\CMSIS\Include;..\..\components\dfs;..\..\components\dfs\include;..\..\components\drivers\include;..\..\components\finsh;..\..\components\init;..\..\components\net\lwip\src;..\..\components\net\lwip\src\arch\include;..\..\components\net\lwip\src\include;..\..\components\net\lwip\src\include\ipv4;..\..\components\net\lwip\src\include\netif;..\..\include;..\..\libcpu\arm\common;..\..\libcpu\arm\cortex-m3;Libraries\CMSIS\CM3\DeviceSupport\ST\STM32F10x;Libraries\STM32F10x_StdPeriph_Driver\inc;applications;drivers</IncludePath>
|
||||
<IncludePath>.;..\..\components\CMSIS\Include;..\..\components\dfs;..\..\components\dfs\include;..\..\components\drivers\include;..\..\components\finsh;..\..\components\net\lwip-1.4.1\src;..\..\components\net\lwip-1.4.1\src\arch\include;..\..\components\net\lwip-1.4.1\src\include;..\..\components\net\lwip-1.4.1\src\include\ipv4;..\..\components\net\lwip-1.4.1\src\include\netif;..\..\include;..\..\libcpu\arm\common;..\..\libcpu\arm\cortex-m3;Libraries\CMSIS\CM3\DeviceSupport\ST\STM32F10x;Libraries\STM32F10x_StdPeriph_Driver\inc;applications;drivers</IncludePath>
|
||||
</VariousControls>
|
||||
</Cads>
|
||||
<Aads>
|
||||
@@ -388,66 +395,6 @@
|
||||
</TargetArmAds>
|
||||
</TargetOption>
|
||||
<Groups>
|
||||
<Group>
|
||||
<GroupName>Applications</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>application.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>applications\application.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>startup.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>applications\startup.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>Drivers</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>board.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>drivers\board.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>msd.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>drivers\msd.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>platform.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>drivers\platform.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>rt_stm32f10x_spi.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>drivers\rt_stm32f10x_spi.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>serial.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>drivers\serial.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>stm32_eth.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>drivers\stm32_eth.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>stm32f10x_it.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>drivers\stm32f10x_it.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>usart.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>drivers\usart.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>STM32_StdPeriph</GroupName>
|
||||
<Files>
|
||||
@@ -578,6 +525,66 @@
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>Applications</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>application.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>applications\application.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>startup.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>applications\startup.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>Drivers</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>board.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>drivers\board.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>msd.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>drivers\msd.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>platform.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>drivers\platform.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>rt_stm32f10x_spi.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>drivers\rt_stm32f10x_spi.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>serial.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>drivers\serial.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>stm32_eth.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>drivers\stm32_eth.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>stm32f10x_it.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>drivers\stm32f10x_it.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>usart.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>drivers\usart.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>Kernel</GroupName>
|
||||
<Files>
|
||||
@@ -726,6 +733,16 @@
|
||||
<Group>
|
||||
<GroupName>finsh</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>shell.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\components\finsh\shell.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>symbol.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\components\finsh\symbol.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>cmd.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
@@ -766,11 +783,6 @@
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\components\finsh\finsh_parser.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>finsh_token.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\components\finsh\finsh_token.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>finsh_var.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
@@ -782,24 +794,9 @@
|
||||
<FilePath>..\..\components\finsh\finsh_vm.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>shell.c</FileName>
|
||||
<FileName>finsh_token.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\components\finsh\shell.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>symbol.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\components\finsh\symbol.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>Components</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>components.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\components\init\components.c</FilePath>
|
||||
<FilePath>..\..\components\finsh\finsh_token.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
@@ -809,177 +806,177 @@
|
||||
<File>
|
||||
<FileName>api_lib.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\components\net\lwip\src\api\api_lib.c</FilePath>
|
||||
<FilePath>..\..\components\net\lwip-1.4.1\src\api\api_lib.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>api_msg.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\components\net\lwip\src\api\api_msg.c</FilePath>
|
||||
<FilePath>..\..\components\net\lwip-1.4.1\src\api\api_msg.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>err.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\components\net\lwip\src\api\err.c</FilePath>
|
||||
<FilePath>..\..\components\net\lwip-1.4.1\src\api\err.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>netbuf.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\components\net\lwip\src\api\netbuf.c</FilePath>
|
||||
<FilePath>..\..\components\net\lwip-1.4.1\src\api\netbuf.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>netdb.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\components\net\lwip\src\api\netdb.c</FilePath>
|
||||
<FilePath>..\..\components\net\lwip-1.4.1\src\api\netdb.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>netifapi.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\components\net\lwip\src\api\netifapi.c</FilePath>
|
||||
<FilePath>..\..\components\net\lwip-1.4.1\src\api\netifapi.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>sockets.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\components\net\lwip\src\api\sockets.c</FilePath>
|
||||
<FilePath>..\..\components\net\lwip-1.4.1\src\api\sockets.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>tcpip.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\components\net\lwip\src\api\tcpip.c</FilePath>
|
||||
<FilePath>..\..\components\net\lwip-1.4.1\src\api\tcpip.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>sys_arch.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\components\net\lwip\src\arch\sys_arch.c</FilePath>
|
||||
<FilePath>..\..\components\net\lwip-1.4.1\src\arch\sys_arch.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>def.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\components\net\lwip\src\core\def.c</FilePath>
|
||||
<FilePath>..\..\components\net\lwip-1.4.1\src\core\def.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>dhcp.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\components\net\lwip\src\core\dhcp.c</FilePath>
|
||||
<FilePath>..\..\components\net\lwip-1.4.1\src\core\dhcp.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>dns.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\components\net\lwip\src\core\dns.c</FilePath>
|
||||
<FilePath>..\..\components\net\lwip-1.4.1\src\core\dns.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>init.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\components\net\lwip\src\core\init.c</FilePath>
|
||||
<FilePath>..\..\components\net\lwip-1.4.1\src\core\init.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>memp.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\components\net\lwip\src\core\memp.c</FilePath>
|
||||
<FilePath>..\..\components\net\lwip-1.4.1\src\core\memp.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>netif.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\components\net\lwip\src\core\netif.c</FilePath>
|
||||
<FilePath>..\..\components\net\lwip-1.4.1\src\core\netif.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>pbuf.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\components\net\lwip\src\core\pbuf.c</FilePath>
|
||||
<FilePath>..\..\components\net\lwip-1.4.1\src\core\pbuf.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>raw.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\components\net\lwip\src\core\raw.c</FilePath>
|
||||
<FilePath>..\..\components\net\lwip-1.4.1\src\core\raw.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>stats.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\components\net\lwip\src\core\stats.c</FilePath>
|
||||
<FilePath>..\..\components\net\lwip-1.4.1\src\core\stats.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>sys.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\components\net\lwip\src\core\sys.c</FilePath>
|
||||
<FilePath>..\..\components\net\lwip-1.4.1\src\core\sys.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>tcp.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\components\net\lwip\src\core\tcp.c</FilePath>
|
||||
<FilePath>..\..\components\net\lwip-1.4.1\src\core\tcp.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>tcp_in.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\components\net\lwip\src\core\tcp_in.c</FilePath>
|
||||
<FilePath>..\..\components\net\lwip-1.4.1\src\core\tcp_in.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>tcp_out.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\components\net\lwip\src\core\tcp_out.c</FilePath>
|
||||
<FilePath>..\..\components\net\lwip-1.4.1\src\core\tcp_out.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>timers.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\components\net\lwip\src\core\timers.c</FilePath>
|
||||
<FilePath>..\..\components\net\lwip-1.4.1\src\core\timers.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>udp.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\components\net\lwip\src\core\udp.c</FilePath>
|
||||
<FilePath>..\..\components\net\lwip-1.4.1\src\core\udp.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>autoip.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\components\net\lwip\src\core\ipv4\autoip.c</FilePath>
|
||||
<FilePath>..\..\components\net\lwip-1.4.1\src\core\ipv4\autoip.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>icmp.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\components\net\lwip\src\core\ipv4\icmp.c</FilePath>
|
||||
<FilePath>..\..\components\net\lwip-1.4.1\src\core\ipv4\icmp.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>igmp.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\components\net\lwip\src\core\ipv4\igmp.c</FilePath>
|
||||
<FilePath>..\..\components\net\lwip-1.4.1\src\core\ipv4\igmp.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>inet.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\components\net\lwip\src\core\ipv4\inet.c</FilePath>
|
||||
<FilePath>..\..\components\net\lwip-1.4.1\src\core\ipv4\inet.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>inet_chksum.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\components\net\lwip\src\core\ipv4\inet_chksum.c</FilePath>
|
||||
<FilePath>..\..\components\net\lwip-1.4.1\src\core\ipv4\inet_chksum.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>ip.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\components\net\lwip\src\core\ipv4\ip.c</FilePath>
|
||||
<FilePath>..\..\components\net\lwip-1.4.1\src\core\ipv4\ip.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>ip_addr.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\components\net\lwip\src\core\ipv4\ip_addr.c</FilePath>
|
||||
<FilePath>..\..\components\net\lwip-1.4.1\src\core\ipv4\ip_addr.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>ip_frag.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\components\net\lwip\src\core\ipv4\ip_frag.c</FilePath>
|
||||
<FilePath>..\..\components\net\lwip-1.4.1\src\core\ipv4\ip_frag.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>etharp.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\components\net\lwip\src\netif\etharp.c</FilePath>
|
||||
<FilePath>..\..\components\net\lwip-1.4.1\src\netif\etharp.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>ethernetif.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\components\net\lwip\src\netif\ethernetif.c</FilePath>
|
||||
<FilePath>..\..\components\net\lwip-1.4.1\src\netif\ethernetif.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>slipif.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\components\net\lwip\src\netif\slipif.c</FilePath>
|
||||
<FilePath>..\..\components\net\lwip-1.4.1\src\netif\slipif.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
|
||||
@@ -69,8 +69,8 @@
|
||||
#define RT_CONSOLE_DEVICE_NAME "uart1"
|
||||
// </section>
|
||||
|
||||
// <section name="RT_USING_COMPONENTS_INIT" description="Using components init" default="true" >
|
||||
#define RT_USING_COMPONENTS_INIT
|
||||
// <section name="RT_USING_COMPONENTS_INIT" description="Using components init" default="false" >
|
||||
// #define RT_USING_COMPONENTS_INIT
|
||||
// </section>
|
||||
|
||||
/* SECTION: finsh, a C-Express shell */
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
<PageWidth>79</PageWidth>
|
||||
<PageLength>66</PageLength>
|
||||
<TabStop>8</TabStop>
|
||||
<ListingPath>.\</ListingPath>
|
||||
<ListingPath>.\build\</ListingPath>
|
||||
</OPTLEX>
|
||||
<ListingPage>
|
||||
<CreateCListing>1</CreateCListing>
|
||||
@@ -115,6 +115,7 @@
|
||||
<tRmem>1</tRmem>
|
||||
<tRfunc>0</tRfunc>
|
||||
<tRbox>1</tRbox>
|
||||
<tRtrace>0</tRtrace>
|
||||
<sRunDeb>0</sRunDeb>
|
||||
<sLrtime>0</sLrtime>
|
||||
<nTsel>7</nTsel>
|
||||
@@ -130,6 +131,22 @@
|
||||
<tIfile></tIfile>
|
||||
<pMon>Segger\JL2CM3.dll</pMon>
|
||||
</DebugOpt>
|
||||
<TargetDriverDllRegistry>
|
||||
<SetRegEntry>
|
||||
<Number>0</Number>
|
||||
<Key>JL2CM3</Key>
|
||||
<Name>-U20090928 -O78 -S0 -A0 -C0 -JU1 -JI127.0.0.1 -JP0 -RST0 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8008 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -TB1 -TFE0 -FO15 -FD20000000 -FC800 -FN1 -FF0STM32F10x_CL -FS08000000 -FL040000</Name>
|
||||
</SetRegEntry>
|
||||
<SetRegEntry>
|
||||
<Number>0</Number>
|
||||
<Key>UL2CM3</Key>
|
||||
<Name>UL2CM3(-O14 -S0 -C0 -N00("ARM Cortex-M3") -D00(1BA00477) -L00(4) -FO7 -FD20000000 -FC800 -FN1 -FF0STM32F10x_CL -FS08000000 -FL040000)</Name>
|
||||
</SetRegEntry>
|
||||
</TargetDriverDllRegistry>
|
||||
<Breakpoint/>
|
||||
<Tracepoint>
|
||||
<THDelay>0</THDelay>
|
||||
</Tracepoint>
|
||||
<DebugFlag>
|
||||
<trace>0</trace>
|
||||
<periodic>0</periodic>
|
||||
@@ -153,7 +170,7 @@
|
||||
<aSer4>0</aSer4>
|
||||
<StkLoc>0</StkLoc>
|
||||
<TrcWin>0</TrcWin>
|
||||
<newCpu>3</newCpu>
|
||||
<newCpu>0</newCpu>
|
||||
<uProt>0</uProt>
|
||||
</DebugFlag>
|
||||
<LintExecutable></LintExecutable>
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
<SLE66AMisc></SLE66AMisc>
|
||||
<SLE66LinkerMisc></SLE66LinkerMisc>
|
||||
<SFDFile>SFD\ST\STM32F107x\STM32F107.sfr</SFDFile>
|
||||
<bCustSvd>0</bCustSvd>
|
||||
<UseEnv>0</UseEnv>
|
||||
<BinPath></BinPath>
|
||||
<IncludePath></IncludePath>
|
||||
@@ -61,6 +62,8 @@
|
||||
<UserProg2Name></UserProg2Name>
|
||||
<UserProg1Dos16Mode>0</UserProg1Dos16Mode>
|
||||
<UserProg2Dos16Mode>0</UserProg2Dos16Mode>
|
||||
<nStopU1X>0</nStopU1X>
|
||||
<nStopU2X>0</nStopU2X>
|
||||
</BeforeCompile>
|
||||
<BeforeMake>
|
||||
<RunUserProg1>0</RunUserProg1>
|
||||
@@ -95,6 +98,7 @@
|
||||
<StopOnExitCode>3</StopOnExitCode>
|
||||
<CustomArgument></CustomArgument>
|
||||
<IncludeLibraryModules></IncludeLibraryModules>
|
||||
<ComprImg>1</ComprImg>
|
||||
</CommonProperty>
|
||||
<DllOption>
|
||||
<SimDllName>SARMCM3.DLL</SimDllName>
|
||||
@@ -134,6 +138,7 @@
|
||||
<RestoreMemoryDisplay>1</RestoreMemoryDisplay>
|
||||
<RestoreFunctions>0</RestoreFunctions>
|
||||
<RestoreToolbox>1</RestoreToolbox>
|
||||
<RestoreTracepoints>0</RestoreTracepoints>
|
||||
</Target>
|
||||
<RunDebugAfterBuild>0</RunDebugAfterBuild>
|
||||
<TargetSelection>7</TargetSelection>
|
||||
@@ -158,13 +163,18 @@
|
||||
<UseTargetDll>1</UseTargetDll>
|
||||
<UseExternalTool>0</UseExternalTool>
|
||||
<RunIndependent>0</RunIndependent>
|
||||
<UpdateFlashBeforeDebugging>0</UpdateFlashBeforeDebugging>
|
||||
<UpdateFlashBeforeDebugging>1</UpdateFlashBeforeDebugging>
|
||||
<Capability>1</Capability>
|
||||
<DriverSelection>4099</DriverSelection>
|
||||
</Flash1>
|
||||
<bUseTDR>1</bUseTDR>
|
||||
<Flash2>Segger\JL2CM3.dll</Flash2>
|
||||
<Flash3></Flash3>
|
||||
<Flash3>"" ()</Flash3>
|
||||
<Flash4></Flash4>
|
||||
<pFcarmOut></pFcarmOut>
|
||||
<pFcarmGrp></pFcarmGrp>
|
||||
<pFcArmRoot></pFcArmRoot>
|
||||
<FcArmLst>0</FcArmLst>
|
||||
</Utilities>
|
||||
<TargetArmAds>
|
||||
<ArmAdsMisc>
|
||||
@@ -342,6 +352,7 @@
|
||||
<Rwpi>0</Rwpi>
|
||||
<wLevel>0</wLevel>
|
||||
<uThumb>0</uThumb>
|
||||
<uSurpInc>0</uSurpInc>
|
||||
<VariousControls>
|
||||
<MiscControls></MiscControls>
|
||||
<Define></Define>
|
||||
@@ -357,6 +368,7 @@
|
||||
<SplitLS>0</SplitLS>
|
||||
<SwStkChk>0</SwStkChk>
|
||||
<NoWarn>0</NoWarn>
|
||||
<uSurpInc>0</uSurpInc>
|
||||
<VariousControls>
|
||||
<MiscControls></MiscControls>
|
||||
<Define></Define>
|
||||
|
||||
@@ -122,9 +122,6 @@ void rt_init_thread_entry(void* parameter)
|
||||
/* init touch panel */
|
||||
rtgui_touch_hw_init();
|
||||
|
||||
/* re-init device driver */
|
||||
rt_device_init_all();
|
||||
|
||||
/* find lcd device */
|
||||
lcd = rt_device_find("lcd");
|
||||
|
||||
|
||||
@@ -66,12 +66,9 @@ void rt_init_thread_entry(void* parameter)
|
||||
|
||||
/* register ethernetif device */
|
||||
eth_system_device_init();
|
||||
|
||||
|
||||
/* initialize eth interface */
|
||||
rt_hw_stm32_eth_init();
|
||||
|
||||
/* re-init device driver */
|
||||
rt_device_init_all();
|
||||
|
||||
/* init lwip system */
|
||||
lwip_sys_init();
|
||||
|
||||
@@ -107,9 +107,6 @@ void rtthread_startup(void)
|
||||
|
||||
rt_hw_rtc_init();
|
||||
|
||||
/* init all device */
|
||||
rt_device_init_all();
|
||||
|
||||
/* init application */
|
||||
rt_application_init();
|
||||
|
||||
|
||||
@@ -41,8 +41,6 @@ void rt_init_thread_entry(void* parameter)
|
||||
eth_system_device_init();
|
||||
|
||||
rt_hw_stm32_eth_init();
|
||||
/* re-init device driver */
|
||||
rt_device_init_all();
|
||||
|
||||
/* init lwip system */
|
||||
lwip_sys_init();
|
||||
|
||||
@@ -85,9 +85,6 @@ void rtthread_startup(void)
|
||||
/* init scheduler system */
|
||||
rt_system_scheduler_init();
|
||||
|
||||
/* init all device */
|
||||
rt_device_init_all();
|
||||
|
||||
/* init application */
|
||||
rt_application_init();
|
||||
|
||||
|
||||
@@ -165,8 +165,8 @@ static void GPIO_Configuration(void)
|
||||
GPIO_Init(UART3_GPIO, &GPIO_InitStructure);
|
||||
|
||||
/* Connect alternate function */
|
||||
GPIO_PinAFConfig(UART2_GPIO, UART3_TX_PIN_SOURCE, GPIO_AF_USART3);
|
||||
GPIO_PinAFConfig(UART2_GPIO, UART3_RX_PIN_SOURCE, GPIO_AF_USART3);
|
||||
GPIO_PinAFConfig(UART3_GPIO, UART3_TX_PIN_SOURCE, GPIO_AF_USART3);
|
||||
GPIO_PinAFConfig(UART3_GPIO, UART3_RX_PIN_SOURCE, GPIO_AF_USART3);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
/* Program Entry, set to mark it as "used" and avoid gc */
|
||||
MEMORY
|
||||
{
|
||||
CODE (rx) : ORIGIN = 0x08000000, LENGTH = 512k /* 512KB flash */
|
||||
DATA (rw) : ORIGIN = 0x20000000, LENGTH = 64k /* 64K sram */
|
||||
CODE (rx) : ORIGIN = 0x08000000, LENGTH = 1024k /* 1024KB flash */
|
||||
DATA (rw) : ORIGIN = 0x20000000, LENGTH = 128k /* 128K sram */
|
||||
}
|
||||
ENTRY(Reset_Handler)
|
||||
_system_stack_size = 0x100;
|
||||
|
||||
@@ -52,10 +52,10 @@ void rtthread_startup(void)
|
||||
|
||||
/* init tick */
|
||||
rt_system_tick_init();
|
||||
|
||||
|
||||
/* init kernel object */
|
||||
rt_system_object_init();
|
||||
|
||||
|
||||
/* init timer system */
|
||||
rt_system_timer_init();
|
||||
|
||||
@@ -68,11 +68,6 @@ void rtthread_startup(void)
|
||||
/* init scheduler system */
|
||||
rt_system_scheduler_init();
|
||||
|
||||
#ifdef RT_USING_DEVICE
|
||||
/* init all device */
|
||||
rt_device_init_all();
|
||||
#endif
|
||||
|
||||
/* init application */
|
||||
rt_application_init();
|
||||
|
||||
@@ -102,7 +97,7 @@ int main(void)
|
||||
|
||||
/* init system setting */
|
||||
TAB0_Start();
|
||||
|
||||
|
||||
/* startup RT-Thread RTOS */
|
||||
rtthread_startup();
|
||||
|
||||
|
||||
@@ -84,10 +84,6 @@ void rtthread_startup(void)
|
||||
rt_thread_idle_sethook(rt_hw_led_flash);
|
||||
#endif
|
||||
|
||||
#ifdef RT_USING_DEVICE
|
||||
rt_device_init_all();
|
||||
#endif
|
||||
|
||||
/* init application */
|
||||
rt_application_init();
|
||||
|
||||
|
||||
@@ -56,11 +56,6 @@ void rtthread_startup(void)
|
||||
/* init scheduler system */
|
||||
rt_system_scheduler_init();
|
||||
|
||||
#ifdef RT_USING_DEVICE
|
||||
/* init all device */
|
||||
rt_device_init_all();
|
||||
#endif
|
||||
|
||||
/* init application */
|
||||
rt_application_init();
|
||||
|
||||
|
||||
@@ -27,5 +27,6 @@
|
||||
#include <rtthread.h>
|
||||
|
||||
int devfs_init(void);
|
||||
void rt_console_init(const char* device_name);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -750,11 +750,12 @@ int nfs_open(struct dfs_fd *file)
|
||||
if (file->flags & DFS_O_CREAT)
|
||||
{
|
||||
if (nfs_mkdir(nfs, file->path, 0755) < 0)
|
||||
return -1;
|
||||
return -DFS_STATUS_EAGAIN;
|
||||
}
|
||||
|
||||
/* open directory */
|
||||
dir = nfs_opendir(nfs, file->path);
|
||||
if (dir == RT_NULL) return -DFS_STATUS_ENOENT;
|
||||
file->data = dir;
|
||||
}
|
||||
else
|
||||
@@ -766,20 +767,20 @@ int nfs_open(struct dfs_fd *file)
|
||||
if (file->flags & DFS_O_CREAT)
|
||||
{
|
||||
if (nfs_create(nfs, file->path, 0664) < 0)
|
||||
return -1;
|
||||
return -DFS_STATUS_EAGAIN;
|
||||
}
|
||||
|
||||
/* open file (get file handle ) */
|
||||
fp = rt_malloc(sizeof(nfs_file));
|
||||
if (fp == RT_NULL)
|
||||
return -1;
|
||||
return -DFS_STATUS_ENOMEM;
|
||||
|
||||
handle = get_handle(nfs, file->path);
|
||||
if (handle == RT_NULL)
|
||||
{
|
||||
rt_free(fp);
|
||||
|
||||
return -1;
|
||||
return -DFS_STATUS_ENOENT;
|
||||
}
|
||||
|
||||
/* get size of file */
|
||||
@@ -798,7 +799,7 @@ int nfs_open(struct dfs_fd *file)
|
||||
|
||||
/* set private file */
|
||||
file->data = fp;
|
||||
file->size = fp->size;
|
||||
file->size = fp->size;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -24,7 +24,7 @@ unsigned short pmap_getport(struct sockaddr_in *address, unsigned long program,
|
||||
{
|
||||
unsigned short port = 0;
|
||||
int socket = -1;
|
||||
register CLIENT *client;
|
||||
register CLIENT *client = RT_NULL;
|
||||
struct pmap parms;
|
||||
|
||||
address->sin_port = htons((unsigned short)PMAPPORT);
|
||||
|
||||
@@ -335,6 +335,9 @@ int dfs_file_lseek(struct dfs_fd *fd, rt_off_t offset)
|
||||
|
||||
if (fd == RT_NULL)
|
||||
return -DFS_STATUS_EINVAL;
|
||||
fs = fd->fs;
|
||||
if (fs == RT_NULL)
|
||||
return -DFS_STATUS_EINVAL;
|
||||
if (fs->ops->lseek == RT_NULL)
|
||||
return -DFS_STATUS_ENOSYS;
|
||||
|
||||
@@ -555,7 +558,7 @@ void ls(const char *pathname)
|
||||
if (pathname == RT_NULL)
|
||||
rt_free(path);
|
||||
}
|
||||
FINSH_FUNCTION_EXPORT(ls, list directory contents)
|
||||
FINSH_FUNCTION_EXPORT(ls, list directory contents);
|
||||
|
||||
void rm(const char *filename)
|
||||
{
|
||||
@@ -564,7 +567,7 @@ void rm(const char *filename)
|
||||
rt_kprintf("Delete %s failed\n", filename);
|
||||
}
|
||||
}
|
||||
FINSH_FUNCTION_EXPORT(rm, remove files or directories)
|
||||
FINSH_FUNCTION_EXPORT(rm, remove files or directories);
|
||||
|
||||
void cat(const char* filename)
|
||||
{
|
||||
@@ -590,7 +593,7 @@ void cat(const char* filename)
|
||||
|
||||
dfs_file_close(&fd);
|
||||
}
|
||||
FINSH_FUNCTION_EXPORT(cat, print file)
|
||||
FINSH_FUNCTION_EXPORT(cat, print file);
|
||||
|
||||
#define BUF_SZ 4096
|
||||
static void copyfile(const char *src, const char *dst)
|
||||
@@ -629,7 +632,15 @@ static void copyfile(const char *src, const char *dst)
|
||||
read_bytes = dfs_file_read(&src_fd, block_ptr, BUF_SZ);
|
||||
if (read_bytes > 0)
|
||||
{
|
||||
dfs_file_write(&fd, block_ptr, read_bytes);
|
||||
int length;
|
||||
|
||||
length = dfs_file_write(&fd, block_ptr, read_bytes);
|
||||
if (length != read_bytes)
|
||||
{
|
||||
/* write failed. */
|
||||
rt_kprintf("Write file data failed, errno=%d\n", length);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} while (read_bytes > 0);
|
||||
|
||||
|
||||
@@ -85,6 +85,8 @@ struct dfs_filesystem *dfs_filesystem_lookup(const char *path)
|
||||
|
||||
prefixlen = 0;
|
||||
|
||||
RT_ASSERT(path);
|
||||
|
||||
/* lock filesystem */
|
||||
dfs_lock();
|
||||
|
||||
|
||||
@@ -33,11 +33,11 @@
|
||||
|
||||
/**
|
||||
* this function is a POSIX compliant version, which will open a file and
|
||||
* return a file descriptor.
|
||||
* return a file descriptor according specified flags.
|
||||
*
|
||||
* @param file the path name of file.
|
||||
* @param flags the file open flags.
|
||||
* @param mode
|
||||
* @param mode ignored parameter
|
||||
*
|
||||
* @return the non-negative integer on successful open, others for failed.
|
||||
*/
|
||||
@@ -120,7 +120,8 @@ RTM_EXPORT(close);
|
||||
* @param buf the buffer to save the read data.
|
||||
* @param len the maximal length of data buffer
|
||||
*
|
||||
* @return the actual read data buffer length
|
||||
* @return the actual read data buffer length. If the returned value is 0, it
|
||||
* may be reach the end of file, please check errno.
|
||||
*/
|
||||
int read(int fd, void *buf, size_t len)
|
||||
{
|
||||
@@ -200,7 +201,7 @@ RTM_EXPORT(write);
|
||||
* @param offset the offset to be seeked.
|
||||
* @param whence the directory of seek.
|
||||
*
|
||||
* @return the current file position, or -1 on failed.
|
||||
* @return the current read/write position in the file, or -1 on failed.
|
||||
*/
|
||||
off_t lseek(int fd, off_t offset, int whence)
|
||||
{
|
||||
@@ -336,6 +337,8 @@ RTM_EXPORT(stat);
|
||||
*
|
||||
* @param fildes the file description
|
||||
* @param buf the data buffer to save stat description.
|
||||
*
|
||||
* @return 0 on successful, -1 on failed.
|
||||
*/
|
||||
int fstat(int fildes, struct stat *buf)
|
||||
{
|
||||
@@ -470,7 +473,7 @@ RTM_EXPORT(rmdir);
|
||||
*
|
||||
* @param name the path name to be open.
|
||||
*
|
||||
* @return the DIR pointer of directory, NULL on open failed.
|
||||
* @return the DIR pointer of directory, NULL on open directory failed.
|
||||
*/
|
||||
DIR *opendir(const char *name)
|
||||
{
|
||||
@@ -537,12 +540,17 @@ struct dirent *readdir(DIR *d)
|
||||
if (fd == RT_NULL)
|
||||
{
|
||||
rt_set_errno(-DFS_STATUS_EBADF);
|
||||
|
||||
return RT_NULL;
|
||||
}
|
||||
|
||||
if (!d->num ||
|
||||
(d->cur += ((struct dirent *)(d->buf + d->cur))->d_reclen) >= d->num)
|
||||
if (d->num)
|
||||
{
|
||||
struct dirent* dirent_ptr;
|
||||
dirent_ptr = (struct dirent*)&d->buf[d->cur];
|
||||
d->cur += dirent_ptr->d_reclen;
|
||||
}
|
||||
|
||||
if (!d->num || d->cur >= d->num)
|
||||
{
|
||||
/* get a new entry */
|
||||
result = dfs_file_getdents(fd,
|
||||
|
||||
@@ -451,9 +451,6 @@ static const struct rt_i2c_bus_device_ops i2c_bit_bus_ops =
|
||||
rt_err_t rt_i2c_bit_add_bus(struct rt_i2c_bus_device *bus,
|
||||
const char *bus_name)
|
||||
{
|
||||
struct rt_i2c_bit_ops *bit_ops = bus->priv;
|
||||
RT_ASSERT(bit_ops != RT_NULL);
|
||||
|
||||
bus->ops = &i2c_bit_bus_ops;
|
||||
|
||||
return rt_i2c_bus_device_register(bus, bus_name);
|
||||
|
||||
@@ -24,8 +24,6 @@
|
||||
|
||||
#include <rtdevice.h>
|
||||
|
||||
static struct rt_mutex i2c_core_lock;
|
||||
|
||||
rt_err_t rt_i2c_bus_device_register(struct rt_i2c_bus_device *bus,
|
||||
const char *bus_name)
|
||||
{
|
||||
@@ -33,17 +31,12 @@ rt_err_t rt_i2c_bus_device_register(struct rt_i2c_bus_device *bus,
|
||||
|
||||
rt_mutex_init(&bus->lock, "i2c_bus_lock", RT_IPC_FLAG_FIFO);
|
||||
|
||||
rt_mutex_take(&i2c_core_lock, RT_WAITING_FOREVER);
|
||||
|
||||
if (bus->timeout == 0)
|
||||
bus->timeout = RT_TICK_PER_SECOND;
|
||||
if (bus->timeout == 0) bus->timeout = RT_TICK_PER_SECOND;
|
||||
|
||||
res = rt_i2c_bus_device_device_init(bus, bus_name);
|
||||
|
||||
i2c_dbg("I2C bus [%s] registered\n", bus_name);
|
||||
|
||||
rt_mutex_release(&i2c_core_lock);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -136,6 +129,6 @@ rt_size_t rt_i2c_master_recv(struct rt_i2c_bus_device *bus,
|
||||
|
||||
int rt_i2c_core_init(void)
|
||||
{
|
||||
return rt_mutex_init(&i2c_core_lock, "i2c_core_lock", RT_IPC_FLAG_FIFO);
|
||||
return 0;
|
||||
}
|
||||
INIT_COMPONENT_EXPORT(rt_i2c_core_init);
|
||||
|
||||
@@ -20,18 +20,11 @@
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2012-04-25 weety first version
|
||||
* 2014-08-03 bernard fix some compiling warning
|
||||
*/
|
||||
|
||||
#include <rtdevice.h>
|
||||
|
||||
static rt_err_t i2c_bus_device_init(rt_device_t dev)
|
||||
{
|
||||
struct rt_i2c_bus_device *bus = (struct rt_i2c_bus_device *)dev->user_data;
|
||||
RT_ASSERT(bus != RT_NULL);
|
||||
|
||||
return RT_EOK;
|
||||
}
|
||||
|
||||
static rt_size_t i2c_bus_device_read(rt_device_t dev,
|
||||
rt_off_t pos,
|
||||
void *buffer,
|
||||
@@ -122,7 +115,7 @@ rt_err_t rt_i2c_bus_device_device_init(struct rt_i2c_bus_device *bus,
|
||||
/* set device type */
|
||||
device->type = RT_Device_Class_I2CBUS;
|
||||
/* initialize device interface */
|
||||
device->init = i2c_bus_device_init;
|
||||
device->init = RT_NULL;
|
||||
device->open = RT_NULL;
|
||||
device->close = RT_NULL;
|
||||
device->read = i2c_bus_device_read;
|
||||
|
||||
@@ -30,9 +30,15 @@
|
||||
|
||||
#include <rtthread.h>
|
||||
|
||||
#define BAUD_RATE_2400 2400
|
||||
#define BAUD_RATE_4800 4800
|
||||
#define BAUD_RATE_9600 9600
|
||||
#define BAUD_RATE_38400 38400
|
||||
#define BAUD_RATE_57600 57600
|
||||
#define BAUD_RATE_115200 115200
|
||||
#define BAUD_RATE_230400 230400
|
||||
#define BAUD_RATE_460800 460800
|
||||
#define BAUD_RATE_921600 921600
|
||||
|
||||
#define DATA_BITS_5 5
|
||||
#define DATA_BITS_6 6
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2012-10-01 Yi Qiu first version
|
||||
* 2013-04-26 aozima add DEVICEQUALIFIER support.
|
||||
*/
|
||||
|
||||
#ifndef __USB_COMMON_H__
|
||||
@@ -149,22 +148,13 @@ extern "C" {
|
||||
#define USB_EPNO_MASK 0x7f
|
||||
#define USB_DIR_OUT 0x00
|
||||
#define USB_DIR_IN 0x80
|
||||
#define USB_DIR_INOUT 0x40
|
||||
#define USB_DIR_MASK 0x80
|
||||
|
||||
#define ID_UNASSIGNED 0
|
||||
#define ID_ASSIGNED 1
|
||||
|
||||
#define RH_GET_PORT_STATUS 0
|
||||
#define RH_SET_PORT_STATUS 1
|
||||
#define RH_CLEAR_PORT_FEATURE 2
|
||||
#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
|
||||
*/
|
||||
@@ -215,7 +205,6 @@ extern "C" {
|
||||
|
||||
#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_DIR(addr) ((addr & USB_DIR_MASK)>>7)
|
||||
|
||||
#define uswap_32(x) \
|
||||
((((x) & 0xff000000) >> 24) | \
|
||||
@@ -250,7 +239,7 @@ struct usb_descriptor
|
||||
};
|
||||
typedef struct usb_descriptor* udesc_t;
|
||||
|
||||
struct udevice_descriptor
|
||||
struct udevice_descriptor
|
||||
{
|
||||
rt_uint8_t bLength;
|
||||
rt_uint8_t type;
|
||||
@@ -269,7 +258,7 @@ struct udevice_descriptor
|
||||
};
|
||||
typedef struct udevice_descriptor* udev_desc_t;
|
||||
|
||||
struct uconfig_descriptor
|
||||
struct uconfig_descriptor
|
||||
{
|
||||
rt_uint8_t bLength;
|
||||
rt_uint8_t type;
|
||||
@@ -283,7 +272,7 @@ struct uconfig_descriptor
|
||||
};
|
||||
typedef struct uconfig_descriptor* ucfg_desc_t;
|
||||
|
||||
struct uinterface_descriptor
|
||||
struct uinterface_descriptor
|
||||
{
|
||||
rt_uint8_t bLength;
|
||||
rt_uint8_t type;
|
||||
@@ -298,7 +287,7 @@ struct uinterface_descriptor
|
||||
typedef struct uinterface_descriptor* uintf_desc_t;
|
||||
|
||||
/* Interface Association Descriptor (IAD) */
|
||||
struct uiad_descriptor
|
||||
struct uiad_descriptor
|
||||
{
|
||||
rt_uint8_t bLength;
|
||||
rt_uint8_t bDescriptorType;
|
||||
@@ -311,7 +300,7 @@ struct uiad_descriptor
|
||||
};
|
||||
typedef struct uiad_descriptor* uiad_desc_t;
|
||||
|
||||
struct uendpoint_descriptor
|
||||
struct uendpoint_descriptor
|
||||
{
|
||||
rt_uint8_t bLength;
|
||||
rt_uint8_t type;
|
||||
@@ -322,7 +311,7 @@ struct uendpoint_descriptor
|
||||
};
|
||||
typedef struct uendpoint_descriptor* uep_desc_t;
|
||||
|
||||
struct ustring_descriptor
|
||||
struct ustring_descriptor
|
||||
{
|
||||
rt_uint8_t bLength;
|
||||
rt_uint8_t type;
|
||||
@@ -330,34 +319,19 @@ struct ustring_descriptor
|
||||
};
|
||||
typedef struct ustring_descriptor* ustr_desc_t;
|
||||
|
||||
struct uhub_descriptor
|
||||
struct uhub_descriptor
|
||||
{
|
||||
rt_uint8_t length;
|
||||
rt_uint8_t type;
|
||||
rt_uint8_t num_ports;
|
||||
rt_uint16_t characteristics;
|
||||
rt_uint16_t characteristics;
|
||||
rt_uint8_t pwron_to_good; /* power on to power good */
|
||||
rt_uint8_t current;
|
||||
rt_uint8_t current;
|
||||
rt_uint8_t removable[8];
|
||||
rt_uint8_t pwr_ctl[8];
|
||||
};
|
||||
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
|
||||
{
|
||||
rt_uint8_t bLength;
|
||||
@@ -378,17 +352,15 @@ struct ureqest
|
||||
rt_uint8_t request_type;
|
||||
rt_uint8_t request;
|
||||
rt_uint16_t value;
|
||||
rt_uint16_t index;
|
||||
rt_uint16_t index;
|
||||
rt_uint16_t length;
|
||||
};
|
||||
typedef struct ureqest* ureq_t;
|
||||
|
||||
#ifndef MIN
|
||||
#define MIN(a, b) (a < b ? a : b)
|
||||
#define MAX(a, b) (a > b ? a : b)
|
||||
#endif
|
||||
|
||||
/*
|
||||
/*
|
||||
* the define related to mass storage
|
||||
*/
|
||||
#define USBREQ_GET_MAX_LUN 0xfe
|
||||
@@ -396,11 +368,6 @@ typedef struct ureqest* ureq_t;
|
||||
|
||||
#define SIZEOF_CSW 0x0d
|
||||
#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_IN 0x80
|
||||
@@ -409,7 +376,7 @@ typedef struct ureqest* ureq_t;
|
||||
#define SCSI_TEST_UNIT_READY 0x00
|
||||
#define SCSI_REQUEST_SENSE 0x03
|
||||
#define SCSI_INQUIRY_CMD 0x12
|
||||
#define SCSI_ALLOW_REMOVAL 0x1e
|
||||
#define SCSI_ALLOW_MEDIUM_REMOVAL 0x1e
|
||||
#define SCSI_MODE_SENSE_6 0x1a
|
||||
#define SCSI_START_STOP 0x1b
|
||||
#define SCSI_READ_CAPACITIES 0x23
|
||||
@@ -422,7 +389,7 @@ typedef struct ureqest* ureq_t;
|
||||
#define CSW_SIGNATURE 0x53425355
|
||||
#define CBW_TAG_VALUE 0x12345678
|
||||
|
||||
struct ustorage_cbw
|
||||
struct ustorage_cbw
|
||||
{
|
||||
rt_uint32_t signature;
|
||||
rt_uint32_t tag;
|
||||
@@ -434,11 +401,11 @@ struct ustorage_cbw
|
||||
};
|
||||
typedef struct ustorage_cbw* ustorage_cbw_t;
|
||||
|
||||
struct ustorage_csw
|
||||
struct ustorage_csw
|
||||
{
|
||||
rt_uint32_t signature;
|
||||
rt_uint32_t tag;
|
||||
rt_int32_t data_reside;
|
||||
rt_uint32_t data_reside;
|
||||
rt_uint8_t status;
|
||||
};
|
||||
typedef struct ustorage_csw* ustorage_csw_t;
|
||||
|
||||
@@ -20,8 +20,7 @@
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2012-10-01 Yi Qiu first version
|
||||
* 2012-12-12 heyuanjie87 change endpoint and function handler
|
||||
* 2013-04-26 aozima add DEVICEQUALIFIER support.
|
||||
* 2012-12-12 heyuanjie87 change endpoint and class handler
|
||||
*/
|
||||
|
||||
#ifndef __USB_DEVICE_H__
|
||||
@@ -32,115 +31,59 @@
|
||||
|
||||
/* Vendor ID */
|
||||
#ifdef USB_VENDOR_ID
|
||||
#define _VENDOR_ID USB_VENDOR_ID
|
||||
#define _VENDOR_ID USB_VENDOR_ID
|
||||
#else
|
||||
#define _VENDOR_ID 0x0EFF
|
||||
#define _VENDOR_ID 0x0EFF
|
||||
#endif
|
||||
/* Product ID */
|
||||
#ifdef USB_PRODUCT_ID
|
||||
#define _PRODUCT_ID USB_PRODUCT_ID
|
||||
#define _PRODUCT_ID USB_PRODUCT_ID
|
||||
#else
|
||||
#define _PRODUCT_ID 0x0001
|
||||
#define _PRODUCT_ID 0x0001
|
||||
#endif
|
||||
|
||||
#define USB_BCD_DEVICE 0x0200 /* USB Specification Release Number in Binary-Coded Decimal */
|
||||
#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)
|
||||
#define USB_BCD_DEVICE 0x0200 /* USB Specification Release Number in Binary-Coded Decimal */
|
||||
#define USB_BCD_VERSION 0x0200 /* USB 2.0 */
|
||||
|
||||
struct ufunction;
|
||||
struct uclass;
|
||||
struct udevice;
|
||||
struct uendpoint;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
/* request to read full count */
|
||||
UIO_REQUEST_READ_FULL,
|
||||
/* request to read any count */
|
||||
UIO_REQUEST_READ_BEST,
|
||||
/* request to write full count */
|
||||
UIO_REQUEST_WRITE,
|
||||
}UIO_REQUEST_TYPE;
|
||||
|
||||
struct udcd_ops
|
||||
{
|
||||
rt_err_t (*set_address)(rt_uint8_t address);
|
||||
rt_err_t (*set_config)(rt_uint8_t address);
|
||||
rt_err_t (*ep_set_stall)(rt_uint8_t address);
|
||||
rt_err_t (*ep_clear_stall)(rt_uint8_t address);
|
||||
rt_err_t (*ep_enable)(struct uendpoint* ep);
|
||||
rt_err_t (*ep_disable)(struct uendpoint* ep);
|
||||
rt_size_t (*ep_read_prepare)(rt_uint8_t address, void *buffer, rt_size_t size);
|
||||
rt_size_t (*ep_read)(rt_uint8_t address, void *buffer);
|
||||
rt_size_t (*ep_write)(rt_uint8_t address, void *buffer, rt_size_t size);
|
||||
rt_err_t (*ep0_send_status)(void);
|
||||
rt_err_t (*suspend)(void);
|
||||
rt_err_t (*wakeup)(void);
|
||||
rt_err_t (*set_address)(rt_uint8_t value);
|
||||
rt_err_t (*clear_feature)(rt_uint16_t value, rt_uint16_t index);
|
||||
rt_err_t (*set_feature)(rt_uint16_t value, rt_uint16_t index);
|
||||
rt_err_t (*ep_alloc)(struct uendpoint* ep);
|
||||
rt_err_t (*ep_free)(struct uendpoint* ep);
|
||||
rt_err_t (*ep_stall)(struct uendpoint* ep);
|
||||
rt_err_t (*ep_run)(struct uendpoint* ep);
|
||||
rt_err_t (*ep_stop)(struct uendpoint* ep);
|
||||
rt_err_t (*ep_read)(struct uendpoint* ep, void *buffer, rt_size_t size);
|
||||
rt_size_t (*ep_write)(struct uendpoint* ep, void *buffer, rt_size_t size);
|
||||
rt_err_t (*send_status)(void);
|
||||
};
|
||||
|
||||
struct ep_id
|
||||
{
|
||||
rt_uint8_t addr;
|
||||
rt_uint8_t type;
|
||||
rt_uint8_t dir;
|
||||
rt_uint8_t maxpacket;
|
||||
rt_uint8_t status;
|
||||
};
|
||||
|
||||
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
|
||||
{
|
||||
rt_list_t list;
|
||||
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;
|
||||
rt_err_t (*rx_indicate)(struct udevice* dev, rt_size_t size);
|
||||
};
|
||||
typedef struct uendpoint* uep_t;
|
||||
|
||||
struct udcd
|
||||
{
|
||||
struct rt_device parent;
|
||||
const struct udcd_ops* ops;
|
||||
struct uendpoint ep0;
|
||||
struct ep_id* ep_pool;
|
||||
struct udcd_ops* ops;
|
||||
struct rt_completion completion;
|
||||
};
|
||||
typedef struct udcd* udcd_t;
|
||||
|
||||
typedef rt_err_t (*udep_handler_t)(struct udevice* device, struct uclass* cls, rt_size_t size);
|
||||
|
||||
struct uendpoint
|
||||
{
|
||||
rt_list_t list;
|
||||
rt_uint8_t* buffer;
|
||||
uep_desc_t ep_desc;
|
||||
udep_handler_t handler;
|
||||
rt_bool_t is_stall;
|
||||
};
|
||||
typedef struct uendpoint* uep_t;
|
||||
|
||||
struct ualtsetting
|
||||
{
|
||||
rt_list_t list;
|
||||
@@ -151,7 +94,7 @@ struct ualtsetting
|
||||
};
|
||||
typedef struct ualtsetting* ualtsetting_t;
|
||||
|
||||
typedef rt_err_t (*uintf_handler_t)(struct ufunction* func, ureq_t setup);
|
||||
typedef rt_err_t (*uintf_handler_t)(struct udevice* device, struct uclass* cls, ureq_t setup);
|
||||
|
||||
struct uinterface
|
||||
{
|
||||
@@ -163,32 +106,32 @@ struct uinterface
|
||||
};
|
||||
typedef struct uinterface* uintf_t;
|
||||
|
||||
struct ufunction_ops
|
||||
struct uclass_ops
|
||||
{
|
||||
rt_err_t (*enable)(struct ufunction* func);
|
||||
rt_err_t (*disable)(struct ufunction* func);
|
||||
rt_err_t (*sof_handler)(struct ufunction* func);
|
||||
rt_err_t (*run)(struct udevice* device, struct uclass* cls);
|
||||
rt_err_t (*stop)(struct udevice* device, struct uclass* cls);
|
||||
rt_err_t (*sof_handler)(struct udevice* device, struct uclass* cls);
|
||||
};
|
||||
typedef struct ufunction_ops* ufunction_ops_t;
|
||||
typedef struct uclass_ops* uclass_ops_t;
|
||||
|
||||
struct ufunction
|
||||
struct uclass
|
||||
{
|
||||
rt_list_t list;
|
||||
ufunction_ops_t ops;
|
||||
uclass_ops_t ops;
|
||||
void* eps;
|
||||
struct udevice* device;
|
||||
udev_desc_t dev_desc;
|
||||
void* user_data;
|
||||
rt_bool_t enabled;
|
||||
|
||||
rt_list_t intf_list;
|
||||
};
|
||||
typedef struct ufunction* ufunction_t;
|
||||
typedef struct uclass* uclass_t;
|
||||
|
||||
struct uconfig
|
||||
{
|
||||
rt_list_t list;
|
||||
struct uconfig_descriptor cfg_desc;
|
||||
rt_list_t func_list;
|
||||
rt_list_t cls_list;
|
||||
};
|
||||
typedef struct uconfig* uconfig_t;
|
||||
|
||||
@@ -196,8 +139,6 @@ struct udevice
|
||||
{
|
||||
rt_list_t list;
|
||||
struct udevice_descriptor dev_desc;
|
||||
|
||||
struct usb_qualifier_descriptor * dev_qualifier;
|
||||
const char** str;
|
||||
|
||||
udevice_state_t state;
|
||||
@@ -213,11 +154,8 @@ enum udev_msg_type
|
||||
{
|
||||
USB_MSG_SETUP_NOTIFY,
|
||||
USB_MSG_DATA_NOTIFY,
|
||||
USB_MSG_EP0_OUT,
|
||||
USB_MSG_EP_CLEAR_FEATURE,
|
||||
USB_MSG_SOF,
|
||||
USB_MSG_RESET,
|
||||
USB_MSG_PLUG_IN,
|
||||
/* 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
|
||||
* is ready, it will send RESET and we will have USB_MSG_RESET. So, a RESET
|
||||
@@ -226,184 +164,153 @@ enum 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
|
||||
{
|
||||
udev_msg_type type;
|
||||
udcd_t dcd;
|
||||
union
|
||||
{
|
||||
struct ep_msg ep_msg;
|
||||
struct ureqest setup;
|
||||
struct
|
||||
{
|
||||
rt_size_t size;
|
||||
rt_uint8_t ep_addr;
|
||||
} ep_msg;
|
||||
struct
|
||||
{
|
||||
rt_uint32_t* packet;
|
||||
} setup_msg;
|
||||
} content;
|
||||
};
|
||||
typedef struct udev_msg* udev_msg_t;
|
||||
|
||||
udevice_t rt_usbd_device_new(void);
|
||||
uconfig_t rt_usbd_config_new(void);
|
||||
ufunction_t rt_usbd_function_new(udevice_t device, udev_desc_t dev_desc,
|
||||
ufunction_ops_t ops);
|
||||
uintf_t rt_usbd_interface_new(udevice_t device, uintf_handler_t handler);
|
||||
uep_t rt_usbd_endpoint_new(uep_desc_t ep_desc, udep_handler_t handler);
|
||||
ualtsetting_t rt_usbd_altsetting_new(rt_size_t desc_size);
|
||||
udevice_t rt_usbd_device_create(void);
|
||||
uconfig_t rt_usbd_config_create(void);
|
||||
uclass_t rt_usbd_class_create(udevice_t device,
|
||||
udev_desc_t dev_desc,
|
||||
uclass_ops_t ops);
|
||||
uintf_t rt_usbd_interface_create(udevice_t device, uintf_handler_t handler);
|
||||
uep_t rt_usbd_endpoint_create(uep_desc_t ep_desc, udep_handler_t handler);
|
||||
ualtsetting_t rt_usbd_altsetting_create(rt_size_t desc_size);
|
||||
|
||||
rt_err_t rt_usbd_core_init(void);
|
||||
rt_err_t rt_usb_device_init(void);
|
||||
rt_err_t rt_usbd_event_signal(struct udev_msg* msg);
|
||||
rt_err_t rt_usb_device_init(const char *udc_name);
|
||||
rt_err_t rt_usbd_post_event(struct udev_msg *msg, rt_size_t size);
|
||||
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_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_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_config_add_function(uconfig_t cfg, ufunction_t func);
|
||||
rt_err_t rt_usbd_function_add_interface(ufunction_t func, uintf_t intf);
|
||||
rt_err_t rt_usbd_config_add_class(uconfig_t cfg, uclass_t cls);
|
||||
rt_err_t rt_usbd_class_add_interface(uclass_t cls, uintf_t intf);
|
||||
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_config_descriptor(ualtsetting_t setting, const void* desc, rt_off_t intf_pos);
|
||||
rt_err_t rt_usbd_altsetting_config_descriptor(ualtsetting_t setting,
|
||||
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_altsetting(uintf_t intf, rt_uint8_t value);
|
||||
|
||||
udevice_t rt_usbd_find_device(udcd_t dcd);
|
||||
uconfig_t rt_usbd_find_config(udevice_t device, rt_uint8_t value);
|
||||
uintf_t rt_usbd_find_interface(udevice_t device, rt_uint8_t value, ufunction_t *pfunc);
|
||||
uep_t rt_usbd_find_endpoint(udevice_t device, ufunction_t* pfunc, rt_uint8_t ep_addr);
|
||||
rt_size_t rt_usbd_io_request(udevice_t device, uep_t ep, uio_request_t req);
|
||||
rt_size_t rt_usbd_ep0_write(udevice_t device, void *buffer, rt_size_t size);
|
||||
rt_size_t rt_usbd_ep0_read(udevice_t device, void *buffer, rt_size_t size,
|
||||
rt_err_t (*rx_ind)(udevice_t device, rt_size_t size));
|
||||
uintf_t rt_usbd_find_interface(udevice_t device,
|
||||
rt_uint8_t value,
|
||||
uclass_t *pcls);
|
||||
uep_t rt_usbd_find_endpoint(udevice_t device,
|
||||
uclass_t *pcls,
|
||||
rt_uint8_t ep_addr);
|
||||
|
||||
ufunction_t rt_usbd_function_mstorage_create(udevice_t device);
|
||||
ufunction_t rt_usbd_function_cdc_create(udevice_t device);
|
||||
ufunction_t rt_usbd_function_rndis_create(udevice_t device);
|
||||
ufunction_t rt_usbd_function_dap_create(udevice_t device);
|
||||
uclass_t rt_usbd_class_mstorage_create(udevice_t device);
|
||||
uclass_t rt_usbd_class_cdc_create(udevice_t device);
|
||||
uclass_t rt_usbd_class_rndis_create(udevice_t device);
|
||||
uclass_t rt_usbd_class_dap_create(udevice_t device);
|
||||
|
||||
#ifdef RT_USB_DEVICE_COMPOSITE
|
||||
rt_err_t rt_usbd_function_set_iad(ufunction_t func, uiad_desc_t iad_desc);
|
||||
rt_err_t rt_usbd_class_set_iad(uclass_t cls, uiad_desc_t iad_desc);
|
||||
#endif
|
||||
|
||||
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 ureqest* 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_inline rt_err_t dcd_set_address(udcd_t dcd, rt_uint8_t value)
|
||||
{
|
||||
RT_ASSERT(dcd != RT_NULL);
|
||||
RT_ASSERT(dcd->ops != RT_NULL);
|
||||
RT_ASSERT(dcd->ops->set_address != RT_NULL);
|
||||
|
||||
return dcd->ops->set_address(address);
|
||||
return dcd->ops->set_address(value);
|
||||
}
|
||||
|
||||
rt_inline rt_err_t dcd_set_config(udcd_t dcd, rt_uint8_t address)
|
||||
rt_inline rt_err_t dcd_clear_feature(udcd_t dcd,
|
||||
rt_uint16_t value,
|
||||
rt_uint16_t index)
|
||||
{
|
||||
RT_ASSERT(dcd != RT_NULL);
|
||||
RT_ASSERT(dcd->ops != RT_NULL);
|
||||
RT_ASSERT(dcd->ops->set_config != RT_NULL);
|
||||
|
||||
return dcd->ops->set_config(address);
|
||||
return dcd->ops->clear_feature(value, index);
|
||||
}
|
||||
|
||||
rt_inline rt_err_t dcd_ep_enable(udcd_t dcd, uep_t ep)
|
||||
rt_inline rt_err_t dcd_set_feature(udcd_t dcd,
|
||||
rt_uint8_t value,
|
||||
rt_uint16_t index)
|
||||
{
|
||||
RT_ASSERT(dcd != RT_NULL);
|
||||
RT_ASSERT(dcd->ops != RT_NULL);
|
||||
RT_ASSERT(dcd->ops->ep_enable != RT_NULL);
|
||||
|
||||
return dcd->ops->ep_enable(ep);
|
||||
return dcd->ops->set_feature(value, index);
|
||||
}
|
||||
|
||||
rt_inline rt_err_t dcd_ep_disable(udcd_t dcd, uep_t ep)
|
||||
rt_inline rt_err_t dcd_ep_stall(udcd_t dcd, uep_t ep)
|
||||
{
|
||||
RT_ASSERT(dcd != RT_NULL);
|
||||
RT_ASSERT(dcd->ops != RT_NULL);
|
||||
RT_ASSERT(dcd->ops->ep_disable != RT_NULL);
|
||||
|
||||
return dcd->ops->ep_disable(ep);
|
||||
return dcd->ops->ep_stall(ep);
|
||||
}
|
||||
|
||||
rt_inline rt_size_t dcd_ep_read_prepare(udcd_t dcd, rt_uint8_t address, void *buffer,
|
||||
rt_inline rt_uint8_t dcd_ep_alloc(udcd_t dcd, uep_t ep)
|
||||
{
|
||||
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_ASSERT(dcd != RT_NULL);
|
||||
RT_ASSERT(dcd->ops != RT_NULL);
|
||||
|
||||
if(dcd->ops->ep_read_prepare != RT_NULL)
|
||||
{
|
||||
return dcd->ops->ep_read_prepare(address, buffer, size);
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return dcd->ops->ep_read(ep, buffer, size);
|
||||
}
|
||||
|
||||
rt_inline rt_size_t dcd_ep_read(udcd_t dcd, rt_uint8_t address, 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_inline rt_size_t dcd_ep_write(udcd_t dcd,
|
||||
uep_t ep,
|
||||
void *buffer,
|
||||
rt_size_t size)
|
||||
{
|
||||
RT_ASSERT(dcd != RT_NULL);
|
||||
RT_ASSERT(dcd->ops != RT_NULL);
|
||||
RT_ASSERT(dcd->ops->ep_write != RT_NULL);
|
||||
|
||||
return dcd->ops->ep_write(address, buffer, size);
|
||||
return dcd->ops->ep_write(ep, buffer, size);
|
||||
}
|
||||
|
||||
rt_inline rt_err_t dcd_ep0_send_status(udcd_t dcd)
|
||||
rt_inline rt_err_t dcd_send_status(udcd_t dcd)
|
||||
{
|
||||
RT_ASSERT(dcd != RT_NULL);
|
||||
RT_ASSERT(dcd->ops != RT_NULL);
|
||||
RT_ASSERT(dcd->ops->ep0_send_status != RT_NULL);
|
||||
|
||||
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);
|
||||
return dcd->ops->send_status();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -37,17 +37,17 @@ extern "C" {
|
||||
#define USB_HUB_PORT_NUM 0x04
|
||||
#define SIZEOF_USB_REQUEST 0x08
|
||||
|
||||
#define DEV_STATUS_IDLE 0x00
|
||||
#define DEV_STATUS_BUSY 0x01
|
||||
#define DEV_STATUS_ERROR 0x02
|
||||
#define UINST_STATUS_IDLE 0x00
|
||||
#define UINST_STATUS_BUSY 0x01
|
||||
#define UINST_STATUS_ERROR 0x02
|
||||
|
||||
#define UPIPE_STATUS_OK 0x00
|
||||
#define UPIPE_STATUS_STALL 0x01
|
||||
#define UPIPE_STATUS_ERROR 0x02
|
||||
|
||||
struct uhcd;
|
||||
struct uintf;
|
||||
struct uhub;
|
||||
struct uifinst;
|
||||
struct uhubinst;
|
||||
|
||||
struct uclass_driver
|
||||
{
|
||||
@@ -55,8 +55,8 @@ struct uclass_driver
|
||||
int class_code;
|
||||
int subclass_code;
|
||||
|
||||
rt_err_t (*enable)(void* arg);
|
||||
rt_err_t (*disable)(void* arg);
|
||||
rt_err_t (*run)(void* arg);
|
||||
rt_err_t (*stop)(void* arg);
|
||||
|
||||
void* user_data;
|
||||
};
|
||||
@@ -86,31 +86,32 @@ struct uinstance
|
||||
rt_uint8_t max_packet_size;
|
||||
rt_uint8_t port;
|
||||
|
||||
struct uhub* parent;
|
||||
struct uintf* intf[USB_MAX_INTERFACE];
|
||||
struct uhubinst* parent;
|
||||
struct uifinst* ifinst[USB_MAX_INTERFACE];
|
||||
};
|
||||
typedef struct uinstance* uinst_t;
|
||||
|
||||
struct uintf
|
||||
struct uifinst
|
||||
{
|
||||
struct uinstance* device;
|
||||
uinst_t uinst;
|
||||
uintf_desc_t intf_desc;
|
||||
|
||||
ucd_t drv;
|
||||
void *user_data;
|
||||
};
|
||||
typedef struct uifinst* uifinst_t;
|
||||
|
||||
struct upipe
|
||||
{
|
||||
rt_uint32_t status;
|
||||
struct uendpoint_descriptor ep;
|
||||
struct uintf* intf;
|
||||
uifinst_t ifinst;
|
||||
func_callback callback;
|
||||
void* user_data;
|
||||
};
|
||||
typedef struct upipe* upipe_t;
|
||||
|
||||
struct uhub
|
||||
struct uhubinst
|
||||
{
|
||||
struct uhub_descriptor hub_desc;
|
||||
rt_uint8_t num_ports;
|
||||
@@ -121,19 +122,19 @@ struct uhub
|
||||
upipe_t pipe_in;
|
||||
rt_uint8_t buffer[8];
|
||||
struct uinstance* self;
|
||||
struct uhcd *hcd;
|
||||
struct uhcd *hcd;
|
||||
};
|
||||
typedef struct uhub* uhub_t;
|
||||
typedef struct uhubinst* uhubinst_t;
|
||||
|
||||
struct uhcd_ops
|
||||
{
|
||||
int (*ctl_xfer)(struct uinstance* inst, ureq_t setup, void* buffer, int nbytes,
|
||||
int (*ctl_xfer)(uinst_t inst, ureq_t setup, 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 (*iso_xfer)(upipe_t pipe, void* buffer, int nbytes, int timeout);
|
||||
|
||||
rt_err_t (*alloc_pipe)(struct upipe** pipe, struct uintf* intf, uep_desc_t ep,
|
||||
rt_err_t (*alloc_pipe)(struct upipe** pipe, uifinst_t ifinst, uep_desc_t ep,
|
||||
func_callback callback);
|
||||
rt_err_t (*free_pipe)(upipe_t pipe);
|
||||
rt_err_t (*hub_ctrl)(rt_uint16_t port, rt_uint8_t cmd, void *args);
|
||||
@@ -143,7 +144,6 @@ struct uhcd
|
||||
{
|
||||
struct rt_device parent;
|
||||
struct uhcd_ops* ops;
|
||||
struct uhub* roothub;
|
||||
};
|
||||
typedef struct uhcd* uhcd_t;
|
||||
|
||||
@@ -159,7 +159,7 @@ struct uhost_msg
|
||||
uhost_msg_type type;
|
||||
union
|
||||
{
|
||||
struct uhub* hub;
|
||||
struct uhubinst* uhub;
|
||||
struct
|
||||
{
|
||||
func_callback function;
|
||||
@@ -170,67 +170,82 @@ struct uhost_msg
|
||||
typedef struct uhost_msg* uhost_msg_t;
|
||||
|
||||
/* usb host system interface */
|
||||
rt_err_t rt_usb_host_init(void);
|
||||
void rt_usbh_hub_init(void);
|
||||
void rt_usb_host_init(void);
|
||||
void rt_usb_hub_thread(void);
|
||||
|
||||
/* usb host core interface */
|
||||
struct uinstance* rt_usbh_alloc_instance(void);
|
||||
rt_err_t rt_usbh_attatch_instance(struct uinstance* device);
|
||||
rt_err_t rt_usbh_detach_instance(struct uinstance* device);
|
||||
rt_err_t rt_usbh_get_descriptor(struct uinstance* device, rt_uint8_t type, void* buffer,
|
||||
int nbytes);
|
||||
rt_err_t rt_usbh_set_configure(struct uinstance* device, int config);
|
||||
rt_err_t rt_usbh_set_address(struct uinstance* device);
|
||||
rt_err_t rt_usbh_set_interface(struct uinstance* device, int intf);
|
||||
rt_err_t rt_usbh_clear_feature(struct uinstance* device, int endpoint, int feature);
|
||||
rt_err_t rt_usbh_get_interface_descriptor(ucfg_desc_t cfg_desc, int num,
|
||||
uintf_desc_t* intf_desc);
|
||||
rt_err_t rt_usbh_get_endpoint_descriptor(uintf_desc_t intf_desc, int num,
|
||||
uep_desc_t* ep_desc);
|
||||
uinst_t rt_usb_alloc_instance(void);
|
||||
rt_err_t rt_usb_attatch_instance(uinst_t uinst);
|
||||
rt_err_t rt_usb_detach_instance(uinst_t uinst);
|
||||
rt_err_t rt_usb_get_descriptor(uinst_t uinst,
|
||||
rt_uint8_t type,
|
||||
void *buffer,
|
||||
int nbytes);
|
||||
rt_err_t rt_usb_set_configure(uinst_t uinst, int config);
|
||||
rt_err_t rt_usb_set_address(uinst_t uinst);
|
||||
rt_err_t rt_usb_set_interface(uinst_t uinst, int intf);
|
||||
rt_err_t rt_usb_clear_feature(uinst_t uinst, int endpoint, int feature);
|
||||
rt_err_t rt_usb_get_interface_descriptor(ucfg_desc_t cfg_desc,
|
||||
int num,
|
||||
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 */
|
||||
rt_err_t rt_usbh_class_driver_init(void);
|
||||
rt_err_t rt_usbh_class_driver_register(ucd_t drv);
|
||||
rt_err_t rt_usbh_class_driver_unregister(ucd_t drv);
|
||||
rt_err_t rt_usbh_class_driver_enable(ucd_t drv, void* args);
|
||||
rt_err_t rt_usbh_class_driver_disable(ucd_t drv, void* args);
|
||||
ucd_t rt_usbh_class_driver_find(int class_code, int subclass_code);
|
||||
rt_err_t rt_usb_class_driver_init(void);
|
||||
rt_err_t rt_usb_class_driver_register(ucd_t drv);
|
||||
rt_err_t rt_usb_class_driver_unregister(ucd_t drv);
|
||||
rt_err_t rt_usb_class_driver_run(ucd_t drv, void *args);
|
||||
rt_err_t rt_usb_class_driver_stop(ucd_t drv, void *args);
|
||||
ucd_t rt_usb_class_driver_find(int class_code, int subclass_code);
|
||||
|
||||
/* usb class driver implement */
|
||||
ucd_t rt_usbh_class_driver_hid(void);
|
||||
ucd_t rt_usbh_class_driver_hub(void);
|
||||
ucd_t rt_usbh_class_driver_storage(void);
|
||||
ucd_t rt_usbh_class_driver_adk(void);
|
||||
ucd_t rt_usb_class_driver_hid(void);
|
||||
ucd_t rt_usb_class_driver_hub(void);
|
||||
ucd_t rt_usb_class_driver_storage(void);
|
||||
ucd_t rt_usb_class_driver_adk(void);
|
||||
|
||||
/* usb hid protocal implement */
|
||||
uprotocal_t rt_usbh_hid_protocal_kbd(void);
|
||||
uprotocal_t rt_usbh_hid_protocal_mouse(void);
|
||||
uprotocal_t rt_usb_hid_protocal_kbd(void);
|
||||
uprotocal_t rt_usb_hid_protocal_mouse(void);
|
||||
|
||||
/* usb adk class driver interface */
|
||||
rt_err_t rt_usbh_adk_set_string(const char* manufacturer, const char* model,
|
||||
const char* description, const char* version, const char* uri,
|
||||
const char* serial);
|
||||
rt_err_t rt_usb_adk_set_string(const char *manufacturer,
|
||||
const char *model,
|
||||
const char *description,
|
||||
const char *version,
|
||||
const char *uri,
|
||||
const char *serial);
|
||||
|
||||
/* usb hub interface */
|
||||
rt_err_t rt_usbh_hub_get_descriptor(struct uinstance* device, rt_uint8_t *buffer,
|
||||
rt_size_t size);
|
||||
rt_err_t rt_usbh_hub_get_status(struct uinstance* device, rt_uint8_t* buffer);
|
||||
rt_err_t rt_usbh_hub_get_port_status(uhub_t uhub, rt_uint16_t port,
|
||||
rt_uint8_t* buffer);
|
||||
rt_err_t rt_usbh_hub_clear_port_feature(uhub_t uhub, rt_uint16_t port,
|
||||
rt_uint16_t feature);
|
||||
rt_err_t rt_usbh_hub_set_port_feature(uhub_t uhub, rt_uint16_t port,
|
||||
rt_uint16_t feature);
|
||||
rt_err_t rt_usbh_hub_reset_port(uhub_t uhub, rt_uint16_t port);
|
||||
rt_err_t rt_usbh_event_signal(struct uhost_msg* msg);
|
||||
rt_err_t rt_usb_hub_get_descriptor(uinst_t uinst,
|
||||
rt_uint8_t *buffer,
|
||||
rt_size_t size);
|
||||
rt_err_t rt_usb_hub_get_status(uinst_t uinst, rt_uint8_t *buffer);
|
||||
rt_err_t rt_usb_hub_get_port_status(uhubinst_t uhub,
|
||||
rt_uint16_t port,
|
||||
rt_uint8_t *buffer);
|
||||
rt_err_t rt_usb_hub_clear_port_feature(uhubinst_t uhub,
|
||||
rt_uint16_t port,
|
||||
rt_uint16_t feature);
|
||||
rt_err_t rt_usb_hub_set_port_feature(uhubinst_t uhub,
|
||||
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 */
|
||||
rt_inline rt_err_t rt_usb_hcd_alloc_pipe(uhcd_t hcd, upipe_t* pipe,
|
||||
struct uintf* intf, uep_desc_t ep, func_callback callback)
|
||||
rt_inline rt_err_t rt_usb_hcd_alloc_pipe(uhcd_t hcd,
|
||||
upipe_t *pipe,
|
||||
uifinst_t ifinst,
|
||||
uep_desc_t ep,
|
||||
func_callback callback)
|
||||
{
|
||||
if(intf == RT_NULL) return -RT_EIO;
|
||||
if (ifinst == RT_NULL)
|
||||
return -RT_EIO;
|
||||
|
||||
return hcd->ops->alloc_pipe(pipe, intf, ep, callback);
|
||||
return hcd->ops->alloc_pipe(pipe, ifinst, ep, callback);
|
||||
}
|
||||
|
||||
rt_inline rt_err_t rt_usb_hcd_free_pipe(uhcd_t hcd, upipe_t pipe)
|
||||
@@ -240,40 +255,59 @@ rt_inline rt_err_t rt_usb_hcd_free_pipe(uhcd_t hcd, upipe_t pipe)
|
||||
return hcd->ops->free_pipe(pipe);
|
||||
}
|
||||
|
||||
rt_inline int rt_usb_hcd_bulk_xfer(uhcd_t hcd, upipe_t pipe, void* buffer,
|
||||
int nbytes, int timeout)
|
||||
rt_inline int rt_usb_hcd_bulk_xfer(uhcd_t hcd,
|
||||
upipe_t pipe,
|
||||
void *buffer,
|
||||
int nbytes,
|
||||
int timeout)
|
||||
{
|
||||
if(pipe == RT_NULL) return -1;
|
||||
if(pipe->intf == RT_NULL) return -1;
|
||||
if(pipe->intf->device == RT_NULL) return -1;
|
||||
if(pipe->intf->device->status == DEV_STATUS_IDLE)
|
||||
if (pipe == RT_NULL)
|
||||
return -1;
|
||||
if (pipe->ifinst == RT_NULL)
|
||||
return -1;
|
||||
if (pipe->ifinst->uinst == RT_NULL)
|
||||
return -1;
|
||||
if (pipe->ifinst->uinst->status == UINST_STATUS_IDLE)
|
||||
return -1;
|
||||
|
||||
return hcd->ops->bulk_xfer(pipe, buffer, nbytes, timeout);
|
||||
}
|
||||
|
||||
rt_inline int rt_usb_hcd_control_xfer(uhcd_t hcd, struct uinstance* device, ureq_t setup,
|
||||
void* buffer, int nbytes, int timeout)
|
||||
rt_inline int rt_usb_hcd_control_xfer(uhcd_t hcd,
|
||||
uinst_t uinst,
|
||||
ureq_t setup,
|
||||
void *buffer,
|
||||
int nbytes,
|
||||
int timeout)
|
||||
{
|
||||
if(device->status == DEV_STATUS_IDLE) return -1;
|
||||
if (uinst->status == UINST_STATUS_IDLE)
|
||||
return -1;
|
||||
|
||||
return hcd->ops->ctl_xfer(device, setup, buffer, nbytes, timeout);
|
||||
return hcd->ops->ctl_xfer(uinst, setup, buffer, nbytes, timeout);
|
||||
}
|
||||
|
||||
rt_inline int rt_usb_hcd_int_xfer(uhcd_t hcd, upipe_t pipe, void* buffer,
|
||||
int nbytes, int timeout)
|
||||
rt_inline int rt_usb_hcd_int_xfer(uhcd_t hcd,
|
||||
upipe_t pipe,
|
||||
void *buffer,
|
||||
int nbytes,
|
||||
int timeout)
|
||||
{
|
||||
if(pipe == RT_NULL) return -1;
|
||||
if(pipe->intf == RT_NULL) return -1;
|
||||
if(pipe->intf->device == RT_NULL) return -1;
|
||||
if(pipe->intf->device->status == DEV_STATUS_IDLE)
|
||||
if (pipe == RT_NULL)
|
||||
return -1;
|
||||
if (pipe->ifinst == RT_NULL)
|
||||
return -1;
|
||||
if (pipe->ifinst->uinst == RT_NULL)
|
||||
return -1;
|
||||
if (pipe->ifinst->uinst->status == UINST_STATUS_IDLE)
|
||||
return -1;
|
||||
|
||||
return hcd->ops->int_xfer(pipe, buffer, nbytes, timeout);
|
||||
}
|
||||
|
||||
rt_inline rt_err_t rt_usb_hcd_hub_control(uhcd_t hcd, rt_uint16_t port,
|
||||
rt_uint8_t cmd, void *args)
|
||||
rt_inline rt_err_t rt_usb_hcd_hub_control(uhcd_t hcd,
|
||||
rt_uint16_t port,
|
||||
rt_uint8_t cmd,
|
||||
void *args)
|
||||
{
|
||||
return hcd->ops->hub_ctrl(port, cmd, args);
|
||||
}
|
||||
|
||||
@@ -1,56 +0,0 @@
|
||||
/*
|
||||
* 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__ */
|
||||
@@ -320,9 +320,5 @@ void rt_data_queue_reset(struct rt_data_queue *queue);
|
||||
#include "drivers/sdio.h"
|
||||
#endif
|
||||
|
||||
#ifdef RT_USING_WDT
|
||||
#include "drivers/watchdog.h"
|
||||
#endif
|
||||
|
||||
#endif /* __RT_DEVICE_H__ */
|
||||
|
||||
|
||||
@@ -25,16 +25,6 @@
|
||||
#include <drivers/spi.h>
|
||||
|
||||
/* SPI bus device interface, compatible with RT-Thread 0.3.x/1.0.x */
|
||||
static rt_err_t _spi_bus_device_init(rt_device_t dev)
|
||||
{
|
||||
struct rt_spi_bus *bus;
|
||||
|
||||
bus = (struct rt_spi_bus *)dev;
|
||||
RT_ASSERT(bus != RT_NULL);
|
||||
|
||||
return RT_EOK;
|
||||
}
|
||||
|
||||
static rt_size_t _spi_bus_device_read(rt_device_t dev,
|
||||
rt_off_t pos,
|
||||
void *buffer,
|
||||
@@ -67,11 +57,7 @@ static rt_err_t _spi_bus_device_control(rt_device_t dev,
|
||||
rt_uint8_t cmd,
|
||||
void *args)
|
||||
{
|
||||
struct rt_spi_bus *bus;
|
||||
|
||||
bus = (struct rt_spi_bus *)dev;
|
||||
RT_ASSERT(bus != RT_NULL);
|
||||
|
||||
/* TODO: add control command handle */
|
||||
switch (cmd)
|
||||
{
|
||||
case 0: /* set device */
|
||||
@@ -93,7 +79,7 @@ rt_err_t rt_spi_bus_device_init(struct rt_spi_bus *bus, const char *name)
|
||||
/* set device type */
|
||||
device->type = RT_Device_Class_SPIBUS;
|
||||
/* initialize device interface */
|
||||
device->init = _spi_bus_device_init;
|
||||
device->init = RT_NULL;
|
||||
device->open = RT_NULL;
|
||||
device->close = RT_NULL;
|
||||
device->read = _spi_bus_device_read;
|
||||
@@ -105,16 +91,6 @@ rt_err_t rt_spi_bus_device_init(struct rt_spi_bus *bus, const char *name)
|
||||
}
|
||||
|
||||
/* SPI Dev device interface, compatible with RT-Thread 0.3.x/1.0.x */
|
||||
static rt_err_t _spidev_device_init(rt_device_t dev)
|
||||
{
|
||||
struct rt_spi_device *device;
|
||||
|
||||
device = (struct rt_spi_device *)dev;
|
||||
RT_ASSERT(device != RT_NULL);
|
||||
|
||||
return RT_EOK;
|
||||
}
|
||||
|
||||
static rt_size_t _spidev_device_read(rt_device_t dev,
|
||||
rt_off_t pos,
|
||||
void *buffer,
|
||||
@@ -147,11 +123,6 @@ static rt_err_t _spidev_device_control(rt_device_t dev,
|
||||
rt_uint8_t cmd,
|
||||
void *args)
|
||||
{
|
||||
struct rt_spi_device *device;
|
||||
|
||||
device = (struct rt_spi_device *)dev;
|
||||
RT_ASSERT(device != RT_NULL);
|
||||
|
||||
switch (cmd)
|
||||
{
|
||||
case 0: /* set device */
|
||||
@@ -172,7 +143,7 @@ rt_err_t rt_spidev_device_init(struct rt_spi_device *dev, const char *name)
|
||||
|
||||
/* set device type */
|
||||
device->type = RT_Device_Class_SPIDevice;
|
||||
device->init = _spidev_device_init;
|
||||
device->init = RT_NULL;
|
||||
device->open = RT_NULL;
|
||||
device->close = RT_NULL;
|
||||
device->read = _spidev_device_read;
|
||||
|
||||
@@ -13,6 +13,9 @@ if GetDepend('RT_USB_DEVICE_CDC'):
|
||||
if GetDepend('RT_USB_DEVICE_MSTORAGE'):
|
||||
src += Glob('class/mstorage.c')
|
||||
|
||||
if GetDepend('RT_USB_DEVICE_RNDIS'):
|
||||
src += Glob('class/rndis.c')
|
||||
|
||||
CPPPATH = [cwd]
|
||||
|
||||
group = DefineGroup('DeviceDrivers', src, depend = ['RT_USING_USB_DEVICE'], CPPPATH = CPPPATH)
|
||||
|
||||
@@ -20,56 +20,34 @@
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2012-10-02 Yi Qiu first version
|
||||
* 2012-12-12 heyuanjie87 change endpoints and function handler
|
||||
* 2013-06-25 heyuanjie87 remove SOF mechinism
|
||||
* 2013-07-20 Yi Qiu do more test
|
||||
* 2012-12-12 heyuanjie87 change endpoints and class handler
|
||||
*/
|
||||
|
||||
#include <rtthread.h>
|
||||
#include <rtservice.h>
|
||||
#include <rtdevice.h>
|
||||
#include <rthw.h>
|
||||
#include "cdc.h"
|
||||
|
||||
#ifdef RT_USB_DEVICE_CDC
|
||||
|
||||
#define TX_TIMEOUT 100
|
||||
#define CDC_RX_BUFSIZE 2048
|
||||
#define CDC_MAX_PACKET_SIZE 64
|
||||
#define VCOM_DEVICE "vcom"
|
||||
#define CDC_TX_BUFSIZE 2048
|
||||
static rt_uint8_t rx_rbp[CDC_RX_BUFSIZE];
|
||||
static rt_uint8_t tx_rbp[CDC_TX_BUFSIZE];
|
||||
static struct rt_ringbuffer rx_ringbuffer;
|
||||
static struct rt_ringbuffer tx_ringbuffer;
|
||||
static struct serial_ringbuffer vcom_int_rx;
|
||||
|
||||
static struct rt_serial_device vcom_serial;
|
||||
|
||||
#define CDC_MaxPacketSize 64
|
||||
ALIGN(RT_ALIGN_SIZE)
|
||||
static rt_uint8_t vcom_thread_stack[512];
|
||||
static struct rt_thread vcom_thread;
|
||||
#define VCOM_MQ_MSG_SZ 16
|
||||
#define VCOM_MQ_MAX_MSG 4
|
||||
/* internal of the message queue: every message is associated with a pointer,
|
||||
* so in order to recveive VCOM_MQ_MAX_MSG messages, we have to allocate more
|
||||
* than VCOM_MQ_MSG_SZ*VCOM_MQ_MAX_MSG memery. */
|
||||
static rt_uint8_t vcom_tx_thread_mq_pool[(VCOM_MQ_MSG_SZ+sizeof(void*))*VCOM_MQ_MAX_MSG];
|
||||
static struct rt_messagequeue vcom_tx_thread_mq;
|
||||
static struct ucdc_line_coding line_coding;
|
||||
static rt_uint8_t rx_buf[CDC_RX_BUFSIZE];
|
||||
ALIGN(RT_ALIGN_SIZE)
|
||||
static rt_uint8_t tx_buf[CDC_TX_BUFSIZE];
|
||||
|
||||
struct vcom
|
||||
{
|
||||
struct rt_serial_device serial;
|
||||
uep_t ep_out;
|
||||
uep_t ep_in;
|
||||
uep_t ep_cmd;
|
||||
rt_bool_t connected;
|
||||
rt_bool_t in_sending;
|
||||
struct rt_completion wait;
|
||||
rt_uint8_t rx_rbp[CDC_RX_BUFSIZE];
|
||||
struct rt_ringbuffer rx_ringbuffer;
|
||||
struct serial_ringbuffer vcom_int_rx;
|
||||
};
|
||||
|
||||
struct vcom_tx_msg
|
||||
{
|
||||
struct rt_serial_device * serial;
|
||||
const char *buf;
|
||||
rt_size_t size;
|
||||
};
|
||||
volatile static rt_bool_t vcom_connected = RT_FALSE;
|
||||
volatile static rt_bool_t vcom_in_sending = RT_FALSE;
|
||||
|
||||
static struct udevice_descriptor dev_desc =
|
||||
{
|
||||
@@ -79,7 +57,7 @@ static struct udevice_descriptor dev_desc =
|
||||
USB_CLASS_CDC, //bDeviceClass;
|
||||
0x00, //bDeviceSubClass;
|
||||
0x00, //bDeviceProtocol;
|
||||
CDC_MAX_PACKET_SIZE, //bMaxPacketSize0;
|
||||
CDC_MaxPacketSize, //bMaxPacketSize0;
|
||||
_VENDOR_ID, //idVendor;
|
||||
_PRODUCT_ID, //idProduct;
|
||||
USB_BCD_DEVICE, //bcdDevice;
|
||||
@@ -89,18 +67,6 @@ static struct udevice_descriptor dev_desc =
|
||||
USB_DYNAMIC, //bNumConfigurations;
|
||||
};
|
||||
|
||||
static struct usb_qualifier_descriptor dev_qualifier =
|
||||
{
|
||||
sizeof(dev_qualifier),
|
||||
USB_DESC_TYPE_DEVICEQUALIFIER,
|
||||
0x0200,
|
||||
USB_CLASS_CDC,
|
||||
0x00,
|
||||
64,
|
||||
0x01,
|
||||
0,
|
||||
};
|
||||
|
||||
/* communcation interface descriptor */
|
||||
const static struct ucdc_comm_descriptor _comm_desc =
|
||||
{
|
||||
@@ -119,19 +85,19 @@ const static struct ucdc_comm_descriptor _comm_desc =
|
||||
USB_DESC_LENGTH_INTERFACE,
|
||||
USB_DESC_TYPE_INTERFACE,
|
||||
USB_DYNAMIC,
|
||||
0x00,
|
||||
0x00,
|
||||
0x01,
|
||||
USB_CDC_CLASS_COMM,
|
||||
USB_CDC_SUBCLASS_ACM,
|
||||
USB_CDC_PROTOCOL_V25TER,
|
||||
0x00,
|
||||
/* Header Functional Descriptor */
|
||||
0x05,
|
||||
/* Header Functional Descriptor */
|
||||
0x05,
|
||||
USB_CDC_CS_INTERFACE,
|
||||
USB_CDC_SCS_HEADER,
|
||||
0x0110,
|
||||
/* Call Management Functional Descriptor */
|
||||
0x05,
|
||||
/* Call Management Functional Descriptor */
|
||||
0x05,
|
||||
USB_CDC_CS_INTERFACE,
|
||||
USB_CDC_SCS_CALL_MGMT,
|
||||
0x00,
|
||||
@@ -141,13 +107,13 @@ const static struct ucdc_comm_descriptor _comm_desc =
|
||||
USB_CDC_CS_INTERFACE,
|
||||
USB_CDC_SCS_ACM,
|
||||
0x02,
|
||||
/* Union Functional Descriptor */
|
||||
/* Union Functional Descriptor */
|
||||
0x05,
|
||||
USB_CDC_CS_INTERFACE,
|
||||
USB_CDC_SCS_UNION,
|
||||
USB_DYNAMIC,
|
||||
USB_DYNAMIC,
|
||||
/* Endpoint Descriptor */
|
||||
/* Endpoint Descriptor */
|
||||
USB_DESC_LENGTH_ENDPOINT,
|
||||
USB_DESC_TYPE_ENDPOINT,
|
||||
USB_DYNAMIC | USB_DIR_IN,
|
||||
@@ -164,23 +130,23 @@ const static struct ucdc_data_descriptor _data_desc =
|
||||
USB_DESC_TYPE_INTERFACE,
|
||||
USB_DYNAMIC,
|
||||
0x00,
|
||||
0x02,
|
||||
0x02,
|
||||
USB_CDC_CLASS_DATA,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
/* endpoint, bulk out */
|
||||
USB_DESC_LENGTH_ENDPOINT,
|
||||
USB_DESC_LENGTH_ENDPOINT,
|
||||
USB_DESC_TYPE_ENDPOINT,
|
||||
USB_DYNAMIC | USB_DIR_OUT,
|
||||
USB_EP_ATTR_BULK,
|
||||
USB_EP_ATTR_BULK,
|
||||
USB_CDC_BUFSIZE,
|
||||
0x00,
|
||||
0x00,
|
||||
/* endpoint, bulk in */
|
||||
USB_DESC_LENGTH_ENDPOINT,
|
||||
USB_DESC_TYPE_ENDPOINT,
|
||||
USB_DYNAMIC | USB_DIR_IN,
|
||||
USB_EP_ATTR_BULK,
|
||||
USB_EP_ATTR_BULK,
|
||||
USB_CDC_BUFSIZE,
|
||||
0x00,
|
||||
};
|
||||
@@ -190,24 +156,18 @@ const static char* _ustring[] =
|
||||
"Language",
|
||||
"RT-Thread Team.",
|
||||
"RTT Virtual Serial",
|
||||
"32021919830108",
|
||||
"1.1.0",
|
||||
"Configuration",
|
||||
"Interface",
|
||||
};
|
||||
static void rt_usb_vcom_init(struct ufunction *func);
|
||||
|
||||
static void _vcom_reset_state(ufunction_t func)
|
||||
static void _vcom_reset_state(void)
|
||||
{
|
||||
struct vcom* data;
|
||||
int lvl;
|
||||
|
||||
RT_ASSERT(func != RT_NULL)
|
||||
|
||||
data = (struct vcom*)func->user_data;
|
||||
|
||||
lvl = rt_hw_interrupt_disable();
|
||||
data->connected = RT_FALSE;
|
||||
data->in_sending = RT_FALSE;
|
||||
int lvl = rt_hw_interrupt_disable();
|
||||
tx_ringbuffer.read_mirror = tx_ringbuffer.read_index = 0;
|
||||
tx_ringbuffer.write_mirror = tx_ringbuffer.write_index = 0;
|
||||
vcom_connected = RT_FALSE;
|
||||
vcom_in_sending = RT_FALSE;
|
||||
/*rt_kprintf("reset USB serial\n", cnt);*/
|
||||
rt_hw_interrupt_enable(lvl);
|
||||
}
|
||||
@@ -215,73 +175,95 @@ static void _vcom_reset_state(ufunction_t func)
|
||||
/**
|
||||
* This function will handle cdc bulk in endpoint request.
|
||||
*
|
||||
* @param func the usb function object.
|
||||
* @param device the usb device object.
|
||||
* @param size request size.
|
||||
*
|
||||
* @return RT_EOK.
|
||||
*/
|
||||
static rt_err_t _ep_in_handler(ufunction_t func, rt_size_t size)
|
||||
static rt_err_t _ep_in_handler(udevice_t device, uclass_t cls, rt_size_t size)
|
||||
{
|
||||
struct vcom *data;
|
||||
rt_uint32_t level;
|
||||
rt_uint32_t remain;
|
||||
cdc_eps_t eps;
|
||||
|
||||
RT_ASSERT(func != RT_NULL);
|
||||
eps = (cdc_eps_t)cls->eps;
|
||||
level = rt_hw_interrupt_disable();
|
||||
remain = rt_ringbuffer_data_len(&tx_ringbuffer);
|
||||
if (remain != 0)
|
||||
{
|
||||
/* although vcom_in_sending is set in SOF handler in the very
|
||||
* beginning, we have to guarantee the state is right when start
|
||||
* sending. There is at least one extreme case where we have finished the
|
||||
* last IN transaction but the vcom_in_sending is RT_FALSE.
|
||||
*
|
||||
* Ok, what the extreme case is: pour data into vcom in loop. Open
|
||||
* terminal on the PC, you will see the data. Then close it. So the
|
||||
* data will be sent to the PC in the back. When the buffer of the PC
|
||||
* driver is full. It will not send IN packet to the board and you will
|
||||
* have no chance to clear vcom_in_sending in this function. The data
|
||||
* will fill into the ringbuffer until it is full, and we will reset
|
||||
* the state machine and clear vcom_in_sending. When you open the
|
||||
* terminal on the PC again. The IN packet will appear on the line and
|
||||
* we will, eventually, reach here with vcom_in_sending is clear.
|
||||
*/
|
||||
vcom_in_sending = RT_TRUE;
|
||||
rt_ringbuffer_get(&tx_ringbuffer, eps->ep_in->buffer, remain);
|
||||
rt_hw_interrupt_enable(level);
|
||||
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("_ep_in_handler %d\n", size));
|
||||
/* send data to host */
|
||||
dcd_ep_write(device->dcd, eps->ep_in, eps->ep_in->buffer, remain);
|
||||
|
||||
data = (struct vcom*)func->user_data;
|
||||
if ((size != 0) && (size % CDC_MAX_PACKET_SIZE == 0))
|
||||
return RT_EOK;
|
||||
}
|
||||
|
||||
if (size != 0 &&
|
||||
(size % CDC_MaxPacketSize) == 0)
|
||||
{
|
||||
/* don't have data right now. Send a zero-length-packet to
|
||||
* terminate the transaction.
|
||||
*
|
||||
* FIXME: actually, this might not be the right place to send zlp.
|
||||
* Only the rt_device_write could know how much data is sending. */
|
||||
data->in_sending = RT_TRUE;
|
||||
|
||||
data->ep_in->request.buffer = RT_NULL;
|
||||
data->ep_in->request.size = 0;
|
||||
data->ep_in->request.req_type = UIO_REQUEST_WRITE;
|
||||
rt_usbd_io_request(func->device, data->ep_in, &data->ep_in->request);
|
||||
|
||||
vcom_in_sending = RT_TRUE;
|
||||
rt_hw_interrupt_enable(level);
|
||||
dcd_ep_write(device->dcd, eps->ep_in, RT_NULL, 0);
|
||||
return RT_EOK;
|
||||
}
|
||||
else
|
||||
{
|
||||
vcom_in_sending = RT_FALSE;
|
||||
rt_hw_interrupt_enable(level);
|
||||
return RT_EOK;
|
||||
}
|
||||
|
||||
rt_completion_done(&data->wait);
|
||||
|
||||
return RT_EOK;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function will handle cdc bulk out endpoint request.
|
||||
*
|
||||
* @param func the usb function object.
|
||||
* @param device the usb device object.
|
||||
* @param size request size.
|
||||
*
|
||||
* @return RT_EOK.
|
||||
*/
|
||||
static rt_err_t _ep_out_handler(ufunction_t func, rt_size_t size)
|
||||
static rt_err_t _ep_out_handler(udevice_t device, uclass_t cls, rt_size_t size)
|
||||
{
|
||||
rt_uint32_t level;
|
||||
struct vcom *data;
|
||||
cdc_eps_t eps;
|
||||
|
||||
RT_ASSERT(func != RT_NULL);
|
||||
RT_ASSERT(device != RT_NULL);
|
||||
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("_ep_out_handler %d\n", size));
|
||||
|
||||
data = (struct vcom*)func->user_data;
|
||||
eps = (cdc_eps_t)cls->eps;
|
||||
/* receive data from USB VCOM */
|
||||
level = rt_hw_interrupt_disable();
|
||||
|
||||
rt_ringbuffer_put(&data->rx_ringbuffer, data->ep_out->buffer, size);
|
||||
rt_ringbuffer_put(&rx_ringbuffer, eps->ep_out->buffer, size);
|
||||
rt_hw_interrupt_enable(level);
|
||||
|
||||
/* notify receive data */
|
||||
rt_hw_serial_isr(&data->serial);
|
||||
rt_hw_serial_isr(&vcom_serial);
|
||||
|
||||
data->ep_out->request.buffer = data->ep_out->buffer;
|
||||
data->ep_out->request.size = EP_MAXPACKET(data->ep_out);
|
||||
data->ep_out->request.req_type = UIO_REQUEST_READ_BEST;
|
||||
rt_usbd_io_request(func->device, data->ep_out, &data->ep_out->request);
|
||||
dcd_ep_read(device->dcd, eps->ep_out, eps->ep_out->buffer,
|
||||
eps->ep_out->ep_desc->wMaxPacketSize);
|
||||
|
||||
return RT_EOK;
|
||||
}
|
||||
@@ -294,9 +276,9 @@ static rt_err_t _ep_out_handler(ufunction_t func, rt_size_t size)
|
||||
*
|
||||
* @return RT_EOK.
|
||||
*/
|
||||
static rt_err_t _ep_cmd_handler(ufunction_t func, rt_size_t size)
|
||||
static rt_err_t _ep_cmd_handler(udevice_t device, uclass_t cls, rt_size_t size)
|
||||
{
|
||||
RT_ASSERT(func != RT_NULL);
|
||||
RT_ASSERT(device != RT_NULL);
|
||||
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("_ep_cmd_handler\n"));
|
||||
|
||||
@@ -319,28 +301,17 @@ static rt_err_t _cdc_get_line_coding(udevice_t device, ureq_t setup)
|
||||
RT_ASSERT(device != RT_NULL);
|
||||
RT_ASSERT(setup != RT_NULL);
|
||||
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("_cdc_get_line_coding\n"));
|
||||
|
||||
data.dwDTERate = 115200;
|
||||
data.bCharFormat = 0;
|
||||
data.bDataBits = 8;
|
||||
data.bParityType = 0;
|
||||
size = setup->length > 7 ? 7 : setup->length;
|
||||
|
||||
rt_usbd_ep0_write(device, (void*)&data, size);
|
||||
dcd_ep_write(device->dcd, 0, (void*)&data, size);
|
||||
|
||||
return RT_EOK;
|
||||
}
|
||||
|
||||
static rt_err_t _cdc_set_line_coding_callback(udevice_t device, rt_size_t size)
|
||||
{
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("_cdc_set_line_coding_callback\n"));
|
||||
|
||||
dcd_ep0_send_status(device->dcd);
|
||||
|
||||
return RT_EOK;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function will handle cdc_set_line_coding request.
|
||||
*
|
||||
@@ -351,13 +322,21 @@ static rt_err_t _cdc_set_line_coding_callback(udevice_t device, rt_size_t size)
|
||||
*/
|
||||
static rt_err_t _cdc_set_line_coding(udevice_t device, ureq_t setup)
|
||||
{
|
||||
struct ucdc_line_coding data;
|
||||
rt_err_t ret;
|
||||
|
||||
RT_ASSERT(device != RT_NULL);
|
||||
RT_ASSERT(setup != RT_NULL);
|
||||
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("_cdc_set_line_coding\n"));
|
||||
rt_completion_init(&device->dcd->completion);
|
||||
|
||||
rt_usbd_ep0_read(device, (void*)&line_coding, sizeof(struct ucdc_line_coding),
|
||||
_cdc_set_line_coding_callback);
|
||||
dcd_ep_read(device->dcd, 0, (void*)&data, setup->length);
|
||||
|
||||
ret = rt_completion_wait(&device->dcd->completion, 100);
|
||||
if(ret != RT_EOK)
|
||||
{
|
||||
rt_kprintf("_cdc_set_line_coding timeout\n");
|
||||
}
|
||||
|
||||
return RT_EOK;
|
||||
}
|
||||
@@ -370,16 +349,11 @@ static rt_err_t _cdc_set_line_coding(udevice_t device, ureq_t setup)
|
||||
*
|
||||
* @return RT_EOK on successful.
|
||||
*/
|
||||
static rt_err_t _interface_handler(ufunction_t func, ureq_t setup)
|
||||
static rt_err_t _interface_handler(udevice_t device, uclass_t cls, ureq_t setup)
|
||||
{
|
||||
struct vcom *data;
|
||||
|
||||
RT_ASSERT(func != RT_NULL);
|
||||
RT_ASSERT(func->device != RT_NULL);
|
||||
RT_ASSERT(device != RT_NULL);
|
||||
RT_ASSERT(setup != RT_NULL);
|
||||
|
||||
data = (struct vcom*)func->user_data;
|
||||
|
||||
switch(setup->request)
|
||||
{
|
||||
case CDC_SEND_ENCAPSULATED_COMMAND:
|
||||
@@ -393,14 +367,14 @@ static rt_err_t _interface_handler(ufunction_t func, ureq_t setup)
|
||||
case CDC_CLEAR_COMM_FEATURE:
|
||||
break;
|
||||
case CDC_SET_LINE_CODING:
|
||||
_cdc_set_line_coding(func->device, setup);
|
||||
data->connected = RT_TRUE;
|
||||
_cdc_set_line_coding(device, setup);
|
||||
vcom_connected = RT_TRUE;
|
||||
break;
|
||||
case CDC_GET_LINE_CODING:
|
||||
_cdc_get_line_coding(func->device, setup);
|
||||
_cdc_get_line_coding(device, setup);
|
||||
break;
|
||||
case CDC_SET_CONTROL_LINE_STATE:
|
||||
dcd_ep0_send_status(func->device->dcd);
|
||||
dcd_send_status(device->dcd);
|
||||
break;
|
||||
case CDC_SEND_BREAK:
|
||||
break;
|
||||
@@ -413,66 +387,92 @@ static rt_err_t _interface_handler(ufunction_t func, ureq_t setup)
|
||||
}
|
||||
|
||||
/**
|
||||
* This function will run cdc function, it will be called on handle set configuration request.
|
||||
* This function will run cdc class, it will be called on handle set configuration request.
|
||||
*
|
||||
* @param func the usb function object.
|
||||
* @param device the usb device object.
|
||||
*
|
||||
* @return RT_EOK on successful.
|
||||
*/
|
||||
static rt_err_t _function_enable(ufunction_t func)
|
||||
static rt_err_t _class_run(udevice_t device, uclass_t cls)
|
||||
{
|
||||
struct vcom *data;
|
||||
cdc_eps_t eps;
|
||||
RT_ASSERT(device != RT_NULL);
|
||||
|
||||
RT_ASSERT(func != RT_NULL);
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("cdc class run\n"));
|
||||
eps = (cdc_eps_t)cls->eps;
|
||||
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("cdc function enable\n"));
|
||||
eps->ep_in->buffer = tx_buf;
|
||||
eps->ep_out->buffer = rx_buf;
|
||||
|
||||
_vcom_reset_state(func);
|
||||
|
||||
data = (struct vcom*)func->user_data;
|
||||
data->ep_out->buffer = rt_malloc(CDC_RX_BUFSIZE);
|
||||
_vcom_reset_state();
|
||||
|
||||
dcd_ep_read(device->dcd, eps->ep_out, eps->ep_out->buffer,
|
||||
eps->ep_out->ep_desc->wMaxPacketSize);
|
||||
|
||||
data->ep_out->request.buffer = data->ep_out->buffer;
|
||||
data->ep_out->request.size = EP_MAXPACKET(data->ep_out);
|
||||
|
||||
data->ep_out->request.req_type = UIO_REQUEST_READ_BEST;
|
||||
rt_usbd_io_request(func->device, data->ep_out, &data->ep_out->request);
|
||||
|
||||
return RT_EOK;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function will stop cdc function, it will be called on handle set configuration request.
|
||||
* This function will stop cdc class, it will be called on handle set configuration request.
|
||||
*
|
||||
* @param func the usb function object.
|
||||
* @param device the usb device object.
|
||||
*
|
||||
* @return RT_EOK on successful.
|
||||
*/
|
||||
static rt_err_t _function_disable(ufunction_t func)
|
||||
static rt_err_t _class_stop(udevice_t device, uclass_t cls)
|
||||
{
|
||||
struct vcom *data;
|
||||
RT_ASSERT(device != RT_NULL);
|
||||
|
||||
RT_ASSERT(func != RT_NULL);
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("cdc class stop\n"));
|
||||
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("cdc function disable\n"));
|
||||
|
||||
_vcom_reset_state(func);
|
||||
|
||||
data = (struct vcom*)func->user_data;
|
||||
if(data->ep_out->buffer != RT_NULL)
|
||||
{
|
||||
rt_free(data->ep_out->buffer);
|
||||
data->ep_out->buffer = RT_NULL;
|
||||
}
|
||||
_vcom_reset_state();
|
||||
|
||||
return RT_EOK;
|
||||
}
|
||||
|
||||
static struct ufunction_ops ops =
|
||||
/**
|
||||
* This function will handle system sof event.
|
||||
*
|
||||
* @param device the usb device object.
|
||||
*
|
||||
* @return RT_EOK on successful.
|
||||
*/
|
||||
static rt_err_t _class_sof_handler(udevice_t device, uclass_t cls)
|
||||
{
|
||||
_function_enable,
|
||||
_function_disable,
|
||||
RT_NULL,
|
||||
rt_uint32_t level;
|
||||
rt_size_t size;
|
||||
cdc_eps_t eps;
|
||||
|
||||
if (vcom_connected != RT_TRUE)
|
||||
return -RT_ERROR;
|
||||
|
||||
if (vcom_in_sending)
|
||||
{
|
||||
return RT_EOK;
|
||||
}
|
||||
|
||||
eps = (cdc_eps_t)cls->eps;
|
||||
|
||||
size = rt_ringbuffer_data_len(&tx_ringbuffer);
|
||||
if (size == 0)
|
||||
return -RT_EFULL;
|
||||
|
||||
level = rt_hw_interrupt_disable();
|
||||
rt_ringbuffer_get(&tx_ringbuffer, eps->ep_in->buffer, size);
|
||||
rt_hw_interrupt_enable(level);
|
||||
|
||||
/* send data to host */
|
||||
vcom_in_sending = RT_TRUE;
|
||||
dcd_ep_write(device->dcd, eps->ep_in, eps->ep_in->buffer, size);
|
||||
|
||||
return RT_EOK;
|
||||
}
|
||||
|
||||
static struct uclass_ops ops =
|
||||
{
|
||||
_class_run,
|
||||
_class_stop,
|
||||
_class_sof_handler,
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -483,8 +483,7 @@ static struct ufunction_ops ops =
|
||||
*
|
||||
* @return RT_EOK on successful.
|
||||
*/
|
||||
static rt_err_t _cdc_descriptor_config(ucdc_comm_desc_t comm,
|
||||
rt_uint8_t cintf_nr, ucdc_data_desc_t data, rt_uint8_t dintf_nr)
|
||||
static rt_err_t _cdc_descriptor_config(ucdc_comm_desc_t comm, rt_uint8_t cintf_nr, ucdc_data_desc_t data, rt_uint8_t dintf_nr)
|
||||
{
|
||||
comm->call_mgmt_desc.data_interface = dintf_nr;
|
||||
comm->union_desc.master_interface = cintf_nr;
|
||||
@@ -497,16 +496,16 @@ static rt_err_t _cdc_descriptor_config(ucdc_comm_desc_t comm,
|
||||
}
|
||||
|
||||
/**
|
||||
* This function will create a cdc function instance.
|
||||
* This function will create a cdc class instance.
|
||||
*
|
||||
* @param device the usb device object.
|
||||
*
|
||||
* @return RT_EOK on successful.
|
||||
*/
|
||||
ufunction_t rt_usbd_function_cdc_create(udevice_t device)
|
||||
uclass_t rt_usbd_class_cdc_create(udevice_t device)
|
||||
{
|
||||
ufunction_t func;
|
||||
struct vcom* data;
|
||||
uclass_t cdc;
|
||||
cdc_eps_t eps;
|
||||
uintf_t intf_comm, intf_data;
|
||||
ualtsetting_t comm_setting, data_setting;
|
||||
ucdc_data_desc_t data_desc;
|
||||
@@ -517,26 +516,19 @@ ufunction_t rt_usbd_function_cdc_create(udevice_t device)
|
||||
|
||||
/* set usb device string description */
|
||||
rt_usbd_device_set_string(device, _ustring);
|
||||
|
||||
/* create a cdc function */
|
||||
func = rt_usbd_function_new(device, &dev_desc, &ops);
|
||||
rt_usbd_device_set_qualifier(device, &dev_qualifier);
|
||||
|
||||
/* allocate memory for cdc vcom data */
|
||||
data = (struct vcom*)rt_malloc(sizeof(struct vcom));
|
||||
rt_memset(data, 0, sizeof(struct vcom));
|
||||
func->user_data = (void*)data;
|
||||
|
||||
/* initilize vcom */
|
||||
rt_usb_vcom_init(func);
|
||||
/* create a cdc class */
|
||||
cdc = rt_usbd_class_create(device, &dev_desc, &ops);
|
||||
/* create a cdc class endpoints collection */
|
||||
eps = rt_malloc(sizeof(struct cdc_eps));
|
||||
cdc->eps = (void*)eps;
|
||||
|
||||
/* create a cdc communication interface and a cdc data interface */
|
||||
intf_comm = rt_usbd_interface_new(device, _interface_handler);
|
||||
intf_data = rt_usbd_interface_new(device, _interface_handler);
|
||||
intf_comm = rt_usbd_interface_create(device, _interface_handler);
|
||||
intf_data = rt_usbd_interface_create(device, _interface_handler);
|
||||
|
||||
/* create a communication alternate setting and a data alternate setting */
|
||||
comm_setting = rt_usbd_altsetting_new(sizeof(struct ucdc_comm_descriptor));
|
||||
data_setting = rt_usbd_altsetting_new(sizeof(struct ucdc_data_descriptor));
|
||||
comm_setting = rt_usbd_altsetting_create(sizeof(struct ucdc_comm_descriptor));
|
||||
data_setting = rt_usbd_altsetting_create(sizeof(struct ucdc_data_descriptor));
|
||||
|
||||
/* config desc in alternate setting */
|
||||
rt_usbd_altsetting_config_descriptor(comm_setting, &_comm_desc,
|
||||
@@ -545,39 +537,39 @@ ufunction_t rt_usbd_function_cdc_create(udevice_t device)
|
||||
/* configure the cdc interface descriptor */
|
||||
_cdc_descriptor_config(comm_setting->desc, intf_comm->intf_num, data_setting->desc, intf_data->intf_num);
|
||||
|
||||
/* create a command endpoint */
|
||||
comm_desc = (ucdc_comm_desc_t)comm_setting->desc;
|
||||
data->ep_cmd = rt_usbd_endpoint_new(&comm_desc->ep_desc, _ep_cmd_handler);
|
||||
|
||||
/* add the command endpoint to the cdc communication interface */
|
||||
rt_usbd_altsetting_add_endpoint(comm_setting, data->ep_cmd);
|
||||
|
||||
/* add the communication alternate setting to the communication interface,
|
||||
then set default setting of the interface */
|
||||
rt_usbd_interface_add_altsetting(intf_comm, comm_setting);
|
||||
rt_usbd_set_altsetting(intf_comm, 0);
|
||||
|
||||
/* add the communication interface to the cdc function */
|
||||
rt_usbd_function_add_interface(func, intf_comm);
|
||||
|
||||
/* create a bulk in and a bulk endpoint */
|
||||
data_desc = (ucdc_data_desc_t)data_setting->desc;
|
||||
data->ep_out = rt_usbd_endpoint_new(&data_desc->ep_out_desc, _ep_out_handler);
|
||||
data->ep_in = rt_usbd_endpoint_new(&data_desc->ep_in_desc, _ep_in_handler);
|
||||
eps->ep_out = rt_usbd_endpoint_create(&data_desc->ep_out_desc, _ep_out_handler);
|
||||
eps->ep_in = rt_usbd_endpoint_create(&data_desc->ep_in_desc, _ep_in_handler);
|
||||
|
||||
/* add the bulk out and bulk in endpoints to the data alternate setting */
|
||||
rt_usbd_altsetting_add_endpoint(data_setting, data->ep_in);
|
||||
rt_usbd_altsetting_add_endpoint(data_setting, data->ep_out);
|
||||
rt_usbd_altsetting_add_endpoint(data_setting, eps->ep_in);
|
||||
rt_usbd_altsetting_add_endpoint(data_setting, eps->ep_out);
|
||||
|
||||
/* add the data alternate setting to the data interface
|
||||
then set default setting of the interface */
|
||||
rt_usbd_interface_add_altsetting(intf_data, data_setting);
|
||||
rt_usbd_set_altsetting(intf_data, 0);
|
||||
|
||||
/* add the cdc data interface to cdc function */
|
||||
rt_usbd_function_add_interface(func, intf_data);
|
||||
|
||||
return func;
|
||||
/* add the cdc data interface to cdc class */
|
||||
rt_usbd_class_add_interface(cdc, intf_data);
|
||||
|
||||
/* create a command endpoint */
|
||||
comm_desc = (ucdc_comm_desc_t)comm_setting->desc;
|
||||
eps->ep_cmd = rt_usbd_endpoint_create(&comm_desc->ep_desc, _ep_cmd_handler);
|
||||
|
||||
/* add the command endpoint to the cdc communication interface */
|
||||
rt_usbd_altsetting_add_endpoint(comm_setting, eps->ep_cmd);
|
||||
|
||||
/* add the communication alternate setting to the communication interface,
|
||||
then set default setting of the interface */
|
||||
rt_usbd_interface_add_altsetting(intf_comm, comm_setting);
|
||||
rt_usbd_set_altsetting(intf_comm, 0);
|
||||
|
||||
/* add the communication interface to the cdc class */
|
||||
rt_usbd_class_add_interface(cdc, intf_comm);
|
||||
|
||||
return cdc;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -605,106 +597,80 @@ static rt_err_t _vcom_control(struct rt_serial_device *serial,
|
||||
return RT_EOK;
|
||||
}
|
||||
|
||||
static int _vcom_putc(struct rt_serial_device *serial, char c)
|
||||
{
|
||||
rt_uint32_t level;
|
||||
int cnt;
|
||||
|
||||
if (vcom_connected != RT_TRUE)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* if the buffer is full, there is a chance that the host would pull some
|
||||
* data out soon. But we cannot rely on that and if we wait to long, just
|
||||
* return. */
|
||||
for (cnt = 500;
|
||||
rt_ringbuffer_space_len(&tx_ringbuffer) == 0 && cnt;
|
||||
cnt--)
|
||||
{
|
||||
/*rt_kprintf("wait for %d\n", cnt);*/
|
||||
if (vcom_connected != RT_TRUE)
|
||||
return 0;
|
||||
}
|
||||
if (cnt == 0)
|
||||
{
|
||||
/* OK, we believe that the connection is lost. So don't send any more
|
||||
* data and act as the USB cable is not plugged in. Reset the VCOM
|
||||
* state machine */
|
||||
_vcom_reset_state();
|
||||
return 0;
|
||||
}
|
||||
|
||||
level = rt_hw_interrupt_disable();
|
||||
if (rt_ringbuffer_space_len(&tx_ringbuffer))
|
||||
{
|
||||
rt_ringbuffer_putchar(&tx_ringbuffer, c);
|
||||
}
|
||||
rt_hw_interrupt_enable(level);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int _vcom_getc(struct rt_serial_device *serial)
|
||||
{
|
||||
int result;
|
||||
rt_uint8_t ch;
|
||||
rt_uint32_t level;
|
||||
struct ufunction *func;
|
||||
struct vcom *data;
|
||||
|
||||
func = (struct ufunction*)serial->parent.user_data;
|
||||
data = (struct vcom*)func->user_data;
|
||||
|
||||
result = -1;
|
||||
|
||||
level = rt_hw_interrupt_disable();
|
||||
|
||||
if(rt_ringbuffer_getchar(&data->rx_ringbuffer, &ch) != 0)
|
||||
if (rt_ringbuffer_data_len(&rx_ringbuffer))
|
||||
{
|
||||
rt_ringbuffer_getchar(&rx_ringbuffer, &ch);
|
||||
result = ch;
|
||||
}
|
||||
|
||||
rt_hw_interrupt_enable(level);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static rt_size_t _vcom_tx(struct rt_serial_device *serial,
|
||||
const char *buf, rt_size_t size)
|
||||
{
|
||||
struct vcom_tx_msg msg;
|
||||
|
||||
RT_ASSERT(serial != RT_NULL);
|
||||
RT_ASSERT(buf != RT_NULL);
|
||||
|
||||
msg.buf = buf;
|
||||
msg.serial = serial;
|
||||
msg.size = size;
|
||||
|
||||
if (rt_mq_send(&vcom_tx_thread_mq, (void*)&msg,
|
||||
sizeof(struct vcom_tx_msg)) != RT_EOK)
|
||||
{
|
||||
rt_kprintf("vcom send msg fail\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
static const struct rt_uart_ops usb_vcom_ops =
|
||||
{
|
||||
_vcom_configure,
|
||||
_vcom_control,
|
||||
RT_NULL,
|
||||
_vcom_putc,
|
||||
_vcom_getc,
|
||||
RT_NULL,
|
||||
//_vcom_tx,
|
||||
};
|
||||
|
||||
/* Vcom Tx Thread */
|
||||
static void vcom_tx_thread_entry(void* parameter)
|
||||
void rt_usb_vcom_init(void)
|
||||
{
|
||||
struct vcom_tx_msg msg;
|
||||
|
||||
while (1)
|
||||
{
|
||||
if (rt_mq_recv(&vcom_tx_thread_mq, (void*)&msg,
|
||||
sizeof(struct vcom_tx_msg), RT_WAITING_FOREVER) == RT_EOK)
|
||||
{
|
||||
struct ufunction *func;
|
||||
struct vcom *data;
|
||||
|
||||
func = (struct ufunction*)msg.serial->parent.user_data;
|
||||
data = (struct vcom*)func->user_data;
|
||||
if (!data->connected)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
rt_completion_init(&data->wait);
|
||||
|
||||
data->ep_in->request.buffer = (void*)msg.buf;
|
||||
data->ep_in->request.size = msg.size;
|
||||
data->ep_in->request.req_type = UIO_REQUEST_WRITE;
|
||||
rt_usbd_io_request(func->device, data->ep_in, &data->ep_in->request);
|
||||
|
||||
if (rt_completion_wait(&data->wait, TX_TIMEOUT) != RT_EOK)
|
||||
{
|
||||
rt_kprintf("vcom tx timeout\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void rt_usb_vcom_init(struct ufunction *func)
|
||||
{
|
||||
rt_err_t result = RT_EOK;
|
||||
struct serial_configure config;
|
||||
struct vcom *data = (struct vcom*)func->user_data;
|
||||
|
||||
|
||||
/* initialize ring buffer */
|
||||
rt_ringbuffer_init(&data->rx_ringbuffer, data->rx_rbp, CDC_RX_BUFSIZE);
|
||||
rt_ringbuffer_init(&rx_ringbuffer, rx_rbp, CDC_RX_BUFSIZE);
|
||||
rt_ringbuffer_init(&tx_ringbuffer, tx_rbp, CDC_TX_BUFSIZE);
|
||||
|
||||
config.baud_rate = BAUD_RATE_115200;
|
||||
config.bit_order = BIT_ORDER_LSB;
|
||||
@@ -713,25 +679,14 @@ static void rt_usb_vcom_init(struct ufunction *func)
|
||||
config.stop_bits = STOP_BITS_1;
|
||||
config.invert = NRZ_NORMAL;
|
||||
|
||||
data->serial.ops = &usb_vcom_ops;
|
||||
data->serial.int_rx = &data->vcom_int_rx;
|
||||
data->serial.config = config;
|
||||
vcom_serial.ops = &usb_vcom_ops;
|
||||
vcom_serial.int_rx = &vcom_int_rx;
|
||||
vcom_serial.config = config;
|
||||
|
||||
/* register vcom device */
|
||||
rt_hw_serial_register(&data->serial, VCOM_DEVICE,
|
||||
RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX | RT_DEVICE_FLAG_INT_TX,
|
||||
func);
|
||||
|
||||
/* create an vcom message queue */
|
||||
rt_mq_init(&vcom_tx_thread_mq, "vcomq", vcom_tx_thread_mq_pool, VCOM_MQ_MSG_SZ,
|
||||
sizeof(vcom_tx_thread_mq_pool), RT_IPC_FLAG_FIFO);
|
||||
|
||||
/* init usb device thread */
|
||||
rt_thread_init(&vcom_thread, "vcom", vcom_tx_thread_entry, RT_NULL,
|
||||
vcom_thread_stack, 512, 8, 20);
|
||||
result = rt_thread_startup(&vcom_thread);
|
||||
RT_ASSERT(result == RT_EOK);
|
||||
rt_hw_serial_register(&vcom_serial, "vcom",
|
||||
RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX,
|
||||
RT_NULL);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -59,6 +59,13 @@ struct request_sense_data
|
||||
rt_uint8_t Reserved4[4];
|
||||
}request_sense_data_t;
|
||||
|
||||
struct mass_eps
|
||||
{
|
||||
uep_t ep_in;
|
||||
uep_t ep_out;
|
||||
};
|
||||
typedef struct mass_eps* mass_eps_t;
|
||||
|
||||
#pragma pack()
|
||||
|
||||
#endif
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -16,7 +16,7 @@
|
||||
* 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-10-02 Yi Qiu first version
|
||||
@@ -28,15 +28,13 @@
|
||||
|
||||
#ifdef RT_USING_USB_DEVICE
|
||||
|
||||
#define USB_DEVICE_CONTROLLER_NAME "usbd"
|
||||
|
||||
#ifdef RT_USB_DEVICE_COMPOSITE
|
||||
const static char* ustring[] =
|
||||
{
|
||||
"Language",
|
||||
"RT-Thread Team.",
|
||||
"RTT Composite Device",
|
||||
"320219198301",
|
||||
"1.1.0",
|
||||
"Configuration",
|
||||
"Interface",
|
||||
};
|
||||
@@ -62,54 +60,54 @@ static struct udevice_descriptor compsit_desc =
|
||||
};
|
||||
#endif
|
||||
|
||||
rt_err_t rt_usb_device_init(void)
|
||||
rt_err_t rt_usb_device_init(const char* udc_name)
|
||||
{
|
||||
rt_device_t udc;
|
||||
udevice_t udevice;
|
||||
uconfig_t cfg;
|
||||
ufunction_t func;
|
||||
uclass_t cls;
|
||||
|
||||
RT_ASSERT(udc_name != RT_NULL);
|
||||
|
||||
udc = rt_device_find(udc_name);
|
||||
if(udc == RT_NULL)
|
||||
{
|
||||
rt_kprintf("can't find usb device controller %s\n", udc_name);
|
||||
return -RT_ERROR;
|
||||
}
|
||||
|
||||
/* create and startup usb device thread */
|
||||
rt_usbd_core_init();
|
||||
|
||||
/* create a device object */
|
||||
udevice = rt_usbd_device_new();
|
||||
|
||||
udc = rt_device_find(USB_DEVICE_CONTROLLER_NAME);
|
||||
if(udc == RT_NULL)
|
||||
{
|
||||
rt_kprintf("can't find usb device controller %s\n", USB_DEVICE_CONTROLLER_NAME);
|
||||
return -RT_ERROR;
|
||||
}
|
||||
udevice = rt_usbd_device_create();
|
||||
|
||||
/* set usb controller driver to the device */
|
||||
rt_usbd_device_set_controller(udevice, (udcd_t)udc);
|
||||
|
||||
/* create a configuration object */
|
||||
cfg = rt_usbd_config_new();
|
||||
cfg = rt_usbd_config_create();
|
||||
|
||||
#ifdef RT_USB_DEVICE_MSTORAGE
|
||||
/* create a mass storage function object */
|
||||
func = rt_usbd_function_mstorage_create(udevice);
|
||||
/* create a mass storage class object */
|
||||
cls = rt_usbd_class_mstorage_create(udevice);
|
||||
|
||||
/* add the function to the configuration */
|
||||
rt_usbd_config_add_function(cfg, func);
|
||||
/* add the class to the configuration */
|
||||
rt_usbd_config_add_class(cfg, cls);
|
||||
#endif
|
||||
|
||||
#ifdef RT_USB_DEVICE_CDC
|
||||
/* create a cdc function object */
|
||||
func = rt_usbd_function_cdc_create(udevice);
|
||||
/* create a cdc class object */
|
||||
cls = rt_usbd_class_cdc_create(udevice);
|
||||
|
||||
/* add the function to the configuration */
|
||||
rt_usbd_config_add_function(cfg, func);
|
||||
/* add the class to the configuration */
|
||||
rt_usbd_config_add_class(cfg, cls);
|
||||
#endif
|
||||
|
||||
#ifdef RT_USB_DEVICE_RNDIS
|
||||
/* create a rndis function object */
|
||||
func = rt_usbd_function_rndis_create(udevice);
|
||||
/* create a rndis class object */
|
||||
cls = rt_usbd_class_rndis_create(udevice);
|
||||
|
||||
/* add the function to the configuration */
|
||||
rt_usbd_config_add_function(cfg, func);
|
||||
/* add the class to the configuration */
|
||||
rt_usbd_config_add_class(cfg, cls);
|
||||
#endif
|
||||
|
||||
/* set device descriptor to the device */
|
||||
@@ -117,18 +115,18 @@ rt_err_t rt_usb_device_init(void)
|
||||
rt_usbd_device_set_descriptor(udevice, &compsit_desc);
|
||||
rt_usbd_device_set_string(udevice, ustring);
|
||||
#else
|
||||
rt_usbd_device_set_descriptor(udevice, func->dev_desc);
|
||||
rt_usbd_device_set_descriptor(udevice, cls->dev_desc);
|
||||
#endif
|
||||
|
||||
/* add the configuration to the device */
|
||||
rt_usbd_device_add_config(udevice, cfg);
|
||||
|
||||
/* initialize usb device controller */
|
||||
rt_device_init(udc);
|
||||
|
||||
/* set default configuration to 1 */
|
||||
rt_usbd_set_config(udevice, 1);
|
||||
|
||||
/* initialize usb device controller */
|
||||
rt_device_init(udc);
|
||||
|
||||
return RT_EOK;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,22 +9,22 @@ core/usbhost.c
|
||||
core/hub.c
|
||||
""")
|
||||
|
||||
if GetDepend('RT_USBH_ADK'):
|
||||
if GetDepend('RT_USB_CLASS_ADK'):
|
||||
src += Glob('class/adk.c')
|
||||
src += Glob('class/adkapp.c')
|
||||
src += Glob('udev/adkapp.c')
|
||||
|
||||
if GetDepend('RT_USBH_MSTORAGE'):
|
||||
if GetDepend('RT_USB_CLASS_MASS_STORAGE'):
|
||||
src += Glob('class/mass.c')
|
||||
src += Glob('class/udisk.c')
|
||||
src += Glob('udev/udisk.c')
|
||||
|
||||
if GetDepend('RT_USBH_HID'):
|
||||
if GetDepend('RT_USB_CLASS_HID'):
|
||||
src += Glob('class/hid.c')
|
||||
|
||||
if GetDepend('RT_USBH_HID_MOUSE'):
|
||||
src += Glob('class/umouse.c')
|
||||
if GetDepend('RT_USB_HID_MOUSE'):
|
||||
src += Glob('udev/umouse.c')
|
||||
|
||||
if GetDepend('RT_USBH_HID_KEYBOARD'):
|
||||
src += Glob('class/ukbd.c')
|
||||
if GetDepend('RT_USB_HID_KEYBOARD'):
|
||||
src += Glob('udev/ukbd.c')
|
||||
|
||||
CPPPATH = [cwd, cwd + '/class', cwd + '/core', \
|
||||
cwd + '/include', cwd + '../../../include']
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
#include <drivers/usb_host.h>
|
||||
#include "adk.h"
|
||||
|
||||
#ifdef RT_USBH_ADK
|
||||
#ifdef RT_USB_CLASS_ADK
|
||||
|
||||
static struct uclass_driver adk_driver;
|
||||
static const char* _adk_manufacturer = RT_NULL;
|
||||
@@ -36,7 +36,7 @@ static const char* _adk_version = RT_NULL;
|
||||
static const char* _adk_uri = RT_NULL;
|
||||
static const char* _adk_serial = RT_NULL;
|
||||
|
||||
rt_err_t rt_usbh_adk_set_string(const char* manufacturer, const char* model,
|
||||
rt_err_t rt_usb_adk_set_string(const char* manufacturer, const char* model,
|
||||
const char* description, const char* _version, const char* uri,
|
||||
const char* serial)
|
||||
{
|
||||
@@ -53,29 +53,29 @@ rt_err_t rt_usbh_adk_set_string(const char* manufacturer, const char* model,
|
||||
#ifdef RT_USING_MODULE
|
||||
#include <rtm.h>
|
||||
|
||||
RTM_EXPORT(rt_usbh_adk_set_string);
|
||||
RTM_EXPORT(rt_usb_adk_set_string);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* This function will do USB_REQ_GET_PROTOCOL request to set idle period to the usb adk device
|
||||
*
|
||||
* @param intf the interface instance.
|
||||
* @param ifinst the interface instance.
|
||||
* @duration the idle period of requesting data.
|
||||
* @report_id the report id
|
||||
*
|
||||
* @return the error code, RT_EOK on successfully.
|
||||
*/
|
||||
static rt_err_t rt_usbh_adk_get_protocol(struct uintf* intf, rt_uint16_t *protocol)
|
||||
static rt_err_t rt_usb_adk_get_protocol(uifinst_t ifinst, rt_uint16_t *protocol)
|
||||
{
|
||||
struct ureqest setup;
|
||||
uinst_t device;
|
||||
uinst_t uinst;
|
||||
int timeout = 100;
|
||||
|
||||
/* parameter check */
|
||||
RT_ASSERT(intf != RT_NULL);
|
||||
RT_ASSERT(intf->device != RT_NULL);
|
||||
RT_ASSERT(ifinst != RT_NULL);
|
||||
RT_ASSERT(ifinst->uinst != RT_NULL);
|
||||
|
||||
device = intf->device;
|
||||
uinst = ifinst->uinst;
|
||||
|
||||
setup.request_type = USB_REQ_TYPE_DIR_IN | USB_REQ_TYPE_VENDOR |
|
||||
USB_REQ_TYPE_DEVICE;
|
||||
@@ -84,7 +84,7 @@ static rt_err_t rt_usbh_adk_get_protocol(struct uintf* intf, rt_uint16_t *protoc
|
||||
setup.length = 2;
|
||||
setup.value = 0;
|
||||
|
||||
if(rt_usb_hcd_control_xfer(device->hcd, device, &setup, (void*)protocol, 2,
|
||||
if(rt_usb_hcd_control_xfer(uinst->hcd, uinst, &setup, (void*)protocol, 2,
|
||||
timeout) == 0) return RT_EOK;
|
||||
else return -RT_FALSE;
|
||||
}
|
||||
@@ -92,24 +92,24 @@ static rt_err_t rt_usbh_adk_get_protocol(struct uintf* intf, rt_uint16_t *protoc
|
||||
/**
|
||||
* This function will do USB_REQ_SEND_STRING request to set idle period to the usb adk device
|
||||
*
|
||||
* @param intf the interface instance.
|
||||
* @param ifinst the interface instance.
|
||||
* @duration the idle period of requesting data.
|
||||
* @report_id the report id
|
||||
*
|
||||
* @return the error code, RT_EOK on successfully.
|
||||
*/
|
||||
static rt_err_t rt_usbh_adk_send_string(struct uintf* intf, rt_uint16_t index,
|
||||
static rt_err_t rt_usb_adk_send_string(uifinst_t ifinst, rt_uint16_t index,
|
||||
const char* str)
|
||||
{
|
||||
struct ureqest setup;
|
||||
uinst_t device;
|
||||
uinst_t uinst;
|
||||
int timeout = 100;
|
||||
|
||||
/* parameter check */
|
||||
RT_ASSERT(intf != RT_NULL);
|
||||
RT_ASSERT(intf->device != RT_NULL);
|
||||
RT_ASSERT(ifinst != RT_NULL);
|
||||
RT_ASSERT(ifinst->uinst != RT_NULL);
|
||||
|
||||
device = intf->device;
|
||||
uinst = ifinst->uinst;
|
||||
|
||||
setup.request_type = USB_REQ_TYPE_DIR_OUT | USB_REQ_TYPE_VENDOR |
|
||||
USB_REQ_TYPE_DEVICE;
|
||||
@@ -118,7 +118,7 @@ static rt_err_t rt_usbh_adk_send_string(struct uintf* intf, rt_uint16_t index,
|
||||
setup.length = rt_strlen(str) + 1;
|
||||
setup.value = 0;
|
||||
|
||||
if(rt_usb_hcd_control_xfer(device->hcd, device, &setup, (void*)str,
|
||||
if(rt_usb_hcd_control_xfer(uinst->hcd, uinst, &setup, (void*)str,
|
||||
rt_strlen(str) + 1, timeout) == 0) return RT_EOK;
|
||||
else return -RT_FALSE;
|
||||
}
|
||||
@@ -126,23 +126,23 @@ static rt_err_t rt_usbh_adk_send_string(struct uintf* intf, rt_uint16_t index,
|
||||
/**
|
||||
* This function will do USB_REQ_START request to set idle period to the usb adk device
|
||||
*
|
||||
* @param intf the interface instance.
|
||||
* @param ifinst the interface instance.
|
||||
* @duration the idle period of requesting data.
|
||||
* @report_id the report id
|
||||
*
|
||||
* @return the error code, RT_EOK on successfully.
|
||||
*/
|
||||
static rt_err_t rt_usbh_adk_start(struct uintf* intf)
|
||||
static rt_err_t rt_usb_adk_start(uifinst_t ifinst)
|
||||
{
|
||||
struct ureqest setup;
|
||||
uinst_t device;
|
||||
uinst_t uinst;
|
||||
int timeout = 100;
|
||||
|
||||
/* parameter check */
|
||||
RT_ASSERT(intf != RT_NULL);
|
||||
RT_ASSERT(intf->device != RT_NULL);
|
||||
RT_ASSERT(ifinst != RT_NULL);
|
||||
RT_ASSERT(ifinst->uinst != RT_NULL);
|
||||
|
||||
device = intf->device;
|
||||
uinst = ifinst->uinst;
|
||||
|
||||
setup.request_type = USB_REQ_TYPE_DIR_OUT | USB_REQ_TYPE_VENDOR |
|
||||
USB_REQ_TYPE_DEVICE;
|
||||
@@ -151,7 +151,7 @@ static rt_err_t rt_usbh_adk_start(struct uintf* intf)
|
||||
setup.length = 0;
|
||||
setup.value = 0;
|
||||
|
||||
if(rt_usb_hcd_control_xfer(device->hcd, device, &setup, RT_NULL, 0,
|
||||
if(rt_usb_hcd_control_xfer(uinst->hcd, uinst, &setup, RT_NULL, 0,
|
||||
timeout) == 0) return RT_EOK;
|
||||
else return -RT_FALSE;
|
||||
}
|
||||
@@ -159,25 +159,25 @@ static rt_err_t rt_usbh_adk_start(struct uintf* intf)
|
||||
/**
|
||||
* This function will read data from usb adk device
|
||||
*
|
||||
* @param intf the interface instance.
|
||||
* @param ifinst the interface instance.
|
||||
*
|
||||
* @return the error code, RT_EOK on successfully.
|
||||
*/
|
||||
static rt_size_t rt_usbh_adk_read(rt_device_t device, rt_off_t pos, void* buffer,
|
||||
static rt_size_t rt_usb_adk_read(rt_device_t device, rt_off_t pos, void* buffer,
|
||||
rt_size_t size)
|
||||
{
|
||||
uadk_t adk;
|
||||
uadkinst_t adkinst;
|
||||
rt_size_t length;
|
||||
struct uintf* intf;
|
||||
uifinst_t ifinst;
|
||||
|
||||
/* check parameter */
|
||||
RT_ASSERT(device != RT_NULL);
|
||||
RT_ASSERT(buffer != RT_NULL);
|
||||
|
||||
intf = (struct uintf*)device->user_data;
|
||||
adk = (uadk_t)intf->user_data;
|
||||
ifinst = (uifinst_t)device->user_data;
|
||||
adkinst = (uadkinst_t)ifinst->user_data;
|
||||
|
||||
length = rt_usb_hcd_bulk_xfer(intf->device->hcd, adk->pipe_in,
|
||||
length = rt_usb_hcd_bulk_xfer(ifinst->uinst->hcd, adkinst->pipe_in,
|
||||
buffer, size, 300);
|
||||
|
||||
return length;
|
||||
@@ -187,23 +187,23 @@ static rt_size_t rt_usbh_adk_read(rt_device_t device, rt_off_t pos, void* buffer
|
||||
/**
|
||||
* This function will write data to usb adk device
|
||||
*
|
||||
* @param intf the interface instance.
|
||||
* @param ifinst the interface instance.
|
||||
*
|
||||
* @return the error code, RT_EOK on successfully.
|
||||
*/
|
||||
static rt_size_t rt_usbh_adk_write (rt_device_t device, rt_off_t pos, const void* buffer,
|
||||
static rt_size_t rt_usb_adk_write (rt_device_t device, rt_off_t pos, const void* buffer,
|
||||
rt_size_t size)
|
||||
{
|
||||
uadk_t adk;
|
||||
uadkinst_t adkinst;
|
||||
rt_size_t length;
|
||||
struct uintf* intf;
|
||||
uifinst_t ifinst;
|
||||
|
||||
RT_ASSERT(buffer != RT_NULL);
|
||||
|
||||
intf = (struct uintf*)device->user_data;
|
||||
adk = (uadk_t)intf->user_data;
|
||||
ifinst = (uifinst_t)device->user_data;
|
||||
adkinst = (uadkinst_t)ifinst->user_data;
|
||||
|
||||
length = rt_usb_hcd_bulk_xfer(intf->device->hcd, adk->pipe_out,
|
||||
length = rt_usb_hcd_bulk_xfer(ifinst->uinst->hcd, adkinst->pipe_out,
|
||||
(void*)buffer, size, 300);
|
||||
|
||||
return length;
|
||||
@@ -217,30 +217,30 @@ static rt_size_t rt_usbh_adk_write (rt_device_t device, rt_off_t pos, const void
|
||||
*
|
||||
* @return the error code, RT_EOK on successfully.
|
||||
*/
|
||||
static rt_err_t rt_usbh_adk_enable(void* arg)
|
||||
static rt_err_t rt_usb_adk_run(void* arg)
|
||||
{
|
||||
int i = 0;
|
||||
uadk_t adk;
|
||||
struct uintf* intf = (struct uintf*)arg;
|
||||
uadkinst_t adkinst;
|
||||
uifinst_t ifinst = (uifinst_t)arg;
|
||||
udev_desc_t dev_desc;
|
||||
rt_uint16_t protocol;
|
||||
rt_err_t ret;
|
||||
|
||||
/* parameter check */
|
||||
if(intf == RT_NULL)
|
||||
if(ifinst == RT_NULL)
|
||||
{
|
||||
rt_kprintf("the interface is not available\n");
|
||||
return -RT_EIO;
|
||||
}
|
||||
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("rt_usbh_adk_run\n"));
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("rt_usb_adk_run\n"));
|
||||
|
||||
dev_desc = &intf->device->dev_desc;
|
||||
dev_desc = &ifinst->uinst->dev_desc;
|
||||
if(dev_desc->idVendor == USB_ACCESSORY_VENDOR_ID &&
|
||||
(dev_desc->idProduct == USB_ACCESSORY_PRODUCT_ID ||
|
||||
dev_desc->idProduct == USB_ACCESSORY_ADB_PRODUCT_ID))
|
||||
{
|
||||
if(intf->intf_desc->bInterfaceSubClass != 0xFF) return -RT_ERROR;
|
||||
if(ifinst->intf_desc->bInterfaceSubClass != 0xFF) return -RT_ERROR;
|
||||
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("found android accessory device\n"));
|
||||
}
|
||||
@@ -248,9 +248,9 @@ static rt_err_t rt_usbh_adk_enable(void* arg)
|
||||
{
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("switch device\n"));
|
||||
|
||||
if((ret = rt_usbh_adk_get_protocol(intf, &protocol)) != RT_EOK)
|
||||
if((ret = rt_usb_adk_get_protocol(ifinst, &protocol)) != RT_EOK)
|
||||
{
|
||||
rt_kprintf("rt_usbh_adk_get_protocol failed\n");
|
||||
rt_kprintf("rt_usb_adk_get_protocol failed\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -260,17 +260,17 @@ static rt_err_t rt_usbh_adk_enable(void* arg)
|
||||
return -RT_ERROR;
|
||||
}
|
||||
|
||||
rt_usbh_adk_send_string(intf,
|
||||
rt_usb_adk_send_string(ifinst,
|
||||
ACCESSORY_STRING_MANUFACTURER, _adk_manufacturer);
|
||||
rt_usbh_adk_send_string(intf,
|
||||
rt_usb_adk_send_string(ifinst,
|
||||
ACCESSORY_STRING_MODEL, _adk_model);
|
||||
rt_usbh_adk_send_string(intf,
|
||||
rt_usb_adk_send_string(ifinst,
|
||||
ACCESSORY_STRING_DESCRIPTION, _adk_description);
|
||||
rt_usbh_adk_send_string(intf,
|
||||
rt_usb_adk_send_string(ifinst,
|
||||
ACCESSORY_STRING_VERSION, _adk_version);
|
||||
rt_usbh_adk_send_string(intf,
|
||||
rt_usb_adk_send_string(ifinst,
|
||||
ACCESSORY_STRING_URI, _adk_uri);
|
||||
rt_usbh_adk_send_string(intf,
|
||||
rt_usb_adk_send_string(ifinst,
|
||||
ACCESSORY_STRING_SERIAL, _adk_serial);
|
||||
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("manufacturer %s\n", _adk_manufacturer));
|
||||
@@ -280,28 +280,28 @@ static rt_err_t rt_usbh_adk_enable(void* arg)
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("uri %s\n", _adk_uri));
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("serial %s\n", _adk_serial));
|
||||
|
||||
if((ret = rt_usbh_adk_start(intf)) != RT_EOK)
|
||||
if((ret = rt_usb_adk_start(ifinst)) != RT_EOK)
|
||||
{
|
||||
rt_kprintf("rt_usbh_adk_start failed\n");
|
||||
rt_kprintf("rt_usb_adk_start failed\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
return RT_EOK;
|
||||
}
|
||||
|
||||
adk = rt_malloc(sizeof(struct uadkinst));
|
||||
RT_ASSERT(adk != RT_NULL);
|
||||
adkinst = rt_malloc(sizeof(struct uadkinst));
|
||||
RT_ASSERT(adkinst != RT_NULL);
|
||||
|
||||
/* initilize the data structure */
|
||||
rt_memset(adk, 0, sizeof(struct uadkinst));
|
||||
intf->user_data = (void*)adk;
|
||||
rt_memset(adkinst, 0, sizeof(struct uadkinst));
|
||||
ifinst->user_data = (void*)adkinst;
|
||||
|
||||
for(i=0; i<intf->intf_desc->bNumEndpoints; i++)
|
||||
for(i=0; i<ifinst->intf_desc->bNumEndpoints; i++)
|
||||
{
|
||||
uep_desc_t ep_desc;
|
||||
|
||||
/* get endpoint descriptor from interface descriptor */
|
||||
rt_usbh_get_endpoint_descriptor(intf->intf_desc, i, &ep_desc);
|
||||
rt_usb_get_endpoint_descriptor(ifinst->intf_desc, i, &ep_desc);
|
||||
if(ep_desc == RT_NULL)
|
||||
{
|
||||
rt_kprintf("rt_usb_get_endpoint_descriptor error\n");
|
||||
@@ -316,41 +316,41 @@ static rt_err_t rt_usbh_adk_enable(void* arg)
|
||||
if(ep_desc->bEndpointAddress & USB_DIR_IN)
|
||||
{
|
||||
/* allocate an in pipe for the adk instance */
|
||||
ret = rt_usb_hcd_alloc_pipe(intf->device->hcd, &adk->pipe_in,
|
||||
intf, ep_desc, RT_NULL);
|
||||
ret = rt_usb_hcd_alloc_pipe(ifinst->uinst->hcd, &adkinst->pipe_in,
|
||||
ifinst, ep_desc, RT_NULL);
|
||||
if(ret != RT_EOK) return ret;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* allocate an output pipe for the adk instance */
|
||||
ret = rt_usb_hcd_alloc_pipe(intf->device->hcd, &adk->pipe_out,
|
||||
intf, ep_desc, RT_NULL);
|
||||
ret = rt_usb_hcd_alloc_pipe(ifinst->uinst->hcd, &adkinst->pipe_out,
|
||||
ifinst, ep_desc, RT_NULL);
|
||||
if(ret != RT_EOK) return ret;
|
||||
}
|
||||
}
|
||||
|
||||
/* check pipes infomation */
|
||||
if(adk->pipe_in == RT_NULL || adk->pipe_out == RT_NULL)
|
||||
if(adkinst->pipe_in == RT_NULL || adkinst->pipe_out == RT_NULL)
|
||||
{
|
||||
rt_kprintf("pipe error, unsupported device\n");
|
||||
return -RT_ERROR;
|
||||
}
|
||||
|
||||
/* set configuration */
|
||||
ret = rt_usbh_set_configure(intf->device, 1);
|
||||
ret = rt_usb_set_configure(ifinst->uinst, 1);
|
||||
if(ret != RT_EOK) return ret;
|
||||
|
||||
/* register adk device */
|
||||
adk->device.type = RT_Device_Class_Char;
|
||||
adk->device.init = RT_NULL;
|
||||
adk->device.open = RT_NULL;
|
||||
adk->device.close = RT_NULL;
|
||||
adk->device.read = rt_usbh_adk_read;
|
||||
adk->device.write = rt_usbh_adk_write;
|
||||
adk->device.control = RT_NULL;
|
||||
adk->device.user_data = (void*)intf;
|
||||
adkinst->device.type = RT_Device_Class_Char;
|
||||
adkinst->device.init = RT_NULL;
|
||||
adkinst->device.open = RT_NULL;
|
||||
adkinst->device.close = RT_NULL;
|
||||
adkinst->device.read = rt_usb_adk_read;
|
||||
adkinst->device.write = rt_usb_adk_write;
|
||||
adkinst->device.control = RT_NULL;
|
||||
adkinst->device.user_data = (void*)ifinst;
|
||||
|
||||
rt_device_register(&adk->device, "adkdev", RT_DEVICE_FLAG_RDWR);
|
||||
rt_device_register(&adkinst->device, "adkdev", RT_DEVICE_FLAG_RDWR);
|
||||
|
||||
return RT_EOK;
|
||||
}
|
||||
@@ -363,39 +363,36 @@ static rt_err_t rt_usbh_adk_enable(void* arg)
|
||||
*
|
||||
* @return the error code, RT_EOK on successfully.
|
||||
*/
|
||||
static rt_err_t rt_usbh_adk_disable(void* arg)
|
||||
static rt_err_t rt_usb_adk_stop(void* arg)
|
||||
{
|
||||
uadk_t adk;
|
||||
struct uintf* intf = (struct uintf*)arg;
|
||||
uadkinst_t adkinst;
|
||||
uifinst_t ifinst = (uifinst_t)arg;
|
||||
|
||||
RT_ASSERT(intf != RT_NULL);
|
||||
RT_ASSERT(ifinst != RT_NULL);
|
||||
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("rt_usbh_adk_stop\n"));
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("rt_usb_adk_stop\n"));
|
||||
|
||||
adk = (uadk_t)intf->user_data;
|
||||
if(adk == RT_NULL)
|
||||
adkinst = (uadkinst_t)ifinst->user_data;
|
||||
if(adkinst == RT_NULL)
|
||||
{
|
||||
rt_free(intf);
|
||||
rt_free(ifinst);
|
||||
return RT_EOK;
|
||||
}
|
||||
|
||||
if(adk->pipe_in != RT_NULL)
|
||||
rt_usb_hcd_free_pipe(intf->device->hcd, adk->pipe_in);
|
||||
if(adkinst->pipe_in != RT_NULL)
|
||||
rt_usb_hcd_free_pipe(ifinst->uinst->hcd, adkinst->pipe_in);
|
||||
|
||||
if(adk->pipe_out != RT_NULL)
|
||||
rt_usb_hcd_free_pipe(intf->device->hcd, adk->pipe_out);
|
||||
if(adkinst->pipe_out != RT_NULL)
|
||||
rt_usb_hcd_free_pipe(ifinst->uinst->hcd, adkinst->pipe_out);
|
||||
|
||||
/* unregister adk device */
|
||||
rt_device_unregister(&adk->device);
|
||||
rt_device_unregister(&adkinst->device);
|
||||
|
||||
/* free adk instance */
|
||||
if(adk != RT_NULL)
|
||||
{
|
||||
rt_free(adk);
|
||||
}
|
||||
if(adkinst != RT_NULL) rt_free(adkinst);
|
||||
|
||||
/* free interface instance */
|
||||
rt_free(intf);
|
||||
rt_free(ifinst);
|
||||
|
||||
return RT_EOK;
|
||||
}
|
||||
@@ -406,12 +403,12 @@ static rt_err_t rt_usbh_adk_disable(void* arg)
|
||||
*
|
||||
* @return the error code, RT_EOK on successfully.
|
||||
*/
|
||||
ucd_t rt_usbh_class_driver_adk(void)
|
||||
ucd_t rt_usb_class_driver_adk(void)
|
||||
{
|
||||
adk_driver.class_code = USB_CLASS_ADK;
|
||||
|
||||
adk_driver.enable = rt_usbh_adk_enable;
|
||||
adk_driver.disable = rt_usbh_adk_disable;
|
||||
adk_driver.run = rt_usb_adk_run;
|
||||
adk_driver.stop = rt_usb_adk_stop;
|
||||
|
||||
return &adk_driver;
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ struct uadkinst
|
||||
|
||||
struct rt_device device;
|
||||
};
|
||||
typedef struct uadkinst* uadk_t;
|
||||
typedef struct uadkinst* uadkinst_t;
|
||||
|
||||
#define USB_ACCESSORY_VENDOR_ID 0x18D1
|
||||
#define USB_ACCESSORY_PRODUCT_ID 0x2D00
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#include <rtthread.h>
|
||||
#include <drivers/usb_host.h>
|
||||
|
||||
static struct uinstance dev[USB_MAX_DEVICE];
|
||||
static struct uinstance uinst[USB_MAX_DEVICE];
|
||||
|
||||
/**
|
||||
* This function will allocate an usb device instance from system.
|
||||
@@ -35,7 +35,7 @@ static struct uinstance dev[USB_MAX_DEVICE];
|
||||
*
|
||||
* @return the allocate instance on successful, or RT_NULL on failure.
|
||||
*/
|
||||
uinst_t rt_usbh_alloc_instance(void)
|
||||
uinst_t rt_usb_alloc_instance(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -45,19 +45,19 @@ uinst_t rt_usbh_alloc_instance(void)
|
||||
for(i=0; i<USB_MAX_DEVICE; i++)
|
||||
{
|
||||
/* to find an idle instance handle */
|
||||
if(dev[i].status != DEV_STATUS_IDLE) continue;
|
||||
if(uinst[i].status != UINST_STATUS_IDLE) continue;
|
||||
|
||||
/* initialize the usb device instance */
|
||||
rt_memset(&dev[i], 0, sizeof(struct uinstance));
|
||||
rt_memset(&uinst[i], 0, sizeof(struct uinstance));
|
||||
|
||||
dev[i].status = DEV_STATUS_BUSY;
|
||||
dev[i].index = i + 1;
|
||||
dev[i].address = 0;
|
||||
dev[i].max_packet_size = 0x8;
|
||||
uinst[i].status = UINST_STATUS_BUSY;
|
||||
uinst[i].index = i + 1;
|
||||
uinst[i].address = 0;
|
||||
uinst[i].max_packet_size = 0x8;
|
||||
|
||||
/* unlock scheduler */
|
||||
rt_exit_critical();
|
||||
return &dev[i];
|
||||
return &uinst[i];
|
||||
}
|
||||
|
||||
/* unlock scheduler */
|
||||
@@ -71,11 +71,11 @@ uinst_t rt_usbh_alloc_instance(void)
|
||||
* and do device enumunation process.
|
||||
*
|
||||
* @param hcd the host controller driver.
|
||||
* @param device the usb device instance.
|
||||
* @param uinst the usb device instance.
|
||||
*
|
||||
* @return the error code, RT_EOK on successfully.
|
||||
*/
|
||||
rt_err_t rt_usbh_attatch_instance(uinst_t device)
|
||||
rt_err_t rt_usb_attatch_instance(uinst_t uinst)
|
||||
{
|
||||
int i = 0;
|
||||
rt_err_t ret = RT_EOK;
|
||||
@@ -84,15 +84,15 @@ rt_err_t rt_usbh_attatch_instance(uinst_t device)
|
||||
uintf_desc_t intf_desc;
|
||||
ucd_t drv;
|
||||
|
||||
RT_ASSERT(device != RT_NULL);
|
||||
RT_ASSERT(uinst != RT_NULL);
|
||||
|
||||
rt_memset(&cfg_desc, 0, sizeof(struct uconfig_descriptor));
|
||||
dev_desc = &device->dev_desc;
|
||||
dev_desc = &uinst->dev_desc;
|
||||
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("start enumnation\n"));
|
||||
|
||||
/* get device descriptor head */
|
||||
ret = rt_usbh_get_descriptor(device, USB_DESC_TYPE_DEVICE, (void*)dev_desc, 8);
|
||||
ret = rt_usb_get_descriptor(uinst, USB_DESC_TYPE_DEVICE, (void*)dev_desc, 8);
|
||||
if(ret != RT_EOK)
|
||||
{
|
||||
rt_kprintf("get device descriptor head failed\n");
|
||||
@@ -100,7 +100,7 @@ rt_err_t rt_usbh_attatch_instance(uinst_t device)
|
||||
}
|
||||
|
||||
/* set device address */
|
||||
ret = rt_usbh_set_address(device);
|
||||
ret = rt_usb_set_address(uinst);
|
||||
if(ret != RT_EOK)
|
||||
{
|
||||
rt_kprintf("set device address failed\n");
|
||||
@@ -108,14 +108,14 @@ rt_err_t rt_usbh_attatch_instance(uinst_t device)
|
||||
}
|
||||
|
||||
/* set device max packet size */
|
||||
device->max_packet_size = device->dev_desc.bMaxPacketSize0;
|
||||
uinst->max_packet_size = uinst->dev_desc.bMaxPacketSize0;
|
||||
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("get device descriptor length %d\n",
|
||||
dev_desc->bLength));
|
||||
|
||||
/* get full device descriptor again */
|
||||
ret = rt_usbh_get_descriptor
|
||||
(device, USB_DESC_TYPE_DEVICE, (void*)dev_desc, dev_desc->bLength);
|
||||
ret = rt_usb_get_descriptor
|
||||
(uinst, USB_DESC_TYPE_DEVICE, (void*)dev_desc, dev_desc->bLength);
|
||||
if(ret != RT_EOK)
|
||||
{
|
||||
rt_kprintf("get full device descriptor failed\n");
|
||||
@@ -126,7 +126,8 @@ rt_err_t rt_usbh_attatch_instance(uinst_t device)
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("Product ID 0x%x\n", dev_desc->idProduct));
|
||||
|
||||
/* get configuration descriptor head */
|
||||
ret = rt_usbh_get_descriptor(device, USB_DESC_TYPE_CONFIGURATION, &cfg_desc, 18);
|
||||
ret = rt_usb_get_descriptor(uinst, USB_DESC_TYPE_CONFIGURATION, &cfg_desc,
|
||||
sizeof(struct uconfig_descriptor));
|
||||
if(ret != RT_EOK)
|
||||
{
|
||||
rt_kprintf("get configuration descriptor head failed\n");
|
||||
@@ -134,12 +135,12 @@ rt_err_t rt_usbh_attatch_instance(uinst_t device)
|
||||
}
|
||||
|
||||
/* alloc memory for configuration descriptor */
|
||||
device->cfg_desc = (ucfg_desc_t)rt_malloc(cfg_desc.wTotalLength);
|
||||
rt_memset(device->cfg_desc, 0, cfg_desc.wTotalLength);
|
||||
uinst->cfg_desc = (ucfg_desc_t)rt_malloc(cfg_desc.wTotalLength);
|
||||
rt_memset(uinst->cfg_desc, 0, cfg_desc.wTotalLength);
|
||||
|
||||
/* get full configuration descriptor */
|
||||
ret = rt_usbh_get_descriptor(device, USB_DESC_TYPE_CONFIGURATION,
|
||||
device->cfg_desc, cfg_desc.wTotalLength);
|
||||
ret = rt_usb_get_descriptor(uinst, USB_DESC_TYPE_CONFIGURATION,
|
||||
uinst->cfg_desc, cfg_desc.wTotalLength);
|
||||
if(ret != RT_EOK)
|
||||
{
|
||||
rt_kprintf("get full configuration descriptor failed\n");
|
||||
@@ -147,13 +148,13 @@ rt_err_t rt_usbh_attatch_instance(uinst_t device)
|
||||
}
|
||||
|
||||
/* set configuration */
|
||||
ret = rt_usbh_set_configure(device, 1);
|
||||
ret = rt_usb_set_configure(uinst, 1);
|
||||
if(ret != RT_EOK) return ret;
|
||||
|
||||
for(i=0; i<device->cfg_desc->bNumInterfaces; i++)
|
||||
for(i=0; i<uinst->cfg_desc->bNumInterfaces; i++)
|
||||
{
|
||||
/* get interface descriptor through configuration descriptor */
|
||||
ret = rt_usbh_get_interface_descriptor(device->cfg_desc, i, &intf_desc);
|
||||
ret = rt_usb_get_interface_descriptor(uinst->cfg_desc, i, &intf_desc);
|
||||
if(ret != RT_EOK)
|
||||
{
|
||||
rt_kprintf("rt_usb_get_interface_descriptor error\n");
|
||||
@@ -165,22 +166,22 @@ rt_err_t rt_usbh_attatch_instance(uinst_t device)
|
||||
intf_desc->bInterfaceSubClass));
|
||||
|
||||
/* find driver by class code found in interface descriptor */
|
||||
drv = rt_usbh_class_driver_find(intf_desc->bInterfaceClass,
|
||||
drv = rt_usb_class_driver_find(intf_desc->bInterfaceClass,
|
||||
intf_desc->bInterfaceSubClass);
|
||||
|
||||
if(drv != RT_NULL)
|
||||
{
|
||||
/* allocate memory for interface device */
|
||||
device->intf[i] =
|
||||
(struct uintf*)rt_malloc(sizeof(struct uintf));
|
||||
/* allocate memory for interface uinst */
|
||||
uinst->ifinst[i] =
|
||||
(uifinst_t)rt_malloc(sizeof(struct uifinst));
|
||||
|
||||
device->intf[i]->drv = drv;
|
||||
device->intf[i]->device = device;
|
||||
device->intf[i]->intf_desc = intf_desc;
|
||||
device->intf[i]->user_data = RT_NULL;
|
||||
uinst->ifinst[i]->drv = drv;
|
||||
uinst->ifinst[i]->uinst = uinst;
|
||||
uinst->ifinst[i]->intf_desc = intf_desc;
|
||||
uinst->ifinst[i]->user_data = RT_NULL;
|
||||
|
||||
/* open usb class driver */
|
||||
ret = rt_usbh_class_driver_enable(drv, (void*)device->intf[i]);
|
||||
ret = rt_usb_class_driver_run(drv, (void*)uinst->ifinst[i]);
|
||||
if(ret != RT_EOK)
|
||||
{
|
||||
rt_kprintf("interface %d run class driver error\n", i);
|
||||
@@ -200,35 +201,35 @@ rt_err_t rt_usbh_attatch_instance(uinst_t device)
|
||||
* This function will detach an usb device instance from its host controller,
|
||||
* and release all resource.
|
||||
*
|
||||
* @param device the usb device instance.
|
||||
* @param uinst the usb device instance.
|
||||
*
|
||||
* @return the error code, RT_EOK on successfully.
|
||||
*/
|
||||
rt_err_t rt_usbh_detach_instance(uinst_t device)
|
||||
rt_err_t rt_usb_detach_instance(uinst_t uinst)
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
if(device == RT_NULL)
|
||||
if(uinst == RT_NULL)
|
||||
{
|
||||
rt_kprintf("no usb instance to detach\n");
|
||||
return -RT_ERROR;
|
||||
}
|
||||
|
||||
/* free configration descriptor */
|
||||
if(device->cfg_desc) rt_free(device->cfg_desc);
|
||||
if(uinst->cfg_desc) rt_free(uinst->cfg_desc);
|
||||
|
||||
for(i=0; i<device->cfg_desc->bNumInterfaces; i++)
|
||||
for(i=0; i<uinst->cfg_desc->bNumInterfaces; i++)
|
||||
{
|
||||
if(device->intf[i] == RT_NULL) continue;
|
||||
if(device->intf[i]->drv == RT_NULL) continue;
|
||||
if(uinst->ifinst[i] == RT_NULL) continue;
|
||||
if(uinst->ifinst[i]->drv == RT_NULL) continue;
|
||||
|
||||
RT_ASSERT(device->intf[i]->device == device);
|
||||
RT_ASSERT(uinst->ifinst[i]->uinst == uinst);
|
||||
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("free interface instance %d\n", i));
|
||||
rt_usbh_class_driver_disable(device->intf[i]->drv, (void*)device->intf[i]);
|
||||
rt_usb_class_driver_stop(uinst->ifinst[i]->drv, (void*)uinst->ifinst[i]);
|
||||
}
|
||||
|
||||
rt_memset(device, 0, sizeof(struct uinstance));
|
||||
rt_memset(uinst, 0, sizeof(struct uinstance));
|
||||
|
||||
return RT_EOK;
|
||||
}
|
||||
@@ -236,20 +237,20 @@ rt_err_t rt_usbh_detach_instance(uinst_t device)
|
||||
/**
|
||||
* This function will do USB_REQ_GET_DESCRIPTO' request for the usb device instance,
|
||||
*
|
||||
* @param device the usb device instance.
|
||||
* @param uinst the usb device instance.
|
||||
* @param type the type of descriptor request.
|
||||
* @param buffer the data buffer to save requested data
|
||||
* @param nbytes the size of buffer
|
||||
*
|
||||
* @return the error code, RT_EOK on successfully.
|
||||
*/
|
||||
rt_err_t rt_usbh_get_descriptor(uinst_t device, rt_uint8_t type, void* buffer,
|
||||
rt_err_t rt_usb_get_descriptor(uinst_t uinst, rt_uint8_t type, void* buffer,
|
||||
int nbytes)
|
||||
{
|
||||
struct ureqest setup;
|
||||
int timeout = 100;
|
||||
|
||||
RT_ASSERT(device != RT_NULL);
|
||||
RT_ASSERT(uinst != RT_NULL);
|
||||
|
||||
setup.request_type = USB_REQ_TYPE_DIR_IN | USB_REQ_TYPE_STANDARD |
|
||||
USB_REQ_TYPE_DEVICE;
|
||||
@@ -258,7 +259,7 @@ rt_err_t rt_usbh_get_descriptor(uinst_t device, rt_uint8_t type, void* buffer,
|
||||
setup.length = nbytes;
|
||||
setup.value = type << 8;
|
||||
|
||||
if(rt_usb_hcd_control_xfer(device->hcd, device, &setup, buffer, nbytes,
|
||||
if(rt_usb_hcd_control_xfer(uinst->hcd, uinst, &setup, buffer, nbytes,
|
||||
timeout) != nbytes) return -RT_EIO;
|
||||
else return RT_EOK;
|
||||
}
|
||||
@@ -266,16 +267,16 @@ rt_err_t rt_usbh_get_descriptor(uinst_t device, rt_uint8_t type, void* buffer,
|
||||
/**
|
||||
* This function will set an address to the usb device.
|
||||
*
|
||||
* @param device the usb device instance.
|
||||
* @param uinst the usb device instance.
|
||||
*
|
||||
* @return the error code, RT_EOK on successfully.
|
||||
*/
|
||||
rt_err_t rt_usbh_set_address(uinst_t device)
|
||||
rt_err_t rt_usb_set_address(uinst_t uinst)
|
||||
{
|
||||
struct ureqest setup;
|
||||
int timeout = 100;
|
||||
|
||||
RT_ASSERT(device != RT_NULL);
|
||||
RT_ASSERT(uinst != RT_NULL);
|
||||
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("rt_usb_set_address\n"));
|
||||
|
||||
@@ -284,14 +285,14 @@ rt_err_t rt_usbh_set_address(uinst_t device)
|
||||
setup.request = USB_REQ_SET_ADDRESS;
|
||||
setup.index = 0;
|
||||
setup.length = 0;
|
||||
setup.value = device->index;
|
||||
setup.value = uinst->index;
|
||||
|
||||
if(rt_usb_hcd_control_xfer(device->hcd, device, &setup, RT_NULL, 0,
|
||||
if(rt_usb_hcd_control_xfer(uinst->hcd, uinst, &setup, RT_NULL, 0,
|
||||
timeout) != 0) return -RT_EIO;
|
||||
|
||||
rt_thread_delay(50);
|
||||
|
||||
device->address = device->index;
|
||||
uinst->address = uinst->index;
|
||||
|
||||
return RT_EOK;
|
||||
}
|
||||
@@ -299,18 +300,18 @@ rt_err_t rt_usbh_set_address(uinst_t device)
|
||||
/**
|
||||
* This function will set a configuration to the usb device.
|
||||
*
|
||||
* @param device the usb device instance.
|
||||
* @param uinst the usb device instance.
|
||||
* @param config the configuration number.
|
||||
*
|
||||
* @return the error code, RT_EOK on successfully.
|
||||
*/
|
||||
rt_err_t rt_usbh_set_configure(uinst_t device, int config)
|
||||
rt_err_t rt_usb_set_configure(uinst_t uinst, int config)
|
||||
{
|
||||
struct ureqest setup;
|
||||
int timeout = 100;
|
||||
|
||||
/* check parameter */
|
||||
RT_ASSERT(device != RT_NULL);
|
||||
RT_ASSERT(uinst != RT_NULL);
|
||||
|
||||
setup.request_type = USB_REQ_TYPE_DIR_OUT | USB_REQ_TYPE_STANDARD |
|
||||
USB_REQ_TYPE_DEVICE;
|
||||
@@ -319,7 +320,7 @@ rt_err_t rt_usbh_set_configure(uinst_t device, int config)
|
||||
setup.length = 0;
|
||||
setup.value = config;
|
||||
|
||||
if(rt_usb_hcd_control_xfer(device->hcd, device, &setup, RT_NULL, 0,
|
||||
if(rt_usb_hcd_control_xfer(uinst->hcd, uinst, &setup, RT_NULL, 0,
|
||||
timeout) != 0) return -RT_EIO;
|
||||
|
||||
return RT_EOK;
|
||||
@@ -328,18 +329,18 @@ rt_err_t rt_usbh_set_configure(uinst_t device, int config)
|
||||
/**
|
||||
* This function will set an interface to the usb device.
|
||||
*
|
||||
* @param device the usb device instance.
|
||||
* @param uinst the usb device instance.
|
||||
* @param intf the interface number.
|
||||
*
|
||||
* @return the error code, RT_EOK on successfully.
|
||||
*/
|
||||
rt_err_t rt_usbh_set_interface(uinst_t device, int intf)
|
||||
rt_err_t rt_usb_set_interface(uinst_t uinst, int intf)
|
||||
{
|
||||
struct ureqest setup;
|
||||
int timeout = 100;
|
||||
|
||||
/* check parameter */
|
||||
RT_ASSERT(device != RT_NULL);
|
||||
RT_ASSERT(uinst != RT_NULL);
|
||||
|
||||
setup.request_type = USB_REQ_TYPE_DIR_OUT | USB_REQ_TYPE_STANDARD |
|
||||
USB_REQ_TYPE_INTERFACE;
|
||||
@@ -348,7 +349,7 @@ rt_err_t rt_usbh_set_interface(uinst_t device, int intf)
|
||||
setup.length = 0;
|
||||
setup.value = intf;
|
||||
|
||||
if(rt_usb_hcd_control_xfer(device->hcd, device, &setup, RT_NULL, 0,
|
||||
if(rt_usb_hcd_control_xfer(uinst->hcd, uinst, &setup, RT_NULL, 0,
|
||||
timeout) != 0) return -RT_EIO;
|
||||
|
||||
return RT_EOK;
|
||||
@@ -357,18 +358,18 @@ rt_err_t rt_usbh_set_interface(uinst_t device, int intf)
|
||||
/**
|
||||
* This function will clear feature for the endpoint of the usb device.
|
||||
*
|
||||
* @param device the usb device instance.
|
||||
* @param uinst the usb device instance.
|
||||
* @param endpoint the endpoint number of the usb device.
|
||||
*
|
||||
* @return the error code, RT_EOK on successfully.
|
||||
*/
|
||||
rt_err_t rt_usbh_clear_feature(uinst_t device, int endpoint, int feature)
|
||||
rt_err_t rt_usb_clear_feature(uinst_t uinst, int endpoint, int feature)
|
||||
{
|
||||
struct ureqest setup;
|
||||
int timeout = 100;
|
||||
|
||||
/* check parameter */
|
||||
RT_ASSERT(device != RT_NULL);
|
||||
RT_ASSERT(uinst != RT_NULL);
|
||||
|
||||
setup.request_type = USB_REQ_TYPE_DIR_OUT | USB_REQ_TYPE_STANDARD |
|
||||
USB_REQ_TYPE_ENDPOINT;
|
||||
@@ -377,7 +378,7 @@ rt_err_t rt_usbh_clear_feature(uinst_t device, int endpoint, int feature)
|
||||
setup.length = 0;
|
||||
setup.value = feature;
|
||||
|
||||
if(rt_usb_hcd_control_xfer(device->hcd, device, &setup, RT_NULL, 0,
|
||||
if(rt_usb_hcd_control_xfer(uinst->hcd, uinst, &setup, RT_NULL, 0,
|
||||
timeout) != 0) return -RT_EIO;
|
||||
|
||||
return RT_EOK;
|
||||
@@ -392,7 +393,7 @@ rt_err_t rt_usbh_clear_feature(uinst_t device, int endpoint, int feature)
|
||||
*
|
||||
* @return the error code, RT_EOK on successfully.
|
||||
*/
|
||||
rt_err_t rt_usbh_get_interface_descriptor(ucfg_desc_t cfg_desc, int num,
|
||||
rt_err_t rt_usb_get_interface_descriptor(ucfg_desc_t cfg_desc, int num,
|
||||
uintf_desc_t* intf_desc)
|
||||
{
|
||||
rt_uint32_t ptr, depth = 0;
|
||||
@@ -437,7 +438,7 @@ rt_err_t rt_usbh_get_interface_descriptor(ucfg_desc_t cfg_desc, int num,
|
||||
*
|
||||
* @return the error code, RT_EOK on successfully.
|
||||
*/
|
||||
rt_err_t rt_usbh_get_endpoint_descriptor(uintf_desc_t intf_desc, int num,
|
||||
rt_err_t rt_usb_get_endpoint_descriptor(uintf_desc_t intf_desc, int num,
|
||||
uep_desc_t* ep_desc)
|
||||
{
|
||||
int count = 0, depth = 0;
|
||||
|
||||
@@ -34,7 +34,7 @@ static rt_list_t _driver_list;
|
||||
*
|
||||
* @return the error code, RT_EOK on successfully.
|
||||
*/
|
||||
rt_err_t rt_usbh_class_driver_init(void)
|
||||
rt_err_t rt_usb_class_driver_init(void)
|
||||
{
|
||||
rt_list_init(&_driver_list);
|
||||
|
||||
@@ -49,7 +49,7 @@ rt_err_t rt_usbh_class_driver_init(void)
|
||||
* @return the error code, RT_EOK on successfully.
|
||||
*/
|
||||
|
||||
rt_err_t rt_usbh_class_driver_register(ucd_t drv)
|
||||
rt_err_t rt_usb_class_driver_register(ucd_t drv)
|
||||
{
|
||||
if (drv == RT_NULL) return -RT_ERROR;
|
||||
|
||||
@@ -66,7 +66,7 @@ rt_err_t rt_usbh_class_driver_register(ucd_t drv)
|
||||
*
|
||||
* @return the error code, RT_EOK on successfully.
|
||||
*/
|
||||
rt_err_t rt_usbh_class_driver_unregister(ucd_t drv)
|
||||
rt_err_t rt_usb_class_driver_unregister(ucd_t drv)
|
||||
{
|
||||
RT_ASSERT(drv != RT_NULL);
|
||||
|
||||
@@ -84,12 +84,12 @@ rt_err_t rt_usbh_class_driver_unregister(ucd_t drv)
|
||||
*
|
||||
* @return the error code, RT_EOK on successfully.
|
||||
*/
|
||||
rt_err_t rt_usbh_class_driver_enable(ucd_t drv, void* args)
|
||||
rt_err_t rt_usb_class_driver_run(ucd_t drv, void* args)
|
||||
{
|
||||
RT_ASSERT(drv != RT_NULL);
|
||||
|
||||
if(drv->enable != RT_NULL)
|
||||
drv->enable(args);
|
||||
if(drv->run != RT_NULL)
|
||||
drv->run(args);
|
||||
|
||||
return RT_EOK;
|
||||
}
|
||||
@@ -102,12 +102,12 @@ rt_err_t rt_usbh_class_driver_enable(ucd_t drv, void* args)
|
||||
*
|
||||
* @return the error code, RT_EOK on successfully.
|
||||
*/
|
||||
rt_err_t rt_usbh_class_driver_disable(ucd_t drv, void* args)
|
||||
rt_err_t rt_usb_class_driver_stop(ucd_t drv, void* args)
|
||||
{
|
||||
RT_ASSERT(drv != RT_NULL);
|
||||
|
||||
if(drv->disable != RT_NULL)
|
||||
drv->disable(args);
|
||||
if(drv->stop != RT_NULL)
|
||||
drv->stop(args);
|
||||
|
||||
return RT_EOK;
|
||||
}
|
||||
@@ -121,7 +121,7 @@ rt_err_t rt_usbh_class_driver_disable(ucd_t drv, void* args)
|
||||
*
|
||||
* @return the registered usb class driver on successful, or RT_NULL on failure.
|
||||
*/
|
||||
ucd_t rt_usbh_class_driver_find(int class_code, int subclass_code)
|
||||
ucd_t rt_usb_class_driver_find(int class_code, int subclass_code)
|
||||
{
|
||||
struct rt_list_node *node;
|
||||
|
||||
|
||||
@@ -34,20 +34,20 @@ static struct uclass_driver hub_driver;
|
||||
* This function will do USB_REQ_GET_DESCRIPTOR request for the device instance
|
||||
* to get usb hub descriptor.
|
||||
*
|
||||
* @param intf the interface instance.
|
||||
* @param ifinst the interface instance.
|
||||
* @buffer the data buffer to save usb hub descriptor.
|
||||
* @param nbytes the size of buffer
|
||||
*
|
||||
* @return the error code, RT_EOK on successfully.
|
||||
*/
|
||||
rt_err_t rt_usbh_hub_get_descriptor(struct uinstance* device, rt_uint8_t *buffer,
|
||||
rt_err_t rt_usb_hub_get_descriptor(uinst_t uinst, rt_uint8_t *buffer,
|
||||
rt_size_t nbytes)
|
||||
{
|
||||
struct ureqest setup;
|
||||
int timeout = 100;
|
||||
|
||||
/* parameter check */
|
||||
RT_ASSERT(device != RT_NULL);
|
||||
RT_ASSERT(uinst != RT_NULL);
|
||||
|
||||
setup.request_type = USB_REQ_TYPE_DIR_IN | USB_REQ_TYPE_CLASS |
|
||||
USB_REQ_TYPE_DEVICE;
|
||||
@@ -56,7 +56,7 @@ rt_err_t rt_usbh_hub_get_descriptor(struct uinstance* device, rt_uint8_t *buffer
|
||||
setup.length = nbytes;
|
||||
setup.value = USB_DESC_TYPE_HUB << 8;
|
||||
|
||||
if(rt_usb_hcd_control_xfer(device->hcd, device, &setup, buffer, nbytes,
|
||||
if(rt_usb_hcd_control_xfer(uinst->hcd, uinst, &setup, buffer, nbytes,
|
||||
timeout) == nbytes) return RT_EOK;
|
||||
else return -RT_FALSE;
|
||||
}
|
||||
@@ -65,19 +65,19 @@ rt_err_t rt_usbh_hub_get_descriptor(struct uinstance* device, rt_uint8_t *buffer
|
||||
* This function will do USB_REQ_GET_STATUS request for the device instance
|
||||
* to get usb hub status.
|
||||
*
|
||||
* @param intf the interface instance.
|
||||
* @param ifinst the interface instance.
|
||||
* @buffer the data buffer to save usb hub status.
|
||||
*
|
||||
* @return the error code, RT_EOK on successfully.
|
||||
*/
|
||||
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)
|
||||
{
|
||||
struct ureqest setup;
|
||||
int timeout = 100;
|
||||
int length = 4;
|
||||
|
||||
/* parameter check */
|
||||
RT_ASSERT(device != RT_NULL);
|
||||
RT_ASSERT(uinst != RT_NULL);
|
||||
|
||||
setup.request_type = USB_REQ_TYPE_DIR_IN | USB_REQ_TYPE_CLASS |
|
||||
USB_REQ_TYPE_DEVICE;
|
||||
@@ -86,7 +86,7 @@ rt_err_t rt_usbh_hub_get_status(struct uinstance* device, rt_uint8_t* buffer)
|
||||
setup.length = length;
|
||||
setup.value = 0;
|
||||
|
||||
if(rt_usb_hcd_control_xfer(device->hcd, device, &setup, buffer, length,
|
||||
if(rt_usb_hcd_control_xfer(uinst->hcd, uinst, &setup, buffer, length,
|
||||
timeout) == length) return RT_EOK;
|
||||
else return -RT_FALSE;
|
||||
}
|
||||
@@ -95,13 +95,13 @@ rt_err_t rt_usbh_hub_get_status(struct uinstance* device, rt_uint8_t* buffer)
|
||||
* This function will do USB_REQ_GET_STATUS request for the device instance
|
||||
* to get hub port status.
|
||||
*
|
||||
* @param intf the interface instance.
|
||||
* @param ifinst the interface instance.
|
||||
* @port the hub port to get status.
|
||||
* @buffer the data buffer to save usb hub status.
|
||||
*
|
||||
* @return the error code, RT_EOK on successfully.
|
||||
*/
|
||||
rt_err_t rt_usbh_hub_get_port_status(uhub_t hub, rt_uint16_t port,
|
||||
rt_err_t rt_usb_hub_get_port_status(uhubinst_t uhub, rt_uint16_t port,
|
||||
rt_uint8_t* buffer)
|
||||
{
|
||||
struct ureqest setup;
|
||||
@@ -109,12 +109,12 @@ rt_err_t rt_usbh_hub_get_port_status(uhub_t hub, rt_uint16_t port,
|
||||
int length = 4;
|
||||
|
||||
/* parameter check */
|
||||
RT_ASSERT(hub != RT_NULL);
|
||||
RT_ASSERT(uhub != RT_NULL);
|
||||
|
||||
/* get roothub port status */
|
||||
if(hub->is_roothub)
|
||||
if(uhub->is_roothub)
|
||||
{
|
||||
rt_usb_hcd_hub_control(hub->hcd, port, RH_GET_PORT_STATUS,
|
||||
rt_usb_hcd_hub_control(uhub->hcd, port, RH_GET_PORT_STATUS,
|
||||
(void*)buffer);
|
||||
return RT_EOK;
|
||||
}
|
||||
@@ -126,7 +126,7 @@ rt_err_t rt_usbh_hub_get_port_status(uhub_t hub, rt_uint16_t port,
|
||||
setup.length = 4;
|
||||
setup.value = 0;
|
||||
|
||||
if(rt_usb_hcd_control_xfer(hub->hcd, hub->self, &setup, buffer,
|
||||
if(rt_usb_hcd_control_xfer(uhub->hcd, uhub->self, &setup, buffer,
|
||||
length, timeout) == timeout) return RT_EOK;
|
||||
else return -RT_FALSE;
|
||||
}
|
||||
@@ -135,25 +135,25 @@ rt_err_t rt_usbh_hub_get_port_status(uhub_t hub, rt_uint16_t port,
|
||||
* This function will do USB_REQ_CLEAR_FEATURE request for the device instance
|
||||
* to clear feature of the hub port.
|
||||
*
|
||||
* @param intf the interface instance.
|
||||
* @param ifinst the interface instance.
|
||||
* @port the hub port.
|
||||
* @feature feature to be cleared.
|
||||
*
|
||||
* @return the error code, RT_EOK on successfully.
|
||||
*/
|
||||
rt_err_t rt_usbh_hub_clear_port_feature(uhub_t hub, rt_uint16_t port,
|
||||
rt_err_t rt_usb_hub_clear_port_feature(uhubinst_t uhub, rt_uint16_t port,
|
||||
rt_uint16_t feature)
|
||||
{
|
||||
struct ureqest setup;
|
||||
int timeout = 100;
|
||||
|
||||
/* parameter check */
|
||||
RT_ASSERT(hub != RT_NULL);
|
||||
RT_ASSERT(uhub != RT_NULL);
|
||||
|
||||
/* clear roothub feature */
|
||||
if(hub->is_roothub)
|
||||
if(uhub->is_roothub)
|
||||
{
|
||||
rt_usb_hcd_hub_control(hub->hcd, port, RH_CLEAR_PORT_FEATURE,
|
||||
rt_usb_hcd_hub_control(uhub->hcd, port, RH_CLEAR_PORT_FEATURE,
|
||||
(void*)feature);
|
||||
return RT_EOK;
|
||||
}
|
||||
@@ -165,7 +165,7 @@ rt_err_t rt_usbh_hub_clear_port_feature(uhub_t hub, rt_uint16_t port,
|
||||
setup.length = 0;
|
||||
setup.value = feature;
|
||||
|
||||
if(rt_usb_hcd_control_xfer(hub->hcd, hub->self, &setup, RT_NULL, 0,
|
||||
if(rt_usb_hcd_control_xfer(uhub->hcd, uhub->self, &setup, RT_NULL, 0,
|
||||
timeout) == 0) return RT_EOK;
|
||||
else return -RT_FALSE;
|
||||
}
|
||||
@@ -174,25 +174,25 @@ rt_err_t rt_usbh_hub_clear_port_feature(uhub_t hub, rt_uint16_t port,
|
||||
* This function will do USB_REQ_SET_FEATURE request for the device instance
|
||||
* to set feature of the hub port.
|
||||
*
|
||||
* @param intf the interface instance.
|
||||
* @param ifinst the interface instance.
|
||||
* @port the hub port.
|
||||
* @feature feature to be set.
|
||||
*
|
||||
* @return the error code, RT_EOK on successfully.
|
||||
*/
|
||||
rt_err_t rt_usbh_hub_set_port_feature(uhub_t hub, rt_uint16_t port,
|
||||
rt_err_t rt_usb_hub_set_port_feature(uhubinst_t uhub, rt_uint16_t port,
|
||||
rt_uint16_t feature)
|
||||
{
|
||||
struct ureqest setup;
|
||||
int timeout = 100;
|
||||
|
||||
/* parameter check */
|
||||
RT_ASSERT(hub != RT_NULL);
|
||||
RT_ASSERT(uhub != RT_NULL);
|
||||
|
||||
/* clear roothub feature */
|
||||
if(hub->is_roothub)
|
||||
if(uhub->is_roothub)
|
||||
{
|
||||
rt_usb_hcd_hub_control(hub->hcd, port, RH_SET_PORT_FEATURE,
|
||||
rt_usb_hcd_hub_control(uhub->hcd, port, RH_SET_PORT_FEATURE,
|
||||
(void*)feature);
|
||||
return RT_EOK;
|
||||
}
|
||||
@@ -204,7 +204,7 @@ rt_err_t rt_usbh_hub_set_port_feature(uhub_t hub, rt_uint16_t port,
|
||||
setup.length = 0;
|
||||
setup.value = feature;
|
||||
|
||||
if(rt_usb_hcd_control_xfer(hub->hcd, hub->self, &setup, RT_NULL, 0,
|
||||
if(rt_usb_hcd_control_xfer(uhub->hcd, uhub->self, &setup, RT_NULL, 0,
|
||||
timeout) == 0) return RT_EOK;
|
||||
else return -RT_FALSE;
|
||||
}
|
||||
@@ -212,33 +212,33 @@ rt_err_t rt_usbh_hub_set_port_feature(uhub_t hub, rt_uint16_t port,
|
||||
/**
|
||||
* This function will rest hub port, it is invoked when sub device attached to the hub port.
|
||||
*
|
||||
* @param intf the interface instance.
|
||||
* @param ifinst the interface instance.
|
||||
* @param port the hub port.
|
||||
*
|
||||
* @return the error code, RT_EOK on successfully.
|
||||
*/
|
||||
rt_err_t rt_usbh_hub_reset_port(uhub_t hub, rt_uint16_t port)
|
||||
rt_err_t rt_usb_hub_reset_port(uhubinst_t uhub, rt_uint16_t port)
|
||||
{
|
||||
rt_err_t ret;
|
||||
rt_uint32_t pstatus;
|
||||
|
||||
/* parameter check */
|
||||
RT_ASSERT(hub != RT_NULL);
|
||||
RT_ASSERT(uhub != RT_NULL);
|
||||
|
||||
rt_thread_delay(50);
|
||||
|
||||
/* reset hub port */
|
||||
ret = rt_usbh_hub_set_port_feature(hub, port, PORT_FEAT_RESET);
|
||||
ret = rt_usb_hub_set_port_feature(uhub, port, PORT_FEAT_RESET);
|
||||
if(ret != RT_EOK) return ret;
|
||||
|
||||
while(1)
|
||||
{
|
||||
ret = rt_usbh_hub_get_port_status(hub, port, (rt_uint8_t*)&pstatus);
|
||||
ret = rt_usb_hub_get_port_status(uhub, port, (rt_uint8_t*)&pstatus);
|
||||
if(!(pstatus & PORT_PRS)) break;
|
||||
}
|
||||
|
||||
/* clear port reset feature */
|
||||
ret = rt_usbh_hub_clear_port_feature(hub, port, PORT_FEAT_C_RESET);
|
||||
ret = rt_usb_hub_clear_port_feature(uhub, port, PORT_FEAT_C_RESET);
|
||||
if(ret != RT_EOK) return ret;
|
||||
|
||||
rt_thread_delay(50);
|
||||
@@ -249,12 +249,12 @@ rt_err_t rt_usbh_hub_reset_port(uhub_t hub, rt_uint16_t port)
|
||||
/**
|
||||
* This function will do debouce, it is invoked when sub device attached to the hub port.
|
||||
*
|
||||
* @param device the usb instance.
|
||||
* @param uinst the usb instance.
|
||||
* @param port the hub port.
|
||||
*
|
||||
* @return the error code, RT_EOK on successfully.
|
||||
*/
|
||||
rt_err_t rt_usbh_hub_port_debounce(uhub_t hub, rt_uint16_t port)
|
||||
rt_err_t rt_usb_hub_port_debounce(uhubinst_t uhub, rt_uint16_t port)
|
||||
{
|
||||
rt_err_t ret;
|
||||
int i = 0, times = 20;
|
||||
@@ -262,11 +262,11 @@ rt_err_t rt_usbh_hub_port_debounce(uhub_t hub, rt_uint16_t port)
|
||||
rt_bool_t connect = RT_TRUE;
|
||||
|
||||
/* parameter check */
|
||||
RT_ASSERT(hub != RT_NULL);
|
||||
RT_ASSERT(uhub != RT_NULL);
|
||||
|
||||
for(i=0; i<times; i++)
|
||||
{
|
||||
ret = rt_usbh_hub_get_port_status(hub, port, (rt_uint8_t*)&pstatus);
|
||||
ret = rt_usb_hub_get_port_status(uhub, port, (rt_uint8_t*)&pstatus);
|
||||
if(ret != RT_EOK) return ret;
|
||||
|
||||
if(!(pstatus & PORT_CCS))
|
||||
@@ -286,70 +286,70 @@ rt_err_t rt_usbh_hub_port_debounce(uhub_t hub, rt_uint16_t port)
|
||||
* This function will poll all the hub ports to detect port status, especially connect and
|
||||
* disconnect events.
|
||||
*
|
||||
* @param intf the interface instance.
|
||||
* @param ifinst the interface instance.
|
||||
*
|
||||
* @return the error code, RT_EOK on successfully.
|
||||
*/
|
||||
static rt_err_t rt_usbh_hub_port_change(uhub_t hub)
|
||||
static rt_err_t rt_usb_hub_port_change(uhubinst_t uhub)
|
||||
{
|
||||
int i;
|
||||
rt_bool_t reconnect;
|
||||
|
||||
/* parameter check */
|
||||
RT_ASSERT(hub != RT_NULL);
|
||||
RT_ASSERT(uhub != RT_NULL);
|
||||
|
||||
/* get usb device instance */
|
||||
for (i = 0; i < hub->num_ports; i++)
|
||||
for (i = 0; i < uhub->num_ports; i++)
|
||||
{
|
||||
rt_err_t ret;
|
||||
struct uinstance* device;
|
||||
uinst_t uinst;
|
||||
rt_uint32_t pstatus = 0;
|
||||
|
||||
reconnect = RT_FALSE;
|
||||
|
||||
/* get hub port status */
|
||||
ret = rt_usbh_hub_get_port_status(hub, i + 1, (rt_uint8_t*)&pstatus);
|
||||
ret = rt_usb_hub_get_port_status(uhub, i + 1, (rt_uint8_t*)&pstatus);
|
||||
if(ret != RT_EOK) continue;
|
||||
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("port %d status 0x%x\n", i, pstatus));
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("port_status 0x%x\n", pstatus));
|
||||
|
||||
/* check port status change */
|
||||
if ((pstatus & PORT_CCSC))
|
||||
{
|
||||
/* clear port status change feature */
|
||||
rt_usbh_hub_clear_port_feature(hub, i + 1, PORT_FEAT_C_CONNECTION);
|
||||
rt_usb_hub_clear_port_feature(uhub, i + 1, PORT_FEAT_C_CONNECTION);
|
||||
reconnect = RT_TRUE;
|
||||
}
|
||||
|
||||
if(pstatus & PORT_PESC)
|
||||
{
|
||||
rt_usbh_hub_clear_port_feature(hub, i + 1, PORT_FEAT_C_ENABLE);
|
||||
rt_usb_hub_clear_port_feature(uhub, i + 1, PORT_FEAT_C_ENABLE);
|
||||
reconnect = RT_TRUE;
|
||||
}
|
||||
|
||||
if(reconnect)
|
||||
{
|
||||
if(hub->child[i]->status != DEV_STATUS_IDLE)
|
||||
rt_usbh_detach_instance(hub->child[i]);
|
||||
if(uhub->child[i]->status != UINST_STATUS_IDLE)
|
||||
rt_usb_detach_instance(uhub->child[i]);
|
||||
|
||||
ret = rt_usbh_hub_port_debounce(hub, i + 1);
|
||||
ret = rt_usb_hub_port_debounce(uhub, i + 1);
|
||||
if(ret != RT_EOK) continue;
|
||||
|
||||
/* allocate an usb instance for new connected device */
|
||||
device = rt_usbh_alloc_instance();
|
||||
if(device == RT_NULL) break;
|
||||
uinst = rt_usb_alloc_instance();
|
||||
if(uinst == RT_NULL) break;
|
||||
|
||||
/* set usb device speed */
|
||||
device->speed = (pstatus & PORT_LSDA) ? 1 : 0;
|
||||
device->parent = hub;
|
||||
device->hcd = hub->hcd;
|
||||
hub->child[i] = device;
|
||||
uinst->speed = (pstatus & PORT_LSDA) ? 1 : 0;
|
||||
uinst->parent = uhub;
|
||||
uinst->hcd = uhub->hcd;
|
||||
uhub->child[i] = uinst;
|
||||
|
||||
/* reset usb roothub port */
|
||||
rt_usbh_hub_reset_port(hub, i + 1);
|
||||
rt_usb_hub_reset_port(uhub, i + 1);
|
||||
|
||||
/* attatch the usb instance to the hcd */
|
||||
rt_usbh_attatch_instance(device);
|
||||
rt_usb_attatch_instance(uinst);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -363,18 +363,18 @@ static rt_err_t rt_usbh_hub_port_change(uhub_t hub)
|
||||
*
|
||||
* @return none.
|
||||
*/
|
||||
static void rt_usbh_hub_irq(void* context)
|
||||
static void rt_usb_hub_irq(void* context)
|
||||
{
|
||||
upipe_t pipe;
|
||||
struct uintf* intf;
|
||||
uhub_t hub;
|
||||
uifinst_t ifinst;
|
||||
uhubinst_t uhub;
|
||||
int timeout = 100;
|
||||
|
||||
RT_ASSERT(context != RT_NULL);
|
||||
|
||||
pipe = (upipe_t)context;
|
||||
intf = pipe->intf;
|
||||
hub = (uhub_t)intf->user_data;
|
||||
ifinst = pipe->ifinst;
|
||||
uhub = (uhubinst_t)ifinst->user_data;
|
||||
|
||||
if(pipe->status != UPIPE_STATUS_OK)
|
||||
{
|
||||
@@ -382,14 +382,14 @@ static void rt_usbh_hub_irq(void* context)
|
||||
return;
|
||||
}
|
||||
|
||||
rt_usbh_hub_port_change(hub);
|
||||
rt_usb_hub_port_change(uhub);
|
||||
|
||||
rt_kprintf("hub int xfer...\n");
|
||||
|
||||
/* parameter check */
|
||||
RT_ASSERT(pipe->intf->device->hcd != RT_NULL);
|
||||
RT_ASSERT(pipe->ifinst->uinst->hcd != RT_NULL);
|
||||
|
||||
rt_usb_hcd_int_xfer(intf->device->hcd, pipe, hub->buffer,
|
||||
rt_usb_hcd_int_xfer(ifinst->uinst->hcd, pipe, uhub->buffer,
|
||||
pipe->ep.wMaxPacketSize, timeout);
|
||||
}
|
||||
|
||||
@@ -401,33 +401,33 @@ static void rt_usbh_hub_irq(void* context)
|
||||
*
|
||||
* @return the error code, RT_EOK on successfully.
|
||||
*/
|
||||
static rt_err_t rt_usbh_hub_enable(void *arg)
|
||||
static rt_err_t rt_usb_hub_run(void *arg)
|
||||
{
|
||||
int i = 0;
|
||||
rt_err_t ret = RT_EOK;
|
||||
uep_desc_t ep_desc;
|
||||
uhub_t hub;
|
||||
struct uinstance* device;
|
||||
struct uintf* intf = (struct uintf*)arg;
|
||||
uhubinst_t uhub;
|
||||
uinst_t uinst;
|
||||
uifinst_t ifinst = (uifinst_t)arg;
|
||||
int timeout = 300;
|
||||
|
||||
/* paremeter check */
|
||||
RT_ASSERT(intf != RT_NULL);
|
||||
RT_ASSERT(ifinst != RT_NULL);
|
||||
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("rt_usbh_hub_run\n"));
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("rt_usb_hub_run\n"));
|
||||
|
||||
/* get usb device instance */
|
||||
device = intf->device;
|
||||
uinst = ifinst->uinst;
|
||||
|
||||
/* create a hub instance */
|
||||
hub = rt_malloc(sizeof(struct uhub));
|
||||
rt_memset(hub, 0, sizeof(struct uhub));
|
||||
uhub = rt_malloc(sizeof(struct uhubinst));
|
||||
rt_memset(uhub, 0, sizeof(struct uhubinst));
|
||||
|
||||
/* make interface instance's user data point to hub instance */
|
||||
intf->user_data = (void*)hub;
|
||||
ifinst->user_data = (void*)uhub;
|
||||
|
||||
/* get hub descriptor head */
|
||||
ret = rt_usbh_hub_get_descriptor(device, (rt_uint8_t*)&hub->hub_desc, 8);
|
||||
ret = rt_usb_hub_get_descriptor(uinst, (rt_uint8_t*)&uhub->hub_desc, 8);
|
||||
if(ret != RT_EOK)
|
||||
{
|
||||
rt_kprintf("get hub descriptor failed\n");
|
||||
@@ -435,8 +435,8 @@ static rt_err_t rt_usbh_hub_enable(void *arg)
|
||||
}
|
||||
|
||||
/* get full hub descriptor */
|
||||
ret = rt_usbh_hub_get_descriptor(device, (rt_uint8_t*)&hub->hub_desc,
|
||||
hub->hub_desc.length);
|
||||
ret = rt_usb_hub_get_descriptor(uinst, (rt_uint8_t*)&uhub->hub_desc,
|
||||
uhub->hub_desc.length);
|
||||
if(ret != RT_EOK)
|
||||
{
|
||||
rt_kprintf("get hub descriptor again failed\n");
|
||||
@@ -444,23 +444,23 @@ static rt_err_t rt_usbh_hub_enable(void *arg)
|
||||
}
|
||||
|
||||
/* get hub ports number */
|
||||
hub->num_ports = hub->hub_desc.num_ports;
|
||||
hub->hcd = device->hcd;
|
||||
hub->self = device;
|
||||
uhub->num_ports = uhub->hub_desc.num_ports;
|
||||
uhub->hcd = uinst->hcd;
|
||||
uhub->self = uinst;
|
||||
|
||||
/* reset all hub ports */
|
||||
for (i = 0; i < hub->num_ports; i++)
|
||||
for (i = 0; i < uhub->num_ports; i++)
|
||||
{
|
||||
rt_usbh_hub_set_port_feature(hub, i + 1, PORT_FEAT_POWER);
|
||||
rt_thread_delay(hub->hub_desc.pwron_to_good
|
||||
rt_usb_hub_set_port_feature(uhub, i + 1, PORT_FEAT_POWER);
|
||||
rt_thread_delay(uhub->hub_desc.pwron_to_good
|
||||
* 2 * RT_TICK_PER_SECOND / 1000 );
|
||||
}
|
||||
|
||||
if(intf->intf_desc->bNumEndpoints != 1)
|
||||
if(ifinst->intf_desc->bNumEndpoints != 1)
|
||||
return -RT_ERROR;
|
||||
|
||||
/* get endpoint descriptor from interface descriptor */
|
||||
rt_usbh_get_endpoint_descriptor(intf->intf_desc, 0, &ep_desc);
|
||||
rt_usb_get_endpoint_descriptor(ifinst->intf_desc, 0, &ep_desc);
|
||||
if(ep_desc == RT_NULL)
|
||||
{
|
||||
rt_kprintf("rt_usb_get_endpoint_descriptor error\n");
|
||||
@@ -474,17 +474,17 @@ static rt_err_t rt_usbh_hub_enable(void *arg)
|
||||
if(ep_desc->bEndpointAddress & USB_DIR_IN)
|
||||
{
|
||||
/* allocate a pipe according to the endpoint type */
|
||||
rt_usb_hcd_alloc_pipe(device->hcd, &hub->pipe_in, intf,
|
||||
ep_desc, rt_usbh_hub_irq);
|
||||
rt_usb_hcd_alloc_pipe(uinst->hcd, &uhub->pipe_in, ifinst,
|
||||
ep_desc, rt_usb_hub_irq);
|
||||
}
|
||||
else return -RT_ERROR;
|
||||
}
|
||||
|
||||
/* parameter check */
|
||||
RT_ASSERT(device->hcd != RT_NULL);
|
||||
RT_ASSERT(uinst->hcd != RT_NULL);
|
||||
|
||||
rt_usb_hcd_int_xfer(device->hcd, hub->pipe_in, hub->buffer,
|
||||
hub->pipe_in->ep.wMaxPacketSize, timeout);
|
||||
rt_usb_hcd_int_xfer(uinst->hcd, uhub->pipe_in, uhub->buffer,
|
||||
uhub->pipe_in->ep.wMaxPacketSize, timeout);
|
||||
|
||||
return RT_EOK;
|
||||
}
|
||||
@@ -497,32 +497,32 @@ static rt_err_t rt_usbh_hub_enable(void *arg)
|
||||
*
|
||||
* @return the error code, RT_EOK on successfully.
|
||||
*/
|
||||
static rt_err_t rt_usbh_hub_disable(void* arg)
|
||||
static rt_err_t rt_usb_hub_stop(void* arg)
|
||||
{
|
||||
int i;
|
||||
uhub_t hub;
|
||||
struct uinstance* device;
|
||||
struct uintf* intf = (struct uintf*)arg;
|
||||
uhubinst_t uhub;
|
||||
uinst_t uinst;
|
||||
uifinst_t ifinst = (uifinst_t)arg;
|
||||
|
||||
/* paremeter check */
|
||||
RT_ASSERT(intf != RT_NULL);
|
||||
RT_ASSERT(ifinst != RT_NULL);
|
||||
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("rt_usbh_hub_stop\n"));
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("rt_usb_hub_stop\n"));
|
||||
|
||||
device = intf->device;
|
||||
hub = (uhub_t)intf->user_data;
|
||||
uinst = ifinst->uinst;
|
||||
uhub = (uhubinst_t)ifinst->user_data;
|
||||
|
||||
if(hub->pipe_in != RT_NULL)
|
||||
rt_usb_hcd_free_pipe(device->hcd, hub->pipe_in);
|
||||
if(uhub->pipe_in != RT_NULL)
|
||||
rt_usb_hcd_free_pipe(uinst->hcd, uhub->pipe_in);
|
||||
|
||||
for(i=0; i<hub->num_ports; i++)
|
||||
for(i=0; i<uhub->num_ports; i++)
|
||||
{
|
||||
if(hub->child[i] != RT_NULL)
|
||||
rt_usbh_detach_instance(hub->child[i]);
|
||||
if(uhub->child[i] != RT_NULL)
|
||||
rt_usb_detach_instance(uhub->child[i]);
|
||||
}
|
||||
|
||||
if(hub != RT_NULL) rt_free(hub);
|
||||
if(intf != RT_NULL) rt_free(intf);
|
||||
if(uhub != RT_NULL) rt_free(uhub);
|
||||
if(ifinst != RT_NULL) rt_free(ifinst);
|
||||
|
||||
return RT_EOK;
|
||||
}
|
||||
@@ -533,12 +533,12 @@ static rt_err_t rt_usbh_hub_disable(void* arg)
|
||||
*
|
||||
* @return the error code, RT_EOK on successfully.
|
||||
*/
|
||||
ucd_t rt_usbh_class_driver_hub(void)
|
||||
ucd_t rt_usb_class_driver_hub(void)
|
||||
{
|
||||
hub_driver.class_code = USB_CLASS_HUB;
|
||||
|
||||
hub_driver.enable = rt_usbh_hub_enable;
|
||||
hub_driver.disable = rt_usbh_hub_disable;
|
||||
hub_driver.run = rt_usb_hub_run;
|
||||
hub_driver.stop = rt_usb_hub_stop;
|
||||
|
||||
return &hub_driver;
|
||||
}
|
||||
@@ -551,7 +551,7 @@ ucd_t rt_usbh_class_driver_hub(void)
|
||||
*
|
||||
* @return none.
|
||||
*/
|
||||
static void rt_usbh_hub_thread_entry(void* parameter)
|
||||
static void rt_usb_hub_thread_entry(void* parameter)
|
||||
{
|
||||
while(1)
|
||||
{
|
||||
@@ -566,7 +566,7 @@ static void rt_usbh_hub_thread_entry(void* parameter)
|
||||
switch (msg.type)
|
||||
{
|
||||
case USB_MSG_CONNECT_CHANGE:
|
||||
rt_usbh_hub_port_change(msg.content.hub);
|
||||
rt_usb_hub_port_change(msg.content.uhub);
|
||||
break;
|
||||
case USB_MSG_CALLBACK:
|
||||
/* invoke callback */
|
||||
@@ -582,15 +582,16 @@ static void rt_usbh_hub_thread_entry(void* parameter)
|
||||
* This function will post an message to the usb message queue,
|
||||
*
|
||||
* @param msg the message to be posted
|
||||
* @param size the size of the message .
|
||||
*
|
||||
* @return the error code, RT_EOK on successfully.
|
||||
*/
|
||||
rt_err_t rt_usbh_event_signal(struct uhost_msg* msg)
|
||||
rt_err_t rt_usb_post_event(struct uhost_msg* msg, rt_size_t size)
|
||||
{
|
||||
RT_ASSERT(msg != RT_NULL);
|
||||
|
||||
/* send message to usb message queue */
|
||||
rt_mq_send(usb_mq, (void*)msg, sizeof(struct uhost_msg));
|
||||
rt_mq_send(usb_mq, (void*)msg, size);
|
||||
|
||||
return RT_EOK;
|
||||
}
|
||||
@@ -601,7 +602,7 @@ rt_err_t rt_usbh_event_signal(struct uhost_msg* msg)
|
||||
* @return none.
|
||||
*
|
||||
*/
|
||||
void rt_usbh_hub_init(void)
|
||||
void rt_usb_hub_thread(void)
|
||||
{
|
||||
rt_thread_t thread;
|
||||
|
||||
@@ -609,7 +610,7 @@ void rt_usbh_hub_init(void)
|
||||
usb_mq = rt_mq_create("usbh", 32, 16, RT_IPC_FLAG_FIFO);
|
||||
|
||||
/* create usb hub thread */
|
||||
thread = rt_thread_create("usbh", rt_usbh_hub_thread_entry, RT_NULL,
|
||||
thread = rt_thread_create("usbh", rt_usb_hub_thread_entry, RT_NULL,
|
||||
USB_THREAD_STACK_SIZE, 8, 20);
|
||||
if(thread != RT_NULL)
|
||||
{
|
||||
|
||||
@@ -24,9 +24,7 @@
|
||||
#include <rtthread.h>
|
||||
#include <drivers/usb_host.h>
|
||||
|
||||
#define USB_HOST_CONTROLLER_NAME "usbh"
|
||||
|
||||
#if defined(RT_USBH_HID_KEYBOARD) || defined(RT_USBH_HID_MOUSE)
|
||||
#if defined(RT_USB_HID_KEYBOARD) || defined(RT_USB_HID_MOUSE)
|
||||
#include <hid.h>
|
||||
#endif
|
||||
|
||||
@@ -36,64 +34,54 @@
|
||||
*
|
||||
* @return none.
|
||||
*/
|
||||
rt_err_t rt_usb_host_init(void)
|
||||
int rt_usb_host_init(void)
|
||||
{
|
||||
ucd_t drv;
|
||||
rt_device_t uhc;
|
||||
#ifdef RT_USBH_HID
|
||||
#ifdef RT_USB_CLASS_HID
|
||||
uprotocal_t protocal;
|
||||
#endif
|
||||
|
||||
uhc = rt_device_find(USB_HOST_CONTROLLER_NAME);
|
||||
if(uhc == RT_NULL)
|
||||
{
|
||||
rt_kprintf("can't find usb host controller %s\n", USB_HOST_CONTROLLER_NAME);
|
||||
return -RT_ERROR;
|
||||
}
|
||||
|
||||
/* initialize usb hub */
|
||||
rt_usbh_hub_init();
|
||||
/* initialize usb hub thread */
|
||||
rt_usb_hub_thread();
|
||||
|
||||
/* initialize class driver */
|
||||
rt_usbh_class_driver_init();
|
||||
rt_usb_class_driver_init();
|
||||
|
||||
#ifdef RT_USBH_MSTORAGE
|
||||
#ifdef RT_USB_CLASS_MASS_STORAGE
|
||||
/* register mass storage class driver */
|
||||
drv = rt_usbh_class_driver_storage();
|
||||
rt_usbh_class_driver_register(drv);
|
||||
drv = rt_usb_class_driver_storage();
|
||||
rt_usb_class_driver_register(drv);
|
||||
#endif
|
||||
|
||||
#ifdef RT_USBH_HID
|
||||
#ifdef RT_USB_CLASS_HID
|
||||
/* register hid class driver */
|
||||
drv = rt_usbh_class_driver_hid();
|
||||
rt_usbh_class_driver_register(drv);
|
||||
drv = rt_usb_class_driver_hid();
|
||||
rt_usb_class_driver_register(drv);
|
||||
|
||||
#ifdef RT_USBH_HID_KEYBOARD
|
||||
#ifdef RT_USB_HID_KEYBOARD
|
||||
/* register hid keyboard protocal */
|
||||
protocal = rt_usbh_hid_protocal_kbd();
|
||||
rt_usbh_hid_protocal_register(protocal);
|
||||
protocal = rt_usb_hid_protocal_kbd();
|
||||
rt_usb_hid_protocal_register(protocal);
|
||||
#endif
|
||||
|
||||
#ifdef RT_USBH_HID_MOUSE
|
||||
#ifdef RT_USB_HID_MOUSE
|
||||
/* register hid mouse protocal */
|
||||
protocal = rt_usbh_hid_protocal_mouse();
|
||||
rt_usbh_hid_protocal_register(protocal);
|
||||
protocal = rt_usb_hid_protocal_mouse();
|
||||
rt_usb_hid_protocal_register(protocal);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef RT_USBH_ADK
|
||||
#ifdef RT_USB_CLASS_ADK
|
||||
/* register adk class driver */
|
||||
drv = rt_usbh_class_driver_adk();
|
||||
rt_usbh_class_driver_register(drv);
|
||||
drv = rt_usb_class_driver_adk();
|
||||
rt_usb_class_driver_register(drv);
|
||||
#endif
|
||||
|
||||
/* register hub class driver */
|
||||
drv = rt_usbh_class_driver_hub();
|
||||
rt_usbh_class_driver_register(drv);
|
||||
drv = rt_usb_class_driver_hub();
|
||||
rt_usb_class_driver_register(drv);
|
||||
|
||||
/* initialize usb host controller */
|
||||
rt_device_init(uhc);
|
||||
|
||||
return RT_EOK;
|
||||
return 0;
|
||||
}
|
||||
INIT_COMPONENT_EXPORT(rt_usb_host_init);
|
||||
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
from building import *
|
||||
|
||||
cwd = GetCurrentDir()
|
||||
src = Glob('*.c')
|
||||
CPPPATH = [cwd + '/../include']
|
||||
group = DefineGroup('DeviceDrivers', src, depend = ['RT_USING_WDT'], CPPPATH = CPPPATH)
|
||||
|
||||
Return('group')
|
||||
@@ -1,108 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
* 2014-03-04 Bernard code cleanup
|
||||
*/
|
||||
|
||||
#include <drivers/watchdog.h>
|
||||
|
||||
/* RT-Thread Device Interface */
|
||||
|
||||
/*
|
||||
* This function initializes serial
|
||||
*/
|
||||
static rt_err_t rt_watchdog_init(struct rt_device *dev)
|
||||
{
|
||||
rt_watchdog_t *wtd;
|
||||
|
||||
RT_ASSERT(dev != RT_NULL);
|
||||
wtd = (rt_watchdog_t *)dev;
|
||||
if (wtd->ops->init)
|
||||
{
|
||||
return (wtd->ops->init(wtd));
|
||||
}
|
||||
|
||||
return (-RT_ENOSYS);
|
||||
}
|
||||
|
||||
static rt_err_t rt_watchdog_open(struct rt_device *dev, rt_uint16_t oflag)
|
||||
{
|
||||
return (RT_EOK);
|
||||
}
|
||||
|
||||
static rt_err_t rt_watchdog_close(struct rt_device *dev)
|
||||
{
|
||||
rt_watchdog_t *wtd;
|
||||
|
||||
RT_ASSERT(dev != RT_NULL);
|
||||
wtd = (rt_watchdog_t *)dev;
|
||||
|
||||
if (wtd->ops->control(wtd, RT_DEVICE_CTRL_WDT_STOP, RT_NULL) != RT_EOK)
|
||||
{
|
||||
rt_kprintf(" This watchdog can not be stoped\n");
|
||||
|
||||
return (-RT_ERROR);
|
||||
}
|
||||
|
||||
return (RT_EOK);
|
||||
}
|
||||
|
||||
static rt_err_t rt_watchdog_control(struct rt_device *dev,
|
||||
rt_uint8_t cmd,
|
||||
void *args)
|
||||
{
|
||||
rt_watchdog_t *wtd;
|
||||
|
||||
RT_ASSERT(dev != RT_NULL);
|
||||
wtd = (rt_watchdog_t *)dev;
|
||||
|
||||
return (wtd->ops->control(wtd, cmd, args));
|
||||
}
|
||||
|
||||
/**
|
||||
* This function register a watchdog device
|
||||
*/
|
||||
rt_err_t rt_hw_watchdog_register(struct rt_watchdog_device *wtd,
|
||||
const char *name,
|
||||
rt_uint32_t flag,
|
||||
void *data)
|
||||
{
|
||||
struct rt_device *device;
|
||||
RT_ASSERT(wtd != RT_NULL);
|
||||
|
||||
device = &(wtd->parent);
|
||||
|
||||
device->type = RT_Device_Class_Miscellaneous;
|
||||
device->rx_indicate = RT_NULL;
|
||||
device->tx_complete = RT_NULL;
|
||||
|
||||
device->init = rt_watchdog_init;
|
||||
device->open = rt_watchdog_open;
|
||||
device->close = rt_watchdog_close;
|
||||
device->read = RT_NULL;
|
||||
device->write = RT_NULL;
|
||||
device->control = rt_watchdog_control;
|
||||
device->user_data = data;
|
||||
|
||||
/* register a character device */
|
||||
return rt_device_register(device, name, flag);
|
||||
}
|
||||
46
components/external/espruino/CONTRIBUTING.md
vendored
46
components/external/espruino/CONTRIBUTING.md
vendored
@@ -1,46 +0,0 @@
|
||||
Contributing
|
||||
===========
|
||||
|
||||
Thanks for thinking about contributing to Espruino! Anything you can add is hugely appreciated, but please can you follow a few simple rules:
|
||||
|
||||
* Keep the same coding style (See **Coding Style** below)
|
||||
* Ensure that you are not contributing someone else's code, and that you are willing to add your code under Espruino's MPL Licence
|
||||
* Make sure that what you do doesn't break the Espruino board or the other boards we build for. We can't check all the boards for every commit, so if you break something you'll annoy a whole bunch of people.
|
||||
* Be aware that Espruino is designed for Microcontrollers - with very low amounts of flash and memory. Both are at a premium so don't statically allocate variables or do other stuff that will use up memory.
|
||||
* Avoid randomly adding newlines, spaces, refactoring everything or renaming things to your own personal style (some things really could do with renaming, but please check first or we may reject your pull request)
|
||||
* Don't add a whole bunch of indirection/abstraction for the sake of it - it'll probably just use of more of our precious memory.
|
||||
* If you add a new API, try and make it familiar to Arduino/JavaScript users.
|
||||
|
||||
Target Areas
|
||||
-----------
|
||||
|
||||
We'll keep the outstanding issues in GitHub's issue list, but general stuff that would really help us is:
|
||||
|
||||
* Tests. If something doesn't work, please make a test for it. Even if you don't fix it it'll help others greatly. Bonus points if it's in a pull request :)
|
||||
* Documentation. Improving the documentation (either the EspruinoDocs project, or the auto-generated reference) would be fantastic.
|
||||
* Duplication. If the same code is used for multiple platforms, try and make sure it's shared, not duplicated.
|
||||
* Remove hard-coded stuff. Various things like the SPI filesystem are still hard-coded with ifdefs for each board - we want all that stuff to be generated from build_platform_info.py
|
||||
* Speed. There are a few areas this could be improved - but please benchmark what you're doing both before and afterwards on the Espruino board to check that what you've done helps
|
||||
* Memory Usage. Both RAM and Flash are at a premium. Ways of reducing this (including stack usage) and making usage more efficient are really appreciated.
|
||||
* JavaScript compliance (without affecting speed or memory usage too much).
|
||||
|
||||
Contributing
|
||||
-----------
|
||||
|
||||
* Please RUN THE TESTS to check that there are no regressions
|
||||
* Issue us a pull request to [www.github.com/espruino] via GitHub
|
||||
* Please keep each request small (just include one fix per request)
|
||||
|
||||
Coding Style
|
||||
-----------
|
||||
|
||||
The rough coding style is as follows, but you should get a good idea from the code. If we've missed anything obvious please let us know!
|
||||
|
||||
* 2 Spaces for indents
|
||||
* Open curly braces on the same line
|
||||
* No Tabs used
|
||||
* Use bool for booleans - not int
|
||||
* ```//``` comments for single lines, ```/* ... */``` for multiple lines
|
||||
* Half-hearted Doxygen compatibility: use ```///<``` for function declaration documentation (if on same line), and ```/** ... */``` if doing it right before a function
|
||||
* Use new lines sparingly (only where it really makes sense)
|
||||
|
||||
515
components/external/espruino/ChangeLog
vendored
515
components/external/espruino/ChangeLog
vendored
@@ -1,515 +0,0 @@
|
||||
1v46 : ...
|
||||
|
||||
1v45 : Fix parseFloat("foo") not returning NaN (and assert) - fix #149
|
||||
Remove Integer.parseInt
|
||||
Fix parseInt("bar") - fix #150
|
||||
Ensure that maths ops with null do treat it as 0 rather than a string - fix #156
|
||||
Fix digitalPulse length (properly!) - fix #154
|
||||
Making sure that undefined gets cast to NaN
|
||||
Fix Array.indexOf() returns undefined instead of -1 - fix #155
|
||||
Moved memory() to process.memory() - added more info too
|
||||
Try and improve handling of PWM timer speeds
|
||||
Fixed varying SPI baud rates depending on device
|
||||
Makefile changes for OSX compile
|
||||
|
||||
1v44 : Modified build system to store binary names in the python definition
|
||||
Fix nasty regression involving losing code at the end of Strings
|
||||
Fix segfault when pinMode is called on an invalid pin
|
||||
Now disable interrupts during 4 bit SPI send - it's just too much otherwise
|
||||
Detect unfinished block comments in console (fix #138)
|
||||
Fix flash write on most 10XxB boards
|
||||
Fix PWM output on all STM32 boards
|
||||
General hardware tidy in prep for more intelligent device management
|
||||
Run initialisation code before setWatch, to make sure pullup/down is set beforehand
|
||||
Change 'Pin' datatype to be an unsigned char - makes tests easier
|
||||
Now use the hardware RTC for keeping system time. Allows proper deep sleep on Espruino board
|
||||
FINALLY - fix the USB VCP lost characters issue (#94)
|
||||
|
||||
1v43 : Added 'Modules' object with support for adding/removing cached modules
|
||||
Allow product ID to be changed via Makefile
|
||||
Fix documentation (and old-fashined Parsing style) for JSON
|
||||
build_jswrapper now outputs errors to stderr (more compatible with default (silent) build process)
|
||||
Fix issue when parsing quotes in strings
|
||||
Added void operator for closure minification compatibility
|
||||
Ensure that return takes the comma operator
|
||||
Fix issue where printing Infinity would crash Espruino (fix #129)
|
||||
Finally some working (extremely beta) cc3000 code
|
||||
Added jsvObjectGet/SetChild to simplify some wrappers
|
||||
'http' now uses JsVars for storage (so is suitable for non-linux devices)
|
||||
Turned 'http' into a library
|
||||
Added process.version and process.env (fix #131)
|
||||
Changed handling of 2nd arg of << so that precedence is correct
|
||||
Fixed handling of 'for (;;)'
|
||||
Fix lock leak in Module handling
|
||||
Update ST's library for the STM32F1
|
||||
Update ST's VCP implementation
|
||||
Added prefix operator (fix #130)
|
||||
Allow espruino for linux to be run with '#!' in scripts
|
||||
Fix indexOf on final element of strings (fix #133)
|
||||
Remove JSV_PARENTINFO, as it turns out JS doesn't keep track of function scopes anyway (fix #109)
|
||||
Make 'this' a keyword (now faster, more memory efficient)
|
||||
Make 'Hardware' (root) the default value of 'this'
|
||||
Add jsvArrayPushAndUnLock and modified code to use it (fix #135)
|
||||
Now remember I2C state (partial fix for #13)
|
||||
Replace 'pow' function with a smaller version - save ~2kb
|
||||
Shaved another 1200 bytes off jslTokenAsString
|
||||
Now store Pin state (fix for #13 on F1 parts, F4 still looks broken)
|
||||
Added Graphics.stringWidth
|
||||
Added internal Printf function
|
||||
Misc speed and code size improvements
|
||||
This version has gone to Seeed for use on the KickStarter boards
|
||||
|
||||
1v42 : [ebirger] allowing 'new' with no brackets
|
||||
Allow built-in functions with variable numbers of arguments (fix #83)
|
||||
Implement 'String' constructor in the normal way (fix #110)
|
||||
Fix regression with parsing constructors while not executing
|
||||
Allow multiple arguments to print and console.log (fix #92)
|
||||
Make 'arguments' array available in functions (fix #100)
|
||||
Fix an assert fail, and handle some potential memory leaks
|
||||
Don't show __proto__ and constructor with for..in, keys(), or JSON.stringify
|
||||
Make 'trace()' output more readable debug data for complex structures
|
||||
Fix memory leak whe parsing functions iwht variable numbers of arguments - fix #115
|
||||
Defined NaN
|
||||
Stop 'new undefined()' crashing Espruino - fix #120
|
||||
Get A13/A14 working on Espruino board (these were JTAG)
|
||||
Get bootloader size direct from Python (remove hard-coding)
|
||||
Fix '~' operator when acting on variables
|
||||
Made bootloader a bit more error tolerate (CRC on write)
|
||||
Added %=, /=, and *= operators (fix #121)
|
||||
Allowed Object.toString() to take a radix argument for integers (fix #125)
|
||||
Fix error message issue - broken strncat (fix #124)
|
||||
Add comma operator (fix #122)
|
||||
Added some basic code for STM32F429IDISCOVERY - not currently working though
|
||||
This version is the one sent off on the Test Harness (so will probably appear on boards)
|
||||
|
||||
1v41 : Fix Olimexino compile (https://github.com/espruino/Espruino/issues/6)
|
||||
[ebirger] Member constructors (eg. new a.b() )
|
||||
[ebirger] Ensuring integers with radix specifiers can still be parsed if a radix is specified
|
||||
Fix for tests/test_json_arraybuffer_001.js - iteration of arraybuffers of length==1
|
||||
Add Object.keys(...)
|
||||
More arraybuffer iteration fixes
|
||||
On linux, use built-in stringToFloat to aid debugging. Handle exponentials, fix #31
|
||||
'make serialflash' is now works correctly for Espruino Boards with bootloader
|
||||
setWatch(..A0);setWatch(..A0);clearWatch(1) does not now kill the other watch, fix #25
|
||||
One-based setTimeout/setWatch, fix #3
|
||||
Added Function.call and Function.apply, fix #54
|
||||
'http' and 'fs' are now libraries that need to be 'require'd, fix #8
|
||||
Updated pin info for STM32F103xC/D/E chips, fix #84
|
||||
Fixed linker script for STM32F4 (discovery board now works)
|
||||
Object prototypes are now Objects, fix #101
|
||||
Board docs now specify '3.3v' only pins fix #104
|
||||
Add Array.forEach
|
||||
Fix searching down >1 prototype to find functions (one more issue posted in #99)
|
||||
Fix "12345"/5 type issues (fix #90)
|
||||
'Consting' some string functions
|
||||
Fixing arrays with string indices that are actually numbers \o/ (fix #19)
|
||||
Released onto website
|
||||
|
||||
1v40 : Ensure that LCD.prototype.setPixel = function actually works
|
||||
Refactor LCD driver code to allow lcdInit (and start of making it non-platform-specific)
|
||||
Built 'LCD' support into linux/raspi/carambola
|
||||
Add initial SPI.send(ArrayBuffer) support - even if NO VALUES RETURNED
|
||||
Start of built-in Nokia 5110 LCD support
|
||||
Remove GPIO clock removal on sleep for now (it kills setWatch)
|
||||
Fix (sub)ArrayBuffer problems (test100.js)
|
||||
Added setDeepSleep - still beta put power consumption drops to 1mA
|
||||
Fix broken name for httpCRq.write
|
||||
Changed LCD to Graphics - added ability to render to ArrayBuffer
|
||||
Fix 8 char built-in class names
|
||||
Adding preliminary Sony SmartWatch support
|
||||
Adding preliminary support for completely bare 36 pin chip
|
||||
Fixing pin defs for Espruino board rev 1v1
|
||||
Added proper SDL/ArrayBuffer and JS Callback graphics support
|
||||
Added "ifdef" ability in build_jswrapper
|
||||
Take JSVAR_CACHE_SIZE out of jsutils and put it in the board config file
|
||||
Added JSV_PARENTINFO which will allow us to do things like setTimeout(foo.bar,10)
|
||||
Fixed arrays in non-executes streams - 'if (0) print([1,2,3]);'
|
||||
Added 'require' function loading modules from node_modules on SD card
|
||||
Added module cache to stop modules being re-loaded
|
||||
Renamed internal vars to start with '>' - much easier to distinguish for 'dump'/etc
|
||||
Only use parentInfo on functions
|
||||
Load all tests in test dir - don't do them by number
|
||||
Added 'zigzag' ordering for ArrayBuffer Graphics
|
||||
Added 'vertical_byte' ordering for ArrayBuffer Graphics
|
||||
toJSON now ignores 'hidden' object elements
|
||||
Special-case jsvArrayBufferIteratorSetIntegerValue
|
||||
Make SPI output an ArrayBuffer
|
||||
Use best out of 3 for DelayMicroseconds calibration - something seems flaky right after bootup
|
||||
Lines now drawn from p1 to p2 inclusive
|
||||
Events now use jshPushIOWatchEvent (should cut down on code) also fixed bug with watching pin #11
|
||||
Now remember if pinMode was set or not
|
||||
Transform ```code``` in JSON into a code tag in the documentation
|
||||
Graphics now supports FSMC for HY boards again
|
||||
Drawing vector fonts is now roughly the right size and position (still not 100%)
|
||||
Remove registration code
|
||||
Adding MPL licence
|
||||
Remove Arduino bit manipulation functions - nobody seems to use them anyway
|
||||
# of flash pages/etc now comes from board info
|
||||
[ebirger] Supply the correct arguments to Array.map
|
||||
[ebirger] Method calls and membership evaluation should be done on all factors (ee. [1,2,3].foo())
|
||||
[ebirger] When running multiple tests, only set up terminal once or it breaks the terminal window on exit
|
||||
Added STM32-style USB CDC bootloader for Espruino Boards
|
||||
Added scripts/create_espruino_image.sh to package up bootloader and espruino into one binary
|
||||
SHIPPED on Impatient developer boards
|
||||
|
||||
1v39 : Added Bitwise NOT operator
|
||||
Added Raspberry Pi version to ZIP (with HTTP support)
|
||||
Fixed load/save on Linux Devices
|
||||
Added pinMode function (to allow pull-ups/pull-downs to be turned on)
|
||||
SPI.send4bit/send8bit will now not mess up the final element
|
||||
changeInterval now clears up stored up callbacks (eg, setInterval(.., 0.01)...wait...changeInterval(...,20)
|
||||
Ctrl-C no longer prints anything, which avoids lockups
|
||||
No longer print "Execution Interrupted" if nothing was interrupted!
|
||||
Added >>>= >>= and <<=
|
||||
When entering text interactively, ensure that there are no trailing spaces
|
||||
|
||||
1v38 : Tweaks for Arduino IDE compile
|
||||
Removed '(char #)' from stack trace, as a bit pointless now
|
||||
Added better reporting of execution location when Ctrl-C pressed
|
||||
Urgent fix for non-working Olimexino since 1v33
|
||||
Fix string comparison when strings contain "\0"
|
||||
Added LED1/2/OSC/SD/etc to Olimexino Board docs
|
||||
|
||||
1v37 : Urgent fix - power saving code made it difficult to re-flash Espruino (now only apply this to Espruino Board)
|
||||
|
||||
1v36 : Fix documentation for Array.pop()
|
||||
Added some much better board documentation
|
||||
Fixed DAC output on F3
|
||||
Fixed DAC output on devices where PWM is also available and the alternate function is less than the DAC's
|
||||
|
||||
1v35 : Attempt to reduce power consumption when sleeping by turning off GPIO, and setting GPIOs to AIN on reset
|
||||
Fix F3 issue where ADC/DAC weren't picked up properly
|
||||
Tidy up register text and add KickStarter mention
|
||||
var a = {}; a[LED1]=0; - not converted to String
|
||||
JSON (and hence dump()) now dumps ArrayBuffer correctly
|
||||
|
||||
1v34 : Faster jshFromDeviceString
|
||||
Preliminary support for flow control on Serial receive
|
||||
Speed improvements by removing jsvGetRef from jsvUnLock
|
||||
fast 4 byte pre-check in jsvFindChildFromString
|
||||
Skip lock/unlock in FindChildFromString to help increase speed
|
||||
When we unplug USB, only go to the default console device IF that is the device we're currently on
|
||||
Support for custom Espruino board
|
||||
Added ArrayBufferView.interpolate
|
||||
16 bit SPI send for send4bit/sevrnd8bit (better reliability on low-end chips)
|
||||
Fix JSON dump of typed array
|
||||
Added Math.clip(x, min, max)
|
||||
When saving on flash, don't do jslTokenAsString properly
|
||||
B3/B4 move from alternate fn
|
||||
Fix incorrect reporting of analog pins
|
||||
Fix I2C.readFrom on STM32F1/4
|
||||
Make 1/2 == 0.5 (was being sensible before, but now follow JS spec)
|
||||
Ctrl-C while in timer fn clears timers (but not outside it)
|
||||
Fixed broken clearInterval from within setInterval
|
||||
Hopefully fixed issue on SSD1289 LCD controller
|
||||
Trigger wheel handler to use interrupts
|
||||
2D arraybuffer interpolation
|
||||
Added Math.wrap, fixed a lot of trigger issues
|
||||
Fixed SysTick priority/preempt problems
|
||||
Slowed the SysTick timer back down for everything
|
||||
Fix Int8Array signedness on F4 boards
|
||||
Refactored source code tree
|
||||
|
||||
1v33 : fix character encoding issue of "\16"+"1" != "\161"
|
||||
Refactoring of ArrayBuffer into iterator, and addition of a general purpose iterator
|
||||
Fancier assert for debugging
|
||||
jsvArrayJoin to use new iterator
|
||||
for (i in ...) to use new iterator
|
||||
I2C and SPI use new iterator
|
||||
Serial.write() - to allow single ints to easily be written
|
||||
changeInterval assert fail when given a function by accident
|
||||
added peek8/poke8/peek16/poke16
|
||||
memory() now takes account of command history size
|
||||
memory() on ARM reports the end address of the stack - so it can be used as a scratchpad with peek and poke
|
||||
Try and reduce code size by not inlining several functions
|
||||
No refs for StringExts - so we get one more byte per JsVar (~5%) more storage efficiency
|
||||
Move from jsvIsBuiltInFunction to computer-generated jswIsBuiltInFunction
|
||||
When creating Objects, check for built-in function BEFORE creating an Object class for it
|
||||
Built process now checks that flash usage is under the allowed value
|
||||
Added short compare to jswHandleFunctionCall to reduce code size
|
||||
Added 3 byte compare (4 byte read and AND off top byte) - faster, less code
|
||||
Auto-generate jsvGetBasicObjectName from docs
|
||||
No longer using refs for storing whether free or not - use flags with JSV_UNUSED and get one extra var with 8 bit refs
|
||||
Switch to using STRING_0...STRING_MAX in flags, rather than specific bits in JsVarFlags - allows more that 15 chars to be used per JsVar
|
||||
Make ArrayBuffers actually be ArrayBufferViews - saves on extra string-handling code at expense of one var
|
||||
Make sure Uint8Array,etc inherits from ArrayBufferView
|
||||
Fix issue where a '\0' coming in from serial was not put in e.data properly
|
||||
Don't inline some functions when we're trying to save on flash
|
||||
Re-use sin for cos, pow for sqrt to reduce code size
|
||||
|
||||
1v32 : Fixed embarassing issue with 0.999=="0.A"
|
||||
Added and checked Pin.writeAtTime on STM32
|
||||
Now don't allocate events array - just allocate directly, which saves memory and is faster (although slighty out of order)
|
||||
Docs: now Alphabetically sorted, and class instances not listed by accident
|
||||
Fix issue where Ctrl-C on ANY Serial port caused execution to be interrupted
|
||||
Updated busy indicator to cope with recent change to not allocate events in an array
|
||||
Fixed I2C on HY 2.4 board - I2C needed hard reset
|
||||
Added basic ArrayBuffers/TypedArray support
|
||||
Fix memory leak when error created with [] on a non-array/object
|
||||
Improved hyperlinking in documentation
|
||||
Fix I2C receive bug on F4
|
||||
Increased VL board's input buffer size
|
||||
|
||||
1v31 : Fix PWM output on TIMER1/8 pins of the STM32F4
|
||||
Fix PWM output for negated timers
|
||||
memory() now runs a GC pass
|
||||
Fixed multiple occurrence of functions in reference
|
||||
|
||||
1v30 : STM32F1: fixed AF issue meant peripherals would never return from AF mode
|
||||
STM32F1: When given an invalid pin, now reports if pins are 'af' or not
|
||||
Updated SPI.setup docs to mention that you can't mix AF and non-AF
|
||||
If one SPI pin is specified but others aren't, only that pin will be set up
|
||||
Added Olimexino hack so SPI1.setup works as expected
|
||||
Allow using [] on a function
|
||||
Fix precedence issue, so var a = function() { return 1; }(); works
|
||||
Update SPI documentation
|
||||
for (i in f) can now iterate over functions
|
||||
Optional argument to trace() for object to start tracing from
|
||||
Small steps towards ArrayBuffers
|
||||
Added smart edit that checks for internal functions, and uses Function.replaceWith
|
||||
Added Function.replaceWith to replace the internals of a function while keeping the scope
|
||||
|
||||
1v29 : Some hacky sysfs-based IO for running on Linux
|
||||
HTTP Callbacks are now stored as names so they can be changed on the fly (Linux only)
|
||||
Successful compile for Carambola
|
||||
Filesystem support on Linux
|
||||
Switch to variable size ref counter (marginally more efficient on very small devices, safe on Linux)
|
||||
Linux now has unlimited memory available
|
||||
Added linux/sysfs 'setWatch' (non-irq driven, so very noddy)
|
||||
Checked jswrapper check from using multi-char constants to a #define
|
||||
Improve pin suggestions for SPI/I2C/USART
|
||||
Auto-initialise USART with default values when setConsole is used
|
||||
Support for new Graphics LCD types
|
||||
3.2" VCT6 board support
|
||||
|
||||
1v28 : Faster LCD fillrect for HY 2.8
|
||||
Fix for multi-byte SPI writes on HY board at 1Mhz (touchscreen control bug)
|
||||
Fix issue with delayMicrosecond calibration on HY (and hence OneWire)
|
||||
Fixed digitalPulse on STM32VLDISCOVERY
|
||||
|
||||
1v27 : Fixed problem with OneWire constructor execution
|
||||
Added |=, &= and ^=
|
||||
Added Array.splice()
|
||||
Faster, more ROM-efficient built-in symbol table
|
||||
Fix for potential issue when using field accessor on an undefined var
|
||||
|
||||
1v26 : I2C Support on STM32F1 and STM32F4 boards too
|
||||
Emergency cut in variables for Olimexino with bootloader (as flash usage has got too high for save to flash!)
|
||||
|
||||
1v25 : http.writeHead to accept an empty header
|
||||
Fixed issue finding methods on built in classes (0 termination)
|
||||
make sure http server with no data still sends headers...
|
||||
Start of MINI-HY-2.8" support (all ok, but no SD card yet)
|
||||
Reduce RAM usage by consting some arrays that are not modified
|
||||
Vector fonts now use polys - 8kb less ROM, and faster rendering
|
||||
Start of LCD 'driver' code
|
||||
Standard way of handling events, Object.on/emit/removeAllListeners - like Node.js's EventEmitter
|
||||
Self-calibrating Microsecond delay (for intermal OneWire/etc)
|
||||
OneWire class
|
||||
Correct handling of built-in class constructors
|
||||
Fix error when parsing a zero-argument function that has been given arguments
|
||||
I2C support - currently ONLY tested on STM32F3 board
|
||||
|
||||
1v24 : SDIO-based fat driver on the HY STM32 board
|
||||
Added DAC to the HY boards (103xE-based)
|
||||
Re-named the fileSystem functions to make them more compatible with node.js (readFile/writeFile/etc)
|
||||
Added fs.appendFile
|
||||
Removed HTTP from the reference until it is included in some boards
|
||||
|
||||
1v23 : Fix 'ERROR: INTERNAL: stmADCChannel' on STM32VLDISCOVERY/F1 boards when accessing PA0
|
||||
Reference now mentions which Espruino version it is for
|
||||
|
||||
1v22 : Important fix - Events got executed in the wrong order if they got queued up
|
||||
|
||||
1v21 : Ensure SPI clock does not stop between bytes
|
||||
Added SPI.send4bit and SPI.send8bit
|
||||
Made sure the VL board's code fits into available flash
|
||||
Smart += that can append to a string rather than cloning it
|
||||
dump() prints functions properly, rather than 'var f = function() {}'
|
||||
Pageup/down move the cursor to the beginning/end of input
|
||||
LCD draw/fill with negative x and y
|
||||
|
||||
1v20 : Add console.log
|
||||
Fix automatic usleep for Linux
|
||||
Added node.js-style HTTP server for Linux version
|
||||
Fixed null-pointer issue when accessing something that doesn't exist on an object
|
||||
Added node.js-style HTTP client for Linux version
|
||||
Start of bit bashing functionality
|
||||
for (i in "ABCD") console.log(i) -> 0,1,2,3
|
||||
String array access (but not for writing - doesn't work in JS anyway)
|
||||
String String.fromCharCode / charCodeAt
|
||||
Added SPI baud rate setting
|
||||
Vector font chars 'a' and '4' now work ok
|
||||
Fix numeric exception when rendering a poly that has some identical points
|
||||
Better digitalPulse (uses timer + interrupts)
|
||||
analogWrite can now take an object with a 'frequency' argument for PWM
|
||||
|
||||
1v19 : Fixed issue where var M=Math;M.random() failed
|
||||
Fixed issue with var U=USB;U.print("Hello");
|
||||
Remove loop iteration limit
|
||||
Fix memory leak when a syntax error is in for '(i in arr)'
|
||||
Save state of pin on setWatch interrupt (e.state)
|
||||
Change setWatch to allow only on rise or fall as an option
|
||||
clearWatch() clears all watches
|
||||
|
||||
1v18 : DAC support on F3/F4
|
||||
Serial.setup() can also take a second parameter of an object {tx,rx}
|
||||
Better support for dump() with echo/setBusyIndicator/etc
|
||||
Better dumping of prototypes on built-in vars
|
||||
Don't add chars<32 (Except tab) to the input line
|
||||
SPI1/2/3/4.setup() to take an object {baud,sck,miso,mosi}
|
||||
Better hardware initialisation code (not UARTS auto-init if they are used)
|
||||
Fix issues with prototypes
|
||||
Peek/poke instructions
|
||||
Start of I2C support (not usable yet)
|
||||
Added Math. ceil/floor/exp/log
|
||||
|
||||
1v17 : Support for running alongside the Maple bootloader
|
||||
Fix parsing of numbers beginning with 0 when forceRadix!=8
|
||||
Fixed USART1 on Maple/Olimexino devices
|
||||
|
||||
1v16 : Inlining of jsvLock/UnLock in jsvar.h to improve speed
|
||||
Move non-hardware-dependent stuff into jsdevices
|
||||
Move jshardware.c into targets/stm32/jshardware.c, create 'targets/linux' and use a single makefile
|
||||
For + While loops work without reallocating lex
|
||||
Fix AddNativeFunction when function already exists (and tests + saved state)
|
||||
Change jsvFindChildFromX to use JsVar* from JsVarRef - saves a lot of lock/unlock
|
||||
Handle new Foo() as per spec (return value + init of this+prototype) - still does not cope with non-object prototype
|
||||
Beginning of SD card support (works on Olimexino, but not very flexible)
|
||||
Fix for parse/eval when given non-strings
|
||||
Strings can now contain '\0'
|
||||
Jumptable-friendly reserved word check
|
||||
Jumptable-friendly builtin functions (massive refactor)
|
||||
SPI support
|
||||
HY board support, and graphics LCD
|
||||
Added fillPoly, and Vector fonts
|
||||
Added Registration code
|
||||
Fixed some undefined function/array warnings
|
||||
Much better HTML function documentation
|
||||
Fixed edit() function
|
||||
STM32F3 support, and now peripheral stuff is done with a script
|
||||
explain what pins are available if a pin is not capable of requested fn
|
||||
power on ADCs only when needed
|
||||
LCD fillPoly speed improvements, + drawLine
|
||||
Add datatype for Pin, so pins written to console by pin name rather than integer value.
|
||||
Added Pin.set/Pin.reset
|
||||
Change warning about 'undefined.' into an error (foo.reset() had unexpected consequences!)
|
||||
Fix parsing of '1.0/-3'!
|
||||
Add typeof and instanceof operators
|
||||
Ensure that Serial1/SPI1/etc are objects of type 'Serial'/'SPI' - so prototypes can be added
|
||||
|
||||
1v15 : Escaping JSON strings
|
||||
Fix parsing of octal numbers in strings (so don't have to be 3 chars long)
|
||||
Drastically improved stack usage using small stub functions (at expense of a bit of speed)
|
||||
dump() also dumps out prototypes for functions
|
||||
|
||||
1v14 : Fix complaint about pins during setBusyIndicator()
|
||||
Increase available memory on OLIMEXINO
|
||||
Added function memory() to return memory usage
|
||||
setWatch now links to function names (rather than just functions)
|
||||
dump() also handles Serial.onData(...)
|
||||
Fix issue with JSON printing functions with arguments to console
|
||||
prefix builtin variables with '_'
|
||||
fix ArrayIndexOf when array contains undefineds
|
||||
move all devices into one git repository
|
||||
USB on F4
|
||||
call onInit function/string if it exists when Espruino powers on
|
||||
Compile F4 with -O2 - as we have the program memory for it
|
||||
Serial3/4/5/6 on F4
|
||||
Serial3 on Olimexino
|
||||
Make Serial.onData() clear onData handler
|
||||
|
||||
1v13 : Operations like + on Object/Array convert them to strings rather than error
|
||||
var now doesn't error if there is no semi-colon
|
||||
Allow new line or line delete in multi-line editing
|
||||
add edit(functionName) - which copies function definition into inputline so it can be updated
|
||||
When printing lines, delete current inputline and then put it back in idle loop (only if echo=1)
|
||||
Support *,/ etc on numpad
|
||||
|
||||
1v12 : Issue when printing lots of data and then disconnect USB
|
||||
Hide USB/Serial in Dump()
|
||||
add Array.map(fn(x), thisArg)
|
||||
For newline, count [] and () (as well as {}) - also knows about comments/strings/etc
|
||||
Fix assert fail is setTimeout with non-function
|
||||
If space at end of input line, enter still executes
|
||||
Removed some hard-coded arrays in favour of JsVar strings
|
||||
Fix confusion with jsvIsName/jsvIsString
|
||||
Handle numpad end key
|
||||
Add code to check stack and stop stack overflow if too much recursion
|
||||
Ensure that setTimeout/setWatch store the link to a function, not the function
|
||||
Fix nasty ref loop in ref loop GC issue
|
||||
Add dotty output
|
||||
Fix memory leak when error in jspParseSingleFunction
|
||||
Now run Garbage collection if we're idle, and we know we have a few ms spare
|
||||
Added setSleepIndicator
|
||||
Fix line/col indicator in errors/warnings
|
||||
Fix JSON parsing and printing when 'undefined' encountered
|
||||
Rewritten object handling code to be way more standard JavaScript compliant
|
||||
Array initialisation with 'new Array()', also for Strings
|
||||
Added a few more built in functions
|
||||
Nice error reporting with line + pointer
|
||||
fixed Math.random
|
||||
Binary style ops on doubles now work - they are just converted to ints
|
||||
Added boolean datatype
|
||||
|
||||
1v11 : Add Math functions
|
||||
Add command history (and dynamic history free if low memory)
|
||||
Fix broken jsvArrayPop
|
||||
Add tests for and fix Array.indexOf
|
||||
In-line editing for commands
|
||||
Fix bug in basicVarEquals for big strings
|
||||
More fixes for low memory conditions
|
||||
Multi-line edit for commands (but no newline or line delete yet)
|
||||
Handle Home, End + reverse delete keys
|
||||
Fix nested for loops not handling interrupts correctly
|
||||
Fix AppendString issue when given start value greater than string
|
||||
Add 'changeInterval' to allow things created with setInterval to have the frequency changed (eg. stepper motor control)
|
||||
Now puts itself to sleep to save power, when it knows nothing is required and it'll be woken up by SysTick before
|
||||
Change Math library to avoid putting constants in RAM
|
||||
|
||||
1v10 : Increase FIFO size for VL
|
||||
Marginally decrease amount of F4 vars to ensure they all fit in one flash sector
|
||||
Allow strings to be longer than the max token size
|
||||
'"key" in obj' syntax
|
||||
Detect if in FOR or WHILE loop, and if not, disallow break and continue
|
||||
Change min setInterval time to 0.1ms - F4 can get close to this
|
||||
Better analog pin error message
|
||||
USB support on Olimexino/Maple
|
||||
Start of multiple COM port support (ioEvent queue)
|
||||
Ctrl-C now clears the input line
|
||||
Save state of 'echo' into flash with save()
|
||||
Add 'setBusyIndicator(pin)' to set pin high when Espruino is busy
|
||||
Inbuilt function handling speed improvements
|
||||
Allow Serial comms via other UARTS. Serial1/2.onData and print/println
|
||||
now inserts elements into arrays in the correct order (GetLength can be (is) now much faster)
|
||||
Faster code to work out pins from strings
|
||||
Automatically convert IDs in form A#,A##,B#,B## etc into numbers.
|
||||
Built-in constants for LED1/BTN/etc.
|
||||
|
||||
1v09 : Enabled 'abs' by default
|
||||
Added flash programming to STM32F4
|
||||
analogWrite now working!
|
||||
|
||||
1v08 : Add preliminary STM32F4 support
|
||||
Allowed test cases to test timers - eg. code in jsinteractive.c
|
||||
Fix memory leak for timer
|
||||
Fix memory leak for digitalWrite
|
||||
|
||||
1v07 : Fix string charAt
|
||||
Fix watch on different pin
|
||||
Pass arguments to event handlers - eg. time
|
||||
digitalWrite/Read to take arrays of pins, and int for value
|
||||
|
||||
1v06 : Add break + continue
|
||||
Add switch statement
|
||||
Handle /r, /r/n or just /n for newlines - phone compatible
|
||||
Handle different type of delete
|
||||
|
||||
1v05 : Allow setWatch/setTimeout/setInterval with a string
|
||||
Handle adding Open bracket then deleting it
|
||||
When calling a NAMED function, zero the scopes - this stops scope table overflow
|
||||
|
||||
1v04 : Renamed to Espruino
|
||||
Fixed issue with event add when out of memory
|
||||
If out of memory happens during a timer, kill all timers
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user