module ti.sysbios.io.DEV

Device Manager

The DEV Device Manager manages the table of IOM drivers. Drivers can be added or removed from the system using DEV_create() and DEV_delete(). [ more ... ]
C synopsis target-domain sourced in ti/sysbios/io/DEV.xdc
#include <ti/sysbios/io/DEV.h>
Functions
Void
Void
Void
Ptr 
Int 
Ptr 
Ptr 
String 
String 
Void
Functions common to all target instances
Functions common to all target modules
Typedefs
typedef DEV_Object *
typedef Void 
typedef struct
typedef struct
typedef struct
Constants
extern const UInt 
 
DETAILS
The DEV Device Manager manages the table of IOM drivers. Drivers can be added or removed from the system using DEV_create() and DEV_delete().
DEV_create() calls mdBindDev() for the underlying IOM driver. If successful, the driver gets added to the driver table. GIO_create() looks in this table for matching device name when opening an I/O channel.
DEV_delete() calls mdUnBindDev() for the underlying IOM driver and removes the entry from the driver table.
 
typedef DEV_InitFxn

Init function type definition

C synopsis target-domain
typedef Void (*DEV_InitFxn)();
 
 
config DEV_tableSize  // module-wide

Size of the device table

C synopsis target-domain
extern const UInt DEV_tableSize;
 
DETAILS
This size needs to be large enough to hold the sum of the drivers created at configuration time and runtime.
 
DEV_match()  // module-wide

DEV_match searches the device table for the first device name that matches a prefix of 'name'. The output parameter, device, points to the appropriate entry in the device table if successful and is set to NULL on error

C synopsis target-domain
String DEV_match(String name, DEV_Handle *device);
 
ARGUMENTS
name — name of device
device — pointer to DEV Handle (output param)
RETURNS
pointer to remaining characters after match
DETAILS
The suffix string return value contains a pointer to the characters remaining after the match. This string can be used to specify device parameters or the name of another device driver.
For example, if you have "/uart" in the device table, then the suffix return value for the following would return a pointer to "0".
  suffix = DEV_match("/uart0", &device);
Module-Wide Built-Ins

C synopsis target-domain
Types_ModuleId DEV_Module_id();
// Get this module's unique id
 
Bool DEV_Module_startupDone();
// Test if this module has completed startup
 
IHeap_Handle DEV_Module_heap();
// The heap from which this module allocates memory
 
Bool DEV_Module_hasMask();
// Test whether this module has a diagnostics mask
 
Bits16 DEV_Module_getMask();
// Returns the diagnostics mask for this module
 
Void DEV_Module_setMask(Bits16 mask);
// Set the diagnostics mask for this module
Instance Object Types

C synopsis target-domain
typedef struct DEV_Object DEV_Object;
// Opaque internal representation of an instance object
 
typedef DEV_Object *DEV_Handle;
// Client reference to an instance object
 
typedef struct DEV_Struct DEV_Struct;
// Opaque client structure large enough to hold an instance object
 
DEV_Handle DEV_handle(DEV_Struct *structP);
// Convert this instance structure pointer into an instance handle
 
DEV_Struct *DEV_struct(DEV_Handle handle);
// Convert this instance handle into an instance structure pointer
Instance Config Parameters

C synopsis target-domain
typedef struct DEV_Params {
// Instance config-params structure
    IInstance_Params *instance;
    // Common per-instance configs
    Ptr deviceParams;
    // Device-specific parameters
    Int devid;
    // Device id
    DEV_InitFxn initFxn;
    // Driver Initialization function
} DEV_Params;
 
Void DEV_Params_init(DEV_Params *params);
// Initialize this config-params structure with supplier-specified defaults before instance creation
 
config DEV_Params.deviceParams  // instance

Device-specific parameters

C synopsis target-domain
struct DEV_Params {
      ...
    Ptr deviceParams;
 
DETAILS
This parameter is passed as the last parameter to the underlying IOM driver's mdBindDevice function.
 
config DEV_Params.devid  // instance

Device id

C synopsis target-domain
struct DEV_Params {
      ...
    Int devid;
 
 
config DEV_Params.initFxn  // instance

Driver Initialization function

C synopsis target-domain
struct DEV_Params {
      ...
    DEV_InitFxn initFxn;
 
DETAILS
This function is called once for every entry in the device table. If this parameter is set to NULL (the default), then no function will be called.
Runtime Instance Creation

C synopsis target-domain
DEV_Handle DEV_create(String name, Ptr fxns, const DEV_Params *params, Error_Block *eb);
// Allocate and initialize a new instance object and return its handle
 
Void DEV_construct(DEV_Struct *structP, String name, Ptr fxns, const DEV_Params *params, Error_Block *eb);
// Initialize a new instance object inside the provided structure
ARGUMENTS
name — name of device (must be a static string)
fxns — pointer to IOM_Fxns table
params — per-instance config params, or NULL to select default values (target-domain only)
eb — active error-handling block, or NULL to select default policy (target-domain only)
DETAILS
The 'name' parameter must be a static string since this name is referenced via a pointer and is not copied. For example:
  Error_init(&eb);
  DEV_create("/a2d", &A2DFXNS, &myparams, &eb);
The following code will not work since 'localstring' is a local variable:
  { 
      Char localstring[10];
      strcpy(localstring, "/a2d");
      Error_init(&eb);
      DEV_create(localstring, &A2DFXNS, &myparams, &eb);
  }
Instance Deletion

C synopsis target-domain
Void DEV_delete(DEV_Handle *handleP);
// Finalize and free this previously allocated instance object, setting the referenced handle to NULL
 
Void DEV_destruct(DEV_Struct *structP);
// Finalize the instance object inside the provided structure
 
DEV_getDeviceParams()  // instance

Get deviceParams of device

C synopsis target-domain
Ptr DEV_getDeviceParams(DEV_Handle handle);
 
ARGUMENTS
handle — handle of a previously-created DEV instance object
RETURNS
deviceParams
DETAILS
DEV_getDeviceParams returns the deviceParams of the referenced device.
 
DEV_getDevid()  // instance

Get devid of device

C synopsis target-domain
Int DEV_getDevid(DEV_Handle handle);
 
ARGUMENTS
handle — handle of a previously-created DEV instance object
RETURNS
devid
DETAILS
DEV_getDevid returns the devid of the referenced device.
 
DEV_getDevp()  // instance

Get devp of device

C synopsis target-domain
Ptr DEV_getDevp(DEV_Handle handle);
 
ARGUMENTS
handle — handle of a previously-created DEV instance object
RETURNS
devp
DETAILS
DEV_getDevp returns the devp of the referenced device.
 
DEV_getFxns()  // instance

Get IOM function table of device

C synopsis target-domain
Ptr DEV_getFxns(DEV_Handle handle);
 
ARGUMENTS
handle — handle of a previously-created DEV instance object
RETURNS
pointer to device function table
DETAILS
DEV_getFxns returns the IOM function table of the referenced device.
 
DEV_getInitFxn()  // instance

Get initialized function of device

C synopsis target-domain
DEV_InitFxn DEV_getInitFxn(DEV_Handle handle);
 
ARGUMENTS
handle — handle of a previously-created DEV instance object
RETURNS
init function pointer
DETAILS
DEV_getInitFxn returns the init function of the referenced device.
 
DEV_getName()  // instance

Get name of device

C synopsis target-domain
String DEV_getName(DEV_Handle handle);
 
ARGUMENTS
handle — handle of a previously-created DEV instance object
RETURNS
device name
DETAILS
DEV_getName returns the name of the referenced device.
Instance Built-Ins

C synopsis target-domain
Int DEV_Object_count();
// The number of statically-created instance objects
 
DEV_Handle DEV_Object_get(DEV_Object *array, Int i);
// The handle of the i-th statically-created instance object (array == NULL)
 
DEV_Handle DEV_Object_first();
// The handle of the first dynamically-created instance object, or NULL
 
DEV_Handle DEV_Object_next(DEV_Handle handle);
// The handle of the next dynamically-created instance object, or NULL
 
IHeap_Handle DEV_Object_heap();
// The heap used to allocate dynamically-created instance objects
 
Types_Label *DEV_Handle_label(DEV_Handle handle, Types_Label *buf);
// The label associated with this instance object
 
String DEV_Handle_name(DEV_Handle handle);
// The name of this instance object
 
Configuration settings sourced in ti/sysbios/io/DEV.xdc
var DEV = xdc.useModule('ti.sysbios.io.DEV');
module-wide constants & types
    var obj = new DEV.BasicView// ;
        obj.name = String  ...
        obj.fxns = Ptr  ...
        obj.initFxn = String[]  ...
        obj.devid = Int  ...
        obj.deviceParams = Ptr  ...
        obj.devp = Ptr  ...
module-wide config parameters
 
per-instance config parameters
    var params = new DEV.Params// Instance config-params object;
        params.deviceParams// Device-specific parameters = Ptr null;
        params.devid// Device id = Int 0;
        params.initFxn// Driver Initialization function = Void(*)() null;
per-instance creation
    var inst = DEV.create// Create an instance-object(String name, Ptr fxns, params);
 
 
metaonly struct DEV.BasicView
Configuration settings
var obj = new DEV.BasicView;
 
