Copyright (c) Hyperion Entertainment and contributors.
Difference between revisions of "Anatomy of a SATA Device Driver"
Jump to navigation
Jump to search
Steven Solie (talk | contribs) (Created page with "Coming soon...") |
Steven Solie (talk | contribs) |
||
Line 1: | Line 1: | ||
+ | = Introduction = |
||
− | Coming soon... |
||
+ | |||
+ | This article describes the p5020sata.device and how it works. It is intended to be used in conjunction with the actual source code. The author will be going through this article at the AmiWest 2016 DevCon on October 8 and 9, 2016. |
||
+ | |||
+ | = Initialization = |
||
+ | |||
+ | Everything begins with a resident kickstart module. You can see a list of kickstart modules in the '''SYS:Kickstart/Kicklayout''' file. All of the modules listed in there will be loaded and linked when the system boots up. They become the system kernel and they are no loaded again until you do a cold reboot. |
||
+ | |||
+ | Creating a resident kickstart module is pretty simple. Here is the resident structure used by the p5020sata.device driver: |
||
+ | <syntaxhighlight> |
||
+ | // Priority of resident kernel module |
||
+ | // |
||
+ | // Chosen to be lower than mounter.library which is at -45 |
||
+ | // which means this device is initialized after mounter.library. |
||
+ | #define KMOD_PRIORITY -46 |
||
+ | |||
+ | static struct Resident launch_restag USED = |
||
+ | { |
||
+ | RTC_MATCHWORD, |
||
+ | &launch_restag, |
||
+ | (APTR)(&launch_restag + 1), |
||
+ | RTF_NATIVE | RTF_COLDSTART, |
||
+ | 54, |
||
+ | NT_UNKNOWN, |
||
+ | KMOD_PRIORITY, |
||
+ | DEVICE_NAME " launch", |
||
+ | "$VER: " DEVICE_NAME " launch", |
||
+ | launch_dev |
||
+ | }; |
||
+ | </syntaxhighlight> |
Revision as of 00:06, 2 October 2016
Introduction
This article describes the p5020sata.device and how it works. It is intended to be used in conjunction with the actual source code. The author will be going through this article at the AmiWest 2016 DevCon on October 8 and 9, 2016.
Initialization
Everything begins with a resident kickstart module. You can see a list of kickstart modules in the SYS:Kickstart/Kicklayout file. All of the modules listed in there will be loaded and linked when the system boots up. They become the system kernel and they are no loaded again until you do a cold reboot.
Creating a resident kickstart module is pretty simple. Here is the resident structure used by the p5020sata.device driver:
// Priority of resident kernel module // // Chosen to be lower than mounter.library which is at -45 // which means this device is initialized after mounter.library. #define KMOD_PRIORITY -46 static struct Resident launch_restag USED = { RTC_MATCHWORD, &launch_restag, (APTR)(&launch_restag + 1), RTF_NATIVE | RTF_COLDSTART, 54, NT_UNKNOWN, KMOD_PRIORITY, DEVICE_NAME " launch", "$VER: " DEVICE_NAME " launch", launch_dev };