Commit Graph

1208 Commits (a7bf31210677d72cfbd0cc94fe12227149b3c680)

Author SHA1 Message Date
Przemyslaw Stekiel 5a79655d05 Modify rtc_api.h header file - update tests specification. 2018-05-25 12:49:11 -05:00
Russ Butler 1f97f11373 Add documentation and test the HAL RTC API
Add requirements, tests, an example implementation and additional
function documentation to the HAL RTC API.
2018-05-25 12:37:19 -05:00
Russ Butler 77637682a0 Keep RTC API prototypes even when not enabled
Keep the prototypes in rtc_api.h even when DEVICE_RTC is not defined.
This allows devices that aren't fully compliant with the RTC API to
still use the header and prototypes.
2018-05-25 12:33:43 -05:00
Bartek Szatkowski efd307fa79 Rename new occurrences of LOWPOWERTIMER to LPTICKER 2018-05-25 12:33:43 -05:00
Bartek Szatkowski 95559ad3e1 Change LPTICKER spec to allow clock freq starting at 4kHz 2018-05-25 12:32:39 -05:00
Marc Emmers ce79492154 Updated types according to header changes 2018-05-25 12:29:55 -05:00
Marc Emmers d35b29830b Changed struct position to try to maintain binary compatibility
Changed comment because a lot of numbers are divisible by 2
2018-05-25 12:29:55 -05:00
Marc Emmers 1aaef7bc12 mbed_ticker_api remove specific case for 32768 in favor of all frequencies divisible by 2 2018-05-25 12:29:55 -05:00
jeromecoutant 12b3df7773 #6536 rebase correction 2018-05-25 12:26:05 -05:00
Bartek Szatkowski ba963b4453 Rename lp_us tests to common and hf to microsecond 2018-05-25 12:20:09 -05:00
Bartek Szatkowski 6e9f04bf2f Rename DEVICE_LOWPOWERTIMER to DEVICE_LPTICKER
That's to match DEVICE_USTICKER.
2018-05-25 12:20:09 -05:00
Przemyslaw Stekiel f55f9d36fb lp_ticker test - provide lp ticker glitch test case
Test that lp ticker does not glitch backwards due to an incorrectly implemented ripple counter driver.
2018-05-25 12:18:55 -05:00
Steven Cartmell 18943a9693 Add lp/us ticker free() function implementation for NRF5 2018-05-25 12:17:49 -05:00
Steven Cartmell 2894152efe Add free function to lp/us ticker HAL API 2018-05-25 12:17:49 -05:00
Przemyslaw Stekiel a8eee0fb1a Modify requirement for the ticker_init function.
Current version:
The function ticker_init resets the internal count and disables the ticker interrupt.

Proposed version:
The function ticker_init allows the ticker to keep counting and disables the ticker interrupt.

This is a result of the following discussion:
https://github.com/ARMmbed/mbed-os/pull/5233#pullrequestreview-86677815
2018-05-25 12:17:49 -05:00
Przemyslaw Stekiel 0ae7b82c07 Add minor modifications of lp/us tickers tests desctiption in ticker header files.
Add one potential bug to the test description.
Fix test function names to be consistant with desctiption and test header.
Fix typos.
2018-05-25 12:04:32 -05:00
Russ Butler 03d7141797 Add documentation for the HAL Ticker API
Add documentation and test header for the HAL Ticker API.
2018-05-25 12:04:32 -05:00
Przemyslaw Stekiel be98bc003e Add Sleep test specification to sleep_api.h. 2018-05-25 12:03:37 -05:00
Martin Kojtal b7682183b8 Sleep: add time requirements for sleep
Sleep - within 10us
Deepsleep - within 10ms

Note about mbed boards with interface, moved to lpc176x, as they are target related,
should be documented in the target documentation.

