1 /* Helper functions for reading the memory map in a device 2 * following the ST DfuSe 1.1a specification. 3 * 4 * (C) 2011 Tormod Volden <debian.tormod@gmail.com> 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; either version 2 of the License, or 9 * (at your option) any later version. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with this program; if not, write to the Free Software 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 */ 20 21 #ifndef DFUSE_MEM_H 22 #define DFUSE_MEM_H 23 24 #define DFUSE_READABLE 1 25 #define DFUSE_ERASABLE 2 26 #define DFUSE_WRITEABLE 4 27 28 struct memsegment { 29 unsigned int start; 30 unsigned int end; 31 int pagesize; 32 int memtype; 33 struct memsegment *next; 34 }; 35 36 int add_segment(struct memsegment **list, struct memsegment new_element); 37 38 struct memsegment *find_segment(struct memsegment *list, unsigned int address); 39 40 void free_segment_list(struct memsegment *list); 41 42 struct memsegment *parse_memory_layout(char *intf_desc_str); 43 44 #endif /* DFUSE_MEM_H */ 45