@CHIP-RTOS C Library - External Disk API
Extdisk_install_callback
Install a notification callback function int Extdisk_install_callback ( EXTDISK_CALLBACK callback ); Parameters
callback
- Pointer to the callback function of the
type EXTDISK_CALLBACK
EXTDISK_CALLBACK is defined as follows:
typedef void (far * EXTDISK_CALLBACK)(unsigned int event);
Return Value
- = 0: success
!= 0: failed
Comments
- The external drives B: and D: may be hot-plugable. This means that the
drive medium might be removed or inserted while your application is
running. In some cases it may be important for you to be notified if a
medium is removed or inserted, for example if one of your tasks has set
its working directory to the external drive. By default @CHIP-RTOS will
reset the working directory of all tasks that previously had their
working directory on a drive that has been removed to A:\. However this
might not be appropriate. So a reaction on the removal of a hot-pluggable
medium might be to set a new valid working directory.
To be notified of insertion and removal events, install an EXTDISK callback
function.
A maximum of 12 EXTDISK callback functions can be installed.
The following events may be passed along with the callback function's
event parameter:
EXTDISK_EVENT_INSTALL_B = 0x01
Drive B: has been installed
EXTDISK_EVENT_REMOVE_B = 0x02
Drive B: has been uninstalled
EXTDISK_EVENT_INSTALL_D = 0x03
Drive D: has been installed
EXTDISK_EVENT_REMOVE_D = 0x04
Drive D: has been uninstalled
ExampleThe following example demonstrates the general usage of the notification
callback function:
void huge callback(unsigned int event)
{
switch(event)
{
case EXTDISK_EVENT_INSTALL_B:
... // Event handling
break;
case ...
}
}
void main()
{
if(Extdisk_install_callback(callback) != 0)
... // Error handling
...
if(Extdisk_remove_callback(callback) != 0)
... // Error handling
}
See Also
RTOS API
- This library function invokes a RTOS software interrupt.
Refer to this RTOS API function's
documentation
for more details.
Supported since or modified in @CHIP-RTOS version-
| SC12 | SC13 | SC11 | SC1x3 | SC2x |
-
| V1.20 | V1.20 | V1.20 | V1.07 | V1.00 |
Supported by @CHIP-RTOS C Library since version
This API List
List of C Libraries
@CHIP-RTOS Main Index
End of document
|