[ucsim] Update email and file info, fix stm8 flash controller
[sdcc.git] / sdcc / sim / ucsim / src / sims / stm8.src / uid.cc
blobd782e95ca8b89be9c90a8e9cecf674abb5df62e4
1 /*
2 * Simulator of microcontrollers (uid.cc)
4 * Copyright (C) 2017 Drotos Daniel
5 *
6 * To contact author send email to dr.dkdb@gmail.com
8 */
10 /* This file is part of microcontroller simulator: ucsim.
12 UCSIM is free software; you can redistribute it and/or modify
13 it under the terms of the GNU General Public License as published by
14 the Free Software Foundation; either version 2 of the License, or
15 (at your option) any later version.
17 UCSIM is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 GNU General Public License for more details.
22 You should have received a copy of the GNU General Public License
23 along with UCSIM; see the file COPYING. If not, write to the Free
24 Software Foundation, 59 Temple Place - Suite 330, Boston, MA
25 02111-1307, USA. */
26 /*@1@*/
28 #include "uidcl.h"
31 cl_uid::cl_uid(class cl_uc *auc, t_addr abase):
32 cl_hw(auc, HW_DUMMY, 0, "uid")
34 base= abase;
37 static u8_t uid[12]= {
38 0x00,
39 0x5b,
40 0x00,
41 0x16,
42 0x11,
43 0x47,
44 0x30,
45 0x31,
46 0x38,
47 0x35,
48 0x35,
49 0x36
52 int
53 cl_uid::init(void)
55 int i;
56 cl_hw::init();
57 for (i= 0; i < 12; i++)
59 //regs[i]= register_cell(uc->rom, base+i);
60 uc->rom->download(base+i, uid[i]);
61 uc->rom->set_cell_flag(base+i, true, CELL_READ_ONLY);
63 return 0;
66 t_mem
67 cl_uid::read(class cl_memory_cell *cell)
69 t_mem v= cell->get();
71 if (conf(cell, NULL))
72 return v;
74 return v;
77 void
78 cl_uid::write(class cl_memory_cell *cell, t_mem *val)
80 if (conf(cell, val))
81 return;
84 void
85 cl_uid::print_info(class cl_console_base *con)
87 for (t_addr i = 0; i < 12; i++)
88 con->dd_cprintf("dump_number", "%02x ", uc->rom->get(base+i));
89 con->dd_printf("\n");
91 //print_cfg_info(con);
95 /* End of stm8.src/uid.cc */