NetSilicon & Digi Confidential

Slides:



Advertisements
Similar presentations
Homework Reading Machine Projects Labs
Advertisements

IO Interfaces and Bus Standards. Interface circuits Consists of the cktry required to connect an i/o device to a computer. On one side we have data bus.
Categories of I/O Devices
Device Drivers. Linux Device Drivers Linux supports three types of hardware device: character, block and network –character devices: R/W without buffering.
USERSPACE I/O Reporter: R 張凱富.
File and I/O system calls int open(const char* path, int flags, mode_t modes) int creat(const char *path, mode_t mode) ssize_t read(int fd, void *buf,
CSE 333 – SECTION 8 Networking and sockets. Overview Network Sockets IP addresses and IP address structures in C/C++ DNS – Resolving DNS names Demos.
Tutorial 8 Socket Programming
Client Server Model The client machine (or the client process) makes the request for some resource or service, and the server machine (the server process)
1-1 NET+OS Software Group Serial EEPROM API Supported Serial EEPROM parts Serial EEPROM API introduction Detailed Serial EEPROM API Function presentation.
POSIX: Files Introduction to Operating Systems: Discussion 1 Read Solaris System Interface Guide: Ch. 5.1 Basic File I/O.
2011 Embedded Systems Software Training Center BluRapport SDK.
Real-time Systems Lab, Computer Science and Engineering, ASU Linux Input Systems (ESP – Fall 2014) Computer Science & Engineering Department Arizona State.
GPIO interface From programmer’s view
Interrupts and DMA CSCI The Role of the Operating System in Performing I/O Two main jobs of a computer are: –Processing –Performing I/O manage and.
LWIP TCP/IP Stack 김백규.
ACE Address Configuration Executive. Why ACE? ACE provides access to several address resolution protocols under a single API ACE is the only API available.
Contact Information Office: 225 Neville Hall Office Hours: Monday and Wednesday 12:00-1:00 and by appointment.
1-1 Embedded Network Interface (ENI) API Concepts Shared RAM vs. FIFO modes ENI API’s.
CP104 Introduction to Programming File I/O Lecture 33 __ 1 File Input/Output Text file and binary files File Input/output File input / output functions.
1-1 NET+OS Software Group Flash API Multiple flash memory bank support New Flash API introduction Detailed Flash API Function presentation Supporting.
Ethernet Driver Changes for NET+OS V5.1. Design Changes Resides in bsp\devices\ethernet directory. Source code broken into more C files. Native driver.
The Socket Interface Chapter 22. Introduction This chapter reviews one example of an Application Program Interface (API) which is the interface between.
Network Programming Eddie Aronovich mail:
Interrupts, Buses Chapter 6.2.5, Introduction to Interrupts Interrupts are a mechanism by which other modules (e.g. I/O) may interrupt normal.
UNIX Files File organization and a few primitives.
Telnet Server API Setting up the Server Callback Functions Setting Server and Client Options Other Telnet API Functions.
© 2004, D. J. Foreman 1 Computer Organization. © 2004, D. J. Foreman 2 Basic Architecture Review  Von Neumann ■ Distinct single-ALU & single-Control.
LAB 12: Timer and Interrupt Chung-Ta King National Tsing Hua University CS 4101 Introduction to Embedded Systems.
CS 158A1 1.4 Implementing Network Software Phenomenal success of the Internet: – Computer # connected doubled every year since 1981, now approaching 200.
FTP Server API Implementing the FTP Server Registering FTP Command Callbacks Data and Control Port Close Callbacks Other Server Calls.
Socket Programming Lab 1 1CS Computer Networks.
PLUS 내부 세미나 1/22 The Libnet Library 이병영 2004/05/06.
FTP Client API FTP in embedded devices Implementing an FTP Client FTP Command APIs Other FTP Client APIs.
DMA Driver APIs DMA State Diagram Loading Driver and Opening Channel DMA Channel Attributes Loading Data to a Channel Unloading Data from a Channel.
Introduction Contain two or more CPU share common memory and peripherals. Provide greater system throughput. Multiple processor executing simultaneous.
LonWorks Introduction Hwayoung Chae.
 Backlight 에서 나온 백색광이 액정 셀을 통과하면 서 투과율이 조절되고 red, green, blue 의 color filter 를 투과해 나오는 빛의 혼합을 통해 색이 구 성됨  Color filter 는 셀사이의 빛을 차단하는 black matrix,
Linux Sound Drivers Framework
1 Socket Interface. 2 Basic Sockets API Review Socket Library TCPUDP IP EthernetPPP ARP DHCP, Mail, WWW, TELNET, FTP... Network cardCom Layer 4 / Transport.
Files in UNIX u UNIX deals with two different classes of files:  Special Files  Regular Files u Regular files are just ordinary data files on disk -
 The LPC2xxx devices currently have two on- chip UARTS.  Except UART1 has additional modem support.
Input/Output (I/O) Important OS function – control I/O
Lecture 2 Interrupts.
Interrupts and signals
CS501 Advanced Computer Architecture
Microprocessor Systems Design I
I2C communication* I²C - Inter-Integrated Circuit – or –I squared C)
UQC113S2 – Embedded Systems
90-30 DeviceNet configuration
8259-programmable interrupt controller
CS 286 Computer Organization and Architecture
Homework Reading Machine Projects Labs
I2C Synchronous Serial Two wire communications (plus ground)
Presentation On 8259 Made by Md Shabbir Hasan.
Programmable Interrupt Controller 8259
Socket Programming in C
8259 Chip The Intel 8259 is a family of Programmable Interrupt Controllers (PIC) designed and developed for use with the Intel 8085 and Intel 8086 microprocessors.
Zephyr Device Driver and Device Model
The Hardware Interface
Parallel communication interface 8255
I2C and RTC Chapter 18 Sepehr Naimi
I/O Systems I/O Hardware Application I/O Interface
NetSilicon & Digi Confidential
8259 Programmable Interrupt Controller
Transmitter Interrupts
Another Physical Layer – I2C
CNET 315 Microprocessor & Assembly Language
Computer System Overview
Serial Communication 19th Han Seung Uk.
Presentation transcript:

