Add piMemorySize for rpi4

#include <stdio.h>

int main()
{
	int bRev, bType, bProc, bMfg, bMem, bWarranty ;
	int revision = 12595474; //Convert hexadecimal to decimal
	bRev      = (revision & (0x0F <<  0)) >>  0 ;
        bType     = (revision & (0xFF <<  4)) >>  4 ;
        bProc     = (revision & (0x0F << 12)) >> 12 ;	// Not used for now.
        bMfg      = (revision & (0x0F << 16)) >> 16 ;
        bMem      = (revision & (0x07 << 20)) >> 20 ;
       bWarranty = (revision & (0x03 << 24)) != 0 ;
       printf ("piBoardId: rev: %d, type: %d, proc: %d, mfg: %d, mem: %d, warranty: %d\n",
		bRev, bType, bProc, bMfg, bMem, bWarranty) ;

   return 0;
}

/* revision see https://www.raspberrypi.org/documentation/hardware/raspberrypi/revision-codes/README.md 
*RPI revision is HEX.*\
This commit is contained in:
FindWaySociety-ykla 2020-04-07 17:19:45 +08:00 committed by GitHub
parent 5bbb6e34b8
commit 7d8188d0bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -288,8 +288,8 @@ const int piMemorySize [8] =
256, // 0
512, // 1
1024, // 2
0, // 3
0, // 4
2048, // 3
4096, // 4
0, // 5
0, // 6
0, // 7