From d380f748cb4c70bd7dbfe091f7c7d2f15bef0c74 Mon Sep 17 00:00:00 2001 From: Arnie Reynoso Date: Tue, 3 Feb 2015 11:40:20 -0800 Subject: [PATCH] Linux: Added option to set base cluster id in LAD An option (-b) has been added to LAD to set the cluster's base id when launching LAD. --- linux/src/daemon/lad.c | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/linux/src/daemon/lad.c b/linux/src/daemon/lad.c index 11b37fd..1162c2d 100644 --- a/linux/src/daemon/lad.c +++ b/linux/src/daemon/lad.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2014, Texas Instruments Incorporated + * Copyright (c) 2012-2015, Texas Instruments Incorporated * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -52,6 +52,7 @@ #include <_NameServer.h> #include #include <_GateMP_daemon.h> +#include <_MultiProc.h> #include @@ -96,12 +97,14 @@ Options:\n\ g : enable GateMP support \n\ l : name of logfile for LAD\n\ p : set LAD's directory permissions\n\ + b : Processor's base cluster id \n\ \n\ Examples:\n\ lad_ -h\n\ lad_ -l log.txt\n\ lad_ -l log.txt -p 777\n\ lad_ -g -l log.txt\n\ + lad_ -l log.txt -b 10\n\ \n" /* @@ -153,7 +156,7 @@ int main(int argc, char * argv[]) /* process command line args */ while (1) { - c = getopt(argc, argv, "ghl:p:"); + c = getopt(argc, argv, "b:ghl:p:"); if (c == -1) { break; } @@ -167,6 +170,19 @@ int main(int argc, char * argv[]) printf("\nGateMP is not supported for this device\n"); #endif break; + case 'b': + if (_MultiProc_cfg.id == 0xFFFF && + _MultiProc_cfg.baseIdOfCluster == 0xFFFF) { + printf("\nSetting base cluster id to %s\n", optarg); + _MultiProc_cfg.id = atoi(optarg); + _MultiProc_cfg.baseIdOfCluster = atoi(optarg); + } + else { + printf("\nBase cluster id in the MultiProcCfg file must be\n" + "set to MultiProc_INVALIDID(0xFFFF) when using -b option\n"); + exit(EXIT_FAILURE); + } + break; case 'h': printf("%s", LAD_USAGE); exit(0); @@ -199,6 +215,15 @@ int main(int argc, char * argv[]) } } + /* Check to ensure id and baseId are not invalid */ + printf ("id = %d baseId= %d\n", _MultiProc_cfg.id, _MultiProc_cfg.baseIdOfCluster); + if (_MultiProc_cfg.id == 0xFFFF || _MultiProc_cfg.baseIdOfCluster == 0xFFFF){ + printf("\nBase cluster id is set to an INVALID value\n"); + printf("Use -b option to set value or modify the MultiProcCfg file\n"); + exit(EXIT_FAILURE); + } + + #if DAEMON /* fork off a child process */ pid = fork(); -- 2.39.2