NetSilicon & Digi Confidential NET+OS 6.1 Training 11/15/2018 NetSilicon & Digi Confidential

NetSilicon & Digi Confidential 11/15/2018 NetSilicon & Digi Confidential

NetSilicon & Digi Confidential I2C device topics Introduction I2C APIs I2C examples 11/15/2018 NetSilicon & Digi Confidential

NetSilicon & Digi Confidential I2C device basic Simple 4-wire device. Multiple I2C devices can be connected to the same I2C bus. We support two types (all) I2C devices – I2C Master and I2C Slave. 11/15/2018 NetSilicon & Digi Confidential

NetSilicon & Digi Confidential Performance We support 100Kbits/sec or 400Kbits/sec. Support 7 & 10 bit addressing Dedicated I/O. No change to the gpio.h 11/15/2018 NetSilicon & Digi Confidential

NetSilicon & Digi Confidential IC2 Master Interface 11/15/2018 NetSilicon & Digi Confidential

NetSilicon & Digi Confidential I2C Slave 11/15/2018 NetSilicon & Digi Confidential

NetSilicon & Digi Confidential 7bit addressing format Slave Address Data(8Bit) RW A S 1. Received of slave side 2. Transmitted of slave side 1 P S = Start A = ACK P = STOP / Repeat Start From master to slave From slave to master 11/15/2018 NetSilicon & Digi Confidential

NetSilicon & Digi Confidential 10bit addressing format Address Upper Address Lower RW A Data(8Bit) S 1. Received of slave side 2. Transmitted of slave side 1 P S = Start A = ACK P = STOP / Repeat Start From master to slave From slave to master 11/15/2018 NetSilicon & Digi Confidential

NetSilicon & Digi Confidential Device Open() Calls i2c_dev_open() Example i2cPort = open("/i2c/0",I2C_SLAVE); or i2cPort = open("/i2c/0",I2C_MASTER); I2C device channel: /i2c/0 I2C device mode: I2C_MASTER, or I2C_SLAVE. 11/15/2018 NetSilicon & Digi Confidential

NetSilicon & Digi Confidential Device close() Calls i2c_dev_close() Closes the I2C channel. Example: ret = close(fd); 11/15/2018 NetSilicon & Digi Confidential

NetSilicon & Digi Confidential Device Read() Calls i2c_dev_read(). int i2c_dev_read(int channel, void * i2cMsg, int notUsed, int * notUsed1); Note: i2cMsg is pointer to the i2cMsg type. The i2cMeg will be returned by a read callback function in an ISR. DO NOT access it before it is returned. 11/15/2018 NetSilicon & Digi Confidential

