mirror of
https://github.com/dingusdev/dingusppc.git
synced 2025-01-11 05:29:43 +00:00
Added further CUDA commands
This commit is contained in:
parent
a01cd9c993
commit
84ded9fc7a
@ -351,6 +351,13 @@ void ViaCuda::pseudo_command(int cmd, int data_count) {
|
||||
}
|
||||
this->is_open_ended = true;
|
||||
break;
|
||||
case CUDA_GET_REAL_TIME:
|
||||
response_header(CUDA_PKT_PSEUDO, 0);
|
||||
this->out_buf[2] = (uint8_t)((this->real_time >> 24) & 0xFF);
|
||||
this->out_buf[3] = (uint8_t)((this->real_time >> 16) & 0xFF);
|
||||
this->out_buf[4] = (uint8_t)((this->real_time >> 8) & 0xFF);
|
||||
this->out_buf[5] = (uint8_t)((this->real_time) & 0xFF);
|
||||
break;
|
||||
case CUDA_WRITE_MCU_MEM:
|
||||
addr = READ_WORD_BE_A(&this->in_buf[2]);
|
||||
// if addr is inside PRAM, update PRAM with data from in_buf
|
||||
@ -375,6 +382,13 @@ void ViaCuda::pseudo_command(int cmd, int data_count) {
|
||||
error_response(CUDA_ERR_BAD_PAR);
|
||||
}
|
||||
break;
|
||||
case CUDA_SET_REAL_TIME:
|
||||
response_header(CUDA_PKT_PSEUDO, 0);
|
||||
this->real_time = ((uint32_t)in_buf[2]) >> 24;
|
||||
this->real_time += ((uint32_t)in_buf[3]) >> 16;
|
||||
this->real_time += ((uint32_t)in_buf[4]) >> 8;
|
||||
this->real_time += ((uint32_t)in_buf[5]);
|
||||
break;
|
||||
case CUDA_WRITE_PRAM:
|
||||
addr = READ_WORD_BE_A(&this->in_buf[2]);
|
||||
if (addr <= 0xFF) {
|
||||
@ -387,6 +401,16 @@ void ViaCuda::pseudo_command(int cmd, int data_count) {
|
||||
error_response(CUDA_ERR_BAD_PAR);
|
||||
}
|
||||
break;
|
||||
case CUDA_FILE_SERVER_FLAG:
|
||||
response_header(CUDA_PKT_PSEUDO, 0);
|
||||
if (this->in_buf[2]) {
|
||||
LOG_F(INFO, "Cuda: File server flag on");
|
||||
this->file_server = true;
|
||||
} else {
|
||||
LOG_F(INFO, "Cuda: File server flag off");
|
||||
this->file_server = false;
|
||||
}
|
||||
break;
|
||||
case CUDA_SET_AUTOPOLL_RATE:
|
||||
this->poll_rate = this->in_buf[2];
|
||||
LOG_F(INFO, "Cuda: autopoll rate set to %d ms", this->poll_rate);
|
||||
@ -397,6 +421,20 @@ void ViaCuda::pseudo_command(int cmd, int data_count) {
|
||||
this->out_buf[3] = this->poll_rate;
|
||||
this->out_count++;
|
||||
break;
|
||||
case CUDA_SET_DEVICE_LIST:
|
||||
response_header(CUDA_PKT_PSEUDO, 0);
|
||||
this->device_mask = ((uint16_t)in_buf[2]) >> 8;
|
||||
this->device_mask += ((uint16_t)in_buf[3]);
|
||||
break;
|
||||
case CUDA_GET_DEVICE_LIST:
|
||||
response_header(CUDA_PKT_PSEUDO, 0);
|
||||
this->out_buf[2] = (uint8_t)((this->device_mask >> 8) & 0xFF);
|
||||
this->out_buf[3] = (uint8_t)((this->device_mask) & 0xFF);
|
||||
break;
|
||||
case CUDA_ONE_SECOND_MODE:
|
||||
LOG_F(INFO, "Cuda: One Second Interrupt - Byte Sent: %d", this->in_buf[2]);
|
||||
response_header(CUDA_PKT_PSEUDO, 0);
|
||||
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);
|
||||
@ -412,6 +450,14 @@ void ViaCuda::pseudo_command(int cmd, int data_count) {
|
||||
LOG_F(INFO, "Cuda: send %d to PB0", (int)(this->in_buf[2]));
|
||||
response_header(CUDA_PKT_PSEUDO, 0);
|
||||
break;
|
||||
case CUDA_WARM_START:
|
||||
case CUDA_POWER_DOWN:
|
||||
case CUDA_MONO_STABLE_RESET:
|
||||
case CUDA_RESTART_SYSTEM:
|
||||
/* really kludge temp code */
|
||||
LOG_F(INFO, "Cuda: Restart/Shutdown signal sent with command 0x%x! \n", cmd);
|
||||
//exit(0);
|
||||
break;
|
||||
default:
|
||||
LOG_F(ERROR, "Cuda: unsupported pseudo command 0x%X", cmd);
|
||||
error_response(CUDA_ERR_BAD_CMD);
|
||||
|
@ -90,13 +90,23 @@ enum {
|
||||
|
||||
/** Cuda pseudo commands. */
|
||||
enum {
|
||||
CUDA_WARM_START = 0x00, /* warm start */
|
||||
CUDA_START_STOP_AUTOPOLL = 0x01, /* start/stop device auto-polling */
|
||||
CUDA_READ_MCU_MEM = 0x02, /* read internal Cuda memory */
|
||||
CUDA_GET_REAL_TIME = 0x03, /* get real time */
|
||||
CUDA_READ_PRAM = 0x07, /* read parameter RAM */
|
||||
CUDA_WRITE_MCU_MEM = 0x08, /* write internal Cuda memory */
|
||||
CUDA_SET_REAL_TIME = 0x09, /* set real time */
|
||||
CUDA_POWER_DOWN = 0x0A, /* power down system */
|
||||
CUDA_WRITE_PRAM = 0x0C, /* write parameter RAM */
|
||||
CUDA_MONO_STABLE_RESET = 0x0D, /* mono stable reset */
|
||||
CUDA_RESTART_SYSTEM = 0x11, /* restart system */
|
||||
CUDA_FILE_SERVER_FLAG = 0x13, /* set file server flag */
|
||||
CUDA_SET_AUTOPOLL_RATE = 0x14, /* set auto-polling rate */
|
||||
CUDA_GET_AUTOPOLL_RATE = 0x16, /* get auto-polling rate */
|
||||
CUDA_SET_DEVICE_LIST = 0x19, /* set device list */
|
||||
CUDA_GET_DEVICE_LIST = 0x1A, /* get device list */
|
||||
CUDA_ONE_SECOND_MODE = 0x1B, /* one second interrupt mode */
|
||||
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 */
|
||||
@ -145,6 +155,9 @@ private:
|
||||
int32_t out_count;
|
||||
int32_t out_pos;
|
||||
uint8_t poll_rate;
|
||||
int32_t real_time = 0;
|
||||
bool file_server;
|
||||
uint16_t device_mask = 0;
|
||||
|
||||
bool is_open_ended; // true if current transaction is open-ended
|
||||
uint8_t curr_i2c_addr; // current I2C address
|
||||
|
Loading…
x
Reference in New Issue
Block a user