The tests will come as separate PR, to conform to this updates to sleep API.
2018-05-25 12:03:37 -05:00
Amanda Butler 824466d18c Copy edit crc_api.h
Copy edit file, mostly for American spelling and consistent tense across files.
2018-05-24 17:53:36 +01:00
Steven Cartmell 5e98eea1a0 HAL CRC: Add additional thread safety notes to the API 2018-05-24 17:51:49 +01:00
Steven Cartmell eb202a29c1 HAL CRC: Update function documentation with new config parameter 2018-05-24 17:51:49 +01:00
Steven Cartmell 1da75e5e85 HAL CRC: Fix code to match coding conventions 2018-05-24 17:51:49 +01:00
Steven Cartmell 8e14b5977b HAL CRC: Add bit width parameter to crc_config_t 2018-05-24 17:51:49 +01:00
Steven Cartmell e1ca2b32fc Add CRC configuration options to HAL API 2018-05-24 17:51:49 +01:00
Steven Cartmell 167d3f9a1e HAL CRC: Return early when calling compute with null or 0 size buffer 2018-05-24 17:51:48 +01:00
Steven Cartmell df93c0151c Remove support for 7/8 bit CRC polynomials for K64F 2018-05-24 17:51:48 +01:00
Steven Cartmell e0d98bfe2c Adapt MbedCRC class to support Hardware CRC
- Move CRC polynomial enum into HAL layer, so it's accessible from platform
  implementations

- Add enum to CRC class to indicate which mode the CRC class should use:
  HARDWARE, TABLE, or BITWISE

- Add calls to HAL Hardware CRC API to each of the compute functions when the
  class is in HARDWARE mode.

- Add missing constructor call to template constructor, and remove const from
  delegating constructor.
2018-05-24 17:50:12 +01:00
Steven Cartmell bad3aa0b6b Add Hardware CRC HAL API specification headers
Define the HAL API header for the Hardware CRC module. This set of functions
allows hardware acceleration of a subset of CRC algorithms for supported
platforms by providing access to the hardware CRC module of certain platforms.

The API is defined as four separate functions:

  - hal_crc_is_supported(polynomial)

    Indicates to the caller if the specific CRC polynomial is supported.

  - hal_crc_compute_partial_start(const uint32_t polynomial)

    Initializes the hardware CRC module with the given polynomial.

  - hal_crc_compute_partial(*data, size)

    Writes an array of bytes to the CRC module to be appended to the calculation

  - hal_crc_get_result()

    Applies the final transformations to the data and returns the result to the
    caller.
2018-05-24 17:50:12 +01:00
Cruz Monrreal 527f9a12fd
Merge pull request #6983 from SenRamakri/sen_ErrorHandling_Push2
Standardized Error Handling and Error Codes
2018-05-24 10:57:00 -05:00
Kevin Bracey 13dcef63e3
Merge pull request #6847 from ARMmbed/feature-emac
Merge feature-emac branch into master
2018-05-24 16:47:04 +03:00
Martin Kojtal d8cb72a0a2
Merge pull request #6273 from bulislaw/update_cmsis_5.3
Update cmsis/rtx to version 5.3
2018-05-24 09:37:40 +02:00
Senthil Ramakrishnan 5ef6728c08 Splitting MBED_ERROR macros to support ones with/without error value argument 2018-05-23 12:21:28 -05:00
Senthil Ramakrishnan d4fe75731d Adding mbed prefixes to all macros and functions to avoid namespace conflicts 2018-05-23 12:21:10 -05:00
Senthil Ramakrishnan 147d9cac4e Test application/cases optimization for some low memory targets, macro changes and test fixes 2018-05-23 12:21:10 -05:00
Senthil Ramakrishnan 2e28dd95e1 Change set_error/set_error_fatal to warning/error, add itm support and other changes 2018-05-23 12:21:08 -05:00
Senthil Ramakrishnan 9041b475c6 Error handling/logging implementation and tests 2018-05-23 12:21:07 -05:00
Kevin Bracey 0386f73719 Networking update: general refactoring, unifying EMAC
Initial work by Bartek Szatkowski in https://github.com/ARMmbed/mbed-os/pull/4079,
reworked following review of https://github.com/ARMmbed/mbed-os/pull/5202 to
transform the entire system into C++, retaining the basic functionality.

Bartek's summary:

* Porting ethernet to EMAC
* Updating EMAC to enable multiple interfaces
* Untangling networking classes, making the abstractions a bit clearer to follow, etc
* General refactoring
* Removal of DEVICE_EMAC flag and introducing DEVICE_ETH and DEVICE_WIFI

