MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / rt_vbus_init

Function rt_vbus_init

components/vbus/vbus.c:1127–1210  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1125}
1126
1127int rt_vbus_init(void *outr, void *inr)
1128{
1129 int i;
1130
1131 if (outr > inr)
1132 {
1133 RT_ASSERT((char*)outr - (char*)inr >= sizeof(struct rt_vbus_ring));
1134 }
1135 else
1136 {
1137 RT_ASSERT((char*)inr - (char*)outr >= sizeof(struct rt_vbus_ring));
1138 }
1139
1140 RT_VBUS_OUT_RING = outr;
1141 RT_VBUS_IN_RING = inr;
1142
1143 rt_memset(RT_VBUS_OUT_RING, 0, sizeof(*RT_VBUS_OUT_RING));
1144 rt_memset(RT_VBUS_IN_RING, 0, sizeof(*RT_VBUS_IN_RING));
1145 _chn_status[0] = RT_VBUS_CHN_ST_ESTABLISHED;
1146 for (i = 1; i < ARRAY_SIZE(_chn_status); i++)
1147 {
1148 _chn_status[i] = RT_VBUS_CHN_ST_AVAILABLE;
1149 }
1150 for (i = 0; i < ARRAY_SIZE(_sess); i++)
1151 {
1152 _sess[i].req = RT_NULL;
1153 _sess[i].st = SESSIOM_AVAILABLE;
1154 }
1155 _vbus_rx_indi[RT_VBUS_EVENT_ID_TX][0].indicate = _chn0_tx_listener;
1156 _vbus_rx_indi[RT_VBUS_EVENT_ID_TX][0].ctx = RT_NULL;
1157
1158#ifdef RT_VBUS_USING_FLOW_CONTROL
1159 for (i = 0; i < ARRAY_SIZE(_chn_wm_que); i++)
1160 {
1161 rt_wm_que_init(&_chn_wm_que[i],
1162 RT_VMM_RB_BLK_NR / 3,
1163 RT_VMM_RB_BLK_NR * 2 / 3);
1164 }
1165 /* Channel 0 has the full channel. */
1166 rt_wm_que_set_mark(&_chn_wm_que[0], 0, ~0);
1167
1168 for (i = 0; i < ARRAY_SIZE(_chn_suspended_threads); i++)
1169 {
1170 rt_list_init(&_chn_suspended_threads[i]);
1171 }
1172
1173 for (i = 1; i < ARRAY_SIZE(_chn_recv_wm); i++)
1174 {
1175 rt_vbus_set_recv_wm(i,
1176 RT_VMM_RB_BLK_NR / 3,
1177 RT_VMM_RB_BLK_NR * 2 / 3);
1178 _chn_recv_wm[i].level = 0;
1179 _chn_recv_wm[i].last_warn = 0;
1180 }
1181 /* Channel 0 has the full channel. Don't suspend it. */
1182 _chn_recv_wm[0].low_mark = 0;
1183 _chn_recv_wm[0].high_mark = ~0;
1184 _chn_recv_wm[0].level = 0;

Callers 2

rt_vbus_do_initFunction · 0.85
rt_vbus_do_initFunction · 0.85

Calls 10

rt_memsetFunction · 0.85
rt_wm_que_initFunction · 0.85
rt_wm_que_set_markFunction · 0.85
rt_list_initFunction · 0.85
rt_vbus_set_recv_wmFunction · 0.85
rt_thread_initFunction · 0.85
rt_thread_startupFunction · 0.85
rt_kprintfFunction · 0.85
rt_vbus_chnx_initFunction · 0.85
rt_vbus_hw_initFunction · 0.50

Tested by

no test coverage detected