RDK-B
platform_hal.h
Go to the documentation of this file.
1 /*
2  * If not stated otherwise in this file or this component's LICENSE file the
3  * following copyright and licenses apply:
4  *
5  * Copyright 2016 RDK Management
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18 */
19 
20 /**********************************************************************
21  Copyright [2014] [Cisco Systems, Inc.]
22 
23  Licensed under the Apache License, Version 2.0 (the "License");
24  you may not use this file except in compliance with the License.
25  You may obtain a copy of the License at
26 
27  http://www.apache.org/licenses/LICENSE-2.0
28 
29  Unless required by applicable law or agreed to in writing, software
30  distributed under the License is distributed on an "AS IS" BASIS,
31  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
32  See the License for the specific language governing permissions and
33  limitations under the License.
34 **********************************************************************/
35 
36 /**********************************************************************
37 
38  module: platform_hal.h
39 
40  For CCSP Component: CcspCMAgent
41 
42  ---------------------------------------------------------------
43 
44  description:
45 
46  This header file gives the function call prototypes and
47  structure definitions used for the RDK-Broadband
48  hardware abstraction layer for platform
49 
50  ---------------------------------------------------------------
51 
52  environment:
53 
54  This HAL layer is intended to support platform drivers
55  through an open API.
56  Changes may be needed to support different hardware enviornments.
57 
58  ---------------------------------------------------------------
59 
60  author:
61 
62  Cisco
63 
64 **********************************************************************/
65 /**
66 * @file platform_hal.h
67 * @author Cisco
68 * @brief For CCSP Component: CcspPandM
69 *
70 * @description This header file gives the function call prototypes and structure definitions used for the RDK-Broadband hardware abstraction layer for platform.
71 */
72 
73 
74 #ifndef __PLATFORM_HAL_H__
75 #define __PLATFORM_HAL_H__
76 
77 /**
78 * @defgroup platform_hal Platform HAL
79 *
80 * @defgroup PLATFORM_HAL_TYPES Platform HAL Data Types
81 * @ingroup platform_hal
82 *
83 * @defgroup PLATFORM_HAL_APIS Platform HAL APIs
84 * @ingroup platform_hal
85 *
86 **/
87 
88 
89 /**
90  * @addtogroup PLATFORM_HAL_TYPES
91  * @{
92  */
93 
94 
95 /**********************************************************************
96  CONSTANT DEFINITIONS
97 **********************************************************************/
98 #ifdef __cplusplus
99 extern "C"{
100 #endif
101 
102 #ifndef CHAR
103 #define CHAR char
104 #endif
105 
106 #ifndef UCHAR
107 #define UCHAR unsigned char
108 #endif
109 
110 #ifndef BOOLEAN
111 #define BOOLEAN unsigned char
112 #endif
113 
114 #ifndef INT
115 #define INT int
116 #endif
117 
118 #ifndef UINT
119 #define UINT unsigned int
120 #endif
121 
122 #ifndef ULONG
123 #define ULONG unsigned long
124 #endif
125 
126 #ifndef TRUE
127 #define TRUE 1
128 #endif
129 
130 #ifndef FALSE
131 #define FALSE 0
132 #endif
133 
134 #ifndef ENABLE
135 #define ENABLE 1
136 #endif
137 
138 #ifndef RETURN_OK
139 #define RETURN_OK 0
140 #endif
141 
142 #ifndef RETURN_ERR
143 #define RETURN_ERR -1
144 #endif
145 
146 /**
147  * @}
148  */
149 
150 //DHCPv6 Options
151 #define DHCPV6_OPT_82 82 // OPTION_SOL_MAX_RT: Solicite Maximum Retry Time
152 #define DHCPV6_OPT_23 23 // OPTION_SOL_MAX_RT: Solicite Maximum Retry Time
153 #define DHCPV6_OPT_95 95 // OPTION_SOL_MAX_RT: Solicite Maximum Retry Time
154 #define DHCPV6_OPT_24 24 // OPTION_DOMAIN_LIST
155 #define DHCPV6_OPT_83 83 // OPTION_INF_MAX_RT
156 #define DHCPV6_OPT_17 17 // OPTION_VENDOR_OPTS
157 #define DHCPV6_OPT_31 31 // OPTION_SNTP_SERVERS
158 #define DHCPV6_OPT_15 15 // User Class Option
159 #define DHCPV6_OPT_16 16 // Vendor Class Option
160 #define DHCPV6_OPT_20 20 // Reconfigure Accept Option
161 
162 
163 //DHCPv4 Options
164 #define DHCPV4_OPT_42 42 // NTP Server Addresses
165 #define DHCPV4_OPT_43 43 // Vendor Specific Information
166 #define DHCPV4_OPT_58 58 // DHCP Renewal (T1) Time
167 #define DHCPV4_OPT_59 59 // DHCP Rebinding (T2) Time
168 #define DHCPV4_OPT_60 60 // Class Identifier
169 #define DHCPV4_OPT_61 61 // Client Identifier
170 #define DHCPV4_OPT_100 100 // IEEE 1003.1 TZ String
171 #define DHCPV4_OPT_122 122 // CableLabs Client Configuration
172 #define DHCPV4_OPT_125 125 // Vendor-Identifying Vendor-Specific Information
173 #define DHCPV4_OPT_242 242 // Private Use
174 #define DHCPV4_OPT_243 243 // Private Use
175 #define DHCPV4_OPT_END 255 // DHCP Option End - used to check if option is valid
176 
177 /**********************************************************************
178  ENUMERATION DEFINITIONS
179 **********************************************************************/
180 
181 typedef enum {
182  HOST_CPU=0,
183  PEER_CPU=1,
185 } RDK_CPUS; // RDK_CPUS
186 
187 #ifndef PLAT_PROC_MEM_MAX_LEN
188 #define PLAT_PROC_MEM_MAX_LEN 40
189 #endif
190 
191 /**********************************************************************
192  STRUCTURE DEFINITIONS
193 **********************************************************************/
194 typedef struct
196 {
197  CHAR dramPath[PLAT_PROC_MEM_MAX_LEN];
198  CHAR emmcPath1[PLAT_PROC_MEM_MAX_LEN];
201 }
203 
204 /**
205  * @addtogroup PLATFORM_HAL_APIS
206  * @{
207  */
208 
209 /**********************************************************************************
210  *
211  * Subsystem level function prototypes
212  *
213 **********************************************************************************/
214 /* platform_hal_GetDeviceConfigStatus() function */
215 /**
216 * @description Get the device configuration status
217 *
218 * @param pValue - Device Configuration status, to be returned
219 *
220 * @return The status of the operation
221 * @retval RETURN_OK if successful
222 * @retval RETURN_ERR if any error is detected
223 *
224 * @sideeffect None
225 */
227 
228 /* platform_hal_GetTelnetEnable() function */
229 /**
230 * @description Get telnet enable status
231 *
232 * @param pFlag - Telnet enable value, to be returned
233 *
234 * @return The status of the operation
235 * @retval RETURN_OK if successful
236 * @retval RETURN_ERR if any error is detected
237 *
238 * @sideeffect None
239 */
241 
242 /* platform_hal_SetTelnetEnable() function */
243 /**
244 * @description Enable/Disable telnet
245 *
246 * @param Flag - Telnet enable value
247 *
248 * @return The status of the operation
249 * @retval RETURN_OK if successful
250 * @retval RETURN_ERR if any error is detected
251 *
252 * @sideeffect None
253 */
255 
256 /* platform_hal_GetSSHEnable() function */
257 /**
258 * @description Get SSH enable status
259 *
260 * @param pFlag - SSH enable value, to be returned
261 *
262 * @return The status of the operation
263 * @retval RETURN_OK if successful
264 * @retval RETURN_ERR if any error is detected
265 *
266 * @sideeffect None
267 */
269 
270 /* platform_hal_SetSSHEnable() function */
271 /**
272 * @description Enable/diable SSH
273 *
274 * @param Flag - SSH enable value
275 *
276 * @return The status of the operation
277 * @retval RETURN_OK if successful
278 * @retval RETURN_ERR if any error is detected
279 *
280 * @sideeffect None
281 */
283 
284 /* platform_hal_GetSNMPEnable() function */
285 /**
286 * @description Get SNMP Enable value from the device
287 *
288 * @param pValue - SNMP enable value, to be returned
289 *
290 * @return The status of the operation
291 * @retval RETURN_OK if successful
292 * @retval RETURN_ERR if any error is detected
293 *
294 * @sideeffect None
295 */
297 
298 /* platform_hal_SetSNMPEnable() function */
299 /**
300 * @description Set SNMP Enable value
301 *
302 * @param pValue - SNMP enable value
303 *
304 * @return The status of the operation
305 * @retval RETURN_OK if successful
306 * @retval RETURN_ERR if any error is detected
307 *
308 * @sideeffect None
309 */
311 
312 /* platform_hal_GetWebUITimeout() function */
313 /**
314 * @description Get WebUI timeout value
315 *
316 * @param pValue - WebUI timeout value, to be returned
317 *
318 * @return The status of the operation
319 * @retval RETURN_OK if successful
320 * @retval RETURN_ERR if any error is detected
321 *
322 * @sideeffect None
323 */
325 
326 /* platform_hal_SetWebUITimeout() function */
327 /**
328 * @description Set WebUI timeout value
329 *
330 * @param value - WebUI timeout value
331 *
332 * @return The status of the operation
333 * @retval RETURN_OK if successful
334 * @retval RETURN_ERR if any error is detected
335 *
336 * @sideeffect None
337 */
339 
340 /* platform_hal_GetWebAccessLevel() function */
341 /**
342 * @description Get Web Access Level
343 *
344 * @param userIndex - User Index
345 * @param ifIndex - Interface Index
346 * @param pValue - Web Access Level, to be returned
347 *
348 * @return The status of the operation
349 * @retval RETURN_OK if successful
350 * @retval RETURN_ERR if any error is detected
351 *
352 * @sideeffect None
353 */
354 INT platform_hal_GetWebAccessLevel(INT userIndex, INT ifIndex, ULONG *pValue);
355 
356 /* platform_hal_SetWebAccessLevel() function */
357 /**
358 * @description Set Web Access Level
359 *
360 * @param userIndex - User Index
361 * @param ifIndex - Interface Index
362 * @param value - Web Access Level
363 *
364 * <table>
365 * <caption id="multi_row">Lan Level Vs Index table</caption>
366 * <tr><th>Lan Level <th>User Index <th>Interface Index
367 * <tr><td>HomeUser_Lan_Level <td>1 <td>1
368 * <tr><td>HomeUser_RfCM_Level <td>1 <td>2
369 * <tr><td>HomeUser_Mta_Level <td>1 <td>16
370 * <tr><td>HomeUser_WanRG_Level <td>1 <td>40
371 * <tr><td>CusAdmin_Lan_Level <td>5 <td>1
372 * <tr><td>CusAdmin_RfCM_Level <td>5 <td>2
373 * <tr><td>CusAdmin_Mta_Level <td>5 <td>16
374 * <tr><td>CusAdmin_WanRG_Level <td>5 <td>40
375 * <tr><td>AdvUser_Lan_Level <td>10 <td>1
376 * <tr><td>AdvUser_RfCM_Level <td>10 <td>2
377 * <tr><td>AdvUser_Mta_Level <td>10 <td>16
378 * <tr><td>AdvUser_WanRG_Level <td>10 <td>40
379 * </table>
380 *
381 * @return The status of the operation
382 * @retval RETURN_OK if successful
383 * @retval RETURN_ERR if any error is detected
384 *
385 * @sideeffect None
386 */
387 INT platform_hal_SetWebAccessLevel(INT userIndex, INT ifIndex, ULONG value);
388 
389 /* platform_hal_PandMDBInit() function */
390 /**
391 * @description Initialize PandM DB (Database)
392 *
393 * @param None
394 *
395 * @return The status of the operation
396 * @retval RETURN_OK if successful
397 * @retval RETURN_ERR if any error is detected
398 *
399 * @sideeffect None
400 */
402 
403 /* platform_hal_DocsisParamsDBInit() function */
404 /**
405 * @description Initialize Platform HAL docsis parameters DB
406 *
407 * @param None
408 *
409 * @return The status of the operation
410 * @retval RETURN_OK if successful
411 * @retval RETURN_ERR if any error is detected
412 *
413 * @sideeffect None
414 */
416 
417 /* platform_hal_GetModelName() function */
418 /**
419 * @description Get device model name
420 *
421 * @param pValue - Device Model Name, to be returned
422 *
423 * @return The status of the operation
424 * @retval RETURN_OK if successful
425 * @retval RETURN_ERR if any error is detected
426 *
427 * @sideeffect None
428 */
430 
431 /* platform_hal_GetRouterRegion() function */
432 /**
433 * @description Get router region
434 *
435 * @param pValue - Router region name, to be returned
436 *
437 * @return The status of the operation
438 * @retval RETURN_OK if successful
439 * @retval RETURN_ERR if any error is detected
440 *
441 * @sideeffect None
442 */
444 
445 /* platform_hal_GetSerialNumber() function */
446 /**
447 * @description Get device serial number
448 *
449 * @param pValue - Device Serial Number, to be returned
450 *
451 * @return The status of the operation
452 * @retval RETURN_OK if successful
453 * @retval RETURN_ERR if any error is detected
454 *
455 * @sideeffect None
456 */
458 
459 /* platform_hal_GetHardwareVersion() function */
460 /**
461 * @description Get hardware version of the device
462 *
463 * @param pValue - Hardware version, to be returned
464 *
465 * @return The status of the operation
466 * @retval RETURN_OK if successful
467 * @retval RETURN_ERR if any error is detected
468 *
469 * @sideeffect None
470 */
472 
473 /* platform_hal_GetSoftwareVersion() function */
474 /**
475 * @description Get software version flashed in the device
476 *
477 * @param pValue - Software version, to be returned
478 * @param maxSize - Maximum size of the Software version string
479 *
480 * @return The status of the operation
481 * @retval RETURN_OK if successful
482 * @retval RETURN_ERR if any error is detected
483 *
484 * @sideeffect None
485 */
487 
488 /* platform_hal_GetBootloaderVersion() function */
489 /**
490 * @description Get bootloader version flashed in the device
491 *
492 * @param pValue - Bootloader version, to be returned
493 * @param maxSize - Maximum size of the bootloader version string
494 *
495 * @return The status of the operation
496 * @retval RETURN_OK if successful
497 * @retval RETURN_ERR if any error is detected
498 *
499 * @sideeffect None
500 */
502 
503 /* platform_hal_GetFirmwareName() function */
504 /**
505 * @description Get firmware image name flashed in the device
506 *
507 * @param pValue - Firmware image name, to be returned
508 * @param maxSize - Maximum size of the bootloader version string
509 *
510 * @return The status of the operation
511 * @retval RETURN_OK if successful
512 * @retval RETURN_ERR if any error is detected
513 *
514 * @sideeffect None
515 */
516 INT platform_hal_GetFirmwareName(CHAR* pValue, ULONG maxSize);
517 
518 /* platform_hal_GetBaseMacAddress() function */
519 /**
520 * @description Get base MAC Address of the device
521 *
522 * @param pValue - Base MAC Address, to be returned
523 *
524 * @return The status of the operation
525 * @retval RETURN_OK if successful
526 * @retval RETURN_ERR if any error is detected
527 *
528 * @sideeffect None
529 */
531 
532 /* platform_hal_GetHardware() function */
533 /**
534 * @description Get total flash size of the hardware
535 *
536 * @param pValue - Total flash size, to be returned
537 *
538 * @return The status of the operation
539 * @retval RETURN_OK if successful
540 * @retval RETURN_ERR if any error is detected
541 *
542 * @sideeffect None
543 */
545 
546 /* platform_hal_GetHardware_MemUsed() function */
547 /**
548 * @description Get total used memory of the flash
549 *
550 * @param pValue - Total used memory, to be returned
551 *
552 * @return The status of the operation
553 * @retval RETURN_OK if successful
554 * @retval RETURN_ERR if any error is detected
555 *
556 * @sideeffect None
557 */
559 
560 /* platform_hal_GetHardware_MemFree() function */
561 /**
562 * @description Get total availabe memory of the flash
563 *
564 * @param pValue - Total available memory, to be returned
565 *
566 * @return The status of the operation
567 * @retval RETURN_OK if successful
568 * @retval RETURN_ERR if any error is detected
569 *
570 * @sideeffect None
571 */
573 
574 /* platform_hal_GetTotalMemorySize() function */
575 /**
576 * @description Get total memory size of the DRAM (Dynamic Random Access Memory)
577 *
578 * @param pulSize - Total memory size of DRAM, to be returned
579 *
580 * @return The status of the operation
581 * @retval RETURN_OK if successful
582 * @retval RETURN_ERR if any error is detected
583 *
584 * @sideeffect None
585 */
587 
588 /* platform_hal_GetUsedMemorySize() function */
589 /**
590 * @description Get total used memory of the DRAM (Dynamic Random Access Memory)
591 *
592 * @param pulSize - Total used memory of DRAM, to be returned
593 *
594 * @return The status of the operation
595 * @retval RETURN_OK if successful
596 * @retval RETURN_ERR if any error is detected
597 *
598 * @sideeffect None
599 */
601 
602 /* platform_hal_GetFreeMemorySize() function */
603 /**
604 * @description Get total available memory of the DRAM (Dynamic Random Access Memory)
605 *
606 * @param pulSize - Total available memory of DRAM, to be returned
607 *
608 * @return The status of the operation
609 * @retval RETURN_OK if successful
610 * @retval RETURN_ERR if any error is detected
611 *
612 * @sideeffect None
613 */
615 
616 /* platform_hal_GetFactoryResetCount() function */
617 /**
618 * @description Get total number of times factory reset has been done on the device
619 * \n Device.DeviceInfo.FactoryResetCount
620 *
621 * @param pulSize - Factory reset count, to be returned
622 *
623 * @return The status of the operation
624 * @retval RETURN_OK if successful
625 * @retval RETURN_ERR if any error is detected
626 *
627 * @sideeffect None
628 */
630 
631 /* platform_hal_ClearResetCount() function */
632 /**
633 * @description Reset factory reset count on the device
634 * \n Device.DeviceInfo.ClearResetCount
635 *
636 * @param bFlag - Reset Factory reset count, if TRUE
637 *
638 * @return The status of the operation
639 * @retval RETURN_OK if successful
640 * @retval RETURN_ERR if any error is detected
641 *
642 * @sideeffect None
643 */
645 
646 /* platform_hal_getTimeOffSet() function */
647 /**
648 * @description Get time offset from the device
649 * \n Device.DeviceInfo.TimeOffset
650 *
651 * @param timeOffSet - Time offset, to be returned
652 *
653 * @return The status of the operation
654 * @retval RETURN_OK if successful
655 * @retval RETURN_ERR if any error is detected
656 *
657 * @sideeffect None
658 */
659 INT platform_hal_getTimeOffSet(CHAR *timeOffSet);
660 
661 /* platform_hal_SetDeviceCodeImageTimeout() function */
662 /**
663 * @description Set HW watchdog timeout value. Default value is 60 minutes.
664 *
665 * @param seconds - Hardware watchdog timeout value in seconds
666 *
667 * @return The status of the operation
668 * @retval RETURN_OK if successful
669 * @retval RETURN_ERR if any error is detected
670 *
671 * @sideeffect None
672 */
674 
675 /* platform_hal_SetDeviceCodeImageValid() function */
676 /**
677 * @description Set Valid flag for firmware image flashed in the device.
678 *
679 * @param flag - Image valid flag
680 *
681 * @return The status of the operation
682 * @retval RETURN_OK if successful
683 * @retval RETURN_ERR if any error is detected
684 *
685 * @sideeffect None
686 */
688 /* platform_hal_getFactoryPartnerId function */
689 /**
690 * @description Get FactoryPartnerID from the the device.
691 *
692 * @return The status of the operation
693 * @retval RETURN_OK if successful
694 * @retval RETURN_ERR if any error is detected
695 *
696 * @sideeffect None
697 */
699 
700 /* platform_hal_getFactoryCmVariant function */
701 /**
702 * @description Get FactoryCmVariant from the the device.
703 *
704 * @return The status of the operation
705 * @retval RETURN_OK if successful
706 * @retval RETURN_ERR if any error is detected
707 *
708 * @sideeffect None
709 */
711 
712 /* platform_hal_setFactoryCmVariant function */
713 /**
714 * @description Set FactoryCmVariant from the the device.
715 *
716 * @return The status of the operation
717 * @retval RETURN_OK if successful
718 * @retval RETURN_ERR if any error is detected
719 *
720 * @sideeffect None
721 */
723 
724 /**
725  * @addtogroup PLATFORM_HAL_TYPES
726  * @{
727  */
728 
729 #define LED_BUFFER_SIZE 3
730 
731 typedef enum {
733  LED_YELLOW=1, //This is also classified as Amber from RDKB perspective
740 } LED_COLOR; // LED_COLOR
741 
742 
743 typedef struct _LEDMGMT_PARAMS
744 {
745 #ifdef FEATURE_RDKB_LED_MANAGER
746  char * led_name;
747  char * led_param;
748 #endif
749  LED_COLOR LedColor; //!< LED_COLOR
750  INT State; //!< 0 for Solid, 1 for Blink
751  INT Interval; //!< In case fs State is blink then interval per second
752 }
754 
755 /**
756  * @}
757  */
758 
759 /**
760  * @addtogroup PLATFORM_HAL_APIS
761  * @{
762  */
763 
764 #ifdef FEATURE_RDKB_LED_MANAGER
765 /* platfom_hal_initLed : */
766 /**
767 * @description: Initialises HAL layer and return file pointer to config file
768 *
769 * @param buffer to hold the config file path
770 * @return returns status on successful initialisation
771 * @retval RETURN_OK if successful
772 * @retval RETURN_ERR if any error is detected
773 */
774 int platform_hal_initLed (char * config_file_name);
775 #endif
776 
777 /* platform_hal_setLed function */
778 /**
779 * @description Set Led behavior of the device
780 *
781 * @param LED identification and control parameters
782 * @return The status of the operation
783 * @retval RETURN_OK if successful
784 * @retval RETURN_ERR if any error is detected
785 *
786 * @sideeffect None
787 */
789 
790 /* platform_hal_getLed function */
791 /**
792 * @description Get Led behavior of the device at time of call
793 *
794 * @pValue The Current Led Buffer to be populated
795 * @return The status of the operation
796 * @retval RETURN_OK if successful
797 * @retval RETURN_ERR if any error is detected
798 *
799 * @sideeffect None
800 */
802 
803 
804 /* platform_hal_getFanSpeed function */
805 /**
806 * @description Get the fan speed in RPMs
807 *
808 * @param fanIndex - Fan index starting from 0.
809 * @return FanSpeed in unsigned int
810 */
812 
813 
814 /* platform_hal_getFanRPM fuction */
815 /**
816 * @description Get the fan speed
817 *
818 * @param fanIndex - Fan index starting from 0.
819 * @return FanRPM in unsigned int
820 */
821 UINT platform_hal_getRPM(UINT fanIndex);
822 
823 
824 /* platform_hal_getRotorLock function */
825 /**
826 * @description Get the status of rotor lock
827 *
828 * @param fanIndex - Fan index starting from 0.
829 * @return The status of the rotor lock
830 * @rtnval 1 if locked
831 * @rtnval 0 if not locked
832 * @rtnval -1 if value not applicable
833 */
835 
836 
837 /* platform_hal_getFanStatus function */
838 /**
839 * @description Get the fan status
840 *
841 * @param fanIndex - Fan index starting from 0.
842 * @return the fan status
843 * @rtnval 1 if fan is enabled
844 * @rtnval 0 if fan disabled
845 */
847 
848 /* platform_hal_setFanMaxOverride function */
849 /**
850 * @description Set the fax to maximum speed
851 *
852 * @param bOverrideFlag - Boolean value to enable/disalbe fan tur run in highspeed
853 *
854 * @return RETURN_OK on success setting/unsetting the fan to run in high speed mode
855 */
856 INT platform_hal_setFanMaxOverride(BOOLEAN bOverrideFlag, UINT fanIndex);
857 
858 #ifdef FEATURE_RDKB_THERMAL_MANAGER
859 typedef enum {
860  FAN_SPEED_OFF=0,
861  FAN_SPEED_SLOW=1,
862  FAN_SPEED_MEDIUM=2,
863  FAN_SPEED_FAST=3,
864  FAN_SPEED_MAX=4
865 } FAN_SPEED; // Fan speed
866 
867 
868 
869 typedef struct _FAN_PLATFORM_CONFIG
870 {
871  UINT FanCount;
872  UINT SlowSpeedThresh;
873  UINT MediumSpeedThresh;
874  UINT FastSpeedThresh;
875  UINT FanMinRunTime;
876  UINT MonitoringDelay;
877  UINT PowerMonitoring;
878 } THERMAL_PLATFORM_CONFIG;
879 
880 
881 
882 /* platform_hal_initThermal() function */
883 /**
884 * @description initialise Thermal Hal
885 *
886 * @param pThermalPlatformConfig - Pointer to platforms thermal configuration
887 *
888 * @return RETURN_OK on successful initialisation
889 */
890 INT platform_hal_initThermal(THERMAL_PLATFORM_CONFIG* pThermalPlatformConfig);
891 
892 /* platform_hal_LoadThermalConfig() function */
893 /**
894 * @description Loas default Thermal Hal thresholds
895 *
896 * @param pThermalPlatformConfig - Pointer to platforms thermal configuration
897 *
898 * @return RETURN_OK on successful initialisation
899 */
900 INT platform_hal_LoadThermalConfig (THERMAL_PLATFORM_CONFIG* pThermalPlatformConfig);
901 
902 typedef enum {
903  FAN_ERR_NONE = 0,
904  FAN_ERR_HW = 1,
905  FAN_ERR_MAX_OVERRIDE_SET = 2
906 } FAN_ERR; // Fan errors
907 
908 
909 
910 /* platform_hal_setFanSpeed() function */
911 /**
912 * @description Set the fan speed
913 *
914 * @param fanIndex - fan index
915 * @param fanSpeed - Off, Slow, medium or fast
916 * @param pErrReason - Pointer where to provide error status
917 *
918 * @return RETURN_OK on success setting fan speed
919 */
920 INT platform_hal_setFanSpeed(UINT fanIndex, FAN_SPEED fanSpeed, FAN_ERR* pErrReason);
921 
922 
923 
924 /* platform_hal_getFanTemperature() function */
925 /**
926 * @description Get current device temperature reading
927 *
928 * @param pTemp - Pointer where to provide temperature reading
929 *
930 * @return RETURN_OK on success reading temperature
931 */
932 INT platform_hal_getFanTemperature(int* pTemp);
933 
934 
935 /* platform_hal_getInputCurrent() */
936 /**
937 * @description To get input current
938 *
939 * @retval RETURN_OK if successful
940 * @retval RETURN_ERR if any error is detected
941 */
942 
943 INT platform_hal_getInputCurrent(INT *pValue);
944 
945 /* platform_hal_getInputPower() */
946 /**
947 * @description To get input power
948 *
949 * @retval RETURN_OK if successful
950 * @retval RETURN_ERR if any error is detected
951 */
952 
953 INT platform_hal_getInputPower(INT *pValue);
954 
955 /* platform_hal_getRadioTemperature() */
956 /**
957 * @description To get Radio Temperature
958 *
959 * @retval RETURN_OK if successful
960 * @retval RETURN_ERR if any error is detected
961 */
962 
963 INT platform_hal_getRadioTemperature(INT radioIndex, INT* pValue);
964 
965 #endif
966 
967 /* platform_hal_SetSNMPOnboardRebootEnable() function */
968 /**
969 * @description Set SNMP Onboard Reboot Enable value
970 * to allow or ignore SNMP reboot
971 *
972 * @param pValue - SNMP Onboard Reboot Enable value ("disable", "enable")
973 *
974 * @return The status of the operation
975 * @retval RETURN_OK if successful
976 * @retval RETURN_ERR if any error is detected
977 */
979 
980 /* platform_hal_GetMACsecEnable() function */
981 /**
982 * @description Get MACsec enable status
983 *
984 * @param ethPort - Ethernet port (zero-based)
985 * @param pFlag - MACsec enable value, to be returned
986 *
987 * @return The status of the operation
988 * @retval RETURN_OK if successful
989 * @retval RETURN_ERR if any error is detected
990 */
992 
993 
994 /* platform_hal_SetMACsecEnable() function */
995 /**
996 * @description Enable/Disable MACsec
997 *
998 * @param ethPort - Ethernet port (zero-based)
999 * @param Flag - MACsec enable value
1000 *
1001 * @return The status of the operation
1002 * @retval RETURN_OK if successful
1003 * @retval RETURN_ERR if any error is detected
1004 */
1006 
1007 
1008 /* platform_hal_GetMACsecOperationalStatus() function */
1009 /**
1010 * @description Get MACsec operation status
1011 *
1012 * @param ethPort - Ethernet port (zero-based)
1013 * @param pFlag - MACsec operation status value, to be returned
1014 *
1015 * @return The status of the operation
1016 * @retval RETURN_OK if successful
1017 * @retval RETURN_ERR if any error is detected
1018 */
1020 
1021 /* platform_hal_StartMACsec() function */
1022 /**
1023 * @description Start MACsec - Call should be Blocking
1024 *
1025 * @param ethPort - Ethernet port (zero-based)
1026 * @param timeoutSec - MACsec Start Timeout (0 means retry forever)
1027 *
1028 * @return The status of the operation
1029 * @retval RETURN_OK if successful
1030 * @retval RETURN_ERR if any error is detected
1031 */
1032 INT platform_hal_StartMACsec(INT ethPort, INT timeoutSec);
1033 
1034 /* platform_hal_StopMACsec() function */
1035 /**
1036 * @description Stop MACsec - Call should be Blocking
1037 *
1038 * @param ethPort - Ethernet port (zero-based)
1039 *
1040 * @return The status of the operation
1041 * @retval RETURN_OK if successful
1042 * @retval RETURN_ERR if any error is detected
1043 */
1045 
1046 /* platform_hal_GetMemoryPaths() function : */
1047 /**
1048 *@description Get the device specific processors DRAM and eMMC paths
1049 * @param RDK_CPUS index - Index to which processor/CPU to request. Host is the primary RDK CPU
1050 * @param PPLAT_PROC_MEM_INFO *ppinfo - Ponter to get the return array
1051 * @return The status of the operation.
1052 * @retval RETURN_OK if successful.
1053 * @retval RETURN_ERR if any error is detected
1054 *
1055 * @execution Synchronous.
1056 * @sideeffect None.
1057 *
1058 * @note HAL function need to allocate the array of PPLAT_PROC_MEM_INFO and return with ppinfo.
1059 *
1060 */
1062 
1063 /*
1064  * dhcpv4_req_opt_to_hal - is used to fill options to request values
1065  * from platform
1066  */
1067 
1068 typedef struct dhcp_opt_list {
1072 } dhcp_opt_list;
1073 
1074 /*
1075  * platform_hal_GetDhcpv4Options ()
1076  * @description: This function fills in 2 list, 1 for request option and 1 for send option.
1077  * @params : v4_req_opt_list - list to be filled for request dhcp options
1078  * v4_send_opt_list - list to be filled for send dhcp options
1079  * @return : RETURN_OK for success or RETURN_ERR for failure
1080  *
1081  */
1082 INT platform_hal_GetDhcpv4_Options ( dhcp_opt_list ** req_opt_list, dhcp_opt_list ** send_opt_list);
1083 
1084 /*
1085  * platform_hal_GetDhcpv6Options ()
1086  * @description: This function fills in 2 list, 1 for request option and 1 for send option.
1087  * @params : v6_req_opt_list - list to be filled for request dhcp options
1088  * v6_send_opt_list - list to be filled for send dhcp options
1089  * @return : RETURN_OK for success or RETURN_ERR for failure
1090  *
1091  */
1092 INT platform_hal_GetDhcpv6_Options ( dhcp_opt_list ** req_opt_list, dhcp_opt_list ** send_opt_list);
1093 
1094 typedef enum {
1101 } PSM_STATE, *PPSM_STATE; // Power Saving Mode State
1102 
1103 /* platform_hal_SetLowPowerModeState() function */
1104 /**
1105 * @description Set Low Power Mode State value. Hysteresis currently not accounted for before call.
1106 *
1107 * @param seconds - Low Power Mode State.
1108 *
1109 * @return The status of the operation
1110 * @retval RETURN_OK if successful
1111 * @retval RETURN_ERR if any error is detected
1112 *
1113 * @sideeffect None
1114 */
1116 
1118 
1119 
1120 typedef enum {
1122  EWAN=2,
1123 } WAN_INTERFACE;
1124 
1125 typedef enum {
1129 
1130 typedef struct Traffic_client {
1131  char mac[18]; // e.g. 00:AA:BB:CC:DD:EE
1135 
1136 typedef struct DSCP_Element {
1141 
1142 typedef struct DSCP_list {
1146 
1147 /* platform_hal_setDscp() */
1148 /**
1149 * @description Control/Set traffic counting based on Dscp value
1150 *
1151 * @param interfaceType - 1 for DOCSIS , 2 for EWAN
1152 * @param cmd - START/STOP
1153 * @param dscpVal comma seperated string , e.g. "10,0" , NULL
1154 * NULL is for all DSCP values , values are base 10
1155 *
1156 * @retval RETURN_OK if successful
1157 * @retval RETURN_ERR if any error is detected
1158 */
1159 INT platform_hal_setDscp(WAN_INTERFACE interfaceType , TRAFFIC_CNT_COMMAND cmd , char* pDscpVals);
1160 
1161 /* platform_hal_resetDscpCounts() */
1162 /**
1163 * @description To reset Dscp Counter values
1164 *
1165 * @param interfaceType - 1 for DOCSIS , 2 for EWAN
1166 *
1167 * @retval RETURN_OK if successful
1168 * @retval RETURN_ERR if any error is detected
1169 */
1171 
1172 /* platform_hal_getDscpClientList() */
1173 /**
1174 * @description To get counter data
1175 * e.g. DSCP_list_t DSCP_List;
1176 * platform_hal_getDscpClientList(DOCSIS,&DSCP_List);
1177 * DSCP_List should be filled by hal.
1178 *
1179 * @param interfaceType - 1 for DOCSIS , 2 for EWAN
1180 * @param pDSCP_List - List of client structure to be filled by hal
1181 *
1182 */
1183 INT platform_hal_getDscpClientList(WAN_INTERFACE interfaceType , pDSCP_list_t pDSCP_List);
1184 
1185 
1186 /* INT platform_hal_GetCPUSpeed() function */
1187 /**
1188 * @description get cpu speed.
1189 *
1190 * @param cpuSpeed - store cpu speed
1191 *
1192 * @return The status of the operation
1193 * @retval RETURN_OK if successful
1194 * @retval RETURN_ERR if any error is detected
1195 *
1196 * @sideeffect None
1197 */
1198 INT platform_hal_GetCPUSpeed(char *cpuSpeed);
1199 
1200 
1201 #ifdef __cplusplus
1202 }
1203 #endif
1204 
1205 #endif
1206 
1207 /**
1208  * @}
1209  */
1210 
1211 
platform_hal_GetHardware
int platform_hal_GetHardware(char *pValue)
PEER_CPU
@ PEER_CPU
Definition: platform_hal.h:185
platform_hal_getRotorLock
int platform_hal_getRotorLock(unsigned int fanIndex)
_LEDMGMT_PARAMS::State
int State
0 for Solid, 1 for Blink
Definition: platform_hal.h:750
DSCP_Element::Client
Traffic_client_t Client[256]
Definition: platform_hal.h:1139
Traffic_client::txBytes
unsigned long txBytes
Definition: platform_hal.h:1133
platform_hal_GetCPUSpeed
int platform_hal_GetCPUSpeed(char *cpuSpeed)
platform_hal_GetWebUITimeout
int platform_hal_GetWebUITimeout(unsigned long *pValue)
platform_hal_GetHardware_MemFree
int platform_hal_GetHardware_MemFree(char *pValue)
_LEDMGMT_PARAMS::LedColor
LED_COLOR LedColor
LED_COLOR.
Definition: platform_hal.h:749
platform_hal_SetDeviceCodeImageTimeout
int platform_hal_SetDeviceCodeImageTimeout(int seconds)
DSCP_Element
Definition: platform_hal.h:1136
LED_COLOR
LED_COLOR
Definition: platform_hal.h:731
TRAFFIC_CNT_STOP
@ TRAFFIC_CNT_STOP
Definition: platform_hal.h:1127
platform_hal_getFactoryCmVariant
int platform_hal_getFactoryCmVariant(char *pValue)
BOOLEAN
#define BOOLEAN
Definition: platform_hal.h:111
PLAT_PROC_MEM_MAX_LEN
#define PLAT_PROC_MEM_MAX_LEN
Definition: platform_hal.h:188
platform_hal_GetHardware_MemUsed
int platform_hal_GetHardware_MemUsed(char *pValue)
PSM_STATE
PSM_STATE
Definition: platform_hal.h:1094
INT
#define INT
Definition: platform_hal.h:115
DSCP_Element::numClients
unsigned int numClients
Definition: platform_hal.h:1138
platform_hal_GetSerialNumber
int platform_hal_GetSerialNumber(char *pValue)
PSM_COOLED
@ PSM_COOLED
Definition: platform_hal.h:1099
DSCP_Element::dscp_value
unsigned int dscp_value
Definition: platform_hal.h:1137
_LEDMGMT_PARAMS::Interval
int Interval
In case fs State is blink then interval per second.
Definition: platform_hal.h:751
platform_hal_GetFreeMemorySize
int platform_hal_GetFreeMemorySize(unsigned long *pulSize)
platform_hal_SetWebAccessLevel
int platform_hal_SetWebAccessLevel(int userIndex, int ifIndex, unsigned long value)
platform_hal_GetMemoryPaths
int platform_hal_GetMemoryPaths(RDK_CPUS index, PPLAT_PROC_MEM_INFO *ppinfo)
pTraffic_client_t
struct Traffic_client * pTraffic_client_t
platform_hal_getFanStatus
unsigned char platform_hal_getFanStatus(unsigned int fanIndex)
platform_hal_getDscpClientList
int platform_hal_getDscpClientList(WAN_INTERFACE interfaceType, pDSCP_list_t pDSCP_List)
LED_WHITE
@ LED_WHITE
Definition: platform_hal.h:732
DSCP_list
Definition: platform_hal.h:1142
platform_hal_resetDscpCounts
int platform_hal_resetDscpCounts(WAN_INTERFACE interfaceType)
PSM_HOT
@ PSM_HOT
Definition: platform_hal.h:1098
LEDMGMT_PARAMS
struct _LEDMGMT_PARAMS LEDMGMT_PARAMS
PSM_AC
@ PSM_AC
Definition: platform_hal.h:1096
platform_hal_GetFactoryResetCount
int platform_hal_GetFactoryResetCount(unsigned long *pulSize)
platform_hal_SetWebUITimeout
int platform_hal_SetWebUITimeout(unsigned long value)
platform_hal_GetModelName
int platform_hal_GetModelName(char *pValue)
platform_hal_GetWebAccessLevel
int platform_hal_GetWebAccessLevel(int userIndex, int ifIndex, unsigned long *pValue)
platform_hal_GetHardwareVersion
int platform_hal_GetHardwareVersion(char *pValue)
HOST_CPU
@ HOST_CPU
Definition: platform_hal.h:184
dhcp_opt_list::dhcp_opt
int dhcp_opt
Definition: platform_hal.h:1069
UINT
#define UINT
Definition: platform_hal.h:119
platform_hal_GetTotalMemorySize
int platform_hal_GetTotalMemorySize(unsigned long *pulSize)
platform_hal_ClearResetCount
int platform_hal_ClearResetCount(unsigned char bFlag)
platform_hal_GetMACsecOperationalStatus
int platform_hal_GetMACsecOperationalStatus(int ethPort, unsigned char *pFlag)
PPSM_STATE
enum PSM_STATE * PPSM_STATE
PSM_BATT
@ PSM_BATT
Definition: platform_hal.h:1097
platform_hal_SetSNMPEnable
int platform_hal_SetSNMPEnable(char *pValue)
NOT_SUPPORTED
@ NOT_SUPPORTED
Definition: platform_hal.h:739
dhcp_opt_list::next
struct dhcp_opt_list * next
Definition: platform_hal.h:1071
platform_hal_SetSSHEnable
int platform_hal_SetSSHEnable(unsigned char Flag)
LED_YELLOW_AND_GREEN
@ LED_YELLOW_AND_GREEN
Definition: platform_hal.h:738
LED_BLUE
@ LED_BLUE
Definition: platform_hal.h:736
platform_hal_setFanMaxOverride
int platform_hal_setFanMaxOverride(unsigned char bOverrideFlag, unsigned int fanIndex)
dhcp_opt_list
struct dhcp_opt_list dhcp_opt_list
_PLAT_PROC_MEM_INFO
Definition: platform_hal.h:194
LED_YELLOW
@ LED_YELLOW
Definition: platform_hal.h:733
platform_hal_GetSNMPEnable
int platform_hal_GetSNMPEnable(char *pValue)
Traffic_client
Definition: platform_hal.h:1130
PLAT_PROC_MEM_INFO
struct _PLAT_PROC_MEM_INFO PLAT_PROC_MEM_INFO
platform_hal_getRPM
unsigned int platform_hal_getRPM(unsigned int fanIndex)
DOCSIS
@ DOCSIS
Definition: platform_hal.h:1121
platform_hal_setDscp
int platform_hal_setDscp(WAN_INTERFACE interfaceType, TRAFFIC_CNT_COMMAND cmd, char *pDscpVals)
DSCP_list::numElements
unsigned int numElements
Definition: platform_hal.h:1143
LED_RED_AND_GREEN
@ LED_RED_AND_GREEN
Definition: platform_hal.h:737
ULONG
#define ULONG
Definition: platform_hal.h:123
platform_hal_getFanSpeed
unsigned int platform_hal_getFanSpeed(unsigned int fanIndex)
platform_hal_StopMACsec
int platform_hal_StopMACsec(int ethPort)
platform_hal_GetDhcpv4_Options
int platform_hal_GetDhcpv4_Options(dhcp_opt_list **req_opt_list, dhcp_opt_list **send_opt_list)
platform_hal_getFactoryPartnerId
int platform_hal_getFactoryPartnerId(char *pValue)
platform_hal_GetSoftwareVersion
int platform_hal_GetSoftwareVersion(char *pValue, unsigned long maxSize)
platform_hal_StartMACsec
int platform_hal_StartMACsec(int ethPort, int timeoutSec)
pDSCP_list_t
struct DSCP_list * pDSCP_list_t
LED_GREEN
@ LED_GREEN
Definition: platform_hal.h:734
platform_hal_GetFirmwareName
int platform_hal_GetFirmwareName(char *pValue, unsigned long maxSize)
EWAN
@ EWAN
Definition: platform_hal.h:1122
platform_hal_GetUsedMemorySize
int platform_hal_GetUsedMemorySize(unsigned long *pulSize)
platform_hal_SetLowPowerModeState
int platform_hal_SetLowPowerModeState(PPSM_STATE pState)
platform_hal_GetTelnetEnable
int platform_hal_GetTelnetEnable(unsigned char *pFlag)
pDSCP_Element_t
struct DSCP_Element * pDSCP_Element_t
NOT_SUPPORTED_CPU
@ NOT_SUPPORTED_CPU
Definition: platform_hal.h:186
platform_hal_getTimeOffSet
int platform_hal_getTimeOffSet(char *timeOffSet)
DSCP_Element_t
struct DSCP_Element DSCP_Element_t
PSM_UNKNOWN
@ PSM_UNKNOWN
Definition: platform_hal.h:1095
platform_hal_getCMTSMac
int platform_hal_getCMTSMac(char *pValue)
WAN_INTERFACE
WAN_INTERFACE
Definition: platform_hal.h:1120
platform_hal_DocsisParamsDBInit
int platform_hal_DocsisParamsDBInit(void)
dhcp_opt_list
Definition: platform_hal.h:1068
platform_hal_GetBaseMacAddress
int platform_hal_GetBaseMacAddress(char *pValue)
platform_hal_GetSSHEnable
int platform_hal_GetSSHEnable(unsigned char *pFlag)
platform_hal_setLed
int platform_hal_setLed(PLEDMGMT_PARAMS pValue)
platform_hal_GetMACsecEnable
int platform_hal_GetMACsecEnable(int ethPort, unsigned char *pFlag)
platform_hal_getLed
int platform_hal_getLed(PLEDMGMT_PARAMS pValue)
platform_hal_setFactoryCmVariant
int platform_hal_setFactoryCmVariant(char *pValue)
TRAFFIC_CNT_START
@ TRAFFIC_CNT_START
Definition: platform_hal.h:1126
DSCP_list_t
struct DSCP_list DSCP_list_t
platform_hal_SetMACsecEnable
int platform_hal_SetMACsecEnable(int ethPort, unsigned char Flag)
Traffic_client_t
struct Traffic_client Traffic_client_t
PLEDMGMT_PARAMS
struct _LEDMGMT_PARAMS * PLEDMGMT_PARAMS
LED_RED
@ LED_RED
Definition: platform_hal.h:735
platform_hal_SetDeviceCodeImageValid
int platform_hal_SetDeviceCodeImageValid(unsigned char flag)
platform_hal_PandMDBInit
int platform_hal_PandMDBInit(void)
CHAR
#define CHAR
Definition: platform_hal.h:103
RDK_CPUS
RDK_CPUS
Definition: platform_hal.h:181
PPLAT_PROC_MEM_INFO
struct _PLAT_PROC_MEM_INFO * PPLAT_PROC_MEM_INFO
Traffic_client::mac
char mac[18]
Definition: platform_hal.h:1131
dhcp_opt_list::dhcp_opt_val
char * dhcp_opt_val
Definition: platform_hal.h:1070
platform_hal_GetBootloaderVersion
int platform_hal_GetBootloaderVersion(char *pValue, unsigned long maxSize)
platform_hal_SetTelnetEnable
int platform_hal_SetTelnetEnable(unsigned char Flag)
platform_hal_GetDeviceConfigStatus
int platform_hal_GetDeviceConfigStatus(char *pValue)
platform_hal_GetDhcpv6_Options
int platform_hal_GetDhcpv6_Options(dhcp_opt_list **req_opt_list, dhcp_opt_list **send_opt_list)
_LEDMGMT_PARAMS
Definition: platform_hal.h:743
platform_hal_GetRouterRegion
int platform_hal_GetRouterRegion(char *pValue)
TRAFFIC_CNT_COMMAND
TRAFFIC_CNT_COMMAND
Definition: platform_hal.h:1125
platform_hal_SetSNMPOnboardRebootEnable
int platform_hal_SetSNMPOnboardRebootEnable(char *pValue)
Traffic_client::rxBytes
unsigned long rxBytes
Definition: platform_hal.h:1132
PSM_NOT_SUPPORTED
@ PSM_NOT_SUPPORTED
Definition: platform_hal.h:1100