示例#1
0
void mbox_fbctl_upd(void)
{
	struct omapfb_update_window win;
	volatile unsigned short *buf = ipbuf_sys_da->d;

	if (sync_with_dsp(&ipbuf_sys_da->s, TID_ANON, 5000) < 0) {
		printk(KERN_ERR "mbox: FBCTL:UPD - IPBUF sync failed!\n");
		return;
	}
	win.x = buf[0];
	win.y = buf[1];
	win.width = buf[2];
	win.height = buf[3];
	win.format = buf[4];
	release_ipbuf_pvt(ipbuf_sys_da);

#ifdef CONFIG_FB_OMAP_LCDC_EXTERNAL
	if (!omapfb_ready) {
		printk(KERN_WARNING
		       "omapdsp: fbupd() called while HWA742 is not ready!\n");
		return;
	}
#endif
	omapfb_update_window_async(registered_fb[0], &win, fbupd_cb, NULL);
}
示例#2
0
void mbx1_getvar(struct mbcmd *mb)
{
	unsigned char varid = mb->cmd_l;
	int i;
	volatile unsigned short *buf;

	if (!waitqueue_active(&ioctl_wait_q) ||
	    (ioctl_wait_cmd != MBCMD(GETVAR))) {
		printk(KERN_WARNING
		       "mbx: GETVAR command received, "
		       "but nobody is waiting for it...\n");
		return;
	}

	ioctl_wait_cmd = 0;
	switch (varid) {
	case OMAP_DSP_MBCMD_VARID_ICRMASK:
		varread_val[0] = mb->data;
		break;
	case OMAP_DSP_MBCMD_VARID_LOADINFO:
		{
			if (sync_with_dsp(&ipbuf_sys_da->s, OMAP_DSP_TID_ANON, 10) < 0) {
				printk(KERN_ERR
				       "mbx: GETVAR - IPBUF sync failed!\n");
				return;
			}
			/* need word access. do not use memcpy. */
			buf = ipbuf_sys_da->d;
			for (i = 0; i < 5; i++) {
				varread_val[i] = buf[i];
			}
			ipbuf_sys_da->s = OMAP_DSP_TID_FREE;
			break;
		}
	}
	wake_up_interruptible(&ioctl_wait_q);

	return;
}
示例#3
0
void mbx1_dspcfg(struct mbcmd *mb)
{
	unsigned char last   = mb->cmd_l & 0x80;
	unsigned char cfgcmd = mb->cmd_l & 0x7f;
	static unsigned long tmp_ipbuf_sys_da;

	/* mailbox protocol check */
	if (cfgcmd == OMAP_DSP_MBCMD_DSPCFG_PROTREV) {
		if (!waitqueue_active(&ioctl_wait_q) ||
		    (ioctl_wait_cmd != MBCMD(DSPCFG))) {
			printk(KERN_WARNING
			       "mbx: DSPCFG command received, "
			       "but nobody is waiting for it...\n");
			return;
		}

		mbx_revision = mb->data;
		if (mbx_revision == OMAP_DSP_MBPROT_REVISION)
			return;
#ifdef OLD_BINARY_SUPPORT
		else if (mbx_revision == MBREV_3_0) {
			printk(KERN_WARNING
			       "mbx: ***** old DSP binary *****\n"
			       "  Please update your DSP application.\n");
			return;
		}
#endif
		else {
			printk(KERN_ERR
			       "mbx: protocol revision check error!\n"
			       "  expected=0x%04x, received=0x%04x\n",
			       OMAP_DSP_MBPROT_REVISION, mb->data);
			mbx_revision = -1;
			goto abort;
		}
	}

	/*
	 * following commands are accepted only after
	 * revision check has been passed.
	 */
	if (!mbx_revision < 0) {
		printk(KERN_INFO
		       "mbx: DSPCFG command received, "
		       "but revision check has not been passed.\n");
		return;
	}

	if (!waitqueue_active(&ioctl_wait_q) ||
	    (ioctl_wait_cmd != MBCMD(DSPCFG))) {
		printk(KERN_WARNING
		       "mbx: DSPCFG command received, "
		       "but nobody is waiting for it...\n");
		return;
	}

	switch (cfgcmd) {
	case OMAP_DSP_MBCMD_DSPCFG_SYSADRH:
		tmp_ipbuf_sys_da = (unsigned long)mb->data << 16;
		break;

	case OMAP_DSP_MBCMD_DSPCFG_SYSADRL:
		tmp_ipbuf_sys_da |= mb->data;
		break;

	case OMAP_DSP_MBCMD_DSPCFG_ABORT:
		goto abort;

	default:
		printk(KERN_ERR
		       "mbx: Unknown CFG command: cmd_l=0x%02x, data=0x%04x\n",
		       mb->cmd_l, mb->data);
		return;
	}

	if (last) {
		unsigned long badr;
		unsigned short bln;
		unsigned short bsz;
		volatile unsigned short *buf;
		void *sync_seq;

		/* system IPBUF initialization */
		if (tmp_ipbuf_sys_da & 0x1) {
			printk(KERN_ERR
			       "mbx: system ipbuf address (0x%lx) "
			       "is odd number!\n", tmp_ipbuf_sys_da);
			goto abort;
		}
		ipbuf_sys_da = dspword_to_virt(tmp_ipbuf_sys_da);

		if (sync_with_dsp(&ipbuf_sys_da->s, OMAP_DSP_TID_ANON, 10) < 0) {
			printk(KERN_ERR "mbx: DSPCFG - IPBUF sync failed!\n");
			return;
		}
		/*
		 * read configuration data on system IPBUF
		 * we must read with 16bit-access
		 */
#ifdef OLD_BINARY_SUPPORT
		if (mbx_revision == OMAP_DSP_MBPROT_REVISION) {
#endif
			buf = ipbuf_sys_da->d;
			n_stask = buf[0];
			bln     = buf[1];
			bsz     = buf[2];
			badr    = MKLONG(buf[3], buf[4]);
			/*ipbuf_sys_da = dspword_to_virt(MKLONG(buf[5], buf[6])); */
			ipbuf_sys_ad = dspword_to_virt(MKLONG(buf[7], buf[8]));
			sync_seq = dspword_to_virt(MKLONG(buf[9], buf[10]));
#ifdef OLD_BINARY_SUPPORT
		} else if (mbx_revision == MBREV_3_0) {
			buf = ipbuf_sys_da->d;
			n_stask = buf[0];
			bln     = buf[1];
			bsz     = buf[2];
			badr    = MKLONG(buf[3], buf[4]);
			/* bkeep   = buf[5]; */
			/*ipbuf_sys_da = dspword_to_virt(MKLONG(buf[6], buf[67)); */
			ipbuf_sys_ad = dspword_to_virt(MKLONG(buf[8], buf[9]));
			sync_seq = dspword_to_virt(MKLONG(buf[10], buf[11]));
		} else /* should not occur */
			goto abort;
#endif

		/* ipbuf_config() should be done in interrupt routine. */
		if (ipbuf_config(bln, bsz, badr) < 0)
			goto abort;

		ipbuf_sys_da->s = OMAP_DSP_TID_FREE;

		/* mb_config() should be done in interrupt routine. */
		dsp_mb_config(sync_seq);

		ioctl_wait_cmd = 0;
		wake_up_interruptible(&ioctl_wait_q);
	}
	return;

abort:
	wake_up_interruptible(&ioctl_wait_q);
	return;
}