NetSilicon & Digi Confidential Device Write() Calls i2c_dev_write(). int i2c_dev_write(int channel, void * i2cMsg, int notUsed, int * notUsed1) The i2cMsg will be returned by a write callback function in an ISR context. DO NOT access the message before it is returned. 11/15/2018 NetSilicon & Digi Confidential

NetSilicon & Digi Confidential Device Ioctl() Calls i2c_dev_ioctl() Important flags: I2C_SET_READ_CALLBACK_FUNC I2C_SET_WRITE_CALLBACK_FUNC I2C_SET_CLOCK_SPEED I2C_SET_GCA_IRQ_ENABLE I2C_FLUSH_BUFFER 11/15/2018 NetSilicon & Digi Confidential

NetSilicon & Digi Confidential Other APIs void MCI2cBuildMsg(MC_I2C_MESSAGE_TYPE* i2cMsg, char* buf, unsigned long bufLength, unsigned char addr); 11/15/2018 NetSilicon & Digi Confidential

NetSilicon & Digi Confidential I2C Specific…. I2C driver is interrupt driven and the I2C interrupt is part of the BBUS interrupt. After we install the I2C interrupt function, on receiving every data byte and I2C commannd, we will receive an interrupt generated by the I2C IP. The MCI2cInterrupt() function will then be called by the ISR handler. Based on the state of the current I2C bus and whether the Mercury is acting as an I2C Master or Slave, the appropriate function will be called. Please refer to the I2C Master or Slave State machine for ISR handling details. A semaphore is used to keep multiple I2C port from opening at the same time. A Event flag is created in the application example; but it is up to the application to decide whether to use it or not. The same applies to the Event flag in the nausbdevapp example as well. 11/15/2018 NetSilicon & Digi Confidential

NetSilicon & Digi Confidential Example Typical User application A typical open function call is fd = open(“i2c/0”, I2C_MASTER); Or fd = open(“i2c/0”, I2C_SLAVE); A typical close function call is Ret = close(fd); 11/15/2018 NetSilicon & Digi Confidential

NetSilicon & Digi Confidential Read() Example Typical usage: The third parameter is ignored. Ret=Read(fd, i2cMsg, 0x0); If (ret == -1) printf(“ read failed.\n”); 11/15/2018 NetSilicon & Digi Confidential

NetSilicon & Digi Confidential Write() example Typical usage: The third parameter is ignored. Ret=write(fd, i2cMsg, 0x0); If (ret == -1) printf(“ write failed.\n”); 11/15/2018 NetSilicon & Digi Confidential

NetSilicon & Digi Confidential I2C message defination typedef struct _MESSAGE_TYPE { char * buffer; unsigned short address; unsigned long bufLength; /* size of the buffer */ unsigned long availableDataLen; MC_I2C_BUFFER_STATE state; } MC_I2C_MESSAGE_TYPE; 11/15/2018 NetSilicon & Digi Confidential

Typical write Callback function void writeCallBackFunc(MC_I2C_MESSAGE_TYPE * ptrData) { if (ptrData->state != I2C_INIT) tx_event_flags_set(&i2cEvent,I2C_WRITE_EVENT_FLAG, TX_OR); /* free(ptrData); */ } return; 11/15/2018 NetSilicon & Digi Confidential

Typical read callback function void readCallBackFunc(MC_I2C_MESSAGE_TYPE * ptrData) { if (ptrData->state != I2C_INIT) tx_event_flags_set(&i2cEvent,I2C_READ_EVENT_FLAG, TX_OR); /* free(ptrData); */ } return; 11/15/2018 NetSilicon & Digi Confidential

NetSilicon & Digi Confidential Example application MCI2cBuildMsg(i2cMsg, ptrTemp, 26, 0x60); ret = write(i2cPort, i2cMsg, 0); MCInstallIsr (I2C_INTERRUPT, (MC_ISR_HANDLER) MCI2cInterrupt, (void *) 0, 0); while( 1 /* mySleepCount < 6 */) { ret = tx_event_flags_get(&i2cEvent, I2C_WRITE_EVENT_FLAG|I2C_READ_EVENT_FLAG, TX_OR_CLEAR, &actualEvent, TX_WAIT_FOREVER); …… 11/15/2018 NetSilicon & Digi Confidential

NetSilicon & Digi Confidential Important files Driver: Src/bsp/devices/i2c/* Example: Src/examples/nai2capp/itc_test.c 11/15/2018 NetSilicon & Digi Confidential