nios ii常用函数整理(Nios II commonly used function arrangement).doc

上传人:scccc 文档编号:11227748 上传时间:2021-07-15 格式:DOC 页数:25 大小:24.56KB
返回 下载 相关 举报
nios ii常用函数整理(Nios II commonly used function arrangement).doc_第1页
第1页 / 共25页
nios ii常用函数整理(Nios II commonly used function arrangement).doc_第2页
第2页 / 共25页
nios ii常用函数整理(Nios II commonly used function arrangement).doc_第3页
第3页 / 共25页
nios ii常用函数整理(Nios II commonly used function arrangement).doc_第4页
第4页 / 共25页
nios ii常用函数整理(Nios II commonly used function arrangement).doc_第5页
第5页 / 共25页
点击查看更多>>
资源描述

《nios ii常用函数整理(Nios II commonly used function arrangement).doc》由会员分享,可在线阅读,更多相关《nios ii常用函数整理(Nios II commonly used function arrangement).doc(25页珍藏版)》请在三一文库上搜索。

1、nios ii常用函数整理(Nios II commonly used function arrangement)NIOS II commonly used function arrangement2009-10-28 09:49:02|: Nios II | subscription name classificationIO operation functionPrototype of function: IORD (BASE, REGNUM)Input parameters: BASE base address register, REGNUM offset registerFuncti

2、on Description: from the base address for the BASE device reads the REGNUM offset register unit inside value. The register value within the scope of the address bus.Return value: -Prototype of function: IOWR (BASE, REGNUM, DATA)Input parameters: BASE base address register, REGNUM offset register, DA

3、TA data to be writtenFunction Description: to offset write data in the REGNUM register. The register value within the scope of the address bus.Return value: -Prototype of function: IORD_32DIRECT (BASE, OFFSET)Input parameters: BASE base address register, the register offset for OFFSETFunction Descri

4、ption: from the address position is directly read 32Bit BASE+OFFSET data in the registerReturn value: -Prototype of function: IORD_16DIRECT (BASE, OFFSET)Input parameters: BASE base address register, the register offset for OFFSETFunction Description: from the address position is directly read 16Bit

5、 BASE+OFFSET data in the registerReturn value: -Prototype of function: IORD_8DIRECT (BASE, OFFSET)Input parameters: BASE base address register, the register offset for OFFSETFunction Description: from the address position is directly read 8Bit BASE+OFFSET data in the registerReturn value: -The funct

6、ion prototype: IOWR_32DIRECT (BASE, OFFSET, DATA)Input parameters: BASE base address register, REGNUM offset register, DATA data to be writtenFunction Description: to address location directly into the 32Bit BASE+OFFSET register dataReturn value: -The function prototype: IOWR_16DIRECT (BASE, OFFSET,

7、 DATA)Input parameters: BASE base address register, REGNUM offset register, DATA data to be writtenFunction Description: to address location directly into the 16Bit BASE+OFFSET register dataReturn value: -The function prototype: IOWR_8DIRECT (BASE, OFFSET, DATA)Input parameters: BASE base address re

8、gister, REGNUM offset register, DATA data to be writtenFunction Description: to address location directly into the 8Bit BASE+OFFSET register dataReturn value: -Dma:The function prototype: int alt_dma_rxchan_close (alt_dma_rxchan rxchan)Input parameter: rxchan is the receive channelFunction: function

9、 (alt_dma_rxchan_close) notification system: application has been completed DMAThe receiving channel rxchan, the current implementation is successfulReturns: 0, and 1The function prototype: alt_dma_rxchan_depth (alt_dma_rxchan DMA)Input parameter: DMAFunction: function alt_dma_rxchan_depth () return

10、s the maximum number of transmitted to the special DMA (depth) of the received requestReturn value: the maximum number of DMAThe function prototype: int alt_dma_rxchan_ioctl (alt_dma_rxchan DMA, int req, void* ARG)Input parameters: DMA direct memory, req lists the requested operation, Arg decided by

11、 the requestFunction Description: received through the DMA channel to perform equipment specific I/O operationReturns: request specific value, otherwise return is negativeRequest typeRequest type request specificationTransmission of ALT_DMA_SET_MODE_8 data in 8Bit Arg ignoreTransmission of ALT_DMA_S

12、ET_MODE_16 data in 16Bit Arg ignoreTransmission of ALT_DMA_SET_MODE_32 data in 32Bit Arg ignoreTransmission of ALT_DMA_SET_MODE_64 data in 64Bit Arg ignoreTransmission of ALT_DMA_SET_MODE_128 data in 128Bit Arg ignoreALT_DMA_TX_ONLY_ON (1) under the control of software can only sendALT_DMA_TX_ONLY_O

13、FF (1) custom mode, under the control of software can receive, sendALT_DMA_RX_ONLY_ON (1) under the control of software can only receiveALT_DMA_RX_ONLY_OFF (1) custom mode, under the control of software can receive, sendThe function prototype: alt_dma_rxchan alt_dma_rxchan_open (const char* name)Inp

14、ut parameters: name constant character pointer, such as /dev/dma_0Function Description: get a alt_dma_rxchan descriptor for the DMA receiving channelReturns: 0, and returns to 0The function prototype: int alt_dma_rxchan_prepare (alt_dma_rxchan DMA, void* data,Alt_u32 length, alt_rxchan_done * done,

15、void* handle)Input parameters: DMA use channel; data receive data position pointer; length maximum receive data length; done once data is received, call the return function; handle, non transparent value to doneFunction Description: Send a request to the DMA receiver receiving channel,Returns: 0, wh

16、ereas the return is negativeThe function prototype: int alt_dma_rxchan_reg (alt_dma_rxchan_dev * DEV)Input parameter: dev receive channel device nameFunction Description: system to register DMA receiving channelReturns: 0, whereas the return is negativeThe function prototype: int alt_dma_txchan_clos

17、e (alt_dma_txchan txchan)Input parameter: txchan transmit channel nameFunction Description: notification system: application has been completed DMA transmission channel txchanReturns: 0, whereas the return is negativeThe function prototype: int alt_dma_txchan_ioctl (alt_dma_txchan DMA, int req, void

18、* ARG)Input parameters: DMA direct memory name; req for enumeration of request operations; additional parameters of Arg request determined by requestFunction Description: DMA sent through the channel to implement equipment specific I/O operationReturns: request specific value, otherwise return is ne

19、gativeThe function prototype: alt_dma_txchan alt_dma_txchan_open (const char* name)Input parameters: name constant character pointer, such as /dev/dma_0Function Description: get a alt_dma_rxchan descriptor for DMA transmission channelReturns: 0, and returns to 0The function prototype: int alt_dma_tx

20、chan_reg (alt_dma_txchan_dev* DEV)Input parameter: dev receive channel device nameFunction Description: system to register DMA transmission channelReturns: 0, whereas the return is negativeThe function prototype: int alt_dma_txchan_send (alt_dma_txchan DMA, const void* from,Alt_u32 length, alt_txcha

21、n_done* done, void* handle)Input parameters: DMA use channel; data receive data position pointer; length maximum receive data length; done once data is received, call the return function; handle, non transparent value to doneFunction Description: Send a send request to DMA transmission channel,Retur

22、n value: Send a successful return 0, otherwise return is negativeThe function prototype: NT alt_dma_txchan_space (alt_dma_txchan DMA)Input parameter: DMA direct memory nameFunction Description: return is send to the specific DMA transmission channel request numberReturn value: returns the number of

23、send requestsFlashInt length)Input parameters: src_addr source address; FD, flash; offset offset length byte length;Function Description: write the data to the flsah, to write the data in the source address in src_addrReturn value: successfully returned 0, and vice versa for 0The function prototype:

24、 int alt_write_flash_block (alt_flash_fd* FD, int block_offset, int data_offset,Const void *data, int length)Input parameters: FD; data_offset start write offset data; length to write data lengthFunction Description: write to a flash module has been erasedReturn value: successfully returned 0, and v

25、ice versa for 0Function prototype: int close (int filedes)Input parameter: filedes, descriptorFunction Description: UNIX function close standard (), close the file descriptor filedesReturns: 0, and 1The function prototype: int open (const char* pathname, int flags, mode_t mode)Input parameters: path

26、name, path name; flags, O_RDONLY or O_WRONLY or O_RDWR, corresponding to read only, write only, or read write operations; mode, use license specificationFunction Description: open a file or device and return a file descriptor (non negative integer used in reading and writing)Returns: file descriptor

27、, and return - 1The function prototype: int read (int file, void *ptr, size_t len)Input parameter: file file descriptor; PTR is read data position pointer, len read data length, unit is byteFunction Description: read data from the file or device.Returns: the number of bytes read, and return - 1The f

28、unction prototype: clock_t times (struct TMS *buf)Input parameter: buf struct pointerFunction Description: compatible with newlib, struct TMS as follows:Type structclock_t tms_utime;Clock_t tms_stime;Clock_t tms_cutime;Clock_t tms_sutime;Tms_utime:CPU for user instruction execution timeThe tms_stime

29、:CPU request process represented by the system of execution timeTms_cutime: all the sub processes tms_utime and tms_cutime times.Tms_sutime: all the sub processes tms_stime and tms_sutime times.The return value is the number of clock, no clock returns 0Function prototype: int usleep (int US)Input pa

30、rameter: US, unit is microsecondFunction Description: until us microseconds after the lifting of obstruction, its function is equivalent to us microsecond delayReturns: 0, whereas for 1, there is an error that causes the errorFunction prototype: int wait (int *status)Input parameter: status process

31、status pointerFunction Description: the function is to wait for all child processes to exit. Because the HAL does not support the decentralized child process, the function returns immediatelyReturn value: status content is 0, indicating no child process; return value is - 1, and errno is set to ECHI

32、LD, indicating no child process waitingThe function prototype: int write (int file, const void *ptr, size_t len)Input parameter: file file descriptor; PTR is read data position pointer, len read data length, unit is byteFunction Description: to write the file or device data block,Return value: the n

33、umber of bytes written back, may also be less than the length of the request; otherwise returns 1, if the error occurs, errno is set to the causeThe standard type of dataType descriptionAlt_8 symbol 8 bit integerAlt_u8 unsigned 8 bit integerAlt_16 symbol 16 bit integerAlt_u16 unsigned 16 bit integer

34、Alt_32 symbol 32 bit integerAlt_u32 unsigned 32 bit integerThe following for their own finishingThe function prototype: int fopen (char * file_name, way_use);Input parameter: file_name file name, way_use using file mode, such as R, w correspond to read and writeFunction Description: open the file, a

35、 file on itReturn value: not open then the error, returns a null pointer NULLPrototype of function: int Fclose (FP)Input parameter: FP is defined as: FILE *fpFunction Description: close file FpReturns: 0, and 1 (EOF)The function prototype: int FREAD (void *ptr, int size, int count, FILE * FP);Input

36、parameter: buffer is pointer; read data address; size read byte number; count read byte number; FP file pointerFunction Description: read data from a streamReturn value: the successful return value is countThe function prototype: int fwrite (void *ptr, int size, int count, FILE *fp)Input parameter:

37、buffer is pointer; read data address; size read byte number; count read byte number; FP file pointer,Function Description: write content to streamReturn value: the successful return value is countThe function prototype: int fprintf (FILE *fp, char *format, argument,.);Input parameters: FP file point

38、er; format format string; argument, the output list, such as.:Fprintf (FP, %d,%f, I, t)Function Description: transmitting the formatted output to a streamReturn value: -The function prototype: int fscanf (FILE * FP, char *format, argument.)Input parameters: FP file pointer; format format string; , a

39、rgument,. input list, such as:Fscanf (FP, %d,%f, I, t)Function Description: the implementation of the formatted input from a streamReturn value: -Function prototype: int fputc (int ch, FILE *fp)Input parameters: ch characters; FP: file pointerFunction Description: Send a character to a streamReturns

40、: character and return - 1 (EOF)Function prototype: int fgetc (FILE *fp);Input parameter: FP: file pointerFunction Description: read characters from the streamReturn value: encounter end of file return - 1 (EOF)Function prototype: int putw (int w, FILE *fp)Input parameters: w: character or word; FP:

41、 file pointerFunction Description: a character or word to streamReturn value: -Function prototype: int getw (FILE *fp)Input parameter: FP: file pointerFunction Description: take an integer from the streamReturn value: -Function prototype: int rewind (FILE *fp)Input parameter: FP: file pointerFunctio

42、n Description: the file pointer to pointer to a stream at the beginningReturn value: -The function prototype: int fseek (FILE *fp, long offset, int fromwhere);Input parameters: FP: file pointer; offset:long type offset; fromwhere: the starting pointThe starting point for the 0, 1, 2 respectively rep

43、resent the beginning of file, the current location, at the end of the fileFunction Description: relocation stream file pointerReturn value: -Function prototype: int ferror (FILE *fp)Input parameter: FP: file pointerFunction Description: detecting errors on the streamReturn value: no return value is

44、0, otherwise 0Function prototype: long fTell (FILE *fp)Input parameter: FP: file pointerFunction Description: returns the current file pointer, get the current positionReturns: the return value is 1 to indicate an error, otherwise 0Function prototype: void clearerr (FILE *fp)Input parameter: FP: fil

45、e pointerFunction Description: reset error flagReturn value: error is not 0, and vice versa is 0The function prototype: char *fgets (char *string, int n, FILE *fp)Input parameters: String: FP: string pointer; file pointerFunction Description: read a string from the stream, but only enter n - 1 chara

46、cters from the file, and the last is the 0 end flagReturn value: -The function prototype: NT fputs (char *string, FILE *fp)Input parameters: String: FP: string pointer; file pointerFunction Description: Send a string to a streamReturn value: -Function prototype: int feof (FILE *fp)Input parameter: FP: file pointerFunction Description: end of file detection on the flow characterReturn value: -Nios II IDE Command Line ToolsTool DescriptorCreate a new database system engineering nios2-create-system-libraryCreate a C/C+ application librar

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 社会民生


经营许可证编号:宁ICP备18001539号-1