Hello,
I am currently using MQX 4.0 and trying to write my own I/O driver, base on TFS source code. I stumbled on this code in tfs.c :
/*FUNCTION*-------------------------------------------------------------------
*
* Function Name : _io_tfs_install
* Returned Value : TFS error code.
* Comments : Initialize the Trivial File System.
*
*END*---------------------------------------------------------------------*/
uint_32 _io_tfs_install
(
/*[IN] the name that should be given to tfs (ex: "C:", "TFS1:", etc..) */
char_ptr identifier,
/*[IN] pointer to the first entry of the root TFS directory */
const TFS_DIR_ENTRY *root
)
{ /* Body */
uint_32 error_code;
TFS_DRIVE_STRUCT_PTR drive_ptr;
drive_ptr = _mem_alloc_system_zero( sizeof(TFS_DRIVE_STRUCT) );
if ( drive_ptr == NULL ) {
return( TFS_INSUFFICIENT_MEMORY );
}/* Endif */
_mem_set_type(drive_ptr,MEM_TYPE_IO_TFS_DRIVE_STRUCT);
_int_disable();
error_code = _io_dev_install_ext( identifier,
_io_tfs_open,
_io_tfs_close,
_io_tfs_read,
_io_tfs_write,
_io_tfs_ioctl,
_io_tfs_uninstall,
(pointer)drive_ptr);
if (error_code != IO_OK) {
_mem_free(drive_ptr);
drive_ptr = NULL;
_int_enable();
return error_code;
} /* Endif */
drive_ptr->IDENTIFIER = identifier;
drive_ptr->ROOT = root;
_int_enable();
return(error_code);
} /* Endbody */
I understand all of it except the call to _mem_set_type(). This function does not seem to be documented, so I don't know what it does and how I can adapt it for my own I/O driver.
It would be great if someone could give me a clue !
Best regards,
AV