| 1 |
|
|---|
| 2 |
strict; |
|---|
| 3 |
use warnings; |
|---|
| 4 |
require 'dumpvar.pl'; |
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
$path_to_ah_h = '../hal/ah.h'; |
|---|
| 10 |
$path_to_ath_hal_api_h = '../ath_hal/ath_hal_api.h'; |
|---|
| 11 |
$path_to_ath_hal_api_c = '../ath_hal/ath_hal_api.c'; |
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
my %function_names = ( |
|---|
| 17 |
"ah_beaconInit" => "ath_hal_beaconinit" |
|---|
| 18 |
, "ah_disablePhyErrDiag" => "ath_hal_disablePhyDiag" |
|---|
| 19 |
, "ah_enablePhyErrDiag" => "ath_hal_enablePhyDiag" |
|---|
| 20 |
, "ah_enableReceive" => "ath_hal_rxena" |
|---|
| 21 |
, "ah_fillTxDesc" => "ath_hal_filltxdesc" |
|---|
| 22 |
, "ah_getAckCTSRate" => "ath_hal_getackctsrate" |
|---|
| 23 |
, "ah_setAckCTSRate" => "ath_hal_setackctsrate" |
|---|
| 24 |
, "ah_updateMibCounters" => "ath_hal_updatemibcounters" |
|---|
| 25 |
, "ah_getAntennaSwitch" => "ath_hal_getantennaswitch" |
|---|
| 26 |
, "ah_setAntennaSwitch" => "ath_hal_setantennaswitch" |
|---|
| 27 |
, "ah_getAckTimeout" => "ath_hal_getacktimeout" |
|---|
| 28 |
, "ah_getBssIdMask" => "ath_hal_getbssidmask" |
|---|
| 29 |
, "ah_getCapability" => "ath_hal_getcapability" |
|---|
| 30 |
, "ah_getChanNoise" => "ath_hal_get_channel_noise" |
|---|
| 31 |
, "ah_getCTSTimeout" => "ath_hal_getctstimeout" |
|---|
| 32 |
, "ah_getDefAntenna" => "ath_hal_getdefantenna" |
|---|
| 33 |
, "ah_getDiagState" => "ath_hal_getdiagstate" |
|---|
| 34 |
, "ah_getInterrupts" => "ath_hal_intrget" |
|---|
| 35 |
, "ah_getKeyCacheSize" => "ath_hal_keycachesize" |
|---|
| 36 |
, "ah_getMacAddress" => "ath_hal_getmac" |
|---|
| 37 |
, "ah_getPendingInterrupts" => "ath_hal_getisr" |
|---|
| 38 |
, "ah_getPowerMode" => "ath_hal_getPowerMode" |
|---|
| 39 |
, "ah_getRateTable" => "ath_hal_getratetable" |
|---|
| 40 |
, "ah_getRfGain" => "ath_hal_getrfgain" |
|---|
| 41 |
, "ah_getRxDP" => "ath_hal_getrxbuf" |
|---|
| 42 |
, "ah_getRxFilter" => "ath_hal_getrxfilter" |
|---|
| 43 |
, "ah_getSlotTime" => "ath_hal_getslottime" |
|---|
| 44 |
, "ah_getTsf32" => "ath_hal_gettsf32" |
|---|
| 45 |
, "ah_getTsf64" => "ath_hal_gettsf64" |
|---|
| 46 |
, "ah_getTxDP" => "ath_hal_gettxbuf" |
|---|
| 47 |
, "ah_getTxIntrQueue" => "ath_hal_gettxintrtxqs" |
|---|
| 48 |
, "ah_getTxQueueProps" => "ath_hal_gettxqueueprops" |
|---|
| 49 |
, "ah_gpioCfgOutput" => "ath_hal_gpioCfgOutput" |
|---|
| 50 |
, "ah_gpioSet" => "ath_hal_gpioset" |
|---|
| 51 |
, "ah_gpioGet" => "ath_hal_gpioget" |
|---|
| 52 |
, "ah_gpioSetIntr" => "ath_hal_gpiosetintr" |
|---|
| 53 |
, "ah_gpioCfgInput" => "ath_hal_gpiCfgInput" |
|---|
| 54 |
, "ah_isInterruptPending" => "ath_hal_intrpend" |
|---|
| 55 |
, "ah_isKeyCacheEntryValid" => "ath_hal_keyisvalid" |
|---|
| 56 |
, "ah_numTxPending" => "ath_hal_numtxpending" |
|---|
| 57 |
, "ah_perCalibration" => "ath_hal_calibrate" |
|---|
| 58 |
, "ah_phyDisable" => "ath_hal_phydisable" |
|---|
| 59 |
, "ah_disable" => "ath_hal_disable" |
|---|
| 60 |
, "ah_procMibEvent" => "ath_hal_mibevent" |
|---|
| 61 |
, "ah_procRxDesc" => "ath_hal_rxprocdesc" |
|---|
| 62 |
, "ah_procTxDesc" => "ath_hal_txprocdesc" |
|---|
| 63 |
, "ah_radarWait" => "ath_hal_radar_wait" |
|---|
| 64 |
, "ah_releaseTxQueue" => "ath_hal_releasetxqueue" |
|---|
| 65 |
, "ah_reqTxIntrDesc" => "ath_hal_txreqintrdesc" |
|---|
| 66 |
, "ah_reset" => "ath_hal_reset" |
|---|
| 67 |
, "ah_resetKeyCacheEntry" => "ath_hal_keyreset" |
|---|
| 68 |
, "ah_resetStationBeaconTimers" => "ath_hal_beaconreset" |
|---|
| 69 |
, "ah_resetTsf" => "ath_hal_resettsf" |
|---|
| 70 |
, "ah_resetTxQueue" => "ath_hal_resettxqueue" |
|---|
| 71 |
, "ah_rxMonitor" => "ath_hal_rxmonitor" |
|---|
| 72 |
, "ah_setAckTimeout" => "ath_hal_setacktimeout" |
|---|
| 73 |
, "ah_setBssIdMask" => "ath_hal_setbssidmask" |
|---|
| 74 |
, "ah_setCapability" => "ath_hal_setcapability" |
|---|
| 75 |
, "ah_setChannel" => "ath_hal_setchannel" |
|---|
| 76 |
, "ah_setCoverageClass" => "ath_hal_setcoverageclass" |
|---|
| 77 |
, "ah_setCTSTimeout" => "ath_hal_setctstimeout" |
|---|
| 78 |
, "ah_setDecompMask" => "ath_hal_setdecompmask" |
|---|
| 79 |
, "ah_setDefAntenna" => "ath_hal_setdefantenna" |
|---|
| 80 |
, "ah_setInterrupts" => "ath_hal_intrset" |
|---|
| 81 |
, "ah_setKeyCacheEntry" => "ath_hal_keyset" |
|---|
| 82 |
, "ah_setKeyCacheEntryMac" => "ath_hal_keysetmac" |
|---|
| 83 |
, "ah_setLedState" => "ath_hal_setledstate" |
|---|
| 84 |
, "ah_setMacAddress" => "ath_hal_setmac" |
|---|
| 85 |
, "ah_setMulticastFilter" => "ath_hal_setmcastfilter" |
|---|
| 86 |
, "ah_setMulticastFilterIndex" => "ath_hal_setmcastfilterindex" |
|---|
| 87 |
, "ah_setPCUConfig" => "ath_hal_setopmode" |
|---|
| 88 |
, "ah_setPowerMode" => "ath_hal_setpower" |
|---|
| 89 |
, "ah_setRxDP" => "ath_hal_putrxbuf" |
|---|
| 90 |
, "ah_setRxFilter" => "ath_hal_setrxfilter" |
|---|
| 91 |
, "ah_setRegulatoryDomain" => "ath_hal_setregulatorydomain" |
|---|
| 92 |
, "ah_setSlotTime" => "ath_hal_setslottime" |
|---|
| 93 |
, "ah_setStationBeaconTimers" => "ath_hal_beacontimers" |
|---|
| 94 |
, "ah_setTxDP" => "ath_hal_puttxbuf" |
|---|
| 95 |
, "ah_setTxQueueProps" => "ath_hal_settxqueueprops" |
|---|
| 96 |
, "ah_setTxPowerLimit" => "ath_hal_settxpowerlimit" |
|---|
| 97 |
, "ah_setBeaconTimers" => "ath_hal_setbeacontimers" |
|---|
| 98 |
, "ah_setupRxDesc" => "ath_hal_setuprxdesc" |
|---|
| 99 |
, "ah_setupTxDesc" => "ath_hal_setuptxdesc" |
|---|
| 100 |
, "ah_setupTxQueue" => "ath_hal_setuptxqueue" |
|---|
| 101 |
, "ah_setupXTxDesc" => "ath_hal_setupxtxdesc" |
|---|
| 102 |
, "ah_startPcuReceive" => "ath_hal_startpcurecv" |
|---|
| 103 |
, "ah_startTxDma" => "ath_hal_txstart" |
|---|
| 104 |
, "ah_stopDmaReceive" => "ath_hal_stopdmarecv" |
|---|
| 105 |
, "ah_stopPcuReceive" => "ath_hal_stoppcurecv" |
|---|
| 106 |
, "ah_stopTxDma" => "ath_hal_stoptxdma" |
|---|
| 107 |
, "ah_updateCTSForBursting" => "ath_hal_updateCTSForBursting" |
|---|
| 108 |
, "ah_updateTxTrigLevel" => "ath_hal_updatetxtriglevel" |
|---|
| 109 |
, "ah_waitForBeaconDone" => "ath_hal_waitforbeacon" |
|---|
| 110 |
, "ah_writeAssocid" => "ath_hal_setassocid" |
|---|
| 111 |
, "ah_detach" => "ath_hal_detach" |
|---|
| 112 |
, "ah_clrMulticastFilterIndex" => "ath_hal_clearmcastfilter" |
|---|
| 113 |
, "ah_detectCardPresent" => "ath_hal_detectcardpresent" |
|---|
| 114 |
); |
|---|
| 115 |
|
|---|
| 116 |
|
|---|
| 117 |
|
|---|
| 118 |
|
|---|
| 119 |
$header_comment = <<EOF |
|---|
| 120 |
/* |
|---|
| 121 |
* Wrapper macros/functions for the binary HAL to comply with local coding convention. |
|---|
| 122 |
* |
|---|
| 123 |
* Provides function-style calling convention using either macros or wrapper functions for function pointers in the HAL. |
|---|
| 124 |
* |
|---|
| 125 |
* The typical convention is foo(hal,p1,p2,p3,...) turns into hal->foo(p1,p2,p3,...) where foo |
|---|
| 126 |
* is a function pointer and a member of the struct ath_hal. |
|---|
| 127 |
* |
|---|
| 128 |
* The macros are faster, but the functions have the advantage that they show up unobfuscated in backtraces thus giving you a clue as to where in |
|---|
| 129 |
* your code you went wrong in your use of the HAL. |
|---|
| 130 |
* |
|---|
| 131 |
*/ |
|---|
| 132 |
EOF |
|---|
| 133 |
; |
|---|
| 134 |
|
|---|
| 135 |
my %custom_wrappers = ( |
|---|
| 136 |
"HAL_BOOL ath_hal_burstsupported(struct ath_hal * ah)" => "(ath_hal_getcapability(ah, HAL_CAP_BURST, 0, NULL) == HAL_OK)" |
|---|
| 137 |
, "HAL_BOOL ath_hal_ciphersupported(struct ath_hal * ah, u_int32_t cipher)" => "(ath_hal_getcapability(ah, HAL_CAP_CIPHER, cipher, NULL) == HAL_OK)" |
|---|
| 138 |
, "HAL_BOOL ath_hal_compressionsupported(struct ath_hal * ah)" => "(ath_hal_getcapability(ah, HAL_CAP_COMPRESSION, 0, NULL) == HAL_OK)" |
|---|
| 139 |
, "HAL_BOOL ath_hal_fastframesupported(struct ath_hal * ah)" => "(ath_hal_getcapability(ah, HAL_CAP_FASTFRAME, 0, NULL) == HAL_OK)" |
|---|
| 140 |
, "HAL_BOOL ath_hal_getcountrycode(struct ath_hal * ah, u_int32_t* destination)" => "((*(destination) = ah->ah_countryCode), AH_TRUE)" |
|---|
| 141 |
, "HAL_BOOL ath_hal_getdiversity(struct ath_hal * ah)" => "(ath_hal_getcapability(ah, HAL_CAP_DIVERSITY, 1, NULL) == HAL_OK)" |
|---|
| 142 |
, "HAL_BOOL ath_hal_getmaxtxpow(struct ath_hal * ah, u_int32_t* destination)" => "(ath_hal_getcapability(ah, HAL_CAP_TXPOW, 2, destination) == HAL_OK)" |
|---|
| 143 |
, "HAL_BOOL ath_hal_getmcastkeysearch(struct ath_hal * ah)" => "(ath_hal_getcapability(ah, HAL_CAP_MCAST_KEYSRCH, 1, NULL) == HAL_OK)" |
|---|
| 144 |
, "HAL_BOOL ath_hal_getnumtxqueues(struct ath_hal * ah, u_int32_t* destination)" => "(ath_hal_getcapability(ah, HAL_CAP_NUM_TXQUEUES, 0, destination) == HAL_OK)" |
|---|
| 145 |
, "HAL_BOOL ath_hal_getregdomain(struct ath_hal * ah, u_int32_t* destination)" => "(ath_hal_getcapability(ah, HAL_CAP_REG_DMN, 0, destination))" |
|---|
| 146 |
, "HAL_BOOL ath_hal_gettkipmic(struct ath_hal * ah)" => "(ath_hal_getcapability(ah, HAL_CAP_TKIP_MIC, 1, NULL) == HAL_OK)" |
|---|
| 147 |
, "HAL_BOOL ath_hal_gettkipsplit(struct ath_hal * ah)" => "(ath_hal_getcapability(ah, HAL_CAP_TKIP_SPLIT, 1, NULL) == HAL_OK)" |
|---|
| 148 |
, "HAL_BOOL ath_hal_gettpc(struct ath_hal * ah)" => "(ath_hal_getcapability(ah, HAL_CAP_TPC, 1, NULL) == HAL_OK)" |
|---|
| 149 |
, "HAL_BOOL ath_hal_gettpscale(struct ath_hal * ah, u_int32_t* destination)" => "(ath_hal_getcapability(ah, HAL_CAP_TXPOW, 3, destination) == HAL_OK)" |
|---|
| 150 |
, "HAL_BOOL ath_hal_gettsfadjust(struct ath_hal * ah)" => "(ath_hal_getcapability(ah, HAL_CAP_TSF_ADJUST, 1, NULL) == HAL_OK)" |
|---|
| 151 |
, "HAL_BOOL ath_hal_gettxpowlimit(struct ath_hal * ah, u_int32_t* destination)" => "(ath_hal_getcapability(ah, HAL_CAP_TXPOW, 1, destination) == HAL_OK)" |
|---|
| 152 |
, "HAL_BOOL ath_hal_halfrate_chansupported(struct ath_hal * ah)" => "(ath_hal_getcapability(ah, HAL_CAP_CHAN_HALFRATE, 0, NULL) == HAL_OK)" |
|---|
| 153 |
, "HAL_BOOL ath_hal_hasbssidmask(struct ath_hal * ah)" => "(ath_hal_getcapability(ah, HAL_CAP_BSSIDMASK, 0, NULL) == HAL_OK)" |
|---|
| 154 |
, "HAL_BOOL ath_hal_hasbursting(struct ath_hal * ah)" => "(ath_hal_getcapability(ah, HAL_CAP_BURST, 0, NULL) == HAL_OK)" |
|---|
| 155 |
, "HAL_BOOL ath_hal_hascompression(struct ath_hal * ah)" => "(ath_hal_getcapability(ah, HAL_CAP_COMPRESSION, 0, NULL) == HAL_OK)" |
|---|
| 156 |
, "HAL_BOOL ath_hal_hasdiversity(struct ath_hal * ah)" => "(ath_hal_getcapability(ah, HAL_CAP_DIVERSITY, 0, NULL) == HAL_OK)" |
|---|
| 157 |
, "HAL_BOOL ath_hal_hasfastframes(struct ath_hal * ah)" => "(ath_hal_getcapability(ah, HAL_CAP_FASTFRAME, 0, NULL) == HAL_OK)" |
|---|
| 158 |
, "HAL_BOOL ath_hal_hasmcastkeysearch(struct ath_hal * ah)" => "(ath_hal_getcapability(ah, HAL_CAP_MCAST_KEYSRCH, 0, NULL) == HAL_OK)" |
|---|
| 159 |
, "HAL_BOOL ath_hal_hasrfsilent(struct ath_hal * ah)" => "(ath_hal_getcapability(ah, HAL_CAP_RFSILENT, 0, NULL) == HAL_OK)" |
|---|
| 160 |
, "HAL_BOOL ath_hal_hastkipmic(struct ath_hal * ah)" => "(ath_hal_getcapability(ah, HAL_CAP_TKIP_MIC, 0, NULL) == HAL_OK)" |
|---|
| 161 |
, "HAL_BOOL ath_hal_hastkipsplit(struct ath_hal * ah)" => "(ath_hal_getcapability(ah, HAL_CAP_TKIP_SPLIT, 0, NULL) == HAL_OK)" |
|---|
| 162 |
, "HAL_BOOL ath_hal_hastpc(struct ath_hal * ah)" => "(ath_hal_getcapability(ah, HAL_CAP_TPC, 0, NULL) == HAL_OK)" |
|---|
| 163 |
, "HAL_BOOL ath_hal_hastsfadjust(struct ath_hal * ah)" => "(ath_hal_getcapability(ah, HAL_CAP_TSF_ADJUST, 0, NULL) == HAL_OK)" |
|---|
| 164 |
, "HAL_BOOL ath_hal_hastxpowlimit(struct ath_hal * ah)" => "(ath_hal_getcapability(ah, HAL_CAP_TXPOW, 0, NULL) == HAL_OK)" |
|---|
| 165 |
, "HAL_BOOL ath_hal_hasveol(struct ath_hal * ah)" => "(ath_hal_getcapability(ah, HAL_CAP_VEOL, 0, NULL) == HAL_OK)" |
|---|
| 166 |
, "HAL_BOOL ath_hal_hwphycounters(struct ath_hal * ah)" => "(ath_hal_getcapability(ah, HAL_CAP_PHYCOUNTERS, 0, NULL) == HAL_OK)" |
|---|
| 167 |
, "HAL_BOOL ath_hal_quarterrate_chansupported(struct ath_hal * ah)" => "(ath_hal_getcapability(ah, HAL_CAP_CHAN_QUARTERRATE, 0, NULL) == HAL_OK)" |
|---|
| 168 |
, "HAL_BOOL ath_hal_setdiversity(struct ath_hal * ah, int v)" => "(ath_hal_setcapability(ah, HAL_CAP_DIVERSITY, 1, v, NULL))" |
|---|
| 169 |
, "HAL_BOOL ath_hal_setrfsilent(struct ath_hal * ah, u_int32_t v)" => "(ath_hal_setcapability(ah, HAL_CAP_RFSILENT, 1, v, NULL))" |
|---|
| 170 |
, "HAL_BOOL ath_hal_settkipmic(struct ath_hal * ah, u_int32_t v)" => "(ath_hal_setcapability(ah, HAL_CAP_TKIP_MIC, 1, v, NULL))" |
|---|
| 171 |
, "HAL_BOOL ath_hal_settkipsplit(struct ath_hal * ah, int v)" => "(ath_hal_setcapability(ah, HAL_CAP_TKIP_SPLIT, 1, v, NULL))" |
|---|
| 172 |
, "HAL_BOOL ath_hal_settpc(struct ath_hal * ah, u_int32_t v)" => "(ath_hal_setcapability(ah, HAL_CAP_TPC, 1, v, NULL))" |
|---|
| 173 |
, "HAL_BOOL ath_hal_settpscale(struct ath_hal * ah, u_int32_t v)" => "(ath_hal_setcapability(ah, HAL_CAP_TXPOW, 3, v, NULL))" |
|---|
| 174 |
, "HAL_BOOL ath_hal_settsfadjust(struct ath_hal * ah, u_int32_t v)" => "(ath_hal_setcapability(ah, HAL_CAP_TSF_ADJUST, 1, v, NULL))" |
|---|
| 175 |
, "HAL_BOOL ath_hal_turboagsupported(struct ath_hal * ah, int countrycode)" => "(ath_hal_getwirelessmodes(ah, countrycode) & (HAL_MODE_108G|HAL_MODE_TURBO))" |
|---|
| 176 |
, "HAL_BOOL ath_hal_wmetkipmic(struct ath_hal * ah)" => "(ath_hal_getcapability(ah, HAL_CAP_WME_TKIPMIC, 0, NULL) == HAL_OK)" |
|---|
| 177 |
, "HAL_BOOL ath_hal_xrsupported(struct ath_hal * ah)" => "(ath_hal_getcapability(ah, HAL_CAP_XR, 0, NULL) == HAL_OK)" |
|---|
| 178 |
); |
|---|
| 179 |
|
|---|
| 180 |
|
|---|
| 181 |
|
|---|
| 182 |
|
|---|
| 183 |
if(!open AH_H, "<$path_to_ah_h") { |
|---|
| 184 |
die "Cannot open $path_to_ah_h: $!"; |
|---|
| 185 |
} |
|---|
| 186 |
if(!open ATH_HAL_API_H, ">$path_to_ath_hal_api_h") { |
|---|
| 187 |
close AH_H; |
|---|
| 188 |
die "Cannot open $path_to_ath_hal_api_h: $!"; |
|---|
| 189 |
} |
|---|
| 190 |
if(!open ATH_HAL_API_C, ">$path_to_ath_hal_api_c") { |
|---|
| 191 |
close AH_H; |
|---|
| 192 |
close ATH_HAL_API_H; |
|---|
| 193 |
die "Cannot open $path_to_ath_hal_api_c: $!"; |
|---|
| 194 |
} |
|---|
| 195 |
|
|---|
| 196 |
|
|---|
| 197 |
|
|---|
| 198 |
|
|---|
| 199 |
|
|---|
| 200 |
@hal_prototypes = (); |
|---|
| 201 |
|
|---|
| 202 |
%hal_return_types = (); |
|---|
| 203 |
|
|---|
| 204 |
%hal_parameter_names = (); |
|---|
| 205 |
|
|---|
| 206 |
%hal_parameter_types = (); |
|---|
| 207 |
|
|---|
| 208 |
|
|---|
| 209 |
$line_continued = 0; |
|---|
| 210 |
$line_buffer = ""; |
|---|
| 211 |
foreach (<AH_H>) { |
|---|
| 212 |
chomp($_); |
|---|
| 213 |
s/\s+$//g; |
|---|
| 214 |
s/^\s+//g; |
|---|
| 215 |
s/\s+/ /g; |
|---|
| 216 |
if (/__ahdecl\s*\(.*/ || $line_continued) { |
|---|
| 217 |
$line_buffer .= "$_"; |
|---|
| 218 |
if (/__ahdecl.*;/ || ($line_continued && /;/)) { |
|---|
| 219 |
push @hal_prototypes, $line_buffer; |
|---|
| 220 |
$line_buffer = ""; |
|---|
| 221 |
$line_continued = 0; |
|---|
| 222 |
} |
|---|
| 223 |
else { |
|---|
| 224 |
$line_buffer .= " "; |
|---|
| 225 |
$line_continued = 1; |
|---|
| 226 |
} |
|---|
| 227 |
} |
|---|
| 228 |
} |
|---|
| 229 |
|
|---|
| 230 |
|
|---|
| 231 |
foreach $proto (@hal_prototypes) { |
|---|
| 232 |
$proto =~ /^((?:(?:const|struct|\*)\s*)*[^\s]+)[\s]*\*?[\s]*__ahdecl\(\*([^\)]*)\)\((.*)\);/; |
|---|
| 233 |
my $return_type = $1; |
|---|
| 234 |
my $member_name = $2; |
|---|
| 235 |
my $parameterlist = $3; |
|---|
| 236 |
$hal_return_types{"$member_name"} = "$return_type"; |
|---|
| 237 |
@{$hal_parameter_names{"$member_name"}} = (); |
|---|
| 238 |
@{$hal_parameter_types{"$member_name"}} = (); |
|---|
| 239 |
my @parameters = split /,\s?/, $parameterlist; |
|---|
| 240 |
$argnum = 0; |
|---|
| 241 |
$first = 1; |
|---|
| 242 |
foreach(@parameters) { |
|---|
| 243 |
$_ =~ s/ \*/\* /; |
|---|
| 244 |
$_ =~ /^((?:(?:const|struct|\*)\s*)*)([^\s]+\*?)\s*([^\s]*)\s*/; |
|---|
| 245 |
my $type = "$1$2"; |
|---|
| 246 |
my $name = "$3"; |
|---|
| 247 |
if(0 == length($name)) { |
|---|
| 248 |
if($argnum == 0 && $type =~ /ath_hal/) { |
|---|
| 249 |
$name = "ah"; |
|---|
| 250 |
} |
|---|
| 251 |
else { |
|---|
| 252 |
$name = "a" . $argnum; |
|---|
| 253 |
} |
|---|
| 254 |
} |
|---|
| 255 |
|
|---|
| 256 |
push @{$hal_parameter_names{$member_name}}, $name; |
|---|
| 257 |
push @{$hal_parameter_types{$member_name}}, $type; |
|---|
| 258 |
$first = 0; |
|---|
| 259 |
$argnum++; |
|---|
| 260 |
} |
|---|
| 261 |
} |
|---|
| 262 |
|
|---|
| 263 |
|
|---|
| 264 |
|
|---|
| 265 |
|
|---|
| 266 |
print ATH_HAL_API_H <<EOF |
|---|
| 267 |
$header_comment |
|---|
| 268 |
|
|---|
| 269 |
|
|---|
| 270 |
|
|---|
| 271 |
|
|---|
| 272 |
|
|---|
| 273 |
EOF |
|---|
| 274 |
; |
|---|
| 275 |
for $member_name (keys %hal_return_types) { |
|---|
| 276 |
my $api_return_type = $hal_return_types{$member_name}; |
|---|
| 277 |
my $api_name = $member_name; |
|---|
| 278 |
if(exists $function_names{$member_name}) { |
|---|
| 279 |
$api_name = $function_names{$member_name}; |
|---|
| 280 |
} |
|---|
| 281 |
print ATH_HAL_API_H "static inline " . $api_return_type . " " . $api_name . "("; |
|---|
| 282 |
my @names = @{$hal_parameter_names{$member_name}}; |
|---|
| 283 |
my @types = @{$hal_parameter_types{$member_name}}; |
|---|
| 284 |
for $i (0..$#names) { |
|---|
| 285 |
if($i) { |
|---|
| 286 |
print ATH_HAL_API_H ", "; |
|---|
| 287 |
} |
|---|
| 288 |
print ATH_HAL_API_H $types[$i] . " " . $names[$i]; |
|---|
| 289 |
} |
|---|
| 290 |
print ATH_HAL_API_H ") {"; |
|---|
| 291 |
print ATH_HAL_API_H "\n\tATH_HAL_LOCK_IRQ(ah);"; |
|---|
| 292 |
print ATH_HAL_API_H "\n\t"; |
|---|
| 293 |
if(! ($api_return_type =~ /void/ )) { |
|---|
| 294 |
print ATH_HAL_API_H $api_return_type . " ret = "; |
|---|
| 295 |
} |
|---|
| 296 |
|
|---|
| 297 |
print ATH_HAL_API_H "ah->$member_name("; |
|---|
| 298 |
for $j (0..$#names) { |
|---|
| 299 |
if($j) { |
|---|
| 300 |
print ATH_HAL_API_H ", "; |
|---|
| 301 |
} |
|---|
| 302 |
print ATH_HAL_API_H $names[$j]; |
|---|
| 303 |
} |
|---|
| 304 |
print ATH_HAL_API_H ");"; |
|---|
| 305 |
print ATH_HAL_API_H "\n\tATH_HAL_UNLOCK_IRQ(ah);"; |
|---|
| 306 |
if(! ($api_return_type =~ /void/ )) { |
|---|
| 307 |
print ATH_HAL_API_H "\n\treturn ret;"; |
|---|
| 308 |
} |
|---|
| 309 |
print ATH_HAL_API_H "\n};\n"; |
|---|
| 310 |
} |
|---|
| 311 |
print ATH_HAL_API_H <<EOF |
|---|
| 312 |
|
|---|
| 313 |
|
|---|
| 314 |
EOF |
|---|
| 315 |
; |
|---|
| 316 |
print %hal_parameter_maps; |
|---|
| 317 |
|
|---|
| 318 |
|
|---|
| 319 |
|
|---|
| 320 |
|
|---|
| 321 |
print ATH_HAL_API_C <<EOF |
|---|
| 322 |
$header_comment |
|---|
| 323 |
|
|---|
| 324 |
|
|---|
| 325 |
|
|---|
| 326 |
|
|---|
| 327 |
|
|---|
| 328 |
|
|---|
| 329 |
|
|---|
| 330 |
|
|---|
| 331 |
|
|---|
| 332 |
|
|---|
| 333 |
|
|---|
| 334 |
|
|---|
| 335 |
|
|---|
| 336 |
|
|---|
| 337 |
|
|---|
| 338 |
|
|---|
| 339 |
|
|---|
| 340 |
|
|---|
| 341 |
|
|---|
| 342 |
|
|---|
| 343 |
|
|---|
| 344 |
|
|---|
| 345 |
|
|---|
| 346 |
EOF |
|---|
| 347 |
; |
|---|
| 348 |
|
|---|
| 349 |
|
|---|
| 350 |
|
|---|
| 351 |
print ATH_HAL_API_C <<EOF |
|---|
| 352 |
|
|---|
| 353 |
|
|---|
| 354 |
EOF |
|---|
| 355 |
; |
|---|
| 356 |
|
|---|
| 357 |
|
|---|
| 358 |
close AH_H; |
|---|
| 359 |
close ATH_HAL_API_H; |
|---|
| 360 |
close ATH_HAL_API_C; |
|---|
| 361 |
|
|---|