Revisions since initial branch:

* Remove lwip depencies
* Correct doxygen warnings
* Remove emac_api.h, replace with C++ EMAC abstract class.
* Create OnboardNetworkInterface, and LWIP implementation.
* Mappings since #4079
     lwip-interface/nsapi_stack_lwip.c -> LWIPStack.cpp
     lwip-interface/ipstack_lwip.c -> LWIPInterface.cpp
     netsocket/mbed_ipstack.h -> OnboardNetworkStack.h
     hal/emac_api.h -> EMAC.h
* Reinstate use of EthInterface abstraction
* Correct and clarify HW address EMAC ops
* Restore MBED_MAC_ADDR implementation
* Integrate PPP support with LWIP::Interface.
* Convert K64F lwIP driver to K64F_EMAC.

To do:

* Convert emac_stack_mem.h to follow this pattern.
* Figure out DEVICE_ETH/EMAC
* Update all drivers to use EMAC
2018-05-22 11:44:45 +03:00
Deepika 029237b683 Addressed review comments
1. LP ticker limiation note
2. Use read_us in mbed_uptime function
3. Doxygen recommendations
4. Use us_timestamp_t instead uint64_t
5. Astyle changes
2018-05-15 11:36:08 -05:00
deepikabhavnani 3420ff7f9c CPU statistics addition
API to get CPU stats like sleep/deepsleep time, uptime and idle time.
These can be used by application to know the CPU Usage runtime.
2018-05-15 11:20:52 -05:00
Bartek Szatkowski 00a321846d Rename __DOMAIN_NS to DOMAIN_NS to match CMSIS 2018-05-14 12:18:21 +01:00
Martin Kojtal c6b6bab2f9
Merge pull request #6630 from OpenNuvoton/nuvoton_add_nonsecure_flash
Support secure/non-secure flash IAP for Cortex-M23/M33
2018-04-19 17:24:27 +02:00
ccli8 076a160ac1 Add comment for target_config/target_config_ns in flash IAP 2018-04-18 11:30:11 +08:00
Russ Butler 17892cbbb9 Add handling for synchronized low power tickers
Some low power tickers take multiple cycles of the low power clock
to set a compare value. Because of this if the compare value is set
twice back-to-back these implementations will block until that time
has passed. This can cause system stability issues since interrupts
are disabling for this time.

To gracefully support this kind of hardware this patch adds code
to prevent back-to-back writes to the hardware. It does this by
recording the low power clock cycle of the initial write. If any
writes come in too soon after this initial write the microsecond
ticker is used to schedule the new write in the future when the
hardware is ready to accept a new value.

To enable this feature on a target the macro LOWPOWERTIMER_DELAY_TICKS
must be set to the number of low power clock cycles that must elapse
between writes to the low power timer.
2018-04-16 17:36:07 -05:00
ccli8 7a7b634fda Refine code with MBED_NONSECURE_ENTRY in flash IAP 2018-04-16 16:59:14 +08:00
ccli8 00147b504b Refactor code for non-secure flash check in flash IAP 2018-04-16 12:39:03 +08:00
ccli8 92d937dd46 Replace with MBED_NONSECURE_ENTRY for all-toolchain secure gateway functions in flash IAP 2018-04-16 09:59:03 +08:00
ccli8 a62c0796c5 Support secure/non-secure flash IAP for Cortex-M23/M33 2018-04-13 16:30:57 +08:00
Anna Bridge 773fb90670
Merge pull request #6373 from 0xc0170/fix_flash_docs
flash: add docs for user defined data
2018-03-28 15:55:35 +01:00
Cruz Monrreal ddf70f1dc9
Merge pull request #6377 from scartmell-arm/feature-deep-sleep-tracing-filename-fix
Replace runtime strip_path function with compiler intrinsic equivalents
2018-03-23 10:28:25 -05:00
Martin Kojtal e828b392bc flash: add docs for user defined data
This should make some of the data more clear to a user
2018-03-20 12:25:22 +00:00
Cruz Monrreal 9bebb8cb57
Merge pull request #6372 from bulislaw/fix_doxy_itm
Fix doxygen for ITM HAL
2018-03-19 11:18:47 -05:00
Steven Cartmell 9a0e8797b9 Refactor sleep tracing driver identifier to be pointer to the driver filepath.
The use of __FILE__ macro to get a usable identifier from the driver path
causes the path of the file to be stored in the .text region of the binary.
Given that this remains for the entire duration of the program, storing a
pointer to this string as an identifier is more efficient than copying the
contents of the string during lookup/insertion.
2018-03-15 17:23:36 +00:00
Cruz Monrreal 9cac3b2f6b
Merge pull request #6149 from bmcdonnell-ionx/typos
Fix typos in the files
2018-03-15 10:53:03 -05:00
Steven Cartmell bd63f93984 Replace runtime strip_path function with compiler intrinsic equivalents
Sleep manager tracing strips the path from filenames and uses the result as an
identifier to track drivers that unlock/lock sleep tracing. Replace the function
that strips the path from the string, replace this function with a new macro,
__FILENAME__ which performs the same action in a compiler specific manner.

- GCC_ARM, use __builtin_strrchr which is optimized out at compile time.
- ARM, use __MODULE__ which returns the filename without path.
- IAR, specifiy the --no_path_in_file_macros compiler flag.
2018-03-15 15:49:42 +00:00
Bartek Szatkowski a7d6c9d1df Fix doxygen for ITM HAL 2018-03-15 10:43:48 +00:00
Bartek Szatkowski d6f57bc3e8 Fix review comments and merge issues 2018-03-02 00:29:14 +00:00
Steven Cartmell 206cc299e0 Fix merge conflict mishap 2018-03-01 17:33:21 +00:00
Steven Cartmell fed5115624 Return pointer to sleep tracker array element instead of an index 2018-03-01 17:25:33 +00:00
Steven Cartmell 076548aa6b Split find/insert sleep tracker function into two seperate functions.
Throw an error when trying to unlock driver that was not previously locked.
2018-03-01 17:25:33 +00:00
Steven Cartmell bd23625d23 Rename SLEEP_STATS_ENABLED to SLEEP_TRACING_ENABLED 2018-03-01 17:25:33 +00:00
Steven Cartmell 5a4027b71d Remove newline printf from sleep manager 2018-03-01 17:25:15 +00:00
Steven Cartmell 21e5f1134d Remove '_PACKED' keyword from sleep statistic structure 2018-03-01 17:25:15 +00:00
Steven Cartmell 74bdf1c3a3 Rename SLEEP_PROFILING_ENABLED to MBED_SLEEP_STATS_ENABLED 2018-03-01 17:25:15 +00:00
Steven Cartmell 0f6b73ae0f Add optional tracing to sleep manager lock/unlock
Add tracing output to console to track when drivers lock and unlock deep
sleep. Tracing output is enabled by configuring the
'SLEEP_PROFILING_ENABLED' at compile time.

- Wrapped sleep_manager_lock/sleep_manager_unlock in a macro to
conditionally call tracing functions when 'SLEEP_PROFILING_ENABLED' is
set.
- Define a global structure to track driver names and how many locks
they hold in the sleep manager.
2018-03-01 17:24:53 +00:00
Bartek Szatkowski 4cb47df40a Add system_reset() function to Mbed OS 2018-02-28 16:42:34 +00:00
Brendan McDonnell c4f10aafee typos 2018-02-20 20:11:19 -05:00
Cruz Monrreal 0ceecb946d
Merge pull request #5956 from marcuschangarm/feature-hal-swo
[feature-hal-itm] Instrumented Trace Macrocell HAL API for SWO debug output
2018-02-16 16:08:12 -06:00
Marcus Chang bbf92fdf0d Instrumented Trace Macrocell (ITM) HAL API
HAL API for initializing the ITM and setting SWO debug output.
Actual debug output implemented as SWO FileHandle.
2018-02-16 08:24:31 -08:00
Przemyslaw Stekiel c2760be01c Fix for issue #6054 - interrupts scheduled in the past.
When ticker is not driven by the 1 MHz clock and HAL driver need to perform conversion between microseconds and ticks, then the interrupt might be scheduled in the past. For details see: https://github.com/ARMmbed/mbed-os/issues/6054.

This patch provides fix for such case. Interrupt is fired immidiatelly when last read tick is equal to the calculated tick when interrupt should be generated.
2018-02-15 12:30:24 +00:00
Przemyslaw Stekiel 6d3ba94f98 Provide fix for issue #5835 - Tickers update should be atomic
Synchronise only (and all) the public functions.
2018-01-22 13:29:31 +01:00
Steven Cartmell 061795c489 Move in_critical_section implementation into the HAL
- Add function to HAL hal_in_critical_section()
- Wrap assert in FEATURE_UVISOR macro
2018-01-09 10:41:29 +00:00
Steven Cartmell 04d2f3de78 Amend critical section function descriptions 2018-01-05 14:55:58 +00:00
Steven Cartmell e14bee5209 Fix potential race condition in critical section HAL API
Call underlying HAL implementation to enter critical section/disable interrupts
before incrementing the global critical section counter.

Modify HAL implementations to track first entrances to the critical section and
only update the saved state on first enter.
2018-01-05 14:55:58 +00:00
Steven Cartmell a07c07fa63 Update HAL API header information 2018-01-05 14:55:57 +00:00
Steven Cartmell 84391f0b64 Remove invalid assert and move uVisor warning to correct function 2018-01-05 14:55:57 +00:00
Steven Cartmell 07a394ee8b Add Critical Section HAL API specification
- Define header functions for Critical Section HAL API
  - hal_critical_section_enter()
  - hal_critical_section_exit()

- Add weak default implementation for HAL API. The default implementation
  matches the previous behaviour stored in mbed_critical:
  - The first call to enter a critical section stores the state of interrupts
    before disabling and each successive call re-disables interrupts.
  - The last call (non-nested) will restore the IRQ state that was set on the
    enter to the critical section. Nested calls are ignored.

- Add function 'core_util_in_critical_section' to User facing API to determine
  if the program is currently in a critical section, instead of depending on
  'core_util_interrupts_enabled'.
2018-01-05 14:53:51 +00:00
Przemyslaw Stekiel 5da5b28f96 Add API to set ticker IRQ handler.
This API is added primarily for testing purposes, to be able to test HAL drivers without using upper layers to handle ticker interrupt.
By default IRQ handler is set to ticker_irq_handler() for us ticker and lp ticker - original one.

Usage example (setting custom ticker irq handler):

void my_irq_handler(const ticker_data_t *const) {
 // handle interrupt
}

ticker_irq_handler_type old_handler = set_us_ticker_irq_handler(my_irq_handler);

Respectively for lp timer set_lp_ticker_irq_handler() API should be used.
2017-10-30 10:38:38 +01:00
Jimmy Brisson fad67559ae Merge pull request #5028 from c1728p9/ticker_api_changes
Update ticker to map closely to hardware
2017-10-13 09:18:02 -05:00
Jimmy Brisson 8beedcef83 Merge pull request #5019 from fkjagodzinski/fix-ticker_API_docs
Fix an incorrect comment in ticker API
2017-10-09 11:11:36 -05:00
Russ Butler 0d3714e9b7 Optimize 1MHz and 32KHz use cases
Add optimizations for the most common use cases of the
us ticker, 1MHz,  and the lp ticker, 32KHz.
2017-10-05 11:57:13 -05:00
Russ Butler ec55b82acf Update ticker to map closely to hardware
Allow tickers to specify their native frequency and number of bits.
This allows the conversion to happen in common code rather than in
each vendor's implementation.
2017-10-05 11:57:12 -05:00
Russ Butler 8183749948 Initialize the HAL ticker on first read
Initialize the ticker on the first call to ticker_read* if the
ticker has not been initialized already.
2017-09-29 09:18:58 +01:00
Martin Kojtal 26f9144c45 Merge pull request #5000 from 0xc0170/fix_flash_page_doc
flash: add note about program size
2017-09-22 11:28:54 +01:00
Martin Kojtal fcdb04351f Sleep: add deepsleep locks for !DEVICE_SLEEP
If a target do not support sleep (no DEVICE_SLEEP defined),
we provide empty deep sleep locking.
2017-09-07 15:35:04 +01:00
Martin Kojtal cb4e9b32a2 Sleep HAL: add sleep manager API
Sleep manager provides API to lock/unlock deepsleep. This API allows a user to
control deep sleep.

This API should be done via atomic operations (to be IRQ/thread safe).
2017-09-07 15:34:47 +01:00
Martin Kojtal 3f58d3ef48 flash: add note about program size
Program size - the writable page size that flash controller supports.
Plus fix program page description - multiple pages program
2017-09-06 07:54:18 +01:00
Filip Jagodzinski b1ff37cdee HAL: ticker_api: Fix outdated comment 2017-09-05 13:31:12 +02:00
Russ Butler 026df0b7cd Turn on doxygen for DEVICE_* features
Enable doxygen for all device features. Also fix the warnings that
showed up once this was enabled.
2017-08-11 15:47:44 -05:00
Jimmy Brisson 1f94ede86c Merge pull request #4744 from deepikabhavnani/spi_issue_4743
Allow user to set default transfer byte for block read
2017-07-24 14:45:30 -05:00
Deepika 1b797e9081 Closed review comments
1. Doxygen and Grammar related
2. Change dummy to spi_fill
3. Remove NXP driver and add default loop in spi block read (same as all
other drivers)
2017-07-21 09:46:22 -05:00
Martin Kojtal 10ea63b8e7 Ticker: add fire interrupt now function
fire_interrupt function should be used for events in the past. As we have now
64bit timestamp, we can figure out what is in the past, and ask a target to invoke
an interrupt immediately. The previous attemps in the target HAL tickers were not ideal, as it can wrap around easily (16 or 32 bit counters). This new
functionality should solve this problem.

set_interrupt for tickers in HAL code should not handle anything but the next match interrupt. If it was in the past is handled by the upper layer.

It is possible that we are setting next event to the close future, so once it is set it is already in the past. Therefore we add a check after set interrupt to verify it is in future.
If it is not, we fire interrupt immediately. This results in
two events - first one immediate, correct one. The second one might be scheduled in far future (almost entire ticker range),
that should be discarded.

The specification for the fire_interrupts are:
- should set pending bit for the ticker interrupt (as soon as possible),
the event we are scheduling is already in the past, and we do not want to skip
any events
- no arguments are provided, neither return value, not needed
- ticker should be initialized prior calling this function (no need to check if it is already initialized)

All our targets provide this new functionality, removing old misleading if (timestamp is in the past) checks.
2017-07-13 12:23:25 +01:00
Deepika fd43405ffe Allow user to set dummy tranfer byte for block read 2017-07-11 15:46:32 -05:00
Marcus Chang abca2ca48b FlashIAP: Add explicit read function to flash_api.h
On some platforms, the in-application memory is not memory mapped
and therefore cannot be accessed using memcpy.

The flash_read function added to flash_api.h (with a weak
implementation using memcpy in mbed_flash_api.c) can be used for
reading data from areas that are not memory mapped.
2017-07-06 18:53:32 +01:00
Sam Grove 8e76bf6da6 Merge pull request #4508 from kegilbert/kg-doxygen-framework-hal-rtos
Doxygen combined HAL, RTOS, and features/Framework updates to not produce warnings and errors [DOC Changes Only]
2017-06-08 23:52:33 -05:00
Deepika 6478e88808 Fix doxygen warnings in 'drivers' 2017-06-08 15:53:53 -05:00
Kevin Gilbert 7e2e80588d Removed bad \ref tag, but left in the tag name. Updated old param names in gpio_api.h and added new params in ticker_api.h 2017-06-08 15:52:31 -05:00
Sam Grove fa0cd205a2 Merge pull request #4094 from pan-/fix_hal_ticker
[HAL] Add support for 64 bit us timestamp
2017-06-01 23:25:26 -05:00
Martin Kojtal e229a49182 Merge pull request #4207 from geky/spi-remove-byte-locking
spi: Add SPI block-write to C++ and HAL for performance
2017-06-01 14:03:36 +02:00
Russ Butler 58041a215d Deprecate config store and related libraries
Deprecate configuration-store, flash-journal and
storage-volume-manager for the 5.5 release. Also disable the
storage tests.
2017-05-31 12:08:11 -05:00