annotate TOOLS/mem2dump.c @ 16429:84174804804b

Updates to NUT spec: 1. remove average_bitrate 2. add other_stream_header, for subtitles and metadata 3. add max_pts to index 4. index_ptr - a 64 bit integer to say the total length of all index packets 5. specify how to write "multiple" indexes 6. change forward_ptr behavior, starts right after forward_ptr, ends after checksum 7. remove stream_id <-> stream_class limitation. 8. time_base_nom must also be non zero. 9. rename time_base_nom and time_base_denom, now timebase means the length of a tick, not amounts of ticks 10. remove (old?) sample_rate_mul stuff. 11. specify what exactly the checksum covers. 12. specify that stream classes which have multiple streams must have an info packet.. (in new Semantic requirements section) 13. Rename 'timestamp' to pts. 14. Change date of draft... 15. Add myself to authors...
author ods15
date Fri, 09 Sep 2005 10:26:21 +0000
parents 51276a7f4ea1
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2356
04c80ace9581 re-eng tool
nick
parents:
diff changeset
1 /*
04c80ace9581 re-eng tool
nick
parents:
diff changeset
2 bios2dump.c - Was designed to dump memory block to file.
04c80ace9581 re-eng tool
nick
parents:
diff changeset
3 Usage: as argument requires absolute address of memory dump and its lenght
04c80ace9581 re-eng tool
nick
parents:
diff changeset
4 (int hexadecimal form).
04c80ace9581 re-eng tool
nick
parents:
diff changeset
5 as output - will write file which will named: memADDR_LEN.dump
04c80ace9581 re-eng tool
nick
parents:
diff changeset
6 where: ADDR - given address of memory
04c80ace9581 re-eng tool
nick
parents:
diff changeset
7 LEN - given length of memory
04c80ace9581 re-eng tool
nick
parents:
diff changeset
8 Licence: GNU GPL v2
04c80ace9581 re-eng tool
nick
parents:
diff changeset
9 Copyright: Nick Kurshev <nickols_k@mail.ru>
04c80ace9581 re-eng tool
nick
parents:
diff changeset
10 */
04c80ace9581 re-eng tool
nick
parents:
diff changeset
11 #include <stdio.h>
04c80ace9581 re-eng tool
nick
parents:
diff changeset
12 #include <stdlib.h>
04c80ace9581 re-eng tool
nick
parents:
diff changeset
13
04c80ace9581 re-eng tool
nick
parents:
diff changeset
14 int main( int argc, char *argv[])
04c80ace9581 re-eng tool
nick
parents:
diff changeset
15 {
04c80ace9581 re-eng tool
nick
parents:
diff changeset
16 FILE * fd_mem, *fd_out;
04c80ace9581 re-eng tool
nick
parents:
diff changeset
17 unsigned long i,addr,len;
04c80ace9581 re-eng tool
nick
parents:
diff changeset
18 int int_no;
04c80ace9581 re-eng tool
nick
parents:
diff changeset
19 char outname[80];
04c80ace9581 re-eng tool
nick
parents:
diff changeset
20 unsigned char ch;
04c80ace9581 re-eng tool
nick
parents:
diff changeset
21 if(argc < 3)
04c80ace9581 re-eng tool
nick
parents:
diff changeset
22 {
04c80ace9581 re-eng tool
nick
parents:
diff changeset
23 printf("Usage: %s address length (in hex)\n",argv[0]);
04c80ace9581 re-eng tool
nick
parents:
diff changeset
24 return EXIT_FAILURE;
04c80ace9581 re-eng tool
nick
parents:
diff changeset
25 }
04c80ace9581 re-eng tool
nick
parents:
diff changeset
26 addr = strtol(argv[1],NULL,16);
04c80ace9581 re-eng tool
nick
parents:
diff changeset
27 len = strtol(argv[2],NULL,16);
04c80ace9581 re-eng tool
nick
parents:
diff changeset
28 if(!(fd_mem = fopen("/dev/mem","rb")))
04c80ace9581 re-eng tool
nick
parents:
diff changeset
29 {
04c80ace9581 re-eng tool
nick
parents:
diff changeset
30 perror("Can't open file - /dev/mem");
04c80ace9581 re-eng tool
nick
parents:
diff changeset
31 return EXIT_FAILURE;
04c80ace9581 re-eng tool
nick
parents:
diff changeset
32 }
04c80ace9581 re-eng tool
nick
parents:
diff changeset
33 sprintf(outname,"mem%08X_%08X.dump",addr,len);
04c80ace9581 re-eng tool
nick
parents:
diff changeset
34 if(!(fd_out = fopen(outname,"wb")))
04c80ace9581 re-eng tool
nick
parents:
diff changeset
35 {
04c80ace9581 re-eng tool
nick
parents:
diff changeset
36 perror("Can't open output file");
04c80ace9581 re-eng tool
nick
parents:
diff changeset
37 fclose(fd_mem);
04c80ace9581 re-eng tool
nick
parents:
diff changeset
38 return EXIT_FAILURE;
04c80ace9581 re-eng tool
nick
parents:
diff changeset
39 }
04c80ace9581 re-eng tool
nick
parents:
diff changeset
40 fseek(fd_mem,addr,SEEK_SET);
04c80ace9581 re-eng tool
nick
parents:
diff changeset
41 for(i=0;i<len;i++)
04c80ace9581 re-eng tool
nick
parents:
diff changeset
42 {
04c80ace9581 re-eng tool
nick
parents:
diff changeset
43 fread(&ch,1,1,fd_mem);
04c80ace9581 re-eng tool
nick
parents:
diff changeset
44 fwrite(&ch,1,1,fd_out);
04c80ace9581 re-eng tool
nick
parents:
diff changeset
45 }
04c80ace9581 re-eng tool
nick
parents:
diff changeset
46 fclose(fd_out);
04c80ace9581 re-eng tool
nick
parents:
diff changeset
47 fclose(fd_mem);
04c80ace9581 re-eng tool
nick
parents:
diff changeset
48 return EXIT_SUCCESS;
12923
51276a7f4ea1 cosmetic warning fix (missing newline at end of file)
diego
parents: 2356
diff changeset
49 }