Пример #1
0
/* stall other cpu that this cpu is pending to access dport register end */
void IRAM_ATTR esp_dport_access_stall_other_cpu_end(void)
{
#ifndef CONFIG_FREERTOS_UNICORE
    int cpu_id = xPortGetCoreID();
    
    if (dport_core_state[0] == DPORT_CORE_STATE_IDLE
            || dport_core_state[1] == DPORT_CORE_STATE_IDLE) {
        return;
    }

    if (dport_access_ref[cpu_id] == 0) {
        assert(0);
    }

    dport_access_ref[cpu_id]--;

    if (dport_access_ref[cpu_id] == 0) {
        dport_access_end[cpu_id] = 1;

        portEXIT_CRITICAL_ISR(&g_dport_mux);
    }
        
    portEXIT_CRITICAL_NESTED(oldInterruptLevel[cpu_id]);

#ifdef DPORT_ACCESS_BENCHMARK
    ccount_end[cpu_id] = XTHAL_GET_CCOUNT();
    ccount_margin[cpu_id][ccount_margin_cnt] = ccount_end[cpu_id] - ccount_start[cpu_id];
    ccount_margin_cnt = (ccount_margin_cnt + 1)&(DPORT_ACCESS_BENCHMARK_STORE_NUM - 1);
#endif
#endif /* CONFIG_FREERTOS_UNICORE */
}
Пример #2
0
/*
 * Returns true if the current core is in ISR context; low prio ISR, med prio ISR or timer tick ISR. High prio ISRs
 * aren't detected here, but they normally cannot call C code, so that should not be an issue anyway.
 */
BaseType_t xPortInIsrContext()
{
	unsigned int irqStatus;
	BaseType_t ret;
	irqStatus=portENTER_CRITICAL_NESTED();
	ret=(port_interruptNesting[xPortGetCoreID()] != 0);
	portEXIT_CRITICAL_NESTED(irqStatus);
	return ret;
}
Пример #3
0
void vPortCPUReleaseMutex(portMUX_TYPE *mux) {
	unsigned int irqStatus = portENTER_CRITICAL_NESTED();
	vPortCPUReleaseMutexIntsDisabled(mux);
	portEXIT_CRITICAL_NESTED(irqStatus);
}
Пример #4
0
void vPortCPUReleaseMutex(portMUX_TYPE *mux, const char *fnName, int line) {
	unsigned int irqStatus = portENTER_CRITICAL_NESTED();
	vPortCPUReleaseMutexIntsDisabled(mux, fnName, line);
	portEXIT_CRITICAL_NESTED(irqStatus);
}
Пример #5
0
bool vPortCPUAcquireMutexTimeout(portMUX_TYPE *mux, int timeout_cycles) {
	unsigned int irqStatus = portENTER_CRITICAL_NESTED();
	bool result = vPortCPUAcquireMutexIntsDisabled(mux, timeout_cycles);
	portEXIT_CRITICAL_NESTED(irqStatus);
	return result;
}
Пример #6
0
void vPortCPUAcquireMutex(portMUX_TYPE *mux) {
	unsigned int irqStatus = portENTER_CRITICAL_NESTED();
	vPortCPUAcquireMutexIntsDisabled(mux, portMUX_NO_TIMEOUT);
	portEXIT_CRITICAL_NESTED(irqStatus);
}
Пример #7
0
void IRAM_ATTR phy_exit_critical(uint32_t level)
{
    portEXIT_CRITICAL_NESTED(level);
}