/** * @brief The header file for the MB86-API Linux driver(LSI core dependent part) * @since 2009/01/08 * @note None * @attention None * COPYRIGHT FUJITSU LIMITED 2009 */ /* * This program 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 2 of the License, or * (at your option) any later version. */ /****************************************************************************/ #ifndef __FMB_CORE_H__ #define __FMB_CORE_H__ //#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "fmb_drv.h" #include "fmb_hw.h" /********************************************************/ /* Constant definition for ioctl() */ /********************************************************/ /** * Async system command send */ #define FMB_SYS_CMD_SEND_NONE 0 #define FMB_SYS_CMD_SEND_SYNC 1 #define FMB_SYS_CMD_SEND_ASYNC 2 /** * system command ACK receive (for sync mode) */ #define FMB_SYS_CMD_ACK_NONE 0 #define FMB_SYS_CMD_ACK_RECEIVE 1 #define FMB_CMD_TYPE_VIDEO 0x00000000 #define FMB_CMD_TYPE_AUDIO 0x00000001 /********************************************************/ /* Constant definition for MB86 LSI core */ /********************************************************/ /** * register address */ #define FMB_INTERNAL_RAM 0x0 /** * Version Info */ #define FMB_VERSION_BASE 0x10 #define FMB_VERSION_FJ_3 (FMB_VERSION_BASE + 0x00) #define FMB_VERSION_FJ_2 (FMB_VERSION_BASE + 0x02) #define FMB_VERSION_FJ_1 (FMB_VERSION_BASE + 0x04) #define FMB_VERSION_FJ_0 (FMB_VERSION_BASE + 0x06) #define FMB_VERSION_RESERVED0 (FMB_VERSION_BASE + 0x08) #define FMB_VERSION_RESERVED1 (FMB_VERSION_BASE + 0x0A) #define FMB_VERSION_RESERVED2 (FMB_VERSION_BASE + 0x0C) #define FMB_VERSION_RESERVED3 (FMB_VERSION_BASE + 0x0E) /** * System Command */ #define FMB_SYS_CMD_BASE 0x80000 #define FMB_SYS_CMD_DESTINATION_ID (FMB_SYS_CMD_BASE + 0x0) #define FMB_SYS_CMD_CONTINUITY_COUNTER (FMB_SYS_CMD_BASE + 0x2) #define FMB_SYS_CMD_CMD_ID (FMB_SYS_CMD_BASE + 0x4) #define FMB_SYS_CMD_SUB_CMD_ID (FMB_SYS_CMD_BASE + 0x4) #define FMB_SYS_CMD_BODY_00 (FMB_SYS_CMD_BASE + 0x6) /** * System Command ACK */ #define FMB_SYS_CMD_ACK_BASE 0x80020 #define FMB_SYS_CMD_ACK_CONTINUITY_COUNTER (FMB_SYS_CMD_ACK_BASE + 0x2) #define FMB_SYS_CMD_ACK_CACK_ID (FMB_SYS_CMD_ACK_BASE + 0x4) #define FMB_SYS_CMD_ACK_SUB_CACK_ID (FMB_SYS_CMD_ACK_BASE + 0x4) /** * System Message */ #define FMB_SYS_MSG_BASE 0x80040 #define FMB_SYS_MSG_CONTINUITY_COUNTER (FMB_SYS_MSG_BASE + 0x2) #define FMB_SYS_MSG_MSG_ID (FMB_SYS_MSG_BASE + 0x4) #define FMB_SYS_MSG_SUB_MSG_ID (FMB_SYS_MSG_BASE + 0x4) #define FMB_SYS_MSG_BODY_00 (FMB_SYS_MSG_BASE + 0x6) /** * System Message ACK */ #define FMB_SYS_MSG_ACK_BASE 0x80060 #define FMB_SYS_MSG_ACK_DESTINATION_ID (FMB_SYS_MSG_ACK_BASE + 0x0) #define FMB_SYS_MSG_ACK_CONTINUITY_COUNTER (FMB_SYS_MSG_ACK_BASE + 0x2) #define FMB_SYS_MSG_ACK_MACK_ID (FMB_SYS_MSG_ACK_BASE + 0x4) /** * Add Parammeter Multiple */ #define FMB_ADD_PRAM_M_BASE 0x800C0 #define FMB_ADD_PRAM_M_MODE (FMB_ADD_PRAM_M_BASE + 0x0) #define FMB_ADD_PRAM_M_RELOAD (FMB_ADD_PRAM_M_BASE + 0x0) /** * Add Parammeter Video */ #define FMB_ADD_PRAM_V_BASE 0x801E0 #define FMB_ADD_PRAM_V_AB_SEL (FMB_ADD_PRAM_V_BASE + 0x0) #define FMB_ADD_PRAM_V_FIELD (FMB_ADD_PRAM_V_BASE + 0x0) /** * Video Command(A) */ #define FMB_VIDEO_CMD_A_BASE 0x81000 /** * Video Command(B) */ #define FMB_VIDEO_CMD_B_BASE 0x82000 /** * Video Message(A) */ #define FMB_VIDEO_MSG_A_BASE 0x81040 #define FMB_VIDEO_MSG_A_VALID (FMB_VIDEO_MSG_A_BASE + 0x0) #define FMB_VIDEO_MSG_A_CMD_INVALID (FMB_VIDEO_MSG_A_BASE + 0x2) #define FMB_VIDEO_MSG_A_MODE (FMB_VIDEO_MSG_A_BASE + 0x2) #define FMB_VIDEO_MSG_A_ERROR_LEVEL_H (FMB_VIDEO_MSG_A_BASE + 0x8) #define FMB_VIDEO_MSG_A_ERROR_LEVEL_L (FMB_VIDEO_MSG_A_BASE + 0xA) #define FMB_VIDEO_MSG_A_SUBMODE (FMB_VIDEO_MSG_A_BASE + 0x52) #define FMB_VIDEO_MSG_A_VUDATA_LENGTH (FMB_VIDEO_MSG_A_BASE + 0x54) /** * Video Message(B) */ #define FMB_VIDEO_MSG_B_BASE 0x82040 #define FMB_VIDEO_MSG_B_VALID (FMB_VIDEO_MSG_B_BASE + 0x0) #define FMB_VIDEO_MSG_B_CMD_INVALID (FMB_VIDEO_MSG_B_BASE + 0x2) #define FMB_VIDEO_MSG_B_MODE (FMB_VIDEO_MSG_B_BASE + 0x2) #define FMB_VIDEO_MSG_B_ERROR_LEVEL_H (FMB_VIDEO_MSG_B_BASE + 0x8) #define FMB_VIDEO_MSG_B_ERROR_LEVEL_L (FMB_VIDEO_MSG_B_BASE + 0xA) #define FMB_VIDEO_MSG_B_SUBMODE (FMB_VIDEO_MSG_B_BASE + 0x52) #define FMB_VIDEO_MSG_B_VUDATA_LENGTH (FMB_VIDEO_MSG_B_BASE + 0x54) /** * Audio Command(A) */ #define FMB_AUDIO_CMD_A_BASE 0x83000 /** * Audio Command(B) */ #define FMB_AUDIO_CMD_B_BASE 0x83100 /** * Audio Message(A) */ #define FMB_AUDIO_MSG_A_BASE 0x83020 #define FMB_AUDIO_MSG_A_VALID (FMB_AUDIO_MSG_A_BASE + 0x0) /** * Audio Message(B) */ #define FMB_AUDIO_MSG_B_BASE 0x83120 #define FMB_AUDIO_MSG_B_VALID (FMB_AUDIO_MSG_B_BASE + 0x0) /** * VUDATA Info(A) */ #define FMB_VUDATA_INFO_A_BASE 0x81100 /** * VUDATA Info(B) */ #define FMB_VUDATA_INFO_B_BASE 0x82100 /** * Error Info */ #define FMB_ERROR_INFO_BASE 0x80050 #define FMB_ERROR_INFO_M_H (FMB_ERROR_INFO_BASE + 0x00) #define FMB_ERROR_INFO_M_L (FMB_ERROR_INFO_BASE + 0x02) #define FMB_ERROR_INFO_V_H (FMB_ERROR_INFO_BASE + 0x04) #define FMB_ERROR_INFO_V_L (FMB_ERROR_INFO_BASE + 0x06) #define FMB_ERROR_INFO_A_H (FMB_ERROR_INFO_BASE + 0x08) #define FMB_ERROR_INFO_A_L (FMB_ERROR_INFO_BASE + 0x0A) #define FMB_ERROR_INFO_RESERVED0 (FMB_ERROR_INFO_BASE + 0x0C) #define FMB_ERROR_INFO_RESERVED1 (FMB_ERROR_INFO_BASE + 0x0E) /** * Control Register */ #define FMB_BANKSEL 0x90000 #define FMB_API_SETIRQ_TCPU 0x90070 #define FMB_API_SETIRQ_TACK 0x90070 #define FMB_API_IRQST_ALL 0x90074 #define FMB_API_IRQST_TCPU 0x90074 #define FMB_API_IRQST_TACK 0x90074 #define FMB_API_IRQST_VSYNC 0x90074 #define FMB_API_HCPU_IRQEN_TCPU 0x90078 #define FMB_API_HCPU_IRQEN_TACK 0x90078 #define FMB_API_HCPU_IRQEN_VSYNC 0x90078 #define FMB_OUT_DRIVE 0x90108 /** * mask & shift */ #define FMB_SYS_CMD_DESTINATION_ID_MASK 0x000F #define FMB_SYS_CMD_DESTINATION_ID_SHIFT 12 #define FMB_SYS_CMD_CONTINUITY_COUNTER_MASK 0x003F #define FMB_SYS_CMD_CONTINUITY_COUNTER_SHIFT 0 #define FMB_SYS_CMD_CMD_ID_MASK 0x00FF #define FMB_SYS_CMD_CMD_ID_SHIFT 8 #define FMB_SYS_CMD_SUB_CMD_ID_MASK 0x00FF #define FMB_SYS_CMD_SUB_CMD_ID_SHIFT 0 #define FMB_SYS_CMD_BODY_00_MASK 0xFFFF #define FMB_SYS_CMD_BODY_00_SHIFT 0 #define FMB_SYS_CMD_ACK_CONTINUITY_COUNTER_MASK 0x003F #define FMB_SYS_CMD_ACK_CONTINUITY_COUNTER_SHIFT 0 #define FMB_SYS_CMD_ACK_CACK_ID_MASK 0x00FF #define FMB_SYS_CMD_ACK_CACK_ID_SHIFT 8 #define FMB_SYS_CMD_ACK_SUB_CACK_ID_MASK 0x00FF #define FMB_SYS_CMD_ACK_SUB_CACK_ID_SHIFT 0 #define FMB_SYS_MSG_CONTINUITY_COUNTER_MASK 0x003F #define FMB_SYS_MSG_CONTINUITY_COUNTER_SHIFT 0 #define FMB_SYS_MSG_MSG_ID_MASK 0x00FF #define FMB_SYS_MSG_MSG_ID_SHIFT 8 #define FMB_SYS_MSG_SUB_MSG_ID_MASK 0x00FF #define FMB_SYS_MSG_SUB_MSG_ID_SHIFT 0 #define FMB_SYS_MSG_BODY_00_MASK 0xFFFF #define FMB_SYS_MSG_BODY_00_SHIFT 0 #define FMB_SYS_MSG_ACK_DESTINATION_ID_MASK 0x000F #define FMB_SYS_MSG_ACK_DESTINATION_ID_SHIFT 12 #define FMB_SYS_MSG_ACK_CONTINUITY_COUNTER_MASK 0x003F #define FMB_SYS_MSG_ACK_CONTINUITY_COUNTER_SHIFT 0 #define FMB_SYS_MSG_ACK_MACK_ID_MASK 0x00FF #define FMB_SYS_MSG_ACK_MACK_ID_SHIFT 8 #define FMB_ADD_PRAM_M_MODE_MASK 0x00FF #define FMB_ADD_PRAM_M_MODE_SHIFT 0 #define FMB_ADD_PRAM_M_RELOAD_MASK 0x00FF #define FMB_ADD_PRAM_M_RELOAD_SHIFT 8 #define FMB_ADD_PRAM_V_AB_SEL_MASK 0x0001 #define FMB_ADD_PRAM_V_AB_SEL_SHIFT 0 #define FMB_VIDEO_MSG_A_VALID_MASK 0x0001 #define FMB_VIDEO_MSG_A_VALID_SHIFT 15 #define FMB_VIDEO_MSG_B_VALID_MASK 0x0001 #define FMB_VIDEO_MSG_B_VALID_SHIFT 15 #define FMB_VIDEO_MSG_A_CMD_INVALID_MASK 0x0001 #define FMB_VIDEO_MSG_A_CMD_INVALID_SHIFT 14 #define FMB_VIDEO_MSG_B_CMD_INVALID_MASK 0x0001 #define FMB_VIDEO_MSG_B_CMD_INVALID_SHIFT 14 #define FMB_VIDEO_MSG_A_MODE_MASK 0x00FF #define FMB_VIDEO_MSG_A_MODE_SHIFT 0 #define FMB_VIDEO_MSG_B_MODE_MASK 0x00FF #define FMB_VIDEO_MSG_B_MODE_SHIFT 0 #define FMB_VIDEO_MSG_A_SEQ_END_MASK 0x0001 #define FMB_VIDEO_MSG_A_SEQ_END_SHIFT 2 #define FMB_VIDEO_MSG_B_SEQ_END_MASK 0x0001 #define FMB_VIDEO_MSG_B_SEQ_END_SHIFT 2 #define FMB_VIDEO_MSG_A_FRAME_UPDATE_FLAG_MASK 0x0001 #define FMB_VIDEO_MSG_A_FRAME_UPDATE_FLAG_SHIFT 0 #define FMB_VIDEO_MSG_B_FRAME_UPDATE_FLAG_MASK 0x0001 #define FMB_VIDEO_MSG_B_FRAME_UPDATE_FLAG_SHIFT 0 #define FMB_VIDEO_MSG_A_ERROR_LEVEL_H_MASK 0xFFFF #define FMB_VIDEO_MSG_A_ERROR_LEVEL_H_SHIFT 0 #define FMB_VIDEO_MSG_A_ERROR_LEVEL_L_MASK 0xFFFF #define FMB_VIDEO_MSG_A_ERROR_LEVEL_L_SHIFT 0 #define FMB_VIDEO_MSG_B_ERROR_LEVEL_H_MASK 0xFFFF #define FMB_VIDEO_MSG_B_ERROR_LEVEL_H_SHIFT 0 #define FMB_VIDEO_MSG_B_ERROR_LEVEL_L_MASK 0xFFFF #define FMB_VIDEO_MSG_B_ERROR_LEVEL_L_SHIFT 0 #define FMB_VIDEO_MSG_A_SUBMODE_MASK 0x0003 #define FMB_VIDEO_MSG_A_SUBMODE_SHIFT 0 #define FMB_VIDEO_MSG_B_SUBMODE_MASK 0x0003 #define FMB_VIDEO_MSG_B_SUBMODE_SHIFT 0 #define FMB_VIDEO_MSG_A_VUDATA_LENGTH_MASK 0x00FF #define FMB_VIDEO_MSG_A_VUDATA_LENGTH_SHIFT 0 #define FMB_VIDEO_MSG_B_VUDATA_LENGTH_MASK 0x00FF #define FMB_VIDEO_MSG_B_VUDATA_LENGTH_SHIFT 0 #define FMB_AUDIO_MSG_A_VALID_MASK 0x0001 #define FMB_AUDIO_MSG_A_VALID_SHIFT 15 #define FMB_AUDIO_MSG_B_VALID_MASK 0x0001 #define FMB_AUDIO_MSG_B_VALID_SHIFT 15 #define FMB_API_SETIRQ_TCPU_MASK 0x0001 #define FMB_API_SETIRQ_TCPU_SHIFT 2 #define FMB_API_SETIRQ_TACK_MASK 0x0001 #define FMB_API_SETIRQ_TACK_SHIFT 3 #define FMB_API_IRQST_TCPU_MASK 0x0001 #define FMB_API_IRQST_TCPU_SHIFT 2 #define FMB_API_IRQST_TACK_MASK 0x0001 #define FMB_API_IRQST_TACK_SHIFT 3 #define FMB_API_IRQST_VSYNC_MASK 0x0001 #define FMB_API_IRQST_VSYNC_SHIFT 4 #define FMB_API_HCPU_IRQEN_TCPU_MASK 0x0001 #define FMB_API_HCPU_IRQEN_TCPU_SHIFT 2 #define FMB_API_HCPU_IRQEN_TACK_MASK 0x0001 #define FMB_API_HCPU_IRQEN_TACK_SHIFT 3 #define FMB_API_HCPU_IRQEN_VSYNC_MASK 0x0001 #define FMB_API_HCPU_IRQEN_VSYNC_SHIFT 4 #define FMB_ADD_PRAM_V_FIELD_MASK 0x0001 #define FMB_ADD_PRAM_V_FIELD_SHIFT 15 /** * Register value */ #define FMB_API_IRQST_TCPU_IRQ 1 #define FMB_API_IRQST_TACK_IRQ 1 #define FMB_API_IRQST_VSYNC_IRQ 1 #define FMB_API_SETIRQ_TCPU_SET 1 #define FMB_API_SETIRQ_TACK_SET 1 #define FMB_API_HCPU_IRQEN_TCPU_ENABLE 1 #define FMB_API_HCPU_IRQEN_TCPU_DISABLE 0 #define FMB_API_HCPU_IRQEN_TACK_ENABLE 1 #define FMB_API_HCPU_IRQEN_TACK_DISABLE 0 #define FMB_API_HCPU_IRQEN_VSYNC_ENABLE 1 #define FMB_API_HCPU_IRQEN_VSYNC_DISABLE 0 #define FMB_SYS_CMD_ACK_ID_CHECK 0x00 #define FMB_SYS_CMD_ACK_ID_RESET 0x02 #define FMB_SYS_CMD_ACK_ID_RELOAD 0x04 #define FMB_SYS_CMD_ACK_ID_STREAM 0x0A #define FMB_SYS_CMD_ACK_ID_ERROR 0x80 #define FMB_SYS_CMD_ACK_SUB_ID_TRUE 0x00 #define FMB_SYS_CMD_ACK_SUB_ID_FALSE 0x80 #define FMB_SYS_CMD_DESTINATION_ID_SET 0x0 #define FMB_SYS_MSG_ACK_DESTINATION_ID_SET 0x3 #define FMB_OUT_DRIVE_VALUE 0x0100 #define FMB_CODEC_BANKSEL_FIRM_DOWNLOAD_BASE 0x4200 #define FMB_CODEC_BANKSEL_AFTER_BOOTUP 0x0000 #define FMB_CMD_VIDEO_VAILID_ON 0x8000 #define FMB_CMD_AUDIO_VAILID_ON 0x8000 #define FMB_CMD_VIDEO_VAILID_OFF 0x0000 #define FMB_CMD_AUDIO_VAILID_OFF 0x0000 #define FMB_CMD_VIDEO_ENCODE_STOP 0x00 #define FMB_CMD_VIDEO_ENCODE_START 0x01 #define FMB_CMD_VIDEO_ENCODE_NULL 0x02 #define FMB_ADD_PRAM_M_MODE_IDLE 0x00 #define FMB_ADD_PRAM_M_MODE_ENCODE 0x01 #define FMB_ADD_PRAM_M_MODE_DECODE 0x11 #define FMB_ADD_PRAM_V_AB_SEL_A 0x1 #define FMB_ADD_PRAM_V_AB_SEL_B 0x0 #define FMB_ADD_PRAM_V_FIELD_TOP 0x0 #define FMB_ADD_PRAM_V_FIELD_BOTTOM 0x1 /** * size define */ #define FMB_CODEC_BANK_SIZE (512 * 1024) #define FMB_CMD_SYS_INFO_SIZE 0x10 #define FMB_CMD_VIDEO_INFO_SIZE 0x200 #define FMB_CMD_AUDIO_INFO_SIZE 0x1e /** * DMA status */ #define FMB_DMA_STOP 0 /* stop */ #define FMB_DMA_START 1 /* executing */ #define FMB_DMA_END_WAIT 2 /* waiting for end */ #define FMB_DMA_END 3 /* end */ /** * DMA buffer */ #define FMB_DMA_SND_BUF_CNT 1 #define FMB_DMA_RCV_BUF_CNT 24 #define FMB_DMA_SND_BUF_SIZE (64*1024) #define FMB_DMA_RCV_BUF_SIZE (128*1024) /** * DMA count */ #define FMB_DATA_DMACOUNT_MIN 0x00000000 #define FMB_DATA_DMACOUNT_READ_DEF 0x00000003 #define FMB_DATA_DMACOUNT_WRITE_DEF 0x00000003 #define FMB_DATA_DMACOUNT_MAX 0x00000180 /********************************************************/ /* Macro definition (Register Field R/W) */ /********************************************************/ #define SWAPW(x) (((x>>8)&0x00ff) | ((x<<8)&0xff00)) #define FMB_LSI_REG_FIELD_READ(hw_priv_p, name) \ ((Fmb_hw_reg_read_lsi(hw_priv_p, name) >> name##_SHIFT) & name##_MASK) #define FMB_LSI_REG_FIELD_WRITE(hw_priv_p, name, value) \ Fmb_hw_reg_rmw_lsi(hw_priv_p, name, name##_SHIFT, name##_MASK, value) /********************************************************/ /* Structure definition */ /********************************************************/ /** * system message buffer */ struct fmb_sys_msg_buf { struct fmb_msg_sys_info msg; struct fmb_sys_msg_buf* next_p; }; /** * video message buffer */ struct fmb_video_msg_buf { struct fmb_msg_video_info msg; struct fmb_video_msg_buf* next_p; }; /** * audio message buffer */ struct fmb_audio_msg_buf { struct fmb_msg_audio_info msg; struct fmb_audio_msg_buf* next_p; }; /** * system command ACK buffer */ struct fmb_cmd_ack_sys_buf { struct fmb_cmd_ack_sys_info cack; struct fmb_cmd_ack_sys_buf* next_p; }; /** * XERROR info buffer */ struct fmb_xerror_info_buf { struct fmb_async_info msg; struct fmb_xerror_info_buf* next_p; }; /** * VUDATA info buffer */ struct fmb_vudata_info_buf { struct fmb_async_info msg; struct fmb_vudata_info_buf* next_p; }; /** * EDERR info buffer */ struct fmb_ederr_info_buf { struct fmb_async_info msg; struct fmb_ederr_info_buf* next_p; }; /** * DDERR info buffer */ struct fmb_dderr_info_buf { struct fmb_async_info msg; struct fmb_dderr_info_buf* next_p; }; /** * system comand buffer */ struct fmb_sys_cmd_info { unsigned short reg[FMB_CMD_SYS_INFO_SIZE]; void* distinct; unsigned short sync; }; struct fmb_sys_cmd_buf { struct fmb_sys_cmd_info cmd; struct fmb_sys_cmd_buf* next_p; }; /** * video comand buffer */ struct fmb_video_cmd_info { unsigned short reg[FMB_CMD_VIDEO_INFO_SIZE]; }; struct fmb_video_cmd_buf { struct fmb_video_cmd_info cmd; struct fmb_video_cmd_buf* next_p; }; /** * audio comand buffer */ struct fmb_audio_cmd_info { unsigned short reg[FMB_CMD_AUDIO_INFO_SIZE]; }; struct fmb_audio_cmd_buf { struct fmb_audio_cmd_info cmd; struct fmb_audio_cmd_buf* next_p; }; /** * DMA buffer */ struct fmb_dma_buf { char* addr_l; /**< logical address */ dma_addr_t addr_p; /**< physical address */ unsigned long trans_size; /**< size to be transferred */ unsigned long copy_size; /**< size copied */ struct fmb_dma_buf* next_p; /**< pointer to the next buffer */ }; /** * system message buffer queue */ struct fmb_msg_sys_queue { spinlock_t lock; /**< spin lock */ int isactive; /**< active flag */ wait_queue_head_t waitq; /**< wait queue */ int b_num; /**< using buffer number */ int f_num; /**< number of free buffers */ struct fmb_sys_msg_buf* b_head_p; /**< head of a busy buffer */ struct fmb_sys_msg_buf* b_tail_p; /**< tail of a busy buffer */ struct fmb_sys_msg_buf* f_head_p; /**< head of a empty buffer */ struct fmb_sys_msg_buf* f_tail_p; /**< tail of a empty buffer */ struct fmb_sys_msg_buf msg_buf[FMB_MSG_BUF_SIZE]; /**< message buffer list */ }; /** * video message buffer queue */ struct fmb_msg_video_queue { spinlock_t lock; /**< spin lock */ int isactive; /**< active flag */ wait_queue_head_t waitq; /**< wait queue */ int b_num; /**< using buffer number */ int f_num; /**< number of free buffers */ struct fmb_video_msg_buf* b_head_p; /**< head of a busy buffer */ struct fmb_video_msg_buf* b_tail_p; /**< tail of a busy buffer */ struct fmb_video_msg_buf* f_head_p; /**< head of a empty buffer */ struct fmb_video_msg_buf* f_tail_p; /**< tail of a empty buffer */ struct fmb_video_msg_buf msg_buf[FMB_MSG_BUF_SIZE]; /**< message buffer list */ }; /** * audio message buffer queue */ struct fmb_msg_audio_queue { spinlock_t lock; /**< spin lock */ int isactive; /**< active flag */ wait_queue_head_t waitq; /**< wait queue */ int b_num; /**< using buffer number */ int f_num; /**< number of free buffers */ struct fmb_audio_msg_buf* b_head_p; /**< head of a busy buffer */ struct fmb_audio_msg_buf* b_tail_p; /**< tail of a busy buffer */ struct fmb_audio_msg_buf* f_head_p; /**< head of a empty buffer */ struct fmb_audio_msg_buf* f_tail_p; /**< tail of a empty buffer */ struct fmb_audio_msg_buf msg_buf[FMB_MSG_BUF_SIZE]; /**< message buffer list */ }; /** * system command ACK buffer queue */ struct fmb_cmd_ack_sys_queue { spinlock_t lock; /**< spin lock */ int isactive; /**< active flag */ wait_queue_head_t waitq; /**< wait queue */ int b_num; /**< using buffer number */ int f_num; /**< number of free buffers */ struct fmb_cmd_ack_sys_buf* b_head_p; /**< head of a busy buffer */ struct fmb_cmd_ack_sys_buf* b_tail_p; /**< tail of a busy buffer */ struct fmb_cmd_ack_sys_buf* f_head_p; /**< head of a empty buffer */ struct fmb_cmd_ack_sys_buf* f_tail_p; /**< tail of a empty buffer */ struct fmb_cmd_ack_sys_buf msg_buf[FMB_MSG_BUF_SIZE]; /**< message buffer list */ }; /** * xerror info buffer queue */ struct fmb_xerror_info_queue { spinlock_t lock; /**< spin lock */ int isactive; /**< active flag */ wait_queue_head_t waitq; /**< wait queue */ int b_num; /**< using buffer number */ int f_num; /**< number of free buffers */ struct fmb_xerror_info_buf* b_head_p; /**< head of a busy buffer */ struct fmb_xerror_info_buf* b_tail_p; /**< tail of a busy buffer */ struct fmb_xerror_info_buf* f_head_p; /**< head of a empty buffer */ struct fmb_xerror_info_buf* f_tail_p; /**< tail of a empty buffer */ struct fmb_xerror_info_buf msg_buf[FMB_MSG_BUF_SIZE]; /**< message buffer list */ }; /** * vudata buffer queue */ struct fmb_vudata_info_queue { spinlock_t lock; /**< spin lock */ int isactive; /**< active flag */ wait_queue_head_t waitq; /**< wait queue */ int b_num; /**< using buffer number */ int f_num; /**< number of free buffers */ struct fmb_vudata_info_buf* b_head_p; /**< head of a busy buffer */ struct fmb_vudata_info_buf* b_tail_p; /**< tail of a busy buffer */ struct fmb_vudata_info_buf* f_head_p; /**< head of a empty buffer */ struct fmb_vudata_info_buf* f_tail_p; /**< tail of a empty buffer */ struct fmb_vudata_info_buf msg_buf[FMB_MSG_BUF_SIZE]; /**< message buffer list */ }; /** * ederr info buffer queue */ struct fmb_ederr_info_queue { spinlock_t lock; /**< spin lock */ int isactive; /**< active flag */ wait_queue_head_t waitq; /**< wait queue */ int b_num; /**< using buffer number */ int f_num; /**< number of free buffers */ struct fmb_ederr_info_buf* b_head_p; /**< head of a busy buffer */ struct fmb_ederr_info_buf* b_tail_p; /**< tail of a busy buffer */ struct fmb_ederr_info_buf* f_head_p; /**< head of a empty buffer */ struct fmb_ederr_info_buf* f_tail_p; /**< tail of a empty buffer */ struct fmb_ederr_info_buf msg_buf[FMB_MSG_BUF_SIZE]; /**< message buffer list */ }; /** * ederr info buffer queue */ struct fmb_dderr_info_queue { spinlock_t lock; /**< spin lock */ int isactive; /**< active flag */ wait_queue_head_t waitq; /**< wait queue */ int b_num; /**< using buffer number */ int f_num; /**< number of free buffers */ struct fmb_dderr_info_buf* b_head_p; /**< head of a busy buffer */ struct fmb_dderr_info_buf* b_tail_p; /**< tail of a busy buffer */ struct fmb_dderr_info_buf* f_head_p; /**< head of a empty buffer */ struct fmb_dderr_info_buf* f_tail_p; /**< tail of a empty buffer */ struct fmb_dderr_info_buf msg_buf[FMB_MSG_BUF_SIZE]; /**< message buffer list */ }; /** * system command buffer queue */ struct fmb_cmd_sys_queue { spinlock_t lock; /**< spin lock */ int isactive; /**< active flag */ wait_queue_head_t waitq; /**< wait queue */ int b_num; /**< using buffer number */ int f_num; /**< number of free buffers */ struct fmb_sys_cmd_buf* b_head_p; /**< head of a busy buffer */ struct fmb_sys_cmd_buf* b_tail_p; /**< tail of a busy buffer */ struct fmb_sys_cmd_buf* f_head_p; /**< head of a empty buffer */ struct fmb_sys_cmd_buf* f_tail_p; /**< tail of a empty buffer */ struct fmb_sys_cmd_buf cmd_buf[FMB_CMD_BUF_SIZE]; /**< command buffer list */ }; /** * video command buffer queue */ struct fmb_cmd_video_queue { spinlock_t lock; /**< spin lock */ int isactive; /**< active flag */ wait_queue_head_t waitq; /**< wait queue */ int b_num; /**< using buffer number */ int f_num; /**< number of free buffers */ struct fmb_video_cmd_buf* b_head_p; /**< head of a busy buffer */ struct fmb_video_cmd_buf* b_tail_p; /**< tail of a busy buffer */ struct fmb_video_cmd_buf* f_head_p; /**< head of a empty buffer */ struct fmb_video_cmd_buf* f_tail_p; /**< tail of a empty buffer */ struct fmb_video_cmd_buf cmd_buf[FMB_CMD_BUF_SIZE]; /**< command buffer list */ }; /** * audio command buffer queue */ struct fmb_cmd_audio_queue { spinlock_t lock; /**< spin lock */ int isactive; /**< active flag */ wait_queue_head_t waitq; /**< wait queue */ int b_num; /**< using buffer number */ int f_num; /**< number of free buffers */ struct fmb_audio_cmd_buf* b_head_p; /**< head of a busy buffer */ struct fmb_audio_cmd_buf* b_tail_p; /**< tail of a busy buffer */ struct fmb_audio_cmd_buf* f_head_p; /**< head of a empty buffer */ struct fmb_audio_cmd_buf* f_tail_p; /**< tail of a empty buffer */ struct fmb_audio_cmd_buf cmd_buf[FMB_CMD_BUF_SIZE]; /**< command buffer list */ }; /** * DMA buffer queue(common) */ struct fmb_dma_queue { int dma_status; /**< DMA status */ struct fmb_dma_buf* dma_data_p; /**< buffer used for DMA */ struct fmb_dma_buf* copy_data_p; /**< buffer used for copying data */ wait_queue_head_t buf_waitq; /**< wait queue for free DMA buffer */ wait_queue_head_t comp_waitq; /**< wait queue for DMA completion of all data */ struct fmb_dma_buf* b_head_p; /**< head of busy buffer queue */ struct fmb_dma_buf* b_tail_p; /**< tail of busy buffer queue */ struct fmb_dma_buf* f_head_p; /**< head of free buffer queue */ struct fmb_dma_buf* f_tail_p; /**< tail of busy buffer queue */ int b_num; /**< number of busy buffers */ int f_num; /**< number of free buffers */ }; /** * DMA send buffer queue */ struct fmb_dma_snd_queue { struct semaphore mutex_write; /**< mutex for write */ spinlock_t lock; /**< spin lock */ int isactive; /**< active flag */ struct fmb_dma_queue dma_queue; /**< DMA queue */ struct fmb_dma_buf buf[FMB_DMA_SND_BUF_CNT]; /**< DMA buffer array */ }; /** * DMA receive buffer queue */ struct fmb_dma_rcv_queue { struct semaphore mutex_read; /**< mutex for read */ spinlock_t lock; /**< spin lock */ int isactive; /**< active flag */ struct fmb_dma_queue dma_queue; /**< DMA queue */ struct fmb_dma_buf buf[FMB_DMA_RCV_BUF_CNT]; /**< DMA buffer array */ unsigned long dma_comp_size; /**< total size of DMA(byte) */ wait_queue_head_t comp_waitq; /**< wait queue for DMA completion */ }; /** * @brief The MB86-LSI-dependent part of private data
* @note None * @attention None */ struct fmb_core_private { spinlock_t lock_core_priv; /**< spin lock for this private data */ unsigned char sys_cmd_continuity_counter; /**< continuity counter of system command */ int firm_write_redy; /**< whether or not the driver can download firmware */ unsigned long firm_write_size; /**< total size of downloaded firmware */ unsigned int encode_mode; unsigned int notify_mode; unsigned int system_status; int sys_cmd_ack_rcv_flag; int sys_cmd_send_flag; void* sys_cmd_distinct_p; struct fmb_cmd_ack_sys_info sys_cmd_ack_info; /**< system command ack info */ /* check message info */ unsigned short* check_msg_sys_info_p; /**< check buffer for system message */ unsigned short* check_msg_video_info_p; /**< check buffer for video message */ unsigned short* check_msg_audio_info_p; /**< check buffer for audio message */ unsigned short* check_vudata_info_p; /**< check buffer for VUDATA info */ /* sync command info */ unsigned short* sync_cmd_video_info_p; /**< video commando info */ unsigned short* sync_cmd_audio_info_p; /**< audio commando info */ /* message buffer queue */ spinlock_t lock_factor_num; /**< spin lock for factor_num */ int factor_num; struct fmb_msg_sys_queue msg_sys_queue; /**< buffer queue for system message */ struct fmb_msg_video_queue msg_video_queue; /**< buffer queue for video message */ struct fmb_msg_audio_queue msg_audio_queue; /**< buffer queue for audio message */ struct fmb_cmd_ack_sys_queue cmd_cack_sys_queue; /**< buffer queue for system command ack */ struct fmb_xerror_info_queue xerror_info_queue; /**< buffer queue for XERROR info */ struct fmb_vudata_info_queue vudata_info_queue; /**< buffer queue for VUDATA info */ struct fmb_ederr_info_queue ederr_info_queue; /**< buffer queue for EDERR info */ struct fmb_dderr_info_queue dderr_info_queue; /**< buffer queue for DDERR info */ /* command buffer queue */ struct fmb_cmd_sys_queue cmd_sys_queue; /**< buffer queue for system command */ struct fmb_cmd_video_queue cmd_video_queue; /**< buffer queue for video command */ struct fmb_cmd_audio_queue cmd_audio_queue; /**< buffer queue for audio command */ /* Low Level mode only */ int factor_irq; /* DMA buffer queue */ struct fmb_dma_snd_queue dma_snd_queue; /**< buffer queue for DMA send */ struct fmb_dma_rcv_queue dma_rcv_queue; /**< buffer queue for DMA receive */ /* waitqueue */ wait_queue_head_t sys_cmd_ack_wait; /**< wait queue for system command ACK */ wait_queue_head_t sys_cmd_ack_wait_sync; /**< wait queue for system command ACK(SYNC mode) */ wait_queue_head_t sys_msg_wait; /**< wait queue for system message */ wait_queue_head_t video_msg_wait; /**< wait queue for video message */ wait_queue_head_t audio_msg_wait; /**< wait queue for audio message */ wait_queue_head_t xerror_info_wait; /**< wait queue for XERROR */ wait_queue_head_t vudata_info_wait; /**< wait queue for VUDATA */ wait_queue_head_t ederr_info_wait; /**< wait queue for EDERR */ wait_queue_head_t dderr_info_wait; /**< wait queue for DDERR */ /* tasklet */ struct tasklet_struct xerror_tasklet; /**< tasklet for XERROR interrupt */ struct tasklet_struct tcpu_tasklet; /**< tasklet for TCPU interrupt */ struct tasklet_struct tack_tasklet; /**< tasklet for TACK interrupt */ struct tasklet_struct vsync_tasklet; /**< tasklet for VSYNC interrupt */ struct tasklet_struct cmd_sys_tasklet; /**< tasklet for system command */ struct tasklet_struct dma_comp_snd_tasklet; /**< tasklet for DMA(send) completion interrupt */ struct tasklet_struct dma_comp_rcv_tasklet; /**< tasklet for DMA(receive) completion interrupt */ struct tasklet_struct ederr_tasklet; /**< tasklet for EDERR interrupt */ struct tasklet_struct dderr_tasklet; /**< tasklet for DDERR interrupt */ /* DMA Timer */ unsigned int read_dma_flg; /**< whether or not timeout for DMA(receive) is specified */ unsigned int read_dma_count; /**< timeout count for DMA(receive) */ unsigned int write_dma_flg; /**< whether or not timeout for DMA(send) is specified */ unsigned int write_dma_count; /**< timeout count for DMA(send) */ unsigned int irqst_clear_flg; /**< Flag that clears IRQ register */ unsigned int vsync_mode ; struct semaphore sys_cmd_sync_send_mutex; /**< mutex for system command */ int minor; /**< minor number */ struct fmb_hard_private* hw_priv_p; /**< pointer to the HW private data */ }; /********************************************************/ /* External Function */ /********************************************************/ /** * @brief Clears all DMA channels. * @param[in] priv_p the pointer to the core private data * @return None * @note None * @attention None */ void Fmb_core_clear_dma_all( struct fmb_core_private* priv_p ); /** * @brief Clears the DMA channel(HOST -> LSI). * @param[in] priv_p the pointer to the core private data * @return None * @note None * @attention None */ void Fmb_core_clear_dma_snd( struct fmb_core_private* priv_p ); /** * @brief Clears the DMA channel(LSI -> HOST). * @param[in] priv_p the pointer to the core private data * @return None * @note None * @attention None */ void Fmb_core_clear_dma_rcv( struct fmb_core_private* priv_p ); /** * @brief Enables the DMA channel(HOST -> LSI). * @param[in] priv_p the pointer to the core private data * @return None * @note None * @attention None */ void Fmb_core_enable_dma_snd( struct fmb_core_private* priv_p ); /** * @brief Enables the DMA channel(LSI -> HOST). * @param[in] priv_p the pointer to the core private data * @return None * @note None * @attention None */ void Fmb_core_enable_dma_rcv( struct fmb_core_private* priv_p ); /** * @brief Dequeues a busy DMA buffer from the buffer queue. * @param[in] priv_p the pointer to the core private data * @param[in] queue_p the pointer to the buffer queue * @param[in] lock_p the pointer to the spinlock for the buffer queue * @return the pointer to the busy DMA buffer * @note None * @attention None */ struct fmb_dma_buf* Fmb_core_get_busy_dma_buf( struct fmb_core_private* priv_p, struct fmb_dma_queue* queue_p, spinlock_t* lock_p); /** * @brief Dequeues a free DMA buffer from the buffer queue. * @param[in] priv_p the pointer to the core private data * @param[in] queue_p the pointer to the buffer queue * @param[in] lock_p the pointer to the spinlock for the buffer queue * @return the pointer to the free DMA buffer * @note None * @attention None */ struct fmb_dma_buf* Fmb_core_get_free_dma_buf( struct fmb_core_private* priv_p, struct fmb_dma_queue* queue_p, spinlock_t* lock_p); /** * @brief Enqueues the free DMA buffer to the buffer queue. * @param[in] priv_p the pointer to the core private data * @param[in] buf_p the pointer to the free DMA buffer * @param[in] queue_p the pointer to the buffer queue * @param[in] lock_p the pointer to the spinlock for the buffer queue * @return None * @note None * @attention None */ void Fmb_core_add_free_dma_buf( struct fmb_core_private* priv_p, struct fmb_dma_buf* buf_p, struct fmb_dma_queue* queue_p, spinlock_t* lock_p); /** * @brief Enqueues the busy DMA buffer to the buffer queue. * @param[in] priv_p the pointer to the core private data * @param[in] buf_p the pointer to the busy DMA buffer * @param[in] queue_p the pointer to the buffer queue * @param[in] lock_p the pointer to the spinlock for the buffer queue * @return None * @note None * @attention None */ void Fmb_core_add_busy_dma_buf( struct fmb_core_private* priv_p, struct fmb_dma_buf* buf_p, struct fmb_dma_queue* queue_p, spinlock_t* lock_p); /** * @brief Resets the DMA queue(HOST -> LSI). * @param[in] priv_p the pointer to the core private data * @param[in] lock_p the pointer to the spinlock for the DMA queue * @return None * @note None * @attention None */ void Fmb_core_reset_dma_queue_snd( struct fmb_core_private* priv_p, spinlock_t* lock_p ); /** * @brief Resets the DMA queue(LSI -> HOST). * @param[in] priv_p the pointer to the core private data * @param[in] lock_p the pointer to the spinlock for the DMA queue * @return None * @note None * @attention None */ void Fmb_core_reset_dma_queue_rcv( struct fmb_core_private* priv_p, spinlock_t* lock_p ); /** * @brief Starts the DMA access(HOST -> LSI). * @param[in] priv_p the pointer to the core private data * @param[in] lock_p the pointer to the spinlock * @return None * @note None * @attention None */ void Fmb_core_start_dma_snd( struct fmb_core_private* priv_p, spinlock_t* lock_p ); /** * @brief Starts the DMA access(LSI -> HOST). * @param[in] priv_p the pointer to the core private data * @param[in] lock_p the pointer to the spinlock * @return None * @note None * @attention None */ void Fmb_core_start_dma_rcv( struct fmb_core_private* priv_p, spinlock_t* lock_p ); /** * @brief Called from the interrupt handler when the interrupt source
* is DMA(HOST->LSI) completion.
* @param[in] priv_p the pointer to the core private data * @return None * @note None * @attention None */ void Fmb_core_dma_snd_irq( struct fmb_core_private* priv_p ); /** * @brief Called from the interrupt handler when the interrupt source
* is DMA(LSI->HOST) completion.
* @param[in] priv_p the pointer to the core private data * @return None * @note None * @attention None */ void Fmb_core_dma_rcv_irq( struct fmb_core_private* priv_p ); /** * @brief Dequeues a busy system message buffer from the buffer queue. * @param[in] priv_p the pointer to the core private data * @param[in] queue_p the pointer to the buffer queue * @return the pointer to the busy system message buffer * @note None * @attention None */ struct fmb_sys_msg_buf* Fmb_core_get_busy_msg_sys_buf( struct fmb_core_private* priv_p, struct fmb_msg_sys_queue* queue_p ); /** * @brief Enqueues the busy system message buffer
* to the buffer queue. * @param[in] priv_p the pointer to the core private data * @param[in] queue_p the pointer to the buffer queue * @param[in] buf_p the pointer to the system message buffer * @return None * @note None * @attention None */ void Fmb_core_add_busy_msg_sys_buf( struct fmb_core_private* priv_p, struct fmb_msg_sys_queue* queue_p, struct fmb_sys_msg_buf* buf_p ); /** * @brief Dequeues a free system message buffer from the buffer queue. * @param[in] priv_p the pointer to the core private data * @param[in] queue_p the pointer to the buffer queue * @return the pointer to the free system message buffer * @note None * @attention None */ struct fmb_sys_msg_buf* Fmb_core_get_free_msg_sys_buf( struct fmb_core_private* priv_p, struct fmb_msg_sys_queue* queue_p ); /** * @brief Enqueues the free system message buffer to
* the buffer queue. * @param[in] priv_p the pointer to the core private data * @param[in] queue_p the pointer to the buffer queue * @param[in] buf_p the pointer to the system message buffer * @return None * @note None * @attention None */ void Fmb_core_add_free_msg_sys_buf( struct fmb_core_private* priv_p, struct fmb_msg_sys_queue* queue_p, struct fmb_sys_msg_buf* buf_p ); /** * @brief Resets the system message buffer queue. * @param[in] priv_p the pointer to the core private data * @param[in] queue_p the pointer to the buffer queue * @return None * @note None * @attention None */ void Fmb_core_reset_msg_sys_buf( struct fmb_core_private* priv_p, struct fmb_msg_sys_queue* queue_p ); /** * @brief Initializes the system message buffer queue. * @param[in] priv_p the pointer to the core private data * @param[in] queue_p the pointer to the buffer queue * @return None * @note None * @attention None */ void Fmb_core_init_msg_sys_buf( struct fmb_core_private* priv_p, struct fmb_msg_sys_queue* queue_p ); /** * @brief Dequeues a busy video message buffer from the buffer queue. * @param[in] priv_p the pointer to the core private data * @param[in] queue_p the pointer to the buffer queue * @return the pointer to the busy video message buffer * @note None * @attention None */ struct fmb_video_msg_buf* Fmb_core_get_busy_msg_video_buf( struct fmb_core_private* priv_p, struct fmb_msg_video_queue* queue_p ); /** * @brief Enqueues the busy video message buffer
* to the buffer queue. * @param[in] priv_p the pointer to the core private data * @param[in] queue_p the pointer to the buffer queue * @param[in] buf_p the pointer to the video message buffer * @return None * @note None * @attention None */ void Fmb_core_add_busy_msg_video_buf( struct fmb_core_private* priv_p, struct fmb_msg_video_queue* queue_p, struct fmb_video_msg_buf* buf_p ); /** * @brief Dequeues a free video message buffer from the buffer queue. * @param[in] priv_p the pointer to the core private data * @param[in] queue_p the pointer to the buffer queue * @return the pointer to the free video message buffer * @note None * @attention None */ struct fmb_video_msg_buf* Fmb_core_get_free_msg_video_buf( struct fmb_core_private* priv_p, struct fmb_msg_video_queue* queue_p ); /** * @brief Enqueues the free video message buffer to
* the buffer queue. * @param[in] priv_p the pointer to the core private data * @param[in] queue_p the pointer to the buffer queue * @param[in] buf_p the pointer to the video message buffer * @return None * @note None * @attention None */ void Fmb_core_add_free_msg_video_buf( struct fmb_core_private* priv_p, struct fmb_msg_video_queue* queue, struct fmb_video_msg_buf* buf_p ); /** * @brief Resets the video message buffer queue. * @param[in] priv_p the pointer to the core private data * @param[in] queue_p the pointer to the buffer queue * @return None * @note None * @attention None */ void Fmb_core_reset_msg_video_buf( struct fmb_core_private* priv_p, struct fmb_msg_video_queue* queue_p); /** * @brief Initializes the video message buffer queue. * @param[in] priv_p the pointer to the core private data * @param[in] queue_p the pointer to the buffer queue * @return 0 success * @return -1 fail * @note None * @attention None */ int Fmb_core_init_msg_video_buf( struct fmb_core_private* priv_p, struct fmb_msg_video_queue* queue_p ); /** * @brief Releases the video message buffer queue. * @param[in] priv_p the pointer to the core private data * @param[in] queue_p the pointer to the buffer queue * @return None * @note None * @attension None */ void Fmb_core_release_msg_video_buf( struct fmb_core_private* priv_p, struct fmb_msg_video_queue* queue_p ); /** * @brief Dequeues a busy audio message buffer from the buffer queue. * @param[in] priv_p the pointer to the core private data * @param[in] queue_p the pointer to the buffer queue * @return the pointer to the busy audio message buffer * @note None * @attention None */ struct fmb_audio_msg_buf* Fmb_core_get_busy_msg_audio_buf( struct fmb_core_private* priv_p, struct fmb_msg_audio_queue* queue_p ); /** * @brief Enqueues the busy audio message buffer
* to the buffer queue. * @param[in] priv_p the pointer to the core private data * @param[in] queue_p the pointer to the buffer queue * @param[in] buf_p the pointer to the audio message buffer * @return None * @note None * @attention None */ void Fmb_core_add_busy_msg_audio_buf( struct fmb_core_private* priv_p, struct fmb_msg_audio_queue* queue_p, struct fmb_audio_msg_buf* buf_p ); /** * @brief Dequeues a free audio message buffer from the buffer queue. * @param[in] priv_p the pointer to the core private data * @param[in] queue_p the pointer to the buffer queue * @return the pointer to the free audio message buffer * @note None * @attention None */ struct fmb_audio_msg_buf* Fmb_core_get_free_msg_audio_buf( struct fmb_core_private* priv_p, struct fmb_msg_audio_queue* queue_p); /** * @brief Enqueues the free audio message buffer to
* the buffer queue. * @param[in] priv_p the pointer to the core private data * @param[in] queue_p the pointer to the buffer queue * @param[in] buf_p the pointer to the audio message buffer * @return None * @note None * @attention None */ void Fmb_core_add_free_msg_audio_buf( struct fmb_core_private* priv_p, struct fmb_msg_audio_queue* queue_p, struct fmb_audio_msg_buf* buf_p ); /** * @brief Resets the audio message buffer queue. * @param[in] priv_p the pointer to the core private data * @param[in] queue_p the pointer to the buffer queue * @return None * @note None * @attention None */ void Fmb_core_reset_msg_audio_buf( struct fmb_core_private* priv_p, struct fmb_msg_audio_queue* queue_p ); /** * @brief Initializes the audio message buffer queue. * @param[in] priv_p the pointer to the core private data * @param[in] queue_p the pointer to the buffer queue * @return 0 success * @return -1 fail * @note None * @attention None */ int Fmb_core_init_msg_audio_buf( struct fmb_core_private* priv_p, struct fmb_msg_audio_queue* queue_p ); /** * @brief Releases the video message buffer queue. * @param[in] priv_p the pointer to the core private data * @param[in] queue_p the pointer to the buffer queue * @return None * @note None * @attention None */ void Fmb_core_release_msg_audio_buf( struct fmb_core_private* priv_p, struct fmb_msg_audio_queue* queue_p ); /** * @brief Dequeues a busy system command ACK buffer from the buffer queue. * @param[in] priv_p the pointer to the core private data * @param[in] queue_p the pointer to the buffer queue * @return the pointer to the busy system command ACK buffer * @note None * @attention None */ struct fmb_cmd_ack_sys_buf* Fmb_core_get_busy_cmd_ack_sys_buf( struct fmb_core_private* priv_p, struct fmb_cmd_ack_sys_queue* queue_p ); /** * @brief Enqueues the busy system command ACK buffer
* to the buffer queue. * @param[in] priv_p the pointer to the core private data * @param[in] queue_p the pointer to the buffer queue * @param[in] buf_p the pointer to the system command ACK buffer * @return None * @note None * @attention None */ void Fmb_core_add_busy_cmd_ack_sys_buf( struct fmb_core_private* priv_p, struct fmb_cmd_ack_sys_queue* queue_p, struct fmb_cmd_ack_sys_buf* buf_p ); /** * @brief Dequeues a free system command ACK buffer from the buffer queue. * @param[in] priv_p the pointer to the core private data * @param[in] queue_p the pointer to the buffer queue * @return the pointer to the free system command ACK buffer * @note None * @attention None */ struct fmb_cmd_ack_sys_buf* Fmb_core_get_free_cmd_ack_sys_buf( struct fmb_core_private* priv_p, struct fmb_cmd_ack_sys_queue* queue_p ); /** * @brief Enqueues the free system command ACK buffer to
* the buffer queue. * @param[in] priv_p the pointer to the core private data * @param[in] queue_p the pointer to the buffer queue * @param[in] buf_p the pointer to the system command ACK buffer * @return None * @note None * @attention None */ void Fmb_core_add_free_cmd_ack_sys_buf( struct fmb_core_private* priv_p, struct fmb_cmd_ack_sys_queue* queue_p, struct fmb_cmd_ack_sys_buf* buf_p); /** * @brief Resets the system command ACK buffer queue. * @param[in] priv_p the pointer to the core private data * @param[in] queue_p the pointer to the buffer queue * @return None * @note None * @attention None */ void Fmb_core_reset_cmd_ack_sys_buf( struct fmb_core_private* priv_p, struct fmb_cmd_ack_sys_queue* queue_p ); /** * @brief Initializes the system command ACK buffer queue. * @param[in] priv_p the pointer to the core private data * @param[in] queue_p the pointer to the buffer queue * @return None * @note None * @attention None */ void Fmb_core_init_cmd_ack_sys_buf( struct fmb_core_private* priv_p, struct fmb_cmd_ack_sys_queue* queue_p ); /** * @brief Dequeues a busy xerror info buffer from the buffer queue. * @param[in] priv_p the pointer to the core private data * @param[in] queue_p the pointer to the buffer queue * @return the pointer to the busy xerror info buffer * @note None * @attention None */ struct fmb_xerror_info_buf* Fmb_core_get_busy_xerror_info_buf( struct fmb_core_private* priv_p, struct fmb_xerror_info_queue* queue_p ); /** * @brief Enqueues the busy XERROR info buffer
* to the buffer queue. * @param[in] priv_p the pointer to the core private data * @param[in] queue_p the pointer to the buffer queue * @param[in] buf_p the pointer to the XERROR info buffer * @return None * @note None * @attention None */ void Fmb_core_add_busy_xerror_info_buf( struct fmb_core_private* priv_p, struct fmb_xerror_info_queue* queue_p, struct fmb_xerror_info_buf* buf_p ); /** * @brief Dequeues a free XERROR info buffer from the buffer queue. * @param[in] priv_p the pointer to the core private data * @param[in] queue_p the pointer to the buffer queue * @return the pointer to the free XERROR info buffer * @note None * @attention None */ struct fmb_xerror_info_buf* Fmb_core_get_free_xerror_info_buf( struct fmb_core_private* priv_p, struct fmb_xerror_info_queue* queue_p ); /** * @brief Enqueues the free XERROR info buffer to
* the buffer queue. * @param[in] priv_p the pointer to the core private data * @param[in] queue_p the pointer to the buffer queue * @param[in] buf_p the pointer to the XERROR info buffer * @return None * @note None * @attention None */ void Fmb_core_add_free_xerror_info_buf( struct fmb_core_private* priv_p, struct fmb_xerror_info_queue* queue_p, struct fmb_xerror_info_buf* buf_p ); /** * @brief Resets the XERROR info buffer queue. * @param[in] priv_p the pointer to the core private data * @param[in] queue_p the pointer to the buffer queue * @return None * @note None * @attention None */ void Fmb_core_reset_xerror_info_buf( struct fmb_core_private* priv_p, struct fmb_xerror_info_queue* queue_p ); /** * @brief Initializes the XERROR info buffer queue. * @param[in] priv_p the pointer to the core private data * @param[in] queue_p the pointer to the buffer queue * @return 0 sucsess * @return -1 fail * @note None * @attention None */ int Fmb_core_init_xerror_info_buf( struct fmb_core_private* priv_p, struct fmb_xerror_info_queue* queue_p ); /** * @brief Releases the XERROR info buffer queue. * @param[in] priv_p the pointer to the core private data * @param[in] queue_p the pointer to the buffer queue * @return None * @note None * @attention None */ void Fmb_core_release_xerror_info_buf( struct fmb_core_private* priv_p, struct fmb_xerror_info_queue* queue_p ); /** * @brief Dequeues a busy VUDATA info buffer from the buffer queue. * @param[in] priv_p the pointer to the core private data * @param[in] queue_p the pointer to the buffer queue * @return the pointer to the busy VUDATA info buffer * @note None * @attention None */ struct fmb_vudata_info_buf* Fmb_core_get_busy_vudata_buf( struct fmb_core_private* priv_p, struct fmb_vudata_info_queue* queue_p ); /** * @brief Enqueues the busy VUDATA info buffer
* to the buffer queue. * @param[in] priv_p the pointer to the core private data * @param[in] queue_p the pointer to the buffer queue * @param[in] buf_p the pointer to the VUDATA info buffer * @return None * @note None * @attention None */ void fmb_core_add_busy_vudata_buf( struct fmb_core_private* priv_p, struct fmb_vudata_info_queue* queue_p, struct fmb_vudata_info_buf* buf_p ); /** * @brief Dequeues a free VUDATA info buffer from the buffer queue. * @param[in] priv_p the pointer to the core private data * @param[in] queue_p the pointer to the buffer queue * @return the pointer to the free VUDATA info buffer * @note None * @attention None */ struct fmb_vudata_info_buf* Fmb_core_get_free_vudata_buf( struct fmb_core_private* priv_p, struct fmb_vudata_info_queue* queue_p ); /** * @brief Enqueues the free VUDATA info buffer to
* the buffer queue. * @param[in] priv_p the pointer to the core private data * @param[in] queue_p the pointer to the buffer queue * @param[in] buf_p the pointer to the VUDATA info buffer * @return None * @note None * @attention None */ void Fmb_core_add_free_vudata_buf( struct fmb_core_private* priv_p, struct fmb_vudata_info_queue* queue_p, struct fmb_vudata_info_buf* buf_p ); /** * @brief Resets the VUDATA info buffer queue. * @param[in] priv_p the pointer to the core private data * @param[in] queue_p the pointer to the buffer queue * @return None * @note None * @attention None */ void Fmb_core_reset_vudata_buf( struct fmb_core_private* priv_p, struct fmb_vudata_info_queue* queue_p ); /** * @brief Initializes the VUDATA info buffer queue. * @param[in] priv_p the pointer to the core private data * @param[in] queue_p the pointer to the buffer queue * @return 0 success * @return -1 fail * @note None * @attention None */ int Fmb_core_init_vudata_buf( struct fmb_core_private* priv_p, struct fmb_vudata_info_queue* queue_p ); /** * @brief Releases the VUDATA info buffer queue. * @param[in] priv_p the pointer to the core private data * @param[in] queue_p the pointer to the buffer queue * @return None * @note None * @attention None */ void Fmb_core_release_vudata_buf( struct fmb_core_private* priv_p, struct fmb_vudata_info_queue* queue_p ); /** * @brief Enqueues the busy EDERR info buffer
* to the buffer queue. * @param[in] priv_p the pointer to the core private data * @param[in] queue_p the pointer to the buffer queue * @param[in] buf_p the pointer to the EDERR info buffer * @return None * @note None * @attention None */ void Fmb_core_add_busy_ederr_info_buf( struct fmb_core_private* priv_p, struct fmb_ederr_info_queue* queue_p, struct fmb_ederr_info_buf* buf_p ); /** * @brief Dequeues a free EDERR info buffer from the buffer queue. * @param[in] priv_p the pointer to the core private data * @param[in] queue_p the pointer to the buffer queue * @return the pointer to the free EDERR info buffer * @note None * @attention None */ struct fmb_ederr_info_buf* Fmb_core_get_free_ederr_info_buf( struct fmb_core_private* priv_p, struct fmb_ederr_info_queue* queue_p ); /** * @brief Enqueues the free EDERR info buffer to
* the buffer queue. * @param[in] priv_p the pointer to the core private data * @param[in] queue_p the pointer to the buffer queue * @param[in] buf_p the pointer to the EDERR info buffer * @return None * @note None * @attention None */ void Fmb_core_add_free_ederr_info_buf( struct fmb_core_private* priv_p, struct fmb_ederr_info_queue* queue_p, struct fmb_ederr_info_buf* buf_p ); /** * @brief Resets the EDERR info buffer queue. * @param[in] priv_p the pointer to the core private data * @param[in] queue_p the pointer to the buffer queue * @return None * @note None * @attention None */ void Fmb_core_reset_ederr_info_buf( struct fmb_core_private* priv_p, struct fmb_ederr_info_queue* queue_p ); /** * @brief Initializes the EDERR info buffer queue. * @param[in] priv_p the pointer to the core private data * @param[in] queue_p the pointer to the buffer queue * @return 0 sucsess * @return -1 fail * @note None * @attention None */ int Fmb_core_init_ederr_info_buf( struct fmb_core_private* priv_p, struct fmb_ederr_info_queue* queue_p ); /** * @brief Releases the EDERR info buffer queue. * @param[in] priv_p the pointer to the core private data * @param[in] queue_p the pointer to the buffer queue * @return None * @note None * @attention None */ void Fmb_core_release_ederr_info_buf( struct fmb_core_private* priv_p, struct fmb_ederr_info_queue* queue_p ); /** * @brief Enqueues the busy DDERR info buffer
* to the buffer queue. * @param[in] priv_p the pointer to the core private data * @param[in] queue_p the pointer to the buffer queue * @param[in] buf_p the pointer to the DDERR info buffer * @return None * @note None * @attention None */ void Fmb_core_add_busy_dderr_info_buf( struct fmb_core_private* priv_p, struct fmb_dderr_info_queue* queue_p, struct fmb_dderr_info_buf* buf_p ); /** * @brief Dequeues a free DDERR info buffer from the buffer queue. * @param[in] priv_p the pointer to the core private data * @param[in] queue_p the pointer to the buffer queue * @return the pointer to the free DDERR info buffer * @note None * @attention None */ struct fmb_dderr_info_buf* Fmb_core_get_free_dderr_info_buf( struct fmb_core_private* priv_p, struct fmb_dderr_info_queue* queue_p ); /** * @brief Enqueues the free DDERR info buffer to
* the buffer queue. * @param[in] priv_p the pointer to the core private data * @param[in] queue_p the pointer to the buffer queue * @param[in] buf_p the pointer to the DDERR info buffer * @return None * @note None * @attention None */ void Fmb_core_add_free_dderr_info_buf( struct fmb_core_private* priv_p, struct fmb_dderr_info_queue* queue_p, struct fmb_dderr_info_buf* buf_p ); /** * @brief Resets the DDERR info buffer queue. * @param[in] priv_p the pointer to the core private data * @param[in] queue_p the pointer to the buffer queue * @return None * @note None * @attention None */ void Fmb_core_reset_dderr_info_buf( struct fmb_core_private* priv_p, struct fmb_dderr_info_queue* queue_p ); /** * @brief Initializes the DDERR info buffer queue. * @param[in] priv_p the pointer to the core private data * @param[in] queue_p the pointer to the buffer queue * @return 0 sucsess * @return -1 fail * @note None * @attention None */ int Fmb_core_init_dderr_info_buf( struct fmb_core_private* priv_p, struct fmb_dderr_info_queue* queue_p ); /** * @brief Releases the DDERR info buffer queue. * @param[in] priv_p the pointer to the core private data * @param[in] queue_p the pointer to the buffer queue * @return None * @note None * @attention None */ void Fmb_core_release_dderr_info_buf( struct fmb_core_private* priv_p, struct fmb_dderr_info_queue* queue_p ); /** * @brief Dequeues a busy system command buffer from the buffer queue. * @param[in] priv_p the pointer to the core private data * @param[in] queue_p the pointer to the buffer queue * @return the pointer to the busy system command buffer * @note None * @attention None */ struct fmb_sys_cmd_buf* Fmb_core_get_busy_cmd_sys_buf( struct fmb_core_private* priv_p, struct fmb_cmd_sys_queue* queue_p ); /** * @brief Enqueues the busy system command buffer
* to the buffer queue. * @param[in] priv_p the pointer to the core private data * @param[in] queue_p the pointer to the buffer queue * @param[in] buf_p the pointer to the system command buffer * @return None * @note None * @attention None */ void Fmb_core_add_busy_cmd_sys_buf( struct fmb_core_private* priv_p, struct fmb_cmd_sys_queue* queue_p, struct fmb_sys_cmd_buf* buf_p ); /** * @brief Dequeues a free system command buffer from the buffer queue. * @param[in] priv_p the pointer to the core private data * @param[in] queue_p the pointer to the buffer queue * @return the pointer to the free system command buffer * @note None * @attention None */ struct fmb_sys_cmd_buf* Fmb_core_get_free_cmd_sys_buf( struct fmb_core_private* priv_p, struct fmb_cmd_sys_queue* queue_p ); /** * @brief Enqueues the free system command buffer to
* the buffer queue. * @param[in] priv_p the pointer to the core private data * @param[in] queue_p the pointer to the buffer queue * @param[in] buf_p the pointer to the system command buffer * @return None * @note None * @attention None */ void Fmb_core_add_free_cmd_sys_buf( struct fmb_core_private* priv_p, struct fmb_cmd_sys_queue* queue_p, struct fmb_sys_cmd_buf* buf_p ); /** * @brief Resets thesystem command buffer queue. * @param[in] priv_p the pointer to the core private data * @param[in] queue_p the pointer to the buffer queue * @return None * @note None * @attention None */ void Fmb_core_reset_cmd_sys_buf( struct fmb_core_private* priv_p, struct fmb_cmd_sys_queue* queue_p ); /** * @brief Initializes the system command buffer queue. * @param[in] priv_p the pointer to the core private data * @param[in] queue_p the pointer to the buffer queue * @return None * @note None * @attention None */ void Fmb_core_init_cmd_sys_buf( struct fmb_core_private* priv_p, struct fmb_cmd_sys_queue* queue_p ); /** * @brief Returns the queue head of the busy video command buffer. * @param[in] priv_p the pointer to the core private data * @param[in] queue_p the pointer to the buffer queue * @return the head of the busy queue * @note None * @attention None */ struct fmb_video_cmd_buf* Fmb_core_ref_busy_cmd_video_buf( struct fmb_core_private* priv_p, struct fmb_cmd_video_queue* queue_p); /** * @brief Dequeues a busy video command buffer from the buffer queue. * @param[in] priv_p the pointer to the core private data * @param[in] queue_p the pointer to the buffer queue * @return the pointer to the busy video command buffer * @note None * @attention None */ struct fmb_video_cmd_buf* fmb_core_get_busy_cmd_video_buf( struct fmb_core_private* priv_p, struct fmb_cmd_video_queue* queue_p ); /** * @brief Enqueues the busy video command buffer
* to the buffer queue. * @param[in] priv_p the pointer to the core private data * @param[in] queue_p the pointer to the buffer queue * @param[in] buf_p the pointer to the video command buffer * @return None * @note None * @attention None */ void Fmb_core_add_busy_cmd_video_buf( struct fmb_core_private* priv_p, struct fmb_cmd_video_queue* queue_p, struct fmb_video_cmd_buf* buf_p); /** * @brief Dequeues a free video command buffer from the buffer queue. * @param[in] priv_p the pointer to the core private data * @param[in] queue_p the pointer to the buffer queue * @return the pointer to the free video command buffer * @note None * @attention None */ struct fmb_video_cmd_buf* Fmb_core_get_free_cmd_video_buf( struct fmb_core_private* priv_p, struct fmb_cmd_video_queue* queue_p ); /** * @brief Enqueues the free video command buffer to
* the buffer queue. * @param[in] priv_p the pointer to the core private data * @param[in] queue_p the pointer to the buffer queue * @param[in] buf_p the pointer to the video command buffer * @return None * @note None * @attention None */ void Fmb_core_add_free_cmd_video_buf( struct fmb_core_private* priv_p, struct fmb_cmd_video_queue* queue_p, struct fmb_video_cmd_buf* buf_p); /** * @brief Resets the video command buffer queue. * @param[in] priv_p the pointer to the core private data * @param[in] queue_p the pointer to the buffer queue * @return None * @note None * @attention None */ void Fmb_core_reset_cmd_video_buf( struct fmb_core_private* priv_p, struct fmb_cmd_video_queue* queue_p ); /** * @brief Initializes the video command buffer queue. * @param[in] priv_p the pointer to the core private data * @param[in] queue_p the pointer to the buffer queue * @return None * @note None * @attention None */ void Fmb_core_init_cmd_video_buf( struct fmb_core_private* priv_p, struct fmb_cmd_video_queue* queue_p ); /** * @brief Dequeues a busy audio command buffer from the buffer queue. * @param[in] priv_p the pointer to the core private data * @param[in] queue_p the pointer to the buffer queue * @return the pointer to the busy audio command buffer * @note None * @attention None */ struct fmb_audio_cmd_buf* Fmb_core_get_busy_cmd_audio_buf( struct fmb_core_private* priv_p, struct fmb_cmd_audio_queue* queue_p ); /** * @brief Enqueues the busy audio command buffer
* to the buffer queue. * @param[in] priv_p the pointer to the core private data * @param[in] queue_p the pointer to the buffer queue * @param[in] buf_p the pointer to the audio command buffer * @return None * @note None * @attention None */ void Fmb_core_add_busy_cmd_audio_buf( struct fmb_core_private* priv_p, struct fmb_cmd_audio_queue* queue_p, struct fmb_audio_cmd_buf* buf_p); /** * @brief Dequeues a free audio command buffer from the buffer queue. * @param[in] priv_p the pointer to the core private data * @param[in] queue_p the pointer to the buffer queue * @return the pointer to the free audio command buffer * @note None * @attention None */ struct fmb_audio_cmd_buf* Fmb_core_get_free_cmd_audio_buf( struct fmb_core_private* priv_p, struct fmb_cmd_audio_queue* queue_p ); /** * @brief Enqueues the free audio command buffer to
* the buffer queue. * @param[in] priv_p the pointer to the core private data * @param[in] queue_p the pointer to the buffer queue * @param[in] buf_p the pointer to the audio command buffer * @return None * @note None * @attention None */ void Fmb_core_add_free_cmd_audio_buf( struct fmb_core_private* priv_p, struct fmb_cmd_audio_queue* queue_p, struct fmb_audio_cmd_buf* buf_p ); /** * @brief Resets the audio command buffer queue. * @param[in] priv_p the pointer to the core private data * @param[in] queue_p the pointer to the buffer queue * @return None * @note None * @attention None */ void Fmb_core_reset_cmd_audio_buf( struct fmb_core_private* priv_p, struct fmb_cmd_audio_queue* queue_p ); /** * @brief Initializes the audio command buffer queue. * @param[in] priv_p the pointer to the core private data * @param[in] queue_p the pointer to the buffer queue * @return None * @note None * @attention None */ void Fmb_core_init_cmd_audio_buf( struct fmb_core_private* priv_p, struct fmb_cmd_audio_queue* queue_p ); /** * @brief Returns the notification kind for received ASYNC notification. * @param[in] priv_p the pointer to the core private data * @return factor notification kind.
* The lower 6bits each represents presence(1)/
* absence(0) of particular notification:
* - bit0 : system command ack message
* - bit1 : system message
* - bit2 : video message
* - bit3 : audio message
* - bit4 : xerror message
* - bit5 : vudata message
* @note None * @attention None */ int Fmb_core_get_factor_check( struct fmb_core_private* priv_p ); /** * @brief Resets the private data. * @param[in] priv_p the pointer to the core private data * @return None * @note None * @attention None */ void Fmb_core_private_data_reset( struct fmb_core_private* priv_p ); /** * @brief set factor_num * * @param[in] set value * @return None * @note None * @attension None */ void Fmb_core_set_factor_num( struct fmb_core_private* priv_p, int val ); /** * @brief get factor_num * * @param None * @return factor_num * @note None * @attension None */ int Fmb_core_get_factor_num( struct fmb_core_private* priv_p ); /** * @brief Interrupt handler for a XERROR interrupt from the MB86 LSI. * @param[in] the pointer to the core private data * @return None * @note None * @attention None */ void Fmb_core_xerror_irq( struct fmb_core_private* priv_p ); /** * @brief Interrupt handler for a INT interrupt from the MB86 LSI. * @param[in] the pointer to the core private data * @return None * @note None * @attention None */ void Fmb_core_int_irq( struct fmb_core_private* priv_p ); /** * @brief Interrupt handler for a EDERR interrupt from the MB86 LSI. * @param[in] the pointer to the core private data * @return None * @note None * @attention None */ void Fmb_core_ederr_irq( struct fmb_core_private* priv_p ); /** * @brief Interrupt handler for a DDERR interrupt from the MB86 LSI. * @param[in] the pointer to the core private data * @return None * @note None * @attention None */ void Fmb_core_dderr_irq( struct fmb_core_private* priv_p ); /** * @brief The MB86-LSI part of the probe function. * @param[in] hw_priv_p the pointer to the HW private data * @return 0 success * @return -1 fail * @note None * @attention None */ int Fmb_core_probe( struct fmb_hard_private* hw_priv_p ); /** * @brief Kills tasklets and releases the core private data. * @param[in] priv_p the pointer to the core private data * @return None * @note None * @attention None */ void Fmb_core_remove( struct fmb_core_private* priv_p ); /** * @brief The MB86-LSI part of the init_module function. * @param None * @return None * @note None * @attention None */ void Fmb_core_init_module( void ); #endif /* ifndef __FMB_CORE_H__ */