| 1 |
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ |
| 2 |
|
| 3 |
File: oct6100_interrupts_priv.h |
| 4 |
|
| 5 |
Copyright (c) 2001-2007 Octasic Inc. |
| 6 |
|
| 7 |
Description: |
| 8 |
|
| 9 |
File containing all private defines, macros, structures and prototypes |
| 10 |
pertaining to the file oct6100_interrupts.c. All elements defined in this |
| 11 |
file are for private usage of the API. All public elements are defined |
| 12 |
in the oct6100_interrupts_pub.h file. |
| 13 |
|
| 14 |
This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is |
| 15 |
free software; you can redistribute it and/or modify it under the terms of |
| 16 |
the GNU General Public License as published by the Free Software Foundation; |
| 17 |
either version 2 of the License, or (at your option) any later version. |
| 18 |
|
| 19 |
The OCT6100 GPL API is distributed in the hope that it will be useful, but |
| 20 |
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
| 21 |
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
| 22 |
for more details. |
| 23 |
|
| 24 |
You should have received a copy of the GNU General Public License |
| 25 |
along with the OCT6100 GPL API; if not, write to the Free Software |
| 26 |
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
| 27 |
|
| 28 |
$Octasic_Release: OCT612xAPI-01.00-PR49 $ |
| 29 |
|
| 30 |
$Octasic_Revision: 11 $ |
| 31 |
|
| 32 |
\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ |
| 33 |
|
| 34 |
#ifndef __OCT6100_INTERRUPTS_PRIV_H__ |
| 35 |
#define __OCT6100_INTERRUPTS_PRIV_H__ |
| 36 |
|
| 37 |
/***************************** INCLUDE FILES *******************************/ |
| 38 |
|
| 39 |
|
| 40 |
/***************************** DEFINES *************************************/ |
| 41 |
|
| 42 |
#define mOCT6100_GET_INTRPT_ENABLE_TIME( \ |
| 43 |
ulRegMclkTimeHigh, \ |
| 44 |
ulRegMclkTimeLow, \ |
| 45 |
ulIntrptState, \ |
| 46 |
ulIntrptEnableMclkHigh, \ |
| 47 |
ulIntrptEnableMclkLow, \ |
| 48 |
ulIntrptTimeoutMclk, \ |
| 49 |
ulTimeDiff ) \ |
| 50 |
if ( ulIntrptState == cOCT6100_INTRPT_WILL_TIMEOUT ) \ |
| 51 |
{ \ |
| 52 |
ulIntrptEnableMclkLow = ulRegMclkTimeLow + ulIntrptTimeoutMclk; \ |
| 53 |
if ( ulIntrptEnableMclkLow < ulRegMclkTimeLow ) \ |
| 54 |
ulIntrptEnableMclkHigh = (ulRegMclkTimeHigh + 1) & 0xFF; \ |
| 55 |
else \ |
| 56 |
ulIntrptEnableMclkHigh = ulRegMclkTimeHigh; \ |
| 57 |
\ |
| 58 |
ulIntrptState = cOCT6100_INTRPT_IN_TIMEOUT; \ |
| 59 |
} \ |
| 60 |
\ |
| 61 |
if ( ulIntrptEnableMclkLow < ulRegMclkTimeLow ) \ |
| 62 |
{ \ |
| 63 |
ulTimeDiff = (cOCT6100_FFFFFFFF - ulRegMclkTimeLow - 1) + ulIntrptEnableMclkLow; \ |
| 64 |
} \ |
| 65 |
else \ |
| 66 |
{ \ |
| 67 |
ulTimeDiff = ulIntrptEnableMclkLow - ulRegMclkTimeLow; \ |
| 68 |
} |
| 69 |
|
| 70 |
#define mOCT6100_CHECK_INTRPT_TIMEOUT( \ |
| 71 |
ulRegMclkTimePlus5MsHigh, \ |
| 72 |
ulRegMclkTimePlus5MsLow, \ |
| 73 |
ulIntrptDisableMclkHigh, \ |
| 74 |
ulIntrptDisableMclkLow, \ |
| 75 |
ulIntrptEnableMclkHigh, \ |
| 76 |
ulIntrptEnableMclkLow, \ |
| 77 |
ulIntrptState, \ |
| 78 |
fIntrptChange ) \ |
| 79 |
/* Branch depending on whether the disable time is lesser or greater than the timeout time. */ \ |
| 80 |
if ( ulIntrptDisableMclkLow < ulIntrptEnableMclkLow ) \ |
| 81 |
{ \ |
| 82 |
/* Disable period is over if mclk is greater than timeout time or less than disabled time. */ \ |
| 83 |
if ( ulRegMclkTimePlus5MsLow > ulIntrptEnableMclkLow || \ |
| 84 |
ulRegMclkTimePlus5MsLow < ulIntrptDisableMclkLow || \ |
| 85 |
ulRegMclkTimePlus5MsHigh != ulIntrptEnableMclkHigh ) \ |
| 86 |
{ \ |
| 87 |
fIntrptChange = TRUE; \ |
| 88 |
ulIntrptState = cOCT6100_INTRPT_ACTIVE; \ |
| 89 |
} \ |
| 90 |
} \ |
| 91 |
else \ |
| 92 |
{ \ |
| 93 |
/* Disable period is over if mclk is lesser than disable time and greater than timeout. */ \ |
| 94 |
if ( (ulRegMclkTimePlus5MsLow > ulIntrptEnableMclkLow && ulRegMclkTimePlus5MsLow < ulIntrptDisableMclkLow) || \ |
| 95 |
(ulRegMclkTimePlus5MsHigh != ulIntrptDisableMclkHigh && ulRegMclkTimePlus5MsHigh != ulIntrptEnableMclkHigh) ) \ |
| 96 |
{ \ |
| 97 |
fIntrptChange = TRUE; \ |
| 98 |
ulIntrptState = cOCT6100_INTRPT_ACTIVE; \ |
| 99 |
} \ |
| 100 |
} |
| 101 |
|
| 102 |
/***************************** TYPES ***************************************/ |
| 103 |
|
| 104 |
|
| 105 |
/************************** FUNCTION PROTOTYPES *****************************/ |
| 106 |
|
| 107 |
UINT32 Oct6100ApiIsrSwInit( |
| 108 |
IN tPOCT6100_INSTANCE_API f_pApiInstance ); |
| 109 |
|
| 110 |
UINT32 Oct6100ApiIsrHwInit( |
| 111 |
IN tPOCT6100_INSTANCE_API f_pApiInstance, |
| 112 |
IN tPOCT6100_INTERRUPT_CONFIGURE f_pIntrptConfig ); |
| 113 |
|
| 114 |
UINT32 Oct6100InterruptConfigureSer( |
| 115 |
IN tPOCT6100_INSTANCE_API f_pApiInstance, |
| 116 |
IN tPOCT6100_INTERRUPT_CONFIGURE f_pIntrptConfig, |
| 117 |
IN BOOL f_fCheckParams ); |
| 118 |
|
| 119 |
UINT32 Oct6100ApiClearEnabledInterrupts( |
| 120 |
IN tPOCT6100_INSTANCE_API f_pApiInstance ); |
| 121 |
|
| 122 |
UINT32 Oct6100InterruptServiceRoutineSer( |
| 123 |
IN tPOCT6100_INSTANCE_API f_pApiInstance, |
| 124 |
OUT tPOCT6100_INTERRUPT_FLAGS f_pIntFlags ); |
| 125 |
|
| 126 |
UINT32 Oct6100ApiWriteIeRegs( |
| 127 |
IN tPOCT6100_INSTANCE_API f_pApiInstance ); |
| 128 |
|
| 129 |
UINT32 Oct6100ApiReadIntrptRegs( |
| 130 |
IN tPOCT6100_INSTANCE_API f_pApiInstance, |
| 131 |
OUT tPOCT6100_INTERRUPT_FLAGS f_pIntFlags, |
| 132 |
IN UINT32 f_ulRegister210h ); |
| 133 |
|
| 134 |
UINT32 Oct6100ApiUpdateIntrptStates( |
| 135 |
IN tPOCT6100_INSTANCE_API f_pApiInstance, |
| 136 |
OUT tPOCT6100_INTERRUPT_FLAGS f_pIntFlags ); |
| 137 |
|
| 138 |
UINT32 Oct6100ApiWriteIntrptRegs( |
| 139 |
IN tPOCT6100_INSTANCE_API f_pApiInstance ); |
| 140 |
|
| 141 |
UINT32 Oct6100ApiReadChipMclkTime( |
| 142 |
IN tPOCT6100_INSTANCE_API f_pApiInstance ); |
| 143 |
|
| 144 |
UINT32 Oct6100ApiUpdateIntrptTimeouts( |
| 145 |
IN tPOCT6100_INSTANCE_API f_pApiInstance ); |
| 146 |
|
| 147 |
UINT32 Oct6100ApiScheduleNextMclkIntrpt( |
| 148 |
IN tPOCT6100_INSTANCE_API f_pApiInstance, |
| 149 |
IN UINT32 f_ulIntrptToSet ); |
| 150 |
|
| 151 |
UINT32 Oct6100ApiScheduleNextMclkIntrptSer( |
| 152 |
IN tPOCT6100_INSTANCE_API f_pApiInstance ); |
| 153 |
|
| 154 |
UINT32 Oct6100ApiCheckProcessorState( |
| 155 |
IN tPOCT6100_INSTANCE_API f_pApiInstance, |
| 156 |
IN tPOCT6100_INTERRUPT_FLAGS f_pIntFlags ); |
| 157 |
|
| 158 |
#endif /* __OCT6100_INTERRUPTS_PRIV_H__ */ |