fork download
  1. // Online C compiler to run C program online
  2. #include <stdio.h>
  3.  
  4. #define DIAGDC_ERASEADDDATA_MINLEN (int)0u
  5.  
  6. #define DIAGDC_ERASEADD_LEN (int)0x3u
  7.  
  8. #define DIAGDC_ERASECTRL_OPRECORD_BYTES (int)0x8u
  9.  
  10. #define DiagDC_OTABANK2_ERASEADDRESS (0x03340000U)
  11. #define DiagDC_OTABANK2_ERASELENGTH (0x02800000U)
  12.  
  13. #define DIAG_u8BYTE_SHIFT_8 (8U)
  14.  
  15. #define DIAGDC_ERASEDATA_LEN (int)0x7u
  16.  
  17. int main() {
  18.  
  19. int u8BankIndex ;
  20. /* !Comment : Local array variable for routine requested Data. */
  21. int pu8ReqData[DIAGDC_ERASECTRL_OPRECORD_BYTES];
  22. /* !Comment : Local variable for Iterate index. */
  23. int u8Iter;
  24. int u8Iter1;
  25.  
  26. for(u8Iter= DIAGDC_ERASEADD_LEN,u8BankIndex = DIAGDC_ERASEADDDATA_MINLEN;u8Iter>=DIAGDC_ERASEADDDATA_MINLEN;u8Iter--,u8BankIndex++)
  27. {
  28. /** :Extracting the Bank2 Address value to pu8ReqData[u8BankIndex] variable; */
  29. pu8ReqData[u8BankIndex]= (DiagDC_OTABANK2_ERASEADDRESS>>(DIAG_u8BYTE_SHIFT_8 * u8Iter))&0xFF;
  30.  
  31. printf("%02x %d \n", pu8ReqData[u8BankIndex], u8Iter);
  32. /** repeat while (u8Iter>=DIAGDC_ERASEADDDATA_MINLEN) is (yes)*/
  33. }
  34. printf("\n");
  35. /** :loop to update the Bank2 Length with 4 bytes data;*/
  36. /**repeat*/
  37. for(u8Iter1 = DIAGDC_ERASEDATA_LEN;u8Iter1 > DIAGDC_ERASEADD_LEN;u8Iter1--,u8BankIndex++)
  38. {
  39. /** :Extracting the Bank2 Data value to pu8ReqData[u8BankIndex] variable; */
  40. pu8ReqData[u8BankIndex]= (DiagDC_OTABANK2_ERASELENGTH>>(DIAG_u8BYTE_SHIFT_8 * u8Iter1))&0xFF;
  41. /** repeat while (u8Iter > DIAGDC_ERASEADD_LEN) is (yes)*/
  42.  
  43. printf("%02x %d \n", pu8ReqData[u8BankIndex], u8Iter1);
  44.  
  45. }
  46.  
  47. printf("\n");
  48. }
Success #stdin #stdout 0s 5284KB
stdin
Standard input is empty
stdout
03 3 
34 2 
00 1 
00 0 

00 7 
00 6 
00 5 
00 4