# libgram, the C companion for gram
-libgram is the C library for gram core initialization and memory testing.
+libgram is the C library for gram core initialization and calibration.
## HowTo
int main(void) {
struct gramCtx ctx;
- int err = gram_init(&ctx, 0x10000000, 0x00006000, 0x00005000);
+ struct gramProfile profile {
+ .mode_registers = {
+ 0x320, 0x6, 0x200, 0
+ },
+ .rdly_p0 = 0,
+ .rdly_p1 = 0
+ };
+ int err = gram_init(&ctx, &profile, 0x10000000, 0x00006000, 0x00005000);
return 0;
}
```
GRAM_ERR_NONE: No error happened (hardcoded to zero)
GRAM_ERR_UNDOCUMENTED: Undocumented error, shame on us lazy coders (take a look at the code)
+GRAM_ERR_RDLY_MAX: Read delay calibration unsuccessful because its value exceeds DQSBUFM's max
```
-## Using libgram when you can't directly access the bus
+## Using libgram outside the SoC
-Compile libgram with `CFLAGS="-DGRAM_RW_FUNC"` (run `make clean` beforehand) then define the following functions:
+Compile libgram with `CFLAGS="-DGRAM_RW_FUNC"` (run `make clean` beforehand) and define the following bus access functions:
```c
uint32_t gram_read(struct gramCtx *ctx, void *addr);