MCPcopy Create free account
hub / github.com/BlitterStudio/amiberry / cdtv_init

Function cdtv_init

src/cdtv.cpp:1754–1841  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1752}
1753
1754bool cdtv_init(struct autoconfig_info *aci)
1755{
1756 memset(dmacmemory, 0xff, sizeof dmacmemory);
1757 ew(0x00, 0xc0 | 0x01);
1758 ew(0x04, 0x03);
1759 ew(0x08, 0x40);
1760 ew(0x10, 0x02);
1761 ew(0x14, 0x02);
1762
1763 ew(0x18, 0x00); /* ser.no. Byte 0 */
1764 ew(0x1c, 0x00); /* ser.no. Byte 1 */
1765 ew(0x20, 0x00); /* ser.no. Byte 2 */
1766 ew(0x24, 0x00); /* ser.no. Byte 3 */
1767
1768 if (aci) {
1769 dma_mask = aci->rc->dma24bit ? 0x00ffffff : 0xffffffff;
1770 aci->label = dmac_bank.name;
1771 aci->hardwired = true;
1772 aci->addrbank = &dmac_bank;
1773 if (!aci->doinit) {
1774 memcpy(aci->autoconfig_raw, dmacmemory, sizeof dmacmemory);
1775 return true;
1776 }
1777 }
1778
1779 close_unit ();
1780 if (!thread_alive) {
1781 init_comm_pipe (&requests, 100, 1);
1782 uae_start_thread (_T("cdtv"), dev_thread, NULL, NULL);
1783 while (!thread_alive)
1784 sleep_millis (10);
1785 uae_sem_init(&sub_sem, 0, 1);
1786 uae_sem_init(&cda_sem, 0, 0);
1787 }
1788 write_comm_pipe_u32 (&requests, 0x0104, 1);
1789
1790 cdrom_command_cnt_out = -1;
1791 cmd = 0;
1792 enable = 0;
1793 xaen = 0;
1794 dten = 0;
1795
1796 /* KS autoconfig handles the rest */
1797 if (!savestate_state) {
1798 cdtv_reset_int ();
1799 configured = 0;
1800 tp_a = tp_b = tp_c = tp_ad = tp_bd = tp_cd = 0;
1801 tp_imask = tp_cr = tp_air = tp_ilatch = 0;
1802 stch = 0;
1803 sten = 0;
1804 scor = 0;
1805 sbcp = 0;
1806 cdtvscsi = 0;
1807 }
1808
1809 int cardsize = 0;
1810 if (aci && is_board_enabled(aci->prefs, ROMTYPE_CDTVSRAM, 0)) {
1811 struct romconfig *rc = get_device_romconfig(aci->prefs, ROMTYPE_CDTVSRAM, 0);

Callers 2

restore_cdtvFunction · 0.85
restore_cdtv_finishFunction · 0.85

Calls 15

init_comm_pipeFunction · 0.85
uae_start_threadFunction · 0.85
sleep_millisFunction · 0.85
uae_sem_initFunction · 0.85
write_comm_pipe_u32Function · 0.85
cdtv_reset_intFunction · 0.85
is_board_enabledFunction · 0.85
get_device_romconfigFunction · 0.85
mapped_mallocFunction · 0.85
cdtv_loadcardmemFunction · 0.85
cdtv_battram_resetFunction · 0.85
device_add_hsyncFunction · 0.85

Tested by

no test coverage detected