ProjetoBB

Dependencies:   F7_Ethernet WebSocketClient mbed mcp3008

Fork of Nucleo_F746ZG_Ethernet by Dieter Graef

Committer:
DieterGraef
Date:
Sat Jun 18 10:49:12 2016 +0000
Revision:
0:f9b6112278fe
Ethernet for the NUCLEO STM32F746 Board Testprogram uses DHCP and NTP to set the clock

Who changed what in which revision?

UserRevisionLine numberNew contents of line
DieterGraef 0:f9b6112278fe 1 /* Copyright (C) 2013 - Adam Green (https://github.com/adamgreen)
DieterGraef 0:f9b6112278fe 2
DieterGraef 0:f9b6112278fe 3 Licensed under the Apache License, Version 2.0 (the "License");
DieterGraef 0:f9b6112278fe 4 you may not use this file except in compliance with the License.
DieterGraef 0:f9b6112278fe 5 You may obtain a copy of the License at
DieterGraef 0:f9b6112278fe 6
DieterGraef 0:f9b6112278fe 7 http://www.apache.org/licenses/LICENSE-2.0
DieterGraef 0:f9b6112278fe 8
DieterGraef 0:f9b6112278fe 9 Unless required by applicable law or agreed to in writing, software
DieterGraef 0:f9b6112278fe 10 distributed under the License is distributed on an "AS IS" BASIS,
DieterGraef 0:f9b6112278fe 11 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
DieterGraef 0:f9b6112278fe 12 See the License for the specific language governing permissions and
DieterGraef 0:f9b6112278fe 13 limitations under the License.
DieterGraef 0:f9b6112278fe 14 */
DieterGraef 0:f9b6112278fe 15 #if defined(TOOLCHAIN_GCC) && defined(__thumb2__)
DieterGraef 0:f9b6112278fe 16
DieterGraef 0:f9b6112278fe 17 #include <stdio.h>
DieterGraef 0:f9b6112278fe 18
DieterGraef 0:f9b6112278fe 19
DieterGraef 0:f9b6112278fe 20 /* This is a hand written Thumb-2 assembly language version of the
DieterGraef 0:f9b6112278fe 21 standard C memcpy() function that can be used by the lwIP networking
DieterGraef 0:f9b6112278fe 22 stack to improve its performance. It copies 4 bytes at a time and
DieterGraef 0:f9b6112278fe 23 unrolls the loop to perform 4 of these copies per loop iteration.
DieterGraef 0:f9b6112278fe 24 */
DieterGraef 0:f9b6112278fe 25 __attribute__((naked)) void thumb2_memcpy(void* pDest, const void* pSource, size_t length)
DieterGraef 0:f9b6112278fe 26 {
DieterGraef 0:f9b6112278fe 27 __asm (
DieterGraef 0:f9b6112278fe 28 ".syntax unified\n"
DieterGraef 0:f9b6112278fe 29 ".thumb\n"
DieterGraef 0:f9b6112278fe 30
DieterGraef 0:f9b6112278fe 31 // Copy 16 bytes at a time first.
DieterGraef 0:f9b6112278fe 32 " lsrs r3, r2, #4\n"
DieterGraef 0:f9b6112278fe 33 " beq.n 2$\n"
DieterGraef 0:f9b6112278fe 34 "1$: ldr r12, [r1], #4\n"
DieterGraef 0:f9b6112278fe 35 " str r12, [r0], #4\n"
DieterGraef 0:f9b6112278fe 36 " ldr r12, [r1], #4\n"
DieterGraef 0:f9b6112278fe 37 " str r12, [r0], #4\n"
DieterGraef 0:f9b6112278fe 38 " ldr r12, [r1], #4\n"
DieterGraef 0:f9b6112278fe 39 " str r12, [r0], #4\n"
DieterGraef 0:f9b6112278fe 40 " ldr r12, [r1], #4\n"
DieterGraef 0:f9b6112278fe 41 " str r12, [r0], #4\n"
DieterGraef 0:f9b6112278fe 42 " subs r3, #1\n"
DieterGraef 0:f9b6112278fe 43 " bne 1$\n"
DieterGraef 0:f9b6112278fe 44
DieterGraef 0:f9b6112278fe 45 // Copy byte by byte for what is left.
DieterGraef 0:f9b6112278fe 46 "2$:\n"
DieterGraef 0:f9b6112278fe 47 " ands r3, r2, #0xf\n"
DieterGraef 0:f9b6112278fe 48 " beq.n 4$\n"
DieterGraef 0:f9b6112278fe 49 "3$: ldrb r12, [r1], #1\n"
DieterGraef 0:f9b6112278fe 50 " strb r12, [r0], #1\n"
DieterGraef 0:f9b6112278fe 51 " subs r3, #1\n"
DieterGraef 0:f9b6112278fe 52 " bne 3$\n"
DieterGraef 0:f9b6112278fe 53
DieterGraef 0:f9b6112278fe 54 // Return to caller.
DieterGraef 0:f9b6112278fe 55 "4$: bx lr\n"
DieterGraef 0:f9b6112278fe 56 );
DieterGraef 0:f9b6112278fe 57 }
DieterGraef 0:f9b6112278fe 58
DieterGraef 0:f9b6112278fe 59 #endif