1 /*****************************************************************************
2 * Copyright 2003 - 2008 Broadcom Corporation. All rights reserved.
4 * Unless you and Broadcom execute a separate written software license
5 * agreement governing use of this software, this software is licensed to you
6 * under the terms of the GNU General Public License version 2, available at
7 * http://www.broadcom.com/licenses/GPLv2.php (the "GPL").
9 * Notwithstanding the above, under no circumstances may you combine this
10 * software in any way with any other Broadcom software provided under a
11 * license other than the GPL, without Broadcom's express prior written
13 *****************************************************************************/
15 #ifndef CHIPC_INLINE_H
16 #define CHIPC_INLINE_H
18 /* ---- Include Files ----------------------------------------------------- */
20 #include <csp/errno.h>
22 #include <mach/csp/chipcHw_reg.h>
23 #include <mach/csp/chipcHw_def.h>
25 /* ---- Private Constants and Types --------------------------------------- */
27 chipcHw_OPTYPE_BYPASS
, /* Bypass operation */
28 chipcHw_OPTYPE_OUTPUT
/* Output operation */
31 /* ---- Public Constants and Types ---------------------------------------- */
32 /* ---- Public Variable Externs ------------------------------------------- */
33 /* ---- Public Function Prototypes ---------------------------------------- */
34 /* ---- Private Function Prototypes --------------------------------------- */
35 static inline void chipcHw_setClock(chipcHw_CLOCK_e clock
,
36 chipcHw_OPTYPE_e type
, int mode
);
38 /****************************************************************************/
40 * @brief Get Numeric Chip ID
42 * This function returns Chip ID that includes the revison number
44 * @return Complete numeric Chip ID
47 /****************************************************************************/
48 static inline uint32_t chipcHw_getChipId(void)
50 return pChipcHw
->ChipId
;
53 /****************************************************************************/
55 * @brief Enable Spread Spectrum
57 * @note chipcHw_Init() must be called earlier
59 /****************************************************************************/
60 static inline void chipcHw_enableSpreadSpectrum(void)
63 PLLPreDivider
& chipcHw_REG_PLL_PREDIVIDER_NDIV_MODE_MASK
) !=
64 chipcHw_REG_PLL_PREDIVIDER_NDIV_MODE_INTEGER
) {
65 ddrcReg_PHY_ADDR_CTL_REGP
->ssCfg
=
66 (0xFFFF << ddrcReg_PHY_ADDR_SS_CFG_NDIV_AMPLITUDE_SHIFT
) |
67 (ddrcReg_PHY_ADDR_SS_CFG_MIN_CYCLE_PER_TICK
<<
68 ddrcReg_PHY_ADDR_SS_CFG_CYCLE_PER_TICK_SHIFT
);
69 ddrcReg_PHY_ADDR_CTL_REGP
->ssCtl
|=
70 ddrcReg_PHY_ADDR_SS_CTRL_ENABLE
;
74 /****************************************************************************/
76 * @brief Disable Spread Spectrum
79 /****************************************************************************/
80 static inline void chipcHw_disableSpreadSpectrum(void)
82 ddrcReg_PHY_ADDR_CTL_REGP
->ssCtl
&= ~ddrcReg_PHY_ADDR_SS_CTRL_ENABLE
;
85 /****************************************************************************/
87 * @brief Get Chip Product ID
89 * This function returns Chip Product ID
91 * @return Chip Product ID
93 /****************************************************************************/
94 static inline uint32_t chipcHw_getChipProductId(void)
97 ChipId
& chipcHw_REG_CHIPID_BASE_MASK
) >>
98 chipcHw_REG_CHIPID_BASE_SHIFT
;
101 /****************************************************************************/
103 * @brief Get revision number
105 * This function returns revision number of the chip
107 * @return Revision number
109 /****************************************************************************/
110 static inline chipcHw_REV_NUMBER_e
chipcHw_getChipRevisionNumber(void)
112 return pChipcHw
->ChipId
& chipcHw_REG_CHIPID_REV_MASK
;
115 /****************************************************************************/
117 * @brief Enables bus interface clock
119 * Enables bus interface clock of various device
123 * @note use chipcHw_REG_BUS_CLOCK_XXXX for mask
125 /****************************************************************************/
126 static inline void chipcHw_busInterfaceClockEnable(uint32_t mask
)
128 reg32_modify_or(&pChipcHw
->BusIntfClock
, mask
);
131 /****************************************************************************/
133 * @brief Disables bus interface clock
135 * Disables bus interface clock of various device
139 * @note use chipcHw_REG_BUS_CLOCK_XXXX
141 /****************************************************************************/
142 static inline void chipcHw_busInterfaceClockDisable(uint32_t mask
)
144 reg32_modify_and(&pChipcHw
->BusIntfClock
, ~mask
);
147 /****************************************************************************/
149 * @brief Get status (enabled/disabled) of bus interface clock
151 * This function returns the status of devices' bus interface clock
153 * @return Bus interface clock
156 /****************************************************************************/
157 static inline uint32_t chipcHw_getBusInterfaceClockStatus(void)
159 return pChipcHw
->BusIntfClock
;
162 /****************************************************************************/
164 * @brief Enables various audio channels
166 * Enables audio channel
170 * @note use chipcHw_REG_AUDIO_CHANNEL_XXXXXX
172 /****************************************************************************/
173 static inline void chipcHw_audioChannelEnable(uint32_t mask
)
175 reg32_modify_or(&pChipcHw
->AudioEnable
, mask
);
178 /****************************************************************************/
180 * @brief Disables various audio channels
182 * Disables audio channel
186 * @note use chipcHw_REG_AUDIO_CHANNEL_XXXXXX
188 /****************************************************************************/
189 static inline void chipcHw_audioChannelDisable(uint32_t mask
)
191 reg32_modify_and(&pChipcHw
->AudioEnable
, ~mask
);
194 /****************************************************************************/
196 * @brief Soft resets devices
198 * Soft resets various devices
202 * @note use chipcHw_REG_SOFT_RESET_XXXXXX defines
204 /****************************************************************************/
205 static inline void chipcHw_softReset(uint64_t mask
)
207 chipcHw_softResetEnable(mask
);
208 chipcHw_softResetDisable(mask
);
211 static inline void chipcHw_softResetDisable(uint64_t mask
)
213 uint32_t ctrl1
= (uint32_t) mask
;
214 uint32_t ctrl2
= (uint32_t) (mask
>> 32);
216 /* Deassert module soft reset */
218 pChipcHw
->SoftReset1
^= ctrl1
;
219 pChipcHw
->SoftReset2
^= (ctrl2
& (~chipcHw_REG_SOFT_RESET_UNHOLD_MASK
));
220 REG_LOCAL_IRQ_RESTORE
;
223 static inline void chipcHw_softResetEnable(uint64_t mask
)
225 uint32_t ctrl1
= (uint32_t) mask
;
226 uint32_t ctrl2
= (uint32_t) (mask
>> 32);
230 pChipcHw
->SoftReset1
|= ctrl1
;
231 /* Mask out unhold request bits */
232 pChipcHw
->SoftReset2
|= (ctrl2
& (~chipcHw_REG_SOFT_RESET_UNHOLD_MASK
));
234 /* Process unhold requests */
235 if (ctrl2
& chipcHw_REG_SOFT_RESET_VPM_GLOBAL_UNHOLD
) {
236 unhold
= chipcHw_REG_SOFT_RESET_VPM_GLOBAL_HOLD
;
239 if (ctrl2
& chipcHw_REG_SOFT_RESET_VPM_UNHOLD
) {
240 unhold
|= chipcHw_REG_SOFT_RESET_VPM_HOLD
;
243 if (ctrl2
& chipcHw_REG_SOFT_RESET_ARM_UNHOLD
) {
244 unhold
|= chipcHw_REG_SOFT_RESET_ARM_HOLD
;
248 /* Make sure unhold request is effective */
249 pChipcHw
->SoftReset1
&= ~unhold
;
251 REG_LOCAL_IRQ_RESTORE
;
254 /****************************************************************************/
256 * @brief Configures misc CHIP functionality
258 * Configures CHIP functionality
262 * @note use chipcHw_REG_MISC_CTRL_XXXXXX
264 /****************************************************************************/
265 static inline void chipcHw_miscControl(uint32_t mask
)
267 reg32_write(&pChipcHw
->MiscCtrl
, mask
);
270 static inline void chipcHw_miscControlDisable(uint32_t mask
)
272 reg32_modify_and(&pChipcHw
->MiscCtrl
, ~mask
);
275 static inline void chipcHw_miscControlEnable(uint32_t mask
)
277 reg32_modify_or(&pChipcHw
->MiscCtrl
, mask
);
280 /****************************************************************************/
282 * @brief Set OTP options
288 * @note use chipcHw_REG_OTP_XXXXXX
290 /****************************************************************************/
291 static inline void chipcHw_setOTPOption(uint64_t mask
)
293 uint32_t ctrl1
= (uint32_t) mask
;
294 uint32_t ctrl2
= (uint32_t) (mask
>> 32);
296 reg32_modify_or(&pChipcHw
->SoftOTP1
, ctrl1
);
297 reg32_modify_or(&pChipcHw
->SoftOTP2
, ctrl2
);
300 /****************************************************************************/
302 * @brief Get sticky bits
304 * @return Sticky bit options of type chipcHw_REG_STICKY_XXXXXX
307 /****************************************************************************/
308 static inline uint32_t chipcHw_getStickyBits(void)
310 return pChipcHw
->Sticky
;
313 /****************************************************************************/
315 * @brief Set sticky bits
319 * @note use chipcHw_REG_STICKY_XXXXXX
321 /****************************************************************************/
322 static inline void chipcHw_setStickyBits(uint32_t mask
)
327 if (mask
& chipcHw_REG_STICKY_POR_BROM
) {
328 bits
|= chipcHw_REG_STICKY_POR_BROM
;
331 sticky
= pChipcHw
->Sticky
;
333 if ((mask
& chipcHw_REG_STICKY_BOOT_DONE
)
334 && (sticky
& chipcHw_REG_STICKY_BOOT_DONE
) == 0) {
335 bits
|= chipcHw_REG_STICKY_BOOT_DONE
;
337 if ((mask
& chipcHw_REG_STICKY_GENERAL_1
)
338 && (sticky
& chipcHw_REG_STICKY_GENERAL_1
) == 0) {
339 bits
|= chipcHw_REG_STICKY_GENERAL_1
;
341 if ((mask
& chipcHw_REG_STICKY_GENERAL_2
)
342 && (sticky
& chipcHw_REG_STICKY_GENERAL_2
) == 0) {
343 bits
|= chipcHw_REG_STICKY_GENERAL_2
;
345 if ((mask
& chipcHw_REG_STICKY_GENERAL_3
)
346 && (sticky
& chipcHw_REG_STICKY_GENERAL_3
) == 0) {
347 bits
|= chipcHw_REG_STICKY_GENERAL_3
;
349 if ((mask
& chipcHw_REG_STICKY_GENERAL_4
)
350 && (sticky
& chipcHw_REG_STICKY_GENERAL_4
) == 0) {
351 bits
|= chipcHw_REG_STICKY_GENERAL_4
;
353 if ((mask
& chipcHw_REG_STICKY_GENERAL_5
)
354 && (sticky
& chipcHw_REG_STICKY_GENERAL_5
) == 0) {
355 bits
|= chipcHw_REG_STICKY_GENERAL_5
;
358 pChipcHw
->Sticky
= bits
;
359 REG_LOCAL_IRQ_RESTORE
;
362 /****************************************************************************/
364 * @brief Clear sticky bits
368 * @note use chipcHw_REG_STICKY_XXXXXX
370 /****************************************************************************/
371 static inline void chipcHw_clearStickyBits(uint32_t mask
)
377 (chipcHw_REG_STICKY_BOOT_DONE
| chipcHw_REG_STICKY_GENERAL_1
|
378 chipcHw_REG_STICKY_GENERAL_2
| chipcHw_REG_STICKY_GENERAL_3
|
379 chipcHw_REG_STICKY_GENERAL_4
| chipcHw_REG_STICKY_GENERAL_5
)) {
380 uint32_t sticky
= pChipcHw
->Sticky
;
382 if ((mask
& chipcHw_REG_STICKY_BOOT_DONE
)
383 && (sticky
& chipcHw_REG_STICKY_BOOT_DONE
)) {
384 bits
= chipcHw_REG_STICKY_BOOT_DONE
;
385 mask
&= ~chipcHw_REG_STICKY_BOOT_DONE
;
387 if ((mask
& chipcHw_REG_STICKY_GENERAL_1
)
388 && (sticky
& chipcHw_REG_STICKY_GENERAL_1
)) {
389 bits
|= chipcHw_REG_STICKY_GENERAL_1
;
390 mask
&= ~chipcHw_REG_STICKY_GENERAL_1
;
392 if ((mask
& chipcHw_REG_STICKY_GENERAL_2
)
393 && (sticky
& chipcHw_REG_STICKY_GENERAL_2
)) {
394 bits
|= chipcHw_REG_STICKY_GENERAL_2
;
395 mask
&= ~chipcHw_REG_STICKY_GENERAL_2
;
397 if ((mask
& chipcHw_REG_STICKY_GENERAL_3
)
398 && (sticky
& chipcHw_REG_STICKY_GENERAL_3
)) {
399 bits
|= chipcHw_REG_STICKY_GENERAL_3
;
400 mask
&= ~chipcHw_REG_STICKY_GENERAL_3
;
402 if ((mask
& chipcHw_REG_STICKY_GENERAL_4
)
403 && (sticky
& chipcHw_REG_STICKY_GENERAL_4
)) {
404 bits
|= chipcHw_REG_STICKY_GENERAL_4
;
405 mask
&= ~chipcHw_REG_STICKY_GENERAL_4
;
407 if ((mask
& chipcHw_REG_STICKY_GENERAL_5
)
408 && (sticky
& chipcHw_REG_STICKY_GENERAL_5
)) {
409 bits
|= chipcHw_REG_STICKY_GENERAL_5
;
410 mask
&= ~chipcHw_REG_STICKY_GENERAL_5
;
413 pChipcHw
->Sticky
= bits
| mask
;
414 REG_LOCAL_IRQ_RESTORE
;
417 /****************************************************************************/
419 * @brief Get software strap value
421 * Retrieves software strap value
423 * @return Software strap value
426 /****************************************************************************/
427 static inline uint32_t chipcHw_getSoftStraps(void)
429 return pChipcHw
->SoftStraps
;
432 /****************************************************************************/
434 * @brief Set software override strap options
436 * set software override strap options
441 /****************************************************************************/
442 static inline void chipcHw_setSoftStraps(uint32_t strapOptions
)
444 reg32_write(&pChipcHw
->SoftStraps
, strapOptions
);
447 /****************************************************************************/
449 * @brief Get Pin Strap Options
451 * This function returns the raw boot strap options
453 * @return strap options
456 /****************************************************************************/
457 static inline uint32_t chipcHw_getPinStraps(void)
459 return pChipcHw
->PinStraps
;
462 /****************************************************************************/
464 * @brief Get Valid Strap Options
466 * This function returns the valid raw boot strap options
468 * @return strap options
471 /****************************************************************************/
472 static inline uint32_t chipcHw_getValidStraps(void)
477 ** Always return the SoftStraps - bootROM calls chipcHw_initValidStraps
478 ** which copies HW straps to soft straps if there is no override
480 softStraps
= chipcHw_getSoftStraps();
485 /****************************************************************************/
487 * @brief Initialize valid pin strap options
489 * Retrieves valid pin strap options by copying HW strap options to soft register
490 * (if chipcHw_STRAPS_SOFT_OVERRIDE not set)
495 /****************************************************************************/
496 static inline void chipcHw_initValidStraps(void)
501 softStraps
= chipcHw_getSoftStraps();
503 if ((softStraps
& chipcHw_STRAPS_SOFT_OVERRIDE
) == 0) {
504 /* Copy HW straps to software straps */
505 chipcHw_setSoftStraps(chipcHw_getPinStraps());
507 REG_LOCAL_IRQ_RESTORE
;
510 /****************************************************************************/
512 * @brief Get boot device
514 * This function returns the device type used in booting the system
516 * @return Boot device of type chipcHw_BOOT_DEVICE
519 /****************************************************************************/
520 static inline chipcHw_BOOT_DEVICE_e
chipcHw_getBootDevice(void)
522 return chipcHw_getValidStraps() & chipcHw_STRAPS_BOOT_DEVICE_MASK
;
525 /****************************************************************************/
527 * @brief Get boot mode
529 * This function returns the way the system was booted
531 * @return Boot mode of type chipcHw_BOOT_MODE
534 /****************************************************************************/
535 static inline chipcHw_BOOT_MODE_e
chipcHw_getBootMode(void)
537 return chipcHw_getValidStraps() & chipcHw_STRAPS_BOOT_MODE_MASK
;
540 /****************************************************************************/
542 * @brief Get NAND flash page size
544 * This function returns the NAND device page size
546 * @return Boot NAND device page size
549 /****************************************************************************/
550 static inline chipcHw_NAND_PAGESIZE_e
chipcHw_getNandPageSize(void)
552 return chipcHw_getValidStraps() & chipcHw_STRAPS_NAND_PAGESIZE_MASK
;
555 /****************************************************************************/
557 * @brief Get NAND flash address cycle configuration
559 * This function returns the NAND flash address cycle configuration
561 * @return 0 = Do not extra address cycle, 1 = Add extra cycle
564 /****************************************************************************/
565 static inline int chipcHw_getNandExtraCycle(void)
567 if (chipcHw_getValidStraps() & chipcHw_STRAPS_NAND_EXTRA_CYCLE
) {
574 /****************************************************************************/
576 * @brief Activates PIF interface
578 * This function activates PIF interface by taking control of LCD pins
581 * When activated, LCD pins will be defined as follows for PIF operation
583 * CLD[17:0] = pif_data[17:0]
584 * CLD[23:18] = pif_address[5:0]
585 * CLPOWER = pif_wr_str
590 * GPIO[42] = pif_hrdy2
592 * In PIF mode, "pif_hrdy2" overrides other shared function for GPIO[42] pin
595 /****************************************************************************/
596 static inline void chipcHw_activatePifInterface(void)
598 reg32_write(&pChipcHw
->LcdPifMode
, chipcHw_REG_PIF_PIN_ENABLE
);
601 /****************************************************************************/
603 * @brief Activates LCD interface
605 * This function activates LCD interface
608 * When activated, LCD pins will be defined as follows
610 * CLD[17:0] = LCD data
611 * CLD[23:18] = LCD data
612 * CLPOWER = LCD power
618 /****************************************************************************/
619 static inline void chipcHw_activateLcdInterface(void)
621 reg32_write(&pChipcHw
->LcdPifMode
, chipcHw_REG_LCD_PIN_ENABLE
);
624 /****************************************************************************/
626 * @brief Deactivates PIF/LCD interface
628 * This function deactivates PIF/LCD interface
631 * When deactivated LCD pins will be in rti-stated
634 /****************************************************************************/
635 static inline void chipcHw_deactivatePifLcdInterface(void)
637 reg32_write(&pChipcHw
->LcdPifMode
, 0);
640 /****************************************************************************/
644 * This function select GE2 as the graphic engine
647 /****************************************************************************/
648 static inline void chipcHw_selectGE2(void)
650 reg32_modify_and(&pChipcHw
->MiscCtrl
, ~chipcHw_REG_MISC_CTRL_GE_SEL
);
653 /****************************************************************************/
657 * This function select GE3 as the graphic engine
660 /****************************************************************************/
661 static inline void chipcHw_selectGE3(void)
663 reg32_modify_or(&pChipcHw
->MiscCtrl
, chipcHw_REG_MISC_CTRL_GE_SEL
);
666 /****************************************************************************/
668 * @brief Get to know the configuration of GPIO pin
671 /****************************************************************************/
672 static inline chipcHw_GPIO_FUNCTION_e
chipcHw_getGpioPinFunction(int pin
)
674 return (*((uint32_t *) chipcHw_REG_GPIO_MUX(pin
)) &
675 (chipcHw_REG_GPIO_MUX_MASK
<<
676 chipcHw_REG_GPIO_MUX_POSITION(pin
))) >>
677 chipcHw_REG_GPIO_MUX_POSITION(pin
);
680 /****************************************************************************/
682 * @brief Configure GPIO pin function
685 /****************************************************************************/
686 static inline void chipcHw_setGpioPinFunction(int pin
,
687 chipcHw_GPIO_FUNCTION_e func
)
690 *((uint32_t *) chipcHw_REG_GPIO_MUX(pin
)) &=
691 ~(chipcHw_REG_GPIO_MUX_MASK
<< chipcHw_REG_GPIO_MUX_POSITION(pin
));
692 *((uint32_t *) chipcHw_REG_GPIO_MUX(pin
)) |=
693 func
<< chipcHw_REG_GPIO_MUX_POSITION(pin
);
694 REG_LOCAL_IRQ_RESTORE
;
697 /****************************************************************************/
699 * @brief Set Pin slew rate
701 * This function sets the slew of individual pin
704 /****************************************************************************/
705 static inline void chipcHw_setPinSlewRate(uint32_t pin
,
706 chipcHw_PIN_SLEW_RATE_e slewRate
)
709 *((uint32_t *) chipcHw_REG_SLEW_RATE(pin
)) &=
710 ~(chipcHw_REG_SLEW_RATE_MASK
<<
711 chipcHw_REG_SLEW_RATE_POSITION(pin
));
712 *((uint32_t *) chipcHw_REG_SLEW_RATE(pin
)) |=
713 (uint32_t) slewRate
<< chipcHw_REG_SLEW_RATE_POSITION(pin
);
714 REG_LOCAL_IRQ_RESTORE
;
717 /****************************************************************************/
719 * @brief Set Pin output drive current
721 * This function sets output drive current of individual pin
723 * Note: Avoid the use of the word 'current' since linux headers define this
724 * to be the current task.
726 /****************************************************************************/
727 static inline void chipcHw_setPinOutputCurrent(uint32_t pin
,
728 chipcHw_PIN_CURRENT_STRENGTH_e
732 *((uint32_t *) chipcHw_REG_CURRENT(pin
)) &=
733 ~(chipcHw_REG_CURRENT_MASK
<< chipcHw_REG_CURRENT_POSITION(pin
));
734 *((uint32_t *) chipcHw_REG_CURRENT(pin
)) |=
735 (uint32_t) curr
<< chipcHw_REG_CURRENT_POSITION(pin
);
736 REG_LOCAL_IRQ_RESTORE
;
739 /****************************************************************************/
741 * @brief Set Pin pullup register
743 * This function sets pullup register of individual pin
746 /****************************************************************************/
747 static inline void chipcHw_setPinPullup(uint32_t pin
, chipcHw_PIN_PULL_e pullup
)
750 *((uint32_t *) chipcHw_REG_PULLUP(pin
)) &=
751 ~(chipcHw_REG_PULLUP_MASK
<< chipcHw_REG_PULLUP_POSITION(pin
));
752 *((uint32_t *) chipcHw_REG_PULLUP(pin
)) |=
753 (uint32_t) pullup
<< chipcHw_REG_PULLUP_POSITION(pin
);
754 REG_LOCAL_IRQ_RESTORE
;
757 /****************************************************************************/
759 * @brief Set Pin input type
761 * This function sets input type of individual pin
764 /****************************************************************************/
765 static inline void chipcHw_setPinInputType(uint32_t pin
,
766 chipcHw_PIN_INPUTTYPE_e inputType
)
769 *((uint32_t *) chipcHw_REG_INPUTTYPE(pin
)) &=
770 ~(chipcHw_REG_INPUTTYPE_MASK
<<
771 chipcHw_REG_INPUTTYPE_POSITION(pin
));
772 *((uint32_t *) chipcHw_REG_INPUTTYPE(pin
)) |=
773 (uint32_t) inputType
<< chipcHw_REG_INPUTTYPE_POSITION(pin
);
774 REG_LOCAL_IRQ_RESTORE
;
777 /****************************************************************************/
779 * @brief Power up the USB PHY
781 * This function powers up the USB PHY
784 /****************************************************************************/
785 static inline void chipcHw_powerUpUsbPhy(void)
787 reg32_modify_and(&pChipcHw
->MiscCtrl
,
788 chipcHw_REG_MISC_CTRL_USB_POWERON
);
791 /****************************************************************************/
793 * @brief Power down the USB PHY
795 * This function powers down the USB PHY
798 /****************************************************************************/
799 static inline void chipcHw_powerDownUsbPhy(void)
801 reg32_modify_or(&pChipcHw
->MiscCtrl
,
802 chipcHw_REG_MISC_CTRL_USB_POWEROFF
);
805 /****************************************************************************/
807 * @brief Set the 2nd USB as host
809 * This function sets the 2nd USB as host
812 /****************************************************************************/
813 static inline void chipcHw_setUsbHost(void)
815 reg32_modify_or(&pChipcHw
->MiscCtrl
,
816 chipcHw_REG_MISC_CTRL_USB_MODE_HOST
);
819 /****************************************************************************/
821 * @brief Set the 2nd USB as device
823 * This function sets the 2nd USB as device
826 /****************************************************************************/
827 static inline void chipcHw_setUsbDevice(void)
829 reg32_modify_and(&pChipcHw
->MiscCtrl
,
830 chipcHw_REG_MISC_CTRL_USB_MODE_DEVICE
);
833 /****************************************************************************/
835 * @brief Lower layer function to enable/disable a clock of a certain device
837 * This function enables/disables a core clock
840 /****************************************************************************/
841 static inline void chipcHw_setClock(chipcHw_CLOCK_e clock
,
842 chipcHw_OPTYPE_e type
, int mode
)
844 volatile uint32_t *pPLLReg
= (uint32_t *) 0x0;
845 volatile uint32_t *pClockCtrl
= (uint32_t *) 0x0;
848 case chipcHw_CLOCK_DDR
:
849 pPLLReg
= &pChipcHw
->DDRClock
;
851 case chipcHw_CLOCK_ARM
:
852 pPLLReg
= &pChipcHw
->ARMClock
;
854 case chipcHw_CLOCK_ESW
:
855 pPLLReg
= &pChipcHw
->ESWClock
;
857 case chipcHw_CLOCK_VPM
:
858 pPLLReg
= &pChipcHw
->VPMClock
;
860 case chipcHw_CLOCK_ESW125
:
861 pPLLReg
= &pChipcHw
->ESW125Clock
;
863 case chipcHw_CLOCK_UART
:
864 pPLLReg
= &pChipcHw
->UARTClock
;
866 case chipcHw_CLOCK_SDIO0
:
867 pPLLReg
= &pChipcHw
->SDIO0Clock
;
869 case chipcHw_CLOCK_SDIO1
:
870 pPLLReg
= &pChipcHw
->SDIO1Clock
;
872 case chipcHw_CLOCK_SPI
:
873 pPLLReg
= &pChipcHw
->SPIClock
;
875 case chipcHw_CLOCK_ETM
:
876 pPLLReg
= &pChipcHw
->ETMClock
;
878 case chipcHw_CLOCK_USB
:
879 pPLLReg
= &pChipcHw
->USBClock
;
880 if (type
== chipcHw_OPTYPE_OUTPUT
) {
882 reg32_modify_and(pPLLReg
,
883 ~chipcHw_REG_PLL_CLOCK_POWER_DOWN
);
885 reg32_modify_or(pPLLReg
,
886 chipcHw_REG_PLL_CLOCK_POWER_DOWN
);
890 case chipcHw_CLOCK_LCD
:
891 pPLLReg
= &pChipcHw
->LCDClock
;
892 if (type
== chipcHw_OPTYPE_OUTPUT
) {
894 reg32_modify_and(pPLLReg
,
895 ~chipcHw_REG_PLL_CLOCK_POWER_DOWN
);
897 reg32_modify_or(pPLLReg
,
898 chipcHw_REG_PLL_CLOCK_POWER_DOWN
);
902 case chipcHw_CLOCK_APM
:
903 pPLLReg
= &pChipcHw
->APMClock
;
904 if (type
== chipcHw_OPTYPE_OUTPUT
) {
906 reg32_modify_and(pPLLReg
,
907 ~chipcHw_REG_PLL_CLOCK_POWER_DOWN
);
909 reg32_modify_or(pPLLReg
,
910 chipcHw_REG_PLL_CLOCK_POWER_DOWN
);
914 case chipcHw_CLOCK_BUS
:
915 pClockCtrl
= &pChipcHw
->ACLKClock
;
917 case chipcHw_CLOCK_OTP
:
918 pClockCtrl
= &pChipcHw
->OTPClock
;
920 case chipcHw_CLOCK_I2C
:
921 pClockCtrl
= &pChipcHw
->I2CClock
;
923 case chipcHw_CLOCK_I2S0
:
924 pClockCtrl
= &pChipcHw
->I2S0Clock
;
926 case chipcHw_CLOCK_RTBUS
:
927 pClockCtrl
= &pChipcHw
->RTBUSClock
;
929 case chipcHw_CLOCK_APM100
:
930 pClockCtrl
= &pChipcHw
->APM100Clock
;
932 case chipcHw_CLOCK_TSC
:
933 pClockCtrl
= &pChipcHw
->TSCClock
;
935 case chipcHw_CLOCK_LED
:
936 pClockCtrl
= &pChipcHw
->LEDClock
;
938 case chipcHw_CLOCK_I2S1
:
939 pClockCtrl
= &pChipcHw
->I2S1Clock
;
945 case chipcHw_OPTYPE_OUTPUT
:
946 /* PLL clock output enable/disable */
948 if (clock
== chipcHw_CLOCK_DDR
) {
949 /* DDR clock enable is inverted */
950 reg32_modify_and(pPLLReg
,
951 ~chipcHw_REG_PLL_CLOCK_OUTPUT_ENABLE
);
953 reg32_modify_or(pPLLReg
,
954 chipcHw_REG_PLL_CLOCK_OUTPUT_ENABLE
);
957 if (clock
== chipcHw_CLOCK_DDR
) {
958 /* DDR clock disable is inverted */
959 reg32_modify_or(pPLLReg
,
960 chipcHw_REG_PLL_CLOCK_OUTPUT_ENABLE
);
962 reg32_modify_and(pPLLReg
,
963 ~chipcHw_REG_PLL_CLOCK_OUTPUT_ENABLE
);
967 case chipcHw_OPTYPE_BYPASS
:
968 /* PLL clock bypass enable/disable */
970 reg32_modify_or(pPLLReg
,
971 chipcHw_REG_PLL_CLOCK_BYPASS_SELECT
);
973 reg32_modify_and(pPLLReg
,
974 ~chipcHw_REG_PLL_CLOCK_BYPASS_SELECT
);
978 } else if (pClockCtrl
) {
980 case chipcHw_OPTYPE_OUTPUT
:
982 reg32_modify_or(pClockCtrl
,
983 chipcHw_REG_DIV_CLOCK_OUTPUT_ENABLE
);
985 reg32_modify_and(pClockCtrl
,
986 ~chipcHw_REG_DIV_CLOCK_OUTPUT_ENABLE
);
989 case chipcHw_OPTYPE_BYPASS
:
991 reg32_modify_or(pClockCtrl
,
992 chipcHw_REG_DIV_CLOCK_BYPASS_SELECT
);
994 reg32_modify_and(pClockCtrl
,
995 ~chipcHw_REG_DIV_CLOCK_BYPASS_SELECT
);
1002 /****************************************************************************/
1004 * @brief Disables a core clock of a certain device
1006 * This function disables a core clock
1008 * @note no change in power consumption
1010 /****************************************************************************/
1011 static inline void chipcHw_setClockDisable(chipcHw_CLOCK_e clock
)
1014 /* Disable output of the clock */
1015 chipcHw_setClock(clock
, chipcHw_OPTYPE_OUTPUT
, 0);
1018 /****************************************************************************/
1020 * @brief Enable a core clock of a certain device
1022 * This function enables a core clock
1024 * @note no change in power consumption
1026 /****************************************************************************/
1027 static inline void chipcHw_setClockEnable(chipcHw_CLOCK_e clock
)
1030 /* Enable output of the clock */
1031 chipcHw_setClock(clock
, chipcHw_OPTYPE_OUTPUT
, 1);
1034 /****************************************************************************/
1036 * @brief Enables bypass clock of a certain device
1038 * This function enables bypass clock
1040 * @note Doesnot affect the bus interface clock
1042 /****************************************************************************/
1043 static inline void chipcHw_bypassClockEnable(chipcHw_CLOCK_e clock
)
1045 /* Enable bypass clock */
1046 chipcHw_setClock(clock
, chipcHw_OPTYPE_BYPASS
, 1);
1049 /****************************************************************************/
1051 * @brief Disabled bypass clock of a certain device
1053 * This function disables bypass clock
1055 * @note Doesnot affect the bus interface clock
1057 /****************************************************************************/
1058 static inline void chipcHw_bypassClockDisable(chipcHw_CLOCK_e clock
)
1060 /* Disable bypass clock */
1061 chipcHw_setClock(clock
, chipcHw_OPTYPE_BYPASS
, 0);
1065 /****************************************************************************/
1066 /** @brief Checks if software strap is enabled
1068 * @return 1 : When enable
1071 /****************************************************************************/
1072 static inline int chipcHw_isSoftwareStrapsEnable(void)
1074 return pChipcHw
->SoftStraps
& 0x00000001;
1077 /****************************************************************************/
1078 /** @brief Enable software strap
1080 /****************************************************************************/
1081 static inline void chipcHw_softwareStrapsEnable(void)
1083 reg32_modify_or(&pChipcHw
->SoftStraps
, 0x00000001);
1086 /****************************************************************************/
1087 /** @brief Disable software strap
1089 /****************************************************************************/
1090 static inline void chipcHw_softwareStrapsDisable(void)
1092 reg32_modify_and(&pChipcHw
->SoftStraps
, (~0x00000001));
1095 /****************************************************************************/
1096 /** @brief PLL test enable
1098 /****************************************************************************/
1099 static inline void chipcHw_pllTestEnable(void)
1101 reg32_modify_or(&pChipcHw
->PLLConfig
,
1102 chipcHw_REG_PLL_CONFIG_TEST_ENABLE
);
1105 /****************************************************************************/
1106 /** @brief PLL2 test enable
1108 /****************************************************************************/
1109 static inline void chipcHw_pll2TestEnable(void)
1111 reg32_modify_or(&pChipcHw
->PLLConfig2
,
1112 chipcHw_REG_PLL_CONFIG_TEST_ENABLE
);
1115 /****************************************************************************/
1116 /** @brief PLL test disable
1118 /****************************************************************************/
1119 static inline void chipcHw_pllTestDisable(void)
1121 reg32_modify_and(&pChipcHw
->PLLConfig
,
1122 ~chipcHw_REG_PLL_CONFIG_TEST_ENABLE
);
1125 /****************************************************************************/
1126 /** @brief PLL2 test disable
1128 /****************************************************************************/
1129 static inline void chipcHw_pll2TestDisable(void)
1131 reg32_modify_and(&pChipcHw
->PLLConfig2
,
1132 ~chipcHw_REG_PLL_CONFIG_TEST_ENABLE
);
1135 /****************************************************************************/
1136 /** @brief Get PLL test status
1138 /****************************************************************************/
1139 static inline int chipcHw_isPllTestEnable(void)
1141 return pChipcHw
->PLLConfig
& chipcHw_REG_PLL_CONFIG_TEST_ENABLE
;
1144 /****************************************************************************/
1145 /** @brief Get PLL2 test status
1147 /****************************************************************************/
1148 static inline int chipcHw_isPll2TestEnable(void)
1150 return pChipcHw
->PLLConfig2
& chipcHw_REG_PLL_CONFIG_TEST_ENABLE
;
1153 /****************************************************************************/
1154 /** @brief PLL test select
1156 /****************************************************************************/
1157 static inline void chipcHw_pllTestSelect(uint32_t val
)
1160 pChipcHw
->PLLConfig
&= ~chipcHw_REG_PLL_CONFIG_TEST_SELECT_MASK
;
1161 pChipcHw
->PLLConfig
|=
1162 (val
) << chipcHw_REG_PLL_CONFIG_TEST_SELECT_SHIFT
;
1163 REG_LOCAL_IRQ_RESTORE
;
1166 /****************************************************************************/
1167 /** @brief PLL2 test select
1169 /****************************************************************************/
1170 static inline void chipcHw_pll2TestSelect(uint32_t val
)
1174 pChipcHw
->PLLConfig2
&= ~chipcHw_REG_PLL_CONFIG_TEST_SELECT_MASK
;
1175 pChipcHw
->PLLConfig2
|=
1176 (val
) << chipcHw_REG_PLL_CONFIG_TEST_SELECT_SHIFT
;
1177 REG_LOCAL_IRQ_RESTORE
;
1180 /****************************************************************************/
1181 /** @brief Get PLL test selected option
1183 /****************************************************************************/
1184 static inline uint8_t chipcHw_getPllTestSelected(void)
1186 return (uint8_t) ((pChipcHw
->
1187 PLLConfig
& chipcHw_REG_PLL_CONFIG_TEST_SELECT_MASK
)
1188 >> chipcHw_REG_PLL_CONFIG_TEST_SELECT_SHIFT
);
1191 /****************************************************************************/
1192 /** @brief Get PLL2 test selected option
1194 /****************************************************************************/
1195 static inline uint8_t chipcHw_getPll2TestSelected(void)
1197 return (uint8_t) ((pChipcHw
->
1198 PLLConfig2
& chipcHw_REG_PLL_CONFIG_TEST_SELECT_MASK
)
1199 >> chipcHw_REG_PLL_CONFIG_TEST_SELECT_SHIFT
);
1202 /****************************************************************************/
1204 * @brief Disable the PLL1
1207 /****************************************************************************/
1208 static inline void chipcHw_pll1Disable(void)
1211 pChipcHw
->PLLConfig
|= chipcHw_REG_PLL_CONFIG_POWER_DOWN
;
1212 REG_LOCAL_IRQ_RESTORE
;
1215 /****************************************************************************/
1217 * @brief Disable the PLL2
1220 /****************************************************************************/
1221 static inline void chipcHw_pll2Disable(void)
1224 pChipcHw
->PLLConfig2
|= chipcHw_REG_PLL_CONFIG_POWER_DOWN
;
1225 REG_LOCAL_IRQ_RESTORE
;
1228 /****************************************************************************/
1230 * @brief Enables DDR SW phase alignment interrupt
1232 /****************************************************************************/
1233 static inline void chipcHw_ddrPhaseAlignInterruptEnable(void)
1236 pChipcHw
->Spare1
|= chipcHw_REG_SPARE1_DDR_PHASE_INTR_ENABLE
;
1237 REG_LOCAL_IRQ_RESTORE
;
1240 /****************************************************************************/
1242 * @brief Disables DDR SW phase alignment interrupt
1244 /****************************************************************************/
1245 static inline void chipcHw_ddrPhaseAlignInterruptDisable(void)
1248 pChipcHw
->Spare1
&= ~chipcHw_REG_SPARE1_DDR_PHASE_INTR_ENABLE
;
1249 REG_LOCAL_IRQ_RESTORE
;
1252 /****************************************************************************/
1254 * @brief Set VPM SW phase alignment interrupt mode
1256 * This function sets VPM phase alignment interrupt
1258 /****************************************************************************/
1260 chipcHw_vpmPhaseAlignInterruptMode(chipcHw_VPM_HW_PHASE_INTR_e mode
)
1263 if (mode
== chipcHw_VPM_HW_PHASE_INTR_DISABLE
) {
1264 pChipcHw
->Spare1
&= ~chipcHw_REG_SPARE1_VPM_PHASE_INTR_ENABLE
;
1266 pChipcHw
->Spare1
|= chipcHw_REG_SPARE1_VPM_PHASE_INTR_ENABLE
;
1268 pChipcHw
->VPMPhaseCtrl2
=
1270 VPMPhaseCtrl2
& ~(chipcHw_REG_VPM_INTR_SELECT_MASK
<<
1271 chipcHw_REG_VPM_INTR_SELECT_SHIFT
)) | mode
;
1272 REG_LOCAL_IRQ_RESTORE
;
1275 /****************************************************************************/
1277 * @brief Enable DDR phase alignment in software
1280 /****************************************************************************/
1281 static inline void chipcHw_ddrSwPhaseAlignEnable(void)
1284 pChipcHw
->DDRPhaseCtrl1
|= chipcHw_REG_DDR_SW_PHASE_CTRL_ENABLE
;
1285 REG_LOCAL_IRQ_RESTORE
;
1288 /****************************************************************************/
1290 * @brief Disable DDR phase alignment in software
1293 /****************************************************************************/
1294 static inline void chipcHw_ddrSwPhaseAlignDisable(void)
1297 pChipcHw
->DDRPhaseCtrl1
&= ~chipcHw_REG_DDR_SW_PHASE_CTRL_ENABLE
;
1298 REG_LOCAL_IRQ_RESTORE
;
1301 /****************************************************************************/
1303 * @brief Enable DDR phase alignment in hardware
1306 /****************************************************************************/
1307 static inline void chipcHw_ddrHwPhaseAlignEnable(void)
1310 pChipcHw
->DDRPhaseCtrl1
|= chipcHw_REG_DDR_HW_PHASE_CTRL_ENABLE
;
1311 REG_LOCAL_IRQ_RESTORE
;
1314 /****************************************************************************/
1316 * @brief Disable DDR phase alignment in hardware
1319 /****************************************************************************/
1320 static inline void chipcHw_ddrHwPhaseAlignDisable(void)
1323 pChipcHw
->DDRPhaseCtrl1
&= ~chipcHw_REG_DDR_HW_PHASE_CTRL_ENABLE
;
1324 REG_LOCAL_IRQ_RESTORE
;
1327 /****************************************************************************/
1329 * @brief Enable VPM phase alignment in software
1332 /****************************************************************************/
1333 static inline void chipcHw_vpmSwPhaseAlignEnable(void)
1336 pChipcHw
->VPMPhaseCtrl1
|= chipcHw_REG_VPM_SW_PHASE_CTRL_ENABLE
;
1337 REG_LOCAL_IRQ_RESTORE
;
1340 /****************************************************************************/
1342 * @brief Disable VPM phase alignment in software
1345 /****************************************************************************/
1346 static inline void chipcHw_vpmSwPhaseAlignDisable(void)
1349 pChipcHw
->VPMPhaseCtrl1
&= ~chipcHw_REG_VPM_SW_PHASE_CTRL_ENABLE
;
1350 REG_LOCAL_IRQ_RESTORE
;
1353 /****************************************************************************/
1355 * @brief Enable VPM phase alignment in hardware
1358 /****************************************************************************/
1359 static inline void chipcHw_vpmHwPhaseAlignEnable(void)
1362 pChipcHw
->VPMPhaseCtrl1
|= chipcHw_REG_VPM_HW_PHASE_CTRL_ENABLE
;
1363 REG_LOCAL_IRQ_RESTORE
;
1366 /****************************************************************************/
1368 * @brief Disable VPM phase alignment in hardware
1371 /****************************************************************************/
1372 static inline void chipcHw_vpmHwPhaseAlignDisable(void)
1375 pChipcHw
->VPMPhaseCtrl1
&= ~chipcHw_REG_VPM_HW_PHASE_CTRL_ENABLE
;
1376 REG_LOCAL_IRQ_RESTORE
;
1379 /****************************************************************************/
1381 * @brief Set DDR phase alignment margin in hardware
1384 /****************************************************************************/
1386 chipcHw_setDdrHwPhaseAlignMargin(chipcHw_DDR_HW_PHASE_MARGIN_e margin
)
1392 case chipcHw_DDR_HW_PHASE_MARGIN_STRICT
:
1396 case chipcHw_DDR_HW_PHASE_MARGIN_MEDIUM
:
1400 case chipcHw_DDR_HW_PHASE_MARGIN_WIDE
:
1409 pChipcHw
->DDRPhaseCtrl1
&=
1410 ~((chipcHw_REG_DDR_PHASE_VALUE_GE_MASK
<<
1411 chipcHw_REG_DDR_PHASE_VALUE_GE_SHIFT
)
1412 || (chipcHw_REG_DDR_PHASE_VALUE_LE_MASK
<<
1413 chipcHw_REG_DDR_PHASE_VALUE_LE_SHIFT
));
1415 pChipcHw
->DDRPhaseCtrl1
|=
1416 ((ge
<< chipcHw_REG_DDR_PHASE_VALUE_GE_SHIFT
)
1417 || (le
<< chipcHw_REG_DDR_PHASE_VALUE_LE_SHIFT
));
1419 REG_LOCAL_IRQ_RESTORE
;
1423 /****************************************************************************/
1425 * @brief Set VPM phase alignment margin in hardware
1428 /****************************************************************************/
1430 chipcHw_setVpmHwPhaseAlignMargin(chipcHw_VPM_HW_PHASE_MARGIN_e margin
)
1436 case chipcHw_VPM_HW_PHASE_MARGIN_STRICT
:
1440 case chipcHw_VPM_HW_PHASE_MARGIN_MEDIUM
:
1444 case chipcHw_VPM_HW_PHASE_MARGIN_WIDE
:
1453 pChipcHw
->VPMPhaseCtrl1
&=
1454 ~((chipcHw_REG_VPM_PHASE_VALUE_GE_MASK
<<
1455 chipcHw_REG_VPM_PHASE_VALUE_GE_SHIFT
)
1456 || (chipcHw_REG_VPM_PHASE_VALUE_LE_MASK
<<
1457 chipcHw_REG_VPM_PHASE_VALUE_LE_SHIFT
));
1459 pChipcHw
->VPMPhaseCtrl1
|=
1460 ((ge
<< chipcHw_REG_VPM_PHASE_VALUE_GE_SHIFT
)
1461 || (le
<< chipcHw_REG_VPM_PHASE_VALUE_LE_SHIFT
));
1463 REG_LOCAL_IRQ_RESTORE
;
1467 /****************************************************************************/
1469 * @brief Checks DDR phase aligned status done by HW
1471 * @return 1: When aligned
1472 * 0: When not aligned
1474 /****************************************************************************/
1475 static inline uint32_t chipcHw_isDdrHwPhaseAligned(void)
1478 PhaseAlignStatus
& chipcHw_REG_DDR_PHASE_ALIGNED
) ? 1 : 0;
1481 /****************************************************************************/
1483 * @brief Checks VPM phase aligned status done by HW
1485 * @return 1: When aligned
1486 * 0: When not aligned
1488 /****************************************************************************/
1489 static inline uint32_t chipcHw_isVpmHwPhaseAligned(void)
1492 PhaseAlignStatus
& chipcHw_REG_VPM_PHASE_ALIGNED
) ? 1 : 0;
1495 /****************************************************************************/
1497 * @brief Get DDR phase aligned status done by HW
1500 /****************************************************************************/
1501 static inline uint32_t chipcHw_getDdrHwPhaseAlignStatus(void)
1504 PhaseAlignStatus
& chipcHw_REG_DDR_PHASE_STATUS_MASK
) >>
1505 chipcHw_REG_DDR_PHASE_STATUS_SHIFT
;
1508 /****************************************************************************/
1510 * @brief Get VPM phase aligned status done by HW
1513 /****************************************************************************/
1514 static inline uint32_t chipcHw_getVpmHwPhaseAlignStatus(void)
1517 PhaseAlignStatus
& chipcHw_REG_VPM_PHASE_STATUS_MASK
) >>
1518 chipcHw_REG_VPM_PHASE_STATUS_SHIFT
;
1521 /****************************************************************************/
1523 * @brief Get DDR phase control value
1526 /****************************************************************************/
1527 static inline uint32_t chipcHw_getDdrPhaseControl(void)
1530 PhaseAlignStatus
& chipcHw_REG_DDR_PHASE_CTRL_MASK
) >>
1531 chipcHw_REG_DDR_PHASE_CTRL_SHIFT
;
1534 /****************************************************************************/
1536 * @brief Get VPM phase control value
1539 /****************************************************************************/
1540 static inline uint32_t chipcHw_getVpmPhaseControl(void)
1543 PhaseAlignStatus
& chipcHw_REG_VPM_PHASE_CTRL_MASK
) >>
1544 chipcHw_REG_VPM_PHASE_CTRL_SHIFT
;
1547 /****************************************************************************/
1549 * @brief DDR phase alignment timeout count
1551 * @note If HW fails to perform the phase alignment, it will trigger
1552 * a DDR phase alignment timeout interrupt.
1554 /****************************************************************************/
1555 static inline void chipcHw_ddrHwPhaseAlignTimeout(uint32_t busCycle
)
1558 pChipcHw
->DDRPhaseCtrl2
&=
1559 ~(chipcHw_REG_DDR_PHASE_TIMEOUT_COUNT_MASK
<<
1560 chipcHw_REG_DDR_PHASE_TIMEOUT_COUNT_SHIFT
);
1561 pChipcHw
->DDRPhaseCtrl2
|=
1562 (busCycle
& chipcHw_REG_DDR_PHASE_TIMEOUT_COUNT_MASK
) <<
1563 chipcHw_REG_DDR_PHASE_TIMEOUT_COUNT_SHIFT
;
1564 REG_LOCAL_IRQ_RESTORE
;
1567 /****************************************************************************/
1569 * @brief VPM phase alignment timeout count
1571 * @note If HW fails to perform the phase alignment, it will trigger
1572 * a VPM phase alignment timeout interrupt.
1574 /****************************************************************************/
1575 static inline void chipcHw_vpmHwPhaseAlignTimeout(uint32_t busCycle
)
1578 pChipcHw
->VPMPhaseCtrl2
&=
1579 ~(chipcHw_REG_VPM_PHASE_TIMEOUT_COUNT_MASK
<<
1580 chipcHw_REG_VPM_PHASE_TIMEOUT_COUNT_SHIFT
);
1581 pChipcHw
->VPMPhaseCtrl2
|=
1582 (busCycle
& chipcHw_REG_VPM_PHASE_TIMEOUT_COUNT_MASK
) <<
1583 chipcHw_REG_VPM_PHASE_TIMEOUT_COUNT_SHIFT
;
1584 REG_LOCAL_IRQ_RESTORE
;
1587 /****************************************************************************/
1589 * @brief Clear DDR phase alignment timeout interrupt
1592 /****************************************************************************/
1593 static inline void chipcHw_ddrHwPhaseAlignTimeoutInterruptClear(void)
1596 /* Clear timeout interrupt service bit */
1597 pChipcHw
->DDRPhaseCtrl2
|= chipcHw_REG_DDR_INTR_SERVICED
;
1598 pChipcHw
->DDRPhaseCtrl2
&= ~chipcHw_REG_DDR_INTR_SERVICED
;
1599 REG_LOCAL_IRQ_RESTORE
;
1602 /****************************************************************************/
1604 * @brief Clear VPM phase alignment timeout interrupt
1607 /****************************************************************************/
1608 static inline void chipcHw_vpmHwPhaseAlignTimeoutInterruptClear(void)
1611 /* Clear timeout interrupt service bit */
1612 pChipcHw
->VPMPhaseCtrl2
|= chipcHw_REG_VPM_INTR_SERVICED
;
1613 pChipcHw
->VPMPhaseCtrl2
&= ~chipcHw_REG_VPM_INTR_SERVICED
;
1614 REG_LOCAL_IRQ_RESTORE
;
1617 /****************************************************************************/
1619 * @brief DDR phase alignment timeout interrupt enable
1622 /****************************************************************************/
1623 static inline void chipcHw_ddrHwPhaseAlignTimeoutInterruptEnable(void)
1626 chipcHw_ddrHwPhaseAlignTimeoutInterruptClear(); /* Recommended */
1627 /* Enable timeout interrupt */
1628 pChipcHw
->DDRPhaseCtrl2
|= chipcHw_REG_DDR_TIMEOUT_INTR_ENABLE
;
1629 REG_LOCAL_IRQ_RESTORE
;
1632 /****************************************************************************/
1634 * @brief VPM phase alignment timeout interrupt enable
1637 /****************************************************************************/
1638 static inline void chipcHw_vpmHwPhaseAlignTimeoutInterruptEnable(void)
1641 chipcHw_vpmHwPhaseAlignTimeoutInterruptClear(); /* Recommended */
1642 /* Enable timeout interrupt */
1643 pChipcHw
->VPMPhaseCtrl2
|= chipcHw_REG_VPM_TIMEOUT_INTR_ENABLE
;
1644 REG_LOCAL_IRQ_RESTORE
;
1647 /****************************************************************************/
1649 * @brief DDR phase alignment timeout interrupt disable
1652 /****************************************************************************/
1653 static inline void chipcHw_ddrHwPhaseAlignTimeoutInterruptDisable(void)
1656 pChipcHw
->DDRPhaseCtrl2
&= ~chipcHw_REG_DDR_TIMEOUT_INTR_ENABLE
;
1657 REG_LOCAL_IRQ_RESTORE
;
1660 /****************************************************************************/
1662 * @brief VPM phase alignment timeout interrupt disable
1665 /****************************************************************************/
1666 static inline void chipcHw_vpmHwPhaseAlignTimeoutInterruptDisable(void)
1669 pChipcHw
->VPMPhaseCtrl2
&= ~chipcHw_REG_VPM_TIMEOUT_INTR_ENABLE
;
1670 REG_LOCAL_IRQ_RESTORE
;
1673 #endif /* CHIPC_INLINE_H */