kernel: maintain stack alignment
[minix3.git] / include / minix / audio_fw.h
blobd3139286849a4b708147c242644b903a586543fd
1 #ifndef AUDIO_FW_H
2 #define AUDIO_FW_H
4 #include <minix/drivers.h>
5 #include <minix/chardriver.h>
6 #include <sys/ioc_sound.h>
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(int 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);
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 int ReviveStatus; /* return val when proc unblocked */
46 endpoint_t ReviveProcNr; /* the process to unblock */
47 cp_grant_id_t ReviveGrant; /* grant id associated with io */
48 void *UserBuf; /* address of user's data buffer */
49 int ReadyToRevive; /* are we ready to revive process?*/
50 endpoint_t SourceProcNr; /* process to send notify to (FS) */
51 u32_t FragSize; /* dma fragment size */
52 char *DmaBuf; /* the dma buffer; extra space for
53 page alignment */
54 phys_bytes DmaPhys; /* physical address of dma buffer */
55 char* DmaPtr; /* pointer to aligned dma buffer */
56 int OutOfData; /* all buffers empty? */
57 char *ExtraBuf; /* don't use extra buffer;just
58 declare a pointer to supress
59 error messages */
60 } sub_dev_t;
62 typedef struct {
63 int minor_dev_nr;
64 int read_chan;
65 int write_chan;
66 int io_ctl;
67 } special_file_t;
69 typedef struct {
70 char* DriverName;
71 int NrOfSubDevices;
72 int NrOfSpecialFiles;
73 } drv_t;
75 EXTERN drv_t drv;
76 EXTERN sub_dev_t sub_dev[];
77 EXTERN special_file_t special_file[];
79 /* Number of bytes you can DMA before hitting a 64K boundary: */
80 #define dma_bytes_left(phys) \
81 ((unsigned) (sizeof(int) == 2 ? 0 : 0x10000) - (unsigned) ((phys) & 0xFFFF))
83 #define NO_CHANNEL -1
85 #define TRUE 1
86 #define FALSE 0
87 #define NO_DMA 0
90 #endif /* AUDIO_FW_H */