• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src-rt-6.x.4708/linux/linux-2.6/arch/avr32/lib/
1/*
2 * Copyright (C) 2004-2006 Atmel Corporation
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8
9	/*
10	 * unsigned int csum_partial(const unsigned char *buff,
11	 *			     int len, unsigned int sum)
12	 */
13	.text
14	.global	csum_partial
15	.type	csum_partial,"function"
16	.align	1
17csum_partial:
18	/* checksum complete words, aligned or not */
193:	sub	r11, 4
20	brlt	5f
214:	ld.w	r9, r12++
22	add	r10, r9
23	acr	r10
24	sub	r11, 4
25	brge	4b
26
27	/* return if we had a whole number of words */
285:	sub	r11, -4
29	reteq	r10
30
31	/* checksum any remaining bytes at the end */
32	mov	r9, 0
33	mov	r8, 0
34	cp	r11, 2
35	brlt	6f
36	ld.uh	r9, r12++
37	sub	r11, 2
38	breq	7f
39	lsl	r9, 16
406:	ld.ub	r8, r12++
41	lsl	r8, 8
427:	or	r9, r8
43	add	r10, r9
44	acr	r10
45
46	retal	r10
47	.size	csum_partial, . - csum_partial
48