rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
Typedefs | Functions
HAL

Typedefs

typedef uint32_t halclock_t
 Type representing a system clock frequency.
 
typedef uint32_t halrtcnt_t
 Type of the realtime free counter value.
 

Functions

 __attribute__ ((used, section(".bcaconfig"))) const
 
 __attribute__ ((used, section(".cfmconfig"))) const
 
void hal_lld_init (void)
 Low level HAL driver initialization.
 
void ke1xf_init (void)
 KE1xF initialization.
 

Detailed Description

Typedef Documentation

◆ halclock_t

typedef uint32_t halclock_t

Type representing a system clock frequency.

Definition at line 264 of file hal_lld.h.

◆ halrtcnt_t

typedef uint32_t halrtcnt_t

Type of the realtime free counter value.

Definition at line 269 of file hal_lld.h.

Function Documentation

◆ __attribute__() [1/2]

__attribute__ ( (used, section(".bcaconfig"))  ) const

Definition at line 48 of file hal_lld.c.

49 {
50 'k', 'c', 'f', 'g', 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
51 BCA_PERIPH, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
52 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
53 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
54};

◆ __attribute__() [2/2]

__attribute__ ( (used, section(".cfmconfig"))  ) const

Definition at line 56 of file hal_lld.c.

57 {
58 0xFF, /* NV_BACKKEY3: KEY=0xFF */
59 0xFF, /* NV_BACKKEY2: KEY=0xFF */
60 0xFF, /* NV_BACKKEY1: KEY=0xFF */
61 0xFF, /* NV_BACKKEY0: KEY=0xFF */
62 0xFF, /* NV_BACKKEY7: KEY=0xFF */
63 0xFF, /* NV_BACKKEY6: KEY=0xFF */
64 0xFF, /* NV_BACKKEY5: KEY=0xFF */
65 0xFF, /* NV_BACKKEY4: KEY=0xFF */
66 0xFF, /* NV_FPROT3: PROT=0xFF */
67 0xFF, /* NV_FPROT2: PROT=0xFF */
68 0xFF, /* NV_FPROT1: PROT=0xFF */
69 0xFF, /* NV_FPROT0: PROT=0xFF */
70 /* [andreika][rusefi]: Warning! These two bytes are extremely important! Don't change them until 100% sure! */
71 /* there is an opinion that wrong values would brick your Kinetis chip for good */
72 0x7E, /* NV_FSEC: KEYEN=1,MEEN=3,FSLACC=3,SEC=2 */
73 0xFB, /* NV_FOPT: BOOTSRC_SEL=1,res=111,RESET_PIN_CFG=1,NMI_DIS=0,BOOTPIN_OPT=1,LPBOOT=1 */
74
75 0xFF,
76 0xFF
77};

◆ hal_lld_init()

void hal_lld_init ( void  )

Low level HAL driver initialization.

Todo:
Use a macro to define the system clock frequency.

@notapi

Definition at line 97 of file hal_lld.c.

97 {
98 // Enable DMA
99 dmaInit();
100}
void dmaInit(void)
Definition kinetis_dma.c:31
Here is the call graph for this function:

◆ ke1xf_init()

void ke1xf_init ( void  )

KE1xF initialization.

Note
All the involved constants come from the file board.h.
This function is meant to be invoked early during the system initialization, it is usually invoked from the file board.c.
Todo:
This function needs to be more generic.

@special

Definition at line 112 of file hal_lld.c.

112 {
113#if ((__FPU_PRESENT == 1) && (__FPU_USED == 1))
114 SCB->CPACR |= ((3UL << 10*2) | (3UL << 11*2)); /* set CP10, CP11 Full Access */
115#endif /* ((__FPU_PRESENT == 1) && (__FPU_USED == 1)) */
116
117 /* Disable Watchdog */
118 WDOG->CNT = WDOG_UPDATE_KEY;
119 WDOG->TOVAL = 0xFFFF;
120 WDOG->CS = (uint32_t) ((WDOG->CS) & ~WDOG_CS_EN_MASK) | WDOG_CS_UPDATE_MASK;
121
122 /* Initialize Cache */
123 /* Enable Code Bus Cache */
124 /* set command to invalidate all ways, enable write buffer and write GO bit to initiate command */
125 LMEM->PCCCR |= LMEM_PCCCR_INVW1_MASK | LMEM_PCCCR_INVW0_MASK;
126 LMEM->PCCCR |= LMEM_PCCCR_GO_MASK;
127 /* Wait until the command completes */
128 while (LMEM->PCCCR & LMEM_PCCCR_GO_MASK) {
129 }
130 /* Enable cache, enable write buffer */
131 LMEM->PCCCR |= (LMEM_PCCCR_ENWRBUF_MASK | LMEM_PCCCR_ENCACHE_MASK);
132 __ISB();
133}

Referenced by __early_init().

Here is the caller graph for this function: