2020
2121#define PRIV (x ) ((virtio_snd_config_t *) x->priv)
2222
23+ static int cnt = 0 ;
24+
2325enum {
2426 VSND_QUEUE_CTRL = 0 ,
2527 VSND_QUEUE_EVT = 1 ,
@@ -985,6 +987,7 @@ static bool virtio_snd_reg_write(virtio_snd_state_t *vsnd,
985987 fprintf (stderr , "TX start\n" );
986988 virtio_queue_notify_handler (vsnd , value ,
987989 virtio_snd_tx_desc_handler );
990+ sleep (1 );
988991 fprintf (stderr , "TX end\n" );
989992 break ;
990993 default :
@@ -1021,6 +1024,7 @@ void virtio_snd_read(hart_t *vm,
10211024 uint8_t width ,
10221025 uint32_t * value )
10231026{
1027+ fprintf (stderr , "=== start read lock ===\n" );
10241028 pthread_mutex_lock (& virtio_snd_mutex );
10251029 switch (width ) {
10261030 case RV_MEM_LW :
@@ -1038,6 +1042,8 @@ void virtio_snd_read(hart_t *vm,
10381042 vm_set_exception (vm , RV_EXC_ILLEGAL_INSN , 0 );
10391043 break ;
10401044 }
1045+ cnt ++ ;
1046+ fprintf (stderr , "=== end read lock count %d ===\n" , cnt );
10411047 pthread_mutex_unlock (& virtio_snd_mutex );
10421048}
10431049void virtio_snd_write (hart_t * vm ,
@@ -1046,6 +1052,7 @@ void virtio_snd_write(hart_t *vm,
10461052 uint8_t width ,
10471053 uint32_t value )
10481054{
1055+ fprintf (stderr , "=== start write lock ===\n" );
10491056 pthread_mutex_lock (& virtio_snd_mutex );
10501057 switch (width ) {
10511058 case RV_MEM_SW :
@@ -1060,6 +1067,8 @@ void virtio_snd_write(hart_t *vm,
10601067 vm_set_exception (vm , RV_EXC_ILLEGAL_INSN , 0 );
10611068 break ;
10621069 }
1070+ cnt ++ ;
1071+ fprintf (stderr , "=== end write lock count %d ===\n" , cnt );
10631072 pthread_mutex_unlock (& virtio_snd_mutex );
10641073}
10651074
0 commit comments