Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
proview
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Esteban Blanc
proview
Commits
37edcabd
Commit
37edcabd
authored
Oct 13, 2004
by
claes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
new file
parent
9d490f37
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
497 additions
and
12 deletions
+497
-12
src/exp/com/src/os_linux/upgrade.sh
src/exp/com/src/os_linux/upgrade.sh
+36
-12
src/exp/com/src/os_linux/upgrade_pb.pwr_com
src/exp/com/src/os_linux/upgrade_pb.pwr_com
+85
-0
src/exp/com/src/pb_slave_config.pwr_com
src/exp/com/src/pb_slave_config.pwr_com
+376
-0
No files found.
src/exp/com/src/os_linux/upgrade.sh
View file @
37edcabd
...
...
@@ -361,6 +361,29 @@ reload_loaddb()
done
}
reload_cnvobjects
()
{
reload_checkpass
"cnvobjects"
$start_pass
if
[
$pass_status
-ne
$pass__execute
]
;
then
reload_status
=
$reload__success
return
fi
reload_continue
"Pass convert objects in loaded db"
list
=
`
eval ls
-1d
$pwrp_db
/
*
.db
`
for
file
in
$list
;
do
file
=
${
file
##/*/
}
file
=
${
file
%%.*
}
if
[
$file
!=
"directory"
]
&&
[
$file
!=
"rt_eventlog"
]
;
then
wb_cmd
-v
$file
@
$pwr_exe
/upgrade_pb.pwr_com
fi
done
reload_status
=
$reload__success
}
reload_compile
()
{
reload_checkpass
"compile"
$start_pass
...
...
@@ -572,17 +595,18 @@ usage()
Pass
dumpdb Dump database to textfile
\$
pwrp_db/'volume'.wb_dmp
userclasses Create loadfiles and rename userclasses.wb_load
dirvolume Create directory volume.
cnvdirvolume Convert the directory volume.
cnvdump Convert dumpfiles.
createvolumes Create configured databases.
localwb Create LocalWb volume for lists and template objects.
compile Compile all plcprograms in the database
createload Create new loadfiles.
createboot Create bootfiles for all nodes in the project.
convertge Convert ge graphs.
dumpdb Dump database to textfile
\$
pwrp_db/'volume'.wb_dmp
userclasses Create loadfiles and rename userclasses.wb_load
dirvolume Create directory volume.
cnvdirvolume Convert the directory volume.
cnvdump Convert dumpfiles.
createvolumes Create configured databases.
localwb Create LocalWb volume for lists and template objects.
cnvobjects Convert certain objects in new db.
compile Compile all plcprograms in the database
createload Create new loadfiles.
createboot Create bootfiles for all nodes in the project.
convertge Convert ge graphs.
Note!
The first pass (dumpdb) must be executed on NEWTON and then you must move to
...
...
@@ -619,7 +643,7 @@ databases=`eval source $v34_root/os_linux/hw_x86/exp/exe/pwrp_env.sh show db -a`
databases
=
$databases
" dbdirectory"
export
pwr_inc
=
$pwrb_root
/os_linux/hw_x86/exp/inc
passes
=
"dumpdb userclasses dirvolume cnvdirvolume cnvdump createvolumes localwb compile createload createboot convertge"
passes
=
"dumpdb userclasses dirvolume cnvdirvolume cnvdump createvolumes localwb c
nvobjects c
ompile createload createboot convertge"
echo
"Pass:
$passes
"
echo
""
echo
-n
"Enter start pass [dumpdb] > "
...
...
src/exp/com/src/os_linux/upgrade_pb.pwr_com
0 → 100644
View file @
37edcabd
!
! Script for converting Profibus objects during upgrading from v3.9 to v4.0.0
!
! Traverse all trees under every $NodeHier root object to find every Pb_DP_Slave object.
! Attribute ByteOrdering has a new meaning and should be changed, was formerly bitmask.
! The new ByteOrdering in Pb_DP_Slave object is ONLY ByteOrdering
!
! Every Pb_Di, Pb_Do, Pb_Ai and Pb_Ao object also has new arguments, Orientation and
! NumberRepresentation that should be set according to the old ByteOrdering bitmask.
!
! Pb_Ii and Pb_Io are new objects in v4.0.0 and don't need changing.
!
function int convert(string slave)
int old;
int sts;
string attr;
string child;
string class;
attr = slave + ".ByteOrdering";
old = GetAttribute(attr, sts);
if (sts != 0)
child = GetChild(slave);
while (child != "")
class = GetObjectClass(child);
if (class == "Pb_Di" || class == "Pb_Do")
if (old & 2)
set attr/attr=Orientation/value=16/name='child'/noco
else
set attr/attr=Orientation/value=8/name='child'/noco
endif
endif
if (class == "Pb_Ai" || class == "Pb_Ao")
if (old & 4)
set attr/attr=NumberRepresentation/value=0/name='child'/noco
else
set attr/attr=NumberRepresentation/value=1/name='child'/noco
endif
endif
child = GetNextSibling(child);
endwhile
if (old & 1)
set attr/attr=ByteOrdering/value=1/name='slave'/noco
else
set attr/attr=ByteOrdering/value=0/name='slave'/noco
endif
save
endif
endfunction
function int traverse(string parent)
string child;
string class;
child = GetChild(parent);
while(child != "")
class = GetObjectClass(child);
if (class == "Pb_DP_Slave")
convert(child);
else
traverse(child);
endif
child = GetNextSibling(child);
endwhile
endfunction
main()
string object;
string class;
!
object = GetRootList();
while (object != "")
class = GetObjectClass(object);
if (class == "$NodeHier")
traverse(object);
endif
object = GetNextSibling(object);
endwhile
endmain
src/exp/com/src/pb_slave_config.pwr_com
0 → 100644
View file @
37edcabd
function string get_keyword(string in)
string retval;
string str;
str = element(1, ";", in);
str = toupper(str);
str = element(1, "=", str);
str = edit(str);
retval = "NO_KEYWORD";
if (str == "IDENT_NUMBER")
retval = str;
endif
if (str == "VENDOR_NAME")
retval = str;
endif
if (str == "MODEL_NAME")
retval = str;
endif
if (str == "REVISION")
retval = str;
endif
if (str == "HARDWARE_RELEASE")
retval = str;
endif
if (str == "SOFTWARE_RELEASE")
retval = str;
endif
if (str == "USER_PRM_DATA_LEN")
retval = str;
endif
if (str == "USER_PRM_DATA")
retval = str;
endif
if (str == "MODULE")
retval = str;
endif
return retval;
endfunction
function string get_param(int i, string in)
string str;
string quote;
int j;
quote = "\"";
quote = extract(2, 1, quote);
str = element(1, ";", in);
str = element(1, "\b", str);
if (strchr(str, "=") != 0)
str = element(2, "=", str);
endif
if (i > 0)
if (strstr(str, quote) != 0)
j = i+1;
str = element(j, quote, str);
str = edit(str);
else
str = edit(str);
endif
endif
return str;
endfunction
function string get_value(int i, string in)
string str;
str = element(1, ";", in);
str = element(1, "\b", str);
if (strchr(str, "=") != 0)
str = element(2, "=", str);
endif
str = edit(str);
if (i > 0)
str = element(i, ",", str);
str = edit(str);
endif
return str;
endfunction
function int continuation_line(string in)
string str;
int retval;
str = element(1, ";", in);
if (strchr(str, "\b") != 0)
retval = 1;
else
retval = 0;
endif
return retval;
endfunction
function int ascii_to_dec(string in)
int retval;
int i;
int pos;
int k;
int exp;
string value;
string tmp;
value = in;
pos = strstr(value, "0x");
if (pos == 0)
retval = value;
else
pos += 2;
value = extract(pos, 100, value);
i = strlen(value);
retval = 0;
exp = 1;
while ( i > 0)
tmp = extract(i, 1, value);
k = 0;
if (tmp == "A" || tmp == "a")
k = 10;
endif
if (tmp == "B" || tmp == "b")
k = 11;
endif
if (tmp == "C" || tmp == "c")
k = 12;
endif
if (tmp == "D" || tmp == "d")
k = 13;
endif
if (tmp == "E" || tmp == "e")
k = 14;
endif
if (tmp == "F" || tmp == "f")
k = 15;
endif
if (k == 0)
k = tmp;
endif
retval = retval + exp*k;
exp = exp*16;
i--;
endwhile
endif
return retval;
endfunction
main()
int file;
string str;
string keyword;
int pos;
string value;
string param;
string dbname;
string volname;
string objname;
string attr;
int sts;
int i;
int cont;
int cont2;
int user_prm_idx;
int module_data_idx;
int dec_val;
string filename;
! verify(1);
printf("\n");
if (p1 == "")
printf(" Bad argument(s), usage & example:\n");
printf(" >pwr_cmd @ssab_exe:pb_slave_config object (nodename)\n");
printf("\n");
exit(0);
endif
if (p2 != "")
dbname = "db" + p2;
volname = "vol" + p2;
set db/db='dbname'
set vol/vol='volname'
endif
objname = p1;
attr = objname + ".GSDfile";
filename = GetAttribute(attr);
file = fopen( filename, "r");
if ( !file)
printf( "Unable to open GSD file %s\n", filename);
exit();
endif
printf("Parsing GSD file %s\n", filename);
printf("\n");
module_data_idx = 2;
user_prm_idx = 0;
set attr/noco/name='objname'/attr=VendorName/value="Not found"
set attr/noco/name='objname'/attr=ModelName/value="Not found"
set attr/noco/name='objname'/attr=Revision/value="Not found"
set attr/noco/name='objname'/attr=PNOIdent/value=0
set attr/noco/name='objname'/attr=GroupIdent/value=0
set attr/noco/name='objname'/attr=PrmUserDataLen/value=0
set attr/noco/name='objname'/attr=ConfigDataLen/value=0
set attr/noco/name='objname'/attr=SlaveUserDataLen/value=0
i=0;
while (i < 100)
set attr/noco/name='objname'/attr=PrmUserData['i']/value=0
set attr/noco/name='objname'/attr=ConfigData['i']/value=0
set attr/noco/name='objname'/attr=SlaveUserData['i']/value=0
i++;
endwhile
while ( fgets( str, file))
str = element(1, ";", str);
keyword = get_keyword(str);
if (keyword == "IDENT_NUMBER")
param = get_param(1, str);
i = ascii_to_dec(param);
printf("Ident number: %04x\n", i);
set attr/noco/name='objname'/attr=PNOIdent/value="'i'"
endif
if (keyword == "VENDOR_NAME")
param = get_param(1, str);
printf("Vendor name: %s\n", param);
set attr/noco/name='objname'/attr=VendorName/value="'param'"
endif
if (keyword == "MODEL_NAME")
param = get_param(1, str);
printf("Model name: %s\n", param);
set attr/noco/name='objname'/attr=ModelName/value="'param'"
endif
if (keyword == "REVISION")
param = get_param(1, str);
printf("Revision: %s\n", param);
set attr/noco/name='objname'/attr=Revision/value="'param'"
endif
if (keyword == "HARDWARE_RELEASE")
param = get_param(1, str);
printf("Hardware release: %s\n", param);
set attr/noco/name='objname'/attr=HardwareRelease/value="'param'"
endif
if (keyword == "SOFTWARE_RELEASE")
param = get_param(1, str);
printf("Software release: %s\n", param);
set attr/noco/name='objname'/attr=SoftwareRelease/value="'param'"
endif
if (keyword == "USER_PRM_DATA_LEN")
param = get_param(1, str);
i = ascii_to_dec(param);
printf("User prm data length: %d\n", i);
set attr/noco/name='objname'/attr=PrmUserDataLen/value="'i'"
endif
if (keyword == "USER_PRM_DATA")
printf("User prm data: ......\n");
cont = 1;
while (cont == 1)
i = 1;
cont2 = 1;
param = get_param(1, str);
while (cont2 == 1)
value = get_value(i, param);
if (value != "")
dec_val = ascii_to_dec(value);
set attr/noco/name='objname'/attr=PrmUserData['user_prm_idx']/value="'dec_val'"
user_prm_idx++;
i++;
else
cont2 = 0;
endif
endwhile
if (continuation_line(str) == 1)
fgets(str, file);
else
cont = 0;
endif
endwhile
endif
if (keyword == "MODULE")
param = get_param(1, str);
printf("Module: %s ......\n", param);
str = get_param(2, str);
cont = 1;
while (cont == 1)
i = 1;
cont2 = 1;
param = get_param(1, str);
while (cont2 == 1)
value = get_value(i, param);
if (value != "")
dec_val = ascii_to_dec(value);
set attr/noco/name='objname'/attr=ConfigData['module_data_idx']/value="'dec_val'"
module_data_idx++;
i++;
else
cont2 = 0;
endif
endwhile
if (continuation_line(str) == 1)
fgets(str, file);
else
cont = 0;
endif
endwhile
endif
endwhile
set attr/noco/name='objname'/attr=AutoConfigure/value="0"
printf("Config data length: %d\n", module_data_idx);
! verify(1);
set attr/noco/name='objname'/attr=ConfigDataLen/value="'module_data_idx'"
set attr/noco/name='objname'/attr=ConfigData[0]/value="0"
set attr/noco/name='objname'/attr=ConfigData[1]/value="'module_data_idx'"
i = module_data_idx;
while (i < 100)
set attr/noco/name='objname'/attr=ConfigData['i']/value="0"
i++;
endwhile
i = user_prm_idx;
while (i < 100)
set attr/noco/name='objname'/attr=PrmUserData['i']/value="0"
i++;
endwhile
fclose( file);
save
printf("\n");
printf("Parsing complete\n");
printf("\n");
endmain
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment