Commit 002c4ac8d71550df17fcb86c18b352815f015714

Authored by Grzegorz Jabłoński
1 parent 9bc921b8

Added p1, p2, r1, r2 commands

monitor.c
@@ -543,6 +543,28 @@ static void do_set_gpio(Monitor* mon, const char* port, const char* value) @@ -543,6 +543,28 @@ static void do_set_gpio(Monitor* mon, const char* port, const char* value)
543 printf("Invalid channel\n"); 543 printf("Invalid channel\n");
544 } 544 }
545 545
  546 +static void do_p1(Monitor* mon)
  547 +{
  548 + do_set_gpio(mon, "C5", "0");
  549 +}
  550 +
  551 +static void do_p2(Monitor* mon)
  552 +{
  553 + do_set_gpio(mon, "C4", "0");
  554 +}
  555 +
  556 +static void do_r1(Monitor* mon)
  557 +{
  558 + do_set_gpio(mon, "C5", "1");
  559 +}
  560 +
  561 +static void do_r2(Monitor* mon)
  562 +{
  563 + do_set_gpio(mon, "C5", "1");
  564 +}
  565 +
  566 +
  567 +
546 static void do_logfile(Monitor *mon, const char *filename) 568 static void do_logfile(Monitor *mon, const char *filename)
547 { 569 {
548 cpu_set_log_filename(filename); 570 cpu_set_log_filename(filename);
qemu-monitor.hx
@@ -647,7 +647,7 @@ used by another monitor command. @@ -647,7 +647,7 @@ used by another monitor command.
647 ETEXI 647 ETEXI
648 648
649 649
650 - { "set_gpio", "ss", do_set_gpio, "set_gpio pin value", 650 + { "set_gpio", "ss", do_set_gpio, "pin value",
651 "set a value of a given gpio pio" }, 651 "set a value of a given gpio pio" },
652 STEXI 652 STEXI
653 @item set_gpio @var{pin} @var{value} 653 @item set_gpio @var{pin} @var{value}
@@ -655,6 +655,35 @@ Set the value of the given gpio pin to a specific value @@ -655,6 +655,35 @@ Set the value of the given gpio pin to a specific value
655 ETEXI 655 ETEXI
656 656
657 657
  658 + { "p1", "", do_p1, "",
  659 + "press button 1" },
  660 +STEXI
  661 +@item p1
  662 +Press button 1
  663 +ETEXI
  664 +
  665 + { "p2", "", do_p2, "",
  666 + "press button 2" },
  667 +STEXI
  668 +@item p2
  669 +Press button 2
  670 +ETEXI
  671 +
  672 + { "r1", "", do_r1, "",
  673 + "release button 1" },
  674 +STEXI
  675 +@item r1
  676 +Release button 1
  677 +ETEXI
  678 +
  679 + { "r2", "", do_r2, "",
  680 + "release button 2" },
  681 +STEXI
  682 +@item r2
  683 +Release button 2
  684 +ETEXI
  685 +
  686 +
658 STEXI 687 STEXI
659 @end table 688 @end table
660 ETEXI 689 ETEXI
virtual_lab/g 0 → 120000
  1 +gdbinit
0 \ No newline at end of file 2 \ No newline at end of file
virtual_lab/gdbinit
@@ -9,4 +9,6 @@ disass $pc,+16 @@ -9,4 +9,6 @@ disass $pc,+16
9 end 9 end
10 10
11 target remote :1234 11 target remote :1234
  12 +load
  13 +c
12 14
virtual_lab/main.c
@@ -60,15 +60,7 @@ int main(void) @@ -60,15 +60,7 @@ int main(void)
60 PC_PUER = BT1 | BT2; 60 PC_PUER = BT1 | BT2;
61 while(true) 61 while(true)
62 { 62 {
63 - delay();  
64 - /*  
65 - PB_SODR = DS1;  
66 - PC_CODR = DS2;  
67 - delay();  
68 - PB_CODR = DS1;  
69 - PC_SODR = DS2;  
70 - delay();  
71 - */ 63 +// delay();
72 if(PC_PDSR & BT1) 64 if(PC_PDSR & BT1)
73 PB_SODR = DS1; 65 PB_SODR = DS1;
74 else 66 else