Home | History | Annotate | Download | only in include
      1 #ifndef FW_PVT_H
      2 #define FW_PVT_H
      3 
      4 #include <stdint.h>
      5 #include "viddec_fw_parser_fw_ipc.h"
      6 #include "viddec_fw_parser_ipclib_config.h"
      7 #include "viddec_emitter.h"
      8 #include "viddec_pm.h"
      9 #include "viddec_fw_debug.h"
     10 
     11 #define GET_IPC_HANDLE(x) (FW_IPC_Handle *)&(x.fwIpc)
     12 #define GV_DDR_MEM_MASK 0x80000000
     13 /* Macros for Interrupts */
     14 #define TRAPS_ENABLE  __asm__ volatile ("mov %%psr, %%l0; or  %%l0,  0x20, %%l0; mov %%l0, %%psr; nop; nop; nop;":::"l0")
     15 #define TRAPS_DISABLE __asm__ volatile ("mov %%psr, %%l0; and %%l0, ~0x20, %%l0; mov %%l0, %%psr; nop; nop; nop;":::"l0")
     16 
     17 #define TRAPS_INT_ENABLE  __asm__ volatile ("mov %%psr, %%l0; and %%l0, ~0xF00, %%l0; mov %%l0, %%psr; nop; nop; nop;":::"l0")
     18 #define TRAPS_INT_DISABLE __asm__ volatile ("mov %%psr, %%l0; or  %%l0,  0xF00, %%l0; mov %%l0, %%psr; nop; nop; nop;":::"l0")
     19 
     20 #define TRAPS_ENABLED(enabled) __asm__ volatile ("mov %%psr, %0; and %0, 0x20, %0": "=r" (enabled):)
     21 
     22 #define TRAPS_INT_DISABLED(enabled) __asm__ volatile ("mov %%psr, %0; and %0, 0xF00, %0": "=r" (enabled):)
     23 
     24 #define VIDDEC_WATCHDOG_COUNTER_MAX    (0x000FFFFF)
     25 
     26 /* Synchronous message buffer, which is shared by both Host and Fw for handling synchronous messages */
     27 typedef struct
     28 {
     29     uint8_t data[CONFIG_IPC_SYNC_MESSAGE_BUF_SIZE];
     30 }mfd_sync_msg_t;
     31 
     32 /* Required Information needed by Parser Kernel for each stream */
     33 typedef struct
     34 {
     35 	uint32_t  ddr_cxt;    /* phys addr of swap space where Parser kernel stores pvt information */
     36 	uint32_t  cxt_size;   /* size of context buffer */
     37 	uint32_t  strm_type;  /* Current stream information*/
     38     uint32_t  wl_time;    /* ticks for processing current workload */
     39     uint32_t  es_time;    /* ticks for processing current workload */
     40     uint32_t  low_watermark; /* On crossing this value we generate low watermark interrupt */
     41     uint8_t   state;      /* Current state of stream ... start(1), stop(0).. */
     42     uint8_t   priority;   /* Priority of current stream Real time or Non real time */
     43     uint8_t   buffered_data;/* Do we have data from past buffer */
     44     uint8_t   pending_interrupt;/* Whether an Interrupt needs to be generated for this stream */
     45 }mfd_stream_info;
     46 
     47 /* Global data for Parser kernel */
     48 typedef struct
     49 {
     50 	int32_t  low_id; /* last scheduled low priority stream id */
     51 	int32_t  high_id;/* last scheduled high priority stream id */
     52 	uint32_t g_parser_tables; /* should point to global_parser_table in DDR */
     53 }mfd_pk_data_t;
     54 
     55 typedef struct
     56 {
     57     ipc_msg_data input;
     58     ipc_msg_data wkld1;
     59     ipc_msg_data wkld2;
     60 	viddec_pm_cxt_t pm;
     61 }mfd_pk_strm_cxt;
     62 
     63 /* This structure defines the layout of local memory */
     64 typedef struct
     65 {
     66     mfd_sync_msg_t  buf;
     67     _IPC_int_state_t int_status[FW_SUPPORTED_STREAMS];
     68     FW_IPC_Handle   fwIpc;
     69     mfd_stream_info stream_info[FW_SUPPORTED_STREAMS];
     70     mfd_pk_data_t   g_pk_data;
     71 	mfd_pk_strm_cxt  srm_cxt;
     72 }dmem_t;
     73 
     74 /* Pvt Functions which will be used by multiple modules */
     75 
     76 static inline void reg_write(uint32_t offset, uint32_t value)
     77 {
     78     *((volatile uint32_t*) (GV_SI_MMR_BASE_ADDRESS + offset)) = value;
     79 }
     80 
     81 static inline uint32_t reg_read(uint32_t offset)
     82 {
     83     uint32_t value=0;
     84     value = *((volatile uint32_t*) (GV_SI_MMR_BASE_ADDRESS + offset));
     85     return value;
     86 }
     87 
     88 
     89 static inline void DEBUG(uint32_t print, uint32_t code, uint32_t val)
     90 {
     91     if(print > 0)
     92     {
     93         DUMP_TO_MEM(code);
     94         DUMP_TO_MEM(val);
     95         dump_ptr = (dump_ptr + 7) & ~0x7;
     96     }
     97 }
     98 
     99 void *memcpy(void *dest, const void *src, uint32_t n);
    100 
    101 void *memset(void *s, int32_t c, uint32_t n);
    102 
    103 uint32_t cp_using_dma(uint32_t ddr_addr, uint32_t local_addr, uint32_t size, char to_ddr, char swap);
    104 
    105 uint32_t set_wdog(uint32_t offset);
    106 
    107 void get_wdog(uint32_t *value);
    108 
    109 void enable_intr(void);
    110 
    111 uint32_t get_total_ticks(uint32_t start, uint32_t end);
    112 
    113 void viddec_fw_init_swap_memory(unsigned int stream_id, unsigned int swap, unsigned int clean);
    114 #endif
    115