]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - keystone-rtos/tcp3d-lld.git/blob - src/tcp3d_isr.c
Merge pull request #1 in PROCESSOR-SDK/tcp3d-lld from PRSDK-2194 to master
[keystone-rtos/tcp3d-lld.git] / src / tcp3d_isr.c
1 /**\r
2  *  \file   tcp3d_isr.c\r
3  *\r
4  *  \brief  TCP3D Driver ISR functions.\r
5  *\r
6  *  Copyright (C) Texas Instruments Incorporated 2012\r
7  * \r
8  *  Redistribution and use in source and binary forms, with or without \r
9  *  modification, are permitted provided that the following conditions \r
10  *  are met:\r
11  *\r
12  *    Redistributions of source code must retain the above copyright \r
13  *    notice, this list of conditions and the following disclaimer.\r
14  *\r
15  *    Redistributions in binary form must reproduce the above copyright\r
16  *    notice, this list of conditions and the following disclaimer in the \r
17  *    documentation and/or other materials provided with the   \r
18  *    distribution.\r
19  *\r
20  *    Neither the name of Texas Instruments Incorporated nor the names of\r
21  *    its contributors may be used to endorse or promote products derived\r
22  *    from this software without specific prior written permission.\r
23  *\r
24  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \r
25  *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT \r
26  *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\r
27  *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT \r
28  *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, \r
29  *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT \r
30  *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\r
31  *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\r
32  *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT \r
33  *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE \r
34  *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
35  *\r
36 */\r
37 \r
38 /**\r
39  *  Include Files\r
40  */\r
41 /* TCP3D driver includes */\r
42 #include <ti/drv/tcp3d/tcp3d_drv.h>\r
43 #include <ti/drv/tcp3d/src/tcp3d_drv_priv.h>\r
44 \r
45 /* TCP3D Types and OSAL defintions: These files can be overriden by customers\r
46  * to point to their copies. Because of this the files have not been explicitly \r
47  * specified to include the driver path.*/\r
48 #include <tcp3d_drv_types.h>\r
49 #include <tcp3d_osal.h>\r
50 \r
51 /****************************************************************************\r
52  *              TCP3D Driver Functions                                      *\r
53  ****************************************************************************/\r
54 \r
55 /**\r
56  *  @brief  TCP3D Driver ISR function for the channels associated with REVT0.\r
57  */\r
58 static void Tcp3d_revt0ChannelIsr (Tcp3d_Instance *inst)\r
59 {\r
60     Tcp3d_Result            tcp3dResult = TCP3D_DRV_NO_ERR;\r
61     uint32_t                utmpIdx;\r
62     uint32_t                pingOutIdx;\r
63     EDMA3_DRV_PaRAMRegs     *currPrmPtr1;\r
64 \r
65     utmpIdx = inst->maxCodeBlocks;\r
66 \r
67     /* Increment the ISR counter */\r
68     inst->pingIntr++;\r
69 \r
70     /* Check to see if restart needed before exit */\r
71     /**\r
72      * Read the source address of L2P Channel PaRAM to get the current\r
73      * pseudo PaRAM pointer for PING path. Then compare with the start\r
74      * pointer for the index.\r
75      */\r
76     currPrmPtr1 = (EDMA3_DRV_PaRAMRegs *) inst->pingPtrL2p->srcAddr;\r
77     pingOutIdx = GET_CB_IDX(currPrmPtr1 - inst->startPrmPtr);\r
78 \r
79     /* Check if PING path completed decoding */\r
80     if ( pingOutIdx < utmpIdx )\r
81     {\r
82         tcp3dResult = Tcp3d_start(inst, TCP3D_DRV_START_AUTO);\r
83     \r
84         if ( TCP3D_DRV_NO_ERR != tcp3dResult )\r
85         {\r
86             Tcp3d_osalLog("REVT0 ISR: Tcp3d_start function returned error with value : %d\n", tcp3dResult);\r
87         }\r
88     }\r
89 }\r
90 \r
91 /**\r
92  *  @brief  TCP3D Driver ISR function for the channels associated with REVT1.\r
93  */\r
94 static void Tcp3d_revt1ChannelIsr (Tcp3d_Instance *inst)\r
95 {\r
96     Tcp3d_Result            tcp3dResult = TCP3D_DRV_NO_ERR;\r
97     uint32_t                utmpIdx;\r
98     uint32_t                pongOutIdx;\r
99     EDMA3_DRV_PaRAMRegs     *currPrmPtr1;\r
100 \r
101     utmpIdx = inst->maxCodeBlocks;\r
102 \r
103     /* Increment the ISR counter */\r
104     inst->pongIntr++;\r
105 \r
106     /* Check to see if restart needed before exit */\r
107     /**\r
108      * Read the source address of L2P Channel PaRAM to get the current\r
109      * pseudo PaRAM pointer for PONG path. Then compare with the start\r
110      * pointer for the index.\r
111      */\r
112     currPrmPtr1 = (EDMA3_DRV_PaRAMRegs *) inst->pongPtrL2p->srcAddr;\r
113     pongOutIdx = GET_CB_IDX(currPrmPtr1 - inst->startPrmPtr);\r
114 \r
115     /* Check if PING path completed decoding */\r
116     if ( pongOutIdx < utmpIdx )\r
117     {\r
118         tcp3dResult = Tcp3d_start(inst, TCP3D_DRV_START_AUTO);\r
119     \r
120         if ( TCP3D_DRV_NO_ERR != tcp3dResult )\r
121         {\r
122             Tcp3d_osalLog("REVT1 ISR: Tcp3d_start function returned error with value : %d\n", tcp3dResult);\r
123         }\r
124     }\r
125 }\r
126 \r
127 /* end of file */\r