Rev 3582 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3582 | Rev 3618 | ||
---|---|---|---|
Line 96... | Line 96... | ||
96 | ((type *) (sram_virt_addr + sram_buffer_offset + (offset))) |
96 | ((type *) (sram_virt_addr + sram_buffer_offset + (offset))) |
97 | 97 | ||
98 | /** Returns a pointer to the console buffer header. */ |
98 | /** Returns a pointer to the console buffer header. */ |
99 | #define SGCN_BUFFER_HEADER (SGCN_BUFFER(sgcn_buffer_header_t, 0)) |
99 | #define SGCN_BUFFER_HEADER (SGCN_BUFFER(sgcn_buffer_header_t, 0)) |
100 | 100 | ||
- | 101 | /** |
|
- | 102 | * Pushes the character to the SGCN serial. |
|
- | 103 | * @param c character to be pushed |
|
- | 104 | */ |
|
101 | static void sgcn_putc(char c) |
105 | static void sgcn_putc(char c) |
102 | { |
106 | { |
103 | uint32_t begin = SGCN_BUFFER_HEADER->out_begin; |
107 | uint32_t begin = SGCN_BUFFER_HEADER->out_begin; |
104 | uint32_t end = SGCN_BUFFER_HEADER->out_end; |
108 | uint32_t end = SGCN_BUFFER_HEADER->out_end; |
105 | uint32_t size = end - begin; |
109 | uint32_t size = end - begin; |
Line 115... | Line 119... | ||
115 | ; |
119 | ; |
116 | *buf_ptr = c; |
120 | *buf_ptr = c; |
117 | *out_wrptr_ptr = new_wrptr; |
121 | *out_wrptr_ptr = new_wrptr; |
118 | } |
122 | } |
119 | 123 | ||
- | 124 | /** |
|
- | 125 | * Main function of the thread serving client connections. |
|
- | 126 | */ |
|
120 | static void sgcn_client_connection(ipc_callid_t iid, ipc_call_t *icall) |
127 | static void sgcn_client_connection(ipc_callid_t iid, ipc_call_t *icall) |
121 | { |
128 | { |
122 | int retval; |
129 | int retval; |
123 | ipc_callid_t callid; |
130 | ipc_callid_t callid; |
124 | ipc_call_t call; |
131 | ipc_call_t call; |
Line 209... | Line 216... | ||
209 | } |
216 | } |
210 | ipc_answer_0(callid, retval); |
217 | ipc_answer_0(callid, retval); |
211 | } |
218 | } |
212 | } |
219 | } |
213 | 220 | ||
- | 221 | /** |
|
- | 222 | * Initializes the SGCN serial driver. |
|
- | 223 | */ |
|
214 | int sgcn_init(void) |
224 | int sgcn_init(void) |
215 | { |
225 | { |
216 | sram_virt_addr = (uintptr_t) as_get_mappable_page(sysinfo_value("sram.area.size")); |
226 | sram_virt_addr = (uintptr_t) as_get_mappable_page( |
- | 227 | sysinfo_value("sram.area.size")); |
|
217 | int result = physmem_map( |
228 | int result = physmem_map( |
218 | (void *) sysinfo_value("sram.address.physical"), |
229 | (void *) sysinfo_value("sram.address.physical"), |
219 | (void *) sram_virt_addr, |
230 | (void *) sram_virt_addr, |
220 | sysinfo_value("sram.area.size") / PAGE_SIZE, |
231 | sysinfo_value("sram.area.size") / PAGE_SIZE, |
221 | AS_AREA_READ | AS_AREA_WRITE |
232 | AS_AREA_READ | AS_AREA_WRITE |
Line 234... | Line 245... | ||
234 | } |
245 | } |
235 | 246 | ||
236 | /** |
247 | /** |
237 | * @} |
248 | * @} |
238 | */ |
249 | */ |
239 | - | ||
240 | 250 | ||
- | 251 |