Exemple #1
0
void ps1_write(uint16_t port, uint8_t val, void *p)
{
        switch (port)
        {
                case 0x0092:
                ps1_92 = val;    
                mem_a20_alt = val & 2;
                mem_a20_recalc();
                break;
                case 0x94:
                ps1_94 = val;
                break;
                case 0x102:
                lpt1_remove();
                if (val & 0x04)
                        serial1_init(0x3f8, 4);
                else
                        serial1_remove();
                if (val & 0x10)
                {
                        switch ((val >> 5) & 3)
                        {
                                case 0:
                                lpt1_init(0x3bc);
                                break;
                                case 1:
                                lpt1_init(0x378);
                                break;
                                case 2:
                                lpt1_init(0x278);
                                break;
                        }
                }
                ps1_102 = val;
                break;
                case 0x103:
                ps1_103 = val;
                break;
                case 0x104:
                ps1_104 = val;
                break;
                case 0x105:
                ps1_105 = val;
                break;
                case 0x190:
                ps1_190 = val;
                break;
                
                case 0x322:
                ps1_hd.ctrl = val;
                if (val & 0x80)
                        ps1_hd.status |= 0x02;
                break;
                case 0x324:
                ps1_hd.attention = val & 0xf0;
                if (ps1_hd.attention)
                        ps1_hd.status = 0x14;
                break;
        }
}
Exemple #2
0
void common_init()
{
        dma_init();
        fdc_add();
        lpt_init();
        pic_init();
        pit_init();
        serial1_init(0x3f8, 4);
        serial2_init(0x2f8, 3);
}
Exemple #3
0
void pcjr_init()
{
        fdc_add_pcjr();
        pic_init();
        pit_init();
        pit_set_out_func(0, pit_irq0_timer_pcjr);
        serial1_init(0x2f8, 3);
        keyboard_pcjr_init();
        device_add(&sn76489_device);
	nmi_mask = 0x80;
}
Exemple #4
0
void common_init()
{
        dma_init();
        fdc_add();
        lpt_init();
        pic_init();
        pit_init();
        serial1_init(0x3f8, 4);
        serial2_init(0x2f8, 3);
        device_add(&gameport_device);
}
Exemple #5
0
//---------------------------------------------------------------------------
// Attempt to open a com port.  Keep the handle in ComID.
// Set the starting baud rate to 9600.
//
// 'portnum'   - number 0 to MAX_PORTNUM-1.  This number provided will
//               be used to indicate the port number desired when calling
//               all other functions in this library.
//
// 'port_zstr' - zero terminate port name.  NOT USED.
//
//
// Returns: TRUE(1)  - success, COM port opened
//          FALSE(0) - failure, could not open specified port
//
SMALLINT OpenCOM(int portnum, char *port_zstr)
{
	port_zstr = 0; //to silence compiler

   if(portnum==0)
      serial0_init(BAUD9600_TIMER_RELOAD_VALUE);
   else
      serial1_init(BAUD9600_TIMER_RELOAD_VALUE);

   FlushCOM(portnum);

	return TRUE;
}
Exemple #6
0
void common_init()
{
        dma_init();
        fdc_add();
        lpt_init();
        pic_init();
        pit_init();
        serial1_init(0x3f8, 4);
        serial2_init(0x2f8, 3);
	memregs_init();
        device_add(&gameport_device);
	machine_class = MC_PCAT;
	has_pc87306 = 0;
	/* It then gets set for the models that do need it. */
	fdc_clear_dskchg_activelow();
	fdc_polarity_reset();
}
Exemple #7
0
void pcjr_init()
{
	PCI = 0;
	maxide = 2;
	AT = 0;
	is386 = 0;
        fdc_add_pcjr();
        pic_init();
        pit_init();
        pit_set_out_func(0, pit_irq0_timer_pcjr);
        serial1_init(0x2f8, 3);
        keyboard_pcjr_init();
	memregs_init();
        device_add(&sn76489_device);
	nmi_mask = 0x80;
	machine_class = MC_PCJR;
	fdc_polarity_reset();
}
Exemple #8
0
//---------------------------------------------------------------------------
// Attempt to open a com port.  Keep the handle in ComID.
// Set the starting baud rate to 9600.
//
// 'port_zstr' - zero terminate port name.
//
// Returns: valid handle, or -1 if an error occurred
//
SMALLINT OpenCOM(int portnum, char *port_zstr)
{
   int actualPortnum;

   if(port_zstr)
   {
      if (strcmp(port_zstr,DS400_SERIAL0_STRING) == 0)
        actualPortnum = DS400_SERIAL0;
      else if (strcmp(port_zstr,DS400_SERIAL1_STRING) == 0)
        actualPortnum = DS400_SERIAL1;
      else if (strcmp(port_zstr,DS400_SERIAL2_STRING) == 0)
        actualPortnum = DS400_SERIAL2;
      else
        return FALSE;
   }
   else
      actualPortnum = portnum;

   // attempt to open the communications port
   port_handle[portnum] = actualPortnum;

   switch (actualPortnum)
   {
     case DS400_SERIAL0:
       serial0_init(BAUD9600_TIMER_RELOAD_VALUE);
       break;
     case DS400_SERIAL1:
       serial1_init(BAUD9600_TIMER_RELOAD_VALUE);
       break;
     case DS400_SERIAL2:
       serial2_init(BAUD9600_TIMER_RELOAD_VALUE);
       break;
   }

   FlushCOM(portnum);

   return TRUE;

}
int main (void){
	//Do setup here

	serial1_init(9600, 8, 0, 1);

	psx_init(&PORTB, PINB1, //Data (Brown)
		&PORTB, PINB0, //Clock (Blue)
		&PORTB, PINB2, //Command (Orange)
		&PORTB, PINB3); //Attention (Yellow)

	//Main program loop
	while (1){
		_delay_ms(10);

		psx_read_gamepad();
		
		/*
		serial1_write_s("0x");
		serial1_write_s(itoa(psx_stick(0), temp, 16));
		serial1_write_s(", 0x");
		serial1_write_s(itoa(psx_stick(1), temp, 16));
		serial1_write_s(", 0x");
		serial1_write_s(itoa(psx_stick(2), temp, 16));
		serial1_write_s(", 0x");
		serial1_write_s(itoa(psx_stick(3), temp, 16));
		serial1_write_s(", 0x");
		serial1_write_s(itoa(psx_stick(4), temp, 16));
		serial1_write_s(", 0x");
		serial1_write_s(itoa(psx_stick(5), temp, 16));
		serial1_write_s(", 0x");
		serial1_write_s(itoa(psx_stick(6), temp, 16));
		serial1_write_s(", 0x");
		serial1_write_s(itoa(psx_stick(7), temp, 16));
		serial1_write_s(", 0x");
		serial1_write_s(itoa(psx_stick(8), temp, 16));
		serial1_write_s(", 0x");
		serial1_write_s(itoa(psx_stick(9), temp, 16));
		serial1_write_s(", 0x");
		serial1_write_s(itoa(psx_stick(10), temp, 16));
		serial1_write_s(", 0x");
		serial1_write_s(itoa(psx_stick(11), temp, 16));
		serial1_write_s("\n\r");
		*/
		
		if (psx_button(PSB_SELECT)) serial1_write_s("Select\n\r");
		if (psx_button(PSB_L1)) serial1_write_s("Left 1\n\r");
		if (psx_button(PSB_L2)) serial1_write_s("Left 2\n\r");
		if (psx_button(PSB_L3)) serial1_write_s("Left 3\n\r");
		if (psx_button(PSB_R1)) serial1_write_s("Right 1\n\r");
		if (psx_button(PSB_R2)) serial1_write_s("Right 2\n\r");
		if (psx_button(PSB_R3)) serial1_write_s("Right 3\n\r");
		if (psx_button(PSB_START)) serial1_write_s("Start\n\r");
		if (psx_button(PSB_PAD_UP)) serial1_write_s("Pad Up\n\r");
		if (psx_button(PSB_PAD_LEFT)) serial1_write_s("Pad Left\n\r");
		if (psx_button(PSB_PAD_DOWN)) serial1_write_s("Pad Down\n\r");
		if (psx_button(PSB_PAD_RIGHT)) serial1_write_s("Pad Right\n\r");
		if (psx_button(PSB_TRIANGLE)) serial1_write_s("Triangle\n\r");
		if (psx_button(PSB_CIRCLE)) serial1_write_s("Circle\n\r");
		if (psx_button(PSB_CROSS)) serial1_write_s("Cross\n\r");
		if (psx_button(PSB_SQUARE)) serial1_write_s("Square\n\r");

		if (psx_stick(PSS_LX) != last_LX){
			last_LX = psx_stick(PSS_LX);
			serial1_write_s("LX: ");
			serial1_write_s(itoa(last_LX, temp, 16));
			serial1_write_s("\n\r");
		}
		if (psx_stick(PSS_LY) != last_LY){
			last_LY = psx_stick(PSS_LY);
			serial1_write_s("LY: ");
			serial1_write_s(itoa(last_LY, temp, 16));
			serial1_write_s("\n\r");
		}
		if (psx_stick(PSS_RX) != last_RX){
			last_RX = psx_stick(PSS_RX);
			serial1_write_s("RX: ");
			serial1_write_s(itoa(last_RX, temp, 16));
			serial1_write_s("\n\r");
		}
		if (psx_stick(PSS_RY) != last_RY){
			last_RY = psx_stick(PSS_RY);
			serial1_write_s("RY: ");
			serial1_write_s(itoa(last_RY, temp, 16));
			serial1_write_s("\n\r");
		}
	}
}
Exemple #10
0
void sis85c471_write(uint16_t port, uint8_t val, void *priv)
{
	uint8_t index = (port & 1) ? 0 : 1;
        int temp;
	uint8_t x;
#ifndef RELEASE_BUILD
        pclog("sis85c471_write : port=%04x reg %02X = %02X\n", port, sis85c471_curreg, val);
#endif

	if (index)
	{
		if ((val >= 0x50) && (val <= 0x76))  sis85c471_curreg = val;
		return;
	}
	else
	{
		if ((sis85c471_curreg < 0x50) || (sis85c471_curreg > 0x76))  return;
		x = val ^ sis85c471_regs[sis85c471_curreg - 0x50];
		/* Writes to 0x52 are blocked as otherwise, large hard disks don't read correctly. */
		if (sis85c471_curreg != 0x52)  sis85c471_regs[sis85c471_curreg - 0x50] = val;
		goto process_value;
	}
	return;

process_value:
	switch(sis85c471_curreg)
	{
		case 0x73:
#if 0
			if (x & 0x40)
			{
				if (val & 0x40)
					ide_pri_enable();
				else
					ide_pri_disable();
			}
#endif

			if (x & 0x20)
			{
				if (val & 0x20)
				{
					serial1_init(0x3f8, 4);
					serial2_init(0x2f8, 3);
					mouse_serial_init();
				}
				else
				{
					serial1_remove();
					serial2_remove();
				}
			}

			if (x & 0x10)
			{
				if (val & 0x10)
					lpt1_init(0x378);
				else
					lpt1_remove();
			}

			break;
	}
	sis85c471_curreg = 0;
}
Exemple #11
0
//----------------------------------------------------------------------
//  Main for tstfind
//
void main(void)
{
   uchar rslt;
   int cnt;

   //use port for 1-wire
   uchar portnum = ONEWIRE_P;

   //initialize I/O port
#if STDOUT_P==0
   serial0_init(BAUD9600_TIMER_RELOAD_VALUE);
#else
   serial1_init(BAUD9600_TIMER_RELOAD_VALUE);
#endif

   printf("Beginning tstfindm\r\n");

   // attempt to acquire the 1-Wire Net
   if (!owAcquire(portnum,NULL))
   {
      printf("owAcquire failed\r\n");
      while(owHasErrors())
         printf("  - Error %d\r\n", owGetErrorNum());
      return;
   }

   //----------------------------------------
   // Introduction
   printf("\r\n/----------------\r\n");
   printf("  All iButtons.\r\n\r\n");

   do
   {
      printf("-- Start\r\n");
      cnt = 0;

      // find the first device (all devices not just alarming)
      rslt = owFirst(portnum, TRUE, FALSE);
      while (rslt)
      {
         // print the device number
         cnt++;
         printf("(%d) ",cnt);

         // get and print the Serial Number of the device just found
         DisplaySerialNum(portnum);

         // find the next device
         rslt = owNext(portnum, TRUE, FALSE);
      }
      printf("-- End\r\n\r\nPress any key to continue searching\r\n");

      rslt = getchar();
      //printf("key pressed: %c\r\n",rslt);
   }
   while (rslt!='q');

   // release the 1-Wire Net
   owRelease(portnum);

   return;
}
void serial1_init_b(uint32_t baud){
	serial1_init(baud, 8, 0, 1);
}