root / lab4 / .minix-src / include / minix / audio_fw.h @ 14
History | View | Annotate | Download (2.89 KB)
1 | 13 | up20180614 | #ifndef AUDIO_FW_H
|
---|---|---|---|
2 | #define AUDIO_FW_H
|
||
3 | |||
4 | #include <minix/drivers.h> |
||
5 | #include <minix/chardriver.h> |
||
6 | #include <sys/ioc_sound.h> |
||
7 | |||
8 | |||
9 | int drv_init(void); |
||
10 | int drv_init_hw(void); |
||
11 | int drv_reset(void); |
||
12 | int drv_start(int sub_dev, int DmaMode); |
||
13 | int drv_stop(int sub_dev); |
||
14 | int drv_set_dma(u32_t dma, u32_t length, int chan); |
||
15 | int drv_reenable_int(int chan); |
||
16 | int drv_int_sum(void); |
||
17 | int drv_int(int sub_dev); |
||
18 | int drv_pause(int chan); |
||
19 | int drv_resume(int chan); |
||
20 | int drv_io_ctl(unsigned long request, void * val, int * len, int sub_dev); |
||
21 | int drv_get_irq(char *irq); |
||
22 | int drv_get_frag_size(u32_t *frag_size, int sub_dev); |
||
23 | |||
24 | |||
25 | |||
26 | /* runtime status fields */
|
||
27 | typedef struct { |
||
28 | int readable;
|
||
29 | int writable;
|
||
30 | int DmaSize;
|
||
31 | int NrOfDmaFragments;
|
||
32 | int MinFragmentSize;
|
||
33 | int NrOfExtraBuffers;
|
||
34 | int Nr; /* sub device number */ |
||
35 | int Opened; /* sub device opened */ |
||
36 | int DmaBusy; /* is dma busy? */ |
||
37 | int DmaMode; /* DEV_WRITE / DEV_READ */ |
||
38 | int DmaReadNext; /* current dma buffer */ |
||
39 | int DmaFillNext; /* next dma buffer to fill */ |
||
40 | int DmaLength;
|
||
41 | int BufReadNext; /* start of extra circular buffer */ |
||
42 | int BufFillNext; /* end of extra circular buffer */ |
||
43 | int BufLength;
|
||
44 | int RevivePending; /* process waiting for this dev? */ |
||
45 | endpoint_t ReviveProcNr; /* the process to unblock */
|
||
46 | cdev_id_t ReviveId; /* request ID */
|
||
47 | cp_grant_id_t ReviveGrant; /* grant id associated with io */
|
||
48 | endpoint_t SourceProcNr; /* process to send notify to (FS) */
|
||
49 | u32_t FragSize; /* dma fragment size */
|
||
50 | char *DmaBuf; /* the dma buffer; extra space for |
||
51 | page alignment */
|
||
52 | phys_bytes DmaPhys; /* physical address of dma buffer */
|
||
53 | char* DmaPtr; /* pointer to aligned dma buffer */ |
||
54 | int OutOfData; /* all buffers empty? */ |
||
55 | char *ExtraBuf; /* don't use extra buffer;just |
||
56 | declare a pointer to supress
|
||
57 | error messages */
|
||
58 | } sub_dev_t; |
||
59 | |||
60 | typedef struct { |
||
61 | int minor_dev_nr;
|
||
62 | int read_chan;
|
||
63 | int write_chan;
|
||
64 | int io_ctl;
|
||
65 | } special_file_t; |
||
66 | |||
67 | typedef struct { |
||
68 | char* DriverName;
|
||
69 | int NrOfSubDevices;
|
||
70 | int NrOfSpecialFiles;
|
||
71 | } drv_t; |
||
72 | |||
73 | EXTERN drv_t drv; |
||
74 | EXTERN sub_dev_t sub_dev[]; |
||
75 | EXTERN special_file_t special_file[]; |
||
76 | |||
77 | /* Number of bytes you can DMA before hitting a 64K boundary: */
|
||
78 | #define dma_bytes_left(phys) \
|
||
79 | ((unsigned) (sizeof(int) == 2 ? 0 : 0x10000) - (unsigned) ((phys) & 0xFFFF)) |
||
80 | |||
81 | #define NO_CHANNEL -1 |
||
82 | |||
83 | #define NO_DMA 0 |
||
84 | #define READ_DMA 1 |
||
85 | #define WRITE_DMA 2 |
||
86 | |||
87 | EXTERN int sef_cb_lu_prepare(int state); |
||
88 | EXTERN int sef_cb_lu_state_isvalid(int state, int flags); |
||
89 | EXTERN void sef_cb_lu_state_dump(int state); |
||
90 | |||
91 | #endif /* AUDIO_FW_H */ |