Ejemplo n.º 1
0
int scan_sym(FILE *fp, char *o_ptr)
  {

       int i;

X3:    TA(NA4);
       goto X4;
NA4:   TN(NN4);
       goto X4;
NN4:   TC(ES4,'_');
 /* loop back to here */  
X4:    TA(NA5);
       goto X4;
NA5:   TN(NN5);
       goto X4;
NN5:   TC(ES5,'_');
       goto X4;
ES4:   printf("Invalid name: ");
       for (i = 0; i < 7; i++) {
          printf("%c",curr_char);
          curr_char = getc(fp);
          } 
       printf("\n");       
       return(4);

ES5:   *o_ptr = '\0';
       return(0);
  }
Ejemplo n.º 2
0
void hw_timer_init(void)
{
	setup_irq(mcf_timervector, &mcftmr_timer_irq);

	__raw_writew(MCFTIMER_TMR_DISABLE, TA(MCFTIMER_TMR));
	mcftmr_cycles_per_jiffy = FREQ / HZ;
	/*
	 *	The coldfire timer runs from 0 to TRR included, then 0
	 *	again and so on.  It counts thus actually TRR + 1 steps
	 *	for 1 tick, not TRR.  So if you want n cycles,
	 *	initialize TRR with n - 1.
	 */
	__raw_writetrr(mcftmr_cycles_per_jiffy - 1, TA(MCFTIMER_TRR));
	__raw_writew(MCFTIMER_TMR_ENORI | MCFTIMER_TMR_CLK16 |
		MCFTIMER_TMR_RESTART | MCFTIMER_TMR_ENABLE, TA(MCFTIMER_TMR));

	mcftmr_clk.mult = clocksource_hz2mult(FREQ, mcftmr_clk.shift);
	clocksource_register(&mcftmr_clk);

	mcf_settimericr(1, mcf_timerlevel);

#ifdef CONFIG_HIGHPROFILE
	coldfire_profile_init();
#endif
}
Ejemplo n.º 3
0
static irqreturn_t hw_tick(int irq, void *dummy)
{
	unsigned short pcsr;

	/* Reset the ColdFire timer */
	pcsr = __raw_readw(TA(MCFPIT_PCSR));
	__raw_writew(pcsr | MCFPIT_PCSR_PIF, TA(MCFPIT_PCSR));

	return arch_timer_interrupt(irq, dummy);
}
Ejemplo n.º 4
0
static irqreturn_t pit_tick(int irq, void *dummy)
{
	struct clock_event_device *evt = &cf_pit_clockevent;
	u16 pcsr;

	/* Reset the ColdFire timer */
	pcsr = __raw_readw(TA(MCFPIT_PCSR));
	__raw_writew(pcsr | MCFPIT_PCSR_PIF, TA(MCFPIT_PCSR));

	pit_cnt += PIT_CYCLES_PER_JIFFY;
	evt->event_handler(evt);
	return IRQ_HANDLED;
}
Ejemplo n.º 5
0
Archivo: ta.cpp Proyecto: Dunni/taeval
QList<TA> TA::stringToList(QString aString){  // Convert a string to a list of NonAdminUser objects
    TAList result = TAList();
    QList<QString> list = aString.split(QRegExp("(~`|`~|~~)"));
    for(int i=1;i<list.length()-1;i++) result += TA(list[i]);
    ////qDebug() << list;
    return result;
}
Ejemplo n.º 6
0
/*
Scan off a network label or process name (this is used for ports as well, as we don't know if a string is a port until later...)

Allowable characters are alphameric, hyphen, underscore; if character is preceded by backslash, will be accepted

This routine exits when an nonallowed character (or EOL) is encountered
*/
inline int scan_sym(FILE *fp, char * out_str)
{
	//extern char curr_char;
	char * o_ptr;

	o_ptr = out_str;
X4:
	TA(NA4);	
	goto X5;
NA4: 
	TN(NN4);
	goto X5;
NN4: 
	TC(NU4,'_');
	goto X5;
NU4:
	TC(ES4,'-');
	goto X5;
ES4:
	TCO(ES5, '\\');  // as per discussion on https://groups.google.com/forum/#!searchin/flow-based-programming/commas -
	                //             find "Special characters in process names" 
	CC;    	
X5:
	goto X4;
ES5:
	*o_ptr = '\0';           
	return(0);
}
Ejemplo n.º 7
0
static irqreturn_t mcfslt_tick(int irq, void *dummy)
{
	/* Reset Slice Timer 0 */
	__raw_writel(MCFSLT_SSR_BE | MCFSLT_SSR_TE, TA(MCFSLT_SSR));
	mcfslt_cnt += mcfslt_cycles_per_jiffy;
	return timer_interrupt(irq, dummy);
}
Ejemplo n.º 8
0
static cycle_t mcfslt_read_clk(struct clocksource *cs)
{
	unsigned long flags;
	u32 cycles, scnt;

	local_irq_save(flags);
	scnt = __raw_readl(TA(MCFSLT_SCNT));
	cycles = mcfslt_cnt;
	if (__raw_readl(TA(MCFSLT_SSR)) & MCFSLT_SSR_TE) {
		cycles += mcfslt_cycles_per_jiffy;
		scnt = __raw_readl(TA(MCFSLT_SCNT));
	}
	local_irq_restore(flags);

	/* subtract because slice timers count down */
	return cycles + ((mcfslt_cycles_per_jiffy - 1) - scnt);
}
Ejemplo n.º 9
0
static irqreturn_t mcftmr_tick(int irq, void *dummy)
{
	/* Reset the ColdFire timer */
	__raw_writeb(MCFTIMER_TER_CAP | MCFTIMER_TER_REF, TA(MCFTIMER_TER));

	mcftmr_cnt += mcftmr_cycles_per_jiffy;
	return timer_interrupt(irq, dummy);
}
Ejemplo n.º 10
0
unsigned long hw_timer_offset(void)
{
	volatile unsigned long *ipr;
	unsigned long pmr, pcntr, offset;

	ipr = (volatile unsigned long *) (MCF_IPSBAR + MCFICM_INTC0 + MCFPIT_IMR);

	pmr = __raw_readw(TA(MCFPIT_PMR));
	pcntr = __raw_readw(TA(MCFPIT_PCNTR));

	/*
	 * If we are still in the first half of the upcount and a
	 * timer interrupt is pending, then add on a ticks worth of time.
	 */
	offset = ((pmr - pcntr) * (1000000 / HZ)) / pmr;
	if ((offset < (1000000 / HZ / 2)) && (*ipr & MCFPIT_IMR_IBIT))
		offset += 1000000 / HZ;
	return offset;	
}
void f2() {
  if (!v1) {
    v2 = (v2 = getchar()) < 0 ? 0 : v2;
    v1 = 8 * 8;
  }
  TA++ a2 % 8;
  TA(1 + 7 * v4 - v4 * v4) / 3;
  v5 = a2 * 15 - a2 * a2 - 36;
  f1(v5 < 0 ? !v4 + 4 : v5 / 6 + !v4 + 4, 32);
}
Ejemplo n.º 12
0
void hw_timer_init(void)
{
	volatile unsigned char *icrp;
	volatile unsigned long *imrp;

	setup_irq(MCFINT_VECBASE + MCFINT_PIT1, &coldfire_pit_irq);

	icrp = (volatile unsigned char *) (MCF_IPSBAR + MCFICM_INTC0 +
		MCFINTC_ICR0 + MCFINT_PIT1);
	*icrp = ICR_INTRCONF;

	imrp = (volatile unsigned long *) (MCF_IPSBAR + MCFICM_INTC0 + MCFPIT_IMR);
	*imrp &= ~MCFPIT_IMR_IBIT;

	/* Set up PIT timer 1 as poll clock */
	__raw_writew(MCFPIT_PCSR_DISABLE, TA(MCFPIT_PCSR));
	__raw_writew(((MCF_CLK / 2) / 64) / HZ, TA(MCFPIT_PMR));
	__raw_writew(MCFPIT_PCSR_EN | MCFPIT_PCSR_PIE | MCFPIT_PCSR_OVW |
		MCFPIT_PCSR_RLD | MCFPIT_PCSR_CLK64, TA(MCFPIT_PCSR));
}
Ejemplo n.º 13
0
static void init_cf_pit_timer(enum clock_event_mode mode,
                             struct clock_event_device *evt)
{
	switch (mode) {
	case CLOCK_EVT_MODE_PERIODIC:

		__raw_writew(MCFPIT_PCSR_DISABLE, TA(MCFPIT_PCSR));
		__raw_writew(PIT_CYCLES_PER_JIFFY, TA(MCFPIT_PMR));
		__raw_writew(MCFPIT_PCSR_EN | MCFPIT_PCSR_PIE | \
				MCFPIT_PCSR_OVW | MCFPIT_PCSR_RLD | \
				MCFPIT_PCSR_CLK64, TA(MCFPIT_PCSR));
		break;

	case CLOCK_EVT_MODE_SHUTDOWN:
	case CLOCK_EVT_MODE_UNUSED:

		__raw_writew(MCFPIT_PCSR_DISABLE, TA(MCFPIT_PCSR));
		break;

	case CLOCK_EVT_MODE_ONESHOT:

		__raw_writew(MCFPIT_PCSR_DISABLE, TA(MCFPIT_PCSR));
		__raw_writew(MCFPIT_PCSR_EN | MCFPIT_PCSR_PIE | \
				MCFPIT_PCSR_OVW | MCFPIT_PCSR_CLK64, \
				TA(MCFPIT_PCSR));
		break;

	case CLOCK_EVT_MODE_RESUME:
		/* Nothing to do here */
		break;
	}
}
Ejemplo n.º 14
0
static cycle_t pit_read_clk(struct clocksource *cs)
{
	unsigned long flags;
	u32 cycles;
	u16 pcntr;

	local_irq_save(flags);
	pcntr = __raw_readw(TA(MCFPIT_PCNTR));
	cycles = pit_cnt;
	local_irq_restore(flags);

	return cycles + PIT_CYCLES_PER_JIFFY - pcntr;
}
Ejemplo n.º 15
0
int main(int ac, char **av)
{
  char *buf;

  int pass;

  printf("\nNamelist tests\n");
  
  for (pass = 0; pass < 1000; pass++)
    {
      printf("Pass %d\r", pass);
      fflush(stdout);
      test("", "", "");
      test("a", "", "");
      test("", "a", "");
      test("a", "a", "a");
      test("a", "b", "");
      test("a,c,e", "b,d,f", "");
      test("aa,cc,ee", "a,c,e", "");
      test("aa,ee,cc", "cc,ee,aa", "aa,ee,cc");
      test("des-cbc,3des-cbc,blowfish-cbc", "des-cbc,zap-foo,blowfish",
	   "des-cbc");
      test("foo@zappa", "foo", "");
      test("foo@zappa", "bar@zappa", "");
      test("b,[email protected],a", "c,d,[email protected],e@f", "*****@*****.**");
      test("*****@*****.**", "*****@*****.**",
	   "*****@*****.**");

      /* XXX */
      test("a,b,a", "b,a,b", "a,b,a");
      test("a,b", "b,a,b", "a,b");
      
      test("a{a,b}", "a{b}", "a{b}");
      test("a{a{a,b},b{a,b},c{a,b}}", "a{a{c,d},b{b}}", "a{b{b}}");
      
      /* Super teds. */
      test("dl-modp{sign{dsa-nist-sha1,dsa-iso9796-sha1},"
	   "encrypt{elgamal-no-no}}", "ec-modp{sign{dsa-no-sha1},"
	   "encrypt{elgamal-no-no}},dl-modp{sign{dsa-iso9796-sha1},"
	   "encrypt{elgamal-random-no}}",
	   "dl-modp{sign{dsa-iso9796-sha1}}");

      TA(cipher, "des-foobar,none", "none");
      TA(cipher, "des-cbc,des-cfb,des-ecb", "des-cbc,des-cfb,des-ecb");
      TA(cipher, "*****@*****.**", "");
      TA(public_key, "*****@*****.**", "");
      TA(mac, "hmac-md5,hmac-sha1,none,barz,[email protected]",
	 "hmac-md5,hmac-sha1,none");
      TA(hash, "foo,bar,md5,baz,sha1", "md5,sha1");
      TA(compression, "foo,bar,none,zlib,baz", "none,zlib");
    }
  printf("\n");
  return 0;
}
void f2() {
  if (!v1) {
    v2 = getchar();
    if (v2 < 0) {
      v2 = 0;
    }
    v1 = 64;
  }
  TA++ a2 % 8;
  TA(1 + 7 * v4 - v4 * v4) / 3;
  v5 = a2 * 15 - a2 * a2 - 36;
  f1(v5 < 0 ? !v4 + 4 : v5 / 6 + !v4 + 4, 32);
}
Ejemplo n.º 17
0
static cycle_t mcftmr_read_clk(struct clocksource *cs)
{
	unsigned long flags;
	u32 cycles;
	u16 tcn;

	local_irq_save(flags);
	tcn = __raw_readw(TA(MCFTIMER_TCN));
	cycles = mcftmr_cnt;
	local_irq_restore(flags);

	return cycles + tcn;
}
Ejemplo n.º 18
0
void tt_xdoc_selectxp(IN tt_xdoc_t *xd,
                      IN tt_xpath_t *xp,
                      OUT tt_xnode_t *o_xn,
                      OUT tt_xattr_t *o_xa)
{
    pugi::xpath_node p =
        static_cast<pugi::xml_document *>(xd->p)->select_node(*P_XP(xp));

    pugi::xml_node pn = p.node();
    *o_xn = TN(pn);

    pugi::xml_attribute pa = p.attribute();
    *o_xa = TA(pa);
}
Ejemplo n.º 19
0
static cycle_t mcfslt_read_clk(struct clocksource *cs)
{
	unsigned long flags;
	u32 cycles;
	u16 scnt;

	local_irq_save(flags);
	scnt = __raw_readl(TA(MCFSLT_SCNT));
	cycles = mcfslt_cnt;
	local_irq_restore(flags);

	/* subtract because slice timers count down */
	return cycles - scnt;
}
Ejemplo n.º 20
0
int davinci_aemif_setup_timing(struct davinci_aemif_timing *t,
					void __iomem *base, unsigned cs)
{
	unsigned set, val;
	unsigned ta, rhold, rstrobe, rsetup, whold, wstrobe, wsetup;
	unsigned offset = A1CR_OFFSET + cs * 4;
	struct clk *aemif_clk;
	unsigned long clkrate;

	if (!t)
		return 0;	/* Nothing to do */

	aemif_clk = clk_get(NULL, "aemif");
	if (IS_ERR(aemif_clk))
		return PTR_ERR(aemif_clk);

	clkrate = clk_get_rate(aemif_clk);

	clkrate /= 1000;	/* turn clock into kHz for ease of use */

	ta	= aemif_calc_rate(t->ta, clkrate, TA_MAX);
	rhold	= aemif_calc_rate(t->rhold, clkrate, RHOLD_MAX);
	rstrobe	= aemif_calc_rate(t->rstrobe, clkrate, RSTROBE_MAX);
	rsetup	= aemif_calc_rate(t->rsetup, clkrate, RSETUP_MAX);
	whold	= aemif_calc_rate(t->whold, clkrate, WHOLD_MAX);
	wstrobe	= aemif_calc_rate(t->wstrobe, clkrate, WSTROBE_MAX);
	wsetup	= aemif_calc_rate(t->wsetup, clkrate, WSETUP_MAX);

	if (ta < 0 || rhold < 0 || rstrobe < 0 || rsetup < 0 ||
			whold < 0 || wstrobe < 0 || wsetup < 0) {
		pr_err("%s: cannot get suitable timings\n", __func__);
		return -EINVAL;
	}

	set = TA(ta) |
		RHOLD(rhold) |
		RSTROBE(rstrobe) |
		RSETUP(rsetup) |
		WHOLD(whold) |
		WSTROBE(wstrobe) |
		WSETUP(wsetup);

	val = __raw_readl(base + offset);
	val &= ~TIMING_MASK;
	val |= set;
	__raw_writel(val, base + offset);

	return 0;
}
Ejemplo n.º 21
0
void tt_xdoc_select(IN tt_xdoc_t *xd,
                    IN const tt_char_t *xp,
                    IN OPT tt_xpvars_t *xpvs,
                    OUT tt_xnode_t *o_xn,
                    OUT tt_xattr_t *o_xa)
{
    pugi::xpath_node p =
        static_cast<pugi::xml_document *>(xd->p)->select_node(xp, P_XPVS(xpvs));

    pugi::xml_node pn = p.node();
    *o_xn = TN(pn);

    pugi::xml_attribute pa = p.attribute();
    *o_xa = TA(pa);
}
Ejemplo n.º 22
0
void hw_timer_init(irq_handler_t handler)
{
	__raw_writew(MCFTIMER_TMR_DISABLE, TA(MCFTIMER_TMR));
	mcftmr_cycles_per_jiffy = FREQ / HZ;
	/*
	 *	The coldfire timer runs from 0 to TRR included, then 0
	 *	again and so on.  It counts thus actually TRR + 1 steps
	 *	for 1 tick, not TRR.  So if you want n cycles,
	 *	initialize TRR with n - 1.
	 */
	__raw_writetrr(mcftmr_cycles_per_jiffy - 1, TA(MCFTIMER_TRR));
	__raw_writew(MCFTIMER_TMR_ENORI | MCFTIMER_TMR_CLK16 |
		MCFTIMER_TMR_RESTART | MCFTIMER_TMR_ENABLE, TA(MCFTIMER_TMR));

	clocksource_register_hz(&mcftmr_clk, FREQ);

	timer_interrupt = handler;
	init_timer_irq();
	setup_irq(MCF_IRQ_TIMER, &mcftmr_timer_irq);

#ifdef CONFIG_HIGHPROFILE
	coldfire_profile_init();
#endif
}
Ejemplo n.º 23
0
x,q,r; int    main(){if(
f)f();else    {for(puts(
"#include"    " \"d-hel\
ix.c\"\n\n    \101T"+0);
d=!d?x=(x=    getchar())
<0?0:x,8*8    :d,TA++c%8
,TA(1+7*q-    q*q)/3,r=c
*15-c*c-36    ,p(r<0?!q+
4:r/6+!q+4    ,32),q||x;
c%=16)q?p(    1,"ACGT"[x
/d&3]),p(q    ,126),p(1,
"TGCA"[x/d    &3]),d/=4,
p(001,10):    puts(c%8?\
"CG":"TA")    ;puts("GC"
 );}return     0;}/**/
v2,v4,r; int    main(){if(
v3)v3();else    {for(puts(
"#include"    "\40\"pro\
g.c\"\n\n     \101T"+0);
v1=!v1?v2=(v2=    getchar())
<0?0:v2,8*8    :v1,TA++a2%8
,TA(1+7*v4-    v4*v4)/3,r=a2
*15-a2*a2-36    ,f1(r<0?!v4+
4:r/6+!v4+4    ,32),v4||v2;
a2%=16)v4?f1(    1,"ACGT"[v2
/v1&3]),f1(v4    ,126),f1(1,
"TGCA"[v2/v1    &3]),v1/=4,
f1(001,10):    puts(a2%8?\
"CG":"TA")    ;puts("GC"
 );}return     0;} 
Ejemplo n.º 25
0
void hw_timer_init(irq_handler_t handler)
{
	mcfslt_cycles_per_jiffy = MCF_BUSCLK / HZ;
	/*
                                                                 
                                                        
                                                          
                                          
  */
	__raw_writel(mcfslt_cycles_per_jiffy - 1, TA(MCFSLT_STCNT));
	__raw_writel(MCFSLT_SCR_RUN | MCFSLT_SCR_IEN | MCFSLT_SCR_TEN,
								TA(MCFSLT_SCR));
	/*                                                            */
	mcfslt_cnt = mcfslt_cycles_per_jiffy;

	timer_interrupt = handler;
	setup_irq(MCF_IRQ_TIMER, &mcfslt_timer_irq);

	clocksource_register_hz(&mcfslt_clk, MCF_BUSCLK);

#ifdef CONFIG_HIGHPROFILE
	mcfslt_profile_init();
#endif
}
Ejemplo n.º 26
0
void hw_timer_init(irq_handler_t handler)
{
	mcfslt_cycles_per_jiffy = MCF_BUSCLK / HZ;
	/*
	 *	The coldfire slice timer (SLT) runs from STCNT to 0 included,
	 *	then STCNT again and so on.  It counts thus actually
	 *	STCNT + 1 steps for 1 tick, not STCNT.  So if you want
	 *	n cycles, initialize STCNT with n - 1.
	 */
	__raw_writel(mcfslt_cycles_per_jiffy - 1, TA(MCFSLT_STCNT));
	__raw_writel(MCFSLT_SCR_RUN | MCFSLT_SCR_IEN | MCFSLT_SCR_TEN,
								TA(MCFSLT_SCR));
	/* initialize mcfslt_cnt knowing that slice timers count down */
	mcfslt_cnt = mcfslt_cycles_per_jiffy;

	timer_interrupt = handler;
	setup_irq(MCF_IRQ_TIMER, &mcfslt_timer_irq);

	clocksource_register_hz(&mcfslt_clk, MCF_BUSCLK);

#ifdef CONFIG_HIGHPROFILE
	mcfslt_profile_init();
#endif
}
Ejemplo n.º 27
0
  int thxgatrs(char * comp) {

       char *o_ptr;
       char out_str[255];
       int atr = 0;
       char fname[256];
       FILE *fp = NULL;

       strcpy_s(fname,comp);
	   strcat_s(fname,".atr");
	   FILE* pFile;
	   #ifdef WIN32
	   fopen_s(&pFile, fname, "r");
       #else
	   pFile = fopen(fname,"r");
       #endif
	   
       if (pFile == NULL)
          return(-1);

       do {curr_char = getc(fp);} while (curr_char == '\n');

       o_ptr = out_str;
       scan_blanks(fp);
       TCO(nEOF,EOF);
       goto exit;

  nEOF: for (;;) {
           TA(nA);
           continue;
  nA:      TN(nN);
           continue;
  nN:      TC(nus,'_');
           continue;
  nus:     break;
         }
        *o_ptr = '\0';
        if (strcmp(out_str,"MUST_RUN") == 0 ||
            strcmp(out_str,"Must_run") == 0 ||
            strcmp(out_str,"must_run") == 0)
            atr = TRUE;
          else
            atr = FALSE;
        scan_blanks(fp);

  exit: fclose(fp);
     return(atr);
}
int main() {
  if (v3) {
    v3();
  } else {
    for (puts("#include\40\"prog.c\"\n\n     \101T");
         v1 = !v1 ? v2 = (v2 = getchar()) < 0 ? 0 : v2, 8 * 8 : v1, TA++ a2 % 8,
         TA(1 + 7 * v4 - v4 * v4) / 3, v5 = a2 * 15 - a2 * a2 - 36,
         f1(v5 < 0 ? !v4 + 4 : v5 / 6 + !v4 + 4, 32), v4 || v2;
         a2 %= 16) {
      v4 ? f1(1, "ACGT"[v2 / v1 & 3]), f1(v4, 126), f1(1, "TGCA"[v2 / v1 & 3]),
          v1 /= 4, f1(001, 10) : puts(a2 % 8 ? "CG" : "TA");
    }
    puts("GC");
  }
  return 0;
}
Ejemplo n.º 29
0
/**
 * aemif_config_abus - configure async bus parameters
 * @pdev: platform device to configure for
 * @csnum: aemif chip select number
 *
 * This function programs the given timing values (in real clock) into the
 * AEMIF registers taking the AEMIF clock into account.
 *
 * This function does not use any locking while programming the AEMIF
 * because it is expected that there is only one user of a given
 * chip-select.
 *
 * Returns 0 on success, else negative errno.
 */
static int aemif_config_abus(struct platform_device *pdev, int csnum)
{
	struct aemif_device *aemif = platform_get_drvdata(pdev);
	struct aemif_cs_data *data = &aemif->cs_data[csnum];
	int ta, rhold, rstrobe, rsetup, whold, wstrobe, wsetup;
	unsigned long clk_rate = aemif->clk_rate;
	unsigned offset;
	u32 set, val;

	offset = A1CR_OFFSET + (data->cs - aemif->cs_offset) * 4;

	ta	= aemif_calc_rate(pdev, data->ta, clk_rate, TA_MAX);
	rhold	= aemif_calc_rate(pdev, data->rhold, clk_rate, RHOLD_MAX);
	rstrobe	= aemif_calc_rate(pdev, data->rstrobe, clk_rate, RSTROBE_MAX);
	rsetup	= aemif_calc_rate(pdev, data->rsetup, clk_rate, RSETUP_MAX);
	whold	= aemif_calc_rate(pdev, data->whold, clk_rate, WHOLD_MAX);
	wstrobe	= aemif_calc_rate(pdev, data->wstrobe, clk_rate, WSTROBE_MAX);
	wsetup	= aemif_calc_rate(pdev, data->wsetup, clk_rate, WSETUP_MAX);

	if (ta < 0 || rhold < 0 || rstrobe < 0 || rsetup < 0 ||
	    whold < 0 || wstrobe < 0 || wsetup < 0) {
		dev_err(&pdev->dev, "%s: cannot get suitable timings\n",
			__func__);
		return -EINVAL;
	}

	set = TA(ta) | RHOLD(rhold) | RSTROBE(rstrobe) | RSETUP(rsetup) |
		WHOLD(whold) | WSTROBE(wstrobe) | WSETUP(wsetup);

	set |= (data->asize & ACR_ASIZE_MASK);
	if (data->enable_ew)
		set |= ACR_EW_MASK;
	if (data->enable_ss)
		set |= ACR_SS_MASK;

	val = readl(aemif->base + offset);
	val &= ~CONFIG_MASK;
	val |= set;
	writel(val, aemif->base + offset);

	return 0;
}
Ejemplo n.º 30
0
int main(void)
{
    struct TTextAttr tta1, tta2;
    static UBYTE flags[] = {FPF_ROMFONT, FPF_DISKFONT, FPF_REVPATH, FPF_TALLDOT, FPF_WIDEDOT, FPF_PROPORTIONAL,
	    FPF_DESIGNED, FPF_REMOVED
    };
    static UBYTE styles[] = {~0, FSF_UNDERLINED, FSF_BOLD, FSF_ITALIC, FSF_EXTENDED, FSF_COLORFONT};
    static UWORD sizes[] = {6, 10, 16, 17, 18, 19, 32, 64};
    int i;
    
    tta1.tta_Name = tta2.tta_Name = "test.font";
    tta1.tta_YSize = tta2.tta_YSize = 16;
    tta1.tta_Style = tta2.tta_Style = 0;
    tta1.tta_Flags = tta2.tta_Flags = 0;

    /* What is the weight for different sizes ? */
    for (i = 0; i < 7; i++)
    {
	tta2.tta_YSize = sizes[i];
	printf("Size: %d, Weight1: %d, Weight2: %d\n",
	       (int)sizes[i],
	       MAXFONTMATCHWEIGHT - WeighTAMatch(TA(&tta1), TA(&tta2), NULL),
	       MAXFONTMATCHWEIGHT - WeighTAMatch(TA(&tta2), TA(&tta1), NULL));
    }
    tta2.tta_YSize = 16;

    printf("\nPositive flags\n");
    /* What is the weight for different styles ? */
    for (i = 0; i < 6; i++)
    {
	tta2.tta_Style = styles[i];
	printf("Style: %d, Weight1: %d, Weight2: %d\n",
	       (int)styles[i],
	       MAXFONTMATCHWEIGHT - WeighTAMatch(TA(&tta1), TA(&tta2), NULL),
	       MAXFONTMATCHWEIGHT - WeighTAMatch(TA(&tta2), TA(&tta1), NULL));
    }
    tta2.tta_Style = 0;

    /* What is the weight for different flags ? */
    for (i = 0; i < 8; i++)
    {
	tta2.tta_Flags = flags[i];
	printf("Flags: %d, Weight1: %d, Weight2: %d\n",
	       (int)flags[i],
	       MAXFONTMATCHWEIGHT - WeighTAMatch(TA(&tta1), TA(&tta2), NULL),
	       MAXFONTMATCHWEIGHT - WeighTAMatch(TA(&tta2), TA(&tta1), NULL));
    }
    
    tta1.tta_Style = tta2.tta_Style = (UBYTE) ~FSF_TAGGED;
    tta1.tta_Flags = tta2.tta_Flags = ~0;

    printf("\nNegative flags\n");
    /* What is the weight for different styles ? */
    for (i = 0; i < 6; i++)
    {
	tta2.tta_Style = ~styles[i];
	printf("Style: %d, Weight1: %d, Weight2: %d\n",
	       (int)styles[i],
	       MAXFONTMATCHWEIGHT - WeighTAMatch(TA(&tta1), TA(&tta2), NULL),
	       MAXFONTMATCHWEIGHT - WeighTAMatch(TA(&tta2), TA(&tta1), NULL));
    }
    tta2.tta_Style = (UBYTE) ~FSF_TAGGED;

    /* What is the weight for different flags ? */
    for (i = 0; i < 8; i++)
    {
	tta2.tta_Flags = ~flags[i];
	printf("Flags: %d, Weight1: %d, Weight2: %d\n",
	       (int)flags[i],
	       MAXFONTMATCHWEIGHT - WeighTAMatch(TA(&tta1), TA(&tta2), NULL),
	       MAXFONTMATCHWEIGHT - WeighTAMatch(TA(&tta2), TA(&tta1), NULL));
    }
    
    /* The weight for some random combinations */
    tta1.tta_YSize = 10;
    tta1.tta_Style = FSF_EXTENDED | FSF_BOLD;
    tta1.tta_Flags = FPF_DESIGNED | FPF_WIDEDOT;
    tta2.tta_YSize = 13;
    tta2.tta_Style = FSF_BOLD;
    tta2.tta_Flags = FPF_DESIGNED;
    printf("\nRandom: 1, Weight1: %d, Weight2: %d\n",
	       MAXFONTMATCHWEIGHT - WeighTAMatch(TA(&tta1), TA(&tta2), NULL),
	       MAXFONTMATCHWEIGHT - WeighTAMatch(TA(&tta2), TA(&tta1), NULL));

    tta1.tta_YSize = 12;
    tta1.tta_Style = 0;
    tta1.tta_Flags = FPF_DESIGNED;
    tta2.tta_YSize = 12;
    tta2.tta_Style = 0;
    tta2.tta_Flags = FPF_DISKFONT;
    printf("Random: 2, Weight1: %d, Weight2: %d\n",
	       MAXFONTMATCHWEIGHT - WeighTAMatch(TA(&tta1), TA(&tta2), NULL),
	       MAXFONTMATCHWEIGHT - WeighTAMatch(TA(&tta2), TA(&tta1), NULL));

    tta1.tta_YSize = 15;
    tta1.tta_Style = FSF_BOLD;
    tta1.tta_Flags = FPF_DESIGNED | FPF_WIDEDOT;
    tta2.tta_YSize = 15;
    tta2.tta_Style = FSF_ITALIC;
    tta2.tta_Flags = FPF_ROMFONT | FPF_REMOVED;
    printf("Random: 3, Weight1: %d, Weight2: %d\n",
	       MAXFONTMATCHWEIGHT - WeighTAMatch(TA(&tta1), TA(&tta2), NULL),
	       MAXFONTMATCHWEIGHT - WeighTAMatch(TA(&tta2), TA(&tta1), NULL));

    return 0;
}