hii all.
i'm writing a perl script, by searching the net and understanding the functionality of it.
the requirement is that i should create a file by using a perl scipt which should contain something like this.
struct regread ge1[] {
{"string","offset","shift,"mask"},
{... },
{... },
}
so, the file from which i should read contains something like this
Code:
#define SPIRO_TX_EB_ADDR_LOW_OFFSET 0xc00
#define SPIRO_TX_EB_ADDR_LOW_SHIFT 0x00
#define SPIRO_TX_EB_ADDR_LOW_MASK 0xFFFFFFFF
#define SPIRO_TX_EB_ADDR_HIGH_OFFSET 0xc04
#define SPIRO_TX_EB_ADDR_HIGH_SHIFT 0x00
#define SPIRO_TX_EB_ADDR_HIGH_MASK 0xFFFFFFFF
so i have to 1.extract string
2.eliminate #define
3.extract string from (offset,shift,mask) and write that in the string
4.for offset the respective address should be in "offset" of the structure similarly for mask, and shift.
i came to a stage and stuck i need your help in extracting the spiro_tx_eb_addr_high and separating from (offset,mask,shift)
my code is
Code:
#!usr/bin/perl
open IN, "/home/ge1/Documents/c_files/gmac_dma.h" or die "Can not open in.txt for reading : $!"; #opening the file
while ( my $line = <IN> ) { #openig each line in file
#print "$line";
my @list = split ' ' , $line; #spliting the line on spaces,storing
#print "string:$list[1]\t\taddress:$list[2]\n"; #printing the wanted stuff
@string=$list[1]=~ m/OFFSET/g;
print "@string";
}
close IN or die "Can not close file : $!";
i hope you understood what i was expecting, if so please help. I'm not asking you to give me code, just tell how to do.