Where I can find examples for BF548 SDH device driver(adi_sdh)? I've found only "raw" SD in VisualDSP examples.
I believe you require the 'raw PID' functionality available in Blackfin\lib\src\drivers\pid\adi_rawpid.c, (which is part of libdrv548.dlb - so it does not need added to your project). Attached is an example application that reads sector 0 from the SD Card directly. Hopefully, the comments within sdh_direct_access.c will prove instructive. In particular, please note that the module can be used either to hide all driver details - useful for simple inspection type applications - or to provide a more flexible approach that enables it to be embedded in other frameworks.
Due mostly to the asynchronous data transfer model within the FSS framework, direct access to a PID is complicated and the RAW pid functionality takes care of that complexity. The generic PID documentation, Blackfin\docs\drivers\pid\Generic_PID_Design_Document.pdf is quite comprehensive and shows how the PID fits into the FSS framework. For raw access, it is essential to replicate, in part, the asynchronous FSS framework. Examining the generic PID document and the internals of adi_rawpid.c should give you some insight into direct access.
At the end of the day, your reason for wanting raw access will determine how best to proceed. Use of the RAW PID module can be useful if you want a simple approach. Indeed, our USB MSC Device class uses the RAW PID module for access to the Mass storage medium required. Please see Blackfin\Examples\ADSP-BF548 EZ-KIT Lite\Drivers\usb\mass_storage_app and Blackfin\lib\src\drivers\usb\class\peripheral\mass_storage for more details.
I'm unsure which examples you have already looked at, but we generally recommend the Shell_Browser example as a good starting point. You can find this example using the following path in VisualDSP++ 5.1:
C:\Program Files (x86)\Analog Devices\VisualDSP 5.1\Blackfin\Examples\ADSP-BF548 EZ-KIT Lite\Services\File System\VDK\shell_browser
Please be aware you can find detailed documentation on the Secure Digital Host Physical Interface Driver here:
C:\Program Files (x86)\Analog Devices\VisualDSP 5.1 (Base)\Blackfin\docs\drivers\pid\sdh
Thanks for your reply, but this example is not what i looked for. I studied it earlier, but I need "raw" adi_sdh, without FSS support. Driver docs also emphasised on FSS mode. Standalone mode is poorly documented. For example, there is no mention about necessity of calling ADI_PID_CMD_MEDIA_ACTIVATE. Although there is no mention about that fact, that if SemaphoreHandle in ADI_FSS_SUPER_BUFFER is not equal DataSemaphoreHandle in inner driver structure, driver simply won't post it:
static void adi_sdh_CallbackFromFSS (
void *pHandle, /* Client Handle */
u32 Event, /* Callback Event */
void *pArg /* Buffer address that caused this callback */
ADI_FSS_SUPER_BUFFER *pSuperBuffer = (ADI_FSS_SUPER_BUFFER *)pArg;
ADI_SDH_DEF *pDevice = (ADI_SDH_DEF *)pHandle;
/* CASEOF (Event) */
/* CASE: PID Event device interrupt occured */
/* if the Data semaphore belongs to SDH PID */
if (pSuperBuffer->SemaphoreHandle == pDevice->DataSemaphoreHandle)
/* release SDH device Lock Semaphore */
adi_dev_Control(pDevice->DeviceHandle, ADI_FSS_CMD_RELEASE_LOCK_SEMAPHORE, NULL);
/* and post the data semaphore */
In FSS dirver this question is solved by crosscalling: adi_sdh driver calls _adi_fss_DetectVolumes, in which it transfers DataSemaphoreHandle to FSS. FSS then transfers handle back, when makes dataflow transactions. But what about standalone?
So that's the reason I asked my question about code axamples. I'm sure, that there are some more nuances.
Retrieving data ...