Lemonzest
Mini-Member
Posts: 62
Registered: 09-06 |
code: 2956 static int __devinit snd_cmipci_create_fm(struct cmipci *cm, long fm_port)
2957{
2958 long iosynth;
2959 unsigned int val;
2960 struct snd_opl3 *opl3;
2961 int err;
2962
2963 if (!fm_port)
2964 goto disable_fm;
2965
2966 if (cm->chip_version >= 39) {
2967 /* first try FM regs in PCI port range */
2968 iosynth = cm->iobase + CM_REG_FM_PCI;
2969 err = snd_opl3_create(cm->card, iosynth, iosynth + 2,
2970 OPL3_HW_OPL3, 1, &opl3);
2971 } else {
2972 err = -EIO;
2973 }
2974 if (err < 0) {
2975 /* then try legacy ports */
2976 val = snd_cmipci_read(cm, CM_REG_LEGACY_CTRL) & ~CM_FMSEL_MASK;
2977 iosynth = fm_port;
2978 switch (iosynth) {
2979 case 0x3E8: val |= CM_FMSEL_3E8; break;
2980 case 0x3E0: val |= CM_FMSEL_3E0; break;
2981 case 0x3C8: val |= CM_FMSEL_3C8; break;
2982 case 0x388: val |= CM_FMSEL_388; break;
2983 default:
2984 goto disable_fm;
2985 }
2986 snd_cmipci_write(cm, CM_REG_LEGACY_CTRL, val);
2987 /* enable FM */
2988 snd_cmipci_set_bit(cm, CM_REG_MISC_CTRL, CM_FM_EN);
2989
2990 if (snd_opl3_create(cm->card, iosynth, iosynth + 2,
2991 OPL3_HW_OPL3, 0, &opl3) < 0) {
2992 printk(KERN_ERR "cmipci: no OPL device at %#lx, "
2993 "skipping...\n", iosynth);
2994 goto disable_fm;
2995 }
2996 }
2997 if ((err = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0) {
2998 printk(KERN_ERR "cmipci: cannot create OPL3 hwdep\n");
2999 return err;
3000 }
3001 return 0;
Thats the init code from cmicpi.c in linux (I assume its the init code)
and the YM724 code looks like this (ymfpci.c)
code: 207 if (pci_id->device >= 0x0010) { /* YMF 744/754 */
208 if (fm_port[dev] == 1) {
209 /* auto-detect */
210 fm_port[dev] = pci_resource_start(pci, 1);
211 }
212 if (fm_port[dev] > 0 &&
213 (fm_res = request_region(fm_port[dev], 4, "YMFPCI OPL3")) != NULL) {
214 legacy_ctrl |= YMFPCI_LEGACY_FMEN;
215 pci_write_config_word(pci, PCIR_DSXG_FMBASE, fm_port[dev]);
216 }
217 if (mpu_port[dev] == 1) {
218 /* auto-detect */
219 mpu_port[dev] = pci_resource_start(pci, 1) + 0x20;
220 }
221 if (mpu_port[dev] > 0 &&
222 (mpu_res = request_region(mpu_port[dev], 2, "YMFPCI MPU401")) != NULL) {
223 legacy_ctrl |= YMFPCI_LEGACY_MEN;
224 pci_write_config_word(pci, PCIR_DSXG_MPU401BASE, mpu_port[dev]);
225 }
226 } else {
227 switch (fm_port[dev]) {
228 case 0x388: legacy_ctrl2 |= 0; break;
229 case 0x398: legacy_ctrl2 |= 1; break;
230 case 0x3a0: legacy_ctrl2 |= 2; break;
231 case 0x3a8: legacy_ctrl2 |= 3; break;
232 default: fm_port[dev] = 0; break;
233 }
234 if (fm_port[dev] > 0 &&
235 (fm_res = request_region(fm_port[dev], 4, "YMFPCI OPL3")) != NULL) {
236 legacy_ctrl |= YMFPCI_LEGACY_FMEN;
237 } else {
238 legacy_ctrl2 &= ~YMFPCI_LEGACY2_FMIO;
239 fm_port[dev] = 0;
240 }
241 switch (mpu_port[dev]) {
242 case 0x330: legacy_ctrl2 |= 0 << 4; break;
243 case 0x300: legacy_ctrl2 |= 1 << 4; break;
244 case 0x332: legacy_ctrl2 |= 2 << 4; break;
245 case 0x334: legacy_ctrl2 |= 3 << 4; break;
246 default: mpu_port[dev] = 0; break;
247 }
248 if (mpu_port[dev] > 0 &&
249 (mpu_res = request_region(mpu_port[dev], 2, "YMFPCI MPU401")) != NULL) {
250 legacy_ctrl |= YMFPCI_LEGACY_MEN;
251 } else {
252 legacy_ctrl2 &= ~YMFPCI_LEGACY2_MPUIO;
253 mpu_port[dev] = 0;
254 }
255 }
looks like as with cmipci, you can have ports in pci space (fm_port=1) or legacy (fm_port=0x388)
Maybe in windows you could send the init sequence to the cards because the driver does not? as mentioned this is no problem in linux usually.
|