Skip to content

Commit 6b3b650

Browse files
committed
ports: fomu: place eptri into ram
Signed-off-by: Sean Cross <[email protected]>
1 parent 220040e commit 6b3b650

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

ports/fomu/src/usb-eptri.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ void eptri_usb_init(void) {
123123
return;
124124
}
125125

126+
__attribute__((section(".ramtext")))
126127
static void process_tx(void) {
127128

128129
// Don't allow requeueing -- only queue more data if the system is idle.
@@ -186,6 +187,7 @@ static void process_tx(void) {
186187
return;
187188
}
188189

190+
__attribute__((section(".ramtext")))
189191
static void process_rx(void) {
190192
// If we already have data in our buffer, don't do anything.
191193
if (out_have)
@@ -207,6 +209,7 @@ static void process_rx(void) {
207209
out_buffer_length -= 2;
208210
}
209211

212+
__attribute__((section(".ramtext")))
210213
void eptri_usb_send_epno(const void *data, int total_count, uint8_t epno) {
211214
while ((current_length || current_data) && !(usb_in_status_read() & (1 << CSR_USB_IN_STATUS_IDLE_OFFSET)))
212215
process_tx();
@@ -231,6 +234,7 @@ void eptri_usb_wait_for_send_done(void) {
231234
;
232235
}
233236

237+
__attribute__((section(".ramtext")))
234238
void eptri_usb_isr(void) {
235239
uint8_t setup_packet[10];
236240
uint32_t setup_length;
@@ -343,14 +347,21 @@ int eptri_usb_can_getc(void) {
343347
}
344348

345349
extern volatile uint8_t terminal_is_connected;
350+
__attribute__((section(".ramtext")))
346351
int eptri_usb_can_putc(void) {
347352
return terminal_is_connected && ! (usb_out_status_read() & (1 << CSR_USB_OUT_STATUS_HAVE_OFFSET));
348353
}
349354

355+
__attribute__((section(".ramtext")))
350356
int eptri_usb_write(const char *buf, int count) {
357+
int to_write = 64;
358+
if (to_write > count)
359+
to_write = count;
351360
eptri_usb_send_epno(buf, count, 2);
361+
return to_write;
352362
}
353363

364+
__attribute__((section(".ramtext")))
354365
int eptri_usb_getc(void) {
355366
uint8_t c = 0;
356367
if ((serial_buffer_ptr >= 0) && (serial_buffer_ptr < serial_buffer_len)) {

0 commit comments

Comments
 (0)