    obj.name = String  ...
    obj.fxns = Ptr  ...
    obj.initFxn = String[]  ...
    obj.devid = Int  ...
    obj.deviceParams = Ptr  ...
    obj.devp = Ptr  ...
 
 
config DEV.tableSize  // module-wide

Size of the device table

Configuration settings
DEV.tableSize = UInt 8;
 
DETAILS
This size needs to be large enough to hold the sum of the drivers created at configuration time and runtime.
C SYNOPSIS
 
metaonly config DEV.common$  // module-wide

Common module configuration parameters

Configuration settings
DEV.common$ = Types.Common$ undefined;
 
DETAILS
All modules have this configuration parameter. Its name contains the '$' character to ensure it does not conflict with configuration parameters declared by the module. This allows new configuration parameters to be added in the future without any chance of breaking existing modules.
 
metaonly config DEV.rovViewInfo  // module-wide
Configuration settings
DEV.rovViewInfo = ViewInfo.Instance ViewInfo.create;
 
Instance Config Parameters

Configuration settings
var params = new DEV.Params;
// Instance config-params object
    params.deviceParams = Ptr null;
    // Device-specific parameters
    params.devid = Int 0;
    // Device id
    params.initFxn = Void(*)() null;
    // Driver Initialization function
 
config DEV.Params.deviceParams  // instance

Device-specific parameters

Configuration settings
var params = new DEV.Params;
  ...
params.deviceParams = Ptr null;
 
DETAILS
This parameter is passed as the last parameter to the underlying IOM driver's mdBindDevice function.
C SYNOPSIS
 
config DEV.Params.devid  // instance

Device id

Configuration settings
var params = new DEV.Params;
  ...
params.devid = Int 0;
 
C SYNOPSIS
 
config DEV.Params.initFxn  // instance

Driver Initialization function

Configuration settings
var params = new DEV.Params;
  ...
params.initFxn = Void(*)() null;
 
DETAILS
This function is called once for every entry in the device table. If this parameter is set to NULL (the default), then no function will be called.
C SYNOPSIS
Static Instance Creation

Configuration settings
var params = new DEV.Params;
// Allocate instance config-params
params.config =   ...
// Assign individual configs
 
var inst = DEV.create(String name, Ptr fxns, params);
// Create an instance-object
ARGUMENTS
name — name of device (must be a static string)
fxns — pointer to IOM_Fxns table
params — per-instance config params, or NULL to select default values (target-domain only)
eb — active error-handling block, or NULL to select default policy (target-domain only)
DETAILS
The 'name' parameter must be a static string since this name is referenced via a pointer and is not copied. For example:
  Error_init(&eb);
  DEV_create("/a2d", &A2DFXNS, &myparams, &eb);
The following code will not work since 'localstring' is a local variable:
  { 
      Char localstring[10];
      strcpy(localstring, "/a2d");
      Error_init(&eb);
      DEV_create(localstring, &A2DFXNS, &myparams, &eb);
  }
generated on Fri, 10 Jun 2016 23:29:38 GMT