extern "C" void FCExport FmsCreateAuthAdaptor3(IFmsAuthServerContext2* pAuthServerCtx, IFmsAuthAdaptor*& pFmsAuthAdaptor, U32& iVersion) { pFmsAuthAdaptor = new FmsAuthAdaptor(pAuthServerCtx); U32 version = pAuthServerCtx->getVersion(); U16 w2 = LWORD(version); U16 w1 = HWORD(version); iVersion = MKLONG(INTERFACE_MINOR_VERSION, INTERFACE_MAJOR_VERSION); char buf[1024]; char *ptr = buf; int valueLen = pAuthServerCtx->getConfig("UserKey1", &ptr, sizeof(buf)); if (!valueLen) { valueLen = pAuthServerCtx->getConfig("UserKey2", &ptr, sizeof(buf)); if (!valueLen) { return; } if (valueLen < 0) { // failed to find this key return; } } if (valueLen < 0) { // failed to find this key return; } // value length is bigger then the buffer size, and a real adaptor should // allocate valueLen + 1 bytes and call again }
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; }