/*
 *  pacid.c
 *
 *  v 0.0 2021.5.31
 *    Read PAC ID for LP-2841/9x81(i.MX8).
 */

#include "msw.h"
#include "armplat.h"

#define VERSION "1.1(20210521)"

int main(int argc,char **argv)
{
	int c;
	int result = 0;
	unsigned int pac_id = 0;

        while((c=getopt(argc, argv, "v")) != -1)
	{
		switch(c)
		{
			case 'v':
				printf("pacid version : %s\n", VERSION);
				return NOERROR;
                        default:
				return NOERROR;
		}
	}

	result = linpac_read_pacid(&pac_id);

	if(result)
	{
		printf("pacid(%d) : LinPAC ID read error\n",result);
		return FAILURE;
	}
	else
	{
		if(pac_id == LP2841)
		{
			printf("LinPAC : LP-2841\n");
		}
		else if(pac_id == LP2841_4G)
		{
			printf("LinPAC : LP-2841-4G\n");
		}
		else if(pac_id == LP9X81)
		{
			printf("LinPAC : LP-9x81\n");
		}
		else if(pac_id == ALP9X81)
		{
			printf("LinPAC : ALP-9x81\n");
		}
		else if(pac_id == SV4801)
		{
			printf("LinPAC : ALP-9x81\n");
		}
		else
		{
			printf("Unknown Device!\n");
		}
	
	}

	return NOERROR;
}

