From: Jean THOMAS Date: Mon, 3 Aug 2020 10:38:28 +0000 (+0200) Subject: Read delay calibration: return error codes X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=255b9c89cd706a55c2d65c655edde1d028e4bd9d;p=gram.git Read delay calibration: return error codes --- diff --git a/libgram/README.md b/libgram/README.md index 1ab1a83..41a8b48 100644 --- a/libgram/README.md +++ b/libgram/README.md @@ -1,6 +1,6 @@ # 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 @@ -31,6 +31,7 @@ Link it to this library and you should be good to go! ``` 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 outside the SoC diff --git a/libgram/include/gram.h b/libgram/include/gram.h index 5640df6..52eb010 100644 --- a/libgram/include/gram.h +++ b/libgram/include/gram.h @@ -8,7 +8,7 @@ enum GramError { GRAM_ERR_NONE = 0, GRAM_ERR_UNDOCUMENTED, - GRAM_ERR_MEMTEST, + GRAM_ERR_RDLY_MAX, }; struct gramCoreRegs; diff --git a/libgram/src/calibration.c b/libgram/src/calibration.c index 0483998..8d89ebd 100644 --- a/libgram/src/calibration.c +++ b/libgram/src/calibration.c @@ -61,6 +61,8 @@ int gram_generate_calibration(const struct gramCtx *ctx, struct gramProfile *pro if (gram_read_burstdet(&ctx, 0)) { min_rdly_p0 = rdly; break; + } else if (rdly == 7) { + return GRAM_ERR_RDLY_MAX; } } @@ -76,6 +78,8 @@ int gram_generate_calibration(const struct gramCtx *ctx, struct gramProfile *pro if (gram_read_burstdet(&ctx, 1)) { min_rdly_p1 = rdly; break; + } else if (rdly == 7) { + return GRAM_ERR_RDLY_MAX; } } @@ -92,6 +96,8 @@ int gram_generate_calibration(const struct gramCtx *ctx, struct gramProfile *pro if (!gram_read_burstdet(&ctx, 0)) { max_rdly_p0 = rdly - 1; break; + } else if (rdly == 7) { + return GRAM_ERR_RDLY_MAX; } } @@ -107,6 +113,8 @@ int gram_generate_calibration(const struct gramCtx *ctx, struct gramProfile *pro if (!gram_read_burstdet(&ctx, 1)) { max_rdly_p1 = rdly - 1; break; + } else if (rdly == 7) { + return GRAM_ERR_RDLY_MAX; } } @@ -116,7 +124,7 @@ int gram_generate_calibration(const struct gramCtx *ctx, struct gramProfile *pro profile->rdly_p0 = (min_rdly_p0+max_rdly_p0)/2; profile->rdly_p1 = (min_rdly_p1+max_rdly_p1)/2; - return 0; + return GRAM_ERR_NONE; } void gram_load_calibration(const struct gramCtx *ctx, const struct gramProfile *profile) {