SD-Card Activity Status
Posted: Fri Oct 24, 2014 11:29 am
Hi Giovanni,
do you have any objections for me submitting a patch/change to the sd-card driver.
Basically i would like to add the functionality to show disk activity. i.e read and writing.
At the moment i do it like this
Bold type showing calls to my LED's
For me this is not a very elegant solution, and also if i change versions i have to go and redo the changes to the new version.
So my thoughts where, to have this work abit like the "sdc_lld_is_card_inserted(SDCDriver *sdcp)"
Where you can have disk activity functions in board.c, these would be called from the sdc.c read and write routines.
Also the addition of this functionality would be controlled by conditional selections i.e #if SDC_READ_ACTIVITY etc etc
What are your thoughts ?
do you have any objections for me submitting a patch/change to the sd-card driver.
Basically i would like to add the functionality to show disk activity. i.e read and writing.
At the moment i do it like this
Code: Select all
bool_t sdcRead(SDCDriver *sdcp, uint32_t startblk,
uint8_t *buf, uint32_t n) {
bool_t status;
chDbgCheck((sdcp != NULL) && (buf != NULL) && (n > 0), "sdcRead");
chDbgAssert(sdcp->state == BLK_READY, "sdcRead(), #1", "invalid state");
if ((startblk + n - 1) > sdcp->capacity){
sdcp->errors |= SDC_OVERFLOW_ERROR;
return CH_FAILED;
}
/* Read operation in progress.*/
sdcp->state = BLK_READING;
[b]palClearPad(GPIOG, GPIOG_LED_STATUS_GRN);[/b]
status = sdc_lld_read(sdcp, startblk, buf, n);
[b]palSetPad(GPIOG, GPIOG_LED_STATUS_GRN);[/b]
/* Read operation finished.*/
sdcp->state = BLK_READY;
return status;
}
Bold type showing calls to my LED's
For me this is not a very elegant solution, and also if i change versions i have to go and redo the changes to the new version.
So my thoughts where, to have this work abit like the "sdc_lld_is_card_inserted(SDCDriver *sdcp)"
Where you can have disk activity functions in board.c, these would be called from the sdc.c read and write routines.
Also the addition of this functionality would be controlled by conditional selections i.e #if SDC_READ_ACTIVITY etc etc
What are your thoughts ?