📄 hostif_high.c
字号:
/************************************************** * * hostif_high.c * * CVS ID: $Id: hostif_high.c,v 1.143 2007/11/15 13:21:29 belardi Exp $ * Author: Raffaele Belardi [RB] - STM * Date: $Date: 2007/11/15 13:21:29 $ * Revision: $Revision: 1.143 $ * * Description: * * Implement the Link Layer and Transport Layer of the * Communication protocol * Does not include the lower level I2C driver. * *************************************************** * * COPYRIGHT (C) ST Microelectronics 2005 * All Rights Reserved * *************************************************** * * STM CVS Log: * * $Log: hostif_high.c,v $ * Revision 1.143 2007/11/15 13:21:29 belardi * New request/message ReqCurrentPlaylistAbsContent * * Revision 1.142 2007/11/08 17:37:05 sedmik * based on setting IPOD_PASSTHROUGH and IPOD_AP different cmd/status channles are used * * Revision 1.141 2007/11/06 10:35:36 belardi * Add ID3 version information in MSB of LanguageId of MsgTextInfo * * Revision 1.140 2007/10/22 12:26:43 belardi * Check CmdWriteCfgTable parameters for sanity * Cap CmdRead/WriteTable length to fit in single I2C frame * * Revision 1.139 2007/10/19 12:25:39 belardi * - Fix to send NAStateError in response to ReqDirectoryInfo if device not prepared * - Fix to not send ID3 tags from previous song when current one is not available yet * * Revision 1.138 2007/10/12 13:15:18 marcucci * Add protection against interrupt modification of hostif_inevent variable. * This variable should be always modified in a Task by means of the set_hostif_inevent() * and the reset_hostif_inevent() procedures * * Revision 1.137 2007/09/27 13:52:44 sedmik * fixed precondition of req_time_info * * Revision 1.136 2007/09/21 11:48:09 belardi * Fix problem with playlist index range in CmdChangeDir * * Revision 1.135 2007/09/17 14:02:07 sedmik * fixed REQ_CURRENT_PLAYLIST_CONTENT - report only in case of playlist enabled * * Revision 1.134 2007/09/07 15:19:21 belardi * changed specification of MsgDiscId * * Revision 1.133 2007/08/31 09:56:38 sedmik * fixed report_msg_device_file_type - pass through all nodes (including last one) * * Revision 1.132 2007/08/21 09:41:42 belardi * Removed redundant legth check in FormatTextMsg * Changed MsgDirContent to variable size * Removed useless code (comments) * * Revision 1.131 2007/08/20 12:15:10 belardi * Added check on legal directory number in ReqDirContent * * Revision 1.130 2007/08/14 15:27:31 dellorto * multiple mechanisms * * Revision 1.129 2007/08/10 12:33:28 longauer * IPOD_AP compilation switch enables future iAP * * Revision 1.128 2007/08/09 09:00:16 marcucci * REQ_MISSING_ITEMS and REQ_MECHANICAL_MEASUREMETS * commands added * * Revision 1.127 2007/08/02 14:41:44 sedmik * special files adressing feature(for host update) - added param in ReqEntryName * * Revision 1.126 2007/08/02 13:35:50 sedmik * added commands ReqDirContent, ReqUSBdeviceInfo processing + new messages implementations * * Revision 1.125 2007/08/01 13:00:09 trubac * report_msg_rom_media_content() - additional check for files within directory * * Revision 1.124 2007/08/01 10:29:20 trubac * Optimization for speed in report_msg_rom_media_content() * * Revision 1.123 2007/07/31 11:59:17 belardi * Removed compiler warning * * Revision 1.122 2007/07/25 15:14:51 belardi * Added the channels field for WMA in CAFileInfo * * Revision 1.121 2007/07/25 13:51:36 trubac * Start TOC command used for trigering new mount of USB and SDC, * CD volume deleted when not active device, but only if AutoMode&0x80 * * Revision 1.120 2007/07/24 14:19:33 belardi * ReqCAFileInfo returns 'm4a' for files of type AAC instead of 'aac' * * Revision 1.119 2007/07/24 09:25:26 belardi * Added check in CmdPowerOff to verify from configuration object if the Flash is present before storing the LastPositionMemory * * Revision 1.118 2007/07/18 13:12:17 sedmik * fix for long entry name with extension off, USB serial nr. retval * * Revision 1.117 2007/07/16 10:00:58 trubac * USB HIGH-Z control roughly tested * * Revision 1.116 2007/07/10 14:02:45 longauer * usb events renaming * * Revision 1.115 2007/07/09 16:47:54 sedmik * added report_msg_CA_file_info * * Revision 1.114 2007/07/05 07:58:41 belardi * Modifications to support ID3 selection * * Revision 1.113 2007/07/04 10:05:13 belardi * First implementation of new interface to retrieve USB serial number * Not completely debugged due to possible problem in USB driver * * Revision 1.112 2007/07/03 14:55:28 belardi * New type value in ReqEntryName to get filename with index relative to playlist * * Revision 1.111 2007/06/29 13:17:32 belardi * Added support for Track Number in ID3 v1.1 and v2.x * * Revision 1.110 2007/06/29 09:50:25 marcucci * Added the frame for REQ_USB_HIGH_Z commnad to put in High Impedance the D+/D-Lines * * Revision 1.109 2007/06/28 20:53:51 longauer * 1.Usb restructuralization in order to supports more LUNs and interface preparation * for iAP; 2.PHY emulation moved; 3.compilation works with IPOD_PASSTHROUGH==0; 4. * usb patching init moved from main.c * * Revision 1.108 2007/06/04 16:58:45 longauer * USBtask rearrangement in order to support more logical units; new file usb_pri.h added with USBtask private declarations; USB compilation switches added; constants renaming; * * Revision 1.107 2007/05/02 12:52:49 belardi * Fixex wrong MsgLoaderMode parameters for ROMMediaContent [JS] * * Revision 1.106 2007/04/18 10:26:40 belardi * More robust processing of the MsgTextInfo to avoid not sending message in case of empty string * * Revision 1.105 2007/04/11 14:19:30 belardi * Integration of HAVE_CD_MECHA modification by [GP] * * Revision 1.104 2007/03/16 16:14:42 belardi * Changed filename extension for AAC/M4A to .m4a (more common) * * Revision 1.103 2007/03/13 14:12:26 sedmik * fixed MsgInsertMode (IPOD ready break missing); added condition for playback commands (CDDA param check on USB/SDC) * * Revision 1.102 2007/03/09 13:17:08 belardi * Fix in MsgTimeInfo (wrong value for PAR10) * * Revision 1.101 2007/03/05 15:11:51 belardi * Addition to CIS: * - new parameter in MsgPlayerMode indicating current source * - new values for PAR11 of MsgTimeInfo to indicate the type of file (CDDA, MP3, WMA, AAC) * - new command/message ReqLongEntryName to transmit the filename in multi-packet format * * Revision 1.100 2007/02/26 19:06:17 belardi * Added filename extension in MsgEntryName (run-time configurable) * * Revision 1.99 2007/02/23 11:38:47 sedmik * changes in msg_insert_mode, process_cmd_search_bw fixed param = 3 (FB from EOF) * * Revision 1.98 2007/02/21 20:18:13 longauer * usb states and error reorganization; usb state is propagated to player task = usb * state messaging * * Revision 1.97 2007/02/19 13:50:33 belardi * Fixed bug: * -wrong song number in MsgTextInfo * * Revision 1.96 2007/02/16 15:34:40 sedmik * fix for ipod upstream messaging (was sending error message after msg transmitted) * * Revision 1.95 2007/02/15 16:07:46 sedmik * Binary transfer - support of resume info via I2C * * Revision 1.94 2007/02/13 11:03:18 sedmik * Binary transmission rearrangement * * Revision 1.93 2007/02/09 12:06:41 belardi * First integration of iPod pass-through: * - downstream passthrough ok, upstream not optimizing use of the hostif buffer * - broken host update protocol * * Revision 1.92 2007/02/08 15:59:31 trubac * XAR_NextFile has one more parameter (Optimization of song indexing) * * Revision 1.91 2007/02/02 16:17:07 belardi * Code rearrangement to remove compiler warning * * Revision 1.90 2007/01/24 16:49:35 trubac * filesys function used to retrieve X_array strings * * Revision 1.89 2007/01/18 15:02:30 trubac * strange memcpy replaced by loop copying * * Revision 1.88 2006/12/18 17:54:20 sedmik * fix in CmdPowerOff - store_resume info (invalid time check) * * Revision 1.87 2006/12/18 16:28:23 belardi * Variable initialization to remove compiler warning * * Revision 1.86 2006/12/14 17:27:57 belardi * Changes in HAVE_HOST_UPDATE_NEW * * Revision 1.85 2006/12/13 14:28:23 trubac * Fixed changing directories with respect of playable contents * * Revision 1.84 2006/12/13 13:54:11 sedmik * fixed req_total_time - last CDDA file was not accessible * msgtimeinfo - minutes format reverted to fix in 1.82 * * Revision 1.83 2006/12/13 09:31:50 belardi * Fixed MsgTimeInfo (added DirNo, removed frame number, rearranged parameter order to comply with CIS 0.09) * * Revision 1.82 2006/12/12 10:53:57 sedmik * changes in file update functionality, fix in cmd power off * * Revision 1.81 2006/12/05 17:51:21 belardi * Added 'type of song' parameter to MsgTimeInfo (not yet in official CIS, but requested) * * Revision 1.80 2006/12/04 14:44:49 dellorto * added emergency eject command * * Revision 1.79 2006/11/30 11:05:53 belardi * Changed host_update_file_index to uint16 to comply with XAR_SafeIndex() * * Revision 1.78 2006/11/28 14:10:31 belardi * Added inlcude file * * Revision 1.77 2006/11/28 13:50:57 belardi * Added check for host update protocol * * Revision 1.76 2006/11/27 19:50:02 belardi * Host Update protocol addition * - new functions * * Revision 1.75 2006/11/25 08:54:22 belardi * Coditional compilatio for HAVE_TEMP_SENSOR * * Revision 1.74 2006/11/24 15:41:23 sedmik * cmdSourceChange - commmand sent always to player (more secure) * * Revision 1.73 2006/11/24 11:26:27 zhong * Karbin for Temperature sensor detect * * Revision 1.72 2006/11/22 17:22:32 sedmik * improved REQ_STATE, REQ_DISC_INFO * * Revision 1.71 2006/11/22 15:57:03 sedmik * report_msg_rom_media_content - fix for more partitions on same media reporting * * Revision 1.70 2006/11/21 13:59:11 dellorto * improved hostif reporting of servo parameters in case of restart * * Revision 1.69 2006/11/20 13:25:32 sedmik * improved navigation for playlists, * fix in REQ_TOTAL_TIME, REQ_DEVICE_FILE_TYPE, * added MSG_ENTRY_NAME playlist param, REQ_AVAILABLE_PLAYLIST_FILES, REQ_DISC_INFO * * Revision 1.68 2006/11/17 16:38:57 dellorto * added PVD address in read TOC message * added auto text messages * added configurable text item length * * Revision 1.67 2006/11/16 15:57:00 belardi * Added the product string in ASCII for quick version check on .hex releases * * Revision 1.66 2006/11/16 15:10:08 belardi * added check for validity of current_song_info in MsgTotalTime * * Revision 1.65 2006/11/16 13:12:27 trubac * CountFilesForDevice changed parameter t_SearchMode * * Revision 1.64 2006/11/15 14:18:45 dellorto * added messages for read TOC * * Revision 1.63 2006/11/14 15:40:44 belardi * estetics * * Revision 1.62 2006/11/14 15:06:59 belardi * Implementation of MsgTotalTime * * Revision 1.61 2006/11/13 18:03:03 belardi * - bug fix in MsgDisclabel (was using wrong string length calculation) * - bug fix in MsgDeviceInfo (was building the message but not sending it) * - add CD type check in MsgTrackInfo * - ported MsgProductVersion to CIS0.09 format * * Revision 1.60 2006/11/10 16:29:21 dellorto * added support for servo parameters sending * * Revision 1.59 2006/11/09 16:23:00 belardi * Removed unused function * * Revision 1.58 2006/11/07 18:58:33 sedmik * added funcs for playlists messaging, time information (relative file nr fix) * * Revision 1.57 2006/11/07 16:32:06 belardi * Bug fix in ROMMediaContent * * Revision 1.56 2006/11/07 10:53:56 belardi * Bug fixes in ROMMediaContent * * Revision 1.55 2006/11/01 15:46:43 trubac * CountFilesForVolume/CountFilesForDevice now allows counting of playlists * * Revision 1.54 2006/10/31 08:51:47 belardi * Removed unused variables to eliminate warnings * * Revision 1.53 2006/10/27 15:10:53 sedmik * improved report_msg_entry_name - possible to address any file/dir from current device * * Revision 1.52 2006/10/20 15:41:10 belardi * Support for long multi-packet transmission (or scheduled tx) * * Revision 1.51 2006/10/18 12:38:43 belardi * Removed USE_STM_HOSTIF * * Revision 1.50 2006/10/17 10:04:58 trubac * Different song info strings access using offset * * Revision 1.49 2006/10/11 16:11:53 belardi * Removed unused code in preparation of HostIF redesign to support long messages * * Revision 1.48 2006/10/05 07:33:06 trubac * Implementing TOC info at the end of string pool * * Revision 1.47 2006/09/27 19:51:40 belardi * Removed (global) unused variables * * Revision 1.46 2006/09/26 13:16:59 belardi * Removed compilation warnings * * Revision 1.45 2006/09/26 09:33:34 belardi * Removed 'extern definitions, moved to player.h * * Revision 1.44 2006/09/19 10:26:27 belardi * - Removed unused variables * - Fixed used-before set 'lenght' variable * * Revision 1.43 2006/09/18 09:31:36 belardi * white-space * * Revision 1.42 2006/09/15 19:54:20 belardi * Merged the m8_cav2_cm80506_cs3563. * - removed xtoc from XItem, created temporary XTOC variable * * ***************************************************/#include <string.h>#include "configuration.h"#include "gendef.h"#include "osal.h"#include "hwreg.h" #include "plyinc.h"#include "srvinc.h"#include "plr_conf.h"#include "i2c.h"#include "player.h"#include "hostif_high.h"#include "hostif_low.h"#if (1==HAVE_CDTEXT) #include "text.h"#endif#include "controller.h" //JS added (for next/prev from USB)#if (0!=HAVE_USB)#include "usb.h"#endif /*HAVE_USB*/#include "xfile.h" // for ID3 tags#include "mconfig.h"#include "cddevice.h"#include "player.h"#if ((1 == HAVE_HOST_UPDATE) || (1 == HAVE_HOST_UPDATE_NEW))#include "filesys.h"#endif#if (1 == HAVE_HOST_UPDATE)#include "framebuffer.h"#endif#if (1 == HAVE_TEMP_SENSOR)#include "temper.h"#endifextern uint16 ItemsThrown;extern uint16 jitter_percentage_val;extern uint16 hf_level;//#define HOSTIF_DEBUGuint8 textInfoFlags;t_bool ConfigUpdated = b_FALSE; //JS added for signalling update to player. //Initialised to update player params with 1st commandt_binary_trasnfer_mode binary_trasfer_mode = NO_TRANSFER; //JS added to select type of binary transfer #if (0!=IPOD_PASSTHROUGH)/* ipod passthrough params */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -