Real time embedded FreeRTOS RSS feed 
Homepage FreeRTOS+ Products FreeRTOS Labs Support Forum Contact / Enquiries

FreeRTOS_open()

[FreeRTOS+IO API]

FreeRTOS_IO.h
Peripheral_Descriptor_t FreeRTOS_open( const int8_t *pcPath, const uint32_t ulFlags );
		

Opens a peripheral for use with FreeRTOS+IO. The board support package defines which peripherals are available on any particular platform.

Parameters:

pcPath   The text name of the peripheral being opened, as defined by the board support package.

ulFlags   Mode flags. This parameter is not currently used. It is included for two reasons - so the FreeRTOS_open() prototype complies with the standard open() prototype, and to ensure backward compatibility after future FreeRTOS+IO developments.
Returns:

NULL if the peripheral could not be opened, otherwise a variable of type Peripheral_Descriptor_t that can be used to access the opened peripheral in future calls to FreeRTOS_read(), FreeRTOS_write() and FreeRTOS_ioctl().

Example usage:


/* FreeRTOS+IO includes. */
#include "FreeRTOS_IO.h"

void vAFunction( void )
{
/* The Peripheral_Descriptor_t type is the FreeRTOS+IO equivalent of a descriptor. */
Peripheral_Descriptor_t xOpenedPort;

    /* Open the SPI port identified in the board support package as using the
    path string "/SPI2/".  The second parameter is not currently used and can
    be set to anything, although, for future compatibility, it is recommended 
    that it is set to NULL. */
    xOpenedPort = FreeRTOS_open( "/SPI2/", NULL );

    if( xOpenedPort != NULL )
    {
        /* xOpenedPort now contains a valid descriptor that can be used with
        other FreeRTOS+IO API functions. */
        
        . . .
    }
    else
    {
        /* The port was not opened successfully. */
    }
}
						
FreeRTOS_open() example


[ Back to the top ]    [ About FreeRTOS ]    [ Privacy ]    [ FreeRTOS+ Sitemap ]    [ Main FreeRTOS Sitemap ]    [ ]


Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.