Minor cleanup

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