1 
2 /*
3  *
4  Copyright (c) Eicon Networks, 2002.
5  *
6  This source file is supplied for the use with
7  Eicon Networks range of DIVA Server Adapters.
8  *
9  Eicon File Revision :    2.1
10  *
11  This program is free software; you can redistribute it and/or modify
12  it under the terms of the GNU General Public License as published by
13  the Free Software Foundation; either version 2, or (at your option)
14  any later version.
15  *
16  This program is distributed in the hope that it will be useful,
17  but WITHOUT ANY WARRANTY OF ANY KIND WHATSOEVER INCLUDING ANY
18  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
19  See the GNU General Public License for more details.
20  *
21  You should have received a copy of the GNU General Public License
22  along with this program; if not, write to the Free Software
23  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24  *
25  */
26 #ifndef __DIVA_SOFT_DSP_TASK_ENTRY_H__
27 #define __DIVA_SOFT_DSP_TASK_ENTRY_H__
28 /*
29   The soft DSP image is described by binary header contained on begin of this
30   image:
31   OFFSET FROM IMAGE START |  VARIABLE
32   ------------------------------------------------------------------------
33   DIVA_MIPS_TASK_IMAGE_LINK_OFFS   |  link to the next image
34   ----------------------------------------------------------------------
35   DIVA_MIPS_TASK_IMAGE_GP_OFFS    |  image gp register value, void*
36   ----------------------------------------------------------------------
37   DIVA_MIPS_TASK_IMAGE_ENTRY_OFFS   |  diva_mips_sdp_task_entry_t*
38   ----------------------------------------------------------------------
39   DIVA_MIPS_TASK_IMAGE_LOAD_ADDR_OFFS |  image image start address (void*)
40   ----------------------------------------------------------------------
41   DIVA_MIPS_TASK_IMAGE_END_ADDR_OFFS |  image image end address   (void*)
42   ----------------------------------------------------------------------
43   DIVA_MIPS_TASK_IMAGE_ID_STRING_OFFS |  image id string char[...];
44   ----------------------------------------------------------------------
45 */
46 #define DIVA_MIPS_TASK_IMAGE_LINK_OFFS   0x6C
47 #define DIVA_MIPS_TASK_IMAGE_GP_OFFS    0x70
48 #define DIVA_MIPS_TASK_IMAGE_ENTRY_OFFS   0x74
49 #define DIVA_MIPS_TASK_IMAGE_LOAD_ADDR_OFFS 0x78
50 #define DIVA_MIPS_TASK_IMAGE_END_ADDR_OFFS 0x7c
51 #define DIVA_MIPS_TASK_IMAGE_ID_STRING_OFFS 0x80
52 /*
53   This function is called in order to set GP register of this task
54   This function should be always called before any function of the
55   task is called
56 */
57 typedef void (*diva_task_set_prog_gp_proc_t)(void *new_gp);
58 /*
59   This function is called to clear .bss at task initialization step
60 */
61 typedef void (*diva_task_sys_reset_proc_t)(void);
62 /*
63   This function is called in order to provide GP of master call to
64   task, that will be used by calls from the task to the master
65 */
66 typedef void (*diva_task_set_main_gp_proc_t)(void *main_gp);
67 /*
68   This function is called to provide address of 'dprintf' function
69   to the task
70 */
71 typedef word (*diva_prt_proc_t)(char *, ...);
72 typedef void (*diva_task_set_prt_proc_t)(diva_prt_proc_t fn);
73 /*
74   This function is called to set task PID
75 */
76 typedef void (*diva_task_set_pid_proc_t)(dword id);
77 /*
78   This function is called for run-time task init
79 */
80 typedef int (*diva_task_run_time_init_proc_t)(void*, dword);
81 /*
82   This function is called from system scheduler or from timer
83 */
84 typedef void (*diva_task_callback_proc_t)(void);
85 /*
86   This callback is used by task to get current time im mS
87 */
88 typedef dword (*diva_task_get_tick_count_proc_t)(void);
89 typedef void (*diva_task_set_get_time_proc_t)(\
90 	diva_task_get_tick_count_proc_t fn);
91 typedef struct _diva_mips_sdp_task_entry {
92 	diva_task_set_prog_gp_proc_t  set_gp_proc;
93 	diva_task_sys_reset_proc_t   sys_reset_proc;
94 	diva_task_set_main_gp_proc_t  set_main_gp_proc;
95 	diva_task_set_prt_proc_t    set_dprintf_proc;
96 	diva_task_set_pid_proc_t    set_pid_proc;
97 	diva_task_run_time_init_proc_t run_time_init_proc;
98 	diva_task_callback_proc_t    task_callback_proc;
99 	diva_task_callback_proc_t    timer_callback_proc;
100 	diva_task_set_get_time_proc_t  set_get_time_proc;
101 	void *last_entry_proc;
102 } diva_mips_sdp_task_entry_t;
103 /*
104   'last_entry_proc' should be set to zero and is used for future extensuios
105 */
106 typedef struct _diva_mips_sw_task {
107 	diva_mips_sdp_task_entry_t  sdp_entry;
108 	void *sdp_gp_reg;
109 	void *own_gp_reg;
110 } diva_mips_sw_task_t;
111 #if !defined(DIVA_BRI2F_SDP_1_NAME)
112 #define DIVA_BRI2F_SDP_1_NAME "sdp0.2q0"
113 #endif
114 #if !defined(DIVA_BRI2F_SDP_2_NAME)
115 #define DIVA_BRI2F_SDP_2_NAME "sdp1.2q0"
116 #endif
117 #endif
118