home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / altsrcs / 3 / 3455 / sb.h < prev    next >
Encoding:
C/C++ Source or Header  |  1991-06-07  |  2.5 KB  |  97 lines

  1. /*
  2.  * Copyrighted as an unpublished work.
  3.  * (c) Copyright 1991 Brian Smith
  4.  * All rights reserved.
  5.  *
  6.  * Read the LICENSE file for details on distribution and use.
  7.  *
  8.  */
  9.  
  10. #ifndef NBPP
  11. #include <sys/immu.h>
  12. #endif
  13.  
  14. #if !defined(TRUE) || !defined(FALSE)
  15. #define FALSE 0
  16. #define TRUE  1
  17. #endif
  18.  
  19. /* minor numbers */
  20. #define SB_CMS_NUM  0
  21. #define SB_FM_NUM   1
  22. #define SB_DSP_NUM  2
  23.  
  24. /* These are hard wired for speed */
  25. #define SB_DMA_CHAN 1
  26. #define SB_IO_PORT 0x220
  27.  
  28. /* C/MS (not supported) */
  29. #define CMS_DATA1   (SB_IO_PORT + 0x00)
  30. #define CMS_REG1    (SB_IO_PORT + 0x01)
  31. #define CMS_DATA2   (SB_IO_PORT + 0x02)
  32. #define CMS_REG2    (SB_IO_PORT + 0x03)
  33.  
  34. /* FM Chips */
  35. #define FM_SELECT   (SB_IO_PORT + 0x08)
  36. #define FM_REG      (SB_IO_PORT + 0x09)
  37. #define MAX_FM_NOTES 9
  38.  
  39. /* DSP (DAC and ADC) Chip(s) */
  40. #define DSP_RESET   (SB_IO_PORT + 0x06)
  41. #define DSP_RDDATA  (SB_IO_PORT + 0x0A)
  42. #define DSP_WRDATA  (SB_IO_PORT + 0x0C)
  43. #define DSP_COMMAND (SB_IO_PORT + 0x0C)
  44. #define DSP_STATUS  (SB_IO_PORT + 0x0C)
  45. #define DSP_RDAVAIL (SB_IO_PORT + 0x0E)
  46.  
  47. /* status bytes (can be OR'ed) */
  48. #define NOT_OPEN    0
  49. #define OPEN_READ   1
  50. #define OPEN_WRITE  2
  51.  
  52. /* compression types */
  53. #define ADCPM_8     0
  54. #define ADCPM_4     1
  55. #define ADCPM_2_6   2
  56. #define ADCPM_2     3
  57.  
  58. /* ioctl numbers for DSP */
  59. #define DSP_IOCTL_RESET 00
  60. #define DSP_IOCTL_SPEED 01
  61. #define DSP_IOCTL_VOICE 02
  62.  
  63. /* ioctl numbers for FM */
  64. #define FM_IOCTL_RESET      00
  65. #define FM_IOCTL_NOTE_ON    01
  66. #define FM_IOCTL_NOTE_OFF   02
  67. #define FM_IOCTL_SET_VOICE  03
  68. #define FM_IOCTL_SET_OPCELL 04
  69. #define FM_IOCTL_SET_RHYTHM 05
  70.  
  71. /* struct for setting a note/voice/key on */
  72. typedef int sb_fm_note;
  73. #define note_num(X) (((unsigned char *)&X)[0])
  74. #define fnum_low(X) (((unsigned char *)&X)[1])
  75. #define keyon_blk_fnum(X) (((unsigned char *)&X)[2])
  76.  
  77. typedef struct {
  78.     unsigned char   voice_num;
  79.     unsigned char   data[16];
  80. } sb_fm_character;
  81.  
  82. #ifdef INKERNEL
  83. struct sb_stat_type {
  84.     char unsigned   cms_open;           /* whether in read/write */
  85.     char unsigned   cms_waiting;        /* number of procs waiting to open */
  86.     char unsigned   fm_open;            /* whether in read/write */
  87.     char unsigned   fm_waiting;         /* number of procs waiting to open */
  88.     char unsigned   dsp_open;           /* whether in read/write */
  89.     unsigned int    dsp_speed;          /* sample read/write HZ */
  90.     char unsigned   dsp_compression;    /* compression protocol */
  91. };
  92.  
  93. extern struct sb_stat_type sb_status;
  94. extern struct iobuf sbtab[3];
  95.  
  96. #endif
  97.