mirror of https://github.com/ARMmbed/mbed-os.git
[MAX32620HSP] Cleanup with formatting script.
parent
8e70018ec1
commit
0611885832
|
@ -40,7 +40,8 @@ extern "C" {
|
||||||
|
|
||||||
extern char Image$$RW_IRAM1$$ZI$$Limit[];
|
extern char Image$$RW_IRAM1$$ZI$$Limit[];
|
||||||
|
|
||||||
extern __value_in_regs struct __initial_stackheap __user_setup_stackheap(uint32_t R0, uint32_t R1, uint32_t R2, uint32_t R3) {
|
extern __value_in_regs struct __initial_stackheap __user_setup_stackheap(uint32_t R0, uint32_t R1, uint32_t R2, uint32_t R3)
|
||||||
|
{
|
||||||
uint32_t zi_limit = (uint32_t)Image$$RW_IRAM1$$ZI$$Limit;
|
uint32_t zi_limit = (uint32_t)Image$$RW_IRAM1$$ZI$$Limit;
|
||||||
uint32_t sp_limit = __current_sp();
|
uint32_t sp_limit = __current_sp();
|
||||||
|
|
||||||
|
|
|
@ -72,72 +72,63 @@ typedef enum {
|
||||||
Bitfield structs for registers in this module
|
Bitfield structs for registers in this module
|
||||||
*/
|
*/
|
||||||
|
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
|
||||||
uint32_t wud_req_p0 : 8;
|
uint32_t wud_req_p0 : 8;
|
||||||
uint32_t wud_req_p1 : 8;
|
uint32_t wud_req_p1 : 8;
|
||||||
uint32_t wud_req_p2 : 8;
|
uint32_t wud_req_p2 : 8;
|
||||||
uint32_t wud_req_p3 : 8;
|
uint32_t wud_req_p3 : 8;
|
||||||
} mxc_ioman_wud_req0_t;
|
} mxc_ioman_wud_req0_t;
|
||||||
|
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
|
||||||
uint32_t wud_req_p4 : 8;
|
uint32_t wud_req_p4 : 8;
|
||||||
uint32_t wud_req_p5 : 8;
|
uint32_t wud_req_p5 : 8;
|
||||||
uint32_t wud_req_p6 : 1;
|
uint32_t wud_req_p6 : 1;
|
||||||
uint32_t : 15;
|
uint32_t : 15;
|
||||||
} mxc_ioman_wud_req1_t;
|
} mxc_ioman_wud_req1_t;
|
||||||
|
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
|
||||||
uint32_t wud_ack_p0 : 8;
|
uint32_t wud_ack_p0 : 8;
|
||||||
uint32_t wud_ack_p1 : 8;
|
uint32_t wud_ack_p1 : 8;
|
||||||
uint32_t wud_ack_p2 : 8;
|
uint32_t wud_ack_p2 : 8;
|
||||||
uint32_t wud_ack_p3 : 8;
|
uint32_t wud_ack_p3 : 8;
|
||||||
} mxc_ioman_wud_ack0_t;
|
} mxc_ioman_wud_ack0_t;
|
||||||
|
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
|
||||||
uint32_t wud_ack_p4 : 8;
|
uint32_t wud_ack_p4 : 8;
|
||||||
uint32_t wud_ack_p5 : 8;
|
uint32_t wud_ack_p5 : 8;
|
||||||
uint32_t wud_ack_p6 : 1;
|
uint32_t wud_ack_p6 : 1;
|
||||||
uint32_t : 15;
|
uint32_t : 15;
|
||||||
} mxc_ioman_wud_ack1_t;
|
} mxc_ioman_wud_ack1_t;
|
||||||
|
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
|
||||||
uint32_t ali_req_p0 : 8;
|
uint32_t ali_req_p0 : 8;
|
||||||
uint32_t ali_req_p1 : 8;
|
uint32_t ali_req_p1 : 8;
|
||||||
uint32_t ali_req_p2 : 8;
|
uint32_t ali_req_p2 : 8;
|
||||||
uint32_t ali_req_p3 : 8;
|
uint32_t ali_req_p3 : 8;
|
||||||
} mxc_ioman_ali_req0_t;
|
} mxc_ioman_ali_req0_t;
|
||||||
|
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
|
||||||
uint32_t ali_req_p4 : 8;
|
uint32_t ali_req_p4 : 8;
|
||||||
uint32_t ali_req_p5 : 8;
|
uint32_t ali_req_p5 : 8;
|
||||||
uint32_t ali_req_p6 : 1;
|
uint32_t ali_req_p6 : 1;
|
||||||
uint32_t : 15;
|
uint32_t : 15;
|
||||||
} mxc_ioman_ali_req1_t;
|
} mxc_ioman_ali_req1_t;
|
||||||
|
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
|
||||||
uint32_t ali_ack_p0 : 8;
|
uint32_t ali_ack_p0 : 8;
|
||||||
uint32_t ali_ack_p1 : 8;
|
uint32_t ali_ack_p1 : 8;
|
||||||
uint32_t ali_ack_p2 : 8;
|
uint32_t ali_ack_p2 : 8;
|
||||||
uint32_t ali_ack_p3 : 8;
|
uint32_t ali_ack_p3 : 8;
|
||||||
} mxc_ioman_ali_ack0_t;
|
} mxc_ioman_ali_ack0_t;
|
||||||
|
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
|
||||||
uint32_t ali_ack_p4 : 8;
|
uint32_t ali_ack_p4 : 8;
|
||||||
uint32_t ali_ack_p5 : 8;
|
uint32_t ali_ack_p5 : 8;
|
||||||
uint32_t ali_ack_p6 : 1;
|
uint32_t ali_ack_p6 : 1;
|
||||||
uint32_t : 15;
|
uint32_t : 15;
|
||||||
} mxc_ioman_ali_ack1_t;
|
} mxc_ioman_ali_ack1_t;
|
||||||
|
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
|
||||||
uint32_t : 4;
|
uint32_t : 4;
|
||||||
uint32_t core_io_req : 1;
|
uint32_t core_io_req : 1;
|
||||||
uint32_t : 3;
|
uint32_t : 3;
|
||||||
|
@ -151,8 +142,7 @@ typedef struct
|
||||||
uint32_t : 15;
|
uint32_t : 15;
|
||||||
} mxc_ioman_spix_req_t;
|
} mxc_ioman_spix_req_t;
|
||||||
|
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
|
||||||
uint32_t : 4;
|
uint32_t : 4;
|
||||||
uint32_t core_io_ack : 1;
|
uint32_t core_io_ack : 1;
|
||||||
uint32_t : 3;
|
uint32_t : 3;
|
||||||
|
@ -166,8 +156,7 @@ typedef struct
|
||||||
uint32_t : 15;
|
uint32_t : 15;
|
||||||
} mxc_ioman_spix_ack_t;
|
} mxc_ioman_spix_ack_t;
|
||||||
|
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
|
||||||
uint32_t io_map : 1;
|
uint32_t io_map : 1;
|
||||||
uint32_t cts_map : 1;
|
uint32_t cts_map : 1;
|
||||||
uint32_t rts_map : 1;
|
uint32_t rts_map : 1;
|
||||||
|
@ -178,8 +167,7 @@ typedef struct
|
||||||
uint32_t : 25;
|
uint32_t : 25;
|
||||||
} mxc_ioman_uart0_req_t;
|
} mxc_ioman_uart0_req_t;
|
||||||
|
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
|
||||||
uint32_t io_map : 1;
|
uint32_t io_map : 1;
|
||||||
uint32_t cts_map : 1;
|
uint32_t cts_map : 1;
|
||||||
uint32_t rts_map : 1;
|
uint32_t rts_map : 1;
|
||||||
|
@ -190,8 +178,7 @@ typedef struct
|
||||||
uint32_t : 25;
|
uint32_t : 25;
|
||||||
} mxc_ioman_uart0_ack_t;
|
} mxc_ioman_uart0_ack_t;
|
||||||
|
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
|
||||||
uint32_t io_map : 1;
|
uint32_t io_map : 1;
|
||||||
uint32_t cts_map : 1;
|
uint32_t cts_map : 1;
|
||||||
uint32_t rts_map : 1;
|
uint32_t rts_map : 1;
|
||||||
|
@ -202,8 +189,7 @@ typedef struct
|
||||||
uint32_t : 25;
|
uint32_t : 25;
|
||||||
} mxc_ioman_uart1_req_t;
|
} mxc_ioman_uart1_req_t;
|
||||||
|
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
|
||||||
uint32_t io_map : 1;
|
uint32_t io_map : 1;
|
||||||
uint32_t cts_map : 1;
|
uint32_t cts_map : 1;
|
||||||
uint32_t rts_map : 1;
|
uint32_t rts_map : 1;
|
||||||
|
@ -214,8 +200,7 @@ typedef struct
|
||||||
uint32_t : 25;
|
uint32_t : 25;
|
||||||
} mxc_ioman_uart1_ack_t;
|
} mxc_ioman_uart1_ack_t;
|
||||||
|
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
|
||||||
uint32_t io_map : 1;
|
uint32_t io_map : 1;
|
||||||
uint32_t cts_map : 1;
|
uint32_t cts_map : 1;
|
||||||
uint32_t rts_map : 1;
|
uint32_t rts_map : 1;
|
||||||
|
@ -226,8 +211,7 @@ typedef struct
|
||||||
uint32_t : 25;
|
uint32_t : 25;
|
||||||
} mxc_ioman_uart2_req_t;
|
} mxc_ioman_uart2_req_t;
|
||||||
|
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
|
||||||
uint32_t io_map : 1;
|
uint32_t io_map : 1;
|
||||||
uint32_t cts_map : 1;
|
uint32_t cts_map : 1;
|
||||||
uint32_t rts_map : 1;
|
uint32_t rts_map : 1;
|
||||||
|
@ -238,8 +222,7 @@ typedef struct
|
||||||
uint32_t : 25;
|
uint32_t : 25;
|
||||||
} mxc_ioman_uart2_ack_t;
|
} mxc_ioman_uart2_ack_t;
|
||||||
|
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
|
||||||
uint32_t io_map : 1;
|
uint32_t io_map : 1;
|
||||||
uint32_t cts_map : 1;
|
uint32_t cts_map : 1;
|
||||||
uint32_t rts_map : 1;
|
uint32_t rts_map : 1;
|
||||||
|
@ -250,8 +233,7 @@ typedef struct
|
||||||
uint32_t : 25;
|
uint32_t : 25;
|
||||||
} mxc_ioman_uart3_req_t;
|
} mxc_ioman_uart3_req_t;
|
||||||
|
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
|
||||||
uint32_t io_map : 1;
|
uint32_t io_map : 1;
|
||||||
uint32_t cts_map : 1;
|
uint32_t cts_map : 1;
|
||||||
uint32_t rts_map : 1;
|
uint32_t rts_map : 1;
|
||||||
|
@ -262,66 +244,57 @@ typedef struct
|
||||||
uint32_t : 25;
|
uint32_t : 25;
|
||||||
} mxc_ioman_uart3_ack_t;
|
} mxc_ioman_uart3_ack_t;
|
||||||
|
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
|
||||||
uint32_t : 4;
|
uint32_t : 4;
|
||||||
uint32_t mapping_req : 1;
|
uint32_t mapping_req : 1;
|
||||||
uint32_t : 27;
|
uint32_t : 27;
|
||||||
} mxc_ioman_i2cm0_req_t;
|
} mxc_ioman_i2cm0_req_t;
|
||||||
|
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
|
||||||
uint32_t : 4;
|
uint32_t : 4;
|
||||||
uint32_t mapping_ack : 1;
|
uint32_t mapping_ack : 1;
|
||||||
uint32_t : 27;
|
uint32_t : 27;
|
||||||
} mxc_ioman_i2cm0_ack_t;
|
} mxc_ioman_i2cm0_ack_t;
|
||||||
|
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
|
||||||
uint32_t : 4;
|
uint32_t : 4;
|
||||||
uint32_t mapping_req : 1;
|
uint32_t mapping_req : 1;
|
||||||
uint32_t : 27;
|
uint32_t : 27;
|
||||||
} mxc_ioman_i2cm1_req_t;
|
} mxc_ioman_i2cm1_req_t;
|
||||||
|
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
|
||||||
uint32_t : 4;
|
uint32_t : 4;
|
||||||
uint32_t mapping_ack : 1;
|
uint32_t mapping_ack : 1;
|
||||||
uint32_t : 27;
|
uint32_t : 27;
|
||||||
} mxc_ioman_i2cm1_ack_t;
|
} mxc_ioman_i2cm1_ack_t;
|
||||||
|
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
|
||||||
uint32_t : 4;
|
uint32_t : 4;
|
||||||
uint32_t mapping_req : 1;
|
uint32_t mapping_req : 1;
|
||||||
uint32_t : 27;
|
uint32_t : 27;
|
||||||
} mxc_ioman_i2cm2_req_t;
|
} mxc_ioman_i2cm2_req_t;
|
||||||
|
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
|
||||||
uint32_t : 4;
|
uint32_t : 4;
|
||||||
uint32_t mapping_ack : 1;
|
uint32_t mapping_ack : 1;
|
||||||
uint32_t : 27;
|
uint32_t : 27;
|
||||||
} mxc_ioman_i2cm2_ack_t;
|
} mxc_ioman_i2cm2_ack_t;
|
||||||
|
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
|
||||||
uint32_t io_sel : 2;
|
uint32_t io_sel : 2;
|
||||||
uint32_t : 2;
|
uint32_t : 2;
|
||||||
uint32_t mapping_req : 1;
|
uint32_t mapping_req : 1;
|
||||||
uint32_t : 27;
|
uint32_t : 27;
|
||||||
} mxc_ioman_i2cs_req_t;
|
} mxc_ioman_i2cs_req_t;
|
||||||
|
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
|
||||||
uint32_t io_sel : 2;
|
uint32_t io_sel : 2;
|
||||||
uint32_t : 2;
|
uint32_t : 2;
|
||||||
uint32_t mapping_ack : 1;
|
uint32_t mapping_ack : 1;
|
||||||
uint32_t : 27;
|
uint32_t : 27;
|
||||||
} mxc_ioman_i2cs_ack_t;
|
} mxc_ioman_i2cs_ack_t;
|
||||||
|
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
|
||||||
uint32_t : 4;
|
uint32_t : 4;
|
||||||
uint32_t core_io_req : 1;
|
uint32_t core_io_req : 1;
|
||||||
uint32_t : 3;
|
uint32_t : 3;
|
||||||
|
@ -337,8 +310,7 @@ typedef struct
|
||||||
uint32_t : 7;
|
uint32_t : 7;
|
||||||
} mxc_ioman_spim0_req_t;
|
} mxc_ioman_spim0_req_t;
|
||||||
|
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
|
||||||
uint32_t : 4;
|
uint32_t : 4;
|
||||||
uint32_t core_io_ack : 1;
|
uint32_t core_io_ack : 1;
|
||||||
uint32_t : 3;
|
uint32_t : 3;
|
||||||
|
@ -354,8 +326,7 @@ typedef struct
|
||||||
uint32_t : 7;
|
uint32_t : 7;
|
||||||
} mxc_ioman_spim0_ack_t;
|
} mxc_ioman_spim0_ack_t;
|
||||||
|
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
|
||||||
uint32_t : 4;
|
uint32_t : 4;
|
||||||
uint32_t core_io_req : 1;
|
uint32_t core_io_req : 1;
|
||||||
uint32_t : 3;
|
uint32_t : 3;
|
||||||
|
@ -369,8 +340,7 @@ typedef struct
|
||||||
uint32_t : 7;
|
uint32_t : 7;
|
||||||
} mxc_ioman_spim1_req_t;
|
} mxc_ioman_spim1_req_t;
|
||||||
|
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
|
||||||
uint32_t : 4;
|
uint32_t : 4;
|
||||||
uint32_t core_io_ack : 1;
|
uint32_t core_io_ack : 1;
|
||||||
uint32_t : 3;
|
uint32_t : 3;
|
||||||
|
@ -384,8 +354,7 @@ typedef struct
|
||||||
uint32_t : 7;
|
uint32_t : 7;
|
||||||
} mxc_ioman_spim1_ack_t;
|
} mxc_ioman_spim1_ack_t;
|
||||||
|
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
|
||||||
uint32_t mapping_req : 1;
|
uint32_t mapping_req : 1;
|
||||||
uint32_t : 3;
|
uint32_t : 3;
|
||||||
uint32_t core_io_req : 1;
|
uint32_t core_io_req : 1;
|
||||||
|
@ -403,8 +372,7 @@ typedef struct
|
||||||
uint32_t : 7;
|
uint32_t : 7;
|
||||||
} mxc_ioman_spim2_req_t;
|
} mxc_ioman_spim2_req_t;
|
||||||
|
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
|
||||||
uint32_t mapping_ack : 1;
|
uint32_t mapping_ack : 1;
|
||||||
uint32_t : 3;
|
uint32_t : 3;
|
||||||
uint32_t core_io_ack : 1;
|
uint32_t core_io_ack : 1;
|
||||||
|
@ -422,8 +390,7 @@ typedef struct
|
||||||
uint32_t : 7;
|
uint32_t : 7;
|
||||||
} mxc_ioman_spim2_ack_t;
|
} mxc_ioman_spim2_ack_t;
|
||||||
|
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
|
||||||
uint32_t : 4;
|
uint32_t : 4;
|
||||||
uint32_t core_io_req : 1;
|
uint32_t core_io_req : 1;
|
||||||
uint32_t : 3;
|
uint32_t : 3;
|
||||||
|
@ -433,8 +400,7 @@ typedef struct
|
||||||
uint32_t : 19;
|
uint32_t : 19;
|
||||||
} mxc_ioman_spib_req_t;
|
} mxc_ioman_spib_req_t;
|
||||||
|
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
|
||||||
uint32_t : 4;
|
uint32_t : 4;
|
||||||
uint32_t core_io_ack : 1;
|
uint32_t core_io_ack : 1;
|
||||||
uint32_t : 3;
|
uint32_t : 3;
|
||||||
|
@ -444,16 +410,14 @@ typedef struct
|
||||||
uint32_t : 19;
|
uint32_t : 19;
|
||||||
} mxc_ioman_spib_ack_t;
|
} mxc_ioman_spib_ack_t;
|
||||||
|
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
|
||||||
uint32_t : 4;
|
uint32_t : 4;
|
||||||
uint32_t mapping_req : 1;
|
uint32_t mapping_req : 1;
|
||||||
uint32_t epu_io_req : 1;
|
uint32_t epu_io_req : 1;
|
||||||
uint32_t : 26;
|
uint32_t : 26;
|
||||||
} mxc_ioman_owm_req_t;
|
} mxc_ioman_owm_req_t;
|
||||||
|
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
|
||||||
uint32_t : 4;
|
uint32_t : 4;
|
||||||
uint32_t mapping_ack : 1;
|
uint32_t mapping_ack : 1;
|
||||||
uint32_t epu_io_ack : 1;
|
uint32_t epu_io_ack : 1;
|
||||||
|
|
|
@ -88,8 +88,7 @@ void pin_dir(PinName name, PinDirection direction)
|
||||||
|
|
||||||
/* Enable default input weak pull-up by setting corresponding output */
|
/* Enable default input weak pull-up by setting corresponding output */
|
||||||
MXC_GPIO->out_val[port] |= 1 << pin;
|
MXC_GPIO->out_val[port] |= 1 << pin;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
/* Set requested output mode */
|
/* Set requested output mode */
|
||||||
MXC_GPIO->out_mode[port] = (MXC_GPIO->out_mode[port] & ~(0xF << (4 * pin))) | (MXC_V_GPIO_OUT_MODE_NORMAL << (4 * pin));
|
MXC_GPIO->out_mode[port] = (MXC_GPIO->out_mode[port] & ~(0xF << (4 * pin))) | (MXC_V_GPIO_OUT_MODE_NORMAL << (4 * pin));
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,7 +60,8 @@ static inline int gpio_read(gpio_t *obj)
|
||||||
|
|
||||||
void pin_dir(PinName name, PinDirection direction);
|
void pin_dir(PinName name, PinDirection direction);
|
||||||
|
|
||||||
static inline int gpio_is_connected(const gpio_t *obj) {
|
static inline int gpio_is_connected(const gpio_t *obj)
|
||||||
|
{
|
||||||
return obj->name != (PinName)NC;
|
return obj->name != (PinName)NC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -114,7 +114,7 @@ static void pwmout_update(pwmout_t* obj)
|
||||||
{
|
{
|
||||||
// Calculate and set the divider ratio
|
// Calculate and set the divider ratio
|
||||||
int div = (obj->period * (SystemCoreClock/1000000))/32;
|
int div = (obj->period * (SystemCoreClock/1000000))/32;
|
||||||
if (div < 2){
|
if (div < 2) {
|
||||||
div = 2;
|
div = 2;
|
||||||
}
|
}
|
||||||
MXC_SET_FIELD(&obj->pwm->rate_length, MXC_F_PT_RATE_LENGTH_RATE_CONTROL, div);
|
MXC_SET_FIELD(&obj->pwm->rate_length, MXC_F_PT_RATE_LENGTH_RATE_CONTROL, div);
|
||||||
|
@ -142,7 +142,7 @@ void pwmout_write(pwmout_t* obj, float percent)
|
||||||
float pwmout_read(pwmout_t* obj)
|
float pwmout_read(pwmout_t* obj)
|
||||||
{
|
{
|
||||||
// Check for when pulsewidth or period equals 0
|
// Check for when pulsewidth or period equals 0
|
||||||
if ((obj->pulse_width == 0) || (obj->period == 0)){
|
if ((obj->pulse_width == 0) || (obj->period == 0)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -86,8 +86,7 @@ static void usb_sleep(void)
|
||||||
MXC_USB->dev_cn = 0;
|
MXC_USB->dev_cn = 0;
|
||||||
MXC_USB->cn = 0;
|
MXC_USB->cn = 0;
|
||||||
restore_usb = 1; // USB should be restored upon wakeup
|
restore_usb = 1; // USB should be restored upon wakeup
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
restore_usb = 0;
|
restore_usb = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -187,8 +186,7 @@ void deepsleep(void)
|
||||||
__SEV();
|
__SEV();
|
||||||
__WFE();
|
__WFE();
|
||||||
__WFI();
|
__WFI();
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
// Note: ARM deep-sleep requires a specific sequence to clear event latches,
|
// Note: ARM deep-sleep requires a specific sequence to clear event latches,
|
||||||
// otherwise the CPU will not enter sleep.
|
// otherwise the CPU will not enter sleep.
|
||||||
__SEV();
|
__SEV();
|
||||||
|
|
|
@ -72,7 +72,8 @@ static volatile uint64_t event_cnt; // Holds the value of the next event
|
||||||
#define MAX_TICK_VAL ((uint64_t)0xFFFFFFFF * ticks_per_us)
|
#define MAX_TICK_VAL ((uint64_t)0xFFFFFFFF * ticks_per_us)
|
||||||
|
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
static inline void inc_current_cnt(uint32_t inc) {
|
static inline void inc_current_cnt(uint32_t inc)
|
||||||
|
{
|
||||||
|
|
||||||
// Overflow the ticker when the us ticker overflows
|
// Overflow the ticker when the us ticker overflows
|
||||||
current_cnt += inc;
|
current_cnt += inc;
|
||||||
|
@ -82,7 +83,8 @@ static inline void inc_current_cnt(uint32_t inc) {
|
||||||
}
|
}
|
||||||
|
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
static inline int event_passed(uint64_t current, uint64_t event) {
|
static inline int event_passed(uint64_t current, uint64_t event)
|
||||||
|
{
|
||||||
|
|
||||||
// Determine if the event has already happened.
|
// Determine if the event has already happened.
|
||||||
// If the event is behind the current ticker, within a window,
|
// If the event is behind the current ticker, within a window,
|
||||||
|
@ -97,7 +99,8 @@ static inline int event_passed(uint64_t current, uint64_t event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
static inline uint64_t event_diff(uint64_t current, uint64_t event) {
|
static inline uint64_t event_diff(uint64_t current, uint64_t event)
|
||||||
|
{
|
||||||
|
|
||||||
// Check to see if the ticker will overflow before the event
|
// Check to see if the ticker will overflow before the event
|
||||||
if(current <= event) {
|
if(current <= event) {
|
||||||
|
|
Loading…
Reference in New Issue