| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602 |
- /** @file sys_pcr.c
- * @brief PCR Driver Implementation File
- * @date 29.May.2013
- * @version 03.05.02
- *
- */
- /* (c) Texas Instruments 2009-2013, All rights reserved. */
- #include "sys_pcr.h"
- /* USER CODE BEGIN (0) */
- /* USER CODE END */
- /* USER CODE BEGIN (1) */
- /* USER CODE END */
- /** @fn void peripheral_Frame_Protection_Set(peripheral_Frame_Select_t peripheral_Frame)
- * @brief Set the peripheral protection of the selected frame
- * @param[in] peripheral_Frame - Peripheral frame to be protected
- *
- * This function sets the protection for the selected frame.
- */
- void peripheral_Frame_Protection_Set(peripheral_Frame_Select_t peripheral_Frame)
- {
- /* USER CODE BEGIN (2) */
- /* USER CODE END */
- uint32 chip_select_grp;
- uint32 Quarant_selct;
- chip_select_grp = (peripheral_Frame.Peripheral_CS >> 3U);
- Quarant_selct = (uint32)(peripheral_Frame.Peripheral_Quadrant << ((peripheral_Frame.Peripheral_CS & 7U) << 2U));
- if (chip_select_grp >= 3U)
- {
- pcrREG->PPROTSET3 = Quarant_selct;
- }
- else if (chip_select_grp >= 2U)
- {
- pcrREG->PPROTSET2 = Quarant_selct;
- }
- else if (chip_select_grp >= 1U)
- {
- pcrREG->PPROTSET1 = Quarant_selct;
- }
- else
- {
- pcrREG->PPROTSET0 = Quarant_selct;
- }
-
- /* USER CODE BEGIN (3) */
- /* USER CODE END */
- }
- /* USER CODE BEGIN (4) */
- /* USER CODE END */
- /** @fn void peripheral_Frame_Protection_Clr(peripheral_Frame_Select_t peripheral_Frame)
- * @brief Clear the peripheral protection of the selected frame
- * @param[in] peripheral_Frame - Peripheral frame to be out of protection
- *
- * This function clears the protection set for the selected frame.
- */
- void peripheral_Frame_Protection_Clr(peripheral_Frame_Select_t peripheral_Frame)
- {
- /* USER CODE BEGIN (5) */
- /* USER CODE END */
- uint32 chip_select_grp;
- uint32 Quarant_selct;
- chip_select_grp = (peripheral_Frame.Peripheral_CS >> 3U);
- Quarant_selct = (uint32)(peripheral_Frame.Peripheral_Quadrant << ((peripheral_Frame.Peripheral_CS & 7U) << 2U));
- if (chip_select_grp >= 3U)
- {
- pcrREG->PPROTCLR3 = Quarant_selct;
- }
- else if (chip_select_grp >= 2U)
- {
- pcrREG->PPROTCLR2 = Quarant_selct;
- }
- else if (chip_select_grp >= 1U)
- {
- pcrREG->PPROTCLR1 = Quarant_selct;
- }
- else
- {
- pcrREG->PPROTCLR0 = Quarant_selct;
- }
-
- /* USER CODE BEGIN (6) */
- /* USER CODE END */
- }
- /* USER CODE BEGIN (7) */
- /* USER CODE END */
- /** @fn void peripheral_Frame_Powerdown_Set(peripheral_Frame_Select_t peripheral_Frame)
- * @brief Take the selected peripheral to powerdown
- * @param[in] peripheral_Frame - Peripheral frame to be taken to powerdown
- *
- * This function will set the selected peripheral frame to powerdown.
- */
- void peripheral_Frame_Powerdown_Set(peripheral_Frame_Select_t peripheral_Frame)
- {
- /* USER CODE BEGIN (8) */
- /* USER CODE END */
- uint32 chip_select_grp;
- uint32 Quarant_selct;
- chip_select_grp = (peripheral_Frame.Peripheral_CS >> 3U);
- Quarant_selct = (uint32)(peripheral_Frame.Peripheral_Quadrant << ((peripheral_Frame.Peripheral_CS & 7U) << 2U));
-
- if (chip_select_grp >= 3U)
- {
- pcrREG->PSPWRDWNSET3 = Quarant_selct;
- }
- else if (chip_select_grp >= 2U)
- {
- pcrREG->PSPWRDWNSET2 = Quarant_selct;
- }
- else if (chip_select_grp >= 1U)
- {
- pcrREG->PSPWRDWNSET1 = Quarant_selct;
- }
- else
- {
- pcrREG->PSPWRDWNSET0 = Quarant_selct;
- }
-
- /* USER CODE BEGIN (9) */
- /* USER CODE END */
- }
- /* USER CODE BEGIN (10) */
- /* USER CODE END */
- /** @fn void peripheral_Frame_Powerdown_Clr(peripheral_Frame_Select_t peripheral_Frame)
- * @brief Bring the selected peripheral frame out of powerdown
- * @param[in] peripheral_Frame - Peripheral frame to be taken out of powerdown
- *
- * This function will bring the selected peripheral frame out of powerdown.
- */
- void peripheral_Frame_Powerdown_Clr(peripheral_Frame_Select_t peripheral_Frame)
- {
- /* USER CODE BEGIN (11) */
- /* USER CODE END */
- uint32 chip_select_grp;
- uint32 Quarant_selct;
- chip_select_grp = (peripheral_Frame.Peripheral_CS >> 3U);
- Quarant_selct = (uint32)(peripheral_Frame.Peripheral_Quadrant << ((peripheral_Frame.Peripheral_CS & 7U) << 2U));
-
- if (chip_select_grp >= 3U)
- {
- pcrREG->PSPWRDWNCLR3 = Quarant_selct;
- }
- else if (chip_select_grp >= 2U)
- {
- pcrREG->PSPWRDWNCLR2 = Quarant_selct;
- }
- else if (chip_select_grp >= 1U)
- {
- pcrREG->PSPWRDWNCLR1 = Quarant_selct;
- }
- else
- {
- pcrREG->PSPWRDWNCLR0 = Quarant_selct;
- }
- /* USER CODE BEGIN (12) */
- /* USER CODE END */
- }
- /* USER CODE BEGIN (13) */
- /* USER CODE END */
- /** @fn void peripheral_Mem_Frame_Prot_Set(peripheral_MemoryFrame_CS_t peripheral_Memory_Frame_CS)
- * @brief Set the peripheral memory protection of the selected frame
- * @param[in] peripheral_Memory_Frame_CS - Peripheral memory frame to be protected
- *
- * This function sets the protection for the selected peripheral memory frame.
- */
- void peripheral_Mem_Frame_Prot_Set(peripheral_MemoryFrame_CS_t peripheral_Memory_Frame_CS)
- {
- /* USER CODE BEGIN (14) */
- /* USER CODE END */
- uint32 chip_select_grp;
- chip_select_grp = (peripheral_Memory_Frame_CS >> 5U);
- if (chip_select_grp >= 1U)
- {
- pcrREG->PMPROTSET1 = (1U << (peripheral_Memory_Frame_CS & 0xFU));
- }
- else
- {
- pcrREG->PMPROTSET0 = (1U << peripheral_Memory_Frame_CS);
- }
-
- /* USER CODE BEGIN (15) */
- /* USER CODE END */
- }
- /* USER CODE BEGIN (16) */
- /* USER CODE END */
- /** @fn void peripheral_Mem_Frame_Prot_Clr(peripheral_MemoryFrame_CS_t peripheral_Memory_Frame_CS)
- * @brief Clear the peripheral memory protection of the selected frame
- * @param[in] peripheral_Memory_Frame_CS - Peripheral memory frame to be cleared from protection
- *
- * This function clears the protection set for the selected peripheral memory frame.
- */
- void peripheral_Mem_Frame_Prot_Clr(peripheral_MemoryFrame_CS_t peripheral_Memory_Frame_CS)
- {
- /* USER CODE BEGIN (17) */
- /* USER CODE END */
- uint32 chip_select_grp;
- chip_select_grp = (peripheral_Memory_Frame_CS >> 5U);
- if (chip_select_grp >= 1U)
- {
- pcrREG->PMPROTCLR1 = (1U << (peripheral_Memory_Frame_CS & 0xFU));
- }
- else
- {
- pcrREG->PMPROTCLR0 = (1U << peripheral_Memory_Frame_CS);
- }
- /* USER CODE BEGIN (18) */
- /* USER CODE END */
- }
- /* USER CODE BEGIN (19) */
- /* USER CODE END */
- /** @fn void peripheral_Mem_Frame_Pwrdwn_Set(peripheral_MemoryFrame_CS_t peripheral_Memory_Frame_CS)
- * @brief Take the selected peripheral memory frame to powerdown
- * @param[in] peripheral_Memory_Frame_CS - Peripheral memory frame to be taken to powerdown
- *
- * This function will set the selected peripheral memory frame to powerdown.
- */
- void peripheral_Mem_Frame_Pwrdwn_Set(peripheral_MemoryFrame_CS_t peripheral_Memory_Frame_CS)
- {
- /* USER CODE BEGIN (20) */
- /* USER CODE END */
- uint32 chip_select_grp;
- chip_select_grp = (peripheral_Memory_Frame_CS >> 5U);
- if (chip_select_grp >= 1U)
- {
- pcrREG->PSPWRDWNSET1 = (1U << (peripheral_Memory_Frame_CS & 0xFU));
- }
- else
- {
- pcrREG->PSPWRDWNSET0 = (1U << peripheral_Memory_Frame_CS);
- }
-
- /* USER CODE BEGIN (21) */
- /* USER CODE END */
- }
- /* USER CODE BEGIN (22) */
- /* USER CODE END */
- /** @fn void peripheral_Mem_Frame_Pwrdwn_Clr (peripheral_MemoryFrame_CS_t peripheral_Memory_Frame_CS)
- * @brief Bring the selected peripheral Memory frame out of powerdown
- * @param[in] peripheral_Memory_Frame_CS - Peripheral memory frame to be taken out of powerdown
- *
- * This function will bring the selected peripheral memory frame out of powerdown.
- */
- void peripheral_Mem_Frame_Pwrdwn_Clr (peripheral_MemoryFrame_CS_t peripheral_Memory_Frame_CS)
- {
- /* USER CODE BEGIN (23) */
- /* USER CODE END */
- uint32 chip_select_grp;
- chip_select_grp = (peripheral_Memory_Frame_CS >> 5U);
- if (chip_select_grp >= 1U)
- {
- pcrREG->PSPWRDWNCLR1 = (1U << (peripheral_Memory_Frame_CS & 0xFU));
- }
- else
- {
- pcrREG->PSPWRDWNCLR0 = (1U << peripheral_Memory_Frame_CS);
- }
-
- /* USER CODE BEGIN (24) */
- /* USER CODE END */
- }
- /* USER CODE BEGIN (25) */
- /* USER CODE END */
- /** @fn void peripheral_Protection_Set(peripheral_Quad_ChipSelect_t peripheral_Quad_CS)
- * @brief Set the peripheral protection of all the selected frames
- * @param[in] peripheral_Quad_CS - All Peripheral frames to be protected
- *
- * This function sets the protection for all the selected frames.
- */
- void peripheral_Protection_Set(peripheral_Quad_ChipSelect_t peripheral_Quad_CS)
- {
- /* USER CODE BEGIN (26) */
- /* USER CODE END */
- pcrREG->PPROTSET0 = peripheral_Quad_CS.Peripheral_Quad0_3_CS0_7;
- pcrREG->PPROTSET1 = peripheral_Quad_CS.Peripheral_Quad4_7_CS8_15;
- pcrREG->PPROTSET2 = peripheral_Quad_CS.Peripheral_Quad8_11_CS16_23;
- pcrREG->PPROTSET3 = peripheral_Quad_CS.Peripheral_Quad12_15_CS24_31;
-
- /* USER CODE BEGIN (27) */
- /* USER CODE END */
- }
- /* USER CODE BEGIN (28) */
- /* USER CODE END */
- /** @fn void peripheral_Protection_Clr(peripheral_Quad_ChipSelect_t peripheral_Quad_CS)
- * @brief Clear the peripheral protection of all the selected frames
- * @param[in] peripheral_Quad_CS - All Peripheral frames to be out of protection.
- *
- * This function clears the protection set for all the selected frame.
- */
- void peripheral_Protection_Clr(peripheral_Quad_ChipSelect_t peripheral_Quad_CS)
- {
- /* USER CODE BEGIN (29) */
- /* USER CODE END */
- pcrREG->PPROTCLR0 = peripheral_Quad_CS.Peripheral_Quad0_3_CS0_7;
- pcrREG->PPROTCLR1 = peripheral_Quad_CS.Peripheral_Quad4_7_CS8_15;
- pcrREG->PPROTCLR2 = peripheral_Quad_CS.Peripheral_Quad8_11_CS16_23;
- pcrREG->PPROTCLR3 = peripheral_Quad_CS.Peripheral_Quad12_15_CS24_31;
- /* USER CODE BEGIN (30) */
- /* USER CODE END */
- }
- /* USER CODE BEGIN (31) */
- /* USER CODE END */
- /** @fn void peripheral_Powerdown_Set(peripheral_Quad_ChipSelect_t peripheral_Quad_CS)
- * @brief Take all the selected peripheral frame to powerdown
- * @param[in] peripheral_Quad_CS - Peripheral frames to be taken to powerdown
- *
- * This function will set all the selected peripheral frame to powerdown.
- */
- void peripheral_Powerdown_Set(peripheral_Quad_ChipSelect_t peripheral_Quad_CS)
- {
- /* USER CODE BEGIN (32) */
- /* USER CODE END */
- pcrREG->PSPWRDWNSET0 = peripheral_Quad_CS.Peripheral_Quad0_3_CS0_7;
- pcrREG->PSPWRDWNSET1 = peripheral_Quad_CS.Peripheral_Quad4_7_CS8_15;
- pcrREG->PSPWRDWNSET2 = peripheral_Quad_CS.Peripheral_Quad8_11_CS16_23;
- pcrREG->PSPWRDWNSET3 = peripheral_Quad_CS.Peripheral_Quad12_15_CS24_31;
- /* USER CODE BEGIN (33) */
- /* USER CODE END */
- }
- /* USER CODE BEGIN (34) */
- /* USER CODE END */
- /** @fn void peripheral_Powerdown_Clr(peripheral_Quad_ChipSelect_t peripheral_Quad_CS)
- * @brief Bring all the selected peripheral frame out of powerdown
- * @param[in] peripheral_Quad_CS - Peripheral frames to be taken out of powerdown
- *
- * This function will bring all the selected peripheral frame out of powerdown.
- */
- void peripheral_Powerdown_Clr(peripheral_Quad_ChipSelect_t peripheral_Quad_CS)
- {
- /* USER CODE BEGIN (35) */
- /* USER CODE END */
- pcrREG->PSPWRDWNCLR0 = peripheral_Quad_CS.Peripheral_Quad0_3_CS0_7;
- pcrREG->PSPWRDWNCLR1 = peripheral_Quad_CS.Peripheral_Quad4_7_CS8_15;
- pcrREG->PSPWRDWNCLR2 = peripheral_Quad_CS.Peripheral_Quad8_11_CS16_23;
- pcrREG->PSPWRDWNCLR3 = peripheral_Quad_CS.Peripheral_Quad12_15_CS24_31;
- /* USER CODE BEGIN (36) */
- /* USER CODE END */
- }
- /* USER CODE BEGIN (37) */
- /* USER CODE END */
- /** @fn void peripheral_Memory_Protection_Set(peripheral_Memory_ChipSelect_t peripheral_Memory_CS)
- * @brief Set the peripheral memory protection of all the selected frame
- * @param[in] peripheral_Memory_CS - Peripheral memory frames to be protected
- *
- * This function sets the protection for all the selected peripheral memory frame.
- */
- void peripheral_Memory_Protection_Set(peripheral_Memory_ChipSelect_t peripheral_Memory_CS)
- {
- /* USER CODE BEGIN (38) */
- /* USER CODE END */
- pcrREG->PMPROTSET0 = peripheral_Memory_CS.Peripheral_Mem_CS0_31;
- pcrREG->PMPROTSET1 = peripheral_Memory_CS.Peripheral_Mem_CS32_63;
- /* USER CODE BEGIN (39) */
- /* USER CODE END */
- }
- /* USER CODE BEGIN (40) */
- /* USER CODE END */
- /** @fn void peripheral_Memory_Protection_Clr(peripheral_Memory_ChipSelect_t peripheral_Memory_CS)
- * @brief Clear the peripheral memory protection of all the selected frame
- * @param[in] peripheral_Memory_CS - Peripheral memory frames to be cleared from protection
- *
- * This function clears the protection set for all the selected peripheral memory frame.
- */
- void peripheral_Memory_Protection_Clr(peripheral_Memory_ChipSelect_t peripheral_Memory_CS)
- {
- /* USER CODE BEGIN (41) */
- /* USER CODE END */
- pcrREG->PMPROTCLR0 = peripheral_Memory_CS.Peripheral_Mem_CS0_31;
- pcrREG->PMPROTCLR1 = peripheral_Memory_CS.Peripheral_Mem_CS32_63;
- /* USER CODE BEGIN (42) */
- /* USER CODE END */
- }
- /* USER CODE BEGIN (43) */
- /* USER CODE END */
- /** @fn void peripheral_Memory_Powerdown_Set(peripheral_Memory_ChipSelect_t peripheral_Memory_CS)
- * @brief Take all the selected peripheral memory frame to powerdown
- * @param[in] peripheral_Memory_CS - Peripheral memory frames to be taken to powerdown
- *
- * This function will set all the selected peripheral memory frame to powerdown.
- */
- void peripheral_Memory_Powerdown_Set(peripheral_Memory_ChipSelect_t peripheral_Memory_CS)
- {
- /* USER CODE BEGIN (44) */
- /* USER CODE END */
- pcrREG->PSPWRDWNSET0 = peripheral_Memory_CS.Peripheral_Mem_CS0_31;
- pcrREG->PSPWRDWNSET1 = peripheral_Memory_CS.Peripheral_Mem_CS32_63;
-
- /* USER CODE BEGIN (45) */
- /* USER CODE END */
- }
- /* USER CODE BEGIN (46) */
- /* USER CODE END */
- /** @fn void peripheral_Memory_Powerdown_Clr(peripheral_Memory_ChipSelect_t peripheral_Memory_CS)
- * @brief Bring all the selected peripheral Memory frame out of powerdown
- * @param[in] peripheral_Memory_CS - Peripheral memory frames to be taken out of powerdown
- *
- * This function will bring all the selected peripheral memory frame out of powerdown.
- */
- void peripheral_Memory_Powerdown_Clr(peripheral_Memory_ChipSelect_t peripheral_Memory_CS)
- {
- /* USER CODE BEGIN (47) */
- /* USER CODE END */
- pcrREG->PSPWRDWNCLR0 = peripheral_Memory_CS.Peripheral_Mem_CS0_31;
- pcrREG->PSPWRDWNCLR1 = peripheral_Memory_CS.Peripheral_Mem_CS32_63;
- /* USER CODE BEGIN (48) */
- /* USER CODE END */
- }
- /* USER CODE BEGIN (49) */
- /* USER CODE END */
- /** @fn peripheral_Quad_ChipSelect_t peripheral_Powerdown_Status(void)
- * @brief Get the powerdown status of the peripheral frames.
- * @return Peripheral frames power down status
- *
- * This function gets the powerdown status of the peripheral frames.
- */
- peripheral_Quad_ChipSelect_t peripheral_Powerdown_Status(void)
- {
- /* USER CODE BEGIN (50) */
- /* USER CODE END */
- peripheral_Quad_ChipSelect_t peripheral_Quad_CS;
- peripheral_Quad_CS.Peripheral_Quad0_3_CS0_7 = pcrREG->PSPWRDWNSET0;
- peripheral_Quad_CS.Peripheral_Quad4_7_CS8_15 = pcrREG->PSPWRDWNSET1;
- peripheral_Quad_CS.Peripheral_Quad8_11_CS16_23 = pcrREG->PSPWRDWNSET2;
- peripheral_Quad_CS.Peripheral_Quad12_15_CS24_31 = pcrREG->PSPWRDWNSET3;
- /* USER CODE BEGIN (51) */
- /* USER CODE END */
-
- return peripheral_Quad_CS;
- }
- /* USER CODE BEGIN (52) */
- /* USER CODE END */
- /** @fn peripheral_Quad_ChipSelect_t peripheral_Protection_Status(void)
- * @brief Get the protection status of the peripheral frames
- * @return Peripheral frames protection status
- *
- * This function gets the protection status of the peripheral frames.
- */
- peripheral_Quad_ChipSelect_t peripheral_Protection_Status(void)
- {
- /* USER CODE BEGIN (53) */
- /* USER CODE END */
- peripheral_Quad_ChipSelect_t peripheral_Quad_CS;
- peripheral_Quad_CS.Peripheral_Quad0_3_CS0_7 = pcrREG->PPROTSET0;
- peripheral_Quad_CS.Peripheral_Quad4_7_CS8_15 = pcrREG->PPROTSET1;
- peripheral_Quad_CS.Peripheral_Quad8_11_CS16_23 = pcrREG->PPROTSET2;
- peripheral_Quad_CS.Peripheral_Quad12_15_CS24_31 = pcrREG->PPROTSET3;
- /* USER CODE BEGIN (54) */
- /* USER CODE END */
-
- return peripheral_Quad_CS;
- }
- /* USER CODE BEGIN (55) */
- /* USER CODE END */
- /** @fn peripheral_Memory_ChipSelect_t peripheral_Memory_Protection_Status(void)
- * @brief Get the protection set of all the peripheral Memory frame
- * @return Peripheral memory frames protection status
- *
- * This function gets the protection status of all the peripheral Memory frame.
- */
- peripheral_Memory_ChipSelect_t peripheral_Memory_Protection_Status(void)
- {
- /* USER CODE BEGIN (56) */
- /* USER CODE END */
- peripheral_Memory_ChipSelect_t peripheral_Memory_CS;
- peripheral_Memory_CS.Peripheral_Mem_CS0_31 = pcrREG->PMPROTSET0;
- peripheral_Memory_CS.Peripheral_Mem_CS32_63 = pcrREG->PMPROTSET1;
- /* USER CODE BEGIN (57) */
- /* USER CODE END */
- return peripheral_Memory_CS;
- }
- /* USER CODE BEGIN (58) */
- /* USER CODE END */
- /** @fn peripheral_Memory_ChipSelect_t Periipheral_Memory_Powerdown_Status(void)
- * @brief Get the powerdown status of all the peripheral Memory frame
- * @return Peripheral memory frames powerdown status
- *
- * This function gets the powerdown status of all the peripheral Memory frame.
- */
- peripheral_Memory_ChipSelect_t Periipheral_Memory_Powerdown_Status(void)
- {
- /* USER CODE BEGIN (59) */
- /* USER CODE END */
- peripheral_Memory_ChipSelect_t peripheral_Memory_CS;
- peripheral_Memory_CS.Peripheral_Mem_CS0_31 = pcrREG->PSPWRDWNSET0;
- peripheral_Memory_CS.Peripheral_Mem_CS32_63 = pcrREG->PSPWRDWNSET1;
- /* USER CODE BEGIN (60) */
- /* USER CODE END */
- return peripheral_Memory_CS;
- }
- /* USER CODE BEGIN (61) */
- /* USER CODE END */
|