no sys.h required
This commit is contained in:
9
entry.c
9
entry.c
@@ -28,15 +28,10 @@
|
|||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include "sys.h"
|
|
||||||
|
|
||||||
static void __attribute__ ((used))
|
|
||||||
flash_unlock (void)
|
|
||||||
{
|
|
||||||
(*vector[3]) ();
|
|
||||||
}
|
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
#include "sys.h"
|
||||||
|
|
||||||
static void __attribute__ ((used))
|
static void __attribute__ ((used))
|
||||||
clock_init (void)
|
clock_init (void)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -20,13 +20,11 @@ set_led (int on)
|
|||||||
return (*func) (on);
|
return (*func) (on);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
static inline void
|
static inline void
|
||||||
flash_unlock (void)
|
flash_unlock (void)
|
||||||
{
|
{
|
||||||
(*vector[3]) ();
|
(*vector[3]) ();
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
static inline int
|
static inline int
|
||||||
flash_program_halfword (uint32_t addr, uint16_t data)
|
flash_program_halfword (uint32_t addr, uint16_t data)
|
||||||
|
|||||||
@@ -6,7 +6,6 @@
|
|||||||
static chopstx_mutex_t mtx;
|
static chopstx_mutex_t mtx;
|
||||||
static chopstx_cond_t cnd0;
|
static chopstx_cond_t cnd0;
|
||||||
static chopstx_cond_t cnd1;
|
static chopstx_cond_t cnd1;
|
||||||
static chopstx_cond_t cnd_intr;
|
|
||||||
|
|
||||||
static uint8_t u, v;
|
static uint8_t u, v;
|
||||||
static uint8_t m; /* 0..100 */
|
static uint8_t m; /* 0..100 */
|
||||||
@@ -51,34 +50,11 @@ blk (void *arg)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define INTR_REQ_0 0
|
|
||||||
|
|
||||||
static void *
|
|
||||||
intr (void *arg)
|
|
||||||
{
|
|
||||||
(void)arg;
|
|
||||||
chopstix_intr_t interrupt;
|
|
||||||
|
|
||||||
chopstx_intr_register (&interrupt, INTR_REQ_0);
|
|
||||||
|
|
||||||
while (1)
|
|
||||||
{
|
|
||||||
chopstx_wait_intr (&interrupt);
|
|
||||||
|
|
||||||
/* process interrupt... */
|
|
||||||
chopstx_usleep (200*1000);
|
|
||||||
}
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
#define PRIO_PWM 3
|
#define PRIO_PWM 3
|
||||||
#define PRIO_BLK 2
|
#define PRIO_BLK 2
|
||||||
#define PRIO_INTR 2
|
|
||||||
|
|
||||||
extern uint8_t __process1_stack_base__, __process1_stack_size__;
|
extern uint8_t __process1_stack_base__, __process1_stack_size__;
|
||||||
extern uint8_t __process2_stack_base__, __process2_stack_size__;
|
extern uint8_t __process2_stack_base__, __process2_stack_size__;
|
||||||
extern uint8_t __process3_stack_base__, __process3_stack_size__;
|
|
||||||
|
|
||||||
const uint32_t __stackaddr_pwm = (uint32_t)&__process1_stack_base__;
|
const uint32_t __stackaddr_pwm = (uint32_t)&__process1_stack_base__;
|
||||||
const size_t __stacksize_pwm = (size_t)&__process1_stack_size__;
|
const size_t __stacksize_pwm = (size_t)&__process1_stack_size__;
|
||||||
@@ -86,9 +62,6 @@ const size_t __stacksize_pwm = (size_t)&__process1_stack_size__;
|
|||||||
const uint32_t __stackaddr_blk = (uint32_t)&__process2_stack_base__;
|
const uint32_t __stackaddr_blk = (uint32_t)&__process2_stack_base__;
|
||||||
const size_t __stacksize_blk = (size_t)&__process2_stack_size__;
|
const size_t __stacksize_blk = (size_t)&__process2_stack_size__;
|
||||||
|
|
||||||
const uint32_t __stackaddr_intr = (uint32_t)&__process3_stack_base__;
|
|
||||||
const size_t __stacksize_intr = (size_t)&__process3_stack_size__;
|
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
main (int argc, const char *argv[])
|
main (int argc, const char *argv[])
|
||||||
@@ -116,11 +89,6 @@ main (int argc, const char *argv[])
|
|||||||
|
|
||||||
chopstx_create (&thd, &attr, blk, NULL);
|
chopstx_create (&thd, &attr, blk, NULL);
|
||||||
|
|
||||||
chopstx_attr_setschedparam (&attr, PRIO_INTR);
|
|
||||||
chopstx_attr_setstack (&attr, __stackaddr_intr, __stacksize_intr);
|
|
||||||
|
|
||||||
chopstx_create (&thd, &attr, intr, NULL);
|
|
||||||
|
|
||||||
chopstx_usleep (200*1000);
|
chopstx_usleep (200*1000);
|
||||||
|
|
||||||
chopstx_mutex_lock (&mtx);
|
chopstx_mutex_lock (&mtx);
|
||||||
|
|||||||
@@ -20,13 +20,11 @@ set_led (int on)
|
|||||||
return (*func) (on);
|
return (*func) (on);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
static inline void
|
static inline void
|
||||||
flash_unlock (void)
|
flash_unlock (void)
|
||||||
{
|
{
|
||||||
(*vector[3]) ();
|
(*vector[3]) ();
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
static inline int
|
static inline int
|
||||||
flash_program_halfword (uint32_t addr, uint16_t data)
|
flash_program_halfword (uint32_t addr, uint16_t data)
|
||||||
|
|||||||
Reference in New Issue
Block a user