MSP432p401r: Where is this declaration?












0















I am attempting to move some of TI's driverlib functions over to my own drivers so that the code is smaller and easier to handle. However, I am having a lot of trouble with the driverlib, specifically the eUSCI declarations.
This line:



/* Disable the USCI module and clears the other bits of control register */
BITBAND_PERI(EUSCI_B_CMSIS(moduleInstance)->rCTLW0.r,UCSWRST_OFS) = 1;


is in the I2C_initMaster() function in driverlib.c. However I cannot find a declaration for the ->rCTLW0.r segment. Is there a way around using this?










share|improve this question



























    0















    I am attempting to move some of TI's driverlib functions over to my own drivers so that the code is smaller and easier to handle. However, I am having a lot of trouble with the driverlib, specifically the eUSCI declarations.
    This line:



    /* Disable the USCI module and clears the other bits of control register */
    BITBAND_PERI(EUSCI_B_CMSIS(moduleInstance)->rCTLW0.r,UCSWRST_OFS) = 1;


    is in the I2C_initMaster() function in driverlib.c. However I cannot find a declaration for the ->rCTLW0.r segment. Is there a way around using this?










    share|improve this question

























      0












      0








      0








      I am attempting to move some of TI's driverlib functions over to my own drivers so that the code is smaller and easier to handle. However, I am having a lot of trouble with the driverlib, specifically the eUSCI declarations.
      This line:



      /* Disable the USCI module and clears the other bits of control register */
      BITBAND_PERI(EUSCI_B_CMSIS(moduleInstance)->rCTLW0.r,UCSWRST_OFS) = 1;


      is in the I2C_initMaster() function in driverlib.c. However I cannot find a declaration for the ->rCTLW0.r segment. Is there a way around using this?










      share|improve this question














      I am attempting to move some of TI's driverlib functions over to my own drivers so that the code is smaller and easier to handle. However, I am having a lot of trouble with the driverlib, specifically the eUSCI declarations.
      This line:



      /* Disable the USCI module and clears the other bits of control register */
      BITBAND_PERI(EUSCI_B_CMSIS(moduleInstance)->rCTLW0.r,UCSWRST_OFS) = 1;


      is in the I2C_initMaster() function in driverlib.c. However I cannot find a declaration for the ->rCTLW0.r segment. Is there a way around using this?







      msp430 code-composer msp432






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 26 '18 at 6:36









      windoge_10windoge_10

      74




      74
























          1 Answer
          1






          active

          oldest

          votes


















          0














          driverlib/MSP432P4xx/eusci.h has:





          #define EUSCI_A_CMSIS(x) ((EUSCI_A_Type *) x)


          inc/msp432p401r.h has:



          typedef struct {
          __IO uint16_t CTLW0; /**< eUSCI_Ax Control Word Register 0 */
          __IO uint16_t CTLW1; /**< eUSCI_Ax Control Word Register 1 */
          uint16_t RESERVED0;
          __IO uint16_t BRW; /**< eUSCI_Ax Baud Rate Control Word Register */
          __IO uint16_t MCTLW; /**< eUSCI_Ax Modulation Control Word Register */
          __IO uint16_t STATW; /**< eUSCI_Ax Status Register */
          __I uint16_t RXBUF; /**< eUSCI_Ax Receive Buffer Register */
          __IO uint16_t TXBUF; /**< eUSCI_Ax Transmit Buffer Register */
          __IO uint16_t ABCTL; /**< eUSCI_Ax Auto Baud Rate Control Register */
          __IO uint16_t IRCTL; /**< eUSCI_Ax IrDA Control Word Register */
          uint16_t RESERVED1[3];
          __IO uint16_t IE; /**< eUSCI_Ax Interrupt Enable Register */
          __IO uint16_t IFG; /**< eUSCI_Ax Interrupt Flag Register */
          __I uint16_t IV; /**< eUSCI_Ax Interrupt Vector Register */
          } EUSCI_A_Type;


          That rXXX.r stuff is used only in the ROM driverlib. It looks as if each register was declared as a union, probably to allow all bytes to be accessed separately. The source code of the ROM driverlib cannot ever be changed, but the source code of the driverlib that you can compile yourself (driverlib/MSP432P4xx/i2c.c, not rom/MSP432P4xx/driverlib.c) uses the correct declarations.



          (And if you don't like the CMSIS-style register accesses, use msp432p401r_classic.h.)






          share|improve this answer
























          • Thanks, I realized that this was probably the case once I found similar declarations in the drivers. My plan is to skip driverlib completely and use the drivers independently.

            – windoge_10
            Nov 28 '18 at 19:07











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53475848%2fmsp432p401r-where-is-this-declaration%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          driverlib/MSP432P4xx/eusci.h has:





          #define EUSCI_A_CMSIS(x) ((EUSCI_A_Type *) x)


          inc/msp432p401r.h has:



          typedef struct {
          __IO uint16_t CTLW0; /**< eUSCI_Ax Control Word Register 0 */
          __IO uint16_t CTLW1; /**< eUSCI_Ax Control Word Register 1 */
          uint16_t RESERVED0;
          __IO uint16_t BRW; /**< eUSCI_Ax Baud Rate Control Word Register */
          __IO uint16_t MCTLW; /**< eUSCI_Ax Modulation Control Word Register */
          __IO uint16_t STATW; /**< eUSCI_Ax Status Register */
          __I uint16_t RXBUF; /**< eUSCI_Ax Receive Buffer Register */
          __IO uint16_t TXBUF; /**< eUSCI_Ax Transmit Buffer Register */
          __IO uint16_t ABCTL; /**< eUSCI_Ax Auto Baud Rate Control Register */
          __IO uint16_t IRCTL; /**< eUSCI_Ax IrDA Control Word Register */
          uint16_t RESERVED1[3];
          __IO uint16_t IE; /**< eUSCI_Ax Interrupt Enable Register */
          __IO uint16_t IFG; /**< eUSCI_Ax Interrupt Flag Register */
          __I uint16_t IV; /**< eUSCI_Ax Interrupt Vector Register */
          } EUSCI_A_Type;


          That rXXX.r stuff is used only in the ROM driverlib. It looks as if each register was declared as a union, probably to allow all bytes to be accessed separately. The source code of the ROM driverlib cannot ever be changed, but the source code of the driverlib that you can compile yourself (driverlib/MSP432P4xx/i2c.c, not rom/MSP432P4xx/driverlib.c) uses the correct declarations.



          (And if you don't like the CMSIS-style register accesses, use msp432p401r_classic.h.)






          share|improve this answer
























          • Thanks, I realized that this was probably the case once I found similar declarations in the drivers. My plan is to skip driverlib completely and use the drivers independently.

            – windoge_10
            Nov 28 '18 at 19:07
















          0














          driverlib/MSP432P4xx/eusci.h has:





          #define EUSCI_A_CMSIS(x) ((EUSCI_A_Type *) x)


          inc/msp432p401r.h has:



          typedef struct {
          __IO uint16_t CTLW0; /**< eUSCI_Ax Control Word Register 0 */
          __IO uint16_t CTLW1; /**< eUSCI_Ax Control Word Register 1 */
          uint16_t RESERVED0;
          __IO uint16_t BRW; /**< eUSCI_Ax Baud Rate Control Word Register */
          __IO uint16_t MCTLW; /**< eUSCI_Ax Modulation Control Word Register */
          __IO uint16_t STATW; /**< eUSCI_Ax Status Register */
          __I uint16_t RXBUF; /**< eUSCI_Ax Receive Buffer Register */
          __IO uint16_t TXBUF; /**< eUSCI_Ax Transmit Buffer Register */
          __IO uint16_t ABCTL; /**< eUSCI_Ax Auto Baud Rate Control Register */
          __IO uint16_t IRCTL; /**< eUSCI_Ax IrDA Control Word Register */
          uint16_t RESERVED1[3];
          __IO uint16_t IE; /**< eUSCI_Ax Interrupt Enable Register */
          __IO uint16_t IFG; /**< eUSCI_Ax Interrupt Flag Register */
          __I uint16_t IV; /**< eUSCI_Ax Interrupt Vector Register */
          } EUSCI_A_Type;


          That rXXX.r stuff is used only in the ROM driverlib. It looks as if each register was declared as a union, probably to allow all bytes to be accessed separately. The source code of the ROM driverlib cannot ever be changed, but the source code of the driverlib that you can compile yourself (driverlib/MSP432P4xx/i2c.c, not rom/MSP432P4xx/driverlib.c) uses the correct declarations.



          (And if you don't like the CMSIS-style register accesses, use msp432p401r_classic.h.)






          share|improve this answer
























          • Thanks, I realized that this was probably the case once I found similar declarations in the drivers. My plan is to skip driverlib completely and use the drivers independently.

            – windoge_10
            Nov 28 '18 at 19:07














          0












          0








          0







          driverlib/MSP432P4xx/eusci.h has:





          #define EUSCI_A_CMSIS(x) ((EUSCI_A_Type *) x)


          inc/msp432p401r.h has:



          typedef struct {
          __IO uint16_t CTLW0; /**< eUSCI_Ax Control Word Register 0 */
          __IO uint16_t CTLW1; /**< eUSCI_Ax Control Word Register 1 */
          uint16_t RESERVED0;
          __IO uint16_t BRW; /**< eUSCI_Ax Baud Rate Control Word Register */
          __IO uint16_t MCTLW; /**< eUSCI_Ax Modulation Control Word Register */
          __IO uint16_t STATW; /**< eUSCI_Ax Status Register */
          __I uint16_t RXBUF; /**< eUSCI_Ax Receive Buffer Register */
          __IO uint16_t TXBUF; /**< eUSCI_Ax Transmit Buffer Register */
          __IO uint16_t ABCTL; /**< eUSCI_Ax Auto Baud Rate Control Register */
          __IO uint16_t IRCTL; /**< eUSCI_Ax IrDA Control Word Register */
          uint16_t RESERVED1[3];
          __IO uint16_t IE; /**< eUSCI_Ax Interrupt Enable Register */
          __IO uint16_t IFG; /**< eUSCI_Ax Interrupt Flag Register */
          __I uint16_t IV; /**< eUSCI_Ax Interrupt Vector Register */
          } EUSCI_A_Type;


          That rXXX.r stuff is used only in the ROM driverlib. It looks as if each register was declared as a union, probably to allow all bytes to be accessed separately. The source code of the ROM driverlib cannot ever be changed, but the source code of the driverlib that you can compile yourself (driverlib/MSP432P4xx/i2c.c, not rom/MSP432P4xx/driverlib.c) uses the correct declarations.



          (And if you don't like the CMSIS-style register accesses, use msp432p401r_classic.h.)






          share|improve this answer













          driverlib/MSP432P4xx/eusci.h has:





          #define EUSCI_A_CMSIS(x) ((EUSCI_A_Type *) x)


          inc/msp432p401r.h has:



          typedef struct {
          __IO uint16_t CTLW0; /**< eUSCI_Ax Control Word Register 0 */
          __IO uint16_t CTLW1; /**< eUSCI_Ax Control Word Register 1 */
          uint16_t RESERVED0;
          __IO uint16_t BRW; /**< eUSCI_Ax Baud Rate Control Word Register */
          __IO uint16_t MCTLW; /**< eUSCI_Ax Modulation Control Word Register */
          __IO uint16_t STATW; /**< eUSCI_Ax Status Register */
          __I uint16_t RXBUF; /**< eUSCI_Ax Receive Buffer Register */
          __IO uint16_t TXBUF; /**< eUSCI_Ax Transmit Buffer Register */
          __IO uint16_t ABCTL; /**< eUSCI_Ax Auto Baud Rate Control Register */
          __IO uint16_t IRCTL; /**< eUSCI_Ax IrDA Control Word Register */
          uint16_t RESERVED1[3];
          __IO uint16_t IE; /**< eUSCI_Ax Interrupt Enable Register */
          __IO uint16_t IFG; /**< eUSCI_Ax Interrupt Flag Register */
          __I uint16_t IV; /**< eUSCI_Ax Interrupt Vector Register */
          } EUSCI_A_Type;


          That rXXX.r stuff is used only in the ROM driverlib. It looks as if each register was declared as a union, probably to allow all bytes to be accessed separately. The source code of the ROM driverlib cannot ever be changed, but the source code of the driverlib that you can compile yourself (driverlib/MSP432P4xx/i2c.c, not rom/MSP432P4xx/driverlib.c) uses the correct declarations.



          (And if you don't like the CMSIS-style register accesses, use msp432p401r_classic.h.)







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 26 '18 at 7:48









          CL.CL.

          137k13125159




          137k13125159













          • Thanks, I realized that this was probably the case once I found similar declarations in the drivers. My plan is to skip driverlib completely and use the drivers independently.

            – windoge_10
            Nov 28 '18 at 19:07



















          • Thanks, I realized that this was probably the case once I found similar declarations in the drivers. My plan is to skip driverlib completely and use the drivers independently.

            – windoge_10
            Nov 28 '18 at 19:07

















          Thanks, I realized that this was probably the case once I found similar declarations in the drivers. My plan is to skip driverlib completely and use the drivers independently.

          – windoge_10
          Nov 28 '18 at 19:07





          Thanks, I realized that this was probably the case once I found similar declarations in the drivers. My plan is to skip driverlib completely and use the drivers independently.

          – windoge_10
          Nov 28 '18 at 19:07




















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53475848%2fmsp432p401r-where-is-this-declaration%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Costa Masnaga

          Fotorealismo

          Sidney Franklin