Skip to content

Commit

Permalink
Merge pull request contiki-os#685 from SmallLars/mc1322x
Browse files Browse the repository at this point in the history
Added mc1322x functions: clock_set_seconds, soft_reset, nvm_verify
  • Loading branch information
malvira committed Sep 13, 2015
2 parents 1ddcdf4 + 879fd8d commit 552408b
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 0 deletions.
6 changes: 6 additions & 0 deletions cpu/mc1322x/clock.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,12 @@ clock_seconds(void)
return seconds;
}

void
clock_set_seconds(unsigned long sec)
{
seconds = sec;
}

void
clock_wait(clock_time_t t)
{
Expand Down
11 changes: 11 additions & 0 deletions cpu/mc1322x/lib/include/crm.h
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,17 @@ static const int XTAL32_EN = 0;
#define pack_XTAL_CNTL(ctune4pf, ctune, ftune, ibias) \
(*CRM_XTAL_CNTL = ((ctune4pf << 25) | (ctune << 21) | ( ftune << 16) | (ibias << 8) | 0x52))

#define soft_reset() \
__asm__ __volatile__ ( \
"ldr r0, [%[sw]] \n\t" \
"str r0, [%[sw]] \n\t" \
: /* out */ \
: /* in */ \
[sw] "l" (CRM_SW_RST) \
: /* clobber list */ \
"r0", "memory" \
);

#endif /* REG_NO_COMPAT */

#endif
1 change: 1 addition & 0 deletions cpu/mc1322x/lib/include/nvm.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,5 +78,6 @@ extern nvmErr_t (*nvm_write)(nvmInterface_t nvmInterface, nvmType_t nvmType ,voi
/* SST flash has 32 sectors 4096 bytes each */
/* bit 0 is the first sector, bit 31 is the last */
extern nvmErr_t (*nvm_erase)(nvmInterface_t nvmInterface, nvmType_t nvmType ,uint32_t sectorBitfield);
extern nvmErr_t (*nvm_verify)(nvmInterface_t nvmInterface, nvmType_t nvmType, void *pSrc, uint32_t address, uint32_t numBytes);
extern void(*nvm_setsvar)(uint32_t zero_for_awesome);
#endif //NVM_H
4 changes: 4 additions & 0 deletions cpu/mc1322x/lib/nvm.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ nvmErr_t (*nvm_erase)
(nvmInterface_t nvmInterface, nvmType_t nvmType ,uint32_t sectorBitfield)
= (void*) 0x00006e05;

nvmErr_t (*nvm_verify)
(nvmInterface_t nvmInterface, nvmType_t nvmType, void *pSrc, uint32_t address, uint32_t numBytes)
= (void*) 0x00006f85;

void(*nvm_setsvar)
(uint32_t zero_for_awesome)
= (void *)0x00007085;
Expand Down

0 comments on commit 552408b

Please sign in to comment.