1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
109
110
111
112
116
117
118
119
122
123
124
125
126
127
128
129
132
133
134
135
136
137
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
224
225
226
227
234
235
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
257
265
266
272
280
281
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
321
322
323
324
325
326
327
328
329
330
331
332
333
339
340
344
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
385
386
387
388
389
390
391
392
393
394
395
396
397
398
403
404
408
409
410
411
412
417
418
422
423
424
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
462
463
464
465
466
467
468
469
470
471
472
473
474
475
480
481
485
486
487
491
492
493
498
499
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
558
559
563
564
565
566
567
568
569
570
571
572
573
579
580
581
582
583
584
585
589
590
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
682
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
713
714
715
716
717
736
752
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
800
816
821
822
823
824
825
826
827
828
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
853
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
876
877
878
879
884
885
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
912
913
914
915
916
920
924
925
926
927
928
931
932
935
936
939
940
941
942
945
946
/* ... */
#include "stm32f4xx_hal.h"
#if defined(FMC_Bank4) || defined(FSMC_Bank4)
/* ... */
#ifdef HAL_PCCARD_MODULE_ENABLED
/* ... */
/* ... */
#define PCCARD_TIMEOUT_READ_ID 0x0000FFFFU
#define PCCARD_TIMEOUT_READ_WRITE_SECTOR 0x0000FFFFU
#define PCCARD_TIMEOUT_ERASE_SECTOR 0x00000400U
#define PCCARD_TIMEOUT_STATUS 0x01000000U
#define PCCARD_STATUS_OK (uint8_t)0x58
#define PCCARD_STATUS_WRITE_OK (uint8_t)0x50
6 defines
/* ... */
Private define
/* ... */
/* ... */
/* ... */
HAL_StatusTypeDef HAL_PCCARD_Init(PCCARD_HandleTypeDef *hpccard, FMC_NAND_PCC_TimingTypeDef *ComSpaceTiming,
FMC_NAND_PCC_TimingTypeDef *AttSpaceTiming, FMC_NAND_PCC_TimingTypeDef *IOSpaceTiming)
{
if (hpccard == NULL)
{
return HAL_ERROR;
}if (hpccard == NULL) { ... }
if (hpccard->State == HAL_PCCARD_STATE_RESET)
{
hpccard->Lock = HAL_UNLOCKED;
#if (USE_HAL_PCCARD_REGISTER_CALLBACKS == 1)
if (hpccard->MspInitCallback == NULL)
{
hpccard->MspInitCallback = HAL_PCCARD_MspInit;
}if (hpccard->MspInitCallback == NULL) { ... }
hpccard->ItCallback = HAL_PCCARD_ITCallback;
hpccard->MspInitCallback(hpccard);/* ... */
#else
HAL_PCCARD_MspInit(hpccard);/* ... */
#endif
}if (hpccard->State == HAL_PCCARD_STATE_RESET) { ... }
hpccard->State = HAL_PCCARD_STATE_BUSY;
FMC_PCCARD_Init(hpccard->Instance, &(hpccard->Init));
FMC_PCCARD_CommonSpace_Timing_Init(hpccard->Instance, ComSpaceTiming);
FMC_PCCARD_AttributeSpace_Timing_Init(hpccard->Instance, AttSpaceTiming);
FMC_PCCARD_IOSpace_Timing_Init(hpccard->Instance, IOSpaceTiming);
__FMC_PCCARD_ENABLE(hpccard->Instance);
hpccard->State = HAL_PCCARD_STATE_READY;
return HAL_OK;
}HAL_PCCARD_Init (PCCARD_HandleTypeDef *hpccard, FMC_NAND_PCC_TimingTypeDef *ComSpaceTiming, FMC_NAND_PCC_TimingTypeDef *AttSpaceTiming, FMC_NAND_PCC_TimingTypeDef *IOSpaceTiming) { ... }
/* ... */
HAL_StatusTypeDef HAL_PCCARD_DeInit(PCCARD_HandleTypeDef *hpccard)
{
#if (USE_HAL_PCCARD_REGISTER_CALLBACKS == 1)
if (hpccard->MspDeInitCallback == NULL)
{
hpccard->MspDeInitCallback = HAL_PCCARD_MspDeInit;
}if (hpccard->MspDeInitCallback == NULL) { ... }
hpccard->MspDeInitCallback(hpccard);/* ... */
#else
HAL_PCCARD_MspDeInit(hpccard);/* ... */
#endif
FMC_PCCARD_DeInit(hpccard->Instance);
hpccard->State = HAL_PCCARD_STATE_RESET;
__HAL_UNLOCK(hpccard);
return HAL_OK;
}HAL_PCCARD_DeInit (PCCARD_HandleTypeDef *hpccard) { ... }
/* ... */
__weak void HAL_PCCARD_MspInit(PCCARD_HandleTypeDef *hpccard)
{
UNUSED(hpccard);
/* ... */
}HAL_PCCARD_MspInit (PCCARD_HandleTypeDef *hpccard) { ... }
/* ... */
__weak void HAL_PCCARD_MspDeInit(PCCARD_HandleTypeDef *hpccard)
{
UNUSED(hpccard);
/* ... */
}HAL_PCCARD_MspDeInit (PCCARD_HandleTypeDef *hpccard) { ... }
/* ... */
/* ... */
/* ... */
HAL_StatusTypeDef HAL_PCCARD_Read_ID(PCCARD_HandleTypeDef *hpccard, uint8_t CompactFlash_ID[], uint8_t *pStatus)
{
uint32_t timeout = PCCARD_TIMEOUT_READ_ID, index = 0U;
uint8_t status = 0;
__HAL_LOCK(hpccard);
if (hpccard->State == HAL_PCCARD_STATE_BUSY)
{
return HAL_BUSY;
}if (hpccard->State == HAL_PCCARD_STATE_BUSY) { ... }
hpccard->State = HAL_PCCARD_STATE_BUSY;
*pStatus = PCCARD_READY;
*(__IO uint16_t *)(PCCARD_IO_SPACE_PRIMARY_ADDR | ATA_STATUS_CMD) = (uint16_t)0xECEC;
do
{
status = *(__IO uint8_t *)(PCCARD_IO_SPACE_PRIMARY_ADDR | ATA_STATUS_CMD_ALTERNATE);
timeout--;
...} while ((status != PCCARD_STATUS_OK) && timeout);
if (timeout == 0U)
{
*pStatus = PCCARD_TIMEOUT_ERROR;
}if (timeout == 0U) { ... }
else
{
for (index = 0U; index < 16U; index++)
{
CompactFlash_ID[index] = *(__IO uint8_t *)(PCCARD_IO_SPACE_PRIMARY_ADDR | ATA_DATA);
}for (index = 0U; index < 16U; index++) { ... }
}else { ... }
hpccard->State = HAL_PCCARD_STATE_READY;
__HAL_UNLOCK(hpccard);
return HAL_OK;
}HAL_PCCARD_Read_ID (PCCARD_HandleTypeDef *hpccard, uint8_t CompactFlash_ID[], uint8_t *pStatus) { ... }
/* ... */
HAL_StatusTypeDef HAL_PCCARD_Read_Sector(PCCARD_HandleTypeDef *hpccard, uint16_t *pBuffer, uint16_t SectorAddress,
uint8_t *pStatus)
{
uint32_t timeout = PCCARD_TIMEOUT_READ_WRITE_SECTOR, index = 0U;
uint8_t status = 0;
__HAL_LOCK(hpccard);
if (hpccard->State == HAL_PCCARD_STATE_BUSY)
{
return HAL_BUSY;
}if (hpccard->State == HAL_PCCARD_STATE_BUSY) { ... }
hpccard->State = HAL_PCCARD_STATE_BUSY;
*pStatus = PCCARD_READY;
*(__IO uint16_t *)(PCCARD_IO_SPACE_PRIMARY_ADDR | ATA_CYLINDER_HIGH) = (uint16_t)0x0000;
*(__IO uint16_t *)(PCCARD_IO_SPACE_PRIMARY_ADDR | ATA_SECTOR_COUNT) = ((uint16_t)0x0100) | ((uint16_t)SectorAddress);
*(__IO uint16_t *)(PCCARD_IO_SPACE_PRIMARY_ADDR | ATA_STATUS_CMD) = (uint16_t)0xE4A0;
do
{
status = *(__IO uint16_t *)(PCCARD_IO_SPACE_PRIMARY_ADDR | ATA_STATUS_CMD_ALTERNATE);
timeout--;
...} while ((status == 0x80U) && timeout);
if (timeout == 0U)
{
*pStatus = PCCARD_TIMEOUT_ERROR;
}if (timeout == 0U) { ... }
timeout = PCCARD_TIMEOUT_READ_WRITE_SECTOR;
do
{
status = *(__IO uint16_t *)(PCCARD_IO_SPACE_PRIMARY_ADDR | ATA_STATUS_CMD_ALTERNATE);
timeout--;
...} while ((status != PCCARD_STATUS_OK) && timeout);
if (timeout == 0U)
{
*pStatus = PCCARD_TIMEOUT_ERROR;
}if (timeout == 0U) { ... }
for (; index < PCCARD_SECTOR_SIZE; index++)
{
*(uint16_t *)pBuffer++ = *(uint16_t *)(PCCARD_IO_SPACE_PRIMARY_ADDR);
}for (; index < PCCARD_SECTOR_SIZE; index++) { ... }
hpccard->State = HAL_PCCARD_STATE_READY;
__HAL_UNLOCK(hpccard);
return HAL_OK;
}HAL_PCCARD_Read_Sector (PCCARD_HandleTypeDef *hpccard, uint16_t *pBuffer, uint16_t SectorAddress, uint8_t *pStatus) { ... }
/* ... */
HAL_StatusTypeDef HAL_PCCARD_Write_Sector(PCCARD_HandleTypeDef *hpccard, uint16_t *pBuffer, uint16_t SectorAddress,
uint8_t *pStatus)
{
uint32_t timeout = PCCARD_TIMEOUT_READ_WRITE_SECTOR, index = 0U;
uint8_t status = 0;
__HAL_LOCK(hpccard);
if (hpccard->State == HAL_PCCARD_STATE_BUSY)
{
return HAL_BUSY;
}if (hpccard->State == HAL_PCCARD_STATE_BUSY) { ... }
hpccard->State = HAL_PCCARD_STATE_BUSY;
*pStatus = PCCARD_READY;
*(__IO uint16_t *)(PCCARD_IO_SPACE_PRIMARY_ADDR | ATA_CYLINDER_HIGH) = (uint16_t)0x0000;
*(__IO uint16_t *)(PCCARD_IO_SPACE_PRIMARY_ADDR | ATA_SECTOR_COUNT) = ((uint16_t)0x0100) | ((uint16_t)SectorAddress);
*(__IO uint16_t *)(PCCARD_IO_SPACE_PRIMARY_ADDR | ATA_STATUS_CMD) = (uint16_t)0x30A0;
do
{
status = *(__IO uint8_t *)(PCCARD_IO_SPACE_PRIMARY_ADDR | ATA_STATUS_CMD_ALTERNATE);
timeout--;
...} while ((status != PCCARD_STATUS_OK) && timeout);
if (timeout == 0U)
{
*pStatus = PCCARD_TIMEOUT_ERROR;
}if (timeout == 0U) { ... }
for (; index < PCCARD_SECTOR_SIZE; index++)
{
*(uint16_t *)(PCCARD_IO_SPACE_PRIMARY_ADDR) = *(uint16_t *)pBuffer++;
}for (; index < PCCARD_SECTOR_SIZE; index++) { ... }
do
{
status = *(__IO uint8_t *)(PCCARD_IO_SPACE_PRIMARY_ADDR | ATA_STATUS_CMD_ALTERNATE);
timeout--;
...} while ((status != PCCARD_STATUS_WRITE_OK) && timeout);
if (timeout == 0U)
{
*pStatus = PCCARD_TIMEOUT_ERROR;
}if (timeout == 0U) { ... }
hpccard->State = HAL_PCCARD_STATE_READY;
__HAL_UNLOCK(hpccard);
return HAL_OK;
}HAL_PCCARD_Write_Sector (PCCARD_HandleTypeDef *hpccard, uint16_t *pBuffer, uint16_t SectorAddress, uint8_t *pStatus) { ... }
/* ... */
HAL_StatusTypeDef HAL_PCCARD_Erase_Sector(PCCARD_HandleTypeDef *hpccard, uint16_t SectorAddress, uint8_t *pStatus)
{
uint32_t timeout = PCCARD_TIMEOUT_ERASE_SECTOR;
uint8_t status = 0;
__HAL_LOCK(hpccard);
if (hpccard->State == HAL_PCCARD_STATE_BUSY)
{
return HAL_BUSY;
}if (hpccard->State == HAL_PCCARD_STATE_BUSY) { ... }
hpccard->State = HAL_PCCARD_STATE_BUSY;
*pStatus = PCCARD_READY;
*(__IO uint8_t *)(PCCARD_IO_SPACE_PRIMARY_ADDR | ATA_CYLINDER_LOW) = 0x00;
*(__IO uint8_t *)(PCCARD_IO_SPACE_PRIMARY_ADDR | ATA_CYLINDER_HIGH) = 0x00;
*(__IO uint8_t *)(PCCARD_IO_SPACE_PRIMARY_ADDR | ATA_SECTOR_NUMBER) = SectorAddress;
*(__IO uint8_t *)(PCCARD_IO_SPACE_PRIMARY_ADDR | ATA_SECTOR_COUNT) = 0x01;
*(__IO uint8_t *)(PCCARD_IO_SPACE_PRIMARY_ADDR | ATA_CARD_HEAD) = 0xA0;
*(__IO uint8_t *)(PCCARD_IO_SPACE_PRIMARY_ADDR | ATA_STATUS_CMD) = ATA_ERASE_SECTOR_CMD;
status = *(__IO uint8_t *)(PCCARD_IO_SPACE_PRIMARY_ADDR | ATA_STATUS_CMD_ALTERNATE);
while ((status != PCCARD_STATUS_WRITE_OK) && timeout)
{
status = *(__IO uint8_t *)(PCCARD_IO_SPACE_PRIMARY_ADDR | ATA_STATUS_CMD_ALTERNATE);
timeout--;
}while ((status != PCCARD_STATUS_WRITE_OK) && timeout) { ... }
if (timeout == 0U)
{
*pStatus = PCCARD_TIMEOUT_ERROR;
}if (timeout == 0U) { ... }
hpccard->State = HAL_PCCARD_STATE_READY;
__HAL_UNLOCK(hpccard);
return HAL_OK;
}HAL_PCCARD_Erase_Sector (PCCARD_HandleTypeDef *hpccard, uint16_t SectorAddress, uint8_t *pStatus) { ... }
/* ... */
HAL_StatusTypeDef HAL_PCCARD_Reset(PCCARD_HandleTypeDef *hpccard)
{
__HAL_LOCK(hpccard);
if (hpccard->State == HAL_PCCARD_STATE_BUSY)
{
return HAL_BUSY;
}if (hpccard->State == HAL_PCCARD_STATE_BUSY) { ... }
/* ... */
hpccard->State = HAL_PCCARD_STATE_BUSY;
*(__IO uint8_t *)(PCCARD_ATTRIBUTE_SPACE_ADDRESS | ATA_CARD_CONFIGURATION) = 0x01;
hpccard->State = HAL_PCCARD_STATE_READY;
__HAL_UNLOCK(hpccard);
return HAL_OK;
}HAL_PCCARD_Reset (PCCARD_HandleTypeDef *hpccard) { ... }
/* ... */
void HAL_PCCARD_IRQHandler(PCCARD_HandleTypeDef *hpccard)
{
if (__FMC_PCCARD_GET_FLAG(hpccard->Instance, FMC_FLAG_RISING_EDGE))
{
#if (USE_HAL_PCCARD_REGISTER_CALLBACKS == 1)
hpccard->ItCallback(hpccard);
#else
HAL_PCCARD_ITCallback(hpccard);
#endif
__FMC_PCCARD_CLEAR_FLAG(hpccard->Instance, FMC_FLAG_RISING_EDGE);
}if (__FMC_PCCARD_GET_FLAG(hpccard->Instance, FMC_FLAG_RISING_EDGE)) { ... }
if (__FMC_PCCARD_GET_FLAG(hpccard->Instance, FMC_FLAG_LEVEL))
{
#if (USE_HAL_PCCARD_REGISTER_CALLBACKS == 1)
hpccard->ItCallback(hpccard);
#else
HAL_PCCARD_ITCallback(hpccard);
#endif
__FMC_PCCARD_CLEAR_FLAG(hpccard->Instance, FMC_FLAG_LEVEL);
}if (__FMC_PCCARD_GET_FLAG(hpccard->Instance, FMC_FLAG_LEVEL)) { ... }
if (__FMC_PCCARD_GET_FLAG(hpccard->Instance, FMC_FLAG_FALLING_EDGE))
{
#if (USE_HAL_PCCARD_REGISTER_CALLBACKS == 1)
hpccard->ItCallback(hpccard);
#else
HAL_PCCARD_ITCallback(hpccard);
#endif
__FMC_PCCARD_CLEAR_FLAG(hpccard->Instance, FMC_FLAG_FALLING_EDGE);
}if (__FMC_PCCARD_GET_FLAG(hpccard->Instance, FMC_FLAG_FALLING_EDGE)) { ... }
if (__FMC_PCCARD_GET_FLAG(hpccard->Instance, FMC_FLAG_FEMPT))
{
#if (USE_HAL_PCCARD_REGISTER_CALLBACKS == 1)
hpccard->ItCallback(hpccard);
#else
HAL_PCCARD_ITCallback(hpccard);
#endif
__FMC_PCCARD_CLEAR_FLAG(hpccard->Instance, FMC_FLAG_FEMPT);
}if (__FMC_PCCARD_GET_FLAG(hpccard->Instance, FMC_FLAG_FEMPT)) { ... }
}HAL_PCCARD_IRQHandler (PCCARD_HandleTypeDef *hpccard) { ... }
/* ... */
__weak void HAL_PCCARD_ITCallback(PCCARD_HandleTypeDef *hpccard)
{
UNUSED(hpccard);
/* ... */
}HAL_PCCARD_ITCallback (PCCARD_HandleTypeDef *hpccard) { ... }
#if (USE_HAL_PCCARD_REGISTER_CALLBACKS == 1)
/* ... */
HAL_StatusTypeDef HAL_PCCARD_RegisterCallback(PCCARD_HandleTypeDef *hpccard, HAL_PCCARD_CallbackIDTypeDef CallbackId,
pPCCARD_CallbackTypeDef pCallback)
{
HAL_StatusTypeDef status = HAL_OK;
if (pCallback == NULL)
{
return HAL_ERROR;
}if (pCallback == NULL) { ... }
__HAL_LOCK(hpccard);
if (hpccard->State == HAL_PCCARD_STATE_READY)
{
switch (CallbackId)
{
case HAL_PCCARD_MSP_INIT_CB_ID :
hpccard->MspInitCallback = pCallback;
break;case HAL_PCCARD_MSP_INIT_CB_ID :
case HAL_PCCARD_MSP_DEINIT_CB_ID :
hpccard->MspDeInitCallback = pCallback;
break;case HAL_PCCARD_MSP_DEINIT_CB_ID :
case HAL_PCCARD_IT_CB_ID :
hpccard->ItCallback = pCallback;
break;case HAL_PCCARD_IT_CB_ID :
default :
status = HAL_ERROR;
break;default
}switch (CallbackId) { ... }
}if (hpccard->State == HAL_PCCARD_STATE_READY) { ... }
else if (hpccard->State == HAL_PCCARD_STATE_RESET)
{
switch (CallbackId)
{
case HAL_PCCARD_MSP_INIT_CB_ID :
hpccard->MspInitCallback = pCallback;
break;case HAL_PCCARD_MSP_INIT_CB_ID :
case HAL_PCCARD_MSP_DEINIT_CB_ID :
hpccard->MspDeInitCallback = pCallback;
break;case HAL_PCCARD_MSP_DEINIT_CB_ID :
default :
status = HAL_ERROR;
break;default
}switch (CallbackId) { ... }
}else if (hpccard->State == HAL_PCCARD_STATE_RESET) { ... }
else
{
status = HAL_ERROR;
}else { ... }
__HAL_UNLOCK(hpccard);
return status;
}HAL_PCCARD_RegisterCallback (PCCARD_HandleTypeDef *hpccard, HAL_PCCARD_CallbackIDTypeDef CallbackId, pPCCARD_CallbackTypeDef pCallback) { ... }
/* ... */
HAL_StatusTypeDef HAL_PCCARD_UnRegisterCallback(PCCARD_HandleTypeDef *hpccard, HAL_PCCARD_CallbackIDTypeDef CallbackId)
{
HAL_StatusTypeDef status = HAL_OK;
__HAL_LOCK(hpccard);
if (hpccard->State == HAL_PCCARD_STATE_READY)
{
switch (CallbackId)
{
case HAL_PCCARD_MSP_INIT_CB_ID :
hpccard->MspInitCallback = HAL_PCCARD_MspInit;
break;case HAL_PCCARD_MSP_INIT_CB_ID :
case HAL_PCCARD_MSP_DEINIT_CB_ID :
hpccard->MspDeInitCallback = HAL_PCCARD_MspDeInit;
break;case HAL_PCCARD_MSP_DEINIT_CB_ID :
case HAL_PCCARD_IT_CB_ID :
hpccard->ItCallback = HAL_PCCARD_ITCallback;
break;case HAL_PCCARD_IT_CB_ID :
default :
status = HAL_ERROR;
break;default
}switch (CallbackId) { ... }
}if (hpccard->State == HAL_PCCARD_STATE_READY) { ... }
else if (hpccard->State == HAL_PCCARD_STATE_RESET)
{
switch (CallbackId)
{
case HAL_PCCARD_MSP_INIT_CB_ID :
hpccard->MspInitCallback = HAL_PCCARD_MspInit;
break;case HAL_PCCARD_MSP_INIT_CB_ID :
case HAL_PCCARD_MSP_DEINIT_CB_ID :
hpccard->MspDeInitCallback = HAL_PCCARD_MspDeInit;
break;case HAL_PCCARD_MSP_DEINIT_CB_ID :
default :
status = HAL_ERROR;
break;default
}switch (CallbackId) { ... }
}else if (hpccard->State == HAL_PCCARD_STATE_RESET) { ... }
else
{
status = HAL_ERROR;
}else { ... }
__HAL_UNLOCK(hpccard);
return status;
}HAL_PCCARD_UnRegisterCallback (PCCARD_HandleTypeDef *hpccard, HAL_PCCARD_CallbackIDTypeDef CallbackId) { ... }
/* ... */#endif
/* ... */
/* ... */
/* ... */
HAL_PCCARD_StateTypeDef HAL_PCCARD_GetState(PCCARD_HandleTypeDef *hpccard)
{
return hpccard->State;
}HAL_PCCARD_GetState (PCCARD_HandleTypeDef *hpccard) { ... }
/* ... */
HAL_PCCARD_StatusTypeDef HAL_PCCARD_GetStatus(PCCARD_HandleTypeDef *hpccard)
{
uint32_t timeout = PCCARD_TIMEOUT_STATUS, status_pccard = 0U;
if (hpccard->State == HAL_PCCARD_STATE_BUSY)
{
return HAL_PCCARD_STATUS_ONGOING;
}if (hpccard->State == HAL_PCCARD_STATE_BUSY) { ... }
status_pccard = *(__IO uint8_t *)(PCCARD_IO_SPACE_PRIMARY_ADDR | ATA_STATUS_CMD_ALTERNATE);
while ((status_pccard == PCCARD_BUSY) && timeout)
{
status_pccard = *(__IO uint8_t *)(PCCARD_IO_SPACE_PRIMARY_ADDR | ATA_STATUS_CMD_ALTERNATE);
timeout--;
}while ((status_pccard == PCCARD_BUSY) && timeout) { ... }
if (timeout == 0U)
{
status_pccard = PCCARD_TIMEOUT_ERROR;
}if (timeout == 0U) { ... }
return (HAL_PCCARD_StatusTypeDef) status_pccard;
}HAL_PCCARD_GetStatus (PCCARD_HandleTypeDef *hpccard) { ... }
/* ... */
HAL_PCCARD_StatusTypeDef HAL_PCCARD_ReadStatus(PCCARD_HandleTypeDef *hpccard)
{
uint8_t data = 0U, status_pccard = PCCARD_BUSY;
if (hpccard->State == HAL_PCCARD_STATE_BUSY)
{
return HAL_PCCARD_STATUS_ONGOING;
}if (hpccard->State == HAL_PCCARD_STATE_BUSY) { ... }
data = *(__IO uint8_t *)(PCCARD_IO_SPACE_PRIMARY_ADDR | ATA_STATUS_CMD_ALTERNATE);
if ((data & PCCARD_TIMEOUT_ERROR) == PCCARD_TIMEOUT_ERROR)
{
status_pccard = PCCARD_TIMEOUT_ERROR;
}if ((data & PCCARD_TIMEOUT_ERROR) == PCCARD_TIMEOUT_ERROR) { ... }
else if ((data & PCCARD_READY) == PCCARD_READY)
{
status_pccard = PCCARD_READY;
}else if ((data & PCCARD_READY) == PCCARD_READY) { ... }
return (HAL_PCCARD_StatusTypeDef) status_pccard;
}HAL_PCCARD_ReadStatus (PCCARD_HandleTypeDef *hpccard) { ... }
/* ... */
/* ... */
/* ... */
/* ... */
#endif
/* ... */
/* ... */
#endif