Changeset 7d5057e in mainline
- Timestamp:
- 2011-09-24T20:32:09Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- cf083e8
- Parents:
- 61013bd
- Location:
- uspace/drv/audio/sb16
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/audio/sb16/registers.h
r61013bd r7d5057e 50 50 ioport8_t __reserved2; /*0xb*/ 51 51 ioport8_t dsp_write; /* Both command and data, bit 7 is write status */ 52 #define DSP_WRITE_ READY (1 << 7)52 #define DSP_WRITE_BUSY (1 << 7) 53 53 ioport8_t __reserved3; /*0xd*/ 54 54 ioport8_t dsp_read_status; /* Bit 7 */ -
uspace/drv/audio/sb16/sb16.c
r61013bd r7d5057e 34 34 #include "sb16.h" 35 35 36 #define PIO_DELAY udelay(10) 36 37 37 static inline void sb16_dsp_command(sb16_drv_t *drv, dsp_command_t command) 38 39 static inline void sb16_dsp_write(sb16_drv_t *drv, uint8_t data) 38 40 { 39 41 assert(drv); 40 42 uint8_t status; 41 43 do { 44 PIO_DELAY; 42 45 status = pio_read_8(&drv->regs->dsp_write); 43 } while ((status & DSP_WRITE_ READY) == 0);44 45 pio_write_8(&drv->regs->dsp_write, command);46 } while ((status & DSP_WRITE_BUSY) != 0); 47 PIO_DELAY; 48 pio_write_8(&drv->regs->dsp_write, data); 46 49 } 47 50 /*----------------------------------------------------------------------------*/ … … 51 54 uint8_t status; 52 55 do { 56 PIO_DELAY; 53 57 status = pio_read_8(&drv->regs->dsp_read_status); 54 58 } while ((status & DSP_READ_READY) == 0); 59 60 PIO_DELAY; 55 61 return pio_read_8(&drv->regs->dsp_data_read); 56 62 } … … 79 85 /* Reset DSP, see Chapter 2 of Sound Blaster HW programming guide */ 80 86 pio_write_8(&drv->regs->dsp_reset, 1); 81 udelay(3); 87 udelay(3); /* Keep reset for 3 us */ 82 88 pio_write_8(&drv->regs->dsp_reset, 0); 89 90 /* "DSP takes about 100 microseconds to initialize itself" */ 83 91 udelay(100); 92 84 93 85 94 unsigned attempts = 100; 86 95 uint8_t status; 87 96 do { 97 PIO_DELAY; 88 98 status = pio_read_8(&drv->regs->dsp_read_status); 89 udelay(10);90 99 } while (--attempts && ((status & DSP_READ_READY) == 0)); 91 100 … … 101 110 return EIO; 102 111 } 103 ddf_log_note("Sound blaster reset!\n");104 105 112 106 113 /* Get DSP version number */ 107 sb16_dsp_command(drv, DSP_VERSION); 108 const uint8_t major = sb16_dsp_read(drv); 109 const uint8_t minor = sb16_dsp_read(drv); 110 ddf_log_note("Sound blaster DSP version: %x.%x.\n", major, minor); 114 sb16_dsp_write(drv, DSP_VERSION); 115 drv->dsp_version.major = sb16_dsp_read(drv); 116 drv->dsp_version.minor = sb16_dsp_read(drv); 117 ddf_log_note("Sound blaster DSP (%x.%x) Initialized.\n", 118 drv->dsp_version.major, drv->dsp_version.minor); 111 119 112 120 -
uspace/drv/audio/sb16/sb16.h
r61013bd r7d5057e 43 43 sb16_regs_t *regs; 44 44 mpu_regs_t *mpu_regs; 45 struct { 46 uint8_t major; 47 uint8_t minor; 48 } dsp_version; 45 49 } sb16_drv_t; 46 50
Note:
See TracChangeset
for help on using the changeset viewer.