Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of mbed-dev by
Revision 150:cd63f849362a, committed 2016-11-03
- Comitter:
- ptpaterson
- Date:
- Thu Nov 03 16:21:53 2016 +0000
- Parent:
- 149:156823d33999
- Commit message:
- targets LPC11Cxx, LPC15xx: can_api can_filter function properly returns 0 if handle argument is out of bounds (handle > 32).
Changed in this revision
--- a/targets/TARGET_NXP/TARGET_LPC11XX_11CXX/TARGET_LPC11CXX/can_api.c Fri Oct 28 11:17:30 2016 +0100 +++ b/targets/TARGET_NXP/TARGET_LPC11XX_11CXX/TARGET_LPC11CXX/can_api.c Thu Nov 03 16:21:53 2016 +0000 @@ -85,6 +85,7 @@ int can_filter(can_t *obj, uint32_t id, uint32_t mask, CANFormat format, int32_t handle) { uint16_t i; + int retval = 0; // Find first free message object if(handle == 0) { @@ -99,6 +100,7 @@ } if(handle > 0 && handle < 32) { + retval = handle; if(format == CANExtended) { // Mark message valid, Direction = TX, Extended Frame, Set Identifier and mask everything LPC_CAN->IF1_ARB1 = BFN_PREP(id, CANIFn_ARB1_ID); @@ -125,7 +127,7 @@ while( LPC_CAN->IF1_CMDREQ & CANIFn_CMDREQ_BUSY ); } - return handle; + return retval; } static inline void can_irq() {
--- a/targets/TARGET_NXP/TARGET_LPC15XX/can_api.c Fri Oct 28 11:17:30 2016 +0100 +++ b/targets/TARGET_NXP/TARGET_LPC15XX/can_api.c Thu Nov 03 16:21:53 2016 +0000 @@ -125,6 +125,7 @@ int can_filter(can_t *obj, uint32_t id, uint32_t mask, CANFormat format, int32_t handle) { uint16_t i; + int retval = 0; // Find first free message object if (handle == 0) { @@ -140,6 +141,7 @@ } if (handle > 0 && handle < 32) { + retval = handle; if (format == CANExtended) { // Mark message valid, Direction = TX, Extended Frame, Set Identifier and mask everything LPC_C_CAN0->CANIF1_ARB1 = (id & 0xFFFF); @@ -165,7 +167,7 @@ while ( LPC_C_CAN0->CANIF1_CMDREQ & CANIFn_CMDREQ_BUSY ); } - return handle; + return retval; } static inline void can_irq() {