4 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
6 * Bridge driver entry point and interface function declarations.
9 * The DSP API obtains it's function interface to
10 * the Bridge driver via a call to bridge_drv_entry().
12 * Bridge services exported to Bridge drivers are initialized by the
13 * DSP API on behalf of the Bridge driver.
15 * Bridge function DBC Requires and Ensures are also made by the DSP API on
16 * behalf of the Bridge driver, to simplify the Bridge driver code.
18 * Copyright (C) 2005-2006 Texas Instruments, Inc.
20 * This package is free software; you can redistribute it and/or modify
21 * it under the terms of the GNU General Public License version 2 as
22 * published by the Free Software Foundation.
24 * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
25 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
26 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
32 #include <dspbridge/brddefs.h>
33 #include <dspbridge/cfgdefs.h>
34 #include <dspbridge/chnlpriv.h>
35 #include <dspbridge/dehdefs.h>
36 #include <dspbridge/devdefs.h>
37 #include <dspbridge/iodefs.h>
38 #include <dspbridge/msgdefs.h>
41 * Any IOCTLS at or above this value are reserved for standard Bridge driver
44 #define BRD_RESERVEDIOCTLBASE 0x8000
46 /* Handle to Bridge driver's private device context. */
47 struct bridge_dev_context;
49 /*--------------------------------------------------------------------------- */
50 /* BRIDGE DRIVER FUNCTION TYPES */
51 /*--------------------------------------------------------------------------- */
54 * ======== bridge_brd_monitor ========
56 * Bring the board to the BRD_IDLE (monitor) state.
58 * dev_ctxt: Handle to Bridge driver defined device context.
61 * -ETIMEDOUT: Timeout occured waiting for a response from hardware.
62 * -EPERM: Other, unspecified error.
66 * 0: Board is in BRD_IDLE state;
67 * else: Board state is indeterminate.
69 typedef int(*fxn_brd_monitor) (struct bridge_dev_context *dev_ctxt);
72 * ======== fxn_brd_setstate ========
74 * Sets the Bridge driver state
76 * dev_ctxt: Handle to Bridge driver defined device info.
77 * brd_state: Board state
80 * -EPERM: Other, unspecified error.
83 * brd_state <= BRD_LASTSTATE.
85 * brd_state <= BRD_LASTSTATE.
86 * Update the Board state to the specified state.
88 typedef int(*fxn_brd_setstate) (struct bridge_dev_context
89 * dev_ctxt, u32 brd_state);
92 * ======== bridge_brd_start ========
94 * Bring board to the BRD_RUNNING (start) state.
96 * dev_ctxt: Handle to Bridge driver defined device context.
97 * dsp_addr: DSP address at which to start execution.
100 * -ETIMEDOUT: Timeout occured waiting for a response from hardware.
101 * -EPERM: Other, unspecified error.
104 * Board is in monitor (BRD_IDLE) state.
106 * 0: Board is in BRD_RUNNING state.
107 * Interrupts to the PC are enabled.
108 * else: Board state is indeterminate.
110 typedef int(*fxn_brd_start) (struct bridge_dev_context
111 * dev_ctxt, u32 dsp_addr);
114 * ======== bridge_brd_mem_copy ========
116 * Copy memory from one DSP address to another
118 * dev_context: Pointer to context handle
119 * dsp_dest_addr: DSP address to copy to
120 * dsp_src_addr: DSP address to copy from
121 * ul_num_bytes: Number of bytes to copy
122 * mem_type: What section of memory to copy to
125 * -EPERM: Other, unspecified error.
127 * dev_context != NULL
129 * 0: Board is in BRD_RUNNING state.
130 * Interrupts to the PC are enabled.
131 * else: Board state is indeterminate.
133 typedef int(*fxn_brd_memcopy) (struct bridge_dev_context
137 u32 ul_num_bytes, u32 mem_type);
139 * ======== bridge_brd_mem_write ========
141 * Write a block of host memory into a DSP address, into a given memory
142 * space. Unlike bridge_brd_write, this API does reset the DSP
144 * dev_ctxt: Handle to Bridge driver defined device info.
145 * dsp_addr: Address on DSP board (Destination).
146 * host_buf: Pointer to host buffer (Source).
147 * ul_num_bytes: Number of bytes to transfer.
148 * mem_type: Memory space on DSP to which to transfer.
151 * -ETIMEDOUT: Timeout occured waiting for a response from hardware.
152 * -EPERM: Other, unspecified error.
158 typedef int(*fxn_brd_memwrite) (struct bridge_dev_context
161 u32 dsp_addr, u32 ul_num_bytes,
165 * ======== bridge_brd_stop ========
167 * Bring board to the BRD_STOPPED state.
169 * dev_ctxt: Handle to Bridge driver defined device context.
172 * -ETIMEDOUT: Timeout occured waiting for a response from hardware.
173 * -EPERM: Other, unspecified error.
177 * 0: Board is in BRD_STOPPED (stop) state;
178 * Interrupts to the PC are disabled.
179 * else: Board state is indeterminate.
181 typedef int(*fxn_brd_stop) (struct bridge_dev_context *dev_ctxt);
184 * ======== bridge_brd_status ========
186 * Report the current state of the board.
188 * dev_ctxt: Handle to Bridge driver defined device context.
189 * board_state: Ptr to BRD status variable.
193 * board_state != NULL;
196 * *board_state is one of
197 * {BRD_STOPPED, BRD_IDLE, BRD_RUNNING, BRD_UNKNOWN};
199 typedef int(*fxn_brd_status) (struct bridge_dev_context *dev_ctxt,
203 * ======== bridge_brd_read ========
205 * Read a block of DSP memory, from a given memory space, into a host
208 * dev_ctxt: Handle to Bridge driver defined device info.
209 * host_buf: Pointer to host buffer (Destination).
210 * dsp_addr: Address on DSP board (Source).
211 * ul_num_bytes: Number of bytes to transfer.
212 * mem_type: Memory space on DSP from which to transfer.
215 * -ETIMEDOUT: Timeout occured waiting for a response from hardware.
216 * -EPERM: Other, unspecified error.
221 * Will not write more than ul_num_bytes bytes into host_buf.
223 typedef int(*fxn_brd_read) (struct bridge_dev_context *dev_ctxt,
226 u32 ul_num_bytes, u32 mem_type);
229 * ======== bridge_brd_write ========
231 * Write a block of host memory into a DSP address, into a given memory
234 * dev_ctxt: Handle to Bridge driver defined device info.
235 * dsp_addr: Address on DSP board (Destination).
236 * host_buf: Pointer to host buffer (Source).
237 * ul_num_bytes: Number of bytes to transfer.
238 * mem_type: Memory space on DSP to which to transfer.
241 * -ETIMEDOUT: Timeout occured waiting for a response from hardware.
242 * -EPERM: Other, unspecified error.
248 typedef int(*fxn_brd_write) (struct bridge_dev_context *dev_ctxt,
251 u32 ul_num_bytes, u32 mem_type);
254 * ======== bridge_chnl_create ========
256 * Create a channel manager object, responsible for opening new channels
257 * and closing old ones for a given 'Bridge board.
259 * channel_mgr: Location to store a channel manager object on output.
260 * hdev_obj: Handle to a device object.
261 * mgr_attrts: Channel manager attributes.
262 * mgr_attrts->max_channels: Max channels
263 * mgr_attrts->birq: Channel's I/O IRQ number.
264 * mgr_attrts->irq_shared: TRUE if the IRQ is shareable.
265 * mgr_attrts->word_size: DSP Word size in equivalent PC bytes..
266 * mgr_attrts->shm_base: Base physical address of shared memory, if any.
267 * mgr_attrts->usm_length: Bytes of shared memory block.
270 * -ENOMEM: Insufficient memory for requested resources.
271 * -EIO: Unable to plug ISR for given IRQ.
272 * -EFAULT: Couldn't map physical address to a virtual one.
274 * channel_mgr != NULL.
276 * mgr_attrts field are all valid:
277 * 0 < max_channels <= CHNL_MAXCHANNELS.
281 * No channel manager exists for this board.
284 typedef int(*fxn_chnl_create) (struct chnl_mgr
289 chnl_mgrattrs * mgr_attrts);
292 * ======== bridge_chnl_destroy ========
294 * Close all open channels, and destroy the channel manager.
296 * hchnl_mgr: Channel manager object.
299 * -EFAULT: hchnl_mgr was invalid.
302 * 0: Cancels I/O on each open channel. Closes each open channel.
303 * chnl_create may subsequently be called for the same device.
305 typedef int(*fxn_chnl_destroy) (struct chnl_mgr *hchnl_mgr);
307 * ======== bridge_deh_notify ========
309 * When notified of DSP error, take appropriate action.
311 * hdeh_mgr: Handle to DEH manager object.
312 * evnt_mask: Indicate the type of exception
313 * error_info: Error information
318 * evnt_mask with a valid exception
321 typedef void (*fxn_deh_notify) (struct deh_mgr *hdeh_mgr,
322 u32 evnt_mask, u32 error_info);
325 * ======== bridge_chnl_open ========
327 * Open a new half-duplex channel to the DSP board.
329 * chnl: Location to store a channel object handle.
330 * hchnl_mgr: Handle to channel manager, as returned by
332 * chnl_mode: One of {CHNL_MODETODSP, CHNL_MODEFROMDSP} specifies
333 * direction of data transfer.
334 * ch_id: If CHNL_PICKFREE is specified, the channel manager will
335 * select a free channel id (default);
336 * otherwise this field specifies the id of the channel.
337 * pattrs: Channel attributes. Attribute fields are as follows:
338 * pattrs->uio_reqs: Specifies the maximum number of I/O requests which can
339 * be pending at any given time. All request packets are
340 * preallocated when the channel is opened.
341 * pattrs->event_obj: This field allows the user to supply an auto reset
342 * event object for channel I/O completion notifications.
343 * It is the responsibility of the user to destroy this
344 * object AFTER closing the channel.
345 * This channel event object can be retrieved using
346 * CHNL_GetEventHandle().
347 * pattrs->hReserved: The kernel mode handle of this event object.
351 * -EFAULT: hchnl_mgr is invalid.
352 * -ENOMEM: Insufficient memory for requested resources.
353 * -EINVAL: Invalid number of IOReqs.
354 * -ENOSR: No free channels available.
355 * -ECHRNG: Channel ID is out of range.
356 * -EALREADY: Channel is in use.
357 * -EIO: No free IO request packets available for
362 * pattrs->event_obj is a valid event handle.
363 * pattrs->hReserved is the kernel mode handle for pattrs->event_obj.
365 * 0: *chnl is a valid channel.
366 * else: *chnl is set to NULL if (chnl != NULL);
368 typedef int(*fxn_chnl_open) (struct chnl_object
370 struct chnl_mgr *hchnl_mgr,
377 * ======== bridge_chnl_close ========
379 * Ensures all pending I/O on this channel is cancelled, discards all
380 * queued I/O completion notifications, then frees the resources allocated
381 * for this channel, and makes the corresponding logical channel id
382 * available for subsequent use.
384 * chnl_obj: Handle to a channel object.
387 * -EFAULT: Invalid chnl_obj.
389 * No thread must be blocked on this channel's I/O completion event.
391 * 0: chnl_obj is no longer valid.
393 typedef int(*fxn_chnl_close) (struct chnl_object *chnl_obj);
396 * ======== bridge_chnl_add_io_req ========
398 * Enqueue an I/O request for data transfer on a channel to the DSP.
399 * The direction (mode) is specified in the channel object. Note the DSP
400 * address is specified for channels opened in direct I/O mode.
402 * chnl_obj: Channel object handle.
403 * host_buf: Host buffer address source.
404 * byte_size: Number of PC bytes to transfer. A zero value indicates
405 * that this buffer is the last in the output channel.
406 * A zero value is invalid for an input channel.
407 *! buf_size: Actual buffer size in host bytes.
408 * dw_dsp_addr: DSP address for transfer. (Currently ignored).
409 * dw_arg: A user argument that travels with the buffer.
412 * -EFAULT: Invalid chnl_obj or host_buf.
413 * -EPERM: User cannot mark EOS on an input channel.
414 * -ECANCELED: I/O has been cancelled on this channel. No further
416 * -EPIPE: End of stream was already marked on a previous
417 * IORequest on this channel. No further I/O is expected.
418 * -EINVAL: Buffer submitted to this output channel is larger than
419 * the size of the physical shared memory output window.
422 * 0: The buffer will be transferred if the channel is ready;
423 * otherwise, will be queued for transfer when the channel becomes
424 * ready. In any case, notifications of I/O completion are
426 * If byte_size is 0 for an output channel, subsequent CHNL_AddIOReq's
427 * on this channel will fail with error code -EPIPE. The
428 * corresponding IOC for this I/O request will have its status flag
429 * set to CHNL_IOCSTATEOS.
431 typedef int(*fxn_chnl_addioreq) (struct chnl_object
436 u32 dw_dsp_addr, u32 dw_arg);
439 * ======== bridge_chnl_get_ioc ========
441 * Dequeue an I/O completion record, which contains information about the
442 * completed I/O request.
444 * chnl_obj: Channel object handle.
445 * timeout: A value of CHNL_IOCNOWAIT will simply dequeue the
446 * first available IOC.
447 * chan_ioc: On output, contains host buffer address, bytes
448 * transferred, and status of I/O completion.
449 * chan_ioc->status: See chnldefs.h.
452 * -EFAULT: Invalid chnl_obj or chan_ioc.
453 * -EREMOTEIO: CHNL_IOCNOWAIT was specified as the timeout parameter
454 * yet no I/O completions were queued.
456 * timeout == CHNL_IOCNOWAIT.
458 * 0: if there are any remaining IOC's queued before this call
459 * returns, the channel event object will be left in a signalled
462 typedef int(*fxn_chnl_getioc) (struct chnl_object *chnl_obj,
464 struct chnl_ioc *chan_ioc);
467 * ======== bridge_chnl_cancel_io ========
469 * Return all I/O requests to the client which have not yet been
470 * transferred. The channel's I/O completion object is
471 * signalled, and all the I/O requests are queued as IOC's, with the
472 * status field set to CHNL_IOCSTATCANCEL.
473 * This call is typically used in abort situations, and is a prelude to
476 * chnl_obj: Channel object handle.
479 * -EFAULT: Invalid chnl_obj.
482 * Subsequent I/O requests to this channel will not be accepted.
484 typedef int(*fxn_chnl_cancelio) (struct chnl_object *chnl_obj);
487 * ======== bridge_chnl_flush_io ========
489 * For an output stream (to the DSP), indicates if any IO requests are in
490 * the output request queue. For input streams (from the DSP), will
491 * cancel all pending IO requests.
493 * chnl_obj: Channel object handle.
494 * timeout: Timeout value for flush operation.
497 * S_CHNLIOREQUEST: Returned if any IORequests are in the output queue.
498 * -EFAULT: Invalid chnl_obj.
501 * 0: No I/O requests will be pending on this channel.
503 typedef int(*fxn_chnl_flushio) (struct chnl_object *chnl_obj,
507 * ======== bridge_chnl_get_info ========
509 * Retrieve information related to a channel.
511 * chnl_obj: Handle to a valid channel object, or NULL.
512 * channel_info: Location to store channel info.
515 * -EFAULT: Invalid chnl_obj or channel_info.
518 * 0: channel_info points to a filled in chnl_info struct,
519 * if (channel_info != NULL).
521 typedef int(*fxn_chnl_getinfo) (struct chnl_object *chnl_obj,
522 struct chnl_info *channel_info);
525 * ======== bridge_chnl_get_mgr_info ========
527 * Retrieve information related to the channel manager.
529 * hchnl_mgr: Handle to a valid channel manager, or NULL.
531 * mgr_info: Location to store channel manager info.
534 * -EFAULT: Invalid hchnl_mgr or mgr_info.
535 * -ECHRNG: Invalid channel ID.
538 * 0: mgr_info points to a filled in chnl_mgrinfo
539 * struct, if (mgr_info != NULL).
541 typedef int(*fxn_chnl_getmgrinfo) (struct chnl_mgr
544 struct chnl_mgrinfo *mgr_info);
547 * ======== bridge_chnl_idle ========
549 * Idle a channel. If this is an input channel, or if this is an output
550 * channel and flush_data is TRUE, all currently enqueued buffers will be
551 * dequeued (data discarded for output channel).
552 * If this is an output channel and flush_data is FALSE, this function
553 * will block until all currently buffered data is output, or the timeout
554 * specified has been reached.
557 * chnl_obj: Channel object handle.
558 * timeout: If output channel and flush_data is FALSE, timeout value
559 * to wait for buffers to be output. (Not used for
561 * flush_data: If output channel and flush_data is TRUE, discard any
562 * currently buffered data. If FALSE, wait for currently
563 * buffered data to be output, or timeout, whichever
564 * occurs first. flush_data is ignored for input channel.
567 * -EFAULT: Invalid chnl_obj.
568 * -ETIMEDOUT: Timeout occured before channel could be idled.
572 typedef int(*fxn_chnl_idle) (struct chnl_object *chnl_obj,
573 u32 timeout, bool flush_data);
576 * ======== bridge_chnl_register_notify ========
578 * Register for notification of events on a channel.
580 * chnl_obj: Channel object handle.
581 * event_mask: Type of events to be notified about: IO completion
582 * (DSP_STREAMIOCOMPLETION) or end of stream
584 * notify_type: DSP_SIGNALEVENT.
585 * hnotification: Handle of a dsp_notification object.
588 * -ENOMEM: Insufficient memory.
589 * -EINVAL: event_mask is 0 and hnotification was not
590 * previously registered.
591 * -EFAULT: NULL hnotification, hnotification event name
592 * too long, or hnotification event name NULL.
595 * hnotification != NULL.
596 * (event_mask & ~(DSP_STREAMIOCOMPLETION | DSP_STREAMDONE)) == 0.
597 * notify_type == DSP_SIGNALEVENT.
600 typedef int(*fxn_chnl_registernotify)
601 (struct chnl_object *chnl_obj,
602 u32 event_mask, u32 notify_type, struct dsp_notification *hnotification);
605 * ======== bridge_dev_create ========
607 * Complete creation of the device object for this board.
609 * device_ctx: Ptr to location to store a Bridge device context.
610 * hdev_obj: Handle to a Device Object, created and managed by DSP API.
611 * config_param: Ptr to configuration parameters provided by the
612 * Configuration Manager during device loading.
613 * pDspConfig: DSP resources, as specified in the registry key for this
617 * -ENOMEM: Unable to allocate memory for device context.
619 * device_ctx != NULL;
621 * config_param != NULL;
622 * pDspConfig != NULL;
623 * Fields in config_param and pDspConfig contain valid values.
625 * 0: All Bridge driver specific DSP resource and other
626 * board context has been allocated.
627 * -ENOMEM: Bridge failed to allocate resources.
628 * Any acquired resources have been freed. The DSP API
629 * will not call bridge_dev_destroy() if
630 * bridge_dev_create() fails.
632 * Called during the CONFIGMG's Device_Init phase. Based on host and
633 * DSP configuration information, create a board context, a handle to
634 * which is passed into other Bridge BRD and CHNL functions. The
635 * board context contains state information for the device. Since the
636 * addresses of all pointer parameters may be invalid when this
637 * function returns, they must not be stored into the device context
640 typedef int(*fxn_dev_create) (struct bridge_dev_context
648 * ======== bridge_dev_ctrl ========
650 * Bridge driver specific interface.
652 * dev_ctxt: Handle to Bridge driver defined device info.
653 * dw_cmd: Bridge driver defined command code.
654 * pargs: Pointer to an arbitrary argument structure.
656 * 0 or -EPERM. Actual command error codes should be passed back in
657 * the pargs structure, and are defined by the Bridge driver implementor.
659 * All calls are currently assumed to be synchronous. There are no
660 * IOCTL completion routines provided.
663 typedef int(*fxn_dev_ctrl) (struct bridge_dev_context *dev_ctxt,
664 u32 dw_cmd, void *pargs);
667 * ======== bridge_dev_destroy ========
669 * Deallocate Bridge device extension structures and all other resources
670 * acquired by the Bridge driver.
671 * No calls to other Bridge driver functions may subsequently
672 * occur, except for bridge_dev_create().
674 * dev_ctxt: Handle to Bridge driver defined device information.
677 * -EPERM: Failed to release a resource previously acquired.
681 * 0: Device context is freed.
683 typedef int(*fxn_dev_destroy) (struct bridge_dev_context *dev_ctxt);
686 * ======== bridge_io_create ========
688 * Create an object that manages I/O between CHNL and msg_ctrl.
690 * io_man: Location to store IO manager on output.
691 * hchnl_mgr: Handle to channel manager.
692 * hmsg_mgr: Handle to message manager.
695 * -ENOMEM: Memory allocation failure.
696 * -EPERM: Creation failed.
699 * Channel manager already created;
700 * Message manager already created;
701 * mgr_attrts != NULL;
705 typedef int(*fxn_io_create) (struct io_mgr **io_man,
706 struct dev_object *hdev_obj,
707 const struct io_attrs *mgr_attrts);
710 * ======== bridge_io_destroy ========
712 * Destroy object created in bridge_io_create.
714 * hio_mgr: IO Manager.
717 * -ENOMEM: Memory allocation failure.
718 * -EPERM: Creation failed.
723 typedef int(*fxn_io_destroy) (struct io_mgr *hio_mgr);
726 * ======== bridge_io_on_loaded ========
728 * Called whenever a program is loaded to update internal data. For
729 * example, if shared memory is used, this function would update the
730 * shared memory location and address.
732 * hio_mgr: IO Manager.
735 * -EPERM: Internal failure occurred.
740 typedef int(*fxn_io_onloaded) (struct io_mgr *hio_mgr);
743 * ======== fxn_io_getprocload ========
745 * Called to get the Processor's current and predicted load
747 * hio_mgr: IO Manager.
748 * proc_load_stat Processor Load statistics
751 * -EPERM: Internal failure occurred.
756 typedef int(*fxn_io_getprocload) (struct io_mgr *hio_mgr,
757 struct dsp_procloadstat *
761 * ======== bridge_msg_create ========
763 * Create an object to manage message queues. Only one of these objects
764 * can exist per device object.
766 * msg_man: Location to store msg_ctrl manager on output.
767 * hdev_obj: Handle to a device object.
768 * msg_callback: Called whenever an RMS_EXIT message is received.
771 * -ENOMEM: Insufficient memory.
774 * msg_callback != NULL.
778 typedef int(*fxn_msg_create)
779 (struct msg_mgr **msg_man,
780 struct dev_object *hdev_obj, msg_onexit msg_callback);
783 * ======== bridge_msg_create_queue ========
785 * Create a msg_ctrl queue for sending or receiving messages from a Message
788 * hmsg_mgr: msg_ctrl queue manager handle returned from
790 * msgq: Location to store msg_ctrl queue on output.
791 * msgq_id: Identifier for messages (node environment pointer).
792 * max_msgs: Max number of simultaneous messages for the node.
793 * h: Handle passed to hmsg_mgr->msg_callback().
796 * -ENOMEM: Insufficient memory.
802 * msgq !=NULL <==> 0.
804 typedef int(*fxn_msg_createqueue)
805 (struct msg_mgr *hmsg_mgr,
806 struct msg_queue **msgq, u32 msgq_id, u32 max_msgs, void *h);
809 * ======== bridge_msg_delete ========
811 * Delete a msg_ctrl manager allocated in bridge_msg_create().
813 * hmsg_mgr: Handle returned from bridge_msg_create().
819 typedef void (*fxn_msg_delete) (struct msg_mgr *hmsg_mgr);
822 * ======== bridge_msg_delete_queue ========
824 * Delete a msg_ctrl queue allocated in bridge_msg_create_queue.
826 * msg_queue_obj: Handle to msg_ctrl queue returned from
827 * bridge_msg_create_queue.
830 * Valid msg_queue_obj.
833 typedef void (*fxn_msg_deletequeue) (struct msg_queue *msg_queue_obj);
836 * ======== bridge_msg_get ========
838 * Get a message from a msg_ctrl queue.
840 * msg_queue_obj: Handle to msg_ctrl queue returned from
841 * bridge_msg_create_queue.
842 * pmsg: Location to copy message into.
843 * utimeout: Timeout to wait for a message.
846 * -ETIME: Timeout occurred.
847 * -EPERM: No frames available for message (max_msgs too
850 * Valid msg_queue_obj.
854 typedef int(*fxn_msg_get) (struct msg_queue *msg_queue_obj,
855 struct dsp_msg *pmsg, u32 utimeout);
858 * ======== bridge_msg_put ========
860 * Put a message onto a msg_ctrl queue.
862 * msg_queue_obj: Handle to msg_ctrl queue returned from
863 * bridge_msg_create_queue.
864 * pmsg: Pointer to message.
865 * utimeout: Timeout to wait for a message.
868 * -ETIME: Timeout occurred.
869 * -EPERM: No frames available for message (max_msgs too
872 * Valid msg_queue_obj.
876 typedef int(*fxn_msg_put) (struct msg_queue *msg_queue_obj,
877 const struct dsp_msg *pmsg, u32 utimeout);
880 * ======== bridge_msg_register_notify ========
882 * Register notification for when a message is ready.
884 * msg_queue_obj: Handle to msg_ctrl queue returned from
885 * bridge_msg_create_queue.
886 * event_mask: Type of events to be notified about: Must be
887 * DSP_NODEMESSAGEREADY, or 0 to unregister.
888 * notify_type: DSP_SIGNALEVENT.
889 * hnotification: Handle of notification object.
892 * -ENOMEM: Insufficient memory.
894 * Valid msg_queue_obj.
895 * hnotification != NULL.
896 * notify_type == DSP_SIGNALEVENT.
897 * event_mask == DSP_NODEMESSAGEREADY || event_mask == 0.
900 typedef int(*fxn_msg_registernotify)
901 (struct msg_queue *msg_queue_obj,
902 u32 event_mask, u32 notify_type, struct dsp_notification *hnotification);
905 * ======== bridge_msg_set_queue_id ========
907 * Set message queue id to node environment. Allows bridge_msg_create_queue
908 * to be called in node_allocate, before the node environment is known.
910 * msg_queue_obj: Handle to msg_ctrl queue returned from
911 * bridge_msg_create_queue.
912 * msgq_id: Node environment pointer.
915 * Valid msg_queue_obj.
919 typedef void (*fxn_msg_setqueueid) (struct msg_queue *msg_queue_obj,
923 * Bridge Driver interface function table.
925 * The information in this table is filled in by the specific Bridge driver,
926 * and copied into the DSP API's own space. If any interface
927 * function field is set to a value of NULL, then the DSP API will
928 * consider that function not implemented, and return the error code
929 * -ENOSYS when a Bridge driver client attempts to call that function.
931 * This function table contains DSP API version numbers, which are used by the
932 * Bridge driver loader to help ensure backwards compatility between older
933 * Bridge drivers and newer DSP API. These must be set to
934 * BRD_API_MAJOR_VERSION and BRD_API_MINOR_VERSION, respectively.
936 * A Bridge driver need not export a CHNL interface. In this case, *all* of
937 * the bridge_chnl_* entries must be set to NULL.
939 struct bridge_drv_interface {
940 u32 brd_api_major_version; /* Set to BRD_API_MAJOR_VERSION. */
941 u32 brd_api_minor_version; /* Set to BRD_API_MINOR_VERSION. */
942 fxn_dev_create pfn_dev_create; /* Create device context */
943 fxn_dev_destroy pfn_dev_destroy; /* Destroy device context */
944 fxn_dev_ctrl pfn_dev_cntrl; /* Optional vendor interface */
945 fxn_brd_monitor pfn_brd_monitor; /* Load and/or start monitor */
946 fxn_brd_start pfn_brd_start; /* Start DSP program. */
947 fxn_brd_stop pfn_brd_stop; /* Stop/reset board. */
948 fxn_brd_status pfn_brd_status; /* Get current board status. */
949 fxn_brd_read pfn_brd_read; /* Read board memory */
950 fxn_brd_write pfn_brd_write; /* Write board memory. */
951 fxn_brd_setstate pfn_brd_set_state; /* Sets the Board State */
952 fxn_brd_memcopy pfn_brd_mem_copy; /* Copies DSP Memory */
953 fxn_brd_memwrite pfn_brd_mem_write; /* Write DSP Memory w/o halt */
954 fxn_chnl_create pfn_chnl_create; /* Create channel manager. */
955 fxn_chnl_destroy pfn_chnl_destroy; /* Destroy channel manager. */
956 fxn_chnl_open pfn_chnl_open; /* Create a new channel. */
957 fxn_chnl_close pfn_chnl_close; /* Close a channel. */
958 fxn_chnl_addioreq pfn_chnl_add_io_req; /* Req I/O on a channel. */
959 fxn_chnl_getioc pfn_chnl_get_ioc; /* Wait for I/O completion. */
960 fxn_chnl_cancelio pfn_chnl_cancel_io; /* Cancl I/O on a channel. */
961 fxn_chnl_flushio pfn_chnl_flush_io; /* Flush I/O. */
962 fxn_chnl_getinfo pfn_chnl_get_info; /* Get channel specific info */
963 /* Get channel manager info. */
964 fxn_chnl_getmgrinfo pfn_chnl_get_mgr_info;
965 fxn_chnl_idle pfn_chnl_idle; /* Idle the channel */
966 /* Register for notif. */
967 fxn_chnl_registernotify pfn_chnl_register_notify;
968 fxn_io_create pfn_io_create; /* Create IO manager */
969 fxn_io_destroy pfn_io_destroy; /* Destroy IO manager */
970 fxn_io_onloaded pfn_io_on_loaded; /* Notify of program loaded */
971 /* Get Processor's current and predicted load */
972 fxn_io_getprocload pfn_io_get_proc_load;
973 fxn_msg_create pfn_msg_create; /* Create message manager */
974 /* Create message queue */
975 fxn_msg_createqueue pfn_msg_create_queue;
976 fxn_msg_delete pfn_msg_delete; /* Delete message manager */
977 /* Delete message queue */
978 fxn_msg_deletequeue pfn_msg_delete_queue;
979 fxn_msg_get pfn_msg_get; /* Get a message */
980 fxn_msg_put pfn_msg_put; /* Send a message */
981 /* Register for notif. */
982 fxn_msg_registernotify pfn_msg_register_notify;
983 /* Set message queue id */
984 fxn_msg_setqueueid pfn_msg_set_queue_id;
988 * ======== bridge_drv_entry ========
990 * Registers Bridge driver functions with the DSP API. Called only once
991 * by the DSP API. The caller will first check DSP API version
992 * compatibility, and then copy the interface functions into its own
995 * drv_intf Pointer to a location to receive a pointer to the
996 * Bridge driver interface.
999 * The code segment this function resides in must expect to be discarded
1002 * drv_intf pointer initialized to Bridge driver's function
1003 * interface. No system resources are acquired by this function.
1005 * Called during the Device_Init phase.
1007 void bridge_drv_entry(struct bridge_drv_interface **drv_intf,
1008 const char *driver_file_name);
1010 #endif /* DSPDEFS_ */