changeset 209:e4d70b3367be

new ETM debug command for KPD_PWR testing
author Mychaela Falconia <falcon@freecalypso.org>
date Thu, 22 Apr 2021 07:22:59 +0000
parents 6fb17a32c5bd
children 7e225a4cd537
files src/cs/services/etm/etm_tmcore.c
diffstat 1 files changed, 14 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/cs/services/etm/etm_tmcore.c	Tue Apr 06 03:33:18 2021 +0000
+++ b/src/cs/services/etm/etm_tmcore.c	Thu Apr 22 07:22:59 2021 +0000
@@ -33,6 +33,9 @@
 #include "spi/spi_drv.h"
 extern void tr_etm_init(unsigned int mask);
 
+/* FreeCalypso addition for KPD_PWR testing */
+#include "kpd/kpd_power_api.h"
+
 // Version of the ETM CORE module
 // See the file etm_version.h
 
@@ -305,8 +308,8 @@
 int etm_debug(T_ETM_PKT *pkt, uint8 *buf)
 {
    int type, error, data;
-   
-   static char *p;
+   char *p;
+   extern T_KPD_KEYPAD Kp;
 
    type = *buf & 0x0F;   
    buf++; 
@@ -315,11 +318,13 @@
 
    tr_etm(TgTrCore, "ETM CORE: _debug: type(%d) data(0x%x)", type, data);
 
+   error = 0;
    switch (type) {
    case 0: // (0x00) Allocate Test Buffer
        if ((p = etm_malloc(data)) == NULL)
            error = ETM_NOMEM;
-       error = etm_pkt_put32(pkt, (int) p); 
+       else
+           error = etm_pkt_put32(pkt, (int) p); 
        break;
    case 1: // (0x01) Free Test Buffer.
        p = (char *) data;
@@ -333,6 +338,12 @@
        rvf_dump_pool();
        rvf_dump_tasks();
        break;
+   /* FreeCalypso addition for KPD_PWR testing */
+   case 4:
+       (Kp.pressed)(KPD_PWR);
+       rvf_delay(5);
+       (Kp.released)();
+       break;
    default:
        error = ETM_NOSYS;                  
    }