提交 6280238c 编写于 作者: O Omar Ramirez Luna 提交者: Greg Kroah-Hartman
上级 26f8db7d
/*
* _chnl_sm.h
*
* DSP-BIOS Bridge driver support functions for TI OMAP processors.
*
* Private header file defining channel manager and channel objects for
* a shared memory channel driver.
*
* Shared between the modules implementing the shared memory channel class
* library.
*
* Copyright (C) 2005-2006 Texas Instruments, Inc.
*
* This package is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
#ifndef _CHNL_SM_
#define _CHNL_SM_
#include <dspbridge/dspapi.h>
#include <dspbridge/dspdefs.h>
#include <dspbridge/list.h>
#include <dspbridge/ntfy.h>
/*
* These target side symbols define the beginning and ending addresses
* of shared memory buffer. They are defined in the *cfg.cmd file by
* cdb code.
*/
#define CHNL_SHARED_BUFFER_BASE_SYM "_SHM_BEG"
#define CHNL_SHARED_BUFFER_LIMIT_SYM "_SHM_END"
#define BRIDGEINIT_BIOSGPTIMER "_BRIDGEINIT_BIOSGPTIMER"
#define BRIDGEINIT_LOADMON_GPTIMER "_BRIDGEINIT_LOADMON_GPTIMER"
#ifndef _CHNL_WORDSIZE
#define _CHNL_WORDSIZE 4 /* default _CHNL_WORDSIZE is 2 bytes/word */
#endif
#define MAXOPPS 16
/* Shared memory config options */
#define SHM_CURROPP 0 /* Set current OPP in shm */
#define SHM_OPPINFO 1 /* Set dsp voltage and freq table values */
#define SHM_GETOPP 2 /* Get opp requested by DSP */
struct opp_table_entry {
u32 voltage;
u32 frequency;
u32 min_freq;
u32 max_freq;
};
struct opp_struct {
u32 curr_opp_pt;
u32 num_opp_pts;
struct opp_table_entry opp_point[MAXOPPS];
};
/* Request to MPU */
struct opp_rqst_struct {
u32 rqst_dsp_freq;
u32 rqst_opp_pt;
};
/* Info to MPU */
struct load_mon_struct {
u32 curr_dsp_load;
u32 curr_dsp_freq;
u32 pred_dsp_load;
u32 pred_dsp_freq;
};
/* Structure in shared between DSP and PC for communication. */
struct shm {
u32 dsp_free_mask; /* Written by DSP, read by PC. */
u32 host_free_mask; /* Written by PC, read by DSP */
u32 input_full; /* Input channel has unread data. */
u32 input_id; /* Channel for which input is available. */
u32 input_size; /* Size of data block (in DSP words). */
u32 output_full; /* Output channel has unread data. */
u32 output_id; /* Channel for which output is available. */
u32 output_size; /* Size of data block (in DSP words). */
u32 arg; /* Arg for Issue/Reclaim (23 bits for 55x). */
u32 resvd; /* Keep structure size even for 32-bit DSPs */
/* Operating Point structure */
struct opp_struct opp_table_struct;
/* Operating Point Request structure */
struct opp_rqst_struct opp_request;
/* load monitor information structure */
struct load_mon_struct load_mon_info;
#ifdef CONFIG_BRIDGE_WDT3
/* Flag for WDT enable/disable F/I clocks */
u32 wdt_setclocks;
u32 wdt_overflow; /* WDT overflow time */
char dummy[176]; /* padding to 256 byte boundary */
#else
char dummy[184]; /* padding to 256 byte boundary */
#endif
u32 shm_dbg_var[64]; /* shared memory debug variables */
};
/* Channel Manager: only one created per board: */
struct chnl_mgr {
/* Function interface to Bridge driver */
struct bridge_drv_interface *intf_fxns;
struct io_mgr *hio_mgr; /* IO manager */
/* Device this board represents */
struct dev_object *hdev_obj;
/* These fields initialized in bridge_chnl_create(): */
u32 dw_output_mask; /* Host output channels w/ full buffers */
u32 dw_last_output; /* Last output channel fired from DPC */
/* Critical section object handle */
spinlock_t chnl_mgr_lock;
u32 word_size; /* Size in bytes of DSP word */
u8 max_channels; /* Total number of channels */
u8 open_channels; /* Total number of open channels */
struct chnl_object **ap_channel; /* Array of channels */
u8 dw_type; /* Type of channel class library */
/* If no shm syms, return for CHNL_Open */
int chnl_open_status;
};
/*
* Channel: up to CHNL_MAXCHANNELS per board or if DSP-DMA supported then
* up to CHNL_MAXCHANNELS + CHNL_MAXDDMACHNLS per board.
*/
struct chnl_object {
/* Pointer back to channel manager */
struct chnl_mgr *chnl_mgr_obj;
u32 chnl_id; /* Channel id */
u8 dw_state; /* Current channel state */
s8 chnl_mode; /* Chnl mode and attributes */
/* Chnl I/O completion event (user mode) */
void *user_event;
/* Abstract syncronization object */
struct sync_object *sync_event;
u32 process; /* Process which created this channel */
u32 pcb_arg; /* Argument to use with callback */
struct lst_list *pio_requests; /* List of IOR's to driver */
s32 cio_cs; /* Number of IOC's in queue */
s32 cio_reqs; /* Number of IORequests in queue */
s32 chnl_packets; /* Initial number of free Irps */
/* List of IOC's from driver */
struct lst_list *pio_completions;
struct lst_list *free_packets_list; /* List of free Irps */
struct ntfy_object *ntfy_obj;
u32 bytes_moved; /* Total number of bytes transfered */
/* For DSP-DMA */
/* Type of chnl transport:CHNL_[PCPY][DDMA] */
u32 chnl_type;
};
/* I/O Request/completion packet: */
struct chnl_irp {
struct list_head link; /* Link to next CHIRP in queue. */
/* Buffer to be filled/emptied. (User) */
u8 *host_user_buf;
/* Buffer to be filled/emptied. (System) */
u8 *host_sys_buf;
u32 dw_arg; /* Issue/Reclaim argument. */
u32 dsp_tx_addr; /* Transfer address on DSP side. */
u32 byte_size; /* Bytes transferred. */
u32 buf_size; /* Actual buffer size when allocated. */
u32 status; /* Status of IO completion. */
};
#endif /* _CHNL_SM_ */
/*
* brddefs.h
*
* DSP-BIOS Bridge driver support functions for TI OMAP processors.
*
* Global BRD constants and types, shared between DSP API and Bridge driver.
*
* Copyright (C) 2005-2006 Texas Instruments, Inc.
*
* This package is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
#ifndef BRDDEFS_
#define BRDDEFS_
/* platform status values */
#define BRD_STOPPED 0x0 /* No Monitor Loaded, Not running. */
#define BRD_IDLE 0x1 /* Monitor Loaded, but suspended. */
#define BRD_RUNNING 0x2 /* Monitor loaded, and executing. */
#define BRD_UNKNOWN 0x3 /* Board state is indeterminate. */
#define BRD_SYNCINIT 0x4
#define BRD_LOADED 0x5
#define BRD_LASTSTATE BRD_LOADED /* Set to highest legal board state. */
#define BRD_SLEEP_TRANSITION 0x6 /* Sleep transition in progress */
#define BRD_HIBERNATION 0x7 /* MPU initiated hibernation */
#define BRD_RETENTION 0x8 /* Retention mode */
#define BRD_DSP_HIBERNATION 0x9 /* DSP initiated hibernation */
#define BRD_ERROR 0xA /* Board state is Error */
/* BRD Object */
struct brd_object;
#endif /* BRDDEFS_ */
/*
* cfg.h
*
* DSP-BIOS Bridge driver support functions for TI OMAP processors.
*
* PM Configuration module.
*
* Copyright (C) 2005-2006 Texas Instruments, Inc.
*
* This package is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
#ifndef CFG_
#define CFG_
#include <dspbridge/host_os.h>
#include <dspbridge/cfgdefs.h>
/*
* ======== cfg_exit ========
* Purpose:
* Discontinue usage of the CFG module.
* Parameters:
* Returns:
* Requires:
* cfg_init(void) was previously called.
* Ensures:
* Resources acquired in cfg_init(void) are freed.
*/
extern void cfg_exit(void);
/*
* ======== cfg_get_auto_start ========
* Purpose:
* Retreive the autostart mask, if any, for this board.
* Parameters:
* dev_node_obj: Handle to the dev_node who's driver we are querying.
* pdwAutoStart: Ptr to location for 32 bit autostart mask.
* Returns:
* 0: Success.
* -EFAULT: dev_node_obj is invalid.
* -ENODATA: Unable to retreive resource.
* Requires:
* CFG initialized.
* Ensures:
* 0: *pdwAutoStart contains autostart mask for this devnode.
*/
extern int cfg_get_auto_start(IN struct cfg_devnode *dev_node_obj,
OUT u32 *pdwAutoStart);
/*
* ======== cfg_get_cd_version ========
* Purpose:
* Retrieves the version of the PM Class Driver.
* Parameters:
* pdwVersion: Ptr to u32 to contain version number upon return.
* Returns:
* 0: Success. pdwVersion contains Class Driver version in
* the form: 0xAABBCCDD where AABB is Major version and
* CCDD is Minor.
* -EPERM: Failure.
* Requires:
* CFG initialized.
* Ensures:
* 0: Success.
* else: *pdwVersion is NULL.
*/
extern int cfg_get_cd_version(OUT u32 *pdwVersion);
/*
* ======== cfg_get_dev_object ========
* Purpose:
* Retrieve the Device Object handle for a given devnode.
* Parameters:
* dev_node_obj: Platform's dev_node handle from which to retrieve
* value.
* pdwValue: Ptr to location to store the value.
* Returns:
* 0: Success.
* -EFAULT: dev_node_obj is invalid or phDevObject is invalid.
* -ENODATA: The resource is not available.
* Requires:
* CFG initialized.
* Ensures:
* 0: *pdwValue is set to the retrieved u32.
* else: *pdwValue is set to 0L.
*/
extern int cfg_get_dev_object(IN struct cfg_devnode *dev_node_obj,
OUT u32 *pdwValue);
/*
* ======== cfg_get_exec_file ========
* Purpose:
* Retreive the default executable, if any, for this board.
* Parameters:
* dev_node_obj: Handle to the dev_node who's driver we are querying.
* buf_size: Size of buffer.
* pstrExecFile: Ptr to character buf to hold ExecFile.
* Returns:
* 0: Success.
* -EFAULT: dev_node_obj is invalid or pstrExecFile is invalid.
* -ENODATA: The resource is not available.
* Requires:
* CFG initialized.
* Ensures:
* 0: Not more than buf_size bytes were copied into pstrExecFile,
* and *pstrExecFile contains default executable for this
* devnode.
*/
extern int cfg_get_exec_file(IN struct cfg_devnode *dev_node_obj,
IN u32 buf_size, OUT char *pstrExecFile);
/*
* ======== cfg_get_object ========
* Purpose:
* Retrieve the Driver Object handle From the Registry
* Parameters:
* pdwValue: Ptr to location to store the value.
* dw_type Type of Object to Get
* Returns:
* 0: Success.
* Requires:
* CFG initialized.
* Ensures:
* 0: *pdwValue is set to the retrieved u32(non-Zero).
* else: *pdwValue is set to 0L.
*/
extern int cfg_get_object(OUT u32 *pdwValue, u8 dw_type);
/*
* ======== cfg_get_perf_value ========
* Purpose:
* Retrieve a flag indicating whether PERF should log statistics for the
* PM class driver.
* Parameters:
* pfEnablePerf: Location to store flag. 0 indicates the key was
* not found, or had a zero value. A nonzero value
* means the key was found and had a nonzero value.
* Returns:
* Requires:
* pfEnablePerf != NULL;
* Ensures:
*/
extern void cfg_get_perf_value(OUT bool *pfEnablePerf);
/*
* ======== cfg_get_zl_file ========
* Purpose:
* Retreive the ZLFile, if any, for this board.
* Parameters:
* dev_node_obj: Handle to the dev_node who's driver we are querying.
* buf_size: Size of buffer.
* pstrZLFileName: Ptr to character buf to hold ZLFileName.
* Returns:
* 0: Success.
* -EFAULT: pstrZLFileName is invalid or dev_node_obj is invalid.
* -ENODATA: couldn't find the ZLFileName.
* Requires:
* CFG initialized.
* Ensures:
* 0: Not more than buf_size bytes were copied into
* pstrZLFileName, and *pstrZLFileName contains ZLFileName
* for this devnode.
*/
extern int cfg_get_zl_file(IN struct cfg_devnode *dev_node_obj,
IN u32 buf_size, OUT char *pstrZLFileName);
/*
* ======== cfg_init ========
* Purpose:
* Initialize the CFG module's private state.
* Parameters:
* Returns:
* TRUE if initialized; FALSE if error occured.
* Requires:
* Ensures:
* A requirement for each of the other public CFG functions.
*/
extern bool cfg_init(void);
/*
* ======== cfg_set_dev_object ========
* Purpose:
* Store the Device Object handle for a given devnode.
* Parameters:
* dev_node_obj: Platform's dev_node handle we are storing value with.
* dwValue: Arbitrary value to store.
* Returns:
* 0: Success.
* -EFAULT: dev_node_obj is invalid.
* -EPERM: Internal Error.
* Requires:
* CFG initialized.
* Ensures:
* 0: The Private u32 was successfully set.
*/
extern int cfg_set_dev_object(IN struct cfg_devnode *dev_node_obj,
IN u32 dwValue);
/*
* ======== CFG_SetDrvObject ========
* Purpose:
* Store the Driver Object handle.
* Parameters:
* dwValue: Arbitrary value to store.
* dw_type Type of Object to Store
* Returns:
* 0: Success.
* -EPERM: Internal Error.
* Requires:
* CFG initialized.
* Ensures:
* 0: The Private u32 was successfully set.
*/
extern int cfg_set_object(IN u32 dwValue, u8 dw_type);
#endif /* CFG_ */
/*
* cfgdefs.h
*
* DSP-BIOS Bridge driver support functions for TI OMAP processors.
*
* Global CFG constants and types, shared between DSP API and Bridge driver.
*
* Copyright (C) 2005-2006 Texas Instruments, Inc.
*
* This package is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
#ifndef CFGDEFS_
#define CFGDEFS_
/* Maximum length of module search path. */
#define CFG_MAXSEARCHPATHLEN 255
/* Maximum length of general paths. */
#define CFG_MAXPATH 255
/* Host Resources: */
#define CFG_MAXMEMREGISTERS 9
#define CFG_MAXIOPORTS 20
#define CFG_MAXIRQS 7
#define CFG_MAXDMACHANNELS 7
/* IRQ flag */
#define CFG_IRQSHARED 0x01 /* IRQ can be shared */
/* DSP Resources: */
#define CFG_DSPMAXMEMTYPES 10
#define CFG_DEFAULT_NUM_WINDOWS 1 /* We support only one window. */
/* A platform-related device handle: */
struct cfg_devnode;
/*
* Host resource structure.
*/
struct cfg_hostres {
u32 num_mem_windows; /* Set to default */
/* This is the base.memory */
u32 dw_mem_base[CFG_MAXMEMREGISTERS]; /* shm virtual address */
u32 dw_mem_length[CFG_MAXMEMREGISTERS]; /* Length of the Base */
u32 dw_mem_phys[CFG_MAXMEMREGISTERS]; /* shm Physical address */
u8 birq_registers; /* IRQ Number */
u8 birq_attrib; /* IRQ Attribute */
u32 dw_offset_for_monitor; /* The Shared memory starts from
* dw_mem_base + this offset */
/*
* Info needed by NODE for allocating channels to communicate with RMS:
* dw_chnl_offset: Offset of RMS channels. Lower channels are
* reserved.
* dw_chnl_buf_size: Size of channel buffer to send to RMS
* dw_num_chnls: Total number of channels
* (including reserved).
*/
u32 dw_chnl_offset;
u32 dw_chnl_buf_size;
u32 dw_num_chnls;
void __iomem *dw_per_base;
u32 dw_per_pm_base;
u32 dw_core_pm_base;
void __iomem *dw_dmmu_base;
void __iomem *dw_sys_ctrl_base;
};
struct cfg_dspmemdesc {
u32 mem_type; /* Type of memory. */
u32 ul_min; /* Minimum amount of memory of this type. */
u32 ul_max; /* Maximum amount of memory of this type. */
};
#endif /* CFGDEFS_ */
/*
* chnl.h
*
* DSP-BIOS Bridge driver support functions for TI OMAP processors.
*
* DSP API channel interface: multiplexes data streams through the single
* physical link managed by a Bridge driver.
*
* See DSP API chnl.h for more details.
*
* Copyright (C) 2005-2006 Texas Instruments, Inc.
*
* This package is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
#ifndef CHNL_
#define CHNL_
#include <dspbridge/chnlpriv.h>
/*
* ======== chnl_close ========
* Purpose:
* Ensures all pending I/O on this channel is cancelled, discards all
* queued I/O completion notifications, then frees the resources allocated
* for this channel, and makes the corresponding logical channel id
* available for subsequent use.
* Parameters:
* chnl_obj: Channel object handle.
* Returns:
* 0: Success;
* -EFAULT: Invalid chnl_obj.
* Requires:
* chnl_init(void) called.
* No thread must be blocked on this channel's I/O completion event.
* Ensures:
* 0: The I/O completion event for this channel is freed.
* chnl_obj is no longer valid.
*/
extern int chnl_close(struct chnl_object *chnl_obj);
/*
* ======== chnl_create ========
* Purpose:
* Create a channel manager object, responsible for opening new channels
* and closing old ones for a given board.
* Parameters:
* phChnlMgr: Location to store a channel manager object on output.
* hdev_obj: Handle to a device object.
* pMgrAttrs: Channel manager attributes.
* pMgrAttrs->max_channels: Max channels
* pMgrAttrs->birq: Channel's I/O IRQ number.
* pMgrAttrs->irq_shared: TRUE if the IRQ is shareable.
* pMgrAttrs->word_size: DSP Word size in equivalent PC bytes..
* Returns:
* 0: Success;
* -EFAULT: hdev_obj is invalid.
* -EINVAL: max_channels is 0.
* Invalid DSP word size (must be > 0).
* Invalid base address for DSP communications.
* -ENOMEM: Insufficient memory for requested resources.
* -EIO: Unable to plug channel ISR for configured IRQ.
* -ECHRNG: This manager cannot handle this many channels.
* -EEXIST: Channel manager already exists for this device.
* Requires:
* chnl_init(void) called.
* phChnlMgr != NULL.
* pMgrAttrs != NULL.
* Ensures:
* 0: Subsequent calls to chnl_create() for the same
* board without an intervening call to
* chnl_destroy() will fail.
*/
extern int chnl_create(OUT struct chnl_mgr **phChnlMgr,
struct dev_object *hdev_obj,
IN CONST struct chnl_mgrattrs *pMgrAttrs);
/*
* ======== chnl_destroy ========
* Purpose:
* Close all open channels, and destroy the channel manager.
* Parameters:
* hchnl_mgr: Channel manager object.
* Returns:
* 0: Success.
* -EFAULT: hchnl_mgr was invalid.
* Requires:
* chnl_init(void) called.
* Ensures:
* 0: Cancels I/O on each open channel.
* Closes each open channel.
* chnl_create may subsequently be called for the
* same board.
*/
extern int chnl_destroy(struct chnl_mgr *hchnl_mgr);
/*
* ======== chnl_exit ========
* Purpose:
* Discontinue usage of the CHNL module.
* Parameters:
* Returns:
* Requires:
* chnl_init(void) previously called.
* Ensures:
* Resources, if any acquired in chnl_init(void), are freed when the last
* client of CHNL calls chnl_exit(void).
*/
extern void chnl_exit(void);
/*
* ======== chnl_init ========
* Purpose:
* Initialize the CHNL module's private state.
* Parameters:
* Returns:
* TRUE if initialized; FALSE if error occurred.
* Requires:
* Ensures:
* A requirement for each of the other public CHNL functions.
*/
extern bool chnl_init(void);
#endif /* CHNL_ */
/*
* chnldefs.h
*
* DSP-BIOS Bridge driver support functions for TI OMAP processors.
*
* System-wide channel objects and constants.
*
* Copyright (C) 2005-2006 Texas Instruments, Inc.
*
* This package is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
#ifndef CHNLDEFS_
#define CHNLDEFS_
/* Channel id option. */
#define CHNL_PICKFREE (~0UL) /* Let manager pick a free channel. */
/* Channel manager limits: */
#define CHNL_INITIOREQS 4 /* Default # of I/O requests. */
/* Channel modes */
#define CHNL_MODETODSP 0 /* Data streaming to the DSP. */
#define CHNL_MODEFROMDSP 1 /* Data streaming from the DSP. */
/* GetIOCompletion flags */
#define CHNL_IOCINFINITE 0xffffffff /* Wait forever for IO completion. */
#define CHNL_IOCNOWAIT 0x0 /* Dequeue an IOC, if available. */
/* IO Completion Record status: */
#define CHNL_IOCSTATCOMPLETE 0x0000 /* IO Completed. */
#define CHNL_IOCSTATCANCEL 0x0002 /* IO was cancelled */
#define CHNL_IOCSTATTIMEOUT 0x0008 /* Wait for IOC timed out. */
#define CHNL_IOCSTATEOS 0x8000 /* End Of Stream reached. */
/* Macros for checking I/O Completion status: */
#define CHNL_IS_EOS(ioc) (ioc.status & CHNL_IOCSTATEOS)
#define CHNL_IS_IO_COMPLETE(ioc) (!(ioc.status & ~CHNL_IOCSTATEOS))
#define CHNL_IS_IO_CANCELLED(ioc) (ioc.status & CHNL_IOCSTATCANCEL)
#define CHNL_IS_TIMED_OUT(ioc) (ioc.status & CHNL_IOCSTATTIMEOUT)
/* Channel attributes: */
struct chnl_attr {
u32 uio_reqs; /* Max # of preallocated I/O requests. */
void *event_obj; /* User supplied auto-reset event object. */
char *pstr_event_name; /* Ptr to name of user event object. */
void *reserved1; /* Reserved for future use. */
u32 reserved2; /* Reserved for future use. */
};
/* I/O completion record: */
struct chnl_ioc {
void *pbuf; /* Buffer to be filled/emptied. */
u32 byte_size; /* Bytes transferred. */
u32 buf_size; /* Actual buffer size in bytes */
u32 status; /* Status of IO completion. */
u32 dw_arg; /* User argument associated with pbuf. */
};
#endif /* CHNLDEFS_ */
/*
* chnlpriv.h
*
* DSP-BIOS Bridge driver support functions for TI OMAP processors.
*
* Private channel header shared between DSPSYS, DSPAPI and
* Bridge driver modules.
*
* Copyright (C) 2005-2006 Texas Instruments, Inc.
*
* This package is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
#ifndef CHNLPRIV_
#define CHNLPRIV_
#include <dspbridge/chnldefs.h>
#include <dspbridge/devdefs.h>
#include <dspbridge/sync.h>
/* Channel manager limits: */
#define CHNL_MAXCHANNELS 32 /* Max channels available per transport */
/*
* Trans port channel Id definitions:(must match dsp-side).
*
* For CHNL_MAXCHANNELS = 16:
*
* ChnlIds:
* 0-15 (PCPY) - transport 0)
* 16-31 (DDMA) - transport 1)
* 32-47 (ZCPY) - transport 2)
*/
#define CHNL_PCPY 0 /* Proc-copy transport 0 */
#define CHNL_MAXIRQ 0xff /* Arbitrarily large number. */
/* The following modes are private: */
#define CHNL_MODEUSEREVENT 0x1000 /* User provided the channel event. */
#define CHNL_MODEMASK 0x1001
/* Higher level channel states: */
#define CHNL_STATEREADY 0 /* Channel ready for I/O. */
#define CHNL_STATECANCEL 1 /* I/O was cancelled. */
#define CHNL_STATEEOS 2 /* End Of Stream reached. */
/* Determine if user supplied an event for this channel: */
#define CHNL_IS_USER_EVENT(mode) (mode & CHNL_MODEUSEREVENT)
/* Macros for checking mode: */
#define CHNL_IS_INPUT(mode) (mode & CHNL_MODEFROMDSP)
#define CHNL_IS_OUTPUT(mode) (!CHNL_IS_INPUT(mode))
/* Types of channel class libraries: */
#define CHNL_TYPESM 1 /* Shared memory driver. */
#define CHNL_TYPEBM 2 /* Bus Mastering driver. */
/* Max string length of channel I/O completion event name - change if needed */
#define CHNL_MAXEVTNAMELEN 32
/* Max memory pages lockable in CHNL_PrepareBuffer() - change if needed */
#define CHNL_MAXLOCKPAGES 64
/* Channel info. */
struct chnl_info {
struct chnl_mgr *hchnl_mgr; /* Owning channel manager. */
u32 cnhl_id; /* Channel ID. */
void *event_obj; /* Channel I/O completion event. */
/*Abstraction of I/O completion event. */
struct sync_object *sync_event;
s8 dw_mode; /* Channel mode. */
u8 dw_state; /* Current channel state. */
u32 bytes_tx; /* Total bytes transferred. */
u32 cio_cs; /* Number of IOCs in queue. */
u32 cio_reqs; /* Number of IO Requests in queue. */
u32 process; /* Process owning this channel. */
};
/* Channel manager info: */
struct chnl_mgrinfo {
u8 dw_type; /* Type of channel class library. */
/* Channel handle, given the channel id. */
struct chnl_object *chnl_obj;
u8 open_channels; /* Number of open channels. */
u8 max_channels; /* total # of chnls supported */
};
/* Channel Manager Attrs: */
struct chnl_mgrattrs {
/* Max number of channels this manager can use. */
u8 max_channels;
u32 word_size; /* DSP Word size. */
};
#endif /* CHNLPRIV_ */
/*
* clk.h
*
* DSP-BIOS Bridge driver support functions for TI OMAP processors.
*
* Provides Clock functions.
*
* Copyright (C) 2005-2006 Texas Instruments, Inc.
*
* This package is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
#ifndef _CLK_H
#define _CLK_H
enum dsp_clk_id {
DSP_CLK_IVA2 = 0,
DSP_CLK_GPT5,
DSP_CLK_GPT6,
DSP_CLK_GPT7,
DSP_CLK_GPT8,
DSP_CLK_WDT3,
DSP_CLK_MCBSP1,
DSP_CLK_MCBSP2,
DSP_CLK_MCBSP3,
DSP_CLK_MCBSP4,
DSP_CLK_MCBSP5,
DSP_CLK_SSI,
DSP_CLK_NOT_DEFINED
};
/*
* ======== dsp_clk_exit ========
* Purpose:
* Discontinue usage of module; free resources when reference count
* reaches 0.
* Parameters:
* Returns:
* Requires:
* CLK initialized.
* Ensures:
* Resources used by module are freed when cRef reaches zero.
*/
extern void dsp_clk_exit(void);
/*
* ======== dsp_clk_init ========
* Purpose:
* Initializes private state of CLK module.
* Parameters:
* Returns:
* TRUE if initialized; FALSE if error occured.
* Requires:
* Ensures:
* CLK initialized.
*/
extern void dsp_clk_init(void);
void dsp_gpt_wait_overflow(short int clk_id, unsigned int load);
/*
* ======== dsp_clk_enable ========
* Purpose:
* Enables the clock requested.
* Parameters:
* Returns:
* 0: Success.
* -EPERM: Error occured while enabling the clock.
* Requires:
* Ensures:
*/
extern int dsp_clk_enable(IN enum dsp_clk_id clk_id);
u32 dsp_clock_enable_all(u32 dsp_per_clocks);
/*
* ======== dsp_clk_disable ========
* Purpose:
* Disables the clock requested.
* Parameters:
* Returns:
* 0: Success.
* -EPERM: Error occured while disabling the clock.
* Requires:
* Ensures:
*/
extern int dsp_clk_disable(IN enum dsp_clk_id clk_id);
extern u32 dsp_clk_get_iva2_rate(void);
u32 dsp_clock_disable_all(u32 dsp_per_clocks);
extern void ssi_clk_prepare(bool FLAG);
#endif /* _SYNC_H */
/*
* cmm.h
*
* DSP-BIOS Bridge driver support functions for TI OMAP processors.
*
* The Communication Memory Management(CMM) module provides shared memory
* management services for DSP/BIOS Bridge data streaming and messaging.
* Multiple shared memory segments can be registered with CMM. Memory is
* coelesced back to the appropriate pool when a buffer is freed.
*
* The CMM_Xlator[xxx] functions are used for node messaging and data
* streaming address translation to perform zero-copy inter-processor
* data transfer(GPP<->DSP). A "translator" object is created for a node or
* stream object that contains per thread virtual address information. This
* translator info is used at runtime to perform SM address translation
* to/from the DSP address space.
*
* Notes:
* cmm_xlator_alloc_buf - Used by Node and Stream modules for SM address
* translation.
*
* Copyright (C) 2008 Texas Instruments, Inc.
*
* This package is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
#ifndef CMM_
#define CMM_
#include <dspbridge/devdefs.h>
#include <dspbridge/cmmdefs.h>
#include <dspbridge/host_os.h>
/*
* ======== cmm_calloc_buf ========
* Purpose:
* Allocate memory buffers that can be used for data streaming or
* messaging.
* Parameters:
* hcmm_mgr: Cmm Mgr handle.
* usize: Number of bytes to allocate.
* pattr: Attributes of memory to allocate.
* pp_buf_va: Address of where to place VA.
* Returns:
* Pointer to a zero'd block of SM memory;
* NULL if memory couldn't be allocated,
* or if byte_size == 0,
* Requires:
* Valid hcmm_mgr.
* CMM initialized.
* Ensures:
* The returned pointer, if not NULL, points to a valid memory block of
* the size requested.
*
*/
extern void *cmm_calloc_buf(struct cmm_object *hcmm_mgr,
u32 usize, struct cmm_attrs *pattrs,
OUT void **pp_buf_va);
/*
* ======== cmm_create ========
* Purpose:
* Create a communication memory manager object.
* Parameters:
* ph_cmm_mgr: Location to store a communication manager handle on
* output.
* hdev_obj: Handle to a device object.
* pMgrAttrs: Comm mem manager attributes.
* Returns:
* 0: Success;
* -ENOMEM: Insufficient memory for requested resources.
* -EPERM: Failed to initialize critical sect sync object.
*
* Requires:
* cmm_init(void) called.
* ph_cmm_mgr != NULL.
* pMgrAttrs->ul_min_block_size >= 4 bytes.
* Ensures:
*
*/
extern int cmm_create(OUT struct cmm_object **ph_cmm_mgr,
struct dev_object *hdev_obj,
IN CONST struct cmm_mgrattrs *pMgrAttrs);
/*
* ======== cmm_destroy ========
* Purpose:
* Destroy the communication memory manager object.
* Parameters:
* hcmm_mgr: Cmm Mgr handle.
* bForce: Force deallocation of all cmm memory immediately if set TRUE.
* If FALSE, and outstanding allocations will return -EPERM
* status.
* Returns:
* 0: CMM object & resources deleted.
* -EPERM: Unable to free CMM object due to outstanding allocation.
* -EFAULT: Unable to free CMM due to bad handle.
* Requires:
* CMM is initialized.
* hcmm_mgr != NULL.
* Ensures:
* Memory resources used by Cmm Mgr are freed.
*/
extern int cmm_destroy(struct cmm_object *hcmm_mgr, bool bForce);
/*
* ======== cmm_exit ========
* Purpose:
* Discontinue usage of module. Cleanup CMM module if CMM cRef reaches zero.
* Parameters:
* n/a
* Returns:
* n/a
* Requires:
* CMM is initialized.
* Ensures:
*/
extern void cmm_exit(void);
/*
* ======== cmm_free_buf ========
* Purpose:
* Free the given buffer.
* Parameters:
* hcmm_mgr: Cmm Mgr handle.
* pbuf: Pointer to memory allocated by cmm_calloc_buf().
* ul_seg_id: SM segment Id used in CMM_Calloc() attrs.
* Set to 0 to use default segment.
* Returns:
* 0
* -EPERM
* Requires:
* CMM initialized.
* buf_pa != NULL
* Ensures:
*
*/
extern int cmm_free_buf(struct cmm_object *hcmm_mgr,
void *buf_pa, u32 ul_seg_id);
/*
* ======== cmm_get_handle ========
* Purpose:
* Return the handle to the cmm mgr for the given device obj.
* Parameters:
* hprocessor: Handle to a Processor.
* ph_cmm_mgr: Location to store the shared memory mgr handle on
* output.
*
* Returns:
* 0: Cmm Mgr opaque handle returned.
* -EFAULT: Invalid handle.
* Requires:
* ph_cmm_mgr != NULL
* hdev_obj != NULL
* Ensures:
*/
extern int cmm_get_handle(void *hprocessor,
OUT struct cmm_object **ph_cmm_mgr);
/*
* ======== cmm_get_info ========
* Purpose:
* Return the current SM and VM utilization information.
* Parameters:
* hcmm_mgr: Handle to a Cmm Mgr.
* cmm_info_obj: Location to store the Cmm information on output.
*
* Returns:
* 0: Success.
* -EFAULT: Invalid handle.
* -EINVAL Invalid input argument.
* Requires:
* Ensures:
*
*/
extern int cmm_get_info(struct cmm_object *hcmm_mgr,
OUT struct cmm_info *cmm_info_obj);
/*
* ======== cmm_init ========
* Purpose:
* Initializes private state of CMM module.
* Parameters:
* Returns:
* TRUE if initialized; FALSE if error occured.
* Requires:
* Ensures:
* CMM initialized.
*/
extern bool cmm_init(void);
/*
* ======== cmm_register_gppsm_seg ========
* Purpose:
* Register a block of SM with the CMM.
* Parameters:
* hcmm_mgr: Handle to a Cmm Mgr.
* lpGPPBasePA: GPP Base Physical address.
* ul_size: Size in GPP bytes.
* dwDSPAddrOffset GPP PA to DSP PA Offset.
* c_factor: Add offset if CMM_ADDTODSPPA, sub if CMM_SUBFROMDSPPA.
* dw_dsp_base: DSP virtual base byte address.
* ul_dsp_size: Size of DSP segment in bytes.
* pulSegId: Address to store segment Id.
*
* Returns:
* 0: Success.
* -EFAULT: Invalid hcmm_mgr handle.
* -EINVAL: Invalid input argument.
* -EPERM: Unable to register.
* - On success *pulSegId is a valid SM segment ID.
* Requires:
* ul_size > 0
* pulSegId != NULL
* dw_gpp_base_pa != 0
* c_factor = CMM_ADDTODSPPA || c_factor = CMM_SUBFROMDSPPA
* Ensures:
*
*/
extern int cmm_register_gppsm_seg(struct cmm_object *hcmm_mgr,
unsigned int dw_gpp_base_pa,
u32 ul_size,
u32 dwDSPAddrOffset,
s8 c_factor,
unsigned int dw_dsp_base,
u32 ul_dsp_size,
u32 *pulSegId, u32 dwGPPBaseBA);
/*
* ======== cmm_un_register_gppsm_seg ========
* Purpose:
* Unregister the given memory segment that was previously registered
* by cmm_register_gppsm_seg.
* Parameters:
* hcmm_mgr: Handle to a Cmm Mgr.
* ul_seg_id Segment identifier returned by cmm_register_gppsm_seg.
* Returns:
* 0: Success.
* -EFAULT: Invalid handle.
* -EINVAL: Invalid ul_seg_id.
* -EPERM: Unable to unregister for unknown reason.
* Requires:
* Ensures:
*
*/
extern int cmm_un_register_gppsm_seg(struct cmm_object *hcmm_mgr,
u32 ul_seg_id);
/*
* ======== cmm_xlator_alloc_buf ========
* Purpose:
* Allocate the specified SM buffer and create a local memory descriptor.
* Place on the descriptor on the translator's HaQ (Host Alloc'd Queue).
* Parameters:
* xlator: Handle to a Xlator object.
* pVaBuf: Virtual address ptr(client context)
* uPaSize: Size of SM memory to allocate.
* Returns:
* Ptr to valid physical address(Pa) of uPaSize bytes, NULL if failed.
* Requires:
* pVaBuf != 0.
* uPaSize != 0.
* Ensures:
*
*/
extern void *cmm_xlator_alloc_buf(struct cmm_xlatorobject *xlator,
void *pVaBuf, u32 uPaSize);
/*
* ======== cmm_xlator_create ========
* Purpose:
* Create a translator(xlator) object used for process specific Va<->Pa
* address translation. Node messaging and streams use this to perform
* inter-processor(GPP<->DSP) zero-copy data transfer.
* Parameters:
* phXlator: Address to place handle to a new Xlator handle.
* hcmm_mgr: Handle to Cmm Mgr associated with this translator.
* pXlatorAttrs: Translator attributes used for the client NODE or STREAM.
* Returns:
* 0: Success.
* -EINVAL: Bad input Attrs.
* -ENOMEM: Insufficient memory(local) for requested resources.
* Requires:
* phXlator != NULL
* hcmm_mgr != NULL
* pXlatorAttrs != NULL
* Ensures:
*
*/
extern int cmm_xlator_create(OUT struct cmm_xlatorobject **phXlator,
struct cmm_object *hcmm_mgr,
struct cmm_xlatorattrs *pXlatorAttrs);
/*
* ======== cmm_xlator_delete ========
* Purpose:
* Delete translator resources
* Parameters:
* xlator: handle to translator.
* bForce: bForce = TRUE will free XLators SM buffers/dscriptrs.
* Returns:
* 0: Success.
* -EFAULT: Bad translator handle.
* -EPERM: Unable to free translator resources.
* Requires:
* refs > 0
* Ensures:
*
*/
extern int cmm_xlator_delete(struct cmm_xlatorobject *xlator,
bool bForce);
/*
* ======== cmm_xlator_free_buf ========
* Purpose:
* Free SM buffer and descriptor.
* Does not free client process VM.
* Parameters:
* xlator: handle to translator.
* pBufVa Virtual address of PA to free.
* Returns:
* 0: Success.
* -EFAULT: Bad translator handle.
* Requires:
* Ensures:
*
*/
extern int cmm_xlator_free_buf(struct cmm_xlatorobject *xlator,
void *pBufVa);
/*
* ======== cmm_xlator_info ========
* Purpose:
* Set/Get process specific "translator" address info.
* This is used to perform fast virtaul address translation
* for shared memory buffers between the GPP and DSP.
* Parameters:
* xlator: handle to translator.
* paddr: Virtual base address of segment.
* ul_size: Size in bytes.
* uSegId: Segment identifier of SM segment(s)
* set_info Set xlator fields if TRUE, else return base addr
* Returns:
* 0: Success.
* -EFAULT: Bad translator handle.
* Requires:
* (refs > 0)
* (paddr != NULL)
* (ul_size > 0)
* Ensures:
*
*/
extern int cmm_xlator_info(struct cmm_xlatorobject *xlator,
IN OUT u8 **paddr,
u32 ul_size, u32 uSegId, bool set_info);
/*
* ======== cmm_xlator_translate ========
* Purpose:
* Perform address translation VA<->PA for the specified stream or
* message shared memory buffer.
* Parameters:
* xlator: handle to translator.
* paddr address of buffer to translate.
* xType Type of address xlation. CMM_PA2VA or CMM_VA2PA.
* Returns:
* Valid address on success, else NULL.
* Requires:
* refs > 0
* paddr != NULL
* xType >= CMM_VA2PA) && (xType <= CMM_DSPPA2PA)
* Ensures:
*
*/
extern void *cmm_xlator_translate(struct cmm_xlatorobject *xlator,
void *paddr, enum cmm_xlatetype xType);
#endif /* CMM_ */
/*
* cmmdefs.h
*
* DSP-BIOS Bridge driver support functions for TI OMAP processors.
*
* Global MEM constants and types.
*
* Copyright (C) 2008 Texas Instruments, Inc.
*
* This package is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
#ifndef CMMDEFS_
#define CMMDEFS_
#include <dspbridge/list.h>
/* Cmm attributes used in cmm_create() */
struct cmm_mgrattrs {
/* Minimum SM allocation; default 32 bytes. */
u32 ul_min_block_size;
};
/* Attributes for CMM_AllocBuf() & CMM_AllocDesc() */
struct cmm_attrs {
u32 ul_seg_id; /* 1,2... are SM segments. 0 is not. */
u32 ul_alignment; /* 0,1,2,4....ul_min_block_size */
};
/*
* DSPPa to GPPPa Conversion Factor.
*
* For typical platforms:
* converted Address = PaDSP + ( c_factor * addressToConvert).
*/
#define CMM_SUBFROMDSPPA -1
#define CMM_ADDTODSPPA 1
#define CMM_ALLSEGMENTS 0xFFFFFF /* All SegIds */
#define CMM_MAXGPPSEGS 1 /* Maximum # of SM segs */
/*
* SMSEGs are SM segments the DSP allocates from.
*
* This info is used by the GPP to xlate DSP allocated PAs.
*/
struct cmm_seginfo {
u32 dw_seg_base_pa; /* Start Phys address of SM segment */
/* Total size in bytes of segment: DSP+GPP */
u32 ul_total_seg_size;
u32 dw_gpp_base_pa; /* Start Phys addr of Gpp SM seg */
u32 ul_gpp_size; /* Size of Gpp SM seg in bytes */
u32 dw_dsp_base_va; /* DSP virt base byte address */
u32 ul_dsp_size; /* DSP seg size in bytes */
/* # of current GPP allocations from this segment */
u32 ul_in_use_cnt;
u32 dw_seg_base_va; /* Start Virt address of SM seg */
};
/* CMM useful information */
struct cmm_info {
/* # of SM segments registered with this Cmm. */
u32 ul_num_gppsm_segs;
/* Total # of allocations outstanding for CMM */
u32 ul_total_in_use_cnt;
/* Min SM block size allocation from cmm_create() */
u32 ul_min_block_size;
/* Info per registered SM segment. */
struct cmm_seginfo seg_info[CMM_MAXGPPSEGS];
};
/* XlatorCreate attributes */
struct cmm_xlatorattrs {
u32 ul_seg_id; /* segment Id used for SM allocations */
u32 dw_dsp_bufs; /* # of DSP-side bufs */
u32 dw_dsp_buf_size; /* size of DSP-side bufs in GPP bytes */
/* Vm base address alloc'd in client process context */
void *vm_base;
/* dw_vm_size must be >= (dwMaxNumBufs * dwMaxSize) */
u32 dw_vm_size;
};
/*
* Cmm translation types. Use to map SM addresses to process context.
*/
enum cmm_xlatetype {
CMM_VA2PA = 0, /* Virtual to GPP physical address xlation */
CMM_PA2VA = 1, /* GPP Physical to virtual */
CMM_VA2DSPPA = 2, /* Va to DSP Pa */
CMM_PA2DSPPA = 3, /* GPP Pa to DSP Pa */
CMM_DSPPA2PA = 4, /* DSP Pa to GPP Pa */
};
struct cmm_object;
struct cmm_xlatorobject;
#endif /* CMMDEFS_ */
/*
* cod.h
*
* DSP-BIOS Bridge driver support functions for TI OMAP processors.
*
* Code management module for DSPs. This module provides an interface
* interface for loading both static and dynamic code objects onto DSP
* systems.
*
* Copyright (C) 2005-2006 Texas Instruments, Inc.
*
* This package is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
#ifndef COD_
#define COD_
#include <dspbridge/dblldefs.h>
#define COD_MAXPATHLENGTH 255
#define COD_TRACEBEG "SYS_PUTCBEG"
#define COD_TRACEEND "SYS_PUTCEND"
#define COD_TRACECURPOS "BRIDGE_SYS_PUTC_current"
#define COD_TRACESECT "trace"
#define COD_TRACEBEGOLD "PUTCBEG"
#define COD_TRACEENDOLD "PUTCEND"
#define COD_NOLOAD DBLL_NOLOAD
#define COD_SYMB DBLL_SYMB
/* COD code manager handle */
struct cod_manager;
/* COD library handle */
struct cod_libraryobj;
/* COD attributes */
struct cod_attrs {
u32 ul_reserved;
};
/*
* Function prototypes for writing memory to a DSP system, allocating
* and freeing DSP memory.
*/
typedef u32(*cod_writefxn) (void *priv_ref, u32 ulDspAddr,
void *pbuf, u32 ul_num_bytes, u32 nMemSpace);
/*
* ======== cod_close ========
* Purpose:
* Close a library opened with cod_open().
* Parameters:
* lib - Library handle returned by cod_open().
* Returns:
* None.
* Requires:
* COD module initialized.
* valid lib.
* Ensures:
*
*/
extern void cod_close(struct cod_libraryobj *lib);
/*
* ======== cod_create ========
* Purpose:
* Create an object to manage code on a DSP system. This object can be
* used to load an initial program image with arguments that can later
* be expanded with dynamically loaded object files.
* Symbol table information is managed by this object and can be retrieved
* using the cod_get_sym_value() function.
* Parameters:
* phManager: created manager object
* pstrZLFile: ZL DLL filename, of length < COD_MAXPATHLENGTH.
* attrs: attributes to be used by this object. A NULL value
* will cause default attrs to be used.
* Returns:
* 0: Success.
* -ESPIPE: ZL_Create failed.
* -ENOSYS: attrs was not NULL. We don't yet support
* non default values of attrs.
* Requires:
* COD module initialized.
* pstrZLFile != NULL
* Ensures:
*/
extern int cod_create(OUT struct cod_manager **phManager,
char *pstrZLFile,
IN OPTIONAL CONST struct cod_attrs *attrs);
/*
* ======== cod_delete ========
* Purpose:
* Delete a code manager object.
* Parameters:
* cod_mgr_obj: handle of manager to be deleted
* Returns:
* None.
* Requires:
* COD module initialized.
* valid cod_mgr_obj.
* Ensures:
*/
extern void cod_delete(struct cod_manager *cod_mgr_obj);
/*
* ======== cod_exit ========
* Purpose:
* Discontinue usage of the COD module.
* Parameters:
* None.
* Returns:
* None.
* Requires:
* COD initialized.
* Ensures:
* Resources acquired in cod_init(void) are freed.
*/
extern void cod_exit(void);
/*
* ======== cod_get_base_lib ========
* Purpose:
* Get handle to the base image DBL library.
* Parameters:
* cod_mgr_obj: handle of manager to be deleted
* plib: location to store library handle on output.
* Returns:
* 0: Success.
* Requires:
* COD module initialized.
* valid cod_mgr_obj.
* plib != NULL.
* Ensures:
*/
extern int cod_get_base_lib(struct cod_manager *cod_mgr_obj,
struct dbll_library_obj **plib);
/*
* ======== cod_get_base_name ========
* Purpose:
* Get the name of the base image DBL library.
* Parameters:
* cod_mgr_obj: handle of manager to be deleted
* pszName: location to store library name on output.
* usize: size of name buffer.
* Returns:
* 0: Success.
* -EPERM: Buffer too small.
* Requires:
* COD module initialized.
* valid cod_mgr_obj.
* pszName != NULL.
* Ensures:
*/
extern int cod_get_base_name(struct cod_manager *cod_mgr_obj,
char *pszName, u32 usize);
/*
* ======== cod_get_entry ========
* Purpose:
* Retrieve the entry point of a loaded DSP program image
* Parameters:
* cod_mgr_obj: handle of manager to be deleted
* pulEntry: pointer to location for entry point
* Returns:
* 0: Success.
* Requires:
* COD module initialized.
* valid cod_mgr_obj.
* pulEntry != NULL.
* Ensures:
*/
extern int cod_get_entry(struct cod_manager *cod_mgr_obj,
u32 *pulEntry);
/*
* ======== cod_get_loader ========
* Purpose:
* Get handle to the DBL loader.
* Parameters:
* cod_mgr_obj: handle of manager to be deleted
* phLoader: location to store loader handle on output.
* Returns:
* 0: Success.
* Requires:
* COD module initialized.
* valid cod_mgr_obj.
* phLoader != NULL.
* Ensures:
*/
extern int cod_get_loader(struct cod_manager *cod_mgr_obj,
struct dbll_tar_obj **phLoader);
/*
* ======== cod_get_section ========
* Purpose:
* Retrieve the starting address and length of a section in the COFF file
* given the section name.
* Parameters:
* lib Library handle returned from cod_open().
* pstrSect: name of the section, with or without leading "."
* puAddr: Location to store address.
* puLen: Location to store length.
* Returns:
* 0: Success
* -ESPIPE: Symbols could not be found or have not been loaded onto
* the board.
* Requires:
* COD module initialized.
* valid cod_mgr_obj.
* pstrSect != NULL;
* puAddr != NULL;
* puLen != NULL;
* Ensures:
* 0: *puAddr and *puLen contain the address and length of the
* section.
* else: *puAddr == 0 and *puLen == 0;
*
*/
extern int cod_get_section(struct cod_libraryobj *lib,
IN char *pstrSect,
OUT u32 *puAddr, OUT u32 *puLen);
/*
* ======== cod_get_sym_value ========
* Purpose:
* Retrieve the value for the specified symbol. The symbol is first
* searched for literally and then, if not found, searched for as a
* C symbol.
* Parameters:
* lib: library handle returned from cod_open().
* pstrSymbol: name of the symbol
* value: value of the symbol
* Returns:
* 0: Success.
* -ESPIPE: Symbols could not be found or have not been loaded onto
* the board.
* Requires:
* COD module initialized.
* Valid cod_mgr_obj.
* pstrSym != NULL.
* pul_value != NULL.
* Ensures:
*/
extern int cod_get_sym_value(struct cod_manager *cod_mgr_obj,
IN char *pstrSym, OUT u32 * pul_value);
/*
* ======== cod_init ========
* Purpose:
* Initialize the COD module's private state.
* Parameters:
* None.
* Returns:
* TRUE if initialized; FALSE if error occured.
* Requires:
* Ensures:
* A requirement for each of the other public COD functions.
*/
extern bool cod_init(void);
/*
* ======== cod_load_base ========
* Purpose:
* Load the initial program image, optionally with command-line arguments,
* on the DSP system managed by the supplied handle. The program to be
* loaded must be the first element of the args array and must be a fully
* qualified pathname.
* Parameters:
* hmgr: manager to load the code with
* nArgc: number of arguments in the args array
* args: array of strings for arguments to DSP program
* write_fxn: board-specific function to write data to DSP system
* pArb: arbitrary pointer to be passed as first arg to write_fxn
* envp: array of environment strings for DSP exec.
* Returns:
* 0: Success.
* -EBADF: Failed to open target code.
* Requires:
* COD module initialized.
* hmgr is valid.
* nArgc > 0.
* aArgs != NULL.
* aArgs[0] != NULL.
* pfn_write != NULL.
* Ensures:
*/
extern int cod_load_base(struct cod_manager *cod_mgr_obj,
u32 nArgc, char *aArgs[],
cod_writefxn pfn_write, void *pArb,
char *envp[]);
/*
* ======== cod_open ========
* Purpose:
* Open a library for reading sections. Does not load or set the base.
* Parameters:
* hmgr: manager to load the code with
* pszCoffPath: Coff file to open.
* flags: COD_NOLOAD (don't load symbols) or COD_SYMB (load
* symbols).
* pLib: Handle returned that can be used in calls to cod_close
* and cod_get_section.
* Returns:
* S_OK: Success.
* -EBADF: Failed to open target code.
* Requires:
* COD module initialized.
* hmgr is valid.
* flags == COD_NOLOAD || flags == COD_SYMB.
* pszCoffPath != NULL.
* Ensures:
*/
extern int cod_open(struct cod_manager *hmgr,
IN char *pszCoffPath,
u32 flags, OUT struct cod_libraryobj **pLib);
/*
* ======== cod_open_base ========
* Purpose:
* Open base image for reading sections. Does not load the base.
* Parameters:
* hmgr: manager to load the code with
* pszCoffPath: Coff file to open.
* flags: Specifies whether to load symbols.
* Returns:
* 0: Success.
* -EBADF: Failed to open target code.
* Requires:
* COD module initialized.
* hmgr is valid.
* pszCoffPath != NULL.
* Ensures:
*/
extern int cod_open_base(struct cod_manager *hmgr, IN char *pszCoffPath,
dbll_flags flags);
/*
* ======== cod_read_section ========
* Purpose:
* Retrieve the content of a code section given the section name.
* Parameters:
* cod_mgr_obj - manager in which to search for the symbol
* pstrSect - name of the section, with or without leading "."
* pstrContent - buffer to store content of the section.
* Returns:
* 0: on success, error code on failure
* -ESPIPE: Symbols have not been loaded onto the board.
* Requires:
* COD module initialized.
* valid cod_mgr_obj.
* pstrSect != NULL;
* pstrContent != NULL;
* Ensures:
* 0: *pstrContent stores the content of the named section.
*/
extern int cod_read_section(struct cod_libraryobj *lib,
IN char *pstrSect,
OUT char *pstrContent, IN u32 cContentSize);
#endif /* COD_ */
/*
* dbc.h
*
* DSP-BIOS Bridge driver support functions for TI OMAP processors.
*
* "Design by Contract" programming macros.
*
* Notes:
* Requires that the GT->ERROR function has been defaulted to a valid
* error handler for the given execution environment.
*
* Does not require that GT_init() be called.
*
* Copyright (C) 2008 Texas Instruments, Inc.
*
* This package is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
#ifndef DBC_
#define DBC_
/* Assertion Macros: */
#ifdef CONFIG_BRIDGE_DEBUG
#define DBC_ASSERT(exp) \
if (!(exp)) \
pr_err("%s, line %d: Assertion (" #exp ") failed.\n", \
__FILE__, __LINE__)
#define DBC_REQUIRE DBC_ASSERT /* Function Precondition. */
#define DBC_ENSURE DBC_ASSERT /* Function Postcondition. */
#else
#define DBC_ASSERT(exp) {}
#define DBC_REQUIRE(exp) {}
#define DBC_ENSURE(exp) {}
#endif /* DEBUG */
#endif /* DBC_ */
/*
* dbdcd.h
*
* DSP-BIOS Bridge driver support functions for TI OMAP processors.
*
* Defines the DSP/BIOS Bridge Configuration Database (DCD) API.
*
* Copyright (C) 2008 Texas Instruments, Inc.
*
* This package is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
#ifndef DBDCD_
#define DBDCD_
#include <dspbridge/dbdcddef.h>
#include <dspbridge/host_os.h>
#include <dspbridge/nldrdefs.h>
/*
* ======== dcd_auto_register ========
* Purpose:
* This function automatically registers DCD objects specified in a
* special COFF section called ".dcd_register"
* Parameters:
* hdcd_mgr: A DCD manager handle.
* pszCoffPath: Pointer to name of COFF file containing DCD
* objects to be registered.
* Returns:
* 0: Success.
* -EACCES: Unable to find auto-registration/read/load section.
* -EFAULT: Invalid DCD_HMANAGER handle..
* Requires:
* DCD initialized.
* Ensures:
* Note:
* Due to the DCD database construction, it is essential for a DCD-enabled
* COFF file to contain the right COFF sections, especially
* ".dcd_register", which is used for auto registration.
*/
extern int dcd_auto_register(IN struct dcd_manager *hdcd_mgr,
IN char *pszCoffPath);
/*
* ======== dcd_auto_unregister ========
* Purpose:
* This function automatically unregisters DCD objects specified in a
* special COFF section called ".dcd_register"
* Parameters:
* hdcd_mgr: A DCD manager handle.
* pszCoffPath: Pointer to name of COFF file containing
* DCD objects to be unregistered.
* Returns:
* 0: Success.
* -EACCES: Unable to find auto-registration/read/load section.
* -EFAULT: Invalid DCD_HMANAGER handle..
* Requires:
* DCD initialized.
* Ensures:
* Note:
* Due to the DCD database construction, it is essential for a DCD-enabled
* COFF file to contain the right COFF sections, especially
* ".dcd_register", which is used for auto unregistration.
*/
extern int dcd_auto_unregister(IN struct dcd_manager *hdcd_mgr,
IN char *pszCoffPath);
/*
* ======== dcd_create_manager ========
* Purpose:
* This function creates a DCD module manager.
* Parameters:
* pszZlDllName: Pointer to a DLL name string.
* phDcdMgr: A pointer to a DCD manager handle.
* Returns:
* 0: Success.
* -ENOMEM: Unable to allocate memory for DCD manager handle.
* -EPERM: General failure.
* Requires:
* DCD initialized.
* pszZlDllName is non-NULL.
* phDcdMgr is non-NULL.
* Ensures:
* A DCD manager handle is created.
*/
extern int dcd_create_manager(IN char *pszZlDllName,
OUT struct dcd_manager **phDcdMgr);
/*
* ======== dcd_destroy_manager ========
* Purpose:
* This function destroys a DCD module manager.
* Parameters:
* hdcd_mgr: A DCD manager handle.
* Returns:
* 0: Success.
* -EFAULT: Invalid DCD manager handle.
* Requires:
* DCD initialized.
* Ensures:
*/
extern int dcd_destroy_manager(IN struct dcd_manager *hdcd_mgr);
/*
* ======== dcd_enumerate_object ========
* Purpose:
* This function enumerates currently visible DSP/BIOS Bridge objects
* and returns the UUID and type of each enumerated object.
* Parameters:
* cIndex: The object enumeration index.
* obj_type: Type of object to enumerate.
* uuid_obj: Pointer to a dsp_uuid object.
* Returns:
* 0: Success.
* -EPERM: Unable to enumerate through the DCD database.
* ENODATA: Enumeration completed. This is not an error code.
* Requires:
* DCD initialized.
* uuid_obj is a valid pointer.
* Ensures:
* Details:
* This function can be used in conjunction with dcd_get_object_def to
* retrieve object properties.
*/
extern int dcd_enumerate_object(IN s32 cIndex,
IN enum dsp_dcdobjtype obj_type,
OUT struct dsp_uuid *uuid_obj);
/*
* ======== dcd_exit ========
* Purpose:
* This function cleans up the DCD module.
* Parameters:
* Returns:
* Requires:
* DCD initialized.
* Ensures:
*/
extern void dcd_exit(void);
/*
* ======== dcd_get_dep_libs ========
* Purpose:
* Given the uuid of a library and size of array of uuids, this function
* fills the array with the uuids of all dependent libraries of the input
* library.
* Parameters:
* hdcd_mgr: A DCD manager handle.
* uuid_obj: Pointer to a dsp_uuid for a library.
* numLibs: Size of uuid array (number of library uuids).
* pDepLibUuids: Array of dependent library uuids to be filled in.
* pPersistentDepLibs: Array indicating if corresponding lib is persistent.
* phase: phase to obtain correct input library
* Returns:
* 0: Success.
* -ENOMEM: Memory allocation failure.
* -EACCES: Failure to read section containing library info.
* -EPERM: General failure.
* Requires:
* DCD initialized.
* Valid hdcd_mgr.
* uuid_obj != NULL
* pDepLibUuids != NULL.
* Ensures:
*/
extern int dcd_get_dep_libs(IN struct dcd_manager *hdcd_mgr,
IN struct dsp_uuid *uuid_obj,
u16 numLibs,
OUT struct dsp_uuid *pDepLibUuids,
OUT bool *pPersistentDepLibs,
IN enum nldr_phase phase);
/*
* ======== dcd_get_num_dep_libs ========
* Purpose:
* Given the uuid of a library, determine its number of dependent
* libraries.
* Parameters:
* hdcd_mgr: A DCD manager handle.
* uuid_obj: Pointer to a dsp_uuid for a library.
* pNumLibs: Size of uuid array (number of library uuids).
* pNumPersLibs: number of persistent dependent library.
* phase: Phase to obtain correct input library
* Returns:
* 0: Success.
* -ENOMEM: Memory allocation failure.
* -EACCES: Failure to read section containing library info.
* -EPERM: General failure.
* Requires:
* DCD initialized.
* Valid hdcd_mgr.
* uuid_obj != NULL
* pNumLibs != NULL.
* Ensures:
*/
extern int dcd_get_num_dep_libs(IN struct dcd_manager *hdcd_mgr,
IN struct dsp_uuid *uuid_obj,
OUT u16 *pNumLibs,
OUT u16 *pNumPersLibs,
IN enum nldr_phase phase);
/*
* ======== dcd_get_library_name ========
* Purpose:
* This function returns the name of a (dynamic) library for a given
* UUID.
* Parameters:
* hdcd_mgr: A DCD manager handle.
* uuid_obj: Pointer to a dsp_uuid that represents a unique DSP/BIOS
* Bridge object.
* pstrLibName: Buffer to hold library name.
* pdwSize: Contains buffer size. Set to string size on output.
* phase: Which phase to load
* phase_split: Are phases in multiple libraries
* Returns:
* 0: Success.
* -EPERM: General failure.
* Requires:
* DCD initialized.
* Valid hdcd_mgr.
* pstrLibName != NULL.
* uuid_obj != NULL
* pdwSize != NULL.
* Ensures:
*/
extern int dcd_get_library_name(IN struct dcd_manager *hdcd_mgr,
IN struct dsp_uuid *uuid_obj,
IN OUT char *pstrLibName,
IN OUT u32 *pdwSize,
IN enum nldr_phase phase,
OUT bool *phase_split);
/*
* ======== dcd_get_object_def ========
* Purpose:
* This function returns the properties/attributes of a DSP/BIOS Bridge
* object.
* Parameters:
* hdcd_mgr: A DCD manager handle.
* uuid_obj: Pointer to a dsp_uuid that represents a unique
* DSP/BIOS Bridge object.
* obj_type: The type of DSP/BIOS Bridge object to be
* referenced (node, processor, etc).
* pObjDef: Pointer to an object definition structure. A
* union of various possible DCD object types.
* Returns:
* 0: Success.
* -EACCES: Unable to access/read/parse/load content of object code
* section.
* -EPERM: General failure.
* -EFAULT: Invalid DCD_HMANAGER handle.
* Requires:
* DCD initialized.
* pObjUuid is non-NULL.
* pObjDef is non-NULL.
* Ensures:
*/
extern int dcd_get_object_def(IN struct dcd_manager *hdcd_mgr,
IN struct dsp_uuid *pObjUuid,
IN enum dsp_dcdobjtype obj_type,
OUT struct dcd_genericobj *pObjDef);
/*
* ======== dcd_get_objects ========
* Purpose:
* This function finds all DCD objects specified in a special
* COFF section called ".dcd_register", and for each object,
* call a "register" function. The "register" function may perform
* various actions, such as 1) register nodes in the node database, 2)
* unregister nodes from the node database, and 3) add overlay nodes.
* Parameters:
* hdcd_mgr: A DCD manager handle.
* pszCoffPath: Pointer to name of COFF file containing DCD
* objects.
* registerFxn: Callback fxn to be applied on each located
* DCD object.
* handle: Handle to pass to callback.
* Returns:
* 0: Success.
* -EACCES: Unable to access/read/parse/load content of object code
* section.
* -EFAULT: Invalid DCD_HMANAGER handle..
* Requires:
* DCD initialized.
* Ensures:
* Note:
* Due to the DCD database construction, it is essential for a DCD-enabled
* COFF file to contain the right COFF sections, especially
* ".dcd_register", which is used for auto registration.
*/
extern int dcd_get_objects(IN struct dcd_manager *hdcd_mgr,
IN char *pszCoffPath,
dcd_registerfxn registerFxn, void *handle);
/*
* ======== dcd_init ========
* Purpose:
* This function initializes DCD.
* Parameters:
* Returns:
* FALSE: Initialization failed.
* TRUE: Initialization succeeded.
* Requires:
* Ensures:
* DCD initialized.
*/
extern bool dcd_init(void);
/*
* ======== dcd_register_object ========
* Purpose:
* This function registers a DSP/BIOS Bridge object in the DCD database.
* Parameters:
* uuid_obj: Pointer to a dsp_uuid that identifies a DSP/BIOS
* Bridge object.
* obj_type: Type of object.
* psz_path_name: Path to the object's COFF file.
* Returns:
* 0: Success.
* -EPERM: Failed to register object.
* Requires:
* DCD initialized.
* uuid_obj and szPathName are non-NULL values.
* obj_type is a valid type value.
* Ensures:
*/
extern int dcd_register_object(IN struct dsp_uuid *uuid_obj,
IN enum dsp_dcdobjtype obj_type,
IN char *psz_path_name);
/*
* ======== dcd_unregister_object ========
* Purpose:
* This function de-registers a valid DSP/BIOS Bridge object from the DCD
* database.
* Parameters:
* uuid_obj: Pointer to a dsp_uuid that identifies a DSP/BIOS Bridge
* object.
* obj_type: Type of object.
* Returns:
* 0: Success.
* -EPERM: Unable to de-register the specified object.
* Requires:
* DCD initialized.
* uuid_obj is a non-NULL value.
* obj_type is a valid type value.
* Ensures:
*/
extern int dcd_unregister_object(IN struct dsp_uuid *uuid_obj,
IN enum dsp_dcdobjtype obj_type);
#endif /* _DBDCD_H */
/*
* dbdcddef.h
*
* DSP-BIOS Bridge driver support functions for TI OMAP processors.
*
* DCD (DSP/BIOS Bridge Configuration Database) constants and types.
*
* Copyright (C) 2008 Texas Instruments, Inc.
*
* This package is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
#ifndef DBDCDDEF_
#define DBDCDDEF_
#include <dspbridge/dbdefs.h>
#include <dspbridge/mgrpriv.h> /* for mgr_processorextinfo */
/*
* The following defines are critical elements for the DCD module:
*
* - DCD_REGKEY enables DCD functions to locate registered DCD objects.
* - DCD_REGISTER_SECTION identifies the COFF section where the UUID of
* registered DCD objects are stored.
*/
#define DCD_REGKEY "Software\\TexasInstruments\\DspBridge\\DCD"
#define DCD_REGISTER_SECTION ".dcd_register"
#define DCD_MAXPATHLENGTH 255
/* DCD Manager Object */
struct dcd_manager;
struct dcd_key_elem {
struct list_head link; /* Make it linked to a list */
char name[DCD_MAXPATHLENGTH]; /* Name of a given value entry */
char *path; /* Pointer to the actual data */
};
/* DCD Node Properties */
struct dcd_nodeprops {
struct dsp_ndbprops ndb_props;
u32 msg_segid;
u32 msg_notify_type;
char *pstr_create_phase_fxn;
char *pstr_delete_phase_fxn;
char *pstr_execute_phase_fxn;
char *pstr_i_alg_name;
/* Dynamic load properties */
u16 us_load_type; /* Static, dynamic, overlay */
u32 ul_data_mem_seg_mask; /* Data memory requirements */
u32 ul_code_mem_seg_mask; /* Code memory requirements */
};
/* DCD Generic Object Type */
struct dcd_genericobj {
union dcdObjUnion {
struct dcd_nodeprops node_obj; /* node object. */
/* processor object. */
struct dsp_processorinfo proc_info;
/* extended proc object (private) */
struct mgr_processorextinfo ext_proc_obj;
} obj_data;
};
/* DCD Internal Callback Type */
typedef int(*dcd_registerfxn) (IN struct dsp_uuid *uuid_obj,
IN enum dsp_dcdobjtype obj_type,
IN void *handle);
#endif /* DBDCDDEF_ */
/*
* dbdefs.h
*
* DSP-BIOS Bridge driver support functions for TI OMAP processors.
*
* Global definitions and constants for DSP/BIOS Bridge.
*
* Copyright (C) 2005-2006 Texas Instruments, Inc.
*
* This package is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
#ifndef DBDEFS_
#define DBDEFS_
#include <linux/types.h>
#include <dspbridge/dbtype.h> /* GPP side type definitions */
#include <dspbridge/std.h> /* DSP/BIOS type definitions */
#include <dspbridge/rms_sh.h> /* Types shared between GPP and DSP */
#define PG_SIZE4K 4096
#define PG_MASK(pg_size) (~((pg_size)-1))
#define PG_ALIGN_LOW(addr, pg_size) ((addr) & PG_MASK(pg_size))
#define PG_ALIGN_HIGH(addr, pg_size) (((addr)+(pg_size)-1) & PG_MASK(pg_size))
/* API return value and calling convention */
#define DBAPI int
/* Infinite time value for the utimeout parameter to DSPStream_Select() */
#define DSP_FOREVER (-1)
/* Maximum length of node name, used in dsp_ndbprops */
#define DSP_MAXNAMELEN 32
/* notify_type values for the RegisterNotify() functions. */
#define DSP_SIGNALEVENT 0x00000001
/* Types of events for processors */
#define DSP_PROCESSORSTATECHANGE 0x00000001
#define DSP_PROCESSORATTACH 0x00000002
#define DSP_PROCESSORDETACH 0x00000004
#define DSP_PROCESSORRESTART 0x00000008
/* DSP exception events (DSP/BIOS and DSP MMU fault) */
#define DSP_MMUFAULT 0x00000010
#define DSP_SYSERROR 0x00000020
#define DSP_EXCEPTIONABORT 0x00000300
#define DSP_PWRERROR 0x00000080
#define DSP_WDTOVERFLOW 0x00000040
/* IVA exception events (IVA MMU fault) */
#define IVA_MMUFAULT 0x00000040
/* Types of events for nodes */
#define DSP_NODESTATECHANGE 0x00000100
#define DSP_NODEMESSAGEREADY 0x00000200
/* Types of events for streams */
#define DSP_STREAMDONE 0x00001000
#define DSP_STREAMIOCOMPLETION 0x00002000
/* Handle definition representing the GPP node in DSPNode_Connect() calls */
#define DSP_HGPPNODE 0xFFFFFFFF
/* Node directions used in DSPNode_Connect() */
#define DSP_TONODE 1
#define DSP_FROMNODE 2
/* Define Node Minimum and Maximum Priorities */
#define DSP_NODE_MIN_PRIORITY 1
#define DSP_NODE_MAX_PRIORITY 15
/* Pre-Defined Message Command Codes available to user: */
#define DSP_RMSUSERCODESTART RMS_USER /* Start of RMS user cmd codes */
/* end of user codes */
#define DSP_RMSUSERCODEEND (RMS_USER + RMS_MAXUSERCODES);
/* msg_ctrl contains SM buffer description */
#define DSP_RMSBUFDESC RMS_BUFDESC
/* Shared memory identifier for MEM segment named "SHMSEG0" */
#define DSP_SHMSEG0 (u32)(-1)
/* Processor ID numbers */
#define DSP_UNIT 0
#define IVA_UNIT 1
#define DSPWORD unsigned char
#define DSPWORDSIZE sizeof(DSPWORD)
/* Success & Failure macros */
#define DSP_SUCCEEDED(Status) likely((s32)(Status) >= 0)
#define DSP_FAILED(Status) unlikely((s32)(Status) < 0)
/* Power control enumerations */
#define PROC_PWRCONTROL 0x8070
#define PROC_PWRMGT_ENABLE (PROC_PWRCONTROL + 0x3)
#define PROC_PWRMGT_DISABLE (PROC_PWRCONTROL + 0x4)
/* Bridge Code Version */
#define BRIDGE_VERSION_CODE 333
#define MAX_PROFILES 16
/* DSP chip type */
#define DSPTYPE64 0x99
/* Handy Macros */
#define IS_VALID_PROC_EVENT(x) (((x) == 0) || (((x) & \
(DSP_PROCESSORSTATECHANGE | \
DSP_PROCESSORATTACH | \
DSP_PROCESSORDETACH | \
DSP_PROCESSORRESTART | \
DSP_NODESTATECHANGE | \
DSP_STREAMDONE | \
DSP_STREAMIOCOMPLETION | \
DSP_MMUFAULT | \
DSP_SYSERROR | \
DSP_WDTOVERFLOW | \
DSP_PWRERROR)) && \
!((x) & ~(DSP_PROCESSORSTATECHANGE | \
DSP_PROCESSORATTACH | \
DSP_PROCESSORDETACH | \
DSP_PROCESSORRESTART | \
DSP_NODESTATECHANGE | \
DSP_STREAMDONE | \
DSP_STREAMIOCOMPLETION | \
DSP_MMUFAULT | \
DSP_SYSERROR | \
DSP_WDTOVERFLOW | \
DSP_PWRERROR))))
#define IS_VALID_NODE_EVENT(x) (((x) == 0) || \
(((x) & (DSP_NODESTATECHANGE | DSP_NODEMESSAGEREADY)) && \
!((x) & ~(DSP_NODESTATECHANGE | DSP_NODEMESSAGEREADY))))
#define IS_VALID_STRM_EVENT(x) (((x) == 0) || (((x) & (DSP_STREAMDONE | \
DSP_STREAMIOCOMPLETION)) && \
!((x) & ~(DSP_STREAMDONE | \
DSP_STREAMIOCOMPLETION))))
#define IS_VALID_NOTIFY_MASK(x) ((x) & DSP_SIGNALEVENT)
/* The Node UUID structure */
struct dsp_uuid {
u32 ul_data1;
u16 us_data2;
u16 us_data3;
u8 uc_data4;
u8 uc_data5;
u8 uc_data6[6];
};
/* DCD types */
enum dsp_dcdobjtype {
DSP_DCDNODETYPE,
DSP_DCDPROCESSORTYPE,
DSP_DCDLIBRARYTYPE,
DSP_DCDCREATELIBTYPE,
DSP_DCDEXECUTELIBTYPE,
DSP_DCDDELETELIBTYPE,
/* DSP_DCDMAXOBJTYPE is meant to be the last DCD object type */
DSP_DCDMAXOBJTYPE
};
/* Processor states */
enum dsp_procstate {
PROC_STOPPED,
PROC_LOADED,
PROC_RUNNING,
PROC_ERROR
};
/*
* Node types: Message node, task node, xDAIS socket node, and
* device node. _NODE_GPP is used when defining a stream connection
* between a task or socket node and the GPP.
*
*/
enum node_type {
NODE_DEVICE,
NODE_TASK,
NODE_DAISSOCKET,
NODE_MESSAGE,
NODE_GPP
};
/*
* ======== node_state ========
* Internal node states.
*/
enum node_state {
NODE_ALLOCATED,
NODE_CREATED,
NODE_RUNNING,
NODE_PAUSED,
NODE_DONE,
NODE_CREATING,
NODE_STARTING,
NODE_PAUSING,
NODE_TERMINATING,
NODE_DELETING,
};
/* Stream states */
enum dsp_streamstate {
STREAM_IDLE,
STREAM_READY,
STREAM_PENDING,
STREAM_DONE
};
/* Stream connect types */
enum dsp_connecttype {
CONNECTTYPE_NODEOUTPUT,
CONNECTTYPE_GPPOUTPUT,
CONNECTTYPE_NODEINPUT,
CONNECTTYPE_GPPINPUT
};
/* Stream mode types */
enum dsp_strmmode {
STRMMODE_PROCCOPY, /* Processor(s) copy stream data payloads */
STRMMODE_ZEROCOPY, /* Strm buffer ptrs swapped no data copied */
STRMMODE_LDMA, /* Local DMA : OMAP's System-DMA device */
STRMMODE_RDMA /* Remote DMA: OMAP's DSP-DMA device */
};
/* Resource Types */
enum dsp_resourceinfotype {
DSP_RESOURCE_DYNDARAM = 0,
DSP_RESOURCE_DYNSARAM,
DSP_RESOURCE_DYNEXTERNAL,
DSP_RESOURCE_DYNSRAM,
DSP_RESOURCE_PROCLOAD
};
/* Memory Segment Types */
enum dsp_memtype {
DSP_DYNDARAM = 0,
DSP_DYNSARAM,
DSP_DYNEXTERNAL,
DSP_DYNSRAM
};
/* Memory Flush Types */
enum dsp_flushtype {
PROC_INVALIDATE_MEM = 0,
PROC_WRITEBACK_MEM,
PROC_WRITEBACK_INVALIDATE_MEM,
};
/* Memory Segment Status Values */
struct dsp_memstat {
u32 ul_size;
u32 ul_total_free_size;
u32 ul_len_max_free_block;
u32 ul_num_free_blocks;
u32 ul_num_alloc_blocks;
};
/* Processor Load information Values */
struct dsp_procloadstat {
u32 curr_load;
u32 predicted_load;
u32 curr_dsp_freq;
u32 predicted_freq;
};
/* Attributes for STRM connections between nodes */
struct dsp_strmattr {
u32 seg_id; /* Memory segment on DSP to allocate buffers */
u32 buf_size; /* Buffer size (DSP words) */
u32 num_bufs; /* Number of buffers */
u32 buf_alignment; /* Buffer alignment */
u32 utimeout; /* Timeout for blocking STRM calls */
enum dsp_strmmode strm_mode; /* mode of stream when opened */
/* DMA chnl id if dsp_strmmode is LDMA or RDMA */
u32 udma_chnl_id;
u32 udma_priority; /* DMA channel priority 0=lowest, >0=high */
};
/* The dsp_cbdata structure */
struct dsp_cbdata {
u32 cb_data;
u8 node_data[1];
};
/* The dsp_msg structure */
struct dsp_msg {
u32 dw_cmd;
u32 dw_arg1;
u32 dw_arg2;
};
/* The dsp_resourcereqmts structure for node's resource requirements */
struct dsp_resourcereqmts {
u32 cb_struct;
u32 static_data_size;
u32 global_data_size;
u32 program_mem_size;
u32 uwc_execution_time;
u32 uwc_period;
u32 uwc_deadline;
u32 avg_exection_time;
u32 minimum_period;
};
/*
* The dsp_streamconnect structure describes a stream connection
* between two nodes, or between a node and the GPP
*/
struct dsp_streamconnect {
u32 cb_struct;
enum dsp_connecttype connect_type;
u32 this_node_stream_index;
void *connected_node;
struct dsp_uuid ui_connected_node_id;
u32 connected_node_stream_index;
};
struct dsp_nodeprofs {
u32 ul_heap_size;
};
/* The dsp_ndbprops structure reports the attributes of a node */
struct dsp_ndbprops {
u32 cb_struct;
struct dsp_uuid ui_node_id;
char ac_name[DSP_MAXNAMELEN];
enum node_type ntype;
u32 cache_on_gpp;
struct dsp_resourcereqmts dsp_resource_reqmts;
s32 prio;
u32 stack_size;
u32 sys_stack_size;
u32 stack_seg;
u32 message_depth;
u32 num_input_streams;
u32 num_output_streams;
u32 utimeout;
u32 count_profiles; /* Number of supported profiles */
/* Array of profiles */
struct dsp_nodeprofs node_profiles[MAX_PROFILES];
u32 stack_seg_name; /* Stack Segment Name */
};
/* The dsp_nodeattrin structure describes the attributes of a
* node client */
struct dsp_nodeattrin {
u32 cb_struct;
s32 prio;
u32 utimeout;
u32 profile_id;
/* Reserved, for Bridge Internal use only */
u32 heap_size;
void *pgpp_virt_addr; /* Reserved, for Bridge Internal use only */
};
/* The dsp_nodeinfo structure is used to retrieve information
* about a node */
struct dsp_nodeinfo {
u32 cb_struct;
struct dsp_ndbprops nb_node_database_props;
u32 execution_priority;
enum node_state ns_execution_state;
void *device_owner;
u32 number_streams;
struct dsp_streamconnect sc_stream_connection[16];
u32 node_env;
};
/* The dsp_nodeattr structure describes the attributes of a node */
struct dsp_nodeattr {
u32 cb_struct;
struct dsp_nodeattrin in_node_attr_in;
u32 node_attr_inputs;
u32 node_attr_outputs;
struct dsp_nodeinfo node_info;
};
/*
* Notification type: either the name of an opened event, or an event or
* window handle.
*/
struct dsp_notification {
char *ps_name;
void *handle;
};
/* The dsp_processorattrin structure describes the attributes of a processor */
struct dsp_processorattrin {
u32 cb_struct;
u32 utimeout;
};
/*
* The dsp_processorinfo structure describes basic capabilities of a
* DSP processor
*/
struct dsp_processorinfo {
u32 cb_struct;
int processor_family;
int processor_type;
u32 clock_rate;
u32 ul_internal_mem_size;
u32 ul_external_mem_size;
u32 processor_id;
int ty_running_rtos;
s32 node_min_priority;
s32 node_max_priority;
};
/* Error information of last DSP exception signalled to the GPP */
struct dsp_errorinfo {
u32 dw_err_mask;
u32 dw_val1;
u32 dw_val2;
u32 dw_val3;
};
/* The dsp_processorstate structure describes the state of a DSP processor */
struct dsp_processorstate {
u32 cb_struct;
enum dsp_procstate proc_state;
struct dsp_errorinfo err_info;
};
/*
* The dsp_resourceinfo structure is used to retrieve information about a
* processor's resources
*/
struct dsp_resourceinfo {
u32 cb_struct;
enum dsp_resourceinfotype resource_type;
union {
u32 ul_resource;
struct dsp_memstat mem_stat;
struct dsp_procloadstat proc_load_stat;
} result;
};
/*
* The dsp_streamattrin structure describes the attributes of a stream,
* including segment and alignment of data buffers allocated with
* DSPStream_AllocateBuffers(), if applicable
*/
struct dsp_streamattrin {
u32 cb_struct;
u32 utimeout;
u32 segment_id;
u32 buf_alignment;
u32 num_bufs;
enum dsp_strmmode strm_mode;
u32 udma_chnl_id;
u32 udma_priority;
};
/* The dsp_bufferattr structure describes the attributes of a data buffer */
struct dsp_bufferattr {
u32 cb_struct;
u32 segment_id;
u32 buf_alignment;
};
/*
* The dsp_streaminfo structure is used to retrieve information
* about a stream.
*/
struct dsp_streaminfo {
u32 cb_struct;
u32 number_bufs_allowed;
u32 number_bufs_in_stream;
u32 ul_number_bytes;
void *sync_object_handle;
enum dsp_streamstate ss_stream_state;
};
/* DMM MAP attributes
It is a bit mask with each bit value indicating a specific attribute
bit 0 - GPP address type (user virtual=0, physical=1)
bit 1 - MMU Endianism (Big Endian=1, Little Endian=0)
bit 2 - MMU mixed page attribute (Mixed/ CPUES=1, TLBES =0)
bit 3 - MMU element size = 8bit (valid only for non mixed page entries)
bit 4 - MMU element size = 16bit (valid only for non mixed page entries)
bit 5 - MMU element size = 32bit (valid only for non mixed page entries)
bit 6 - MMU element size = 64bit (valid only for non mixed page entries)
bit 14 - Input (read only) buffer
bit 15 - Output (writeable) buffer
*/
/* Types of mapping attributes */
/* MPU address is virtual and needs to be translated to physical addr */
#define DSP_MAPVIRTUALADDR 0x00000000
#define DSP_MAPPHYSICALADDR 0x00000001
/* Mapped data is big endian */
#define DSP_MAPBIGENDIAN 0x00000002
#define DSP_MAPLITTLEENDIAN 0x00000000
/* Element size is based on DSP r/w access size */
#define DSP_MAPMIXEDELEMSIZE 0x00000004
/*
* Element size for MMU mapping (8, 16, 32, or 64 bit)
* Ignored if DSP_MAPMIXEDELEMSIZE enabled
*/
#define DSP_MAPELEMSIZE8 0x00000008
#define DSP_MAPELEMSIZE16 0x00000010
#define DSP_MAPELEMSIZE32 0x00000020
#define DSP_MAPELEMSIZE64 0x00000040
#define DSP_MAPVMALLOCADDR 0x00000080
#define DSP_MAPDONOTLOCK 0x00000100
#define DSP_MAP_DIR_MASK 0x3FFF
#define GEM_CACHE_LINE_SIZE 128
#define GEM_L1P_PREFETCH_SIZE 128
/*
* Definitions from dbreg.h
*/
#define DSPPROCTYPE_C64 6410
#define IVAPROCTYPE_ARM7 470
#define REG_MGR_OBJECT 1
#define REG_DRV_OBJECT 2
/* registry */
#define DRVOBJECT "DrvObject"
#define MGROBJECT "MgrObject"
/* Max registry path length. Also the max registry value length. */
#define MAXREGPATHLENGTH 255
#endif /* DBDEFS_ */
/*
* dbldefs.h
*
* DSP-BIOS Bridge driver support functions for TI OMAP processors.
*
* Copyright (C) 2005-2006 Texas Instruments, Inc.
*
* This package is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
#ifndef DBLDEFS_
#define DBLDEFS_
/*
* Bit masks for dbl_flags.
*/
#define DBL_NOLOAD 0x0 /* Don't load symbols, code, or data */
#define DBL_SYMB 0x1 /* load symbols */
#define DBL_CODE 0x2 /* load code */
#define DBL_DATA 0x4 /* load data */
#define DBL_DYNAMIC 0x8 /* dynamic load */
#define DBL_BSS 0x20 /* Unitialized section */
#define DBL_MAXPATHLENGTH 255
/*
* ======== dbl_flags ========
* Specifies whether to load code, data, or symbols
*/
typedef s32 dbl_flags;
/*
* ======== dbl_sect_info ========
* For collecting info on overlay sections
*/
struct dbl_sect_info {
const char *name; /* name of section */
u32 sect_run_addr; /* run address of section */
u32 sect_load_addr; /* load address of section */
u32 size; /* size of section (target MAUs) */
dbl_flags type; /* Code, data, or BSS */
};
/*
* ======== dbl_symbol ========
* (Needed for dynamic load library)
*/
struct dbl_symbol {
u32 value;
};
/*
* ======== dbl_alloc_fxn ========
* Allocate memory function. Allocate or reserve (if reserved == TRUE)
* "size" bytes of memory from segment "space" and return the address in
* *dspAddr (or starting at *dspAddr if reserve == TRUE). Returns 0 on
* success, or an error code on failure.
*/
typedef s32(*dbl_alloc_fxn) (void *hdl, s32 space, u32 size, u32 align,
u32 *dspAddr, s32 seg_id, s32 req, bool reserved);
/*
* ======== dbl_free_fxn ========
* Free memory function. Free, or unreserve (if reserved == TRUE) "size"
* bytes of memory from segment "space"
*/
typedef bool(*dbl_free_fxn) (void *hdl, u32 addr, s32 space, u32 size,
bool reserved);
/*
* ======== dbl_log_write_fxn ========
* Function to call when writing data from a section, to log the info.
* Can be NULL if no logging is required.
*/
typedef int(*dbl_log_write_fxn) (void *handle,
struct dbl_sect_info *sect, u32 addr,
u32 bytes);
/*
* ======== dbl_sym_lookup ========
* Symbol lookup function - Find the symbol name and return its value.
*
* Parameters:
* handle - Opaque handle
* parg - Opaque argument.
* name - Name of symbol to lookup.
* sym - Location to store address of symbol structure.
*
* Returns:
* TRUE: Success (symbol was found).
* FALSE: Failed to find symbol.
*/
typedef bool(*dbl_sym_lookup) (void *handle, void *parg, void *rmm_handle,
const char *name, struct dbl_symbol ** sym);
/*
* ======== dbl_write_fxn ========
* Write memory function. Write "n" HOST bytes of memory to segment "mtype"
* starting at address "dspAddr" from the buffer "buf". The buffer is
* formatted as an array of words appropriate for the DSP.
*/
typedef s32(*dbl_write_fxn) (void *hdl, u32 dspAddr, void *buf,
u32 n, s32 mtype);
/*
* ======== dbl_attrs ========
*/
struct dbl_attrs {
dbl_alloc_fxn alloc;
dbl_free_fxn free;
void *rmm_handle; /* Handle to pass to alloc, free functions */
dbl_write_fxn write;
void *input_params; /* Handle to pass to write, cinit function */
dbl_log_write_fxn log_write;
void *log_write_handle;
/* Symbol matching function and handle to pass to it */
dbl_sym_lookup sym_lookup;
void *sym_handle;
void *sym_arg;
/*
* These file manipulation functions should be compatible with the
* "C" run time library functions of the same name.
*/
s32(*fread) (void *, size_t, size_t, void *);
s32(*fseek) (void *, long, int);
s32(*ftell) (void *);
s32(*fclose) (void *);
void *(*fopen) (const char *, const char *);
};
#endif /* DBLDEFS_ */
/*
* dbll.h
*
* DSP-BIOS Bridge driver support functions for TI OMAP processors.
*
* DSP/BIOS Bridge Dynamic load library module interface. Function header
* comments are in the file dblldefs.h.
*
* Copyright (C) 2005-2006 Texas Instruments, Inc.
*
* This package is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
#ifndef DBLL_
#define DBLL_
#include <dspbridge/dbdefs.h>
#include <dspbridge/dblldefs.h>
extern bool symbols_reloaded;
extern void dbll_close(struct dbll_library_obj *lib);
extern int dbll_create(struct dbll_tar_obj **target_obj,
struct dbll_attrs *pattrs);
extern void dbll_delete(struct dbll_tar_obj *target);
extern void dbll_exit(void);
extern bool dbll_get_addr(struct dbll_library_obj *lib, char *name,
struct dbll_sym_val **ppSym);
extern void dbll_get_attrs(struct dbll_tar_obj *target,
struct dbll_attrs *pattrs);
extern bool dbll_get_c_addr(struct dbll_library_obj *lib, char *name,
struct dbll_sym_val **ppSym);
extern int dbll_get_sect(struct dbll_library_obj *lib, char *name,
u32 *paddr, u32 *psize);
extern bool dbll_init(void);
extern int dbll_load(struct dbll_library_obj *lib,
dbll_flags flags,
struct dbll_attrs *attrs, u32 * pEntry);
extern int dbll_load_sect(struct dbll_library_obj *lib,
char *sectName, struct dbll_attrs *attrs);
extern int dbll_open(struct dbll_tar_obj *target, char *file,
dbll_flags flags, struct dbll_library_obj **pLib);
extern int dbll_read_sect(struct dbll_library_obj *lib,
char *name, char *pbuf, u32 size);
extern void dbll_set_attrs(struct dbll_tar_obj *target,
struct dbll_attrs *pattrs);
extern void dbll_unload(struct dbll_library_obj *lib, struct dbll_attrs *attrs);
extern int dbll_unload_sect(struct dbll_library_obj *lib,
char *sectName, struct dbll_attrs *attrs);
bool dbll_find_dsp_symbol(struct dbll_library_obj *zl_lib, u32 address,
u32 offset_range, u32 *sym_addr_output, char *name_output);
#endif /* DBLL_ */
/*
* dblldefs.h
*
* DSP-BIOS Bridge driver support functions for TI OMAP processors.
*
* Copyright (C) 2005-2006 Texas Instruments, Inc.
*
* This package is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
#ifndef DBLLDEFS_
#define DBLLDEFS_
/*
* Bit masks for dbl_flags.
*/
#define DBLL_NOLOAD 0x0 /* Don't load symbols, code, or data */
#define DBLL_SYMB 0x1 /* load symbols */
#define DBLL_CODE 0x2 /* load code */
#define DBLL_DATA 0x4 /* load data */
#define DBLL_DYNAMIC 0x8 /* dynamic load */
#define DBLL_BSS 0x20 /* Unitialized section */
#define DBLL_MAXPATHLENGTH 255
/*
* ======== DBLL_Target ========
*
*/
struct dbll_tar_obj;
/*
* ======== dbll_flags ========
* Specifies whether to load code, data, or symbols
*/
typedef s32 dbll_flags;
/*
* ======== DBLL_Library ========
*
*/
struct dbll_library_obj;
/*
* ======== dbll_sect_info ========
* For collecting info on overlay sections
*/
struct dbll_sect_info {
const char *name; /* name of section */
u32 sect_run_addr; /* run address of section */
u32 sect_load_addr; /* load address of section */
u32 size; /* size of section (target MAUs) */
dbll_flags type; /* Code, data, or BSS */
};
/*
* ======== dbll_sym_val ========
* (Needed for dynamic load library)
*/
struct dbll_sym_val {
u32 value;
};
/*
* ======== dbll_alloc_fxn ========
* Allocate memory function. Allocate or reserve (if reserved == TRUE)
* "size" bytes of memory from segment "space" and return the address in
* *dspAddr (or starting at *dspAddr if reserve == TRUE). Returns 0 on
* success, or an error code on failure.
*/
typedef s32(*dbll_alloc_fxn) (void *hdl, s32 space, u32 size, u32 align,
u32 *dspAddr, s32 seg_id, s32 req,
bool reserved);
/*
* ======== dbll_close_fxn ========
*/
typedef s32(*dbll_f_close_fxn) (void *);
/*
* ======== dbll_free_fxn ========
* Free memory function. Free, or unreserve (if reserved == TRUE) "size"
* bytes of memory from segment "space"
*/
typedef bool(*dbll_free_fxn) (void *hdl, u32 addr, s32 space, u32 size,
bool reserved);
/*
* ======== dbll_f_open_fxn ========
*/
typedef void *(*dbll_f_open_fxn) (const char *, const char *);
/*
* ======== dbll_log_write_fxn ========
* Function to call when writing data from a section, to log the info.
* Can be NULL if no logging is required.
*/
typedef int(*dbll_log_write_fxn) (void *handle,
struct dbll_sect_info *sect, u32 addr,
u32 bytes);
/*
* ======== dbll_read_fxn ========
*/
typedef s32(*dbll_read_fxn) (void *, size_t, size_t, void *);
/*
* ======== dbll_seek_fxn ========
*/
typedef s32(*dbll_seek_fxn) (void *, long, int);
/*
* ======== dbll_sym_lookup ========
* Symbol lookup function - Find the symbol name and return its value.
*
* Parameters:
* handle - Opaque handle
* parg - Opaque argument.
* name - Name of symbol to lookup.
* sym - Location to store address of symbol structure.
*
* Returns:
* TRUE: Success (symbol was found).
* FALSE: Failed to find symbol.
*/
typedef bool(*dbll_sym_lookup) (void *handle, void *parg, void *rmm_handle,
const char *name, struct dbll_sym_val ** sym);
/*
* ======== dbll_tell_fxn ========
*/
typedef s32(*dbll_tell_fxn) (void *);
/*
* ======== dbll_write_fxn ========
* Write memory function. Write "n" HOST bytes of memory to segment "mtype"
* starting at address "dspAddr" from the buffer "buf". The buffer is
* formatted as an array of words appropriate for the DSP.
*/
typedef s32(*dbll_write_fxn) (void *hdl, u32 dspAddr, void *buf,
u32 n, s32 mtype);
/*
* ======== dbll_attrs ========
*/
struct dbll_attrs {
dbll_alloc_fxn alloc;
dbll_free_fxn free;
void *rmm_handle; /* Handle to pass to alloc, free functions */
dbll_write_fxn write;
void *input_params; /* Handle to pass to write, cinit function */
bool base_image;
dbll_log_write_fxn log_write;
void *log_write_handle;
/* Symbol matching function and handle to pass to it */
dbll_sym_lookup sym_lookup;
void *sym_handle;
void *sym_arg;
/*
* These file manipulation functions should be compatible with the
* "C" run time library functions of the same name.
*/
s32(*fread) (void *, size_t, size_t, void *);
s32(*fseek) (void *, long, int);
s32(*ftell) (void *);
s32(*fclose) (void *);
void *(*fopen) (const char *, const char *);
};
/*
* ======== dbll_close ========
* Close library opened with dbll_open.
* Parameters:
* lib - Handle returned from dbll_open().
* Returns:
* Requires:
* DBL initialized.
* Valid lib.
* Ensures:
*/
typedef void (*dbll_close_fxn) (struct dbll_library_obj *library);
/*
* ======== dbll_create ========
* Create a target object, specifying the alloc, free, and write functions.
* Parameters:
* target_obj - Location to store target handle on output.
* pattrs - Attributes.
* Returns:
* 0: Success.
* -ENOMEM: Memory allocation failed.
* Requires:
* DBL initialized.
* pattrs != NULL.
* target_obj != NULL;
* Ensures:
* Success: *target_obj != NULL.
* Failure: *target_obj == NULL.
*/
typedef int(*dbll_create_fxn) (struct dbll_tar_obj **target_obj,
struct dbll_attrs *attrs);
/*
* ======== dbll_delete ========
* Delete target object and free resources for any loaded libraries.
* Parameters:
* target - Handle returned from DBLL_Create().
* Returns:
* Requires:
* DBL initialized.
* Valid target.
* Ensures:
*/
typedef void (*dbll_delete_fxn) (struct dbll_tar_obj *target);
/*
* ======== dbll_exit ========
* Discontinue use of DBL module.
* Parameters:
* Returns:
* Requires:
* refs > 0.
* Ensures:
* refs >= 0.
*/
typedef void (*dbll_exit_fxn) (void);
/*
* ======== dbll_get_addr ========
* Get address of name in the specified library.
* Parameters:
* lib - Handle returned from dbll_open().
* name - Name of symbol
* ppSym - Location to store symbol address on output.
* Returns:
* TRUE: Success.
* FALSE: Symbol not found.
* Requires:
* DBL initialized.
* Valid library.
* name != NULL.
* ppSym != NULL.
* Ensures:
*/
typedef bool(*dbll_get_addr_fxn) (struct dbll_library_obj *lib, char *name,
struct dbll_sym_val **ppSym);
/*
* ======== dbll_get_attrs ========
* Retrieve the attributes of the target.
* Parameters:
* target - Handle returned from DBLL_Create().
* pattrs - Location to store attributes on output.
* Returns:
* Requires:
* DBL initialized.
* Valid target.
* pattrs != NULL.
* Ensures:
*/
typedef void (*dbll_get_attrs_fxn) (struct dbll_tar_obj *target,
struct dbll_attrs *attrs);
/*
* ======== dbll_get_c_addr ========
* Get address of "C" name on the specified library.
* Parameters:
* lib - Handle returned from dbll_open().
* name - Name of symbol
* ppSym - Location to store symbol address on output.
* Returns:
* TRUE: Success.
* FALSE: Symbol not found.
* Requires:
* DBL initialized.
* Valid target.
* name != NULL.
* ppSym != NULL.
* Ensures:
*/
typedef bool(*dbll_get_c_addr_fxn) (struct dbll_library_obj *lib, char *name,
struct dbll_sym_val **ppSym);
/*
* ======== dbll_get_sect ========
* Get address and size of a named section.
* Parameters:
* lib - Library handle returned from dbll_open().
* name - Name of section.
* paddr - Location to store section address on output.
* psize - Location to store section size on output.
* Returns:
* 0: Success.
* -ENXIO: Section not found.
* Requires:
* DBL initialized.
* Valid lib.
* name != NULL.
* paddr != NULL;
* psize != NULL.
* Ensures:
*/
typedef int(*dbll_get_sect_fxn) (struct dbll_library_obj *lib,
char *name, u32 * addr, u32 * size);
/*
* ======== dbll_init ========
* Initialize DBL module.
* Parameters:
* Returns:
* TRUE: Success.
* FALSE: Failure.
* Requires:
* refs >= 0.
* Ensures:
* Success: refs > 0.
* Failure: refs >= 0.
*/
typedef bool(*dbll_init_fxn) (void);
/*
* ======== dbll_load ========
* Load library onto the target.
*
* Parameters:
* lib - Library handle returned from dbll_open().
* flags - Load code, data and/or symbols.
* attrs - May contain alloc, free, and write function.
* pulEntry - Location to store program entry on output.
* Returns:
* 0: Success.
* -EBADF: File read failed.
* -EILSEQ: Failure in dynamic loader library.
* Requires:
* DBL initialized.
* Valid lib.
* pEntry != NULL.
* Ensures:
*/
typedef int(*dbll_load_fxn) (struct dbll_library_obj *lib,
dbll_flags flags,
struct dbll_attrs *attrs, u32 *entry);
/*
* ======== dbll_load_sect ========
* Load a named section from an library (for overlay support).
* Parameters:
* lib - Handle returned from dbll_open().
* sectName - Name of section to load.
* attrs - Contains write function and handle to pass to it.
* Returns:
* 0: Success.
* -ENXIO: Section not found.
* -ENOSYS: Function not implemented.
* Requires:
* Valid lib.
* sectName != NULL.
* attrs != NULL.
* attrs->write != NULL.
* Ensures:
*/
typedef int(*dbll_load_sect_fxn) (struct dbll_library_obj *lib,
char *pszSectName,
struct dbll_attrs *attrs);
/*
* ======== dbll_open ========
* dbll_open() returns a library handle that can be used to load/unload
* the symbols/code/data via dbll_load()/dbll_unload().
* Parameters:
* target - Handle returned from dbll_create().
* file - Name of file to open.
* flags - If flags & DBLL_SYMB, load symbols.
* pLib - Location to store library handle on output.
* Returns:
* 0: Success.
* -ENOMEM: Memory allocation failure.
* -EBADF: File open/read failure.
* Unable to determine target type.
* Requires:
* DBL initialized.
* Valid target.
* file != NULL.
* pLib != NULL.
* dbll_attrs fopen function non-NULL.
* Ensures:
* Success: Valid *pLib.
* Failure: *pLib == NULL.
*/
typedef int(*dbll_open_fxn) (struct dbll_tar_obj *target, char *file,
dbll_flags flags,
struct dbll_library_obj **pLib);
/*
* ======== dbll_read_sect ========
* Read COFF section into a character buffer.
* Parameters:
* lib - Library handle returned from dbll_open().
* name - Name of section.
* pbuf - Buffer to write section contents into.
* size - Buffer size
* Returns:
* 0: Success.
* -ENXIO: Named section does not exists.
* Requires:
* DBL initialized.
* Valid lib.
* name != NULL.
* pbuf != NULL.
* size != 0.
* Ensures:
*/
typedef int(*dbll_read_sect_fxn) (struct dbll_library_obj *lib,
char *name, char *content,
u32 uContentSize);
/*
* ======== dbll_set_attrs ========
* Set the attributes of the target.
* Parameters:
* target - Handle returned from dbll_create().
* pattrs - New attributes.
* Returns:
* Requires:
* DBL initialized.
* Valid target.
* pattrs != NULL.
* Ensures:
*/
typedef void (*dbll_set_attrs_fxn) (struct dbll_tar_obj *target,
struct dbll_attrs *attrs);
/*
* ======== dbll_unload ========
* Unload library loaded with dbll_load().
* Parameters:
* lib - Handle returned from dbll_open().
* attrs - Contains free() function and handle to pass to it.
* Returns:
* Requires:
* DBL initialized.
* Valid lib.
* Ensures:
*/
typedef void (*dbll_unload_fxn) (struct dbll_library_obj *library,
struct dbll_attrs *attrs);
/*
* ======== dbll_unload_sect ========
* Unload a named section from an library (for overlay support).
* Parameters:
* lib - Handle returned from dbll_open().
* sectName - Name of section to load.
* attrs - Contains free() function and handle to pass to it.
* Returns:
* 0: Success.
* -ENXIO: Named section not found.
* -ENOSYS
* Requires:
* DBL initialized.
* Valid lib.
* sectName != NULL.
* Ensures:
*/
typedef int(*dbll_unload_sect_fxn) (struct dbll_library_obj *lib,
char *pszSectName,
struct dbll_attrs *attrs);
struct dbll_fxns {
dbll_close_fxn close_fxn;
dbll_create_fxn create_fxn;
dbll_delete_fxn delete_fxn;
dbll_exit_fxn exit_fxn;
dbll_get_attrs_fxn get_attrs_fxn;
dbll_get_addr_fxn get_addr_fxn;
dbll_get_c_addr_fxn get_c_addr_fxn;
dbll_get_sect_fxn get_sect_fxn;
dbll_init_fxn init_fxn;
dbll_load_fxn load_fxn;
dbll_load_sect_fxn load_sect_fxn;
dbll_open_fxn open_fxn;
dbll_read_sect_fxn read_sect_fxn;
dbll_set_attrs_fxn set_attrs_fxn;
dbll_unload_fxn unload_fxn;
dbll_unload_sect_fxn unload_sect_fxn;
};
#endif /* DBLDEFS_ */
/*
* dbtype.h
*
* DSP-BIOS Bridge driver support functions for TI OMAP processors.
*
* This header defines data types for DSP/BIOS Bridge APIs and device
* driver modules. It also defines the Hungarian prefix to use for each
* base type.
*
* Copyright (C) 2008 Texas Instruments, Inc.
*
* This package is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
#ifndef DBTYPE_
#define DBTYPE_
/*===========================================================================*/
/* Argument specification syntax */
/*===========================================================================*/
#ifndef IN
#define IN /* Following parameter is for input. */
#endif
#ifndef OUT
#define OUT /* Following parameter is for output. */
#endif
#ifndef OPTIONAL
#define OPTIONAL /* Function may optionally use previous parameter. */
#endif
#ifndef CONST
#define CONST const
#endif
/*===========================================================================*/
/* Boolean constants */
/*===========================================================================*/
#ifndef FALSE
#define FALSE 0
#endif
#ifndef TRUE
#define TRUE 1
#endif
/*===========================================================================*/
/* NULL (Definition is language specific) */
/*===========================================================================*/
#ifndef NULL
#define NULL ((void *)0) /* Null pointer. */
#endif
/*===========================================================================*/
/* NULL character (normally used for string termination) */
/*===========================================================================*/
#ifndef NULL_CHAR
#define NULL_CHAR '\0' /* Null character. */
#endif
/*===========================================================================*/
/* Basic Type definitions (with Prefixes for Hungarian notation) */
/*===========================================================================*/
#ifndef OMAPBRIDGE_TYPES
#define OMAPBRIDGE_TYPES
typedef volatile unsigned short reg_uword16;
#endif
#define TEXT(x) x
#define DLLIMPORT
#define DLLEXPORT
/* Define DSPAPIDLL correctly in dspapi.h */
#define _DSPSYSDLL32_
#endif /* DBTYPE_ */
/*
* dehdefs.h
*
* DSP-BIOS Bridge driver support functions for TI OMAP processors.
*
* Definition for Bridge driver module DEH.
*
* Copyright (C) 2005-2006 Texas Instruments, Inc.
*
* This package is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
#ifndef DEHDEFS_
#define DEHDEFS_
#include <dspbridge/mbx_sh.h> /* shared mailbox codes */
/* DEH object manager */
struct deh_mgr;
/* Magic code used to determine if DSP signaled exception. */
#define DEH_BASE MBX_DEH_BASE
#define DEH_USERS_BASE MBX_DEH_USERS_BASE
#define DEH_LIMIT MBX_DEH_LIMIT
#endif /* _DEHDEFS_H */
此差异已折叠。
/*
* devdefs.h
*
* DSP-BIOS Bridge driver support functions for TI OMAP processors.
*
* Definition of common include typedef between dspdefs.h and dev.h. Required
* to break circular dependency between Bridge driver and DEV include files.
*
* Copyright (C) 2008 Texas Instruments, Inc.
*
* This package is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
#ifndef DEVDEFS_
#define DEVDEFS_
/* Bridge Device Object */
struct dev_object;
#endif /* DEVDEFS_ */
/*
* disp.h
*
* DSP-BIOS Bridge driver support functions for TI OMAP processors.
*
* DSP/BIOS Bridge Node Dispatcher.
*
* Copyright (C) 2005-2006 Texas Instruments, Inc.
*
* This package is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
#ifndef DISP_
#define DISP_
#include <dspbridge/dbdefs.h>
#include <dspbridge/nodedefs.h>
#include <dspbridge/nodepriv.h>
#include <dspbridge/dispdefs.h>
/*
* ======== disp_create ========
* Create a NODE Dispatcher object. This object handles the creation,
* deletion, and execution of nodes on the DSP target, through communication
* with the Resource Manager Server running on the target. Each NODE
* Manager object should have exactly one NODE Dispatcher.
*
* Parameters:
* phDispObject: Location to store node dispatcher object on output.
* hdev_obj: Device for this processor.
* pDispAttrs: Node dispatcher attributes.
* Returns:
* 0: Success;
* -ENOMEM: Insufficient memory for requested resources.
* -EPERM: Unable to create dispatcher.
* Requires:
* disp_init(void) called.
* pDispAttrs != NULL.
* hdev_obj != NULL.
* phDispObject != NULL.
* Ensures:
* 0: IS_VALID(*phDispObject).
* error: *phDispObject == NULL.
*/
extern int disp_create(OUT struct disp_object **phDispObject,
struct dev_object *hdev_obj,
IN CONST struct disp_attr *pDispAttrs);
/*
* ======== disp_delete ========
* Delete the NODE Dispatcher.
*
* Parameters:
* hDispObject: Node Dispatcher object.
* Returns:
* Requires:
* disp_init(void) called.
* Valid hDispObject.
* Ensures:
* hDispObject is invalid.
*/
extern void disp_delete(struct disp_object *hDispObject);
/*
* ======== disp_exit ========
* Discontinue usage of DISP module.
*
* Parameters:
* Returns:
* Requires:
* disp_init(void) previously called.
* Ensures:
* Any resources acquired in disp_init(void) will be freed when last DISP
* client calls disp_exit(void).
*/
extern void disp_exit(void);
/*
* ======== disp_init ========
* Initialize the DISP module.
*
* Parameters:
* Returns:
* TRUE if initialization succeeded, FALSE otherwise.
* Ensures:
*/
extern bool disp_init(void);
/*
* ======== disp_node_change_priority ========
* Change the priority of a node currently running on the target.
*
* Parameters:
* hDispObject: Node Dispatcher object.
* hnode: Node object representing a node currently
* allocated or running on the DSP.
* ulFxnAddress: Address of RMS function for changing priority.
* node_env: Address of node's environment structure.
* prio: New priority level to set node's priority to.
* Returns:
* 0: Success.
* -ETIME: A timeout occurred before the DSP responded.
* Requires:
* disp_init(void) called.
* Valid hDispObject.
* hnode != NULL.
* Ensures:
*/
extern int disp_node_change_priority(struct disp_object
*hDispObject,
struct node_object *hnode,
u32 ul_fxn_addr,
nodeenv node_env, s32 prio);
/*
* ======== disp_node_create ========
* Create a node on the DSP by remotely calling the node's create function.
*
* Parameters:
* hDispObject: Node Dispatcher object.
* hnode: Node handle obtained from node_allocate().
* ul_fxn_addr: Address or RMS create node function.
* ul_create_fxn: Address of node's create function.
* pargs: Arguments to pass to RMS node create function.
* pNodeEnv: Location to store node environment pointer on
* output.
* Returns:
* 0: Success.
* -ETIME: A timeout occurred before the DSP responded.
* -EPERM: A failure occurred, unable to create node.
* Requires:
* disp_init(void) called.
* Valid hDispObject.
* pargs != NULL.
* hnode != NULL.
* pNodeEnv != NULL.
* node_get_type(hnode) != NODE_DEVICE.
* Ensures:
*/
extern int disp_node_create(struct disp_object *hDispObject,
struct node_object *hnode,
u32 ul_fxn_addr,
u32 ul_create_fxn,
IN CONST struct node_createargs
*pargs, OUT nodeenv *pNodeEnv);
/*
* ======== disp_node_delete ========
* Delete a node on the DSP by remotely calling the node's delete function.
*
* Parameters:
* hDispObject: Node Dispatcher object.
* hnode: Node object representing a node currently
* loaded on the DSP.
* ul_fxn_addr: Address or RMS delete node function.
* ul_delete_fxn: Address of node's delete function.
* node_env: Address of node's environment structure.
* Returns:
* 0: Success.
* -ETIME: A timeout occurred before the DSP responded.
* Requires:
* disp_init(void) called.
* Valid hDispObject.
* hnode != NULL.
* Ensures:
*/
extern int disp_node_delete(struct disp_object *hDispObject,
struct node_object *hnode,
u32 ul_fxn_addr,
u32 ul_delete_fxn, nodeenv node_env);
/*
* ======== disp_node_run ========
* Start execution of a node's execute phase, or resume execution of a node
* that has been suspended (via DISP_NodePause()) on the DSP.
*
* Parameters:
* hDispObject: Node Dispatcher object.
* hnode: Node object representing a node to be executed
* on the DSP.
* ul_fxn_addr: Address or RMS node execute function.
* ul_execute_fxn: Address of node's execute function.
* node_env: Address of node's environment structure.
* Returns:
* 0: Success.
* -ETIME: A timeout occurred before the DSP responded.
* Requires:
* disp_init(void) called.
* Valid hDispObject.
* hnode != NULL.
* Ensures:
*/
extern int disp_node_run(struct disp_object *hDispObject,
struct node_object *hnode,
u32 ul_fxn_addr,
u32 ul_execute_fxn, nodeenv node_env);
#endif /* DISP_ */
/*
* dispdefs.h
*
* DSP-BIOS Bridge driver support functions for TI OMAP processors.
*
* Global DISP constants and types, shared by PROCESSOR, NODE, and DISP.
*
* Copyright (C) 2005-2006 Texas Instruments, Inc.
*
* This package is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
#ifndef DISPDEFS_
#define DISPDEFS_
struct disp_object;
/* Node Dispatcher attributes */
struct disp_attr {
u32 ul_chnl_offset; /* Offset of channel ids reserved for RMS */
/* Size of buffer for sending data to RMS */
u32 ul_chnl_buf_size;
int proc_family; /* eg, 5000 */
int proc_type; /* eg, 5510 */
void *reserved1; /* Reserved for future use. */
u32 reserved2; /* Reserved for future use. */
};
#endif /* DISPDEFS_ */
/*
* dmm.h
*
* DSP-BIOS Bridge driver support functions for TI OMAP processors.
*
* The Dynamic Memory Mapping(DMM) module manages the DSP Virtual address
* space that can be directly mapped to any MPU buffer or memory region.
*
* Copyright (C) 2005-2006 Texas Instruments, Inc.
*
* This package is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
#ifndef DMM_
#define DMM_
#include <dspbridge/dbdefs.h>
struct dmm_object;
/* DMM attributes used in dmm_create() */
struct dmm_mgrattrs {
u32 reserved;
};
#define DMMPOOLSIZE 0x4000000
/*
* ======== dmm_get_handle ========
* Purpose:
* Return the dynamic memory manager object for this device.
* This is typically called from the client process.
*/
extern int dmm_get_handle(void *hprocessor,
OUT struct dmm_object **phDmmMgr);
extern int dmm_reserve_memory(struct dmm_object *dmm_mgr,
u32 size, u32 *prsv_addr);
extern int dmm_un_reserve_memory(struct dmm_object *dmm_mgr,
u32 rsv_addr);
extern int dmm_map_memory(struct dmm_object *dmm_mgr, u32 addr,
u32 size);
extern int dmm_un_map_memory(struct dmm_object *dmm_mgr,
u32 addr, u32 *psize);
extern int dmm_destroy(struct dmm_object *dmm_mgr);
extern int dmm_delete_tables(struct dmm_object *dmm_mgr);
extern int dmm_create(OUT struct dmm_object **phDmmMgr,
struct dev_object *hdev_obj,
IN CONST struct dmm_mgrattrs *pMgrAttrs);
extern bool dmm_init(void);
extern void dmm_exit(void);
extern int dmm_create_tables(struct dmm_object *dmm_mgr,
u32 addr, u32 size);
#ifdef DSP_DMM_DEBUG
u32 dmm_mem_map_dump(struct dmm_object *dmm_mgr);
#endif
#endif /* DMM_ */
此差异已折叠。
/*
* drvdefs.h
*
* DSP-BIOS Bridge driver support functions for TI OMAP processors.
*
* Definition of common struct between dspdefs.h and drv.h.
*
* Copyright (C) 2005-2006 Texas Instruments, Inc.
*
* This package is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
#ifndef DRVDEFS_
#define DRVDEFS_
/* Bridge Driver Object */
struct drv_object;
#endif /* DRVDEFS_ */
/*
* dspapi.h
*
* DSP-BIOS Bridge driver support functions for TI OMAP processors.
*
* Includes the wrapper functions called directly by the
* DeviceIOControl interface.
*
* Notes:
* Bridge services exported to Bridge driver are initialized by the DSPAPI on
* behalf of the Bridge driver. Bridge driver must not call module Init/Exit
* functions.
*
* To ensure Bridge driver binary compatibility across different platforms,
* for the same processor, a Bridge driver must restrict its usage of system
* services to those exported by the DSPAPI library.
*
* Copyright (C) 2005-2006 Texas Instruments, Inc.
*
* This package is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
#ifndef DSPAPI_
#define DSPAPI_
#include <dspbridge/dspapi-ioctl.h>
/* This BRD API Library Version: */
#define BRD_API_MAJOR_VERSION (u32)8 /* .8x - Alpha, .9x - Beta, 1.x FCS */
#define BRD_API_MINOR_VERSION (u32)0
/*
* ======== api_call_dev_ioctl ========
* Purpose:
* Call the (wrapper) function for the corresponding API IOCTL.
* Parameters:
* cmd: IOCTL id, base 0.
* args: Argument structure.
* pResult:
* Returns:
* 0 if command called; -EINVAL if command not in IOCTL
* table.
* Requires:
* Ensures:
*/
extern int api_call_dev_ioctl(unsigned int cmd,
union Trapped_Args *args,
u32 *pResult, void *pr_ctxt);
/*
* ======== api_init ========
* Purpose:
* Initialize modules used by Bridge API.
* This procedure is called when the driver is loaded.
* Parameters:
* Returns:
* TRUE if success; FALSE otherwise.
* Requires:
* Ensures:
*/
extern bool api_init(void);
/*
* ======== api_init_complete2 ========
* Purpose:
* Perform any required bridge initialization which cannot
* be performed in api_init() or dev_start_device() due
* to the fact that some services are not yet
* completely initialized.
* Parameters:
* Returns:
* 0: Allow this device to load
* -EPERM: Failure.
* Requires:
* Bridge API initialized.
* Ensures:
*/
extern int api_init_complete2(void);
/*
* ======== api_exit ========
* Purpose:
* Exit all modules initialized in api_init(void).
* This procedure is called when the driver is unloaded.
* Parameters:
* Returns:
* Requires:
* api_init(void) was previously called.
* Ensures:
* Resources acquired in api_init(void) are freed.
*/
extern void api_exit(void);
/* MGR wrapper functions */
extern u32 mgrwrap_enum_node_info(union Trapped_Args *args, void *pr_ctxt);
extern u32 mgrwrap_enum_proc_info(union Trapped_Args *args, void *pr_ctxt);
extern u32 mgrwrap_register_object(union Trapped_Args *args, void *pr_ctxt);
extern u32 mgrwrap_unregister_object(union Trapped_Args *args, void *pr_ctxt);
extern u32 mgrwrap_wait_for_bridge_events(union Trapped_Args *args,
void *pr_ctxt);
extern u32 mgrwrap_get_process_resources_info(union Trapped_Args *args,
void *pr_ctxt);
/* CPRC (Processor) wrapper Functions */
extern u32 procwrap_attach(union Trapped_Args *args, void *pr_ctxt);
extern u32 procwrap_ctrl(union Trapped_Args *args, void *pr_ctxt);
extern u32 procwrap_detach(union Trapped_Args *args, void *pr_ctxt);
extern u32 procwrap_enum_node_info(union Trapped_Args *args, void *pr_ctxt);
extern u32 procwrap_enum_resources(union Trapped_Args *args, void *pr_ctxt);
extern u32 procwrap_get_state(union Trapped_Args *args, void *pr_ctxt);
extern u32 procwrap_get_trace(union Trapped_Args *args, void *pr_ctxt);
extern u32 procwrap_load(union Trapped_Args *args, void *pr_ctxt);
extern u32 procwrap_register_notify(union Trapped_Args *args, void *pr_ctxt);
extern u32 procwrap_start(union Trapped_Args *args, void *pr_ctxt);
extern u32 procwrap_reserve_memory(union Trapped_Args *args, void *pr_ctxt);
extern u32 procwrap_un_reserve_memory(union Trapped_Args *args, void *pr_ctxt);
extern u32 procwrap_map(union Trapped_Args *args, void *pr_ctxt);
extern u32 procwrap_un_map(union Trapped_Args *args, void *pr_ctxt);
extern u32 procwrap_flush_memory(union Trapped_Args *args, void *pr_ctxt);
extern u32 procwrap_stop(union Trapped_Args *args, void *pr_ctxt);
extern u32 procwrap_invalidate_memory(union Trapped_Args *args, void *pr_ctxt);
extern u32 procwrap_begin_dma(union Trapped_Args *args, void *pr_ctxt);
extern u32 procwrap_end_dma(union Trapped_Args *args, void *pr_ctxt);
/* NODE wrapper functions */
extern u32 nodewrap_allocate(union Trapped_Args *args, void *pr_ctxt);
extern u32 nodewrap_alloc_msg_buf(union Trapped_Args *args, void *pr_ctxt);
extern u32 nodewrap_change_priority(union Trapped_Args *args, void *pr_ctxt);
extern u32 nodewrap_connect(union Trapped_Args *args, void *pr_ctxt);
extern u32 nodewrap_create(union Trapped_Args *args, void *pr_ctxt);
extern u32 nodewrap_delete(union Trapped_Args *args, void *pr_ctxt);
extern u32 nodewrap_free_msg_buf(union Trapped_Args *args, void *pr_ctxt);
extern u32 nodewrap_get_attr(union Trapped_Args *args, void *pr_ctxt);
extern u32 nodewrap_get_message(union Trapped_Args *args, void *pr_ctxt);
extern u32 nodewrap_pause(union Trapped_Args *args, void *pr_ctxt);
extern u32 nodewrap_put_message(union Trapped_Args *args, void *pr_ctxt);
extern u32 nodewrap_register_notify(union Trapped_Args *args, void *pr_ctxt);
extern u32 nodewrap_run(union Trapped_Args *args, void *pr_ctxt);
extern u32 nodewrap_terminate(union Trapped_Args *args, void *pr_ctxt);
extern u32 nodewrap_get_uuid_props(union Trapped_Args *args, void *pr_ctxt);
/* STRM wrapper functions */
extern u32 strmwrap_allocate_buffer(union Trapped_Args *args, void *pr_ctxt);
extern u32 strmwrap_close(union Trapped_Args *args, void *pr_ctxt);
extern u32 strmwrap_free_buffer(union Trapped_Args *args, void *pr_ctxt);
extern u32 strmwrap_get_event_handle(union Trapped_Args *args, void *pr_ctxt);
extern u32 strmwrap_get_info(union Trapped_Args *args, void *pr_ctxt);
extern u32 strmwrap_idle(union Trapped_Args *args, void *pr_ctxt);
extern u32 strmwrap_issue(union Trapped_Args *args, void *pr_ctxt);
extern u32 strmwrap_open(union Trapped_Args *args, void *pr_ctxt);
extern u32 strmwrap_reclaim(union Trapped_Args *args, void *pr_ctxt);
extern u32 strmwrap_register_notify(union Trapped_Args *args, void *pr_ctxt);
extern u32 strmwrap_select(union Trapped_Args *args, void *pr_ctxt);
extern u32 cmmwrap_calloc_buf(union Trapped_Args *args, void *pr_ctxt);
extern u32 cmmwrap_free_buf(union Trapped_Args *args, void *pr_ctxt);
extern u32 cmmwrap_get_handle(union Trapped_Args *args, void *pr_ctxt);
extern u32 cmmwrap_get_info(union Trapped_Args *args, void *pr_ctxt);
#endif /* DSPAPI_ */
/*
* dspchnl.h
*
* DSP-BIOS Bridge driver support functions for TI OMAP processors.
*
* Declares the upper edge channel class library functions required by
* all Bridge driver / DSP API driver interface tables. These functions are
* implemented by every class of Bridge channel library.
*
* Notes:
* The function comment headers reside in dspdefs.h.
*
* Copyright (C) 2005-2006 Texas Instruments, Inc.
*
* This package is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
#ifndef DSPCHNL_
#define DSPCHNL_
extern int bridge_chnl_create(OUT struct chnl_mgr **phChnlMgr,
struct dev_object *hdev_obj,
IN CONST struct chnl_mgrattrs
*pMgrAttrs);
extern int bridge_chnl_destroy(struct chnl_mgr *hchnl_mgr);
extern int bridge_chnl_open(OUT struct chnl_object **phChnl,
struct chnl_mgr *hchnl_mgr,
s8 chnl_mode,
u32 uChnlId,
CONST IN OPTIONAL struct chnl_attr
*pattrs);
extern int bridge_chnl_close(struct chnl_object *chnl_obj);
extern int bridge_chnl_add_io_req(struct chnl_object *chnl_obj,
void *pHostBuf,
u32 byte_size, u32 buf_size,
OPTIONAL u32 dw_dsp_addr, u32 dw_arg);
extern int bridge_chnl_get_ioc(struct chnl_object *chnl_obj,
u32 dwTimeOut, OUT struct chnl_ioc *pIOC);
extern int bridge_chnl_cancel_io(struct chnl_object *chnl_obj);
extern int bridge_chnl_flush_io(struct chnl_object *chnl_obj,
u32 dwTimeOut);
extern int bridge_chnl_get_info(struct chnl_object *chnl_obj,
OUT struct chnl_info *pInfo);
extern int bridge_chnl_get_mgr_info(struct chnl_mgr *hchnl_mgr,
u32 uChnlID, OUT struct chnl_mgrinfo
*pMgrInfo);
extern int bridge_chnl_idle(struct chnl_object *chnl_obj,
u32 dwTimeOut, bool fFlush);
extern int bridge_chnl_register_notify(struct chnl_object *chnl_obj,
u32 event_mask,
u32 notify_type,
struct dsp_notification
*hnotification);
#endif /* DSPCHNL_ */
此差异已折叠。
/*
* dspdeh.h
*
* DSP-BIOS Bridge driver support functions for TI OMAP processors.
*
* Defines upper edge DEH functions required by all Bridge driver/DSP API
* interface tables.
*
* Notes:
* Function comment headers reside with the function typedefs in dspdefs.h.
*
* Copyright (C) 2005-2006 Texas Instruments, Inc.
*
* This package is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
#ifndef DSPDEH_
#define DSPDEH_
#include <dspbridge/devdefs.h>
#include <dspbridge/dehdefs.h>
extern int bridge_deh_create(struct deh_mgr **ret_deh_mgr,
struct dev_object *hdev_obj);
extern int bridge_deh_destroy(struct deh_mgr *deh_mgr);
extern int bridge_deh_get_info(struct deh_mgr *deh_mgr,
struct dsp_errorinfo *pErrInfo);
extern int bridge_deh_register_notify(struct deh_mgr *deh_mgr,
u32 event_mask,
u32 notify_type,
struct dsp_notification *hnotification);
extern void bridge_deh_notify(struct deh_mgr *deh_mgr,
u32 ulEventMask, u32 dwErrInfo);
extern void bridge_deh_release_dummy_mem(void);
#endif /* DSPDEH_ */
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册