Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit76a1a89

Browse files
committed
!fixup Cleanup debug messages and use Error_Handler()
1 parentabef6ee commit76a1a89

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

‎cores/arduino/VirtIOSerial.cpp‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,10 @@ void VirtIOSerial::begin(void)
4444
if (initialized) {
4545
return;
4646
}
47-
OPENAMP_Init();
48-
if (VIRT_UART_Init(&huart) != VIRT_UART_OK) {
49-
// log_err("VIRT_UART_Init UART0 failed.\r\n");
47+
if (OPENAMP_Init() !=0) {
48+
Error_Handler();
49+
}
50+
if (VIRT_UART_Init(&virt_huart) != VIRT_UART_OK) {
5051
Error_Handler();
5152
}
5253
/*Need to register callback for message reception by channels*/
@@ -136,6 +137,7 @@ size_t VirtIOSerial::write(uint8_t ch)
136137
size_tVirtIOSerial::write(constuint8_t *buffer,size_t size)
137138
{
138139
if (VIRT_UART_Transmit(&huart,const_cast<uint8_t *>(buffer), size) == VIRT_UART_ERROR) {
140+
// This error usually happens when rpmsg is not ready for
139141
return0;
140142
}
141143
return size;

‎cores/arduino/stm32/virtio/mbox_ipcc.c‎

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -80,13 +80,13 @@ int MAILBOX_Init(void)
8080

8181
if (HAL_IPCC_ActivateNotification(&hipcc,IPCC_CHANNEL_1,IPCC_CHANNEL_DIR_RX,
8282
IPCC_channel1_callback)!=HAL_OK) {
83-
OPENAMP_log_err("%s: ch_1 RX fail\n",__func__);
83+
Error_Handler();
8484
return-1;
8585
}
8686

8787
if (HAL_IPCC_ActivateNotification(&hipcc,IPCC_CHANNEL_2,IPCC_CHANNEL_DIR_RX,
8888
IPCC_channel2_callback)!=HAL_OK) {
89-
OPENAMP_log_err("%s: ch_2 RX fail\n",__func__);
89+
Error_Handler();
9090
return-1;
9191
}
9292

@@ -106,27 +106,23 @@ int MAILBOX_Notify(void *priv, uint32_t id)
106106
/* Called after virtqueue processing: time to inform the remote */
107107
if (id==VRING0_ID) {
108108
channel=IPCC_CHANNEL_1;
109-
OPENAMP_log_dbg("Send msg on ch_1\r\n");
110109
}elseif (id==VRING1_ID) {
111110
/* Note: the OpenAMP framework never notifies this */
112111
channel=IPCC_CHANNEL_2;
113-
OPENAMP_log_dbg("Send 'buff free' on ch_2\r\n");
114112
return-1;
115113
}else {
116-
OPENAMP_log_err("invalid vring (%d)\r\n", (int)id);
117114
return-1;
118115
}
119116

120117
/* Check that the channel is free (otherwise wait until it is) */
121118
if (HAL_IPCC_GetChannelStatus(&hipcc,channel,IPCC_CHANNEL_DIR_TX)==IPCC_CHANNEL_STATUS_OCCUPIED) {
122-
OPENAMP_log_dbg("Waitingfor channel to be freed\r\n");
119+
// Waitfor channel to be freed
123120
while (HAL_IPCC_GetChannelStatus(&hipcc,channel,IPCC_CHANNEL_DIR_TX)==IPCC_CHANNEL_STATUS_OCCUPIED)
124121
;
125122
}
126123

127124
/* Inform A7 (either new message, or buf free) */
128125
HAL_IPCC_NotifyCPU(&hipcc,channel,IPCC_CHANNEL_DIR_TX);
129-
130126
return0;
131127
}
132128

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp