Contiki 3.x
Files | Data Structures | Functions
PIC32 Contiki Port

Files

file  clock.c
 Clock routines.
 
file  debug-uart.h
 Debug output redirection to uart.
 
file  debug-uart.h
 Debug output redirection to uart.
 
file  mtarch.h
 Implementation of multithreading in PIC32.
 
file  mtarch.h
 Implementation of multithreading in PIC32.
 
file  pic32.h
 PIC32MX initialization routines.
 
file  rtimer-arch.c
 PIC32MX RTIMER routines.
 
file  rtimer-arch.h
 PIC32MX RTIMER routines.
 
file  slip-uart.c
 PIC32MX Slip interface routines.
 
file  watchdog.c
 PIC32MX Watchdog routines.
 
file  pic32_clock.c
 CLOCK interface for PIC32MX (pic32mx795f512l)
 
file  pic32_clock.h
 CLOCK interface for PIC32MX (pic32mx795f512l)
 
file  pic32_irq.h
 INTERRUPT interface for PIC32MX (pic32mx795f512l)
 
file  pic32_spi.c
 SPI interface for PIC32MX (pic32mx795f512l)
 
file  pic32_spi.h
 SPI interface for PIC32MX (pic32mx795f512l)
 
file  pic32_timer.c
 TIMER interface for PIC32MX (pic32mx795f512l)
 
file  pic32_timer.h
 TIMER interface for PIC32MX (pic32mx795f512l)
 
file  pic32_uart.c
 UART Interface for PIC32MX (pic32mx795f512l)
 
file  pic32_uart.h
 UART Interface for PIC32MX (pic32mx795f512l)
 

Data Structures

struct  mtarch_thread
 Copyright (c) 2014, Analog Devices, Inc. More...
 

Functions

clock_time_t clock_time (void)
 Get the current clock time. More...
 
unsigned long clock_seconds (void)
 Get the current value of the platform seconds. More...
 
void clock_set_seconds (unsigned long sec)
 Set the value of the platform seconds. More...
 
void clock_delay_usec (uint16_t dt)
 Delay a given number of microseconds. More...
 
void clock_delay (unsigned int delay)
 Obsolete delay function but we implement it here since some code still uses it. More...
 
void rtimer_arch_init (void)
 We don't need to explicitly initialise anything but this routine is required by the API. More...
 
rtimer_clock_t rtimer_arch_now (void)
 Returns the current real-time clock time. More...
 
void rtimer_arch_schedule (rtimer_clock_t t)
 Schedules an rtimer task to be triggered at time t. More...
 
void watchdog_init (void)
 Copyright (c) 2014, Analog Devices, Inc. More...
 
void watchdog_start (void)
 Starts the WDT in watchdog mode if enabled by user configuration, maximum interval.
 
void watchdog_periodic (void)
 Writes the WDT clear sequence. More...
 
void watchdog_stop (void)
 In watchdog mode, the WDT can not be stopped. More...
 
void watchdog_reboot (void)
 Keeps control until the WDT throws a reset signal. More...
 
uint32_t pic32_clock_get_system_clock (void)
 Calculate the system clock. More...
 
uint32_t pic32_clock_get_peripheral_clock (void)
 Calculate the peripheral clock. More...
 

Detailed Description

Function Documentation

void clock_delay ( unsigned int  delay)
inline

Obsolete delay function but we implement it here since some code still uses it.

Obsolete delay function but we implement it here since some code still uses it.

The original clock_delay for the msp430 used a granularity of 2.83 usec. This approximates that delay for values up to 1456 usec. (The largest core call in leds.c uses 400).

Obsolete delay function but we implement it here since some code still uses it.

Definition at line 150 of file clock.c.

References clock_delay_usec().

void clock_delay_usec ( uint16_t  dt)

Delay a given number of microseconds.

Parameters
dtHow many microseconds to delay.
Note
Interrupts could increase the delay by a variable amount.

Delay a given number of microseconds.

Delay a given number of microseconds.

Parameters
lenDelay len uSecs

See clock_init() for GPT0 Timer A's configuration

Delay a given number of microseconds.

Use the 250KHz MACA clock for longer delays to avoid interrupt effects. However that can't be used if the radio is being power cycled!

Definition at line 126 of file clock.c.

References pic32_clock_get_system_clock().

Referenced by cc2430_rf_command(), clock_delay(), clock_delay_msec(), main(), and mrf24j40_init().

unsigned long clock_seconds ( void  )

Get the current value of the platform seconds.

This could be the number of seconds since startup, or since a standard epoch.

Returns
The value.

Get the current value of the platform seconds.

The comparison avoids the need to disable clock interrupts for an atomic read of the four-byte variable.

Definition at line 90 of file clock.c.

void clock_set_seconds ( unsigned long  sec)

Set the value of the platform seconds.

Parameters
secThe value to set.

Set the value of the platform seconds.

to a standard epoch for an absolute date/time.

Definition at line 96 of file clock.c.

clock_time_t clock_time ( void  )

Get the current clock time.

This function returns the current system clock time.

Returns
The current clock time, measured in system ticks.

Get the current clock time.

When 16 bit it typically wraps every 10 minutes. The comparison avoids the need to disable clock interrupts for an atomic read of the multi-byte variable.

Definition at line 84 of file clock.c.

uint32_t pic32_clock_get_peripheral_clock ( void  )

Calculate the peripheral clock.

Returns
the peripheral clock value.

Definition at line 96 of file pic32_clock.c.

References pic32_clock_get_system_clock().

uint32_t pic32_clock_get_system_clock ( void  )

Calculate the system clock.

Returns
the system clock value.

Definition at line 82 of file pic32_clock.c.

Referenced by clock_delay_usec(), and pic32_clock_get_peripheral_clock().

void rtimer_arch_init ( void  )

We don't need to explicitly initialise anything but this routine is required by the API.

The Sleep Timer starts ticking automatically as soon as the device turns on. We don't need to turn on interrupts before the first call to rtimer_arch_schedule()

Definition at line 82 of file rtimer-arch.c.

rtimer_clock_t rtimer_arch_now ( void  )

Returns the current real-time clock time.

Returns
The current rtimer time in ticks
See Also
RTIMER_NOW()

Definition at line 96 of file rtimer-arch.c.

void rtimer_arch_schedule ( rtimer_clock_t  t)

Schedules an rtimer task to be triggered at time t.

Parameters
tThe time when the task will need executed. This is an absolute time, in other words the task will be executed AT time t, not IN t ticks

Definition at line 102 of file rtimer-arch.c.

void watchdog_init ( void  )

Copyright (c) 2014, Analog Devices, Inc.

All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted (subject to the limitations in the disclaimer below) provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  • Neither the name of Analog Devices, Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Author
Jim Paris jim.p.nosp@m.aris.nosp@m.@riga.nosp@m.do.c.nosp@m.om

Copyright (c) 2014, Analog Devices, Inc.

Currently simply explicitly sets the WDT interval to max interval

Definition at line 58 of file watchdog.c.

void watchdog_periodic ( void  )

Writes the WDT clear sequence.

Due to how the SMWDTHROSC_WDCTL works, it is OK to simply write these bits rather than use RMW operations.

Definition at line 71 of file watchdog.c.

void watchdog_reboot ( void  )

Keeps control until the WDT throws a reset signal.

Starts the WDT if not already started.

Definition at line 83 of file watchdog.c.

void watchdog_stop ( void  )

In watchdog mode, the WDT can not be stopped.

This function is defined here to satisfy API requirements.

Definition at line 77 of file watchdog.c.