Move MIN macro to general.h
This commit is contained in:
parent
c10862bff3
commit
a497127a8d
|
@ -173,8 +173,6 @@ enum align {
|
||||||
};
|
};
|
||||||
#define ALIGNOF(x) (((x) & 3) == 0 ? ALIGN_WORD : \
|
#define ALIGNOF(x) (((x) & 3) == 0 ? ALIGN_WORD : \
|
||||||
(((x) & 1) == 0 ? ALIGN_HALFWORD : ALIGN_BYTE))
|
(((x) & 1) == 0 ? ALIGN_HALFWORD : ALIGN_BYTE))
|
||||||
#undef MIN
|
|
||||||
#define MIN(x, y) (((x) < (y)) ? (x) : (y))
|
|
||||||
|
|
||||||
/* Program the CSW and TAR for sequencial access at a given width */
|
/* Program the CSW and TAR for sequencial access at a given width */
|
||||||
static void ap_mem_access_setup(ADIv5_AP_t *ap, uint32_t addr, enum align align)
|
static void ap_mem_access_setup(ADIv5_AP_t *ap, uint32_t addr, enum align align)
|
||||||
|
|
|
@ -39,6 +39,8 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define ALIGN(x, n) (((x) + (n) - 1) & ~((n) - 1))
|
#define ALIGN(x, n) (((x) + (n) - 1) & ~((n) - 1))
|
||||||
|
#undef MIN
|
||||||
|
#define MIN(x, y) (((x) < (y)) ? (x) : (y))
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -159,9 +159,6 @@ static const char samd_xml_memory_map[] = "<?xml version=\"1.0\"?>"
|
||||||
/* Component ID */
|
/* Component ID */
|
||||||
#define SAMD_CID_VALUE 0xB105100D
|
#define SAMD_CID_VALUE 0xB105100D
|
||||||
|
|
||||||
/* Utility */
|
|
||||||
#define MINIMUM(a,b) ((a < b) ? a : b)
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reads the SAM D20 Peripheral ID
|
* Reads the SAM D20 Peripheral ID
|
||||||
*/
|
*/
|
||||||
|
@ -529,7 +526,7 @@ static int samd_flash_write(struct target_s *target, uint32_t dest,
|
||||||
|
|
||||||
for (uint32_t page = first_page; page <= last_page; page += SAMD_PAGE_SIZE) {
|
for (uint32_t page = first_page; page <= last_page; page += SAMD_PAGE_SIZE) {
|
||||||
next_page = page + SAMD_PAGE_SIZE;
|
next_page = page + SAMD_PAGE_SIZE;
|
||||||
length = MINIMUM(end + 4, next_page) - addr;
|
length = MIN(end + 4, next_page) - addr;
|
||||||
|
|
||||||
/* Write within a single page. This may be part or all of the page */
|
/* Write within a single page. This may be part or all of the page */
|
||||||
target_mem_write(target, addr, &data[i], length);
|
target_mem_write(target, addr, &data[i], length);
|
||||||
|
|
Loading…
Reference in New Issue