Started work for ADB polling

This commit is contained in:
dingusdev 2020-04-17 17:23:50 -07:00
parent 3461f2e353
commit 8fb2e851d7
2 changed files with 29 additions and 5 deletions

View File

@ -317,6 +317,18 @@ void ViaCuda::process_adb_command(uint8_t cmd_byte, int data_count)
void ViaCuda::pseudo_command(int cmd, int data_count)
{
switch (cmd) {
case CUDA_START_STOP_AUTO_POLL:
response_header(CUDA_PKT_PSEUDO, 0);
if (this->pram_obj->read_byte(this->in_buf[2])) {
if (this->via_regs[VIA_B] & 0x8) {
LOG_F(INFO, "Auto-polling started \n");
this->via_regs[VIA_ACR] |= 0x10;
this->via_regs[VIA_SR] |= CUDA_PKT_PSEUDO;
this->via_regs[VIA_B] &= ~0x20;
}
}
break;
case CUDA_READ_PRAM:
response_header(CUDA_PKT_PSEUDO, 0);
this->pram_obj->read_byte(this->in_buf[2]);
@ -325,6 +337,15 @@ void ViaCuda::pseudo_command(int cmd, int data_count)
response_header(CUDA_PKT_PSEUDO, 0);
this->pram_obj->write_byte(this->in_buf[2], this->in_buf[3]);
break;
case CUDA_SET_AUTO_RATE:
response_header(CUDA_PKT_PSEUDO, 0);
this->pram_obj->write_byte(this->in_buf[2], this->in_buf[3]);
LOG_F(INFO, "Auto Rate set to: %d \n", this->in_buf[3]);
break;
case CUDA_GET_AUTO_RATE:
response_header(CUDA_PKT_PSEUDO, 0);
this->pram_obj->read_byte(this->in_buf[2]);
break;
case CUDA_READ_WRITE_I2C:
response_header(CUDA_PKT_PSEUDO, 0);
i2c_simple_transaction(this->in_buf[2], &this->in_buf[3], this->in_count - 3);

View File

@ -87,11 +87,14 @@ enum {
/** Cuda pseudo commands. */
enum {
CUDA_READ_PRAM = 0x07, /* read parameter RAM*/
CUDA_WRITE_PRAM = 0x0C, /* write parameter RAM*/
CUDA_READ_WRITE_I2C = 0x22, /* read/write I2C device */
CUDA_COMB_FMT_I2C = 0x25, /* combined format I2C transaction */
CUDA_OUT_PB0 = 0x26, /* output one bit to Cuda's PB0 line */
CUDA_START_STOP_AUTO_POLL = 0x01, /* start/stop device auto-polling */
CUDA_READ_PRAM = 0x07, /* read parameter RAM */
CUDA_WRITE_PRAM = 0x0C, /* write parameter RAM */
CUDA_SET_AUTO_RATE = 0x14, /* set auto-polling rate */
CUDA_GET_AUTO_RATE = 0x16, /* get auto-polling rate */
CUDA_READ_WRITE_I2C = 0x22, /* read/write I2C device */
CUDA_COMB_FMT_I2C = 0x25, /* combined format I2C transaction */
CUDA_OUT_PB0 = 0x26, /* output one bit to Cuda's PB0 line */
};
/** Cuda error codes. */