]> rtime.felk.cvut.cz Git - eurobot/public.git/commitdiff
ULoPoS uzv_rx arranged to run from FLASH
authorMarek P <marek@tesla.(none)>
Sat, 28 Mar 2009 22:46:36 +0000 (23:46 +0100)
committerMarek P <marek@tesla.(none)>
Sat, 28 Mar 2009 22:46:36 +0000 (23:46 +0100)
src/uzv/dsp/uzv_rx.c

index b365b152192938779f90d12a72dab524b9823025..709a4553a80678c5bf0d8e500714000c5b73fd56 100644 (file)
@@ -38,7 +38,9 @@ volatile int out_put_idx = 0, out_get_idx = 0;
 int32_t s1[BUF_LEN], s2[BUF_LEN], s3[BUF_LEN];
 volatile int buf_full = 0;
 
-void adc_irq() __attribute__((interrupt));
+void adc_irq() __attribute__((interrupt,section(".data")));
+//void sig_agc_send() __attribute__((section(".data")));
+//void sig_send_loop() __attribute__((section(".data")));
 
 void timer_init(uint32_t prescale, uint32_t period) {
   T0PR = prescale - 1;
@@ -198,7 +200,13 @@ void sig_agc_send() {
   led_set(LED_GRN, 0);
 }
 
+void sig_send_loop() {
+  for (;;)
+    sig_agc_send();
+}
+
 int main() {
+  cli();
   led_init();
   /* switch the CAN off due to clock change */
   can_off();
@@ -216,6 +224,7 @@ int main() {
   /* VPB=60MHz; 1000kb/s TSEG1=6, TSEG2=3, SJW=00 */
   can_init(0x250005, 14, NULL);
   msg.id = CANLOAD_ID;
+  sti();
 
 #ifdef DBG_FFT_TEST
   for (;;)
@@ -252,6 +261,15 @@ int main() {
   pwm_init(1, 833);
   sync_pwm_timer((uint32_t*)&T0TC);
 
-  for (;;)
-    sig_agc_send();
+  /***
+   * !?FIXME?! Proc je tu tahle blbost?
+   * nevim, ale bez tohohle prostouchnuti trubek
+   * to za nekterych okolnosi nejede :-\
+   ***/
+  msg.id = 0x0;  msg.dlc = 0;
+  while (can_tx_msg(&msg));
+
+  sig_send_loop();
+  /* let Sappho make herself happy: */
+  return 0;
 }