Create New Item
Item Type
File
Folder
Item Name
Search file in folder and subfolders...
Are you sure want to rename?
File Manager
/
PIC18F452
:
DLL_interface.h
Advanced Search
Upload
New Item
Settings
Back
Back Up
Advanced Editor
Save
/**********************************************************************/ /* */ /* File name: DLL_interface.h */ /* */ /* Since: 2002/12/03 */ /* */ /* Version: 1.02 */ /* */ /* Author: MONTAGNE Xavier [XM] {link xavier.montagne@wanadoo.fr} */ /* */ /* Purpose: Offer high level interface for PIC programming operations:*/ /* parsing or creat an HEX file, updating the PIC structures */ /* after parsing, reading or programming the PIC,... */ /* */ /* Distribution: This file is part of PP18. */ /* PP18 is free software; you can redistribute it */ /* and/or modify it under the terms of the GNU General */ /* Public License as published by the Free Software */ /* Foundation; either version 2, or (at your option) */ /* any later version. */ /* */ /* PP18 is distributed in the hope that it will be */ /* useful, but WITHOUT ANY WARRANTY; without even the */ /* implied warranty of MERCHANTABILITY or FITNESS FOR A */ /* PARTICULAR PURPOSE. See the GNU General Public */ /* License for more details. */ /* */ /* You should have received a copy of the GNU General */ /* Public License along with PP18; see the file */ /* COPYING.txt. If not, write to the Free Software */ /* Foundation, 59 Temple Place - Suite 330, */ /* Boston, MA 02111-1307, USA. */ /* */ /* History: */ /* 2002/12/03 [XM] Create this file */ /* */ /**********************************************************************/ #if !defined(__DLL_INTERFACE_H__) #define __DLL_INTERFACE_H__ /*********************************************************************** * INCLUDES **********************************************************************/ #include <windows.h> #include "com.h" /*********************************************************************** * DEFINES **********************************************************************/ #define FromPIC 1 #define FromFile 0 #define DISPLAY_READ 0 #define DISPLAY_WRITE 1 #define DLL_EXPORT __declspec(dllexport) /*********************************************************************** * FUNCTION DEFINITIONS **********************************************************************/ #if defined(__cplusplus) extern "C" { #endif /*********************************************************************** * Only fill the SHexFile structure. Do not proceed to any programming * sequences. This function fills the Hex_from_file structure, so it has * to be called first to initialyze. * * @param char *ucFilename IN HEX filename to parse * @return Status_t FILE_ERROR if something wrong appends * (Hex larger than PIC memory size) * ALL_RIGHT otherwise **********************************************************************/ Status_t DLL_EXPORT ParseFile(char *ucFilename); /*********************************************************************** * Give the memory size of the chip (and not the memory size of usefull * data inside the PIC), or the data size of the HEX file parsed. * * @param u_int *uiSize OUT PIC memory size * @param u_int uiFrom IN Flag (PIC or File) * @return Status_t Always ALL_RIGHT **********************************************************************/ Status_t DLL_EXPORT GetMemorySize(unsigned int *uiSize, unsigned int uiFrom); /*********************************************************************** * Copy the memory content from the PIC or FILE structure to the buffer * parameter. * * @param u_short *usMemory OUT Memory buffer * @param u_int uiFrom IN Flag (PIC or File) * @return Status_t Always ALL_RIGHT **********************************************************************/ Status_t DLL_EXPORT GetMemoryBuffer(unsigned short *usMemory, unsigned int uiFrom); /*********************************************************************** * Copy the memory content from the buffer to the PIC or FILE structure. * * @param u_short *usMemory IN Memory buffer * @param u_int uiFrom IN Flag (PIC or File) * @return Status_t Always ALL_RIGHT **********************************************************************/ Status_t DLL_EXPORT SetMemoryBuffer(unsigned short *usMemory, unsigned int uiFrom); /*********************************************************************** * Rebuil a HEX File from memory, config and ID. Do not proceed to any * programming sequences. This function creats a new HEX file a replace * an existing one. * * @param char *ucFilename IN HEX filename to build * @param u_int uiFrom IN Flag (PIC or File) * @return Status_t FILE_ERROR if something wrong appends * (cannot creat a new file) * ALL_RIGHT otherwise **********************************************************************/ Status_t DLL_EXPORT UnParseFile(char *ucFilename, unsigned int uiFrom); /*********************************************************************** * Perform a programmation process to the hardware programmer and the * chip on it concerning memory area only. * * @param u_int uiFrom IN Flag (PIC or File) * @return Status_t BAD_PROGRAMMED if something wrong appends * PROGRAMMED if not * ALL_RIGHT otherwise **********************************************************************/ Status_t DLL_EXPORT ProgramMem(unsigned int uiFrom); /*********************************************************************** * Perform a programmation process to the hardware programmer and the * chip on it concerning config area only. * * @param u_int uiFrom IN Flag (PIC or File) * @return Status_t BAD_PROGRAMMED if something wrong appends * PROGRAMMED if not * ALL_RIGHT otherwise **********************************************************************/ Status_t DLL_EXPORT ProgramConfig(unsigned int uiFrom); /*********************************************************************** * Perform a programmation process to the hardware programmer and the * chip on it concerning ID area only. * * @param u_int uiFrom IN Flag (PIC or File) * @return Status_t BAD_PROGRAMMED if something wrong appends * PROGRAMMED if not * ALL_RIGHT otherwise **********************************************************************/ Status_t DLL_EXPORT ProgramID(unsigned int uiFrom); /*********************************************************************** * Download the code memory field from the PIC device, and update the * PIC structure. * * @param void * @return Status_t BLANK if all memory set to 0xFFFF * NOT_BLANK if not * ALL_RIGHT otherwise **********************************************************************/ Status_t DLL_EXPORT ReadMem(void); /*********************************************************************** * Download the config field from the PIC device, and update the PIC * structure. * * @param void * @return Status_t LOCKED if Code Prection ON * ALL_RIGHT otherwise **********************************************************************/ Status_t DLL_EXPORT ReadConfig(void); /*********************************************************************** * Download the ID field from the PIC device, and update the PIC * structure. * * @param void * @return Status_t Always ALL_RIGHT **********************************************************************/ Status_t DLL_EXPORT ReadID(void); /*********************************************************************** * Download REV+DEV from the chip present in the device chip. * This function fills the Hex_from_file structure, so it has * to be called first to initialyze the PIC structure. * * @param char *PICname IN PIC name reference (name of DLL) * @return Status_t PIC_DETECTED if right PIC detected * HARDWARE_ERROR if not detected **********************************************************************/ Status_t DLL_EXPORT ReadRevDev(char *PICname); /*********************************************************************** * Get the ID field of the structure specify by uiFrom with the ucValue. * The field is 8 bytes long, so just the byte specified by ucIndex is * modified. * * @param u_char *ucValue IN Value of the ID to get at ucIndex pos * @param u_char ucIndex IN Index of the ID to get * @param u_int uiFrom IN Flag (PIC or File) * @return Status_t Always ALL_RIGHT **********************************************************************/ Status_t DLL_EXPORT GetIDValue(unsigned char *ucValue, unsigned char ucIndex, \ unsigned int uiFrom); /*********************************************************************** * Fill the ID field of the structure specify by uiFrom with the ucValue. * The field is 8 bytes long, so just the byte specified by ucIndex is * modified. * * @param u_char ucValue IN Value of the ID to set at ucIndex pos * @param u_char ucIndex IN Index of the ID to set * @param u_int uiFrom IN Flag (PIC or File) * @return Status_t Always ALL_RIGHT **********************************************************************/ Status_t DLL_EXPORT SetIDValue(unsigned char ucValue, unsigned char ucIndex, \ unsigned int uiFrom); /*********************************************************************** * Extract the checksum info from every line of an INTEL HEX file. * Compare it with the value computed by the HEX parser. * * @param u_short *usChecksum IN Reference to the checksum computed * @param u_int uiFrom IN Flag (PIC or File) * @return Status_t Always ALL_RIGHT **********************************************************************/ Status_t DLL_EXPORT ComputeGeneralChecksum(unsigned short *usChecksum, unsigned int uiFrom); /*********************************************************************** * Check the presence of a programmer on LPT port. * Hardware present if DATA_FROM_PIC == DATA_TO_PIC[0 or 1] * * @param void * @return Status_t ALL_RIGHT if hardware present * HARDWARE_ERROR if not present **********************************************************************/ Status_t DLL_EXPORT IsHWPresent(void); /*********************************************************************** * Stuck at 0 all of the signals (logical 0, not necessarily physical 0). * * @param void * @return Status_t Always ALL_RIGHT **********************************************************************/ Status_t DLL_EXPORT InitHardware(void); /*********************************************************************** * Stuck at 1 the VCC signal (logical 1, not necessarily physical 1). * * @param void * @return Status_t Always ALL_RIGHT **********************************************************************/ Status_t DLL_EXPORT PowerOn(void); /*********************************************************************** * Stuck at 0 the VCC signal (logical 0, not necessarily physical 0). * * @param void * @return Status_t Always ALL_RIGHT **********************************************************************/ Status_t DLL_EXPORT PowerOff(void); /*********************************************************************** * About window of the DLL. * Catch the HWND handle of the application. * * @param HWND hWnd IN Handle of the main window * @return Status_t Always ALL_RIGHT **********************************************************************/ Status_t DLL_EXPORT ShowDLL(HWND hWnd); /*********************************************************************** * Show Settings window. * * @param HWND hWnd IN Handle of the main window * @return Status_t Always ALL_RIGHT **********************************************************************/ Status_t DLL_EXPORT ShowSettings(HWND hWnd); /*********************************************************************** * Display the "Config" window of the DLL. * * @param HWND hWnd IN Handle of the main window * @return Status_t Always ALL_RIGHT **********************************************************************/ Status_t DLL_EXPORT ShowConfig(HWND hWnd, unsigned int uiFrom); /*********************************************************************** * Erase all the programmable bits of the PIC18. * * @param HWND hWnd IN Handle of the main window * @return Status_t Always ALL_RIGHT **********************************************************************/ Status_t DLL_EXPORT DoBulkErase(HWND hWnd); #if defined(__cplusplus) } #endif #endif /* __DLL_INTERFACE_H__ */ /* End of File */