1 //
2 // srecord - manipulate eprom load files
3 // Copyright (C) 2000-2002, 2006-2010 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
8 // (at 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
13 // GNU Lesser 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
17 // <http://www.gnu.org/licenses/>.
18 //
19
20 #include <srecord/memory/walker/crc16.h>
21 #include <srecord/output.h>
22
23
~memory_walker_crc16()24 srecord::memory_walker_crc16::~memory_walker_crc16()
25 {
26 delete checksum;
27 }
28
29
memory_walker_crc16(crc16::seed_mode_t seed_mode,bool augment_flag,unsigned short polynomial,crc16::bit_direction_t bitdir)30 srecord::memory_walker_crc16::memory_walker_crc16(crc16::seed_mode_t seed_mode,
31 bool augment_flag, unsigned short polynomial, crc16::bit_direction_t bitdir)
32 {
33 checksum = new crc16(seed_mode, augment_flag, polynomial, bitdir);
34 }
35
36
37 srecord::memory_walker_crc16::pointer
create(crc16::seed_mode_t arg1,bool a_augment,unsigned short polynomial,crc16::bit_direction_t a_bitdir)38 srecord::memory_walker_crc16::create(crc16::seed_mode_t arg1, bool a_augment,
39 unsigned short polynomial, crc16::bit_direction_t a_bitdir)
40 {
41 return
42 pointer
43 (
44 new srecord::memory_walker_crc16
45 (
46 arg1,
47 a_augment,
48 polynomial,
49 a_bitdir
50 )
51 );
52 }
53
54
55 void
observe(unsigned long,const void * data,int length)56 srecord::memory_walker_crc16::observe(unsigned long, const void *data,
57 int length)
58 {
59 checksum->nextbuf(data, length);
60 }
61
62
63 unsigned
get() const64 srecord::memory_walker_crc16::get()
65 const
66 {
67 return checksum->get();
68 }
69