3 #define STATUS_IMAGE_CHECKSUM_MISMATCH -199
4 #define EVENT_SIGNALED 1
10 u16CheckSum += (
B_UINT8)~(*pu8Buffer);
19 Status = (Adapter->
gpioBitMap & gpios) ^ gpios;
33 if (num_of_time < 0) {
51 "Led thread got signal to exit..hence exiting");
70 if (bInfinite ==
FALSE)
80 else if ((rate > 3) && (rate <= 100))
82 else if ((rate > 100) && (rate <= 200))
84 else if ((rate > 200) && (rate <= 300))
86 else if ((rate > 300) && (rate <= 400))
88 else if ((rate > 400) && (rate <= 500))
90 else if ((rate > 500) && (rate <= 600))
103 ULONG64 Initial_num_of_packts_tx = 0, Initial_num_of_packts_rx = 0;
105 ULONG64 Final_num_of_packts_tx = 0, Final_num_of_packts_rx = 0;
107 ULONG64 rate_of_transfer_tx = 0, rate_of_transfer_rx = 0;
109 INT num_of_time = 0, num_of_time_tx = 0, num_of_time_rx = 0;
116 Initial_num_of_packts_tx = Adapter->
dev->stats.tx_packets;
117 Initial_num_of_packts_rx = Adapter->
dev->stats.rx_packets;
120 num_of_time_tx = ScaleRateofTransfer((
ULONG)rate_of_transfer_tx);
121 num_of_time_rx = ScaleRateofTransfer((
ULONG)rate_of_transfer_rx);
134 if (num_of_time_tx > num_of_time_rx)
135 num_of_time = num_of_time_rx;
137 num_of_time = num_of_time_tx;
138 if (num_of_time > 0) {
140 if (LED_Blink(Adapter, 1 << GPIO_Num_tx,
141 uiTxLedIndex, timeout,
142 num_of_time, currdriverstate)
146 if (LED_Blink(Adapter, 1 << GPIO_Num_rx,
147 uiRxLedIndex, timeout,
148 num_of_time, currdriverstate)
154 if (num_of_time == num_of_time_tx) {
156 if (LED_Blink(Adapter, (1 << GPIO_Num_rx),
157 uiRxLedIndex, timeout,
158 num_of_time_rx-num_of_time,
163 num_of_time = num_of_time_rx;
166 if (LED_Blink(Adapter, 1 << GPIO_Num_tx,
167 uiTxLedIndex, timeout,
168 num_of_time_tx-num_of_time,
173 num_of_time = num_of_time_tx;
176 if (num_of_time == num_of_time_tx) {
178 if (LED_Blink(Adapter, 1 << GPIO_Num_tx,
179 uiTxLedIndex, timeout,
180 num_of_time, currdriverstate)
185 if (LED_Blink(Adapter, 1 << GPIO_Num_rx,
186 uiRxLedIndex, timeout,
187 num_of_time, currdriverstate)
199 timeout = 100 * remDelay;
209 "Led thread got signal to exit..hence exiting");
226 Final_num_of_packts_tx = Adapter->
dev->stats.tx_packets;
227 Final_num_of_packts_rx = Adapter->
dev->stats.rx_packets;
229 rate_of_transfer_tx = Final_num_of_packts_tx -
230 Initial_num_of_packts_tx;
231 rate_of_transfer_rx = Final_num_of_packts_rx -
232 Initial_num_of_packts_rx;
235 Initial_num_of_packts_tx = Final_num_of_packts_tx;
236 Initial_num_of_packts_rx = Final_num_of_packts_rx;
240 ScaleRateofTransfer((
ULONG)rate_of_transfer_tx);
242 ScaleRateofTransfer((
ULONG)rate_of_transfer_rx);
270 USHORT usChecksumCalculated = 0;
273 "LED Thread:ValidateDSDParamsChecksum: 0x%lx 0x%X",
274 ulParamOffset, usParamLen);
280 "LED Thread: ValidateDSDParamsChecksum Allocation failed");
287 ulParamOffset, usParamLen)) {
290 "LED Thread: ValidateDSDParamsChecksum BeceemNVMRead failed");
296 usChecksumCalculated = CFG_CalculateChecksum(puBuffer, usParamLen);
298 "LED Thread: usCheckSumCalculated = 0x%x\n",
299 usChecksumCalculated);
306 ulParamOffset+usParamLen, 2)) {
309 "LED Thread: ValidateDSDParamsChecksum BeceemNVMRead failed");
313 usChksmOrg =
ntohs(usChksmOrg);
315 "LED Thread: usChksmOrg = 0x%x", usChksmOrg);
321 if (usChecksumCalculated ^ usChksmOrg) {
324 "LED Thread: ValidateDSDParamsChecksum: Checksums don't match");
363 HwParamLen =
ntohs(HwParamLen);
364 if (0 == HwParamLen || HwParamLen > Adapter->
uiNVMDSDSize)
368 "LED Thread:HwParamLen = 0x%x", HwParamLen);
369 Status = ValidateDSDParamsChecksum(Adapter, ulHwParamOffset,
379 ULONG dwReadValue = 0;
381 USHORT usEEPROMVersion = 0;
383 UCHAR ucGPIOInfo[32] = {0};
389 "usEEPROMVersion: Minor:0x%X Major:0x%x",
390 usEEPROMVersion&0xFF, ((usEEPROMVersion>>8)&0xFF));
396 usHwParamData =
ntohs(usHwParamData);
397 dwReadValue = usHwParamData;
403 Status = ValidateDSDParamsChecksum(Adapter,
412 dwReadValue =
ntohl(dwReadValue);
417 "LED Thread: Start address of HW_PARAM structure = 0x%lx",
430 Status = ValidateHWParmStructure(Adapter, dwReadValue);
450 for (ucIndex = 0; ucIndex < 32; ucIndex++) {
452 switch (ucGPIOInfo[ucIndex]) {
475 "GPIO's bit map correspond to LED :0x%X", Adapter->
gpioBitMap);
487 UINT uiNum_of_LED_Type = 0;
500 Status = ReadLEDInformationFromEEPROM(Adapter, GPIO_Array);
502 *bEnableThread =
FALSE;
505 *bEnableThread =
FALSE;
514 "LED Thread: Config file read successfully\n");
533 bData = bData & 0x7f;
537 if (bData <= NUM_OF_LEDS)
557 for (uiIndex = 0; uiIndex <
NUM_OF_LEDS; uiIndex++) {
563 if (uiNum_of_LED_Type >= NUM_OF_LEDS)
564 *bEnableThread =
FALSE;
585 UINT uiResetValue = 0;
590 sizeof(uiResetValue)) < 0)
593 for (uiIndex = 0; uiIndex <
NUM_OF_LEDS; uiIndex++) {
601 sizeof(uiResetValue)) < 0)
617 for (uiIndex = 0; uiIndex <
NUM_OF_LEDS; uiIndex++) {
628 *uiLedTxIndex = uiIndex;
631 *uiLedRxIndex = uiIndex;
641 *uiLedTxIndex = uiIndex;
652 UCHAR uiLedIndex = 0;
653 UINT uiResetValue = 0;
659 UCHAR dummyGPIONum = 0;
660 UCHAR dummyIndex = 0;
691 "Led thread got signal to exit..hence exiting");
702 LedGpioInit(Adapter);
710 BcmGetGPIOPinInfo(Adapter, &GPIO_num, &dummyGPIONum,
711 &uiLedIndex, &dummyIndex, currdriverstate);
724 BcmGetGPIOPinInfo(Adapter, &GPIO_num, &dummyGPIONum,
725 &uiLedIndex, &dummyIndex, currdriverstate);
729 LED_Blink(Adapter, 1 << GPIO_num, uiLedIndex,
730 timeout, -1, currdriverstate);
735 BcmGetGPIOPinInfo(Adapter, &GPIO_num, &dummyGPIONum,
736 &uiLedIndex, &dummyIndex, currdriverstate);
748 BcmGetGPIOPinInfo(Adapter, &GPIO_num, &dummyGPIONum,
749 &uiLedIndex, &dummyGPIONum, currdriverstate);
762 BcmGetGPIOPinInfo(Adapter, &GPIO_num_tx,
763 &GPIO_num_rx, &uiLEDTx, &uiLEDRx,
775 GPIO_num_tx = GPIO_num_rx;
777 }
else if (GPIO_num_rx ==
779 GPIO_num_rx = GPIO_num_tx;
786 LED_Proportional_Blink(Adapter,
787 GPIO_num_tx, uiLEDTx,
788 GPIO_num_rx, uiLEDRx,
799 for (uiIndex = 0; uiIndex <
NUM_OF_LEDS; uiIndex++) {
820 for (uiIndex = 0; uiIndex <
NUM_OF_LEDS; uiIndex++) {
835 for (uiIndex = 0; uiIndex <
NUM_OF_LEDS; uiIndex++) {
871 for (uiIndex = 0; uiIndex <
NUM_OF_LEDS; uiIndex++)
878 Status = ReadConfigFileStructure(Adapter, &bEnableThread);
882 "LED Thread: FAILED in ReadConfigFileStructure\n");
896 }
else if (bEnableThread) {
905 Adapter,
"led_control_thread");
909 "Not able to spawn Kernel Thread\n");