Minor cleanup

parent 944e37f2
......@@ -1452,6 +1452,9 @@ static int process_host_to_bmc_ipmi_bt_transactions(void)
}
#if (ENABLE_LPC_FW_CYCLE_DMA)
// Deactivate interrupts on entering critical section
int key = irq_lock();
// Disable DMA engine
dword = read_aquila_register(HOSTLPCSLAVE_BASE, AQUILA_LPC_REG_DMA_CONFIG1);
dword &= ~((1 & AQUILA_LPC_CTL_EN_FW_DMA_R_MASK) << AQUILA_LPC_CTL_EN_FW_DMA_R_SHIFT);
......@@ -1512,6 +1515,9 @@ static int process_host_to_bmc_ipmi_bt_transactions(void)
dword &= ~((1 & AQUILA_LPC_CTL_EN_FW_DMA_W_MASK) << AQUILA_LPC_CTL_EN_FW_DMA_W_SHIFT);
}
write_aquila_register(HOSTLPCSLAVE_BASE, AQUILA_LPC_REG_DMA_CONFIG1, dword);
// Re-activate interupts on exiting critical section
irq_unlock(key);
#endif
// Generate response
......@@ -1701,10 +1707,12 @@ static int process_interrupts_stage2(void)
int read_position;
int work_executed;
#if (WITH_ZEPHYR)
if (k_mutex_lock(&vuart1_access_mutex, K_MSEC(100)) != 0) {
printk("Unable to acquire VUART1 mutex in a timely manner! %s:%d\n", __FILE__, __LINE__);
return -EAGAIN;
}
#endif
work_executed = 0;
......@@ -2759,6 +2767,7 @@ int host_console_event_loop(const struct shell *shell)
}
if (chars_to_tx > 0)
{
chars_sent = 0;
if (shell->iface->api->write(shell->iface, vuart1_incoming_buffer + vuart1_incoming_buffer_read_pos, chars_to_tx, &chars_sent) == 0) {
if (chars_sent > 0) {
vuart1_incoming_buffer_read_pos += chars_sent;
......@@ -2783,8 +2792,10 @@ int host_console_event_loop(const struct shell *shell)
}
int attach_to_host_console(const struct shell *shell)
{
// Deactivate interrupts on entering critical section
int key = irq_lock();
if (k_mutex_lock(&vuart1_access_mutex, K_MSEC(100)) != 0) {
printk("Unable to acquire VUART1 mutex in a timely manner! %s:%d\n", __FILE__, __LINE__);
return -EAGAIN;
}
// Reset VUART1 ring buffer pointers
vuart1_outgoing_buffer_read_pos = vuart1_outgoing_buffer_write_pos;
......@@ -2793,8 +2804,7 @@ int attach_to_host_console(const struct shell *shell)
host_console_service_task_requested = 1;
host_console_service_task_shell = shell;
// Re-activate interupts on exiting critical section
irq_unlock(key);
k_mutex_unlock(&vuart1_access_mutex);
return 0;
}
......
......@@ -8,7 +8,7 @@
#endif
#if (WITH_ZEPHYR)
#define KESTREL_SERVICE_THREAD_PRIORITY K_PRIO_COOP(1)
#define KESTREL_SERVICE_THREAD_PRIORITY K_PRIO_PREEMPT(CONFIG_NUM_PREEMPT_PRIORITIES - 1)
#endif
struct firmware_buffer_region {
......@@ -44,4 +44,4 @@ int attach_to_host_console(const struct shell *shell);
int host_console_event_loop(const struct shell *shell);
#else
int attach_to_host_console();
#endif
\ No newline at end of file
#endif
......@@ -220,4 +220,4 @@ SHELL_STATIC_SUBCMD_SET_CREATE(sub_kestrel,
);
// Register main kestrel command prefix
SHELL_CMD_REGISTER(kestrel, &sub_kestrel, "Kestrel commands", NULL);
\ No newline at end of file
SHELL_CMD_REGISTER(kestrel, &sub_kestrel, "Kestrel commands", NULL);
......@@ -42,10 +42,12 @@ CONFIG_TEST_RANDOM_GENERATOR=y
CONFIG_MINIMAL_LIBC_MALLOC_ARENA_SIZE=100663296
# Logging settings
#CONFIG_LOG_MODE_MINIMAL=y
CONFIG_LOG_MODE_IMMEDIATE=y
#CONFIG_LOG_MODE_DEFERRED=y
CONFIG_LOG_RUNTIME_FILTERING=y
CONFIG_LOG_BUFFER_SIZE=1024
CONFIG_LOG_PRINTK=y
CONFIG_LOG_PRINTK=n
CONFIG_LOG_PROCESS_TRIGGER_THRESHOLD=0
# POSIX options
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment