srecord 1.65.0
 
Loading...
Searching...
No Matches
stm32.h
Go to the documentation of this file.
1//
2// srecord - manipulate eprom load files
3// Copyright (C) 2012 Peter Miller
4//
5// This program is free software; you can redistribute it and/or modify it
6// 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 your
8// option) any later version.
9//
10// This program is distributed in the hope that it will be useful, but WITHOUT
11// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
13// 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// From: Hendrik Beijeman <hbeyeman@gmail.com>
20// To: pmiller@opensource.org.au
21// Subject: Re: patch for srecord 1.59
22// Date: Sat, 05 May 2012 06:26:02 +0200 (05/05/12 14:26:02)
23//
24// I hereby formally assign all copyright to the author of srecord,
25// Peter Miller.
26//
27
28#ifndef SRECORD_MEMORY_WALKER_STM32_H
29#define SRECORD_MEMORY_WALKER_STM32_H
30
31#include <srecord/stm32.h>
33
34namespace srecord
35{
36
37/**
38 * The memory_walker_stm32 class is a vistor for calculating the CRC used by
39 * the hardware CRC unit on the STM32 series of ARM MPUs. The algo used by the
40 * STM32 hardware unit is just a CRC with a different polynomial and word-fed
41 * instead of byte-fed. The MPU is little endian but srecord will compute the
42 * correct checksum regardless of the endianness of the generating platform.
43 * http://www.st.com/
44 */
45class memory_walker_stm32:
46 public memory_walker
47{
48public:
49 typedef std::shared_ptr<memory_walker_stm32> pointer;
50
51 /**
52 * The destructor.
53 */
55
56 /**
57 * The create class method is used to create new dynamically
58 * allocated instances of this class.
59 */
60 static pointer create(void);
61
62 /**
63 * The get method is used to get the CRC32 (STM32) checksum once
64 * all memory chunks have been processed by calls to our observe
65 * method.
66 */
67 unsigned get(void) const;
68
69protected:
70 // See base class for documentation.
71 void observe(unsigned long, const void *, int);
72
73private:
74 /**
75 * The default constructor.
76 * It is private on purpose, use the #create class method instead.
77 */
78 memory_walker_stm32();
79
80 /**
81 * The checksum instance variable is used to remember the running
82 * state of the CRC32 (STM32) checksum calculation.
83 */
84 stm32 checksum;
85
86 /**
87 * The copy constructor. Do not use.
88 */
89 memory_walker_stm32(const memory_walker_stm32 &);
90
91 /**
92 * The assignment operator. Do not use.
93 */
94 memory_walker_stm32 &operator=(const memory_walker_stm32 &);
95};
96
97};
98
99// vim: set ts=8 sw=4 et :
100#endif // SRECORD_MEMORY_WALKER_STM32_H
virtual ~memory_walker_stm32()
The destructor.
std::shared_ptr< memory_walker_stm32 > pointer
Definition stm32.h:49
unsigned get(void) const
The get method is used to get the CRC32 (STM32) checksum once all memory chunks have been processed b...
void observe(unsigned long, const void *, int)
The observe method is used by the memory walker to provide data.
static pointer create(void)
The create class method is used to create new dynamically allocated instances of this class.
memory_walker()
The default constructor.
The stm32 class is used to represent the running value of a 32-bit cyclic redundancy check of series ...
Definition stm32.h:43