1 //
2 // srecord - Manipulate EPROM load files
3 // Copyright (C) 2009-2011 Peter Miller
4 //
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU Lesser General Public License as published by
7 // the Free Software Foundation; either version 3 of the License, or (at
8 // your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13 // General Public License for more details.
14 //
15 // You should have received a copy of the GNU Lesser General Public License
16 // along with this program. If not, see <http://www.gnu.org/licenses/>.
17 //
18 
19 #include <srecord/memory/walker/fletcher16.h>
20 #include <srecord/output.h>
21 
22 
~memory_walker_fletcher16()23 srecord::memory_walker_fletcher16::~memory_walker_fletcher16()
24 {
25 }
26 
27 
memory_walker_fletcher16(int a_sum1,int a_sum2,int a_answer,endian_t a_end)28 srecord::memory_walker_fletcher16::memory_walker_fletcher16(
29     int a_sum1,
30     int a_sum2,
31     int a_answer,
32     endian_t a_end
33 ) :
34     checksum(a_sum1, a_sum2, a_answer, a_end)
35 {
36 }
37 
38 
39 srecord::memory_walker_fletcher16::pointer
create(int a_sum1,int a_sum2,int a_answer,endian_t a_end)40 srecord::memory_walker_fletcher16::create(int a_sum1, int a_sum2,
41     int a_answer, endian_t a_end)
42 {
43     return
44         pointer(new memory_walker_fletcher16(a_sum1, a_sum2, a_answer, a_end));
45 }
46 
47 
48 void
observe(unsigned long,const void * data,int data_size)49 srecord::memory_walker_fletcher16::observe(unsigned long, const void *data,
50     int data_size)
51 {
52     checksum.nextbuf(data, data_size);
53 }
54 
55 
56 unsigned
get(void) const57 srecord::memory_walker_fletcher16::get(void)
58     const
59 {
60     return checksum.get();
61 }
62 
63 
64 // vim: set ts=8 sw=4 et :
65