2424uint8_t xxx_buf [MSG_BUF_SIZE ];
2525size_t xxx_buf_len = 0 ;
2626
27- bool serve (int listen_sock , struct chan * chan );
28- void handle_client (int sock , struct chan * chan );
29- void handle_message (int sock , struct chan * chan , uint8_t * msg , size_t msg_len );
30- void test_and_send_status (int sock , struct chan * chan , uint8_t addr );
31- void purge_status (struct chan * chan , uint8_t addr );
27+ bool serve (int listen_sock , struct chan_out * chan );
28+ void handle_client (int sock , struct chan_out * chan );
29+ void handle_message (int sock , struct chan_out * chan , uint8_t * msg , size_t msg_len );
30+ void test_and_send_status (int sock , struct chan_out * chan , uint8_t addr );
31+ void purge_status (struct chan_out * chan , uint8_t addr );
3232
3333int main (int argc , char * * argv )
3434{
@@ -74,9 +74,9 @@ int main(int argc, char **argv)
7474 printf ("WARN: External interface not enabled, acting as loopback\n" );
7575 }
7676
77- struct chan chan ;
77+ struct chan_out chan ;
7878
79- if (chan_open (& chan , 0x40000000 , mem_fd , "udmabuf0" , frontend_enable ) < 0 ) {
79+ if (chan_out_open (& chan , 0x40000000 , mem_fd , "udmabuf0" , frontend_enable ) < 0 ) {
8080 perror ("chan_open" );
8181 return EXIT_FAILURE ;
8282 }
@@ -95,15 +95,15 @@ int main(int argc, char **argv)
9595 }
9696
9797 mock_cu_close (& mock_cu );
98- chan_close (& chan , true);
98+ chan_out_close (& chan , true);
9999
100100 close (listen_sock );
101101 close (mem_fd );
102102
103103 return EXIT_SUCCESS ;
104104}
105105
106- bool serve (int listen_sock , struct chan * chan )
106+ bool serve (int listen_sock , struct chan_out * chan )
107107{
108108 int epfd ;
109109
@@ -183,7 +183,7 @@ purge_status(chan, ADDR);
183183
184184 // Check for request in.
185185 if (client_sock != -1 ) {
186- if (chan_request_in (chan )) {
186+ if (chan_out_request_in (chan )) {
187187 printf ("REQUEST IN...\n" );
188188
189189 test_and_send_status (client_sock , chan , ADDR /* TODO */ );
@@ -194,7 +194,7 @@ purge_status(chan, ADDR);
194194 return true;
195195}
196196
197- void handle_client (int sock , struct chan * chan )
197+ void handle_client (int sock , struct chan_out * chan )
198198{
199199 // First, read as much as we can into the buffer.
200200 uint8_t * buf_p = xxx_buf + xxx_buf_len ;
@@ -251,7 +251,7 @@ void handle_client(int sock, struct chan *chan)
251251 }
252252}
253253
254- void handle_message (int sock , struct chan * chan , uint8_t * msg , size_t msg_len )
254+ void handle_message (int sock , struct chan_out * chan , uint8_t * msg , size_t msg_len )
255255{
256256 uint8_t buf [MSG_BUF_SIZE ];
257257
@@ -296,9 +296,9 @@ void handle_message(int sock, struct chan *chan, uint8_t *msg, size_t msg_len)
296296
297297 printf ("\taddr = %.2x, cmd = %.2x, flags = %.2x, count = %zu\n" , addr , cmd , flags , count );
298298
299- ssize_t result = chan_exec (chan , ADDR /* TODO */ , cmd , data , count );
299+ ssize_t result = chan_out_exec (chan , ADDR /* TODO */ , cmd , data , count );
300300
301- uint8_t device_status = chan_device_status (chan );
301+ uint8_t device_status = chan_out_device_status (chan );
302302
303303 /*
304304 ssize_t result;
@@ -339,18 +339,18 @@ void handle_message(int sock, struct chan *chan, uint8_t *msg, size_t msg_len)
339339 // wait for it via request in...
340340 printf ("\tgot CE without DE, waiting for DE via request in...\n" );
341341
342- while (!chan_request_in (chan )) {
342+ while (!chan_out_request_in (chan )) {
343343 usleep (100000 ); // 100ms
344344 }
345345
346- int test_result = chan_test (chan , ADDR /* TODO */ );
346+ int test_result = chan_out_test (chan , ADDR /* TODO */ );
347347
348348 if (test_result < 0 ) {
349349 printf ("\ttest result = %d\n" , test_result );
350350 return ;
351351 }
352352
353- device_status |= chan_device_status (chan );
353+ device_status |= chan_out_device_status (chan );
354354
355355 printf ("\tupdated status = %.2x\n" , device_status );
356356
@@ -388,18 +388,18 @@ void handle_message(int sock, struct chan *chan, uint8_t *msg, size_t msg_len)
388388 }
389389}
390390
391- void test_and_send_status (int sock , struct chan * chan , uint8_t addr )
391+ void test_and_send_status (int sock , struct chan_out * chan , uint8_t addr )
392392{
393393 uint8_t buf [MSG_BUF_SIZE ];
394394
395- int result = chan_test (chan , addr );
395+ int result = chan_out_test (chan , addr );
396396
397397 if (result < 0 ) {
398398 printf ("\tresult = %d\n" , result );
399399 return ;
400400 }
401401
402- uint8_t device_status = chan_device_status (chan );
402+ uint8_t device_status = chan_out_device_status (chan );
403403
404404 printf ("\tstatus = %.2x\n" , device_status );
405405
@@ -414,20 +414,20 @@ void test_and_send_status(int sock, struct chan *chan, uint8_t addr)
414414 }
415415}
416416
417- void purge_status (struct chan * chan , uint8_t addr )
417+ void purge_status (struct chan_out * chan , uint8_t addr )
418418{
419419 // Very hacky... this is no way to do error recovery!
420420 while (true) {
421421 printf ("TEST...\n" );
422422
423- int result = chan_test (chan , addr );
423+ int result = chan_out_test (chan , addr );
424424
425425 if (result < 0 ) {
426426 printf ("\tresult = %d\n" , result );
427427 return ;
428428 }
429429
430- uint8_t status = chan_device_status (chan );
430+ uint8_t status = chan_out_device_status (chan );
431431
432432 printf ("\tstatus = 0x%.2x\n" , status );
433433
0 commit comments