FreeCalypso > hg > ffs-editor
comparison src/cs/drivers/drv_app/r2d/board/uwire.c @ 0:92470e5d0b9e
src: partial import from FC Selenite
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Fri, 15 May 2020 01:28:16 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:92470e5d0b9e |
---|---|
1 /************************************************************************************ | |
2 * uwire.c : contains driver for the uwire HD module * | |
3 * * | |
4 * * | |
5 * Author: Davide Carpegna * | |
6 * * | |
7 * version: 1.0 * | |
8 * * | |
9 * Date: 22/09/2000 * | |
10 * (C) Copyright 2000 by Texas Instruments Incorporated, All Rights Reserved * | |
11 ************************************************************************************/ | |
12 | |
13 #include "rv/general.h" | |
14 #include "r2d/uwire.h" | |
15 #include "rvf/rvf_api.h" | |
16 | |
17 /********************************************************************/ | |
18 /* set the DC input to low for command transmission */ | |
19 /* */ | |
20 /********************************************************************/ | |
21 void set_DC_low(void) | |
22 { | |
23 * (volatile UINT16 *) GPIO_OUT &= ~(0x02); //gpio(1) ->0 | |
24 } | |
25 | |
26 /********************************************************************/ | |
27 /* set the DC input to high for data transmission */ | |
28 /* */ | |
29 /********************************************************************/ | |
30 void set_DC_high(void) | |
31 { | |
32 * (volatile UINT16 *) GPIO_OUT |= 0x02; //gpio(1) ->1 | |
33 } | |
34 | |
35 /********************************************************************/ | |
36 /* transmit commands to the lcd */ | |
37 /* */ | |
38 /********************************************************************/ | |
39 void lcd_transmit_cmd(UINT8 cmd) | |
40 { | |
41 set_DC_low(); | |
42 * (volatile UINT16 *) TDR = cmd <<8; | |
43 * (volatile UINT16 *) CSR |= NB_BITS_WR_8 + CS_CMD + START ; // transmit command data | |
44 while (((* (volatile UINT16 *) CSR) & CSRB) != 0 ); // wait for end of WRITE | |
45 * (volatile UINT16 *) CSR &= ~CS_CMD; // clears Chip Select | |
46 } | |
47 | |
48 /********************************************************************/ | |
49 /* transmit data to the lcd */ | |
50 /* */ | |
51 /********************************************************************/ | |
52 void lcd_transmit_data(UINT8 data) | |
53 { | |
54 set_DC_high(); | |
55 * (volatile UINT16 *) TDR = data <<8; | |
56 * (volatile UINT16 *) CSR |= NB_BITS_WR_8 + CS_CMD + START ; // transmit data | |
57 //while (((* (volatile UINT16 *) CSR) & CSRB) != 0 ); // wait for end of WRITE | |
58 //* (volatile UINT16 *) CSR &= ~CS_CMD; // clears Chip Select | |
59 } | |
60 | |
61 extern BOOLEAN lcd_polling(void) | |
62 { | |
63 if (((* (volatile UINT16 *) CSR) & CSRB) == 0 ) | |
64 { | |
65 * (volatile UINT16 *) CSR &= ~CS_CMD; // clears Chip Select | |
66 return(TRUE); | |
67 } | |
68 else | |
69 return(FALSE); | |
70 } | |
71 | |
72 /********************************************************************/ | |
73 /* initialize the uwire parameters for the lcd */ | |
74 /* */ | |
75 /********************************************************************/ | |
76 void uwire_init_lcd() | |
77 { | |
78 * ( UINT16 *) GPIO_INOUT &= ~(0x0002); // configures gpio(1) in output mode | |
79 | |
80 * ( UINT16 *) CNTL_RST &= ~(0x04); // releases reset_out | |
81 * ( UINT16 *) CNTL_RST |= (0x04); // set reset_out to 0 | |
82 rvf_delay(RVF_MS_TO_TICKS(1)); // waits for 5 ms | |
83 * ( UINT16 *) CNTL_RST &= ~(0x04); // releases reset_out | |
84 | |
85 | |
86 * (volatile UINT16 *) SR1 = CS1_FRQ_FINT_4 ; // F_INT/4 -> 13M/4 = 3.25 Mhz | |
87 * (volatile UINT16 *) SR3 = SR3_CLK_EN; // enables the uwire clock | |
88 * (volatile UINT16 *) CSR = INDEX_CS1; // selects CS1 | |
89 } | |
90 | |
91 | |
92 |