Ignore:
Timestamp:
Sep 14, 2020, 6:36:03 PM (4 years ago)
Author:
coas-nagasima
Message:

SPIとSerial、KPUの動作を改善

File:
1 edited

Legend:

Unmodified
Added
Removed
  • azure_iot_hub_riscv/trunk/asp_baseplatform/target/k210_gcc/target_serial.c

    r453 r458  
    5555 *  SIL関数のマクロ定義
    5656 */
    57 #define sil_orw_mem(a, b)               sil_wrw_mem((a), sil_rew_mem(a) | (b))
    58 #define sil_andw_mem(a, b)              sil_wrw_mem((a), sil_rew_mem(a) & ~(b))
     57#define sil_orw_mem(a, b) sil_wrw_mem((a), sil_rew_mem(a) | (b))
     58#define sil_andw_mem(a, b) sil_wrw_mem((a), sil_rew_mem(a) & ~(b))
    5959
    6060/*
    6161 * レジスタ設定値
    6262 */
    63 #define INDEX_PORT(x)   ((x) - 1)
    64 #define GET_SIOPCB(x)   (&siopcb_table[INDEX_PORT(x)])
    65 
    66 #define __UART_BRATE_CONST  16
     63#define INDEX_PORT(x) ((x)-1)
     64#define GET_SIOPCB(x) (&siopcb_table[INDEX_PORT(x)])
     65
     66#define __UART_BRATE_CONST 16
    6767
    6868#ifndef COM0
    69 #define COM0                0
     69#define COM0 0
    7070#endif
    7171
     
    7373 *  ビット長パラメータ
    7474 */
    75 #define UART_WordLength_5B  0x00000000
    76 #define UART_WordLength_6B  0x00000001
    77 #define UART_WordLength_7B  0x00000002
    78 #define UART_WordLength_8b  0x00000003
     75#define UART_WordLength_5B 0x00000000
     76#define UART_WordLength_6B 0x00000001
     77#define UART_WordLength_7B 0x00000002
     78#define UART_WordLength_8b 0x00000003
    7979
    8080/*
    8181 *  ストップビットパラメータ
    82  */ 
    83 #define UART_StopBits_1     0x00000000
    84 #define UART_StopBits_1_5   UART_LCR_STB
     82 */
     83#define UART_StopBits_1 0x00000000
     84#define UART_StopBits_1_5 UART_LCR_STB
    8585
    8686/*
    8787 *  パリティパラメータ
    8888 */
    89 #define UART_Parity_No      0x00000000
    90 #define UART_Parity_Odd     UART_LCR_PARITY
    91 #define UART_Parity_Even    (UART_LCR_PARITY | UART_LCR_PEVEN)
     89#define UART_Parity_No 0x00000000
     90#define UART_Parity_Odd UART_LCR_PARITY
     91#define UART_Parity_Even (UART_LCR_PARITY | UART_LCR_PEVEN)
    9292
    9393/*
    9494 *  送信FIFO
    9595 */
    96 #define UART_SEND_FIFO0     0
    97 #define UART_SEND_FIFO2     1
    98 #define UART_SEND_FIFO4     2
    99 #define UART_SEND_FIFO8     3
     96#define UART_SEND_FIFO0 0
     97#define UART_SEND_FIFO2 1
     98#define UART_SEND_FIFO4 2
     99#define UART_SEND_FIFO8 3
    100100
    101101/*
    102102 *  受信FIFO
    103103 */
    104 #define UART_RECEIVE_FIFO1  0
    105 #define UART_RECEIVE_FIFO4  1
    106 #define UART_RECEIVE_FIFO8  2
     104#define UART_RECEIVE_FIFO1 0
     105#define UART_RECEIVE_FIFO4 1
     106#define UART_RECEIVE_FIFO8 2
    107107#define UART_RECEIVE_FIFO14 3
    108108
     
    112112typedef struct sio_port_initialization_block {
    113113        uint64_t base;
    114         INTNO    intno_usart;
     114        INTNO intno_usart;
    115115        uint32_t clk;
    116         uint8_t  txfunc;
    117         uint8_t  rxfunc;
    118         uint8_t  com;
     116        uint8_t txfunc;
     117        uint8_t rxfunc;
     118        uint8_t com;
    119119} SIOPINIB;
    120120
     
    123123 */
    124124struct sio_port_control_block {
    125         const SIOPINIB  *p_siopinib; /* シリアルI/Oポート初期化ブロック */
    126         intptr_t        exinf;        /* 拡張情報 */
    127         bool_t          opnflg;       /* オープン済みフラグ */
     125        const SIOPINIB *p_siopinib; /* シリアルI/Oポート初期化ブロック */
     126        intptr_t exinf;                         /* 拡張情報 */
     127        bool_t opnflg;                          /* オープン済みフラグ */
    128128};
    129129
     
    134134        {(uint32_t)TADR_UART1_BASE, (INTNO)IRQ_VECTOR_UART1, SYSCTL_CLK_EN_PERI_UART1_CLK_EN, FUNC_UART1_TX, FUNC_UART1_RX, COM0},
    135135#if TNUM_SIOP >= 2
    136         {(uint32_t)TADR_UART3_BASE, (INTNO)IRQ_VECTOR_UART3, SYSCTL_CLK_EN_PERI_UART3_CLK_EN, FUNC_UART3_TX, FUNC_UART3_RX, COM0^1}
     136        {(uint32_t)TADR_UART3_BASE, (INTNO)IRQ_VECTOR_UART3, SYSCTL_CLK_EN_PERI_UART3_CLK_EN, FUNC_UART3_TX, FUNC_UART3_RX, COM0 ^ 1}
    137137#endif
    138138};
     
    142142 */
    143143static uint8_t uartpin[2][2] = {
    144         {5, 4},         /* com0 tx, rx */
    145         {6, 7},         /* com1 tx, rx */
     144        {5, 4}, /* com0 tx, rx */
     145        {6, 7}, /* com1 tx, rx */
    146146};
    147147
     
    149149 *  シリアルI/Oポート管理ブロックのエリア
    150150 */
    151 SIOPCB  siopcb_table[TNUM_SIOP];
     151SIOPCB siopcb_table[TNUM_SIOP];
    152152
    153153/*
    154154 *  シリアルI/OポートIDから管理ブロックを取り出すためのマクロ
    155155 */
    156 #define INDEX_SIOP(siopid)      ((uint_t)((siopid) - 1))
    157 #define get_siopcb(siopid)      (&(siopcb_table[INDEX_SIOP(siopid)]))
     156#define INDEX_SIOP(siopid) ((uint_t)((siopid)-1))
     157#define get_siopcb(siopid) (&(siopcb_table[INDEX_SIOP(siopid)]))
    158158
    159159extern uint32_t get_pll_clock(uint8_t no);
     
    166166get_clock_aclk(void)
    167167{
    168         uint32_t clk_sel0 = sil_rew_mem((uint32_t *)(TADR_SYSCTL_BASE+TOFF_CLK_SEL0));
     168        uint32_t clk_sel0 = sil_rew_mem((uint32_t *)(TADR_SYSCTL_BASE + TOFF_CLK_SEL0));
    169169        uint32_t select = clk_sel0 & SYSCTL_CLK_SEL0_ACLK_SEL;
    170170        uint32_t source = 0;
    171171
    172         if(select == 0)
     172        if (select == 0)
    173173                source = SYSCTRL_CLOCK_FREQ_IN0;
    174         else if(select == 1)
    175                 source = get_pll_clock(0) / (2UL << ((clk_sel0 & SYSCTL_CLK_SEL0_ACLK_SDIVISER)>>1));
     174        else if (select == 1)
     175                source = get_pll_clock(0) / (2UL << ((clk_sel0 & SYSCTL_CLK_SEL0_ACLK_SDIVISER) >> 1));
    176176        return source;
    177177}
    178 
    179178
    180179void put_hex(char a, int val)
     
    183182        target_fput_log(a);
    184183        target_fput_log(' ');
    185         for(i = 28 ; i >= 0 ; i-= 4){
    186                 j = (val >> i) & 0xf;;
    187                 if(j > 9)
    188                         j += ('A'-10);
     184        for (i = 28; i >= 0; i -= 4) {
     185                j = (val >> i) & 0xf;
     186                if (j > 9)
     187                        j += ('A' - 10);
    189188                else
    190189                        j += '0';
     
    200199sio_initialize(intptr_t exinf)
    201200{
    202         SIOPCB  *p_siopcb;
    203         uint_t  i;
     201        SIOPCB *p_siopcb;
     202        uint_t i;
    204203
    205204        /*
     
    212211}
    213212
    214 
    215213/*
    216214 *  シリアルI/Oポートのオープン
     
    219217sio_opn_por(ID siopid, intptr_t exinf)
    220218{
    221         SIOPCB          *p_siopcb;
    222         const SIOPINIB  *p_siopinib;
    223         bool_t   opnflg;
    224         ER       ercd;
     219        SIOPCB *p_siopcb;
     220        const SIOPINIB *p_siopinib;
     221        bool_t opnflg;
     222        ER ercd;
    225223        unsigned long base;
    226224        uint32_t divisor, threshold, tmp;
    227         uint8_t  dlh, dll, dlf;
     225        uint8_t dlh, dll, dlf;
    228226
    229227        p_siopcb = get_siopcb(siopid);
     
    237235        p_siopcb->exinf = exinf;
    238236        base = p_siopinib->base;
    239         if(base == 0)                           /* no uart port */
     237        if (base == 0) /* no uart port */
    240238                goto sio_opn_exit;
    241239
     
    243241         *  ハードウェアの初期化
    244242         */
    245         sil_orw_mem((uint32_t *)(TADR_SYSCTL_BASE+TOFF_SYSCTL_CLK_EN_PERI), p_siopinib->clk);
    246 
    247         sil_wrw_mem((uint32_t *)(base+TOFF_UART_IER), 0x00000000);
     243        sil_orw_mem((uint32_t *)(TADR_SYSCTL_BASE + TOFF_SYSCTL_CLK_EN_PERI), p_siopinib->clk);
     244
     245        sil_wrw_mem((uint32_t *)(base + TOFF_UART_IER), 0x00000000);
    248246        sil_dly_nse(10000);
    249247
    250         threshold = (sil_rew_mem((uint32_t *)(TADR_SYSCTL_BASE+TOFF_CLK_SEL0)) & SYSCTL_CLK_SEL0_APB0_CLK_SEL) >> 3;
    251     divisor = (get_clock_aclk() / (threshold+1)) / BPS_SETTING;
    252     dlh = divisor >> 12;
    253     dll = (divisor - (dlh << 12)) / __UART_BRATE_CONST;
    254     dlf = divisor - (dlh << 12) - dll * __UART_BRATE_CONST;
    255 
    256     /* Set UART registers */
    257         sil_orw_mem((uint32_t *)(base+TOFF_UART_LCR), UART_LCR_DMD);
    258         sil_wrw_mem((uint32_t *)(base+TOFF_UART_DLH), dlh);
    259         sil_wrw_mem((uint32_t *)(base+TOFF_UART_DLL), dll);
    260         sil_wrw_mem((uint32_t *)(base+TOFF_UART_DLF), dlf);
    261         sil_wrw_mem((uint32_t *)(base+TOFF_UART_LCR), 0x00);
    262         sil_wrw_mem((uint32_t *)(base+TOFF_UART_LCR), (UART_WordLength_8b | UART_StopBits_1 | UART_Parity_No));
    263         sil_andw_mem((uint32_t *)(base+TOFF_UART_LCR), UART_LCR_DMD);
    264         sil_orw_mem((uint32_t *)(base+TOFF_UART_IER), UART_IER_THRE);
    265         sil_wrw_mem((uint32_t *)(base+TOFF_UART_FCR),
    266                         (UART_RECEIVE_FIFO1 << 6 | UART_SEND_FIFO8 << 4 | 0x1 << 3 | 0x1));
     248        threshold = (sil_rew_mem((uint32_t *)(TADR_SYSCTL_BASE + TOFF_CLK_SEL0)) & SYSCTL_CLK_SEL0_APB0_CLK_SEL) >> 3;
     249        divisor = (get_clock_aclk() / (threshold + 1)) / BPS_SETTING;
     250        dlh = divisor >> 12;
     251        dll = (divisor - (dlh << 12)) / __UART_BRATE_CONST;
     252        dlf = divisor - (dlh << 12) - dll * __UART_BRATE_CONST;
     253
     254        /* Set UART registers */
     255        sil_orw_mem((uint32_t *)(base + TOFF_UART_LCR), UART_LCR_DMD);
     256        sil_wrw_mem((uint32_t *)(base + TOFF_UART_DLH), dlh);
     257        sil_wrw_mem((uint32_t *)(base + TOFF_UART_DLL), dll);
     258        sil_wrw_mem((uint32_t *)(base + TOFF_UART_DLF), dlf);
     259        sil_wrw_mem((uint32_t *)(base + TOFF_UART_LCR), 0x00);
     260        sil_wrw_mem((uint32_t *)(base + TOFF_UART_LCR), (UART_WordLength_8b | UART_StopBits_1 | UART_Parity_No));
     261        sil_andw_mem((uint32_t *)(base + TOFF_UART_LCR), UART_LCR_DMD);
     262        sil_orw_mem((uint32_t *)(base + TOFF_UART_IER), UART_IER_THRE);
     263        sil_wrw_mem((uint32_t *)(base + TOFF_UART_FCR),
     264                                (UART_RECEIVE_FIFO14 << 6 | UART_SEND_FIFO8 << 4 /*| 0x1 << 3 DMA mode?*/ | 0x1 /*FIFO enable?*/));
     265        sil_andw_mem((uint32_t *)(base + TOFF_UART_MCR), (1 << 6) | 3);
     266        sil_wrw_mem((uint32_t *)(base + TOFF_UART_TCR), 0x00);
    267267
    268268        fpioa_set_function(uartpin[p_siopinib->com][1], p_siopinib->rxfunc);
    269269        fpioa_set_function(uartpin[p_siopinib->com][0], p_siopinib->txfunc);
    270         sil_orw_mem((uint32_t *)(base+TOFF_UART_IER), UART_IER_RIE);
    271         tmp = sil_rew_mem((uint32_t *)(p_siopcb->p_siopinib->base+TOFF_UART_RBR));
     270        sil_orw_mem((uint32_t *)(base + TOFF_UART_IER), UART_IER_RIE);
     271        tmp = sil_rew_mem((uint32_t *)(p_siopcb->p_siopinib->base + TOFF_UART_RBR));
    272272        p_siopcb->opnflg = true;
    273273        (void)(tmp);
     
    283283
    284284sio_opn_exit:;
    285         return(p_siopcb);
     285        return (p_siopcb);
    286286}
    287287
     
    292292sio_cls_por(SIOPCB *p_siopcb)
    293293{
    294         const SIOPINIB  *p_siopinib;
     294        const SIOPINIB *p_siopinib;
    295295
    296296        p_siopinib = p_siopcb->p_siopinib;
     
    305305         *  シリアル停止
    306306         */
    307         sil_wrw_mem((uint32_t *)(p_siopinib->base+TOFF_UART_IER), 0x00000000);
    308         sil_andw_mem((uint32_t *)(TADR_SYSCTL_BASE+TOFF_SYSCTL_CLK_EN_PERI), p_siopinib->clk);
     307        sil_wrw_mem((uint32_t *)(p_siopinib->base + TOFF_UART_IER), 0x00000000);
     308        sil_andw_mem((uint32_t *)(TADR_SYSCTL_BASE + TOFF_SYSCTL_CLK_EN_PERI), p_siopinib->clk);
    309309        p_siopcb->opnflg = false;
    310310}
     
    318318        SIOPCB *p_siopcb = get_siopcb(exinf);
    319319        unsigned long base = p_siopcb->p_siopinib->base;
    320         uint32_t ip = sil_rew_mem((uint32_t *)(base+TOFF_UART_IIR)) & 0x0F;
    321320        uint32_t tmp;
    322321
    323         if(ip == UART_IIR_RECEIVE || ip == UART_IIR_CTIMEOUT){
    324                 sio_irdy_rcv(p_siopcb->exinf);
    325         }
    326         else if(ip == UART_IIR_SEND){
    327                 sio_irdy_snd(p_siopcb->exinf);
    328         }
    329         else{
    330                 tmp = sil_rew_mem((uint32_t *)(base+TOFF_UART_LSR));
    331                 tmp = sil_rew_mem((uint32_t *)(base+TOFF_UART_USR));
    332                 tmp = sil_rew_mem((uint32_t *)(base+TOFF_UART_MSR));
    333         }
    334         (void)(tmp);
     322        for (;;) {
     323                uint32_t ip = sil_rew_mem((uint32_t *)(base + TOFF_UART_IIR)) & 0x0F;
     324
     325                if (ip == 1) {
     326                        break;
     327                }
     328                else if (ip == UART_IIR_RECEIVE || ip == UART_IIR_CTIMEOUT) {
     329                        sio_irdy_rcv(p_siopcb->exinf);
     330                }
     331                else if (ip == UART_IIR_SEND) {
     332                        sio_irdy_snd(p_siopcb->exinf);
     333                }
     334                else {
     335                        tmp = sil_rew_mem((uint32_t *)(base + TOFF_UART_LSR));
     336                        tmp = sil_rew_mem((uint32_t *)(base + TOFF_UART_USR));
     337                        tmp = sil_rew_mem((uint32_t *)(base + TOFF_UART_MSR));
     338                }
     339                (void)(tmp);
     340        }
    335341}
    336342
     
    339345 */
    340346Inline bool_t
    341 sio_putready(SIOPCB* p_siopcb)
    342 {
    343         uint32_t lsr = sil_rew_mem((uint32_t *)(p_siopcb->p_siopinib->base+TOFF_UART_LSR));
    344 
    345         if((lsr & UART_LSR_TFL) == 0){
     347sio_putready(SIOPCB *p_siopcb)
     348{
     349        uint32_t lsr = sil_rew_mem((uint32_t *)(p_siopcb->p_siopinib->base + TOFF_UART_LSR));
     350
     351        if ((lsr & UART_LSR_TFL) == 0) {
    346352                return 1;
    347353        }
     
    352358sio_snd_chr(SIOPCB *p_siopcb, char c)
    353359{
    354         if(sio_putready(p_siopcb)){
    355                 sil_wrw_mem((uint32_t *)(p_siopcb->p_siopinib->base+TOFF_UART_THR), (uint32_t)c);
     360        if (sio_putready(p_siopcb)) {
     361                sil_wrw_mem((uint32_t *)(p_siopcb->p_siopinib->base + TOFF_UART_THR), (uint32_t)c);
    356362                return true;
    357363        }
     
    367373        int_t c = -1;
    368374
    369         if((sil_rew_mem((uint32_t *)(p_siopcb->p_siopinib->base+TOFF_UART_LSR)) & UART_LSR_RFL) != 0){
    370                 c = sil_rew_mem((uint32_t *)(p_siopcb->p_siopinib->base+TOFF_UART_RBR)) & 0xFF;
     375        if ((sil_rew_mem((uint32_t *)(p_siopcb->p_siopinib->base + TOFF_UART_LSR)) & UART_LSR_RFL) != 0) {
     376                c = sil_rew_mem((uint32_t *)(p_siopcb->p_siopinib->base + TOFF_UART_RBR)) & 0xFF;
    371377        }
    372378        return c;
     
    381387        switch (cbrtn) {
    382388        case SIO_RDY_SND:
    383                 sil_orw_mem((uint32_t *)(p_siopcb->p_siopinib->base+TOFF_UART_IER), UART_IER_TIE);
     389                sil_orw_mem((uint32_t *)(p_siopcb->p_siopinib->base + TOFF_UART_IER), UART_IER_TIE);
    384390                break;
    385391        case SIO_RDY_RCV:
    386                 sil_orw_mem((uint32_t *)(p_siopcb->p_siopinib->base+TOFF_UART_IER), UART_IER_RIE);
     392                sil_orw_mem((uint32_t *)(p_siopcb->p_siopinib->base + TOFF_UART_IER), UART_IER_RIE);
    387393                break;
    388394        }
     
    397403        switch (cbrtn) {
    398404        case SIO_RDY_SND:
    399                 sil_andw_mem((uint32_t *)(p_siopcb->p_siopinib->base+TOFF_UART_IER), UART_IER_TIE);
     405                sil_andw_mem((uint32_t *)(p_siopcb->p_siopinib->base + TOFF_UART_IER), UART_IER_TIE);
    400406                break;
    401407        case SIO_RDY_RCV:
    402                 sil_andw_mem((uint32_t *)(p_siopcb->p_siopinib->base+TOFF_UART_IER), UART_IER_RIE);
     408                sil_andw_mem((uint32_t *)(p_siopcb->p_siopinib->base + TOFF_UART_IER), UART_IER_RIE);
    403409                break;
    404410        }
     
    412418        unsigned long base = siopinib_table[INDEX_PORT(siopid)].base;
    413419
    414         sil_wrw_mem((uint32_t *)(base+TOFF_UART_THR), (uint32_t)c);
    415         while(0 != (sil_rew_mem((uint32_t *)(base+TOFF_UART_LSR)) & UART_LSR_TFL));
     420        sil_wrw_mem((uint32_t *)(base + TOFF_UART_THR), (uint32_t)c);
     421        while (0 != (sil_rew_mem((uint32_t *)(base + TOFF_UART_LSR)) & UART_LSR_TFL))
     422                ;
    416423
    417424        /*
    418425         *  出力が完全に終わるまで待つ
    419426         */
    420         volatile int n = SYS_CLOCK/BPS_SETTING;
    421         while(n--);
     427        volatile int n = SYS_CLOCK / BPS_SETTING;
     428        while (n--)
     429                ;
    422430}
    423431
     
    427435void target_uart_init(ID siopid)
    428436{
    429         const SIOPINIB  *p_siopinib;
     437        const SIOPINIB *p_siopinib;
    430438        unsigned long base;
    431439        uint32_t divisor, threshold;
    432         uint8_t  dlh, dll, dlf;
     440        uint8_t dlh, dll, dlf;
    433441
    434442        p_siopinib = &siopinib_table[INDEX_PORT(siopid)];
     
    438446         *  ハードウェアの初期化
    439447         */
    440         sil_orw_mem((uint32_t *)(TADR_SYSCTL_BASE+TOFF_SYSCTL_CLK_EN_PERI), p_siopinib->clk);
    441 
    442         threshold = (sil_rew_mem((uint32_t *)(TADR_SYSCTL_BASE+TOFF_CLK_SEL0)) & SYSCTL_CLK_SEL0_APB0_CLK_SEL) >> 3;
    443     divisor = (get_clock_aclk() / (threshold+1)) / BPS_SETTING;
    444     dlh = divisor >> 12;
    445     dll = (divisor - (dlh << 12)) / __UART_BRATE_CONST;
    446     dlf = divisor - (dlh << 12) - dll * __UART_BRATE_CONST;
    447 
    448     /* Set UART registers */
    449         sil_orw_mem((uint32_t *)(base+TOFF_UART_LCR), UART_LCR_DMD);
    450         sil_wrw_mem((uint32_t *)(base+TOFF_UART_DLH), dlh);
    451         sil_wrw_mem((uint32_t *)(base+TOFF_UART_DLL), dll);
    452         sil_wrw_mem((uint32_t *)(base+TOFF_UART_DLF), dlf);
    453         sil_wrw_mem((uint32_t *)(base+TOFF_UART_LCR), 0x00);
    454         sil_wrw_mem((uint32_t *)(base+TOFF_UART_LCR), (UART_WordLength_8b | UART_StopBits_1 | UART_Parity_No));
    455         sil_andw_mem((uint32_t *)(base+TOFF_UART_LCR), UART_LCR_DMD);
    456         sil_orw_mem((uint32_t *)(base+TOFF_UART_IER), UART_IER_THRE);
    457         sil_wrw_mem((uint32_t *)(base+TOFF_UART_FCR),
    458                         (UART_RECEIVE_FIFO1 << 6 | UART_SEND_FIFO8 << 4 | 0x1 << 3 | 0x1));
     448        sil_orw_mem((uint32_t *)(TADR_SYSCTL_BASE + TOFF_SYSCTL_CLK_EN_PERI), p_siopinib->clk);
     449
     450        threshold = (sil_rew_mem((uint32_t *)(TADR_SYSCTL_BASE + TOFF_CLK_SEL0)) & SYSCTL_CLK_SEL0_APB0_CLK_SEL) >> 3;
     451        divisor = (get_clock_aclk() / (threshold + 1)) / BPS_SETTING;
     452        dlh = divisor >> 12;
     453        dll = (divisor - (dlh << 12)) / __UART_BRATE_CONST;
     454        dlf = divisor - (dlh << 12) - dll * __UART_BRATE_CONST;
     455
     456        /* Set UART registers */
     457        sil_orw_mem((uint32_t *)(base + TOFF_UART_LCR), UART_LCR_DMD);
     458        sil_wrw_mem((uint32_t *)(base + TOFF_UART_DLH), dlh);
     459        sil_wrw_mem((uint32_t *)(base + TOFF_UART_DLL), dll);
     460        sil_wrw_mem((uint32_t *)(base + TOFF_UART_DLF), dlf);
     461        sil_wrw_mem((uint32_t *)(base + TOFF_UART_LCR), 0x00);
     462        sil_wrw_mem((uint32_t *)(base + TOFF_UART_LCR), (UART_WordLength_8b | UART_StopBits_1 | UART_Parity_No));
     463        sil_andw_mem((uint32_t *)(base + TOFF_UART_LCR), UART_LCR_DMD);
     464        sil_orw_mem((uint32_t *)(base + TOFF_UART_IER), UART_IER_THRE);
     465        sil_wrw_mem((uint32_t *)(base + TOFF_UART_FCR),
     466                                (UART_RECEIVE_FIFO14 << 6 | UART_SEND_FIFO8 << 4 /*| 0x1 << 3 DMA mode?*/ | 0x1 /*FIFO enable?*/));
     467        sil_andw_mem((uint32_t *)(base + TOFF_UART_MCR), (1 << 6) | 3);
     468        sil_wrw_mem((uint32_t *)(base + TOFF_UART_TCR), 0x00);
    459469
    460470        fpioa_set_function(uartpin[p_siopinib->com][1], p_siopinib->rxfunc);
Note: See TracChangeset for help on using the changeset viewer.