void IRsend::Airton(char power, char mode, char temperature, char flowControl) { char *raw = (char*) malloc(14 * sizeof(char)); raw[13] = 0x15 + power + mode +temperature + flowControl; //checksum // allocate raw raw[0] = 0xC4; raw[1] = 0xD3; raw[2] = 0x64; raw[3] = 0x80; //ADDRESS raw[4] = 0x00; raw[5] = lsb_first(power); raw[6] = lsb_first(mode); raw[7] = lsb_first(temperature); raw[8] = lsb_first(flowControl); raw[9] = 0x00; raw[10] = 0x00; raw[11] = 0x00; raw[12] = 0x00; enableIROut(38); mark(AIRTON_HDR_MARK); space(AIRTON_HDR_SPACE); for(int i = 0; i < 13 ; i++) { for(int y = 0; y < 8; y++) { if(raw[i] && 0x80) { mark(AIRTON_HDR_MARK); space(AIRTON_HDR_SPACE); } else { mark(AIRTON_HDR_MARK); space(AIRTON_HDR_SPACE); } raw[i] <<= 1; } } space(0); }
void threecom3c505_device::do_command() { // default to successful completion m_response.command = m_command_buffer[0] + CMD_RESPONSE_OFFSET; m_response.length = 1; m_response.data.failed = 0; // successful completion switch (m_command_buffer[0]) { case CMD_RESET: // 0x00 // FIXME: // device_reset(); break; case CMD_CONFIGURE_ADAPTER_MEMORY: // 0x01 m_i82586_config = m_program_buffer.get_word(1); break; case CMD_RECEIVE_PACKET: // 0x08 if (m_rx_data_buffer.get_length() == 0 && !m_rx_fifo.get(&m_rx_data_buffer)) { // receive data not yet available m_rx_pending++; set_command_pending(0); } else { do_receive_command(); } return; // break; case CMD_MC_F9: m_response.command = CMD_TRANSMIT_PACKET_COMPLETE; // fall through case CMD_TRANSMIT_PACKET: // 0x09 case CMD_TRANSMIT_PACKET_18: // 0x18 m_response.length = 8; m_response.data.xmit_resp.buf_ofs = 0; m_response.data.xmit_resp.buf_seg = 0; m_response.data.xmit_resp.c_stat = 0; // successful completion m_response.data.xmit_resp.status = 0; break; case CMD_EXECUTE_PROGRAM: // 0x0e m_response.length = 0; m_microcode_running = 1; m_microcode_version = m_program_buffer.get_word(1); break; case CMD_NETWORK_STATISTICS: // 0x0a m_response.length = sizeof(struct Netstat); // response data must be LSB first! m_response.data.netstat.tot_recv = lsb_first(m_netstat.tot_recv); m_response.data.netstat.tot_xmit = lsb_first(m_netstat.tot_xmit); m_response.data.netstat.err_CRC = lsb_first(m_netstat.err_CRC); m_response.data.netstat.err_align = lsb_first(m_netstat.err_align); m_response.data.netstat.err_res = lsb_first(m_netstat.err_res); m_response.data.netstat.err_ovrrun = lsb_first(m_netstat.err_ovrrun); break; case CMD_ADAPTER_INFO: // 0x11 m_response.length = sizeof(struct Info); // FIXME: replace test data; must be LSB first! m_response.data.info.minor_vers = 1; m_response.data.info.major_vers = 2; m_response.data.info.ROM_cksum = lsb_first(3); m_response.data.info.RAM_sz = lsb_first(4); m_response.data.info.free_ofs = lsb_first(5); m_response.data.info.free_seg = lsb_first(6); break; case CMD_LOAD_MULTICAST_LIST:// 0x0b if (m_command_buffer[1] > sizeof(m_multicast_list) || (m_command_buffer[1] % ETHERNET_ADDR_SIZE) != 0) { LOG(("CMD_LOAD_MULTICAST_LIST - !!! unexpected data size %d !!!", m_command_buffer[1])); } else { memset(m_multicast_list, 0 , sizeof(m_multicast_list)); memcpy(m_multicast_list, m_command_buffer+2 , m_command_buffer[1]-2); set_filter_list(); } break; case CMD_SET_STATION_ADDRESS: // 0x10 if (m_command_buffer[1] != sizeof(m_station_address)) { LOG(("CMD_SET_STATION_ADDRESS - !!! unexpected data size %d !!!", m_command_buffer[1])); memset(m_station_address, 0 , sizeof(m_station_address)); } else { memcpy(m_station_address, m_command_buffer+2 , m_command_buffer[1]); } set_filter_list(); set_mac((char *)m_station_address); break; case CMD_CONFIGURE_82586: // 0x02 case CMD_DOWNLOAD_PROGRAM: // 0x0d case CMD_MC_17: // 0x17 default: break; } m_response_index = 0; m_response_length = m_response.length + 2; m_status |= ACRF; /* adapter command register full */ if (m_control & CMDE) { switch (m_command_buffer[0]) { case CMD_NETWORK_STATISTICS: // 0x0a case CMD_DOWNLOAD_PROGRAM: // 0xd case CMD_EXECUTE_PROGRAM: // 0x0e case CMD_ADAPTER_INFO: // 0x11 // interrupt later m_timer->adjust( attotime::from_msec(5)); break; default: // interrupt at once set_interrupt(ASSERT_LINE); break; } } }