//===================================================================== // // VProc.h Date: 2004/12/13 // // Copyright (c) 2004-2024 Simon Southwell. // // This file is part of VProc. // // VProc is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // VProc is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with VProc. If not, see . // //===================================================================== // // Internal header for VProc definitions and data types // //===================================================================== #ifndef _VPROC_H_ #define _VPROC_H_ #include #include #include #include #include #ifndef VP_MAX_NODES #define VP_MAX_NODES 64 #endif // Definitions for accessess #define V_IDLE 0 #define V_WRITE 1 #define V_READ 2 // Error types #define VP_USER_ERR 1 // Indexes for PLI function arguments #define VPNODENUM_ARG 1 #define VPINTERRUPT_ARG 2 #define VPINDEX_ARG 2 #define VPDATAIN_ARG 3 #define VPDATAOUT_ARG 4 #define VPADDR_ARG 5 #define VPRW_ARG 6 #define VPTICKS_ARG 7 #define VPRESTORE_ARG 8 // A default string buffer size #define DEFAULT_STR_BUF_SIZE 32 // Range of valid interrupt states #define MIN_INTERRUPT_LEVEL 1 #define MAX_INTERRUPT_LEVEL 7 // User thread to simulation exchange structure typedef struct { unsigned int addr; unsigned int data_out; unsigned int rw; void *data_p; int ticks; } send_buf_t, *psend_buf_t; // Simulation to user thread exchange structure typedef struct { unsigned int data_in; unsigned int interrupt; } rcv_buf_t, *prcv_buf_t; // Shared object handle typedef typedef void * handle_t; // Callback pointer types typedef int (*pVUserInt_t) (void); typedef int (*pVUserIrqCB_t) (int); typedef int (*pVUserCB_t) (int); // Scheduler node state structure typedef struct { sem_t snd; sem_t rcv; send_buf_t send_buf; rcv_buf_t rcv_buf; pVUserInt_t VInt_table[MAX_INTERRUPT_LEVEL+1]; pVUserIrqCB_t VUserIrqCB; pVUserCB_t VUserCB; } SchedState_t, *pSchedState_t; // Reference to node state array extern pSchedState_t ns[VP_MAX_NODES]; #endif