📄 gendef.h
字号:
/************************************************** * * gendef.h * * CVS ID: $Id: gendef.h,v 1.69 2007/10/18 10:47:42 longauer Exp $ * Author: Raffaele Belardi [RB] - STM * Date: $Date: 2007/10/18 10:47:42 $ * Revision: $Revision: 1.69 $ * * Description: * * System-wide definitions for Accordo+. * *************************************************** * * COPYRIGHT (C) ST Microelectronics 2005 * All Rights Reserved * ******************************************************************************* * \brief General defines and errors * * \par Change History: * * - BB060926b Improved error reporting * ******************************************************************************* * * STM CVS Log: * * $Log: gendef.h,v $ * Revision 1.69 2007/10/18 10:47:42 longauer * handle authentication and automatically switches to the extended mode * * Revision 1.68 2007/09/20 21:35:52 longauer * virtual iPod authentication is working * * Revision 1.67 2007/09/03 13:25:19 longauer * Ipod Rx Archive; files affected: ACP.h, iAP.*, player.c, gendef.h * * Revision 1.66 2007/08/14 15:28:13 dellorto * multiple mechanisms * * Revision 1.65 2007/08/10 12:33:29 longauer * IPOD_AP compilation switch enables future iAP * * Revision 1.64 2007/07/23 08:18:07 trubac * Host update file is configurable through module config * * Revision 1.63 2007/07/12 16:47:34 longauer * init/close usb controller cmd/status path partly implemented * * Revision 1.62 2007/07/12 12:23:26 trubac * Host update file is configurable through module config * * Revision 1.61 2007/07/09 11:10:35 longauer * preparation for forced closing * of the usb controller, preparation for iAP, total medium size info, * usb device serial number string length corrected, cleaning * * Revision 1.60 2007/06/28 20:53:52 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.59 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.58 2007/04/06 06:35:18 hara * Add TOC_REQUEST_WAIT_FOR_TIME for more robust TOC reading. * * Revision 1.57 2007/02/26 13:32:14 trubac * SDC defines not conditional to ease compilation problems when no SDC * * Revision 1.56 2007/02/23 11:39:42 sedmik * added states for SDC (following strategy of USB states) * * Revision 1.55 2007/02/21 20:18:14 longauer * usb states and error reorganization; usb state is propagated to player task = usb * state messaging * * Revision 1.54 2007/02/21 09:15:43 chlapik * new CTR - CAP interface: ESP history removed from CTR * * Revision 1.52 2007/02/09 12:07:23 belardi * First integration of iPod pass-through: * - better organization of USB error codes * * Revision 1.51 2006/12/19 17:02:33 dellorto * improved loader error reporting * * Revision 1.50 2006/10/20 15:08:36 longauer * VAT works; + code reorganization * * Revision 1.49 2006/10/17 14:23:07 chlapik * new CTR status error TWO_BUF_IN_PAR_ERROR * * Revision 1.48 2006/10/17 10:06:09 trubac * new error codes definitions * * Revision 1.47 2006/10/10 12:14:57 belardi * Merge of m8_cav2_cm80507 * - changed all error return values * - moved the FS error codes to here (commented out) * * Revision 1.46 2006/09/18 13:18:51 chlapik * if ESP memory is empty and there is read request from CTR, instead of sending no event back, send read error * * Revision 1.45 2006/09/15 19:55:27 belardi * Merged the m8_cav2_cm80506_cs3563. * - temporary definition of device_id * * ***************************************************/#ifndef __GENDEF_H#define __GENDEF_H#include "rccu_run.h" // for RUN_MODE and frequencies#include "configuration.h"#include "accordoptypes.h"#include "i2cdef.h"#include "uartdef.h"#ifdef APM_PICKUP //[OK] attempt to make orded with t_did / duid#include "cisdef.h"/* MR: temporary type definition, to be removed. *///typedef uint32 t_XItem;/* MR: temporary type definition, defined multiple times in code, which one is correct?** - typedef char DUID (in apdevsys.h)** - typedef enum {} t_duid (in apdevsys.h)** In both cases the CD device ID is defined as 0x01 instead of 0x02.*/typedef enum{ DEV_ID_CD = CIS_DEV_ID_CD, DEV_ID_SDC = CIS_DEV_ID_SDC, DEV_ID_USB = CIS_DEV_ID_USB, DEV_ID_DEFAULT = CIS_DEVICE_ID_DEFAULT_VALUE,} t_did;/* Just for now: a conversion between t_did and t_duid. */#include "apdevsys.h" /* For definition of t_duid. */__inline t_did duid_to_did(t_duid duid){ switch(duid) { default: return DEV_ID_DEFAULT; case DEV_CD_ID: return DEV_ID_CD; case DEV_USB_ID: return DEV_ID_USB; case DEV_SDC_ID: return DEV_ID_SDC; }}__inline t_duid did_to_duid(t_did did){ switch(did) { default: return DEV_NO_DEVICE; case DEV_ID_CD: return DEV_CD_ID; case DEV_ID_USB: return DEV_USB_ID; case DEV_ID_SDC: return DEV_SDC_ID; }}#endif/* TODO temporary SERVICE WORKAROUNDS */#define _SVC_NO_LOADER 0#ifdef APM_PICKUP#if (M8_SAMPLE_VER >= M8VER_A) /* motor driver */ #define __DRV_PORT PDA #define __DRV_CTL1 10 #define __DRV_CTL2 11 #define __DRV_CTL3 12 /* loader speed */ #define __LSPEED_PORT PDA #define __LSPEED 9 /* home switch */ #define __HOMESW_PORT PDB #define __HOMESW 11 /* loader switch */ #define __SW_STOP_PORT PDA #define __SW_EJECT_PORT PDA #define __SW_INSERT_PORT PDA #define __SW_STOP 4 #define __SW_EJECT 3 #define __SW_INSERT 2 #define __OIF_SELECT_PORT PDA #define __OIF_SELECT_I2S 0#else /* motor driver */ #define __DRV_PORT PDA #define __DRV_CTL1 0 #define __DRV_CTL2 1 #define __DRV_CTL3 2 /* loader speed */ #define __LSPEED_PORT PDB #define __LSPEED 8 /* home switch */ #define __HOMESW_PORT PDA #define __HOMESW 8 /* loader switch */ #define __SW_STOP_PORT PDB #define __SW_EJECT_PORT PDA #define __SW_INSERT_PORT PDA #define __SW_STOP 7 #define __SW_EJECT 3 #define __SW_INSERT 4#endif#ifdef __OIF_SELECT_PORT #define OIF_SELECT_SPDIF() do{__OIF_SELECT_PORT &= ~ (1<<__OIF_SELECT_I2S);}while(0) #define OIF_SELECT_I2S() do{__OIF_SELECT_PORT |= (1<<__OIF_SELECT_I2S);}while(0)#else #define OIF_SELECT_SPDIF() do{}while(0) #define OIF_SELECT_I2S() do{}while(0)#endif#else /* (not) APM_PICKUP */ /* home switch */ #define __HOMESW_PORT PDA #define __HOMESW 8#endif /* APM_PICKUP */#ifdef APM_PICKUP/*****************//* Helper macros *//*****************//* motor driver macros */#define CTL1_ON (1 << __DRV_CTL1)#define CTL2_ON (1 << __DRV_CTL2)#define CTL3_ON (1 << __DRV_CTL3)#define CTL1_OFF (~CTL1_ON)#define CTL2_OFF (~CTL2_ON)#define CTL3_OFF (~CTL3_ON)#define DRIVER_LOADER_IS_ON (__DRV_PORT & CTL3_ON)#define DRIVER_OFF __DRV_PORT = (__DRV_PORT & CTL1_OFF & CTL2_OFF & CTL3_OFF)#define DRIVER_SERVO_IS_ON (__DRV_PORT & CTL2_ON)/* BB050228a - BEGIN */#define DRIVER_UNUSED __DRV_PORT = ((__DRV_PORT & CTL2_OFF & CTL3_OFF)| CTL1_ON)#define ACT_AND_TT_ON_SCBM __DRV_PORT = ((__DRV_PORT & CTL3_OFF) | CTL1_ON | CTL2_ON)#define ACT_AND_TT_ON_RRBM __DRV_PORT = ((__DRV_PORT & CTL1_OFF & CTL3_OFF) | CTL2_ON)#define LOADER_ON_1 __DRV_PORT = ((__DRV_PORT & CTL1_OFF & CTL2_OFF) | CTL3_ON)#define LOADER_ON_INSERT __DRV_PORT = ((__DRV_PORT & CTL1_OFF) | CTL2_ON | CTL3_ON)#define LOADER_ON_EJECT __DRV_PORT = ((__DRV_PORT & CTL2_OFF) | CTL1_ON | CTL3_ON)#define LOADER_ON_BRAKE __DRV_PORT = (__DRV_PORT | CTL1_ON | CTL2_ON | CTL3_ON)/* BB050228a - END*/#define DRIVER_ON ACT_AND_TT_ON_SCBM#define LOADER_SET_SPEED_HIGH() do { __LSPEED_PORT |= (1 << __LSPEED); } while (0)#define LOADER_SET_SPEED_LOW() do { __LSPEED_PORT &= ~(1 << __LSPEED); } while (0)#else /* (not) APM_PICKUP */#define DRIVER_ON (PDA |= 0x0001)#define DRIVER_OFF (PDA &= 0x01FE)#endif /* APM_PICKUP *//**********************************//* State handling defines *//**********************************/#define STATE_1 1#define STATE_2 2#define STATE_3 3#define STATE_4 4#define STATE_5 5#define STATE_6 6#define STATE_7 7#define STATE_8 8#define STATE_9 9#define STATE_10 10#define STATE_11 11#define STATE_12 12#define LEVEL_0 0x00#define LEVEL_1 0x01/**********************************//* RETVAL Interface return values *//**********************************/#define NO_ERROR_REASON (RETVAL) 0x00#define BUSY (RETVAL) 0x00#define READY (RETVAL) 0x01#define OK READY
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -