]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - processor-sdk/pdk.git/blob - packages/ti/drv/mcasp/soc/omapl137/mcasp_soc.c
mcasp-lld: add to PDK
[processor-sdk/pdk.git] / packages / ti / drv / mcasp / soc / omapl137 / mcasp_soc.c
1 /*
2  * mcasp_soc.c
3  *
4  * This file contains MCASP IP & driver specifications pertaining to a given SOC (OMAPL137)
5  *
6  * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/
7  *
8  *
9  *  Redistribution and use in source and binary forms, with or without
10  *  modification, are permitted provided that the following conditions
11  *  are met:
12  *
13  *    Redistributions of source code must retain the above copyright
14  *    notice, this list of conditions and the following disclaimer.
15  *
16  *    Redistributions in binary form must reproduce the above copyright
17  *    notice, this list of conditions and the following disclaimer in the
18  *    documentation and/or other materials provided with the
19  *    distribution.
20  *
21  *    Neither the name of Texas Instruments Incorporated nor the names of
22  *    its contributors may be used to endorse or promote products derived
23  *    from this software without specific prior written permission.
24  *
25  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26  *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27  *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
28  *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
29  *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
30  *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
31  *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32  *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33  *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34  *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
35  *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36  *
37 */
39 /* MCASP Driver Includes. */
41 /* CSL McASP Register Layer */
42 #include <ti/csl/cslr_mcasp.h>
44 #include <ti/csl/cslr_device.h>
47 /*============================================================================*/
48 /*                           IMPORTED VARIABLES                               */
49 /*============================================================================*/
53 /* ========================================================================== */
54 /*                           MODULE FUNCTIONS                                 */
55 /* ========================================================================== */
56 /**
57  * \brief   Initializes McASP driver's data structures
58  *
59  *          This function initializes the McASP driver's data structures
60  *          including instance objects and channel objects. This is the 
61  *          McASP Driver Initialization API which needs to be invoked by
62  *          the users to initialize the McASP peripheral. This call is
63  *          *mandatory* and should be called before calling any of the 
64  *          other driver API's.  This can be modified by customers for 
65  *          their application and configuration.
66  *
67  * \return  None
68  */
69 #include <mcasp_drv.h>
70 #include <mcasp_osal.h>
71 #include <ti/drv/mcasp/soc/mcasp_soc.h>
72 #include <include/McaspLocal.h>
73 #include "string.h"
74 #define AINTC_EVENTID_AXRINT    (0x00000036)
75 extern Mcasp_HwInfo Mcasp_deviceInstInfo[MCASP_CNT];
76 extern Mcasp_Module_State Mcasp_module ;
77 extern Mcasp_Object Mcasp_Instances[MCASP_CNT];
78 extern Mcasp_TempBuffer Mcasp_muteBuf[MCASP_CNT];
80 void McaspDevice_init(void)
82     {
83         Int i;
85         for (i = 0; i < (int32_t)MCASP_CNT; i++)
86         {
87             /* have to initialize  ally */
88             Mcasp_module.inUse[i] = (Bool)0;/* FALSE; */
89             memset((void *)&Mcasp_Instances[i], 0x0, sizeof(Mcasp_Object));
91             Mcasp_module.isrObject[i].isIsrRegistered[0] = (Bool)0;/* FALSE; */
92             Mcasp_module.isrObject[i].isIsrRegistered[1] = (Bool)0;/* FALSE; */
93             Mcasp_module.isrObject[i].chanEnabled[0] = (Bool)0;/* FALSE; */
94             Mcasp_module.isrObject[i].chanEnabled[1] = (Bool)0;/* FALSE; */
95             Mcasp_module.isrObject[i].instHandle = 0;/* NULL; */
96             Mcasp_module.isrObject[i].isrSwiTaskHandle = 0;/* NULL; */
98             if (i == 0)
99             {
100                 Mcasp_deviceInstInfo[i].ditSupport = (Bool)0;/* FALSE; */
101                 Mcasp_deviceInstInfo[i].baseAddress =
102                     (CSL_McaspRegs *)CSL_MCASP_0_CFG_REGS;
103                 Mcasp_deviceInstInfo[i].fifoAddress =
104                     (CSL_AfifoRegs *)CSL_MCASP_0_FIFO_CFG_REGS;
105                 Mcasp_deviceInstInfo[i].dataAddress =
106                     (CSL_AdataRegs *)CSL_MCASP_0_SLV_REGS;
107                 Mcasp_deviceInstInfo[i].numSerializers = 16u;
108                 Mcasp_deviceInstInfo[i].rxDmaEventNumber =
109                     (uint32_t)CSL_EDMA3_CHA_MCASP0_RX;
110                 Mcasp_deviceInstInfo[i].txDmaEventNumber =
111                     (uint32_t)CSL_EDMA3_CHA_MCASP0_TX;
112     #ifndef BIOS_PWRM_ENABLE
113                 Mcasp_deviceInstInfo[i].pwrmLpscId = (Uint32)7;
114     #else
115                 Mcasp_deviceInstInfo[i].pwrmLpscId =
116                     (uint32_t)CSL_LPSC_NUMBER_MCASP_0;
117     #endif
118                 Mcasp_deviceInstInfo[i].pscInstance =
119                    1;
121             }
123             else if (i == 1)
124             {
125                 Mcasp_deviceInstInfo[i].ditSupport = (Bool)0;/* FALSE; */
126                 Mcasp_deviceInstInfo[i].baseAddress =
127                     (CSL_McaspRegs *)CSL_MCASP_1_CFG_REGS;
128                 Mcasp_deviceInstInfo[i].fifoAddress =
129                     (CSL_AfifoRegs *)CSL_MCASP_1_FIFO_CFG_REGS;
130                 Mcasp_deviceInstInfo[i].dataAddress =
131                     (CSL_AdataRegs *)CSL_MCASP_1_SLV_REGS;
133                 Mcasp_deviceInstInfo[i].numSerializers = 12u;
134                 Mcasp_deviceInstInfo[i].rxDmaEventNumber =
135                     (uint32_t)CSL_EDMA3_CHA_MCASP1_RX;
136                 Mcasp_deviceInstInfo[i].txDmaEventNumber =
137                     (uint32_t)CSL_EDMA3_CHA_MCASP1_TX;
138     #ifndef BIOS_PWRM_ENABLE
139                 Mcasp_deviceInstInfo[i].pwrmLpscId = (Uint32)8;
140     #else
141                 Mcasp_deviceInstInfo[i].pwrmLpscId =
142                     (uint32_t)CSL_LPSC_NUMBER_MCASP_1;
143     #endif
144                 Mcasp_deviceInstInfo[i].pscInstance = 1;
146             }
148             else if (i == 2)
149             {
150                 Mcasp_deviceInstInfo[i].ditSupport = (Bool)0;
151                 Mcasp_deviceInstInfo[i].baseAddress =
152                     (CSL_McaspRegs *)CSL_MCASP_2_CFG_REGS;
153                 Mcasp_deviceInstInfo[i].fifoAddress =
154                     (CSL_AfifoRegs *)CSL_MCASP_2_FIFO_CFG_REGS;
155                 Mcasp_deviceInstInfo[i].dataAddress =
156                     (CSL_AdataRegs *)CSL_MCASP_2_SLV_REGS;
157                 Mcasp_deviceInstInfo[i].numSerializers = 4u;
158                 Mcasp_deviceInstInfo[i].rxDmaEventNumber =
159                     (uint32_t)CSL_EDMA3_CHA_MCASP2_RX;
160                 Mcasp_deviceInstInfo[i].txDmaEventNumber =
161                     (uint32_t)CSL_EDMA3_CHA_MCASP2_TX;
162     #ifndef BIOS_PWRM_ENABLE
163                 Mcasp_deviceInstInfo[i].pwrmLpscId = (Uint32)9;
164     #else
165                 Mcasp_deviceInstInfo[i].pwrmLpscId =
166                     (uint32_t)CSL_LPSC_NUMBER_MCASP_2;
167     #endif
168                 Mcasp_deviceInstInfo[i].pscInstance = 1;
169             }
170             else
171             {
172                 /* do nothing                                                     */
173             }
174 #if defined (_TMS320C6X)
175             Mcasp_deviceInstInfo[i].cpuTxEventNumber = CSL_INTC_EVENTID_AXRINT;
176             Mcasp_deviceInstInfo[i].cpuRxEventNumber = CSL_INTC_EVENTID_AXRINT;
177             Mcasp_deviceInstInfo[i].txIntNum = OSAL_REGINT_INTVEC_EVENT_COMBINER;
178             Mcasp_deviceInstInfo[i].rxIntNum = OSAL_REGINT_INTVEC_EVENT_COMBINER;
180 #else
181             Mcasp_deviceInstInfo[i].cpuTxEventNumber = AINTC_EVENTID_AXRINT;
182             Mcasp_deviceInstInfo[i].cpuRxEventNumber = AINTC_EVENTID_AXRINT;
183             Mcasp_deviceInstInfo[i].txIntNum = AINTC_EVENTID_AXRINT;
184             Mcasp_deviceInstInfo[i].rxIntNum = AINTC_EVENTID_AXRINT;
185 #endif
186             /* No mux present */
187             Mcasp_deviceInstInfo[i].muxNum=MCASP_INVALID_MUX_NUM;
188             Mcasp_deviceInstInfo[i].txMuxInEvent=MCASP_INVALID_MUX_EVENTNUM;
189             Mcasp_deviceInstInfo[i].txMuxOutEvent=MCASP_INVALID_MUX_EVENTNUM;
190             Mcasp_deviceInstInfo[i].rxMuxInEvent=MCASP_INVALID_MUX_EVENTNUM;
191             Mcasp_deviceInstInfo[i].rxMuxOutEvent=MCASP_INVALID_MUX_EVENTNUM;
192         }
194         /* intialise the loop job buffers and the mute buffers for all instances  */
195     #ifdef Mcasp_LOOPJOB_ENABLED
196         memset((void *)Mcasp_loopDstBuf, 0x0,
197                sizeof(Mcasp_TempBuffer) * MCASP_CNT);
198         memset((void *)Mcasp_loopSrcBuf, 0x0,
199                sizeof(Mcasp_TempBuffer) * MCASP_CNT);
200     #endif /* Mcasp_LOOPJOB_ENABLED */
201         memset((void *)Mcasp_muteBuf, 0x0,
202                sizeof(Mcasp_TempBuffer) * MCASP_CNT);
205 /* ========================================================================== */
206 /*                              END OF FILE                                   */
207 /* ========================================================================== */