You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by GitBox <gi...@apache.org> on 2022/06/15 20:12:52 UTC

[GitHub] [mynewt-core] apache-mynewt-bot commented on pull request #2851: Ambiq Apollo3: Utilize ram buffer to handle flash to flash memory writes

apache-mynewt-bot commented on PR #2851:
URL: https://github.com/apache/mynewt-core/pull/2851#issuecomment-1156886227

   
   <!-- style-bot -->
   
   ## Style check summary
   
   ### Our coding style is [here!](https://github.com/apache/mynewt-core/blob/master/CODING_STANDARDS.md)
   
   
   #### hw/mcu/ambiq/apollo3/src/hal_flash.c
   <details>
   
   ```diff
   @@ -93,7 +93,7 @@
    
    static int
    apollo3_flash_write_default(const struct hal_flash *dev, uint32_t address,
   -    const void *src, uint32_t num_bytes) 
   +                            const void *src, uint32_t num_bytes)
    {
        const uint8_t *u8p;
        int lead_size;
   @@ -170,7 +170,7 @@
    
    static int
    apollo3_flash_write(const struct hal_flash *dev, uint32_t address,
   -    const void *src, uint32_t num_bytes)
   +                    const void *src, uint32_t num_bytes)
    {
        int rc = 0;
        uint32_t offset = 0;
   @@ -178,11 +178,12 @@
        uint8_t ram_buf[MYNEWT_VAL(FLASH_INTERMEDIARY_BUF_SIZE)];
    
        /* Handle in the default manner if src data is already in ram */
   -    if((uint32_t)src > apollo3_flash_dev.hf_size - apollo3_flash_dev.hf_base_addr) {
   +    if ((uint32_t)src > apollo3_flash_dev.hf_size - apollo3_flash_dev.hf_base_addr) {
            rc = apollo3_flash_write_default(dev, address, src, num_bytes);
        } else {
   -        while(num_bytes) {
   -            chunk_len = num_bytes > MYNEWT_VAL(FLASH_INTERMEDIARY_BUF_SIZE) ? MYNEWT_VAL(FLASH_INTERMEDIARY_BUF_SIZE) : num_bytes;
   +        while (num_bytes) {
   +            chunk_len = num_bytes >
   +                        MYNEWT_VAL(FLASH_INTERMEDIARY_BUF_SIZE) ? MYNEWT_VAL(FLASH_INTERMEDIARY_BUF_SIZE) : num_bytes;
                memcpy(ram_buf, src+offset, chunk_len);
                rc = apollo3_flash_write_default(dev, address+offset, ram_buf, chunk_len);
    
   ```
   
   </details>


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org