Previous 15994 Revisions Next

r7005 Monday 11th January, 2010 at 18:52:58 UTC by Wilbert Pol
uPD1771: ACK signal is triggered when the chip expects more bytes for a command. Set command 00 to 1 bytes, command 01 to 10 bytes, command 02 to 4 bytes.
[src/mess/audio]upd1771.c

src/mess/audio/upd1771.c
r7004r7005
4545      logerror( "upd1771_w: received byte 0x%02x\n", data );
4646
4747   state->packet[ state->index ] = data;
48   state->index = ( state->index + 1 ) % MAX_PACKET_SIZE;
48   state->index = state->index + 1;
4949
5050   devcb_call_write_line( &state->ack_out_func, 0 );
5151
52   /* Trigger ACK after 512??? cycles */
53   timer_adjust_oneshot( state->timer, ticks_to_attotime( 512, device->clock ), 0 );
52   /* Start of a new command */
53   if ( state->expected_bytes == 0 )
54   {
55      switch ( data )
56      {
57      case 0x00:      /* 00 - 1 byte command */
58         state->expected_bytes = 1;
59         break;
60      case 0x01:      /* 01 - 10 byte command */
61         state->expected_bytes = 10;
62      case 0x02:      /* 02 - 4 byte command */
63         state->expected_bytes = 4;
64         break;
65      default:
66         if (LOG)
67            logerror("upd1771: unknown command %02x received\n", data );
68         state->expected_bytes = 99;
69         break;
70      }
71   }
72
73   if ( state->index == state->expected_bytes )
74   {
75      /* The command packet has been transferred, handle the command */
76      if (LOG)
77         logerror("upd1771_w: handle command %02x\n", state->packet[0] );
78      state->expected_bytes = 0;
79   }
80   else
81   {
82      /* We need more data to complete the command packet */
83      /* Trigger ACK after 512??? cycles */
84      timer_adjust_oneshot( state->timer, ticks_to_attotime( 512, device->clock ), 0 );
85   }
86
87   state->index = state->index % MAX_PACKET_SIZE;
5488}
5589
5690

Previous 15994 Revisions Next


© 1998-2018 The MESS Team