| Line No. | Rev | Author | Line |
|---|---|---|---|
| 1 | 32 | kaklik | /****************************************************************************** |
| 2 | * |
||
| 3 | * Microchip Memory Disk Drive File System |
||
| 4 | * |
||
| 5 | ****************************************************************************** |
||
| 6 | * FileName: CF-PMP.h |
||
| 7 | * Dependencies: GenericTypeDefs.h |
||
| 8 | * FSDefs.h |
||
| 9 | * FSconfig.h |
||
| 10 | * Processor: PIC24/dsPIC30/dsPIC33 |
||
| 11 | * Compiler: C30 |
||
| 12 | * Company: Microchip Technology, Inc. |
||
| 13 | * |
||
| 14 | * Software License Agreement |
||
| 15 | * |
||
| 16 | * The software supplied herewith by Microchip Technology Incorporated |
||
| 17 | * (the Company) for its PICmicro® Microcontroller is intended and |
||
| 18 | * supplied to you, the Companys customer, for use solely and |
||
| 19 | * exclusively on Microchip PICmicro Microcontroller products. The |
||
| 20 | * software is owned by the Company and/or its supplier, and is |
||
| 21 | * protected under applicable copyright laws. All rights are reserved. |
||
| 22 | * Any use in violation of the foregoing restrictions may subject the |
||
| 23 | * user to criminal sanctions under applicable laws, as well as to |
||
| 24 | * civil liability for the breach of the terms and conditions of this |
||
| 25 | * license. |
||
| 26 | * |
||
| 27 | * THIS SOFTWARE IS PROVIDED IN AN AS IS CONDITION. NO WARRANTIES, |
||
| 28 | * WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED |
||
| 29 | * TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A |
||
| 30 | * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE COMPANY SHALL NOT, |
||
| 31 | * IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL OR |
||
| 32 | * CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. |
||
| 33 | * |
||
| 34 | *****************************************************************************/ |
||
| 35 | //DOM-IGNORE-BEGIN |
||
| 36 | /******************************************************************** |
||
| 37 | Change History: |
||
| 38 | Rev Description |
||
| 39 | ---- ----------------------- |
||
| 40 | 1.2.4 - 1.2.6 No Change |
||
| 41 | ********************************************************************/ |
||
| 42 | //DOM-IGNORE-END |
||
| 43 | |||
| 44 | #include "GenericTypeDefs.h" |
||
| 45 | #include "FSconfig.h" |
||
| 46 | #include "FSDefs.h" |
||
| 47 | |||
| 48 | |||
| 49 | /*******************************************************************************/ |
||
| 50 | /* Macros */ |
||
| 51 | /*******************************************************************************/ |
||
| 52 | |||
| 53 | // Description: A macro to set the CF data bus TRIS register to outputs |
||
| 54 | #define MDD_CFPMP_DATABoutput MDD_CFPMP_DATADIR = 0; |
||
| 55 | // Description: A macro to set the CF data bus TRIS register to inputs |
||
| 56 | #define MDD_CFPMP_DATABinput MDD_CFPMP_DATADIR = 0xff; |
||
| 57 | |||
| 58 | |||
| 59 | /*******************************************************************************/ |
||
| 60 | /* Structure and defines */ |
||
| 61 | /*******************************************************************************/ |
||
| 62 | |||
| 63 | // Description: A macro for the data register offset for CF cards |
||
| 64 | #define R_DATA 0 |
||
| 65 | // Description: A macro for the error register offset for CF cards |
||
| 66 | #define R_ERROR 1 |
||
| 67 | // Description: A macro for the count register offset for CF cards |
||
| 68 | #define R_COUNT 2 |
||
| 69 | // Description: A macro for the sector register offset for CF cards |
||
| 70 | #define R_SECT 3 |
||
| 71 | // Description: A macro for the cylinder-low register offset for CF cards |
||
| 72 | #define R_CYLO 4 |
||
| 73 | // Description: A macro for the cylinder-high register offset for CF cards |
||
| 74 | #define R_CYHI 5 |
||
| 75 | // Description: A macro for the drive register offset for CF cards |
||
| 76 | #define R_DRIVE 6 |
||
| 77 | // Description: A macro for the command register offset for CF cards |
||
| 78 | #define R_CMD 7 |
||
| 79 | // Description: A macro for the status offset for CF cards |
||
| 80 | #define R_STATUS 7 |
||
| 81 | |||
| 82 | |||
| 83 | |||
| 84 | // Description: A macro for the CF read comment |
||
| 85 | #define C_SECTOR_READ 0x20 |
||
| 86 | // Description: A macro for the CF drive diagnostic command |
||
| 87 | #define C_DRIVE_DIAG 0x90 |
||
| 88 | // Description: A macro for the CF drive identify command |
||
| 89 | #define C_DRIVE_IDENT 0xEC |
||
| 90 | // Description: A macro for the CF write command |
||
| 91 | #define C_SECTOR_WRITE 0x30 |
||
| 92 | |||
| 93 | |||
| 94 | // Description: A macro indicating that the CF status register reports a ready condition |
||
| 95 | #define S_READY 0x58 |
||
| 96 | // Description: A macro indicating that the CF status register reports an error condition |
||
| 97 | #define S_ERROR 0x51 |
||
| 98 | |||
| 99 | // Description: A macro used to set TRIS register bits to output |
||
| 100 | #define OUTPUT 0 |
||
| 101 | // Description: A macro used to set TRIS register bits to input |
||
| 102 | #define INPUT 1 |
||
| 103 | |||
| 104 | #ifndef FALSE |
||
| 105 | #define FALSE 0 |
||
| 106 | #endif |
||
| 107 | #ifndef TRUE |
||
| 108 | #define TRUE !FALSE |
||
| 109 | #endif |
||
| 110 | |||
| 111 | |||
| 112 | // The initialization function for CF cards (no initialization required) |
||
| 113 | |||
| 114 | /************************************************************************/ |
||
| 115 | /* Prototypes */ |
||
| 116 | /************************************************************************/ |
||
| 117 | |||
| 118 | void MDD_CFPMP_InitIO( void); |
||
| 119 | BYTE MDD_CFPMP_MediaDetect( void); |
||
| 120 | BYTE MDD_CFPMP_WriteProtectState (void); |
||
| 121 | BYTE MDD_CFPMP_CFread( BYTE add); |
||
| 122 | void MDD_CFPMP_CFwrite( BYTE add, BYTE d); |
||
| 123 | void MDD_CFPMP_CFwait(void); |
||
| 124 | |||
| 125 | BYTE MDD_CFPMP_SectorRead( DWORD lda, BYTE * buf); |
||
| 126 | BYTE MDD_CFPMP_SectorWrite( DWORD lda, BYTE * buf, BYTE allowWriteToZero); |
||
| 127 | MEDIA_INFORMATION * MDD_CFPMP_MediaInitialize (void); |
||
| 128 | |||
| 129 | #ifdef __C30__ |
||
| 130 | extern BYTE ReadByte( BYTE* pBuffer, WORD index ); |
||
| 131 | extern WORD ReadWord( BYTE* pBuffer, WORD index ); |
||
| 132 | extern DWORD ReadDWord( BYTE* pBuffer, WORD index ); |
||
| 133 | #endif |
||
| 134 | |||
| 135 |
Powered by WebSVN v2.8.3