b43-asm: Add tram keyword for writing to template ram
authorMichael Buesch <mb@bu3sch.de>
Thu, 19 Jun 2008 21:48:44 +0000 (23:48 +0200)
committerMichael Buesch <mb@bu3sch.de>
Thu, 19 Jun 2008 21:48:44 +0000 (23:48 +0200)
Signed-off-by: Michael Buesch <mb@bu3sch.de>
assembler/initvals.c
assembler/initvals.h
assembler/parser.y
assembler/scanner.l
assembler/test.asm

index b40356380e1d7e1ade274ed630937d0f4f112a03..5db74d149d7cb58246c8a13212ab67d60b9216cc 100644 (file)
@@ -189,6 +189,15 @@ static void assemble_write_shm(struct ivals_context *ctx,
        }
 }
 
+/* Template RAM write */
+static void assemble_write_tram(struct ivals_context *ctx,
+                               unsigned int offset,
+                               unsigned int value)
+{
+       assemble_write_mmio(ctx, 0x130, SIZE_32BIT, offset);
+       assemble_write_mmio(ctx, 0x134, SIZE_32BIT, value);
+}
+
 static void assemble_ival_section(struct ivals_context *ctx,
                                  const struct initvals_sect *sect)
 {
@@ -231,6 +240,10 @@ static void assemble_ival_section(struct ivals_context *ctx,
                                           op->args[0],
                                           SIZE_32BIT);
                        break;
+               case IVAL_W_TRAM:
+                       assemble_write_tram(ctx, op->args[1],
+                                           op->args[0]);
+                       break;
                }
        }
 }
index 0afecf24f9733907cac52e6578973598ccc7b342..0530a8f05b2afe724a15ba1bb1bd8ee9dc489a88 100644 (file)
@@ -12,6 +12,7 @@ struct initval_op {
                IVAL_W_RADIO,
                IVAL_W_SHM16,
                IVAL_W_SHM32,
+               IVAL_W_TRAM,
        } type;
        unsigned int args[3];
 
index 50065bab65e6b7f514c800052aaea51d0c393cf4..4ace3307cd8af11e278f300dd13d91e923fcfdf8 100644 (file)
@@ -45,7 +45,7 @@ extern struct initvals_sect *cur_initvals_sect;
 
 %token OP_ADD OP_ADDSC OP_ADDC OP_ADDSCC OP_SUB OP_SUBSC OP_SUBC OP_SUBSCC OP_SRA OP_OR OP_AND OP_XOR OP_SR OP_SRX OP_SL OP_RL OP_RR OP_NAND OP_ORX OP_MOV OP_JMP OP_JAND OP_JNAND OP_JS OP_JNS OP_JE OP_JNE OP_JLS OP_JGES OP_JGS OP_JLES OP_JL OP_JGE OP_JG OP_JLE OP_JZX OP_JNZX OP_JEXT OP_JNEXT OP_CALL OP_RET OP_TKIPH OP_TKIPHS OP_TKIPL OP_TKIPLS OP_NAP RAW_CODE
 
-%token IVAL_MMIO16 IVAL_MMIO32 IVAL_PHY IVAL_RADIO IVAL_SHM16 IVAL_SHM32
+%token IVAL_MMIO16 IVAL_MMIO32 IVAL_PHY IVAL_RADIO IVAL_SHM16 IVAL_SHM32 IVAL_TRAM
 
 %start line
 
@@ -149,6 +149,13 @@ ivals_write        : IVAL_MMIO16 imm_value COMMA imm_value {
                        iop->args[2] = (unsigned int)(unsigned long)$6;
                        $$ = iop;
                  }
+               | IVAL_TRAM imm_value COMMA imm_value {
+                       struct initval_op *iop = xmalloc(sizeof(struct initval_op));
+                       iop->type = IVAL_W_TRAM;
+                       iop->args[0] = (unsigned int)(unsigned long)$2;
+                       iop->args[1] = (unsigned int)(unsigned long)$4;
+                       $$ = iop;
+                 }
                ;
 
 statement      : asmdir {
index 5013d0e94e4e0a430fcab9f357624686cd2a7888..b135552a31a389259fc25c3c6b669c93f613c4f1 100644 (file)
@@ -142,6 +142,7 @@ phy                 { update_lineinfo(); return IVAL_PHY; }
 radio                  { update_lineinfo(); return IVAL_RADIO; }
 shm16                  { update_lineinfo(); return IVAL_SHM16; }
 shm32                  { update_lineinfo(); return IVAL_SHM32; }
+tram                   { update_lineinfo(); return IVAL_TRAM; }
 
 @[0-9a-fA-F]{3,3}      { update_lineinfo(); return RAW_CODE; }
 
index 2c25ddef0d68e873d991b318ecb5c7594ee9c0e2..a228d45c5fcf606e26f0374bd82881657b61fef3 100644 (file)
@@ -193,6 +193,7 @@ function_b:
        radio   0x1234, 0xABC                   /* Write 0x1234 to RADIO register 0xABC */
        shm16   0x1234, 0x0001, 0x0002          /* Write 0x1234 to SHM routing 0x0001, register 0x0002 */
        shm32   0x12345678, 0x0001, 0x0002      /* Write 0x12345678 to SHM routing 0x0001, register 0x0002 */
+       tram    0x12345678, 0x1234              /* Write 0x12345678 to Template Ram offset 0x1234 */
 
 
 // vim: syntax=b43 ts=8