summaryrefslogtreecommitdiff
path: root/firmware/target/arm/tms320dm320/uart-dm320.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/arm/tms320dm320/uart-dm320.c')
-rw-r--r--firmware/target/arm/tms320dm320/uart-dm320.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/firmware/target/arm/tms320dm320/uart-dm320.c b/firmware/target/arm/tms320dm320/uart-dm320.c
index 50e6998e2a..0aeb856027 100644
--- a/firmware/target/arm/tms320dm320/uart-dm320.c
+++ b/firmware/target/arm/tms320dm320/uart-dm320.c
@@ -39,7 +39,7 @@ static volatile int uart1_receive_count, uart1_receive_read, uart1_receive_write
39void uart_init(void) 39void uart_init(void)
40{ 40{
41 /* Enable UART clock */ 41 /* Enable UART clock */
42 IO_CLK_MOD2 |= CLK_MOD2_UART1; 42 bitset16(&IO_CLK_MOD2, CLK_MOD2_UART1);
43 43
44 // 8-N-1 44 // 8-N-1
45 IO_UART1_MSR = 0xC400; 45 IO_UART1_MSR = 0xC400;
@@ -58,7 +58,7 @@ void uart_init(void)
58 uart1_send_write=0; 58 uart1_send_write=0;
59 59
60 /* Enable the interrupt */ 60 /* Enable the interrupt */
61 IO_INTC_EINT0 |= INTR_EINT0_UART1; 61 bitset16(&IO_INTC_EINT0, INTR_EINT0_UART1);
62} 62}
63 63
64/* This function is not interrupt driven */ 64/* This function is not interrupt driven */
@@ -85,7 +85,7 @@ void uart1_puts(const char *str, int size)
85 memcpy(uart1_send_buffer_ring, str, size); 85 memcpy(uart1_send_buffer_ring, str, size);
86 86
87 /* Disable interrupt while modifying the pointers */ 87 /* Disable interrupt while modifying the pointers */
88 IO_INTC_EINT0 &= ~INTR_EINT0_UART1; 88 bitclr16(&IO_INTC_EINT0, INTR_EINT0_UART1);
89 89
90 uart1_send_count=size; 90 uart1_send_count=size;
91 uart1_send_read=0; 91 uart1_send_read=0;
@@ -98,25 +98,27 @@ void uart1_puts(const char *str, int size)
98 } 98 }
99 99
100 /* Enable interrupt */ 100 /* Enable interrupt */
101 IO_INTC_EINT0 |= INTR_EINT0_UART1; 101 bitset16(&IO_INTC_EINT0, INTR_EINT0_UART1);
102} 102}
103 103
104void uart1_clear_queue(void) 104void uart1_clear_queue(void)
105{ 105{
106 /* Disable interrupt while modifying the pointers */ 106 /* Disable interrupt while modifying the pointers */
107 IO_INTC_EINT0 &= ~INTR_EINT0_UART1; 107 bitclr16(&IO_INTC_EINT0, INTR_EINT0_UART1);
108
108 uart1_receive_write=0; 109 uart1_receive_write=0;
109 uart1_receive_count=0; 110 uart1_receive_count=0;
110 uart1_receive_read=0; 111 uart1_receive_read=0;
112
111 /* Enable interrupt */ 113 /* Enable interrupt */
112 IO_INTC_EINT0 |= INTR_EINT0_UART1; 114 bitset16(&IO_INTC_EINT0, INTR_EINT0_UART1);
113} 115}
114 116
115/* This function returns the number of bytes left in the queue after a read is done (negative if fail)*/ 117/* This function returns the number of bytes left in the queue after a read is done (negative if fail)*/
116int uart1_gets_queue(char *str, int size) 118int uart1_gets_queue(char *str, int size)
117{ 119{
118 /* Disable the interrupt while modifying the pointers */ 120 /* Disable the interrupt while modifying the pointers */
119 IO_INTC_EINT0 &= ~INTR_EINT0_UART1; 121 bitclr16(&IO_INTC_EINT0, INTR_EINT0_UART1);
120 int retval; 122 int retval;
121 123
122 if(uart1_receive_count<size) 124 if(uart1_receive_count<size)
@@ -146,7 +148,7 @@ int uart1_gets_queue(char *str, int size)
146 } 148 }
147 149
148 /* Enable the interrupt */ 150 /* Enable the interrupt */
149 IO_INTC_EINT0 |= INTR_EINT0_UART1; 151 bitset16(&IO_INTC_EINT0, INTR_EINT0_UART1);
150 152
151 return retval; 153 return retval;
152} 154}
@@ -176,3 +178,4 @@ void UART1(void)
176 uart1_send_count--; 178 uart1_send_count--;
177 } 179 }
178} 180}
181