Lines Matching refs:frame

301 …uint32_t *frame = heap_caps_malloc(sizeof(cpu_domain_dev_sleep_frame_t) + region_sz + regs_frame_s…  in cpu_domain_dev_sleep_frame_alloc_and_init()  local
302 if (frame) { in cpu_domain_dev_sleep_frame_alloc_and_init()
303 …cpu_domain_dev_regs_region_t *region = (cpu_domain_dev_regs_region_t *)(frame + sizeof(cpu_domain_… in cpu_domain_dev_sleep_frame_alloc_and_init()
305 void *regs_frame = frame + sizeof(cpu_domain_dev_sleep_frame_t) + region_sz; in cpu_domain_dev_sleep_frame_alloc_and_init()
307 *(cpu_domain_dev_sleep_frame_t *)frame = (cpu_domain_dev_sleep_frame_t) { in cpu_domain_dev_sleep_frame_alloc_and_init()
313 return frame; in cpu_domain_dev_sleep_frame_alloc_and_init()
362 void *frame = heap_caps_calloc(1, RV_SLEEP_CTX_FRMSZ, MALLOC_CAP_32BIT|MALLOC_CAP_INTERNAL); in esp_sleep_cpu_retention_init_impl() local
363 if (frame == NULL) { in esp_sleep_cpu_retention_init_impl()
366 s_cpu_retention.retent.critical_frame = (RvCoreCriticalSleepFrame *)frame; in esp_sleep_cpu_retention_init_impl()
367 rv_core_critical_regs_frame = (RvCoreCriticalSleepFrame *)frame; in esp_sleep_cpu_retention_init_impl()
370 …void *frame = heap_caps_calloc(1, sizeof(RvCoreNonCriticalSleepFrame), MALLOC_CAP_32BIT|MALLOC_CAP… in esp_sleep_cpu_retention_init_impl() local
371 if (frame == NULL) { in esp_sleep_cpu_retention_init_impl()
374 s_cpu_retention.retent.non_critical_frame = (RvCoreNonCriticalSleepFrame *)frame; in esp_sleep_cpu_retention_init_impl()
377 void *frame = cpu_domain_intpri_sleep_frame_alloc_and_init(); in esp_sleep_cpu_retention_init_impl() local
378 if (frame == NULL) { in esp_sleep_cpu_retention_init_impl()
381 s_cpu_retention.retent.intpri_frame = (cpu_domain_dev_sleep_frame_t *)frame; in esp_sleep_cpu_retention_init_impl()
384 void *frame = cpu_domain_cache_config_sleep_frame_alloc_and_init(); in esp_sleep_cpu_retention_init_impl() local
385 if (frame == NULL) { in esp_sleep_cpu_retention_init_impl()
388 s_cpu_retention.retent.cache_config_frame = (cpu_domain_dev_sleep_frame_t *)frame; in esp_sleep_cpu_retention_init_impl()
391 void *frame = cpu_domain_plic_sleep_frame_alloc_and_init(); in esp_sleep_cpu_retention_init_impl() local
392 if (frame == NULL) { in esp_sleep_cpu_retention_init_impl()
395 s_cpu_retention.retent.plic_frame = (cpu_domain_dev_sleep_frame_t *)frame; in esp_sleep_cpu_retention_init_impl()
398 void *frame = cpu_domain_clint_sleep_frame_alloc_and_init(); in esp_sleep_cpu_retention_init_impl() local
399 if (frame == NULL) { in esp_sleep_cpu_retention_init_impl()
402 s_cpu_retention.retent.clint_frame = (cpu_domain_dev_sleep_frame_t *)frame; in esp_sleep_cpu_retention_init_impl()
459 RvCoreNonCriticalSleepFrame *frame = s_cpu_retention.retent.non_critical_frame; in rv_core_noncritical_regs_save() local
460 frame->mscratch = RV_READ_CSR(mscratch); in rv_core_noncritical_regs_save()
461 frame->mideleg = RV_READ_CSR(mideleg); in rv_core_noncritical_regs_save()
462 frame->misa = RV_READ_CSR(misa); in rv_core_noncritical_regs_save()
463 frame->tselect = RV_READ_CSR(tselect); in rv_core_noncritical_regs_save()
464 frame->tdata1 = RV_READ_CSR(tdata1); in rv_core_noncritical_regs_save()
465 frame->tdata2 = RV_READ_CSR(tdata2); in rv_core_noncritical_regs_save()
466 frame->tcontrol = RV_READ_CSR(tcontrol); in rv_core_noncritical_regs_save()
468 frame->pmpaddr0 = RV_READ_CSR(pmpaddr0); in rv_core_noncritical_regs_save()
469 frame->pmpaddr1 = RV_READ_CSR(pmpaddr1); in rv_core_noncritical_regs_save()
470 frame->pmpaddr2 = RV_READ_CSR(pmpaddr2); in rv_core_noncritical_regs_save()
471 frame->pmpaddr3 = RV_READ_CSR(pmpaddr3); in rv_core_noncritical_regs_save()
472 frame->pmpaddr4 = RV_READ_CSR(pmpaddr4); in rv_core_noncritical_regs_save()
473 frame->pmpaddr5 = RV_READ_CSR(pmpaddr5); in rv_core_noncritical_regs_save()
474 frame->pmpaddr6 = RV_READ_CSR(pmpaddr6); in rv_core_noncritical_regs_save()
475 frame->pmpaddr7 = RV_READ_CSR(pmpaddr7); in rv_core_noncritical_regs_save()
476 frame->pmpaddr8 = RV_READ_CSR(pmpaddr8); in rv_core_noncritical_regs_save()
477 frame->pmpaddr9 = RV_READ_CSR(pmpaddr9); in rv_core_noncritical_regs_save()
478 frame->pmpaddr10 = RV_READ_CSR(pmpaddr10); in rv_core_noncritical_regs_save()
479 frame->pmpaddr11 = RV_READ_CSR(pmpaddr11); in rv_core_noncritical_regs_save()
480 frame->pmpaddr12 = RV_READ_CSR(pmpaddr12); in rv_core_noncritical_regs_save()
481 frame->pmpaddr13 = RV_READ_CSR(pmpaddr13); in rv_core_noncritical_regs_save()
482 frame->pmpaddr14 = RV_READ_CSR(pmpaddr14); in rv_core_noncritical_regs_save()
483 frame->pmpaddr15 = RV_READ_CSR(pmpaddr15); in rv_core_noncritical_regs_save()
484 frame->pmpcfg0 = RV_READ_CSR(pmpcfg0); in rv_core_noncritical_regs_save()
485 frame->pmpcfg1 = RV_READ_CSR(pmpcfg1); in rv_core_noncritical_regs_save()
486 frame->pmpcfg2 = RV_READ_CSR(pmpcfg2); in rv_core_noncritical_regs_save()
487 frame->pmpcfg3 = RV_READ_CSR(pmpcfg3); in rv_core_noncritical_regs_save()
490 frame->pmaaddr0 = RV_READ_CSR(CSR_PMAADDR(0)); in rv_core_noncritical_regs_save()
491 frame->pmaaddr1 = RV_READ_CSR(CSR_PMAADDR(1)); in rv_core_noncritical_regs_save()
492 frame->pmaaddr2 = RV_READ_CSR(CSR_PMAADDR(2)); in rv_core_noncritical_regs_save()
493 frame->pmaaddr3 = RV_READ_CSR(CSR_PMAADDR(3)); in rv_core_noncritical_regs_save()
494 frame->pmaaddr4 = RV_READ_CSR(CSR_PMAADDR(4)); in rv_core_noncritical_regs_save()
495 frame->pmaaddr5 = RV_READ_CSR(CSR_PMAADDR(5)); in rv_core_noncritical_regs_save()
496 frame->pmaaddr6 = RV_READ_CSR(CSR_PMAADDR(6)); in rv_core_noncritical_regs_save()
497 frame->pmaaddr7 = RV_READ_CSR(CSR_PMAADDR(7)); in rv_core_noncritical_regs_save()
498 frame->pmaaddr8 = RV_READ_CSR(CSR_PMAADDR(8)); in rv_core_noncritical_regs_save()
499 frame->pmaaddr9 = RV_READ_CSR(CSR_PMAADDR(9)); in rv_core_noncritical_regs_save()
500 frame->pmaaddr10 = RV_READ_CSR(CSR_PMAADDR(10)); in rv_core_noncritical_regs_save()
501 frame->pmaaddr11 = RV_READ_CSR(CSR_PMAADDR(11)); in rv_core_noncritical_regs_save()
502 frame->pmaaddr12 = RV_READ_CSR(CSR_PMAADDR(12)); in rv_core_noncritical_regs_save()
503 frame->pmaaddr13 = RV_READ_CSR(CSR_PMAADDR(13)); in rv_core_noncritical_regs_save()
504 frame->pmaaddr14 = RV_READ_CSR(CSR_PMAADDR(14)); in rv_core_noncritical_regs_save()
505 frame->pmaaddr15 = RV_READ_CSR(CSR_PMAADDR(15)); in rv_core_noncritical_regs_save()
506 frame->pmacfg0 = RV_READ_CSR(CSR_PMACFG(0)); in rv_core_noncritical_regs_save()
507 frame->pmacfg1 = RV_READ_CSR(CSR_PMACFG(1)); in rv_core_noncritical_regs_save()
508 frame->pmacfg2 = RV_READ_CSR(CSR_PMACFG(2)); in rv_core_noncritical_regs_save()
509 frame->pmacfg3 = RV_READ_CSR(CSR_PMACFG(3)); in rv_core_noncritical_regs_save()
510 frame->pmacfg4 = RV_READ_CSR(CSR_PMACFG(4)); in rv_core_noncritical_regs_save()
511 frame->pmacfg5 = RV_READ_CSR(CSR_PMACFG(5)); in rv_core_noncritical_regs_save()
512 frame->pmacfg6 = RV_READ_CSR(CSR_PMACFG(6)); in rv_core_noncritical_regs_save()
513 frame->pmacfg7 = RV_READ_CSR(CSR_PMACFG(7)); in rv_core_noncritical_regs_save()
514 frame->pmacfg8 = RV_READ_CSR(CSR_PMACFG(8)); in rv_core_noncritical_regs_save()
515 frame->pmacfg9 = RV_READ_CSR(CSR_PMACFG(9)); in rv_core_noncritical_regs_save()
516 frame->pmacfg10 = RV_READ_CSR(CSR_PMACFG(10)); in rv_core_noncritical_regs_save()
517 frame->pmacfg11 = RV_READ_CSR(CSR_PMACFG(11)); in rv_core_noncritical_regs_save()
518 frame->pmacfg12 = RV_READ_CSR(CSR_PMACFG(12)); in rv_core_noncritical_regs_save()
519 frame->pmacfg13 = RV_READ_CSR(CSR_PMACFG(13)); in rv_core_noncritical_regs_save()
520 frame->pmacfg14 = RV_READ_CSR(CSR_PMACFG(14)); in rv_core_noncritical_regs_save()
521 frame->pmacfg15 = RV_READ_CSR(CSR_PMACFG(15)); in rv_core_noncritical_regs_save()
524 frame->utvec = RV_READ_CSR(utvec); in rv_core_noncritical_regs_save()
525 frame->ustatus = RV_READ_CSR(ustatus); in rv_core_noncritical_regs_save()
526 frame->uepc = RV_READ_CSR(uepc); in rv_core_noncritical_regs_save()
527 frame->ucause = RV_READ_CSR(ucause); in rv_core_noncritical_regs_save()
529 frame->mpcer = RV_READ_CSR(CUSTOM_CSR_PCER_MACHINE); in rv_core_noncritical_regs_save()
530 frame->mpcmr = RV_READ_CSR(CUSTOM_CSR_PCMR_MACHINE); in rv_core_noncritical_regs_save()
531 frame->mpccr = RV_READ_CSR(CUSTOM_CSR_PCCR_MACHINE); in rv_core_noncritical_regs_save()
532 frame->cpu_testbus_ctrl = RV_READ_CSR(CUSTOM_CSR_CPU_TESTBUS_CTRL); in rv_core_noncritical_regs_save()
533 frame->upcer = RV_READ_CSR(CUSTOM_CSR_PCER_USER); in rv_core_noncritical_regs_save()
534 frame->upcmr = RV_READ_CSR(CUSTOM_CSR_PCMR_USER); in rv_core_noncritical_regs_save()
535 frame->upccr = RV_READ_CSR(CUSTOM_CSR_PCCR_USER); in rv_core_noncritical_regs_save()
536 frame->ugpio_oen = RV_READ_CSR(CUSTOM_CSR_GPIO_OEN_USER); in rv_core_noncritical_regs_save()
537 frame->ugpio_in = RV_READ_CSR(CUSTOM_CSR_GPIO_IN_USER); in rv_core_noncritical_regs_save()
538 frame->ugpio_out = RV_READ_CSR(CUSTOM_CSR_GPIO_OUT_USER); in rv_core_noncritical_regs_save()
539 return frame; in rv_core_noncritical_regs_save()
542 static IRAM_ATTR void rv_core_noncritical_regs_restore(RvCoreNonCriticalSleepFrame *frame) in rv_core_noncritical_regs_restore() argument
544 assert(frame); in rv_core_noncritical_regs_restore()
545 RV_WRITE_CSR(mscratch, frame->mscratch); in rv_core_noncritical_regs_restore()
546 RV_WRITE_CSR(mideleg, frame->mideleg); in rv_core_noncritical_regs_restore()
547 RV_WRITE_CSR(misa, frame->misa); in rv_core_noncritical_regs_restore()
548 RV_WRITE_CSR(tselect, frame->tselect); in rv_core_noncritical_regs_restore()
549 RV_WRITE_CSR(tdata1, frame->tdata1); in rv_core_noncritical_regs_restore()
550 RV_WRITE_CSR(tdata2, frame->tdata2); in rv_core_noncritical_regs_restore()
551 RV_WRITE_CSR(tcontrol, frame->tcontrol); in rv_core_noncritical_regs_restore()
552 RV_WRITE_CSR(pmpaddr0, frame->pmpaddr0); in rv_core_noncritical_regs_restore()
553 RV_WRITE_CSR(pmpaddr1, frame->pmpaddr1); in rv_core_noncritical_regs_restore()
554 RV_WRITE_CSR(pmpaddr2, frame->pmpaddr2); in rv_core_noncritical_regs_restore()
555 RV_WRITE_CSR(pmpaddr3, frame->pmpaddr3); in rv_core_noncritical_regs_restore()
556 RV_WRITE_CSR(pmpaddr4, frame->pmpaddr4); in rv_core_noncritical_regs_restore()
557 RV_WRITE_CSR(pmpaddr5, frame->pmpaddr5); in rv_core_noncritical_regs_restore()
558 RV_WRITE_CSR(pmpaddr6, frame->pmpaddr6); in rv_core_noncritical_regs_restore()
559 RV_WRITE_CSR(pmpaddr7, frame->pmpaddr7); in rv_core_noncritical_regs_restore()
560 RV_WRITE_CSR(pmpaddr8, frame->pmpaddr8); in rv_core_noncritical_regs_restore()
561 RV_WRITE_CSR(pmpaddr9, frame->pmpaddr9); in rv_core_noncritical_regs_restore()
562 RV_WRITE_CSR(pmpaddr10,frame->pmpaddr10); in rv_core_noncritical_regs_restore()
563 RV_WRITE_CSR(pmpaddr11,frame->pmpaddr11); in rv_core_noncritical_regs_restore()
564 RV_WRITE_CSR(pmpaddr12,frame->pmpaddr12); in rv_core_noncritical_regs_restore()
565 RV_WRITE_CSR(pmpaddr13,frame->pmpaddr13); in rv_core_noncritical_regs_restore()
566 RV_WRITE_CSR(pmpaddr14,frame->pmpaddr14); in rv_core_noncritical_regs_restore()
567 RV_WRITE_CSR(pmpaddr15,frame->pmpaddr15); in rv_core_noncritical_regs_restore()
568 RV_WRITE_CSR(pmpcfg0, frame->pmpcfg0); in rv_core_noncritical_regs_restore()
569 RV_WRITE_CSR(pmpcfg1, frame->pmpcfg1); in rv_core_noncritical_regs_restore()
570 RV_WRITE_CSR(pmpcfg2, frame->pmpcfg2); in rv_core_noncritical_regs_restore()
571 RV_WRITE_CSR(pmpcfg3, frame->pmpcfg3); in rv_core_noncritical_regs_restore()
574 RV_WRITE_CSR(CSR_PMAADDR(0), frame->pmaaddr0); in rv_core_noncritical_regs_restore()
575 RV_WRITE_CSR(CSR_PMAADDR(1), frame->pmaaddr1); in rv_core_noncritical_regs_restore()
576 RV_WRITE_CSR(CSR_PMAADDR(2), frame->pmaaddr2); in rv_core_noncritical_regs_restore()
577 RV_WRITE_CSR(CSR_PMAADDR(3), frame->pmaaddr3); in rv_core_noncritical_regs_restore()
578 RV_WRITE_CSR(CSR_PMAADDR(4), frame->pmaaddr4); in rv_core_noncritical_regs_restore()
579 RV_WRITE_CSR(CSR_PMAADDR(5), frame->pmaaddr5); in rv_core_noncritical_regs_restore()
580 RV_WRITE_CSR(CSR_PMAADDR(6), frame->pmaaddr6); in rv_core_noncritical_regs_restore()
581 RV_WRITE_CSR(CSR_PMAADDR(7), frame->pmaaddr7); in rv_core_noncritical_regs_restore()
582 RV_WRITE_CSR(CSR_PMAADDR(8), frame->pmaaddr8); in rv_core_noncritical_regs_restore()
583 RV_WRITE_CSR(CSR_PMAADDR(9), frame->pmaaddr9); in rv_core_noncritical_regs_restore()
584 RV_WRITE_CSR(CSR_PMAADDR(10),frame->pmaaddr10); in rv_core_noncritical_regs_restore()
585 RV_WRITE_CSR(CSR_PMAADDR(11),frame->pmaaddr11); in rv_core_noncritical_regs_restore()
586 RV_WRITE_CSR(CSR_PMAADDR(12),frame->pmaaddr12); in rv_core_noncritical_regs_restore()
587 RV_WRITE_CSR(CSR_PMAADDR(13),frame->pmaaddr13); in rv_core_noncritical_regs_restore()
588 RV_WRITE_CSR(CSR_PMAADDR(14),frame->pmaaddr14); in rv_core_noncritical_regs_restore()
589 RV_WRITE_CSR(CSR_PMAADDR(15),frame->pmaaddr15); in rv_core_noncritical_regs_restore()
590 RV_WRITE_CSR(CSR_PMACFG(0), frame->pmacfg0); in rv_core_noncritical_regs_restore()
591 RV_WRITE_CSR(CSR_PMACFG(1), frame->pmacfg1); in rv_core_noncritical_regs_restore()
592 RV_WRITE_CSR(CSR_PMACFG(2), frame->pmacfg2); in rv_core_noncritical_regs_restore()
593 RV_WRITE_CSR(CSR_PMACFG(3), frame->pmacfg3); in rv_core_noncritical_regs_restore()
594 RV_WRITE_CSR(CSR_PMACFG(4), frame->pmacfg4); in rv_core_noncritical_regs_restore()
595 RV_WRITE_CSR(CSR_PMACFG(5), frame->pmacfg5); in rv_core_noncritical_regs_restore()
596 RV_WRITE_CSR(CSR_PMACFG(6), frame->pmacfg6); in rv_core_noncritical_regs_restore()
597 RV_WRITE_CSR(CSR_PMACFG(7), frame->pmacfg7); in rv_core_noncritical_regs_restore()
598 RV_WRITE_CSR(CSR_PMACFG(8), frame->pmacfg8); in rv_core_noncritical_regs_restore()
599 RV_WRITE_CSR(CSR_PMACFG(9), frame->pmacfg9); in rv_core_noncritical_regs_restore()
600 RV_WRITE_CSR(CSR_PMACFG(10), frame->pmacfg10); in rv_core_noncritical_regs_restore()
601 RV_WRITE_CSR(CSR_PMACFG(11), frame->pmacfg11); in rv_core_noncritical_regs_restore()
602 RV_WRITE_CSR(CSR_PMACFG(12), frame->pmacfg12); in rv_core_noncritical_regs_restore()
603 RV_WRITE_CSR(CSR_PMACFG(13), frame->pmacfg13); in rv_core_noncritical_regs_restore()
604 RV_WRITE_CSR(CSR_PMACFG(14), frame->pmacfg14); in rv_core_noncritical_regs_restore()
605 RV_WRITE_CSR(CSR_PMACFG(15), frame->pmacfg15); in rv_core_noncritical_regs_restore()
608 RV_WRITE_CSR(utvec, frame->utvec); in rv_core_noncritical_regs_restore()
609 RV_WRITE_CSR(ustatus, frame->ustatus); in rv_core_noncritical_regs_restore()
610 RV_WRITE_CSR(uepc, frame->uepc); in rv_core_noncritical_regs_restore()
611 RV_WRITE_CSR(ucause, frame->ucause); in rv_core_noncritical_regs_restore()
613 RV_WRITE_CSR(CUSTOM_CSR_PCER_MACHINE, frame->mpcer); in rv_core_noncritical_regs_restore()
614 RV_WRITE_CSR(CUSTOM_CSR_PCMR_MACHINE, frame->mpcmr); in rv_core_noncritical_regs_restore()
615 RV_WRITE_CSR(CUSTOM_CSR_PCCR_MACHINE, frame->mpccr); in rv_core_noncritical_regs_restore()
616 RV_WRITE_CSR(CUSTOM_CSR_CPU_TESTBUS_CTRL, frame->cpu_testbus_ctrl); in rv_core_noncritical_regs_restore()
617 RV_WRITE_CSR(CUSTOM_CSR_PCER_USER, frame->upcer); in rv_core_noncritical_regs_restore()
618 RV_WRITE_CSR(CUSTOM_CSR_PCMR_USER, frame->upcmr); in rv_core_noncritical_regs_restore()
619 RV_WRITE_CSR(CUSTOM_CSR_PCCR_USER, frame->upccr); in rv_core_noncritical_regs_restore()
620 RV_WRITE_CSR(CUSTOM_CSR_GPIO_OEN_USER,frame->ugpio_oen); in rv_core_noncritical_regs_restore()
621 RV_WRITE_CSR(CUSTOM_CSR_GPIO_IN_USER, frame->ugpio_in); in rv_core_noncritical_regs_restore()
622 RV_WRITE_CSR(CUSTOM_CSR_GPIO_OUT_USER,frame->ugpio_out); in rv_core_noncritical_regs_restore()
625 static IRAM_ATTR void cpu_domain_dev_regs_save(cpu_domain_dev_sleep_frame_t *frame) in cpu_domain_dev_regs_save() argument
627 assert(frame); in cpu_domain_dev_regs_save()
628 cpu_domain_dev_regs_region_t *region = frame->region; in cpu_domain_dev_regs_save()
629 uint32_t *regs_frame = frame->regs_frame; in cpu_domain_dev_regs_save()
632 for (int i = 0; i < frame->region_num; i++) { in cpu_domain_dev_regs_save()
639 static IRAM_ATTR void cpu_domain_dev_regs_restore(cpu_domain_dev_sleep_frame_t *frame) in cpu_domain_dev_regs_restore() argument
641 assert(frame); in cpu_domain_dev_regs_restore()
642 cpu_domain_dev_regs_region_t *region = frame->region; in cpu_domain_dev_regs_restore()
643 uint32_t *regs_frame = frame->regs_frame; in cpu_domain_dev_regs_restore()
646 for (int i = 0; i < frame->region_num; i++) { in cpu_domain_dev_regs_restore()
686 RvCoreCriticalSleepFrame * frame = rv_core_critical_regs_save(); in do_cpu_retention() local
687 if ((frame->pmufunc & 0x3) == 0x1) { in do_cpu_retention()
691 …update_retention_frame_crc((uint32_t*)frame, RV_SLEEP_CTX_FRMSZ - 2 * sizeof(long), (uint32_t *)(& in do_cpu_retention()
698 …validate_retention_frame_crc((uint32_t*)frame, RV_SLEEP_CTX_FRMSZ - 2 * sizeof(long), (uint32_t *)… in do_cpu_retention()
715 RvCoreNonCriticalSleepFrame *frame = rv_core_noncritical_regs_save(); in esp_sleep_cpu_retention() local
719 …pdate_retention_frame_crc((uint32_t*)frame, sizeof(RvCoreNonCriticalSleepFrame) - sizeof(long), (u… in esp_sleep_cpu_retention()
725 …idate_retention_frame_crc((uint32_t*)frame, sizeof(RvCoreNonCriticalSleepFrame) - sizeof(long), (u… in esp_sleep_cpu_retention()
728 rv_core_noncritical_regs_restore(frame); in esp_sleep_cpu_retention()