Loading src/drivers/elphel/Kconfig +6 −0 Original line number Diff line number Diff line Loading @@ -20,4 +20,10 @@ config ELPHEL393_INIT default y help If unsure, say Y. config ELPHEL393_EXTERNAL tristate "Compile circbuf as external module" default m help If unsure, say Y. endmenu src/drivers/elphel/Makefile +9 −4 Original line number Diff line number Diff line Loading @@ -7,7 +7,12 @@ obj-$(CONFIG_ELPHEL393) += elphel393-mem.o obj-$(CONFIG_ELPHELDRVONMICROZED) += elphel393-mem.o obj-$(CONFIG_ELPHEL393_INIT) += elphel393-init.o obj-$(CONFIG_ELPHEL393) += framepars.o obj-$(CONFIG_ELPHEL393) += sensor_common.o obj-$(CONFIG_ELPHEL393) += quantization_tables.o obj-$(CONFIG_ELPHEL393) += circbuf.o jpeghead.o No newline at end of file #obj-$(CONFIG_ELPHEL393) += framepars.o #obj-$(CONFIG_ELPHEL393) += sensor_common.o #obj-$(CONFIG_ELPHEL393) += quantization_tables.o #obj-$(CONFIG_ELPHEL393) += circbuf.o jpeghead.o obj-$(CONFIG_ELPHEL393_EXTERNAL) += framepars.o obj-$(CONFIG_ELPHEL393_EXTERNAL) += sensor_common.o obj-$(CONFIG_ELPHEL393_EXTERNAL) += quantization_tables.o obj-$(CONFIG_ELPHEL393_EXTERNAL) += circbuf.o jpeghead.o No newline at end of file src/drivers/elphel/circbuf.c +22 −5 Original line number Diff line number Diff line Loading @@ -150,6 +150,8 @@ #include <linux/init.h> #include <linux/time.h> #include <linux/wait.h> #include <linux/dma-mapping.h> #include <linux/errno.h> //#include <asm/system.h> //#include <asm/arch/memmap.h> Loading Loading @@ -206,14 +208,23 @@ /* really huge static DMA buffer (1288+8)*1032/3=445824 long-s */ // DMA_SIZE - in 32-bit words, not bytes static unsigned long ccam_dma_buf[CCAM_DMA_SIZE + (PAGE_SIZE>>2)] __attribute__ ((aligned (PAGE_SIZE))); //static unsigned long ccam_dma_buf[CCAM_DMA_SIZE + (PAGE_SIZE>>2)] __attribute__ ((aligned (PAGE_SIZE))); static unsigned long *ccam_dma_buf = NULL; //!Without "static" system hangs after "Uncompressing Linux... unsigned long * ccam_dma_buf_ptr = NULL; unsigned long * ccam_dma = NULL; //! still used in autoexposure or something - why is in needed there? void init_ccam_dma_buf_ptr(void) { ccam_dma_buf_ptr = ccam_dma_buf; ccam_dma = ccam_dma_buf; //&ccam_dma_buf[0]; Use in autoexposure int init_ccam_dma_buf_ptr(void) { dma_addr_t *dma_handle; //ccam_dma_buf_ptr = ccam_dma_buf; //ccam_dma = ccam_dma_buf; //&ccam_dma_buf[0]; Use in autoexposure ccam_dma_buf_ptr = dma_alloc_coherent(NULL, (CCAM_DMA_SIZE + (PAGE_SIZE >> 2)), dma_handle, GFP_KERNEL); if (!ccam_dma_buf_ptr) { return -ENOMEM; } else { printk(KERN_DEBUG "%s: dma memory allocated at 0x%08x", __func__, dma_handle); } } extern struct interframe_params_t frame_params; // cc353.c /*!====================================================================================== Loading Loading @@ -679,6 +690,12 @@ static int __init circbuf_all_init(void) { return res; } res = init_ccam_dma_buf_ptr(); if (res < 0) { printk(KERN_ERR "%s: ERROR allocating coherent DMA buffer\n", __func__); return -ENOMEM; } MDF19(printk("init_waitqueue_head()\n")); init_waitqueue_head(&circbuf_wait_queue); MDF19(printk("jpeg_htable_init()\n")); Loading @@ -689,7 +706,7 @@ static int __init circbuf_all_init(void) { module_init(circbuf_all_init); MODULE_LICENSE("GPLv3.0"); MODULE_LICENSE("GPL"); MODULE_AUTHOR("Andrey Filippov <andrey@elphel.com>."); MODULE_DESCRIPTION(CIRCBUF_DRIVER_NAME); src/drivers/elphel/circbuf.h +3 −1 Original line number Diff line number Diff line Loading @@ -25,10 +25,12 @@ ssize_t circbuf_read (struct file * file, char * buf, size_t count, loff_t int circbuf_mmap (struct file *file, struct vm_area_struct *vma); unsigned int circbuf_poll (struct file *file, poll_table *wait); void init_ccam_dma_buf_ptr(void); int init_ccam_dma_buf_ptr(void); /*!====================================================================================== *! Wait queue for the processes waiting for a new frame to appear in the circular buffer *!======================================================================================*/ extern wait_queue_head_t circbuf_wait_queue; unsigned long *ccam_dma_buf_ptr; #endif /* _CIRCBUF_H */ src/drivers/elphel/framepars.c +5 −1 Original line number Diff line number Diff line Loading @@ -302,6 +302,7 @@ unsigned long *multiSensIndex= NULL; /// index for per-sensor alternat unsigned long *multiSensRvrsIndex=NULL; /// reverse index (to parent) for the multiSensIndex wait_queue_head_t framepars_wait_queue; /// used to wait for the frame to be acquired extern struct sensorproc_t * sensorproc; /** * @brief file private data Loading Loading @@ -433,6 +434,7 @@ int initMultiPars(void) { inline unsigned long get_imageParamsThis (int n) { return framepars[thisFrameNumber & PARS_FRAMES_MASK].pars[n] ; } EXPORT_SYMBOL_GPL(get_imageParamsThis); /** * @brief reads parameters from the previous frame (matching hardware index) - used to determine if historam was needed Loading Loading @@ -462,6 +464,7 @@ inline void set_imageParamsThis (int n,unsigned long d) { inline unsigned long get_globalParam (int n) { return GLOBALPARS(n) ; } EXPORT_SYMBOL_GPL(get_globalParam); /** * @brief sets global (not related to particular frames) parameters * @param n number of a parameter to set (numbers start from FRAMEPAR_GLOBALS) Loading @@ -471,6 +474,7 @@ inline unsigned long get_globalParam (int n) { inline void set_globalParam (int n, unsigned long d) { GLOBALPARS(n)=d; } EXPORT_SYMBOL_GPL(set_globalParam); /** * @brief set same parameters in all frames Loading Loading @@ -1340,6 +1344,6 @@ static int __init framepars_init(void) { module_init(framepars_init); MODULE_LICENSE("GPLv3.0"); MODULE_LICENSE("GPL"); MODULE_AUTHOR("Andrey Filippov <andrey@elphel.com>."); MODULE_DESCRIPTION(X3X3_FRAMEPARS_DRIVER_NAME); Loading
src/drivers/elphel/Kconfig +6 −0 Original line number Diff line number Diff line Loading @@ -20,4 +20,10 @@ config ELPHEL393_INIT default y help If unsure, say Y. config ELPHEL393_EXTERNAL tristate "Compile circbuf as external module" default m help If unsure, say Y. endmenu
src/drivers/elphel/Makefile +9 −4 Original line number Diff line number Diff line Loading @@ -7,7 +7,12 @@ obj-$(CONFIG_ELPHEL393) += elphel393-mem.o obj-$(CONFIG_ELPHELDRVONMICROZED) += elphel393-mem.o obj-$(CONFIG_ELPHEL393_INIT) += elphel393-init.o obj-$(CONFIG_ELPHEL393) += framepars.o obj-$(CONFIG_ELPHEL393) += sensor_common.o obj-$(CONFIG_ELPHEL393) += quantization_tables.o obj-$(CONFIG_ELPHEL393) += circbuf.o jpeghead.o No newline at end of file #obj-$(CONFIG_ELPHEL393) += framepars.o #obj-$(CONFIG_ELPHEL393) += sensor_common.o #obj-$(CONFIG_ELPHEL393) += quantization_tables.o #obj-$(CONFIG_ELPHEL393) += circbuf.o jpeghead.o obj-$(CONFIG_ELPHEL393_EXTERNAL) += framepars.o obj-$(CONFIG_ELPHEL393_EXTERNAL) += sensor_common.o obj-$(CONFIG_ELPHEL393_EXTERNAL) += quantization_tables.o obj-$(CONFIG_ELPHEL393_EXTERNAL) += circbuf.o jpeghead.o No newline at end of file
src/drivers/elphel/circbuf.c +22 −5 Original line number Diff line number Diff line Loading @@ -150,6 +150,8 @@ #include <linux/init.h> #include <linux/time.h> #include <linux/wait.h> #include <linux/dma-mapping.h> #include <linux/errno.h> //#include <asm/system.h> //#include <asm/arch/memmap.h> Loading Loading @@ -206,14 +208,23 @@ /* really huge static DMA buffer (1288+8)*1032/3=445824 long-s */ // DMA_SIZE - in 32-bit words, not bytes static unsigned long ccam_dma_buf[CCAM_DMA_SIZE + (PAGE_SIZE>>2)] __attribute__ ((aligned (PAGE_SIZE))); //static unsigned long ccam_dma_buf[CCAM_DMA_SIZE + (PAGE_SIZE>>2)] __attribute__ ((aligned (PAGE_SIZE))); static unsigned long *ccam_dma_buf = NULL; //!Without "static" system hangs after "Uncompressing Linux... unsigned long * ccam_dma_buf_ptr = NULL; unsigned long * ccam_dma = NULL; //! still used in autoexposure or something - why is in needed there? void init_ccam_dma_buf_ptr(void) { ccam_dma_buf_ptr = ccam_dma_buf; ccam_dma = ccam_dma_buf; //&ccam_dma_buf[0]; Use in autoexposure int init_ccam_dma_buf_ptr(void) { dma_addr_t *dma_handle; //ccam_dma_buf_ptr = ccam_dma_buf; //ccam_dma = ccam_dma_buf; //&ccam_dma_buf[0]; Use in autoexposure ccam_dma_buf_ptr = dma_alloc_coherent(NULL, (CCAM_DMA_SIZE + (PAGE_SIZE >> 2)), dma_handle, GFP_KERNEL); if (!ccam_dma_buf_ptr) { return -ENOMEM; } else { printk(KERN_DEBUG "%s: dma memory allocated at 0x%08x", __func__, dma_handle); } } extern struct interframe_params_t frame_params; // cc353.c /*!====================================================================================== Loading Loading @@ -679,6 +690,12 @@ static int __init circbuf_all_init(void) { return res; } res = init_ccam_dma_buf_ptr(); if (res < 0) { printk(KERN_ERR "%s: ERROR allocating coherent DMA buffer\n", __func__); return -ENOMEM; } MDF19(printk("init_waitqueue_head()\n")); init_waitqueue_head(&circbuf_wait_queue); MDF19(printk("jpeg_htable_init()\n")); Loading @@ -689,7 +706,7 @@ static int __init circbuf_all_init(void) { module_init(circbuf_all_init); MODULE_LICENSE("GPLv3.0"); MODULE_LICENSE("GPL"); MODULE_AUTHOR("Andrey Filippov <andrey@elphel.com>."); MODULE_DESCRIPTION(CIRCBUF_DRIVER_NAME);
src/drivers/elphel/circbuf.h +3 −1 Original line number Diff line number Diff line Loading @@ -25,10 +25,12 @@ ssize_t circbuf_read (struct file * file, char * buf, size_t count, loff_t int circbuf_mmap (struct file *file, struct vm_area_struct *vma); unsigned int circbuf_poll (struct file *file, poll_table *wait); void init_ccam_dma_buf_ptr(void); int init_ccam_dma_buf_ptr(void); /*!====================================================================================== *! Wait queue for the processes waiting for a new frame to appear in the circular buffer *!======================================================================================*/ extern wait_queue_head_t circbuf_wait_queue; unsigned long *ccam_dma_buf_ptr; #endif /* _CIRCBUF_H */
src/drivers/elphel/framepars.c +5 −1 Original line number Diff line number Diff line Loading @@ -302,6 +302,7 @@ unsigned long *multiSensIndex= NULL; /// index for per-sensor alternat unsigned long *multiSensRvrsIndex=NULL; /// reverse index (to parent) for the multiSensIndex wait_queue_head_t framepars_wait_queue; /// used to wait for the frame to be acquired extern struct sensorproc_t * sensorproc; /** * @brief file private data Loading Loading @@ -433,6 +434,7 @@ int initMultiPars(void) { inline unsigned long get_imageParamsThis (int n) { return framepars[thisFrameNumber & PARS_FRAMES_MASK].pars[n] ; } EXPORT_SYMBOL_GPL(get_imageParamsThis); /** * @brief reads parameters from the previous frame (matching hardware index) - used to determine if historam was needed Loading Loading @@ -462,6 +464,7 @@ inline void set_imageParamsThis (int n,unsigned long d) { inline unsigned long get_globalParam (int n) { return GLOBALPARS(n) ; } EXPORT_SYMBOL_GPL(get_globalParam); /** * @brief sets global (not related to particular frames) parameters * @param n number of a parameter to set (numbers start from FRAMEPAR_GLOBALS) Loading @@ -471,6 +474,7 @@ inline unsigned long get_globalParam (int n) { inline void set_globalParam (int n, unsigned long d) { GLOBALPARS(n)=d; } EXPORT_SYMBOL_GPL(set_globalParam); /** * @brief set same parameters in all frames Loading Loading @@ -1340,6 +1344,6 @@ static int __init framepars_init(void) { module_init(framepars_init); MODULE_LICENSE("GPLv3.0"); MODULE_LICENSE("GPL"); MODULE_AUTHOR("Andrey Filippov <andrey@elphel.com>."); MODULE_DESCRIPTION(X3X3_FRAMEPARS_DRIVER_NAME);