-
-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This may be a useful starting point for contributors who are familiar with cpus like TI AM1808 even if they are not familiar with the Pybricks codebase. The initial goal is to fill in the gaps designated by // TODO: TIAM1808. This implements the clock driver. When this is done, the baked-in MicroPython code would print something like: Hello, world at time (ms): 0 Hello, world at time (ms): 1000 Hello, world at time (ms): 2000 instead of Hello, world at time (ms): 0 Hello, world at time (ms): 0 Hello, world at time (ms): 0
- Loading branch information
1 parent
bc843db
commit baf7047
Showing
9 changed files
with
198 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// SPDX-License-Identifier: MIT | ||
// Copyright (c) 2024 The Pybricks Authors | ||
|
||
#include <pbdrv/config.h> | ||
|
||
#if PBDRV_CONFIG_CLOCK_TIAM1808 | ||
|
||
#include <stdint.h> | ||
|
||
void pbdrv_clock_init(void) { | ||
// Actual low level clocks should probably be configured at the very | ||
// start of in SystemInit in platform.c instead. | ||
// But optionally, additional things can be initialized here. | ||
} | ||
|
||
uint32_t pbdrv_clock_get_us(void) { | ||
// TODO: TIAM1808 implementation. | ||
return 0; | ||
} | ||
|
||
uint32_t pbdrv_clock_get_ms(void) { | ||
// TODO: TIAM1808 implementation. | ||
return 0; | ||
} | ||
|
||
uint32_t pbdrv_clock_get_100us(void) { | ||
// TODO: TIAM1808 implementation (1 count = 100us, so 10 counts per millisecond.) | ||
return 0; | ||
} | ||
|
||
#endif // PBDRV_CONFIG_CLOCK_TIAM1808 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,30 @@ | ||
// SPDX-License-Identifier: MIT | ||
// Copyright (c) 2022 The Pybricks Authors | ||
// Copyright (c) 2024 The Pybricks Authors | ||
|
||
// This file is unused, but required for the common make file. | ||
|
||
#include <stdint.h> | ||
|
||
typedef struct { | ||
volatile uint8_t *thr; | ||
volatile uint8_t *lsr; | ||
} debug_uart_t; | ||
|
||
// Sensor port 1 | ||
static debug_uart_t UART0 = { .thr = (volatile uint8_t *)0x01D0C000, .lsr = (volatile uint8_t *)0x01D0C014 }; | ||
|
||
static void debug(debug_uart_t *uart, const char *s) { | ||
while (*s) { | ||
while ((*uart->lsr & (1 << 5)) == 0) { | ||
} | ||
*uart->thr = *s++; | ||
} | ||
} | ||
|
||
// Called from assembly code in startup.s. After this, the "main" function in | ||
// lib/pbio/sys/main.c is called. That contains all calls to the driver | ||
// initialization (low level in pbdrv, high level in pbio), and system level | ||
// functions for running user code (currently a hardcoded MicroPython script). | ||
void SystemInit(void) { | ||
debug(&UART0, "System init in platform.c called from startup.s\n\n"); | ||
// TODO: TIAM1808 system init | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters