⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sci.h

📁 56f8300E系列dsp的BOOTloader
💻 H
📖 第 1 页 / 共 3 页
字号:
*
*           - user application :
*
*             handle_t SciFD; 
*
*             SciFD = sciOpen(BSP_DEVICE_NAME_SCI_0, O_NONBLOCK | O_SCI_8_DATA_BITS_NO_PARITY, 115200); 
*     
*          open SCI0 for 7 bit data, even parity, and 9600:
*
*           - user application :
*
*             handle_t SciFD; 
*
*             SciFD = sciOpen(BSP_DEVICE_NAME_SCI_0, O_SCI_7_DATA_BITS_EVEN_PARITY, 9600L); 
*     
*
*   sciIoctl
*
*      UWord16 sciIoctl( handle_t hndl, void * pParams ); 
*
*         Semantics:
*            The SCI driver supports many commands which are
*            described below.
*
*         Parameters:
*            FileDesc    - SCI Device descriptor returned by "sciOpen" call.
*            Cmd         - Command for driver 
*            pParams     - The pParams is specific to each sciIoctl command;
*                          Refer to the ioctl table below to see the ioctl
*                          command and associated type of parameter.
*            pName       - the SCI device name from bsp.h;  typically,
*                          BSP_DEVICE_NAME_SCI_0
*                          BSP_DEVICE_NAME_SCI_1
*
*            The parameter pParams is specific to each sciIoctl command.
*            If pParams is not used then NULL should be passed into function.
*
*         Return Value: 
*            Specific to Command
*
*         Commands:
*
*               SCI_DEVICE_RESET             This command disables SCI driver, clears 
*                                            the Fifo Buffers and then enables the
*                                            SCI driver.  See SCI_DEVICE_ON and
*                                            SCI_DEVICE_OFF.
*                                            pParams: NULL
*                                            Return:  None
*
*               SCI_DEVICE_OFF               This command disables all SCI interrupts
*               SCI_DEVICE_DISABLE           and clears any pending receiver interrupt.
*                                            pParams: NULL
*                                            Return:  None
*
*               SCI_DEVICE_ON                This command clears the transmit and receive
*               SCI_DEVICE_ENABLE            buffers and re-enables the SCI Receiver
*                                            interrupt.
*                                            pParams: NULL
*                                            Return:  None
*
*               SCI_CALLBACK_RX              This command installs the Read Completed Callback
*                                            function. 
*                                            pParams: void (*sciDataCallback)(void)  
*                                            If pParams is equal to NULL, no callback is used.
*                                            Return:  None
*
*               SCI_CALLBACK_TX              This command installs the Write Completed Callback
*                                            function. 
*                                            pParams: void (*sciDataCallback)(void)  
*                                            If pParams is equal to NULL, no callback is used.
*                                            Return:  None
*  
*               SCI_CALLBACK_EXCEPTION       This command installs the Exception Callback function. 
*                                            pParams: void (*sciErrorCallback)(UWord16 Exception)  
*                                            If pParams is equal to NULL, no callback is used.  
*                                            See SCI_EXCEPTION_* #define's below for valid exception
*                                            values. 
*                                            Return:  None 
*
*               SCI_SET_RX_WATERMARK         This command sets the number of bytes that must be
*                                            received prior to calling the Read Completed Callback
*                                            function.
*                                            pParams: UWord16 length, 
*                                            0 < length <= SCI_BYTE_BUFFER_LENGTH 
*                                            Return:  None
*
*               SCI_GET_STATUS               This command gets the status of the SCI driver.
*                                            pParams: NULL 
*                                            Return:  UWord16 Status bit field that indicates 
*                                            write in progress or exception occured. 
*                                            See SCI_STATUS_* and SCI_EXCEPTION_* #define's below 
*                                            for valid status values. 
*
*               SCI_CMD_SEND_BREAK           This command sends a break symbol via SCI.
*                                            pParams: NULL 
*                                            Return:  None
*
*               SCI_CMD_WAIT                 This command puts the SCI device in wait state.
*                                            SCI Interrupts, transceiver and receiver are 
*                                            not disabled.
*                                            pParams: NULL 
*                                            Return:  None
*
*               SCI_CMD_WAKEUP               This command wakes up the device from wait mode.
*                                            pParams: NULL 
*                                            Return:  None
*
*               SCI_SET_HIBIT                This command sets the SCI HiBit to one
*                                            pParams: NULL 
*                                            Return:  None
*
*               SCI_CLEAR_HIBIT              This command clears the SCI HiBit to zero
*                                            pParams: NULL 
*                                            Return:  None
*
*               SCI_READ                     This command waits until data has been received 
*                                            and reads data registry
*                                            pParams: Pointer to user variable (driver uses as a * char)
*                                            Return:  None
*
*               SCI_WRITE                    This command waits until previous data has been transmitted 
*                                            and writes byte to data registry
*                                            pParams: Pointer to user variable (driver uses as a * char)
*                                            Return:  None
*
*      Example:
*
*         // Reset SCI0
*         sciIoctl(SciFd, SCI_DEVICE_RESET, NULL); 
*
*
*   sciWrite
*
*      ssize_t sciWrite(handle_t hndl, const void * pBuffer, size_t NBytes);
*
*      Semantics:
*         The sciWrite function writes user buffer out of SCI device.  Note that
*         the driver treats "pBuffer" as a pointer to a character buffer.
*
*         In Blocking mode, "sciWrite" waits while all required data is transferred.
*
*         In NonBlocking mode, "sciWrite" starts the transfer operation and returns
*         control to the application. It does not wait while all data is
*         transferred via SCI.
*
*         The sciWrite function also enables the transmitter interrupt in
*         order to get the transmitter started.
*
*
*      Parameters:
*         hndl        - SCI Device descriptor returned by "sciOpen" call.
*         pBuffer     - Pointer to user buffer (driver uses as a * char). 
*         NBytes      - NBytes (in 8-bit bytes) of the data to be written
*                       out of SCI device; 
*
*      Return Value: 
*         - Actual size (in 8-bit bytes) of the data written
*
*      Example:
*
*         unsigned char Buffer[10];
*
*         // Write to SCI
*         sciWrite(SciFd, Buffer, sizeof(Buffer)); 
*
*
*   sciRead
*
*      ssize_t sciRead(handle_t hndl, void * pBuffer, size_t NBytes);
*
*      Semantics:
*         The sciRead function reads data from SCI device and stores
*         it in the user's read buffer.  Note that the driver treats
*         "pBuffer" as a pointer to a character buffer.
*
*         In Blocking mode, "sciRead" waits until all data has been
*         received.
*
*         In NonBlocking mode, "sciRead" returns the actual data that
*         has already been received from the SCI device.
*
*      Parameters:
*         hndl        - SCI Device descriptor returned by "sciOpen" call.
*         pBuffer     - Pointer to user buffer. (driver uses as a * char).
*         NBytes      - NBytes (in 8-bit bytes) of the data to be read 
*                       from SCI device; 
*
*      Return Value: 
*         - Actual size (in bytes) of the data read
*
*      Example:
*
*         unsigned char Buffer[10];
*
*         // Read from SCI
*         sciRead(SciFd, Buffer, sizeof(Buffer)); 
*
*
*   sciClose
*
*      int sciClose(handle_t hndl);  
*
*      Semantics:
*         The sciClose function closes the SCI device by disabling
*         all SCI interrupts.
*
*      Parameters:
*         hndl - SCI Device descriptor returned by "sciOpen" call.
*
*      Return Value: 
*         Zero
*
*      Example:
*
*         // Close SCI device
*         sciClose(SciFD); 
*
* 
* IO Layer Interface to the SCI Driver
*
*   General Description:
*
*      A SCI device is configured by the following:
*  
*  		  1)  The device is created and initialized by selecting it by defining
*             both the INCLUDE_SCI variable and the INCLUDE_IO variable in the 
*             appconfig.h file associated with the SDK Embedded Project created 
*             in CodeWarrior. 
*
*         2)  An "open" call is made to initialize the SCI device
*
*         3)  "ioctl" calls are made to control the SCI device
*
*         4)  "write" calls are made to write data out of the SCI device.
* 
*         5)  "read" calls are made to read data from the SCI device.
*
*         6)  After all SCI operations are completed, the SCI device
*             is closed via a "close" call.
*
* 
*    OPEN
*
*       handle_t open(const char *pName, int OFlags, long BaudRate);
*
*          Semantics:
*             The open function opens the SCI peripheral for operations. 
*             The SCI device is always opened for read and for write calls.
*             The open function establishes the handle for the SCI
*             driver.  It initializes the internal memory buffers used by
*             the SCI driver.  It configures the driver for Blocking or
*             NonBlocking modes, as defined in the OFlags parameter.  
*             Finally, it enables the SCI Receiver interrupts.  It does not
*             enable the SCI transmitter interrupts as this is done when
*             the "sciWrite" function is called.
*             Default mode for open, as defined in config.h and config.c, is the
*             following:
*
*                Default Baud Rate = 9600bps                ???????????
*                Default Data Mode = 8-bit with no parity
*                Default Data Polarity = Not Inverted
*                Default HiBit = 0
*                Default Loopback = Not Enabled
*
*             Argument pName identifies the particular SCI device name. See bsp.h
*             for a list of device names for this chip.  Typically, the SCI device
*             names include:
*                      BSP_DEVICE_NAME_SCI_0
*                      BSP_DEVICE_NAME_SCI_1
*                      ...
*
*          Parameters:
*             pName    - device name.  (See bsp.h for a list of SCI device names.)
*
*             OFlags   - open mode flags;  default is O_RDWR, Blocking.   
*                        O_RDONLY                               - ignored
*                        O_WRONLY                               - ignored
*                        O_RDWR                                 - default

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -