summaryrefslogtreecommitdiff
path: root/bsp/pic32ethernet
diff options
context:
space:
mode:
authorwuyangyong <[email protected]>2011-09-05 15:20:56 +0000
committerwuyangyong <[email protected]>2011-09-05 15:20:56 +0000
commit0f50919f303b766831b8d6a04a8d6e6e28da1338 (patch)
tree0d9f150f68d8cd9f89c3d728fceae69517b83b68 /bsp/pic32ethernet
parent40ad880bdd2eb22aca027cdeecd591e8338281e3 (diff)
update PIC32 example project
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1698 bbd45198-f89e-11dd-88c7-29a3b14d5316
Diffstat (limited to 'bsp/pic32ethernet')
-rw-r--r--bsp/pic32ethernet/board.c2
-rw-r--r--bsp/pic32ethernet/project.cbp5
-rw-r--r--bsp/pic32ethernet/project.mcp49
-rw-r--r--bsp/pic32ethernet/project.mcwbin57856 -> 57856 bytes
-rw-r--r--bsp/pic32ethernet/uart.c54
5 files changed, 64 insertions, 46 deletions
diff --git a/bsp/pic32ethernet/board.c b/bsp/pic32ethernet/board.c
index b5bc301aea..0ff6895a54 100644
--- a/bsp/pic32ethernet/board.c
+++ b/bsp/pic32ethernet/board.c
@@ -122,5 +122,5 @@ void __ISR(_TIMER_1_VECTOR, ipl2) Timer1Handler(void)
//}
-void __ISR(_CORE_SOFTWARE_0_VECTOR, ipl2) CoreSW0Handler(void);
+void __ISR(_CORE_SOFTWARE_0_VECTOR, ipl1) CoreSW0Handler(void);
diff --git a/bsp/pic32ethernet/project.cbp b/bsp/pic32ethernet/project.cbp
index 912c26fd86..cdba10e0a6 100644
--- a/bsp/pic32ethernet/project.cbp
+++ b/bsp/pic32ethernet/project.cbp
@@ -18,6 +18,7 @@
</Build>
<Compiler>
<Add option="-Wall" />
+ <Add directory="C:\Program Files\Microchip\MPLAB C32 Suite\pic32mx\include" />
</Compiler>
<Unit filename="application.c">
<Option compilerVar="CC" />
@@ -380,10 +381,10 @@
<Unit filename="..\..\libcpu\mips\common\mipsregs.h" />
<Unit filename="..\..\libcpu\mips\common\stackframe.h" />
<Unit filename="..\..\libcpu\mips\pic32\context_gcc.S" />
- <Unit filename="..\..\libcpu\mips\pic32\interrupt.c">
+ <Unit filename="..\..\libcpu\mips\pic32\cpuport.c">
<Option compilerVar="CC" />
</Unit>
- <Unit filename="..\..\libcpu\mips\pic32\stack.c">
+ <Unit filename="..\..\libcpu\mips\pic32\exceptions.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="..\..\src\clock.c">
diff --git a/bsp/pic32ethernet/project.mcp b/bsp/pic32ethernet/project.mcp
index 5649b16d2c..6aef19a5b0 100644
--- a/bsp/pic32ethernet/project.mcp
+++ b/bsp/pic32ethernet/project.mcp
@@ -43,9 +43,9 @@ file_015=kernel
file_016=kernel
file_017=.
file_018=pic32
-file_019=pic32
-file_020=.
-file_021=pic32
+file_019=.
+file_020=finsh
+file_021=finsh
file_022=finsh
file_023=finsh
file_024=finsh
@@ -57,9 +57,9 @@ file_029=finsh
file_030=finsh
file_031=finsh
file_032=finsh
-file_033=finsh
-file_034=finsh
-file_035=.
+file_033=.
+file_034=pic32
+file_035=pic32
file_036=.
[GENERATED_FILES]
file_000=no
@@ -157,31 +157,30 @@ file_015=..\..\src\timer.c
file_016=..\..\src\clock.c
file_017=startup.c
file_018=..\..\libcpu\mips\pic32\context_gcc.S
-file_019=..\..\libcpu\mips\pic32\stack.c
-file_020=console.c
-file_021=..\..\libcpu\mips\pic32\interrupt.c
-file_022=..\..\components\finsh\finsh_node.c
-file_023=..\..\components\finsh\finsh_ops.c
-file_024=..\..\components\finsh\finsh_parser.c
-file_025=..\..\components\finsh\finsh_token.c
-file_026=..\..\components\finsh\finsh_var.c
-file_027=..\..\components\finsh\finsh_vm.c
-file_028=..\..\components\finsh\shell.c
-file_029=..\..\components\finsh\symbol.c
-file_030=..\..\components\finsh\cmd.c
-file_031=..\..\components\finsh\finsh_compiler.c
-file_032=..\..\components\finsh\finsh_error.c
-file_033=..\..\components\finsh\finsh_heap.c
-file_034=..\..\components\finsh\finsh_init.c
-file_035=uart.c
+file_019=console.c
+file_020=..\..\components\finsh\finsh_node.c
+file_021=..\..\components\finsh\finsh_ops.c
+file_022=..\..\components\finsh\finsh_parser.c
+file_023=..\..\components\finsh\finsh_token.c
+file_024=..\..\components\finsh\finsh_var.c
+file_025=..\..\components\finsh\finsh_vm.c
+file_026=..\..\components\finsh\shell.c
+file_027=..\..\components\finsh\symbol.c
+file_028=..\..\components\finsh\cmd.c
+file_029=..\..\components\finsh\finsh_compiler.c
+file_030=..\..\components\finsh\finsh_error.c
+file_031=..\..\components\finsh\finsh_heap.c
+file_032=..\..\components\finsh\finsh_init.c
+file_033=uart.c
+file_034=..\..\libcpu\mips\pic32\exceptions.c
+file_035=..\..\libcpu\mips\pic32\cpuport.c
file_036=rtconfig.h
[SUITE_INFO]
suite_guid={14495C23-81F8-43F3-8A44-859C583D7760}
suite_state=
[TOOL_SETTINGS]
TS{CB0AF4B8-4022-429D-8F99-8A56782B2C6D}=--gdwarf-2
-TS{9C698E0A-CBC9-4EFF-AE7D-B569F93E7322}=-g -DPIC32_STARTER_KIT -G0
-TS{9C698E0A-CBC9-4EFF-AE7D-B569F93E7322}_alt=yes
+TS{9C698E0A-CBC9-4EFF-AE7D-B569F93E7322}=-g -DPIC32_STARTER_KIT
TS{77F59DA1-3C53-4677-AC5F-A03EB0125170}=-Map="$(BINDIR_)$(TARGETBASE).map" -o"$(BINDIR_)$(TARGETBASE).$(TARGETSUFFIX)"
TS{0396C0A1-9052-4E4F-8B84-EF0162B1B4E9}=
[INSTRUMENTED_TRACE]
diff --git a/bsp/pic32ethernet/project.mcw b/bsp/pic32ethernet/project.mcw
index 56e9837cae..207c64cf6c 100644
--- a/bsp/pic32ethernet/project.mcw
+++ b/bsp/pic32ethernet/project.mcw
Binary files differ
diff --git a/bsp/pic32ethernet/uart.c b/bsp/pic32ethernet/uart.c
index dcc1d3b450..1d18284ae3 100644
--- a/bsp/pic32ethernet/uart.c
+++ b/bsp/pic32ethernet/uart.c
@@ -155,25 +155,34 @@ void __ISR(_UART1_VECTOR, ipl2) IntUART1Handler(void)
// Is this an RX interrupt?
if(INTGetFlag(INT_SOURCE_UART_RX(uart_device->uart)))
{
- // Clear the RX interrupt Flag
- INTClearFlag(INT_SOURCE_UART_RX(uart_device->uart));
-
- /* Receive Data Available */
- uart_device->rx_buffer[uart_device->save_index] = UARTGetDataByte(uart_device->uart);//UARTGetDataByte(UART1);
- uart_device->save_index ++;
- if (uart_device->save_index >= RT_UART_RX_BUFFER_SIZE)
- uart_device->save_index = 0;
+ while( U1STAbits.URXDA )
+ {
+ /* Receive Data Available */
+ uart_device->rx_buffer[uart_device->save_index] = UARTGetDataByte(uart_device->uart);//UARTGetDataByte(UART1);
+ uart_device->save_index ++;
+ if (uart_device->save_index >= RT_UART_RX_BUFFER_SIZE)
+ {
+ uart_device->save_index = 0;
+ }
+ }
/* invoke callback */
if(uart_device->parent.rx_indicate != RT_NULL)
{
rt_size_t length;
if (uart_device->read_index > uart_device->save_index)
+ {
length = RT_UART_RX_BUFFER_SIZE - uart_device->read_index + uart_device->save_index;
+ }
else
+ {
length = uart_device->save_index - uart_device->read_index;
+ }
- uart_device->parent.rx_indicate(&uart_device->parent, length);
+ if( length )
+ {
+ uart_device->parent.rx_indicate(&uart_device->parent, length);
+ }
}
// Clear the RX interrupt Flag
@@ -198,25 +207,34 @@ void __ISR(_UART2_VECTOR, ipl2) IntUART2Handler(void)
// Is this an RX interrupt?
if(INTGetFlag(INT_SOURCE_UART_RX(uart_device->uart)))
{
- // Clear the RX interrupt Flag
- INTClearFlag(INT_SOURCE_UART_RX(uart_device->uart));
-
- /* Receive Data Available */
- uart_device->rx_buffer[uart_device->save_index] = UARTGetDataByte(uart_device->uart);//UARTGetDataByte(UART1);
- uart_device->save_index ++;
- if (uart_device->save_index >= RT_UART_RX_BUFFER_SIZE)
- uart_device->save_index = 0;
+ while( U2STAbits.URXDA )
+ {
+ /* Receive Data Available */
+ uart_device->rx_buffer[uart_device->save_index] = UARTGetDataByte(uart_device->uart);//UARTGetDataByte(UART1);
+ uart_device->save_index ++;
+ if (uart_device->save_index >= RT_UART_RX_BUFFER_SIZE)
+ {
+ uart_device->save_index = 0;
+ }
+ }
/* invoke callback */
if(uart_device->parent.rx_indicate != RT_NULL)
{
rt_size_t length;
if (uart_device->read_index > uart_device->save_index)
+ {
length = RT_UART_RX_BUFFER_SIZE - uart_device->read_index + uart_device->save_index;
+ }
else
+ {
length = uart_device->save_index - uart_device->read_index;
+ }
- uart_device->parent.rx_indicate(&uart_device->parent, length);
+ if( length )
+ {
+ uart_device->parent.rx_indicate(&uart_device->parent, length);
+ }
}
// Clear the RX interrupt Flag