Subversion Repositories freemyipod

Rev

Rev 35 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 35 Rev 54
Line 30... Line 30...
30
#include "console.h"
30
#include "console.h"
31
#include "util.h"
31
#include "util.h"
32
#include "i2c.h"
32
#include "i2c.h"
33
#include "strlen.h"
33
#include "strlen.h"
34
#include "contextswitch.h"
34
#include "contextswitch.h"
35
#include "pmu.h"
35
#include "power.h"
36
#include "mmu.h"
36
#include "mmu.h"
37
#include "shutdown.h"
37
#include "shutdown.h"
38
 
38
 
39
 
39
 
40
static uint8_t ctrlresp[2] CACHEALIGN_ATTR;
40
static uint8_t ctrlresp[2] CACHEALIGN_ATTR;
Line 465... Line 465...
465
            dbgsendbuf[2] = MAX_THREADS * sizeof(struct scheduler_thread);
465
            dbgsendbuf[2] = MAX_THREADS * sizeof(struct scheduler_thread);
466
            memcpy(&dbgsendbuf[4], scheduler_threads, dbgrecvbuf[1]);
466
            memcpy(&dbgsendbuf[4], scheduler_threads, dbgrecvbuf[1]);
467
            size = dbgrecvbuf[1] + 16;
467
            size = dbgrecvbuf[1] + 16;
468
            break;
468
            break;
469
        case 16:  // FREEZE SCHEDULER
469
        case 16:  // FREEZE SCHEDULER
470
            scheduler_freeze(dbgrecvbuf[1]);
470
            dbgsendbuf[1] = scheduler_freeze(dbgrecvbuf[1]);
471
            dbgsendbuf[0] = 1;
471
            dbgsendbuf[0] = 1;
472
            size = 16;
472
            size = 16;
473
            break;
473
            break;
474
        case 17:  // SUSPEND THREAD
474
        case 17:  // SUSPEND THREAD
-
 
475
            if (dbgrecvbuf[1])
-
 
476
            {
475
            if (dbgrecvbuf[1]) thread_suspend(dbgrecvbuf[2]);
477
                if (thread_suspend(dbgrecvbuf[2]) == -4) dbgsendbuf[1] = 1;
-
 
478
                else dbgsendbuf[1] = 0;
-
 
479
            }
-
 
480
            else
-
 
481
            {
476
            else thread_resume(dbgrecvbuf[2]);
482
                if (thread_resume(dbgrecvbuf[2]) == -5) dbgsendbuf[1] = 0;
-
 
483
                else dbgsendbuf[1] = 1;
-
 
484
            }
477
            dbgsendbuf[0] = 1;
485
            dbgsendbuf[0] = 1;
478
            size = 16;
486
            size = 16;
479
            break;
487
            break;
480
        case 18:  // KILL THREAD
488
        case 18:  // KILL THREAD
481
            thread_terminate(dbgrecvbuf[1]);
489
            thread_terminate(dbgrecvbuf[1]);
Line 552... Line 560...
552
                dbgasyncsendbuf[0] = 1;
560
                dbgasyncsendbuf[0] = 1;
553
                usb_drv_send_nonblocking(dbgendpoints[1], dbgasyncsendbuf, 16 + dbgactionlength);
561
                usb_drv_send_nonblocking(dbgendpoints[1], dbgasyncsendbuf, 16 + dbgactionlength);
554
                break;
562
                break;
555
            case DBGACTION_POWEROFF:
563
            case DBGACTION_POWEROFF:
556
                if (dbgactiontype) shutdown();
564
                if (dbgactiontype) shutdown();
557
                poweroff();
565
                power_off();
558
                break;
566
                break;
559
            case DBGACTION_RESET:
567
            case DBGACTION_RESET:
560
                shutdown();
568
                shutdown();
561
                reset();
569
                reset();
562
                break;
570
                break;