Contiki 3.x
uip-arch.c
Go to the documentation of this file.
1 /**
2  * \addtogroup mbxxx-platform
3  *
4  * @{
5  */
6 
7 /*
8  * Copyright (c) 2010, STMicroelectronics.
9  * All rights reserved.
10  *
11  * Redistribution and use in source and binary forms, with or without
12  * modification, are permitted provided that the following conditions
13  * are met:
14  * 1. Redistributions of source code must retain the above copyright
15  * notice, this list of conditions and the following disclaimer.
16  * 2. Redistributions in binary form must reproduce the above
17  * copyright notice, this list of conditions and the following
18  * disclaimer in the documentation and/or other materials provided
19  * with the distribution.
20  * 3. The name of the author may not be used to endorse or promote
21  * products derived from this software without specific prior
22  * written permission.
23  *
24  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
25  * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
26  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27  * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
28  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
30  * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
32  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
33  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
34  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35  *
36  */
37 
38 /**
39 * \file
40 * uip-arch.c
41 * \author
42 * Salvatore Pitrulli <salvopitru@users.sourceforge.net>
43 */
44 
45 #include "net/ip/uip.h"
46 #include "net/ip/uip_arch.h"
47 
48 #if UIP_TCP
49 void
50 uip_add32(uint8_t * op32, uint16_t op16)
51 {
52  uint32_t op32_align, uip_acc32_align;
53 
54  op32_align =
55  ((uint32_t) op32[0]) << 24 | ((uint32_t) op32[1]) << 16 |
56  ((uint16_t) op32[2]) << 8 | op32[3];
57 
58  uip_acc32_align = op32_align + op16;
59  uip_acc32[3] = uip_acc32_align;
60  uip_acc32[2] = uip_acc32_align >> 8;
61  uip_acc32[1] = uip_acc32_align >> 16;
62  uip_acc32[0] = uip_acc32_align >> 24;
63 }
64 #endif
65 /*-----------------------------------------------------------------------------------*/
66 /** @} */
uint8_t uip_acc32[4]
4-byte array used for the 32-bit sequence number calculations.
Header file for the uIP TCP/IP stack.
void uip_add32(uint8_t *op32, uint16_t op16)
Carry out a 32-bit addition.
Definition: uip_arch.c:45
Declarations of architecture specific functions.