Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
ASA
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ASE-2021
ASA
Commits
34881d68
Commit
34881d68
authored
4 years ago
by
Thierno souleymane Bah
Browse files
Options
Downloads
Patches
Plain Diff
fix(format sector prog updated, new arguments added)
parent
28e4d289
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
tpfs/format_sector.c
+13
-10
13 additions, 10 deletions
tpfs/format_sector.c
with
13 additions
and
10 deletions
tpfs/format_sector.c
+
13
−
10
View file @
34881d68
...
...
@@ -5,21 +5,24 @@
#include
"hardware.h"
#include
"drive.h"
#define FMT_DATA 0xCAFEBABE
#define FMT_SIZE 0x1
static
void
empty_it
()
{
return
;
}
void
format_sector
(
int
cylinder
,
int
sector
)
void
format_sector
(
unsigned
int
cylinder
,
unsigned
int
sector
,
unsigned
int
nsector
,
unsigned
int
value
)
{
seek
(
cylinder
,
sector
);
_out
(
HDA_DATAREGS
,
0x0
);
_out
(
HDA_DATAREGS
+
1
,
1
);
_out
(
HDA_DATAREGS
+
2
,
0xFF
);
_out
(
HDA_DATAREGS
+
3
,
0x00
);
_out
(
HDA_DATAREGS
+
4
,
0xFF
);
_out
(
HDA_DATAREGS
+
5
,
0x00
);
_out
(
HDA_DATAREGS
,
(
nsector
>>
8
)
&
255
);
_out
(
HDA_DATAREGS
+
1
,
nsector
&
255
);
_out
(
HDA_DATAREGS
+
2
,
(
value
>>
24
)
&
255
);
_out
(
HDA_DATAREGS
+
3
,
(
value
>>
16
)
&
255
);
_out
(
HDA_DATAREGS
+
4
,
(
value
>>
8
)
&
255
);
_out
(
HDA_DATAREGS
+
5
,
value
&
255
);
_out
(
HDA_CMDREG
,
CMD_FORMAT
);
_sleep
(
HDA_IRQ
);
}
...
...
@@ -48,7 +51,7 @@ int main(int argc, char const *argv[])
for
(
cylinder
=
0
;
cylinder
<
HDA_MAXCYLINDER
;
cylinder
++
)
{
for
(
sector
=
0
;
sector
<
HDA_MAXSECTOR
;
sector
++
)
format_sector
(
cylinder
,
sector
);
format_sector
(
cylinder
,
sector
,
FMT_SIZE
,
FMT_DATA
);
}
}
else
if
(
argc
==
2
&&
(
!
strcmp
(
argv
[
1
],
"-r"
)))
...
...
@@ -56,12 +59,12 @@ int main(int argc, char const *argv[])
for
(
cylinder
=
HDA_MAXCYLINDER
-
1
;
cylinder
>
-
1
;
cylinder
--
)
{
for
(
sector
=
HDA_MAXSECTOR
-
1
;
sector
>
-
1
;
sector
--
)
format_sector
(
cylinder
,
sector
);
format_sector
(
cylinder
,
sector
,
FMT_SIZE
,
FMT_DATA
);
}
}
else
if
(
argc
==
3
)
{
format_sector
(
atoi
(
argv
[
1
]),
atoi
(
argv
[
2
]));
format_sector
(
atoi
(
argv
[
1
]),
atoi
(
argv
[
2
])
,
FMT_SIZE
,
FMT_DATA
);
}
else
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment