39 void default_vreg_init(
void) {
41 *CRM_SYS_CNTL = 0x00000018;
42 *CRM_VREG_CNTL = 0x00000f04;
43 for(i=0; i<0x161a8; i++) {
continue; }
45 *CRM_VREG_CNTL = 0x00000ff8;
48 void uart1_init(
volatile uint16_t inc,
volatile uint16_t mod,
volatile uint8_t samp) {
53 UART1->BR = ( inc << 16 ) | mod;
56 GPIO->PAD_DIR_SET.GPIO_14 = 1;
57 GPIO->PAD_DIR_SET.GPIO_16 = 1;
60 GPIO->PAD_DIR_RESET.GPIO_15 = 1;
61 GPIO->PAD_DIR_RESET.GPIO_17 = 1;
68 #if UART1_RX_BUFFERSIZE > 32
69 *UART1_UCON = (1 << 0) | (1 << 1) ;
71 u1_rx_head = 0; u1_rx_tail = 0;
72 #elif UART1_RX_BUFFERSIZE < 32
73 *UART1_UCON = (1 << 0) | (1 << 1) | (1 << 12) | (1 << 14);
74 *UART1_UCTS = UART1_RX_BUFFERSIZE;
75 *GPIO_FUNC_SEL1 = ( (0x01 << (0*2)) | (0x01 << (1*2)) );
77 *UART1_UCON = (1 << 0) | (1 << 1) | (1 << 14);
80 if(samp == UCON_SAMP_16X)
81 set_bit(*UART1_UCON,UCON_SAMP);
84 GPIO->FUNC_SEL.GPIO_14 = 1;
85 GPIO->FUNC_SEL.GPIO_15 = 1;
89 u1_tx_head = 0; u1_tx_tail = 0;
95 void uart2_init(
volatile uint16_t inc,
volatile uint16_t mod,
volatile uint8_t samp) {
100 UART2->BR = ( inc << 16 ) | mod;
103 GPIO->PAD_DIR_SET.GPIO_18 = 1;
104 GPIO->PAD_DIR_SET.GPIO_20 = 1;
107 GPIO->PAD_DIR_RESET.GPIO_19 = 1;
108 GPIO->PAD_DIR_RESET.GPIO_21 = 1;
115 #if UART2_RX_BUFFERSIZE > 32
116 *UART2_UCON = (1 << 0) | (1 << 1) ;
118 u2_rx_head = 0; u2_rx_tail = 0;
119 #elif UART2_RX_BUFFERSIZE < 32
120 *UART2_UCON = (1 << 0) | (1 << 1) | (0 << 12) | (1 << 14);
121 *UART2_UCTS = UART2_RX_BUFFERSIZE;
122 *GPIO_FUNC_SEL1 = ( (0x01 << (0*2)) | (0x01 << (1*2)) );
124 *UART2_UCON = (1 << 0) | (1 << 1) | (1 << 14);
127 if(samp == UCON_SAMP_16X)
128 set_bit(*UART2_UCON,UCON_SAMP);
131 GPIO->FUNC_SEL.GPIO_18 = 1;
132 GPIO->FUNC_SEL.GPIO_19 = 1;
136 u2_tx_head = 0; u2_tx_tail = 0;