Introduction

This document describes the important points to which attention should be paid by the clients when they design their applications. As SIM800W and SIM800V can be integrated into a wide range of applications, the application notes are described in great detail.

This document can help user to quickly understand SIM800 interface, specifications, electrical and mechanical details. With the help of this document and other SIM800 application notes, users can use SIM800 module to design and set-up mobile applications quickly.

Purpose

Based on ARM7EJ_S core, SIM800W and SIM800V run at 104 MHz, and has redundant MIPS to run programs other than telecommunication protocols. Embedded AT is fully utilizing Sim800W resources, providing interfaces to move some external MCU functions into itself, so as to save customer's cost. The programming idea of Embedded AT is to think from MCU side and to be consistent with the MCU programming style.

Glossary

Glossary | Description
Embedded Application API | Software interfaces developed by SIMCom and open to licensed embedded application developers.
Embedded Application | User created application that utilizes Embedded API functions to interact with SIMCom core software, only to run on a SIMCom product
SIMCom Core System | The Core system released by SIMCom, which includes the core binary file and SIMCom library
EVENT | Capitalized EVENT notion used in this document represents specified system EVENT in embedded application.

Abbreviations

Abbreviation | Description
API | Application Programming Interface
CPU | Central Processing Unit
OS | Operating System
PDU | Protocol Data Unit
RAM | Random-Access Memory
ROM | Read-Only Memory
RTK | Real-Time Kernel
SMS | Short Message Services
SDK | Software Development Kit


Description

Table of Contents

  • Software Architecture
    • Software Organization
    • Resource supplied by SIMCom
    • SIM800W or SIM800V:
    • SIM800H(32M) or SIM800(32M):
    • Pin name description
    • Software Supplied by SIMCom
  • Minimum Embedded Application Code
  • app_main()
  • Embedded AT Memory resources

Software Architecture

Software Organization

The software architecture of the Embedded AT facility is shown below:

Information flow

When the module passes messages from the core system to the embedded application, the eat_get_event function catches EVENT and then alters the embedded application with categorized EVENT type. This approach allows the embedded application to channel different incoming data appropriately.

When the module sends messages to the core system, developer simply invokes API functions tailored for the appropriate purposes, and the rest is taken care of by the API functions, until the feedback message is received by the application through eat_get_event.

Message flows in this cyclical fashion, isolating the developer's application from accessing core variables and stacks. Through this design, Embedded AT masks and protects the core image from developer's application, allows abstract and safe access to the core system.

Resource supplied by SIMCom

SIM800W or SIM800V:

  • 2.5M bytes ROM,Code+Data
  • 2M bytes RAM
  • 30 GPIOs, 6 GPIO INT
  • 16 timers
  • 1 SPI / Display interface
  • 1 PWM
  • 3 UART
  • 1 ADC
  • 2 Bakclight
  • 6*6 Keypad
  • System API

SIM800H(32M) or SIM800(32M):

  • 1.5M bytes ROM,Code+Data
  • 500K bytes RAM
  • 29 GPIOs, 5 GPIO INT
  • 16 timers
  • 1 SPI / Display interface
  • 1 PWM
  • 2 UART
  • 1 USB
  • 1 ADC
  • 2 Bakclight
  • 5*5 Keypad
  • System API

Pin name description

Some pins are multiplex, only one function mode can be enabled at a time.
Each UART port can be used as an AT port, a debug port or a data port.

SIM800W PIN name:

SIM800V PIN name:

SIM800H PIN name:

SIM800 PIN name:

Software Supplied by SIMCom

  • One set of header files (.h) which define the Embedded API functions
  • Source code samples
  • SIMCom core software
  • Image downloading tools

Minimum Embedded Application Code

void app_main(void *data)
{
EatEvent_st event;
while(1)
{
eat_get_event(&event); /* Retrieve EVENT from CORE */
switch(event.event)
{
...
}
}
}

app_main is the main entrance function for embedded application, see next section for details.

eat_get_event is a system interface that receives EVENT from core software.

app_main()

app_main() is the entrance function of embedded application, it works almost as main() in standard C application. Embedded application quits upon exiting app_main().

Embedded AT Memory resources

The Embedded software runs within real time kernel task: application developers must work with pre-defined size, which is 50K bytes, of the customer's application calling stack. Please note that the total size of local variables which user defines cannot exceed 50K bytes.

SIMCom Core Software and Embedded Application manage their own RAM areas. Access from one of these programs to another's RAM area is prohibited and will cause fatal error.

Global variables, call stack and dynamic memory are all part of the RAM allocated to the Embedded Application.


Modules
Here is a list of all modules:
[detail level 12]
o AUDIO
| o AUDIO Type
| \ AUDIO Functions
o FLASH
| \ FLASH Function
o FILESYSTEM
| o FS Function
| o FS Error Type
| \ FS Type
o MEMORY
| \ MEMORY Function
o MODEM
| o Modem Type
| \ Modem Function
o PERIPHERY
| o Periphery Type
| \ Periphery Function
o SOCKET
| o SOCKET Type
| \ SOCKET Function
o SYSTEM
| o SYSTEM Type
| \ SYSTEM Function
o TIMER
| o TIMER Type
| \ TIMER Function
\ UART
  o UART Type
  \ UART Function


AUDIO

Modules
AUDIO

Modules

AUDIO Type
AUDIO Functions

Detailed Description

This module offers the AUDIO operation API and type defination.

Author
ChenHaibing haibi.nosp@m.ng.c.nosp@m.hen@s.nosp@m.im.c.nosp@m.om
Date
2012/09/24
   Copyright (C) 2002-2012 Shanghai SIMCom Wireless Solutions Ltd.

   All rights reserved.


AUDIO Type
AUDIO

Data Structures

struct | EatAudioToneData_st
struct | EatAudioToneTable_st

Macros

#define | EAT_AUDIO_VOL_MAX_LEVEL 15
#define | EAT_AUDIO_TONE_MAX 20

Enumerations

enum EatAudioToneId_enum {
EAT_TONE_DTMF_0,
EAT_TONE_DTMF_1,
EAT_TONE_DTMF_2,
EAT_TONE_DTMF_3,
EAT_TONE_DTMF_4,
EAT_TONE_DTMF_5,
EAT_TONE_DTMF_6,
EAT_TONE_DTMF_7,
EAT_TONE_DTMF_8,
EAT_TONE_DTMF_9,
EAT_TONE_KEY_STAR,
EAT_TONE_KEY_HASH,
EAT_TONE_KEY_NORMAL,
EAT_TONE_DTMF_A,
EAT_TONE_DTMF_B,
EAT_TONE_DTMF_C,
EAT_TONE_DTMF_D,
EAT_TONE_CUSTOM_DTMF,
EAT_TONE_KEY_CLICK,
EAT_TONE_CALL_CONNECT,
EAT_TONE_MT_SMS_IN_CALL,
EAT_TONE_CALL_TIME_REMINDER,
EAT_TONE_DIAL_CALL_GSM,
EAT_TONE_DIAL_CALL_PCS,
EAT_TONE_BUSY_CALL_GSM,
EAT_TONE_BUSY_CALL_PCS,
EAT_TONE_CONGESTION_GSM,
EAT_TONE_CONGESTION_PCS,
EAT_TONE_RADIO_PATH,
EAT_TONE_RADIO_NA,
EAT_TONE_ERROR_INFO,
EAT_TONE_NUM_UNOBTAIN,
EAT_TONE_AUTH_ERROR,
EAT_TONE_CALL_WAITING,
EAT_TONE_RINGING_CALL_GSM,
EAT_TONE_RINGING_CALL_PCS,
EAT_TONE_POSITIVE_ACK,
EAT_TONE_NEGATIVE_ACK,
EAT_TONE_DIAL_CALL_GSM_STK,
EAT_TONE_DIAL_CALL_PCS_STK,
EAT_TONE_BUSY_CALL_GSM_STK,
EAT_TONE_BUSY_CALL_PCS_STK,
EAT_TONE_CONGESTION_GSM_STK,
EAT_TONE_CONGESTION_PCS_STK,
EAT_TONE_RADIO_PATH_STK,
EAT_TONE_RADIO_NA_STK,
EAT_TONE_ERROR_INFO_STK,
EAT_TONE_NUM_UNOBTAIN_STK,
EAT_TONE_AUTH_ERROR_STK,
EAT_TONE_CALL_WAITING_STK,
EAT_TONE_RINGING_CALL_GSM_STK,
EAT_TONE_RINGING_CALL_PCS_STK,
EAT_TONE_POSITIVE_ACK_STK,
EAT_TONE_NEGATIVE_ACK_STK,
EAT_TONE_WARNING1,
EAT_TONE_WARNING2,
EAT_TONE_ERROR1,
EAT_TONE_ERROR2,
EAT_TONE_GENERAL_BEEP,
EAT_TONE_BATTERY_LOW,
EAT_TONE_BATTERY_WARNING,
EAT_TONE_AUX_IND,
EAT_TONE_DATA_CALL,
EAT_MAX_TONE_ID
}
enum EatAudioStyle_enum {
EAT_AUDIO_PLAY_INFINITE,
EAT_AUDIO_PLAY_ONCE
}
enum EatAudioPath_enum {
EAT_AUDIO_PATH_SPK1,
EAT_AUDIO_PATH_SPK2
}
enum EatAudioFormat_enum {
EAT_AUDIO_FORMAT_MIDI,
EAT_AUDIO_FORMAT_WAV
}

Detailed Description

AUDIO type defination.


EatAudioToneData_st Struct Reference

Data Fields
EatAudioToneData_st Struct Reference
AUDIO Type

Data Fields

unsigned short | freq1
unsigned short | freq2
unsigned short | on_duration
unsigned short | off_duration
unsigned char | next_operation

Detailed Description

the data struct of tone id


EatAudioToneData_st::freq1

  • EatAudioToneData_st
freq1
freq2
next_operation
off_duration
on_duration
unsigned short EatAudioToneData_st::freq1


EatAudioToneData_st::freq2

  • EatAudioToneData_st
freq1
freq2
next_operation
off_duration
on_duration
unsigned short EatAudioToneData_st::freq2


EatAudioToneData_st::on_duration

  • EatAudioToneData_st
freq1
freq2
next_operation
off_duration
on_duration
unsigned short EatAudioToneData_st::on_duration


EatAudioToneData_st::off_duration

  • EatAudioToneData_st
freq1
freq2
next_operation
off_duration
on_duration
unsigned short EatAudioToneData_st::off_duration


EatAudioToneData_st::next_operation

  • EatAudioToneData_st
freq1
freq2
next_operation
off_duration
on_duration
unsigned char EatAudioToneData_st::next_operation


EatAudioToneTable_st Struct Reference

Data Fields
EatAudioToneTable_st Struct Reference
AUDIO Type

Data Fields

EatAudioToneData_st tone [EAT_AUDIO_TONE_MAX]

Detailed Description

the data struct of tone id by custom


EatAudioToneTable_st::tone

  • EatAudioToneTable_st
tone
EatAudioToneData_st EatAudioToneTable_st::tone[EAT_AUDIO_TONE_MAX]


EAT_AUDIO_VOL_MAX_LEVEL

  • AUDIO Type
EAT_AUDIO_TONE_MAX
EAT_AUDIO_VOL_MAX_LEVEL
EatAudioFormat_enum
EatAudioPath_enum
EatAudioStyle_enum
EatAudioToneId_enum
#define EAT_AUDIO_VOL_MAX_LEVEL 15

the audio max volume


EAT_AUDIO_TONE_MAX

  • AUDIO Type
EAT_AUDIO_TONE_MAX
EAT_AUDIO_VOL_MAX_LEVEL
EatAudioFormat_enum
EatAudioPath_enum
EatAudioStyle_enum
EatAudioToneId_enum
#define EAT_AUDIO_TONE_MAX 20

this value MUST NOT LARGER than 20


EatAudioToneId_enum

  • AUDIO Type
EAT_AUDIO_TONE_MAX
EAT_AUDIO_VOL_MAX_LEVEL
EatAudioFormat_enum
EatAudioPath_enum
EatAudioStyle_enum
EatAudioToneId_enum
enum EatAudioToneId_enum

This enumerate all the AUDIO tone id

Enumerator:
EAT_TONE_DTMF_0

select out path by AT+CHFA, sound data: { { 941, 1336, 0, 0, 0 } }

EAT_TONE_DTMF_1

select out path by AT+CHFA, sound data: { { 697, 1209, 0, 0, 0 } }

EAT_TONE_DTMF_2

select out path by AT+CHFA, sound data: { { 697, 1336, 0, 0, 0 } }

EAT_TONE_DTMF_3

select out path by AT+CHFA, sound data: { { 697, 1477, 0, 0, 0 } }

EAT_TONE_DTMF_4

select out path by AT+CHFA, sound data: { { 770, 1209, 0, 0, 0 } }

EAT_TONE_DTMF_5

select out path by AT+CHFA, sound data: { { 770, 1336, 0, 0, 0 } }

EAT_TONE_DTMF_6

select out path by AT+CHFA, sound data: { { 770, 1477, 0, 0, 0 } }

EAT_TONE_DTMF_7

select out path by AT+CHFA, sound data: { { 852, 1209, 0, 0, 0 } }

EAT_TONE_DTMF_8

select out path by AT+CHFA, sound data: { { 852, 1336, 0, 0, 0 } }

EAT_TONE_DTMF_9

select out path by AT+CHFA, sound data: { { 852, 1477, 0, 0, 0 } }

EAT_TONE_KEY_STAR

select out path by AT+CHFA, sound data: { { 941, 1209, 0, 0, 0 } }

EAT_TONE_KEY_HASH

select out path by AT+CHFA, sound data: { { 941, 1477, 0, 0, 0 } }

EAT_TONE_KEY_NORMAL

select out path by AT+CHFA, sound data: { { 1200, 0, 100, 0, 0 } }

EAT_TONE_DTMF_A

sound data: {{697, 1633, 0, 0, 0}}

EAT_TONE_DTMF_B

sound data: {{770, 1633, 0, 0, 0}}

EAT_TONE_DTMF_C

sound data: {{852, 1633, 0, 0, 0}}

EAT_TONE_DTMF_D

sound data: {{941, 1633, 0, 0, 0}}

EAT_TONE_CUSTOM_DTMF
EAT_TONE_KEY_CLICK

sound data: { { 1500, 0, 200, 0, 0 } }

EAT_TONE_CALL_CONNECT

sound data: { { 700, 0, 200, 0, 0 } }

EAT_TONE_MT_SMS_IN_CALL

sound data: { { 852, 1209, 200, 0, 0 } }

EAT_TONE_CALL_TIME_REMINDER

sound data: { { 852, 0, 200, 0, 0 } }

EAT_TONE_DIAL_CALL_GSM

sound data: { { 425, 0, 0, 0, 0 } }

EAT_TONE_DIAL_CALL_PCS

sound data: { { 350, 440, 0, 0, 0 } }

EAT_TONE_BUSY_CALL_GSM

sound data: { { 425, 0, 500, 500, 0 } }

EAT_TONE_BUSY_CALL_PCS

sound data: { { 480, 620, 500, 500, 0 } }

EAT_TONE_CONGESTION_GSM

sound data: { { 425, 0, 200, 200, 0 } }

EAT_TONE_CONGESTION_PCS

sound data: { { 480, 620, 200, 200, 0 } }

EAT_TONE_RADIO_PATH

sound data: { { 425, 0, 200, 0, 0 } }

EAT_TONE_RADIO_NA

sound data: { { 425, 0, 200, 200, 1 }, { 425, 0, 200, 200, 2 }, { 425, 0, 200, 0, 0 } }

EAT_TONE_ERROR_INFO

sound data: { { 950, 0, 330,1000, 0 } }

EAT_TONE_NUM_UNOBTAIN

sound data: { {1400, 0, 330, 0, 0 } }

EAT_TONE_AUTH_ERROR

sound data: { { 950, 0, 330,1000, 0 } }

EAT_TONE_CALL_WAITING

sound data: { { 425, 0, 200, 600, 1 }, { 425, 0, 200,3000, 2 }, { 425, 0, 200, 600, 3 }, { 425, 0, 200, 0, 0 } }

EAT_TONE_RINGING_CALL_GSM

sound data: { { 425, 0, 2000, 1000, 0 } }

EAT_TONE_RINGING_CALL_PCS

sound data: { { 425, 0, 2000, 4000, 0 } }

EAT_TONE_POSITIVE_ACK

sound data: { { 600, 0, 200, 100, 1 }, { 800, 0, 200, 100, 2 }, { 1000, 0, 200, 0, 0 } }

EAT_TONE_NEGATIVE_ACK

sound data: { { 600, 0, 300, 100, 1 }, { 300, 0, 700, 0, 0 } }

EAT_TONE_DIAL_CALL_GSM_STK

sound data: { { 425, 0, 0, 0, 0 } }

EAT_TONE_DIAL_CALL_PCS_STK

sound data: { { 350, 440, 0, 0, 0 } }

EAT_TONE_BUSY_CALL_GSM_STK

sound data: { { 425, 0, 500, 500, 0 } }

EAT_TONE_BUSY_CALL_PCS_STK

sound data: { { 480, 620, 500, 500, 0 } }

EAT_TONE_CONGESTION_GSM_STK

sound data: { { 425, 0, 200, 200, 0 } }

EAT_TONE_CONGESTION_PCS_STK

sound data: { { 480, 620, 200, 200, 0 } }

EAT_TONE_RADIO_PATH_STK

sound data: { { 425, 0, 200, 0, 0 } }

EAT_TONE_RADIO_NA_STK

sound data: { { 425, 0, 200, 200, 1 }, { 425, 0, 200, 200, 2 }, { 425, 0, 200, 0, 0 } }

EAT_TONE_ERROR_INFO_STK

sound data: { { 950, 0, 330,1000, 0 } }

EAT_TONE_NUM_UNOBTAIN_STK

sound data: { {1400, 0, 330, 0, 0 } }

EAT_TONE_AUTH_ERROR_STK

sound data: { { 950, 0, 330,1000, 0 } }

EAT_TONE_CALL_WAITING_STK

sound data: { { 425, 0, 200, 600, 1 }, { 425, 0, 200,3000, 2 }, { 425, 0, 200, 600, 3 }, { 425, 0, 200, 0, 0 } }

EAT_TONE_RINGING_CALL_GSM_STK

sound data: { { 425, 0, 2000, 1000, 0 } }

EAT_TONE_RINGING_CALL_PCS_STK

sound data: { { 425, 0, 2000, 4000, 0 } }

EAT_TONE_POSITIVE_ACK_STK

sound data: { { 600, 0, 200, 100, 1 }, { 800, 0, 200, 100, 2 }, { 1000, 0, 200, 0, 0 } }

EAT_TONE_NEGATIVE_ACK_STK

sound data: { { 600, 0, 300, 100, 1 }, { 300, 0, 700, 0, 0 } }

EAT_TONE_WARNING1

sound data: { { 852, 0, 200, 0, 0 } }

EAT_TONE_WARNING2

sound data: { { 852, 0, 200, 0, 0 } }

EAT_TONE_ERROR1

sound data: { { 1209, 0, 200, 0, 0 } }

EAT_TONE_ERROR2

sound data: { { 1209, 0, 200, 0, 0 } }

EAT_TONE_GENERAL_BEEP

sound data: { { 700, 0, 200, 0, 0 } }

EAT_TONE_BATTERY_LOW

sound data: { { 1100, 0, 300, 100, 1 }, { 900, 0, 300, 0, 0 } }

EAT_TONE_BATTERY_WARNING

sound data: { { 1400, 0, 300, 100, 1 }, { 1400, 0, 300, 100, 2 }, { 1400, 0, 300, 0, 0 } }

EAT_TONE_AUX_IND

sound data: { { 700, 0, 200, 0, 0 } }

EAT_TONE_DATA_CALL

sound data: { { 425, 0, 2000, 1000, 0 } }

EAT_MAX_TONE_ID


EatAudioStyle_enum

  • AUDIO Type
EAT_AUDIO_TONE_MAX
EAT_AUDIO_VOL_MAX_LEVEL
EatAudioFormat_enum
EatAudioPath_enum
EatAudioStyle_enum
EatAudioToneId_enum
enum EatAudioStyle_enum

audio play style

Enumerator:
EAT_AUDIO_PLAY_INFINITE

Play sound for infinite.

EAT_AUDIO_PLAY_ONCE

Play sound for once.


EatAudioPath_enum

  • AUDIO Type
EAT_AUDIO_TONE_MAX
EAT_AUDIO_VOL_MAX_LEVEL
EatAudioFormat_enum
EatAudioPath_enum
EatAudioStyle_enum
EatAudioToneId_enum
enum EatAudioPath_enum

audio out path

Enumerator:
EAT_AUDIO_PATH_SPK1

out from 22/23PIN SPK1P/SPK1N

EAT_AUDIO_PATH_SPK2

our from 24/25PIN SPK2P/SPK2N


EatAudioFormat_enum

  • AUDIO Type
EAT_AUDIO_TONE_MAX
EAT_AUDIO_VOL_MAX_LEVEL
EatAudioFormat_enum
EatAudioPath_enum
EatAudioStyle_enum
EatAudioToneId_enum
enum EatAudioFormat_enum

the format of audio string

Enumerator:
EAT_AUDIO_FORMAT_MIDI

sound data of midi format

EAT_AUDIO_FORMAT_WAV

sound data of wav format


AUDIO Functions

Variables
AUDIO Functions
AUDIO

Variables

eat_bool(*const | eat_audio_play_tone_id )(EatAudioToneId_enum id, EatAudioStyle_enum style, unsigned char vol, EatAudioPath_enum path)
eat_bool(*const | eat_audio_stop_tone_id )(EatAudioToneId_enum id)
eat_bool(*const | eat_audio_play_data )(const void *audio_data, unsigned int len, EatAudioFormat_enum format, EatAudioStyle_enum style, unsigned char vol, EatAudioPath_enum path)
eat_bool(*const | eat_audio_stop_data )(void)
eat_bool(*const | eat_audio_set_custom_tone )(const EatAudioToneTable_st *tone)

Detailed Description

AUDIO funtion declaration.


eat_audio_play_tone_id

  • AUDIO Functions
eat_audio_play_data
eat_audio_play_tone_id
eat_audio_set_custom_tone
eat_audio_stop_data
eat_audio_stop_tone_id
eat_bool(* const eat_audio_play_tone_id)(EatAudioToneId_enum id, EatAudioStyle_enum style, unsigned char vol, EatAudioPath_enum path)

This function is used to play key tone sound and audio tone sound.

Parameters
[in] | id | the kind of the tone.See EatAudioToneId_enum.
[in] style play only one time or alway play until stop. but whether it play once or infinitely is deceided by style and the on_duration member of the sound.
  1. the key tone (the tone id is less than EAT_TONE_KEY_CLICK)is played by aud_keytone_play, the style is useful, but the sound data's on_duration IS 0, so these key tones play infinitely.
  2. audio tone sound(the tone id id larger or equal than EAT_TONE_KEY_CLICK)is played by aud_tone_play, the style is not useful. the style is decided by sound data: the on_duaration is NOT 0 and off_duartion is 0, the sound play only once,or it will play infinitely.
[in,out] | vol | the tone volume, the rang is 0-15 (EAT_AUDIO_VOL_MAX_LEVEL)
[in] path the out device of the tone sound.
  1. EAT_AUDIO_PATH_SPK1: SPK1 at 22/23PIN SPK1P/SPK1N
  2. EAT_AUDIO_PATH_SPK2: the SPK2 at 24/25PIN SPK2P/SPK2N
Returns
EAT_TRUE: Sucess to send the msg to mod_med,otherwise EAT_FALSE.
Attention
  1. the priority of audio tone (id > EAT_TONE_KEY_CLICK ) is higher than the key tone(id <= EAT_TONE_KEY_CLICK ).
    for example:
    when it is playing key tone id1, now call the eat_audio_play_tone_id by tone id2 :
    if id1 is key tone (id1<=EAT_TONE_KEY_CLICK) and d2 is key tone (id2<=EAT_TONE_KEY_CLICK) the tone id1 will stop and play tone id2;
    if id1 is key tone (id1<=EAT_TONE_KEY_CLICK ) and id2 is audio tone(id2>EAT_TONE_KEY_CLICK), the tone id1 also will stop and play tone id2.
    if id1 is audio tone (id1>EAT_TONE_KEY_CLICK ) and id2 is key tone(id2>EAT_TONE_KEY_CLICK), the tone id1 also will keep PLAYING and NOT play tone id2 .
    if id1 is audio tone (id1>EAT_TONE_KEY_CLICK ) and id2 is audio tone(id2>EAT_TONE_KEY_CLICK), the tone id1 also will keep PLAYING and NOT play tone id2.
  2. if call eat_audio_play_tone_id by tone id1, and eat_audio_stop_tone_id by id2: only when id1 and id2 is same kind of tone(both key tone or both audio tone),the tone will stop. for example:
    if id1 is key tone (id1<=EAT_TONE_KEY_CLICK) and d2 is key tone (id2<=EAT_TONE_KEY_CLICK) the tone id1 will stop;
    if id1 is audio tone (id1>EAT_TONE_KEY_CLICK ) and id2 is audio tone(id2>EAT_TONE_KEY_CLICK), the tone id1 also will stop .
    other case: the tone will not stop.
    PLEASE keep the play id and stop id is same, or maybe the tone will not be stopped.
  3. the midi and wav sound played by eat_audio_play_data will stop the tone sound(include key tone and audio tone).
  4. Call will also stop the tone sound.
    See the Attention for eat_audio_play_data.
Header
#include "eat_audio.h"
Example
void eat_test_tone_sound(u8 on_off)
{
if( 1 == on_off )
{
//play EAT_TONE_DIAL_CALL_GSM tone sound infinitely,the volum is 12,output from SPK1.
eat_audio_play_tone_id(EAT_TONE_DIAL_CALL_GSM, EAT_AUDIO_PLAY_INFINITE, 12, EAT_AUDIO_PATH_SPK1);
}
else if( 0 == on_off)
{
//stop EAT_TONE_DIAL_CALL_GSM tone
eat_audio_stop_tone_id(EAT_TONE_DIAL_CALL_GSM);
}
}


eat_audio_stop_tone_id

  • AUDIO Functions
eat_audio_play_data
eat_audio_play_tone_id
eat_audio_set_custom_tone
eat_audio_stop_data
eat_audio_stop_tone_id
eat_bool(* const eat_audio_stop_tone_id)(EatAudioToneId_enum id)

Stops tone sound.

Parameters
[in] id the kind of the tone
Returns
EAT_TRUE: Sucess to send the msg to mod_med,otherwise EAT_FALSE.
Attention
See the Attention for eat_audio_play_tone_id,eat_audio_play_data.
Header
#include "eat_audio.h"
Example
See the example for eat_audio_play_tone_id.


eat_audio_play_data

  • AUDIO Functions
eat_audio_play_data
eat_audio_play_tone_id
eat_audio_set_custom_tone
eat_audio_stop_data
eat_audio_stop_tone_id
eat_bool(* const eat_audio_play_data)(const void *audio_data, unsigned int len, EatAudioFormat_enum format, EatAudioStyle_enum style, unsigned char vol, EatAudioPath_enum path)

Plays midi/wav sound.

Parameters
[in] | audio_data | audio data
[in] | len | the len of the audio data
[in] format the midi or wav format
only suppport the midi and wav format sound.
[in] | style | play only one time or alway play until stop.
[in] | vol | the tone volume, the rang is 0-15(EAT_AUDIO_VOL_MAX_LEVEL)
[in] path the out device of the tone sound
  1. EAT_AUDIO_PATH_SPK1: the sound out from the SPK1(22/23PIN SPK1P/SPK1N )
  2. EAT_AUDIO_PATH_SPK2: the sound out from the SPK2(24/25PIN SPK2P/SPK2N )
Returns
EAT_TRUE: Sucess to send the msg to mod_med,otherwise EAT_FALSE.
Attention
  1. During it is playing audio_string1,if call eat_audio_play_data by audio_string2, it will play the audio_string2 and stop audio_string1.
  2. At one time, only one kind audio string is playing.
  3. During call, audio sound will not be played by this function;
  4. During play audio sound, the incoming call will stop the audio sound.
    See the Attention for eat_audio_play_tone_id.
Header
#include "eat_audio.h"
Example
void eat_test_data_string_sound(u8 on_off)
{
// NOTE: the data format must match the third param of eat_audio_play_data
const unsigned char audio_test_midi_data[] =
{
0x4D,0x54,0x68,0x64,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x01,0x00,0xC0,0x4D,0x54,
0x72,0x6B,0x00,0x00,0x16,0x48,0x00,0xFF,0x58,0x04,0x04,0x02,0x18,0x08,0x00,0xFF,
0x51,0x03,0x0D,0x14,0x36,0x00,0xFF,0x59,0x02,0x00,0x00,0x00,0xFF,0x03,0x07,0x44,
......
}
if( 1 == on_off )
{
//play the midi format sound data. play infinitely, the volum is 12, output from SPK2.
eat_audio_play_data(audio_test_midi_data, sizeof(audio_test_midi_data), EAT_AUDIO_FORMAT_MIDI, EAT_AUDIO_PLAY_INFINITE, 12, EAT_AUDIO_PATH_SPK2);
}
else if( 0 == on_off)
{
//stop audio sound data
eat_audio_stop_data();
}
}


eat_audio_stop_data

  • AUDIO Functions
eat_audio_play_data
eat_audio_play_tone_id
eat_audio_set_custom_tone
eat_audio_stop_data
eat_audio_stop_tone_id
eat_bool(* const eat_audio_stop_data)(void)

Stops the audio sound.

Parameters
NONE
Returns
EAT_TRUE: Sucess to send the msg to mod_med,otherwise EAT_FALSE.
Attention
  1. it will stop the current playing audio string. at one time, only one kind audio string is playing.
    See the Attention for eat_audio_play_data.
Header
#include "eat_audio.h"
Example
See the example for eat_audio_play_data.


eat_audio_set_custom_tone

  • AUDIO Functions
eat_audio_play_data
eat_audio_play_tone_id
eat_audio_set_custom_tone
eat_audio_stop_data
eat_audio_stop_tone_id
eat_bool(* const eat_audio_set_custom_tone)(const EatAudioToneTable_st *tone)

Set custom tone.

Parameters
[in,out] tone data
Returns
if the tone is NULL, return EAT_FALSE, or EAT_TRUE.
Attention
  1. for example:
    EatAudioToneTable_st tone =
    { 300, 0, 200, 600, 1,
    2000, 0, 200, 600, 2,
    ......
    1100, 1200, 500, 10, 0
    };
    or
    EatAudioToneTable_st tone =
    {
    1100, 1200, 500, 10, 0
    };
  2. the max number of the ton sequence is EAT_AUDIO_TONE_MAX and cann't larger than 20(EAT_AUDIO_TONE_MAX).
  3. the next_operation member of EatAudioToneTable_st must be 1,2,3,4,....0; the last one is 0 .
  4. if one of the tone's off_duration is 0, the tone sound will stop at this sequence even if this next_operation is not 0
    and the later of this sequence will not be played.
  5. after call eat_audio_set_custom_tone then must call eat_audio_play_tone_id and the first param of tone id must be EAT_TONE_CUSTOM_DTMF.
    See the Attention for eat_audio_play_tone_id.
Header
#include "eat_audio.h"
Example
void eat_test_custom_tone_sound(u8 on_off)
{
if( 1 == on_off )
{
// set the custom tone
EatAudioToneTable_st tone =
{ 300, 0, 200, 600, 1,
2000, 0, 200, 600, 2,
5000, 0, 600, 600, 3,
6000, 0, 500, 11, 4,
100, 200, 500, 10, 5,
200, 300, 500, 10, 6,
300, 400, 500, 10, 7,
400, 500, 500, 10, 8,
500, 600, 500, 10, 9,
600, 700, 500, 10, 10,
700, 800, 500, 10, 11,
800, 900, 500, 10, 12,
900, 1000, 500, 10, 13,
1000,1100, 500, 10, 14,
1100,1200, 500, 10, 0
};
eat_audio_set_custom_tone(&tone);
// play EAT_TONE_CUSTOM_DTMF tone sound infinitely, the volum is 12, output from SPK1.
eat_audio_play_tone_id(EAT_TONE_CUSTOM_DTMF, EAT_AUDIO_PLAY_INFINITE, 12, EAT_AUDIO_PATH_SPK1);
}
else if( 0 == on_off)
{
// stop audio sound data
eat_audio_play_tone_id(EAT_TONE_CUSTOM_DTMF);
}
}


FLASH

Modules
FLASH

Modules

FLASH Function

Detailed Description

This module offers the FLASH operation API and type defination.

Author
LuYong yong..nosp@m.lu@s.nosp@m.im.co.nosp@m.m
Date
2012/09/24
  Copyright (C) 2002-2012 Shanghai SIMCom Wireless Solutions Ltd.

  All rights reserved.


FLASH Function

Variables
FLASH Function
FLASH

Variables

eat_bool(*const | eat_flash_erase )(const void *address, unsigned int size)
eat_bool(*const | eat_flash_write )(const void *address, const void *data, unsigned int len)
void(*const | eat_update_app )(const void *app_code_addr, const void *app_code_new_addr, unsigned int len, EatPinName_enum pin_wd, EatPinName_enum pin_led, eat_bool lcd_bl)
void(*const | eat_update_app_ok )(void)
unsigned long(*const | eat_get_app_base_addr )(void)
unsigned long(*const | eat_get_app_space )(void)

Detailed Description

FLASH funtion declaration.


eat_flash_erase

  • FLASH Function
eat_flash_erase
eat_flash_write
eat_get_app_base_addr
eat_get_app_space
eat_update_app
eat_update_app_ok
eat_bool(* const eat_flash_erase)(const void *address, unsigned int size)

This function is used to erase the flash.

Parameters
[in] | address | the start flash address of erase.
[in] | size | the size of erase
Returns
TRUE or FALSE
Header
#include "eat_flash.h"
Example
#define APP_DATA_RUN_BASE 0x8400000
#define APP_DATA_STORAGE_BASE 0x08500000
const unsigned char app_new_data[] = {app_new};//update data
void update_app_test_start(void)
{
eat_bool ret = FALSE;
unsigned char *addr;
unsigned int t_erase, t_write;
int app_datalen = sizeof(app_new_data);
addr = (unsigned char *)(APP_DATA_STORAGE_BASE);
ret = eat_flash_erase(addr, app_datalen);
if(!ret)
{
eat_trace("Erase flash failed");
return;
}
eat_trace("START: write flash[0x%08x, %dKByte]", APP_DATA_STORAGE_BASE, app_datalen/1024);
ret = eat_flash_write(addr, app_new_data, app_datalen);
if(!ret)
{
eat_trace("Write flash failed [0x%08x, %dKByte]", APP_DATA_STORAGE_BASE, app_datalen/1024);
return;
}
eat_update_app((void*)(APP_DATA_RUN_BASE), (void*)(APP_DATA_STORAGE_BASE), app_datalen, EAT_PIN_NUM, EAT_PIN_NUM,EAT_FALSE);
eat_trace("Test App Over");
}


eat_flash_write

  • FLASH Function
eat_flash_erase
eat_flash_write
eat_get_app_base_addr
eat_get_app_space
eat_update_app
eat_update_app_ok
eat_bool(* const eat_flash_write)(const void *address, const void *data, unsigned int len)

This function is used to write data to flash.

Parameters
[in] | address | the start flash address for write.
[in] | data | Specifies the address of the data to be written.
[in] | len | Specifies the number of bytes to write.
Returns
TRUE or FALSE
Header
#include "eat_flash.h"
Example
See the example for eat_flash_erase.


eat_update_app

  • FLASH Function
eat_flash_erase
eat_flash_write
eat_get_app_base_addr
eat_get_app_space
eat_update_app
eat_update_app_ok
void(* const eat_update_app)(const void *app_code_addr, const void *app_code_new_addr, unsigned int len, EatPinName_enum pin_wd, EatPinName_enum pin_led, eat_bool lcd_bl)

This function is used to update APP code.

Parameters
[in] | app_code_addr | the executive address of App code.
[in] | app_code_new_addr | the store address of App new code.
[in] | len | the length of App new code.
[in] | pin_wd | the pin used for given extenal WDT a singnal when update app.
[in] | pin_led | the pin used for control extenal LED light when update app.
[in] | lcd_bl | bool type,contrl lcd back light whether shining when update app.
Returns
Nothing
Header
#include "eat_flash.h"
Attention
The cycle of pin_wd,pin_led and lcd backlight is about 400 ms.
Example
See the example for eat_flash_erase.


eat_update_app_ok

  • FLASH Function
eat_flash_erase
eat_flash_write
eat_get_app_base_addr
eat_get_app_space
eat_update_app
eat_update_app_ok
void(* const eat_update_app_ok)(void)

This function is used to clear update APP flag.

Returns
Nothing
Header
#include "eat_flash.h"
Example


eat_get_app_base_addr

  • FLASH Function
eat_flash_erase
eat_flash_write
eat_get_app_base_addr
eat_get_app_space
eat_update_app
eat_update_app_ok
unsigned long(* const eat_get_app_base_addr)(void)

This function is used to get app base address. void

Returns
Nothing
Header
#include "eat_flash.h"


eat_get_app_space

  • FLASH Function
eat_flash_erase
eat_flash_write
eat_get_app_base_addr
eat_get_app_space
eat_update_app
eat_update_app_ok
unsigned long(* const eat_get_app_space)(void)

This function is used to get app space value. void

Returns
Nothing


FILESYSTEM

Modules
FILESYSTEM

Modules

FS Function
FS Error Type
FS Type

Detailed Description

This module offers the FILE SYSTEM operation API and type defination.

Author
LuYong yong..nosp@m.lu@s.nosp@m.im.co.nosp@m.m
Date
2012/09/24
  Copyright (C) 2002-2012 Shanghai SIMCom Wireless Solutions Ltd.

  All rights reserved.


FS Function

Variables
FS Function
FILESYSTEM

Variables

int(*const | eat_fs_Open )(const unsigned short *FileName, UINT Flag)
int(*const | eat_fs_Close )(FS_HANDLE FileHandle)
int(*const | eat_fs_Read )(FS_HANDLE FileHandle, void *DataPtr, UINT Length, UINT *Read)
int(*const | eat_fs_Write )(FS_HANDLE FileHandle, void *DataPtr, UINT Length, UINT *Written)
int(*const | eat_fs_Seek )(FS_HANDLE FileHandle, int Offset, int Whence)
int(*const | eat_fs_Commit )(FS_HANDLE FileHandle)
int(*const | eat_fs_GetFileSize )(FS_HANDLE FileHandle, UINT *Size)
int(*const | eat_fs_GetFilePosition )(FS_HANDLE FileHandle, UINT *Position)
int(*const | eat_fs_GetAttributes )(const WCHAR *FileName)
int(*const | eat_fs_SetAttributes )(const WCHAR *FileName, BYTE Attributes)
int(*const | eat_fs_Delete )(const WCHAR *FileName)
int(*const | eat_fs_CreateDir )(const WCHAR *FileName)
int(*const | eat_fs_Truncate )(FS_HANDLE FileHandle)
int(*const | eat_fs_RemoveDir )(const WCHAR *DirName)
int(*const | eat_fs_GetFolderSize )(const WCHAR *FullPath)
int(*const | eat_fs_GetDiskFreeSize )(EatDisk_enum Disk, SINT64 *Size)
int(*const | eat_fs_GetDiskSize )(EatDisk_enum Disk, SINT64 *Size)
int(*const | eat_fs_Rename )(const WCHAR *FileName, const WCHAR *NewName)
int(*const | eat_fs_FindFirst )(const WCHAR *NamePattern, BYTE Attr, BYTE AttrMask, EAT_FS_DOSDirEntry *FileInfo, WCHAR *FileName, UINT MaxLength)
int(*const | eat_fs_FindNext )(FS_HANDLE FileHandle, EAT_FS_DOSDirEntry *FileInfo, WCHAR *FileName, UINT MaxLength)
int(*const | eat_fs_FindClose )(FS_HANDLE FileHandle)

Detailed Description

FS funtion declaration.


eat_fs_Open

  • FS Function
eat_fs_Close
eat_fs_Commit
eat_fs_CreateDir
eat_fs_Delete
eat_fs_FindClose
eat_fs_FindFirst
eat_fs_FindNext
eat_fs_GetAttributes
eat_fs_GetDiskFreeSize
eat_fs_GetDiskSize
eat_fs_GetFilePosition
eat_fs_GetFileSize
eat_fs_GetFolderSize
eat_fs_Open
eat_fs_Read
eat_fs_RemoveDir
eat_fs_Rename
eat_fs_Seek
eat_fs_SetAttributes
eat_fs_Truncate
eat_fs_Write
int(* const eat_fs_Open)(const unsigned short *FileName, UINT Flag)

Opens and possibly creates a file for subsequent read and/or write access.

Parameters
[in] FileName Must point to the name of the file to open/create. File names are not case sensitive; they will be converted to upper case when file system searches this file, and they should be two-byte aligned and UCS2 encoded. The file name can have one of the following formats:
format | meaning
[Drive:][\][Path\]Name[.Ext] | A data file or directory file name with optional drive and path information.
[Drive:]\ | A root directory.
[in] Flag Can be a combination of the following flags
  • FS_READ_WRITE
  • FS_READ_ONLY
  • FS_CREATE
  • FS_CREATE_ALWAYS
  • FS_OPEN_DIR
Returns
Please refer to eat_fs_error_enum.
Attention
If the function succeeds, the return value is a file handle for the opened file and the file pointer of the file is set to 0.
If the return value is less than 0, the function has failed and the return value is the error code.
For data and directory files, the same rules for file name syntax apply as under MS-DOS.
For logical drive and physical disk file names, the same rules as under Windows NT apply.
The function can continuous create most 24 files if all file handles have closed.
Internal FS drive name is "C:".
SD card drive name is "D:".
Header
#include "eat_fs.h"
Example
#define FILE_NAME L"C:\\TestFile.txt"
int eat_fs_test()
{
int FileHandle,FileHandle1;
//open for read (will fail if the file "TestFile.txt" dose not exsit)
FileHandle = eat_fs_Open(FILE_NAME,FS_READ_ONLY);
if(FileHandle<EAT_FS_NO_ERROR)
{
eat_trace("Open File Fail,and Return Error is %d",FileHandle);
return ;
}
else
{
eat_trace("Open File Success,and FileHandle is %d",FileHandle);
}
// close an opened file
fs_Op_ret=eat_fs_Close(FileHandle);
if(EAT_FS_NO_ERROR!=result)
{
eat_trace("Close File Handle Fail,and Return Error is %d",fs_Op_ret);
return ;
}
else
{
eat_trace("Close File Handle Success");
}
//create file (if the file has exsited ,will open file)
FileHandle1 = eat_fs_Open(FILE_NAME,FS_CREATE);
if(FileHandle1<EAT_FS_NO_ERROR)
{
eat_trace("Create File Fail,and Return Error is %d",FileHandle1);
return ;
}
else
{
eat_trace("Create File Success,and FileHandle is %d",FileHandle1);
}
eat_fs_Close(FileHandle1);
}


eat_fs_Close

  • FS Function
eat_fs_Close
eat_fs_Commit
eat_fs_CreateDir
eat_fs_Delete
eat_fs_FindClose
eat_fs_FindFirst
eat_fs_FindNext
eat_fs_GetAttributes
eat_fs_GetDiskFreeSize
eat_fs_GetDiskSize
eat_fs_GetFilePosition
eat_fs_GetFileSize
eat_fs_GetFolderSize
eat_fs_Open
eat_fs_Read
eat_fs_RemoveDir
eat_fs_Rename
eat_fs_Seek
eat_fs_SetAttributes
eat_fs_Truncate
eat_fs_Write
int(* const eat_fs_Close)(FS_HANDLE FileHandle)

Closes an open file and return a file handle back.

Parameters
[in] FileHandle the handle. Must have been assigned in a previous successful call to eat_fs_Open. eat_fs_Close will write any un-flushed file data to the disk and release all resources associated with the file handle.
Returns
Successful EAT_FS_NO_ERROR.
Failed Please refer to eat_fs_error_enum.
Header
#include "eat_fs.h"
Example
See the example for eat_fs_Open.


eat_fs_Read

  • FS Function
eat_fs_Close
eat_fs_Commit
eat_fs_CreateDir
eat_fs_Delete
eat_fs_FindClose
eat_fs_FindFirst
eat_fs_FindNext
eat_fs_GetAttributes
eat_fs_GetDiskFreeSize
eat_fs_GetDiskSize
eat_fs_GetFilePosition
eat_fs_GetFileSize
eat_fs_GetFolderSize
eat_fs_Open
eat_fs_Read
eat_fs_RemoveDir
eat_fs_Rename
eat_fs_Seek
eat_fs_SetAttributes
eat_fs_Truncate
eat_fs_Write
int(* const eat_fs_Read)(FS_HANDLE FileHandle, void *DataPtr, UINT Length, UINT *Read)

Reads data from an opened file.

Parameters
[in] | FileHandle | References the open file from which to read.
[out] | DataPtr | Specifies the address for the data to be read.
[in] | Length | Specifies the number of bytes to read
[out] | Read | Pointer to an unsigned integer to receive the number of bytes actually read. Usually, *Read will contain Length after the call. However, in case of an error or if the end of file is encountered during the read, the value may be less. Read may be set to NULL if this information is not required by an application.
Returns
Successful EAT_FS_NO_ERROR.
Failed Please refer to eat_fs_error_enum.
Attention
Reading past the end of file is not regarded as an error. If eat_fs_Read returns EAT_FS_NO_ERROR, but *Read is less than Length, the end of file has been encountered. This function advances the file's file pointer by the amount given in *Read. In case of an error and if parameter Read is NULL, the new file pointer is undefined.
Header
#include "eat_fs.h"
Example
#define FILE_NAME L"TestFile.txt"
static eat_fs_error_enum fs_Op_ret;
static char writeBuf[2048]="";
static char readBuf[2048]="";
unsigned int readLen;
unsigned int Len=1000;
unsigned int writedLen;
int eat_fs_test()
{
int FileHandle1,FileHandle2;
FileHandle1 = eat_fs_Open(FILE_NAME,FS_READ_WRITE);
if(FileHandle1>EAT_FS_NO_ERROR)
{
//clear test file
fs_Op_ret = eat_fs_Truncate(FileHandle1);
memset(writeBuf,0x61,2048);
fs_Op_ret=eat_fs_Write(FileHandle1,writeBuf,Len,&writedLen);
if(EAT_FS_NO_ERROR!=fs_Op_ret||Len !=writedLen)
{
eat_trace("Write File Fail,and Return Error is %d",fs_Op_ret);
eat_fs_Close(FileHandle1);
return ;
}
else
{
fs_Op_ret = eat_fs_Commit(FileHandle1);
if(EAT_FS_NO_ERROR != fs_Op_ret )
{
eat_trace("Commit File Fail,and Return Error is %d",fs_Op_ret);
eat_fs_Close(FileHandle1);
return;
}
else
{
eat_trace("Commit File Success");
eat_fs_Close(FileHandle1);
}
}
}
else
{
eat_trace("Open File Fail,and Return Error is %d",FileHandle1);
}
FileHandle2 = eat_fs_Open(FILE_NAME,FS_READ_WRITE);
if(FileHandle2>EAT_FS_NO_ERROR)
{
fs_Op_ret=eat_fs_Read(FileHandle2,readBuf,Len,&readLen);
if(EAT_FS_NO_ERROR!=fs_Op_ret)
{
eat_trace("Read File Fail,and Return Error is %d,Readlen is %d",fs_Op_ret,readLen);
eat_fs_Close(FileHandle2);
return ;
}
else
{
eat_trace("Read File Success");
eat_fs_Close(FileHandle2);
}
}
else
{
eat_trace("Open File Fail,and Return Error is %d",FileHandle2);
}
}


eat_fs_Write

  • FS Function
eat_fs_Close
eat_fs_Commit
eat_fs_CreateDir
eat_fs_Delete
eat_fs_FindClose
eat_fs_FindFirst
eat_fs_FindNext
eat_fs_GetAttributes
eat_fs_GetDiskFreeSize
eat_fs_GetDiskSize
eat_fs_GetFilePosition
eat_fs_GetFileSize
eat_fs_GetFolderSize
eat_fs_Open
eat_fs_Read
eat_fs_RemoveDir
eat_fs_Rename
eat_fs_Seek
eat_fs_SetAttributes
eat_fs_Truncate
eat_fs_Write
int(* const eat_fs_Write)(FS_HANDLE FileHandle, void *DataPtr, UINT Length, UINT *Written)

Writes data to a file.

Parameters
[in] | FileHandle | References the open file to write to.
[in] | DataPtr | Specifies the address of the data to be written.
[in] | Length | Specifies the number of bytes to write.
[out] | Written | Pointer to an unsigned integer to receive the number of bytes actually been written. Usually, *Written will contain Length after the call. However, in case of an error, the returned value may be less. Written may be set to NULL if this information is not required by an application.
Returns
Successful EAT_FS_NO_ERROR.
Failed Please refer to eat_fs_error_enum.
Attention
Writing past the current end of file will automatically extend the file. When the file size exceeds the current allocated file size, new clusters are allocated for the file. FS will allocate new clusters immediately following the current last cluster, if possible. This function advances the file's file pointer by the amount given in *Written. In case of an error and if parameter Written is NULL, the new file pointer is undefined.
Header
#include "eat_fs.h"
Example
See the example for eat_fs_Read.


eat_fs_Seek

  • FS Function
eat_fs_Close
eat_fs_Commit
eat_fs_CreateDir
eat_fs_Delete
eat_fs_FindClose
eat_fs_FindFirst
eat_fs_FindNext
eat_fs_GetAttributes
eat_fs_GetDiskFreeSize
eat_fs_GetDiskSize
eat_fs_GetFilePosition
eat_fs_GetFileSize
eat_fs_GetFolderSize
eat_fs_Open
eat_fs_Read
eat_fs_RemoveDir
eat_fs_Rename
eat_fs_Seek
eat_fs_SetAttributes
eat_fs_Truncate
eat_fs_Write
int(* const eat_fs_Seek)(FS_HANDLE FileHandle, int Offset, int Whence)

Repositions a file pointer and possibly extends a file.

Parameters
[in] | FileHandle | References the open file for which to reposition the file pointer.
[in] | Offset | Specifies how far the file pointer should be moved.
[in] | Whence | Specifies Offset's meaning. Please refer to EAT_FS_SEEK_POS_ENUM.
Returns
If the function succeeds, the return value is the new file pointer value, or, if the file pointer is larger than (2^31)-1, EAT_FS_LONG_FILE_POS is returned. If the function fails, the return value is some other negative error code.
Moving the file pointer before the beginning of the file is an error. However, moving it beyond the current file size is supported.
In this case, the file is extended. The data between the previous file size and the new file size is undefined. This method to extend a file is much faster than actually writing data to it.
Header
#include "eat_fs.h"
Example
#define FILE_NAME L"TestFile.txt"
int seekRet;
int eat_fs_test(void)
{
int FileHandle1;
FileHandle1 = eat_fs_Open(FILE_NAME,FS_READ_WRITE);
if(FileHandle1>EAT_FS_NO_ERROR)
{
seekRet = eat_fs_Seek(FileHandle1,0,EAT_FS_FILE_BEGIN);
if(seekRet<0)
{
eat_trace("Seek File Pointer Fail");
eat_fs_Close(FileHandle1);
return;
}
else
{
eat_trace("Seek File Pointer Success");
eat_fs_Close(FileHandle1);
}
}
else
{
eat_trace("Open File Fail,and Return Error is %d",FileHandle1);
}
}


eat_fs_Commit

  • FS Function
eat_fs_Close
eat_fs_Commit
eat_fs_CreateDir
eat_fs_Delete
eat_fs_FindClose
eat_fs_FindFirst
eat_fs_FindNext
eat_fs_GetAttributes
eat_fs_GetDiskFreeSize
eat_fs_GetDiskSize
eat_fs_GetFilePosition
eat_fs_GetFileSize
eat_fs_GetFolderSize
eat_fs_Open
eat_fs_Read
eat_fs_RemoveDir
eat_fs_Rename
eat_fs_Seek
eat_fs_SetAttributes
eat_fs_Truncate
eat_fs_Write
int(* const eat_fs_Commit)(FS_HANDLE FileHandle)

Immediately flushes all buffers associated with a file to disk.

Parameters
[in] FileHandle References the open file to be committed.
Returns
Successful EAT_FS_NO_ERROR.
Failed Please refer to eat_fs_error_enum.
Attention
FS_Commit guarantees that all of the file's data is flushed. The file's data buffer, directory entry, and the complete FAT are flushed.
Header
#include "eat_fs.h"
Example
See the example for eat_fs_Read.


eat_fs_GetFileSize

  • FS Function
eat_fs_Close
eat_fs_Commit
eat_fs_CreateDir
eat_fs_Delete
eat_fs_FindClose
eat_fs_FindFirst
eat_fs_FindNext
eat_fs_GetAttributes
eat_fs_GetDiskFreeSize
eat_fs_GetDiskSize
eat_fs_GetFilePosition
eat_fs_GetFileSize
eat_fs_GetFolderSize
eat_fs_Open
eat_fs_Read
eat_fs_RemoveDir
eat_fs_Rename
eat_fs_Seek
eat_fs_SetAttributes
eat_fs_Truncate
eat_fs_Write
int(* const eat_fs_GetFileSize)(FS_HANDLE FileHandle, UINT *Size)

Gets the current size of an open file.

Parameters
[in] | FileHandle | References the open file for which to retrieve the file size.
[out] | Size | Must point to the int to receive the file's size.
Returns
Successful EAT_FS_NO_ERROR.
Failed Please refer to eat_fs_error_enum.
Header
#include "eat_fs.h"


eat_fs_GetFilePosition

  • FS Function
eat_fs_Close
eat_fs_Commit
eat_fs_CreateDir
eat_fs_Delete
eat_fs_FindClose
eat_fs_FindFirst
eat_fs_FindNext
eat_fs_GetAttributes
eat_fs_GetDiskFreeSize
eat_fs_GetDiskSize
eat_fs_GetFilePosition
eat_fs_GetFileSize
eat_fs_GetFolderSize
eat_fs_Open
eat_fs_Read
eat_fs_RemoveDir
eat_fs_Rename
eat_fs_Seek
eat_fs_SetAttributes
eat_fs_Truncate
eat_fs_Write
int(* const eat_fs_GetFilePosition)(FS_HANDLE FileHandle, UINT *Position)

Gets the current file pointer position of an open file.

Parameters
[in] | FileHandle | File handle to reference the open file for which to retrieve the file pointer.
[out] | Position | The current file pointer of the opened file
Returns
This function always returns EAT_FS_NO_ERROR.
Header
#include "eat_fs.h"


eat_fs_GetAttributes

  • FS Function
eat_fs_Close
eat_fs_Commit
eat_fs_CreateDir
eat_fs_Delete
eat_fs_FindClose
eat_fs_FindFirst
eat_fs_FindNext
eat_fs_GetAttributes
eat_fs_GetDiskFreeSize
eat_fs_GetDiskSize
eat_fs_GetFilePosition
eat_fs_GetFileSize
eat_fs_GetFolderSize
eat_fs_Open
eat_fs_Read
eat_fs_RemoveDir
eat_fs_Rename
eat_fs_Seek
eat_fs_SetAttributes
eat_fs_Truncate
eat_fs_Write
int(* const eat_fs_GetAttributes)(const WCHAR *FileName)

Returns the attributes set for a specific file.

Parameters
[in] FileName It's the file path for which to retrieve the attributes.
Returns
The return value(s) below
  • FS_ATTR_READ_ONLY
  • FS_ATTR_HIDDEN
  • FS_ATTR_SYSTEM
  • FS_ATTR_VOLUME
  • FS_ATTR_DIR
  • FS_ATTR_ARCHIVE
    Failed : Please refer to eat_fs_error_enum.
Header
#include "eat_fs.h"
Example
#define FILE_NAME L"TestFile.txt"
static eat_fs_error_enum fs_Op_ret;
int eat_fs_test()
{
int FileHandle1;
FileHandle1 = eat_fs_Open(FILE_NAME,FS_READ_WRITE);
if(FileHandle1>EAT_FS_NO_ERROR)
{
fs_Op_ret=eat_fs_SetAttributes(FILE_NAME,FS_ATTR_READ_ONLY);
if(EAT_FS_NO_ERROR!=fs_Op_ret||Len !=writedLen)
{
eat_trace("Set File Attribute Fail,and Return Error is %d",fs_Op_ret);
eat_fs_Close(FileHandle1);
return ;
}
else
{
fs_Op_ret = eat_fs_GetAttributes(FILE_NAME);
if(EAT_FS_NO_ERROR != fs_Op_ret )
{
eat_trace("Get File Attributes Fail,and Return Error is %d",fs_Op_ret);
eat_fs_Close(FileHandle1);
return;
}
else
{
eat_trace("Get File Attributes Success,and File Attribute is %d",fs_Op_ret);
eat_fs_Close(FileHandle1);
}
}
}
else
{
eat_trace("Open File Fail,and Return Error is %d",FileHandle1);
}
}


eat_fs_SetAttributes

  • FS Function
eat_fs_Close
eat_fs_Commit
eat_fs_CreateDir
eat_fs_Delete
eat_fs_FindClose
eat_fs_FindFirst
eat_fs_FindNext
eat_fs_GetAttributes
eat_fs_GetDiskFreeSize
eat_fs_GetDiskSize
eat_fs_GetFilePosition
eat_fs_GetFileSize
eat_fs_GetFolderSize
eat_fs_Open
eat_fs_Read
eat_fs_RemoveDir
eat_fs_Rename
eat_fs_Seek
eat_fs_SetAttributes
eat_fs_Truncate
eat_fs_Write
int(* const eat_fs_SetAttributes)(const WCHAR *FileName, BYTE Attributes)

Assigns a new set of attributes to a given file.

Parameters
[in] FileName It's the name of the file for which to set the new attributes.
[in] Attributes
  • FS_ATTR_READ_ONLY
  • FS_ATTR_HIDDEN
  • FS_ATTR_SYSTEM
  • FS_ATTR_ARCHIVE
Returns
Successful EAT_FS_NO_ERROR.
Failed Please refer to eat_fs_error_enum.
Header
#include "eat_fs.h"
Example
See the example for eat_fs_GetAttributes.


eat_fs_Delete

  • FS Function
eat_fs_Close
eat_fs_Commit
eat_fs_CreateDir
eat_fs_Delete
eat_fs_FindClose
eat_fs_FindFirst
eat_fs_FindNext
eat_fs_GetAttributes
eat_fs_GetDiskFreeSize
eat_fs_GetDiskSize
eat_fs_GetFilePosition
eat_fs_GetFileSize
eat_fs_GetFolderSize
eat_fs_Open
eat_fs_Read
eat_fs_RemoveDir
eat_fs_Rename
eat_fs_Seek
eat_fs_SetAttributes
eat_fs_Truncate
eat_fs_Write
int(* const eat_fs_Delete)(const WCHAR *FileName)

Deletes a file.

Parameters
[in] FileName Must point to the name of the file to be deleted and may not contain wildcards. This function cannot delete directories.
Returns
Successful EAT_FS_NO_ERROR.
Failed Please refer to eat_fs_error_enum.
Header
#include "eat_fs.h"


eat_fs_CreateDir

  • FS Function
eat_fs_Close
eat_fs_Commit
eat_fs_CreateDir
eat_fs_Delete
eat_fs_FindClose
eat_fs_FindFirst
eat_fs_FindNext
eat_fs_GetAttributes
eat_fs_GetDiskFreeSize
eat_fs_GetDiskSize
eat_fs_GetFilePosition
eat_fs_GetFileSize
eat_fs_GetFolderSize
eat_fs_Open
eat_fs_Read
eat_fs_RemoveDir
eat_fs_Rename
eat_fs_Seek
eat_fs_SetAttributes
eat_fs_Truncate
eat_fs_Write
int(* const eat_fs_CreateDir)(const WCHAR *FileName)

Creates a new directory.

Parameters
[in] FileName It must point to the name of the directory to be created. The directory can have any legal file name syntax.
Returns
Successful EAT_FS_NO_ERROR.
Failed Please refer to eat_fs_error_enum.
Header
#include "eat_fs.h"
Example
#define TESTFILE_DEV L"TestFolder"
static eat_fs_error_enum fs_Op_ret;
int eat_fs_test()
{
int hFile;
hFile = eat_fs_Open(TESTFILE_DEV, FS_READ_ONLY | FS_OPEN_DIR);
if (hFile == EAT_FS_FILE_NOT_FOUND || hFile == EAT_FS_PATH_NOT_FOUND)
{
//test create dir interface: eat_fs_CreateDir
fs_Op_ret = eat_fs_CreateDir(TESTFILE_DEV);
if(fs_Op_ret == EAT_FS_NO_ERROR)
{
//test get folder size interface: eat_fs_GetFolderSize
fs_Op_ret=eat_fs_GetFolderSize(TESTFILE_DEV);
if(fs_Op_ret>=0)
{
eat_trace("Get Folder Size Success,and The Folder Size is %d",fs_Op_ret);
}
else
{
eat_trace("Get Folder Size Fail, and Return Error is %d",fs_Op_ret);
}
}
else
{
eat_trace("CreateDir Fail,and Return Error is %d",fs_Op_ret);
}
}
else
{
eat_trace("The dir has existed");
eat_fs_Close(hFile);
//test remove dir interface: eat_fs_RemoveDir
fs_Op_ret = eat_fs_RemoveDir(TESTFILE_DEV);
if(EAT_FS_NO_ERROR!=fs_Op_ret)
{
eat_trace("Remove Dir Fail,and Return Error is %d",fs_Op_ret);
return ;
}
else
{
eat_trace("eat_fs_RemoveDir():Remove Dir Success");
}
}
}


eat_fs_Truncate

  • FS Function
eat_fs_Close
eat_fs_Commit
eat_fs_CreateDir
eat_fs_Delete
eat_fs_FindClose
eat_fs_FindFirst
eat_fs_FindNext
eat_fs_GetAttributes
eat_fs_GetDiskFreeSize
eat_fs_GetDiskSize
eat_fs_GetFilePosition
eat_fs_GetFileSize
eat_fs_GetFolderSize
eat_fs_Open
eat_fs_Read
eat_fs_RemoveDir
eat_fs_Rename
eat_fs_Seek
eat_fs_SetAttributes
eat_fs_Truncate
eat_fs_Write
int(* const eat_fs_Truncate)(FS_HANDLE FileHandle)

Sets the current file size to the current file pointer position.

Parameters
[in] FileHandle References the open file to be truncated.
Returns
Successful EAT_FS_NO_ERROR.
Failed Please refer to eat_fs_error_enum.
Header
#include "eat_fs.h"
Example
See the example for eat_fs_Read.


eat_fs_RemoveDir

  • FS Function
eat_fs_Close
eat_fs_Commit
eat_fs_CreateDir
eat_fs_Delete
eat_fs_FindClose
eat_fs_FindFirst
eat_fs_FindNext
eat_fs_GetAttributes
eat_fs_GetDiskFreeSize
eat_fs_GetDiskSize
eat_fs_GetFilePosition
eat_fs_GetFileSize
eat_fs_GetFolderSize
eat_fs_Open
eat_fs_Read
eat_fs_RemoveDir
eat_fs_Rename
eat_fs_Seek
eat_fs_SetAttributes
eat_fs_Truncate
eat_fs_Write
int(* const eat_fs_RemoveDir)(const WCHAR *DirName)

Removes a directory.

Parameters
[in] DirName It must point to the name of the directory to be removed.
Returns
Successful EAT_FS_NO_ERROR.
Failed Please refer to eat_fs_error_enum.
Header
#include "eat_fs.h"
Example
See the example for eat_fs_CreateDir.


eat_fs_GetFolderSize

  • FS Function
eat_fs_Close
eat_fs_Commit
eat_fs_CreateDir
eat_fs_Delete
eat_fs_FindClose
eat_fs_FindFirst
eat_fs_FindNext
eat_fs_GetAttributes
eat_fs_GetDiskFreeSize
eat_fs_GetDiskSize
eat_fs_GetFilePosition
eat_fs_GetFileSize
eat_fs_GetFolderSize
eat_fs_Open
eat_fs_Read
eat_fs_RemoveDir
eat_fs_Rename
eat_fs_Seek
eat_fs_SetAttributes
eat_fs_Truncate
eat_fs_Write
int(* const eat_fs_GetFolderSize)(const WCHAR *FullPath)

Gets the folder size.

Parameters
[in] FullPath Fill source path to be counted.
Returns
Successful number of bytes.
Failed Please refer to eat_fs_error_enum.
Header
#include "eat_fs.h"
Example
See the example for eat_fs_CreateDir.


eat_fs_GetDiskFreeSize

  • FS Function
eat_fs_Close
eat_fs_Commit
eat_fs_CreateDir
eat_fs_Delete
eat_fs_FindClose
eat_fs_FindFirst
eat_fs_FindNext
eat_fs_GetAttributes
eat_fs_GetDiskFreeSize
eat_fs_GetDiskSize
eat_fs_GetFilePosition
eat_fs_GetFileSize
eat_fs_GetFolderSize
eat_fs_Open
eat_fs_Read
eat_fs_RemoveDir
eat_fs_Rename
eat_fs_Seek
eat_fs_SetAttributes
eat_fs_Truncate
eat_fs_Write
int(* const eat_fs_GetDiskFreeSize)(EatDisk_enum Disk, SINT64 *Size)

Gets the current disk free size.

Parameters
[in] Disk EAT_FS is internal file systerm .
EAT_EXTERN is SD card.
[out] Size Must point to the unsigned int to receive the size.
Returns
Successful EAT_FS_NO_ERROR.
Failed Please refer to eat_fs_error_enum.
Attention
The disk free maximum size less than 4GB
Header
#include "eat_fs.h"


eat_fs_GetDiskSize

  • FS Function
eat_fs_Close
eat_fs_Commit
eat_fs_CreateDir
eat_fs_Delete
eat_fs_FindClose
eat_fs_FindFirst
eat_fs_FindNext
eat_fs_GetAttributes
eat_fs_GetDiskFreeSize
eat_fs_GetDiskSize
eat_fs_GetFilePosition
eat_fs_GetFileSize
eat_fs_GetFolderSize
eat_fs_Open
eat_fs_Read
eat_fs_RemoveDir
eat_fs_Rename
eat_fs_Seek
eat_fs_SetAttributes
eat_fs_Truncate
eat_fs_Write
int(* const eat_fs_GetDiskSize)(EatDisk_enum Disk, SINT64 *Size)

Gets the current disk size.

Parameters
[in] Disk EAT_FS is internal file systerm.
EAT_EXTERN is SD card.
[out] Size Must point to the unsigned int to receive the size.
Returns
Successful EAT_FS_NO_ERROR.
Failed Please refer to eat_fs_error_enum.
Attention
The disk maximum size less than 4GB
Header
#include "eat_fs.h"


eat_fs_Rename

  • FS Function
eat_fs_Close
eat_fs_Commit
eat_fs_CreateDir
eat_fs_Delete
eat_fs_FindClose
eat_fs_FindFirst
eat_fs_FindNext
eat_fs_GetAttributes
eat_fs_GetDiskFreeSize
eat_fs_GetDiskSize
eat_fs_GetFilePosition
eat_fs_GetFileSize
eat_fs_GetFolderSize
eat_fs_Open
eat_fs_Read
eat_fs_RemoveDir
eat_fs_Rename
eat_fs_Seek
eat_fs_SetAttributes
eat_fs_Truncate
eat_fs_Write
int(* const eat_fs_Rename)(const WCHAR *FileName, const WCHAR *NewName)

To rename a file.

Parameters
[in] | FileName | The name of the file to be renamed.
[in] | NewName | The new name of the file.
Returns
Successful EAT_FS_NO_ERROR.
Failed Please refer to eat_fs_error_enum.
Header
#include "eat_fs.h"


eat_fs_FindFirst

  • FS Function
eat_fs_Close
eat_fs_Commit
eat_fs_CreateDir
eat_fs_Delete
eat_fs_FindClose
eat_fs_FindFirst
eat_fs_FindNext
eat_fs_GetAttributes
eat_fs_GetDiskFreeSize
eat_fs_GetDiskSize
eat_fs_GetFilePosition
eat_fs_GetFileSize
eat_fs_GetFolderSize
eat_fs_Open
eat_fs_Read
eat_fs_RemoveDir
eat_fs_Rename
eat_fs_Seek
eat_fs_SetAttributes
eat_fs_Truncate
eat_fs_Write
int(* const eat_fs_FindFirst)(const WCHAR *NamePattern, BYTE Attr, BYTE AttrMask, EAT_FS_DOSDirEntry *FileInfo, WCHAR *FileName, UINT MaxLength)

To search a directory for a file satisfying certain criteria.

Parameters
[in] | NamePattern | Pointer to a file name which may contain wildcard characters '*' (match zero or more characters) and/or '?' (match exactly one character), and can optionally be preceded by a path.
[in] | Attr | Specifies a set of all file attributes a file must have to match the request.
[in] | AttrMask | Specified the set of attributes, which are matched against Attr.
[in,out] | FileInfo | It is a pointer to EAT_FS_DOSDirEntry structure. If the function succeeds, this structure will be filled with the directory entry of the file found. .
[in] | FileName | Pointer to a string buffer to receive the file name without path if a file is found.
[in] | MaxLength | Size in bytes of the buffer pointed to by FileName.
Returns
If the function succeeds, at least one file satisfies the search criteria. *FileInfo contains the
directory entry of the first file and the function return value is greater than or equal to 0. The
return value is a file handle, which may be passed to subsequent calls to eat_fs_FindNext. If the function
fails, the return value is a negative error code. In this case, no handle is allocated and eat_fs_FindClose
need not be called.
It is important to close the handle using eat_fs_FindClose when no longer needed. Failing to do so will
quickly exhaust the available file handles
Header
#include "eat_fs.h"


eat_fs_FindNext

  • FS Function
eat_fs_Close
eat_fs_Commit
eat_fs_CreateDir
eat_fs_Delete
eat_fs_FindClose
eat_fs_FindFirst
eat_fs_FindNext
eat_fs_GetAttributes
eat_fs_GetDiskFreeSize
eat_fs_GetDiskSize
eat_fs_GetFilePosition
eat_fs_GetFileSize
eat_fs_GetFolderSize
eat_fs_Open
eat_fs_Read
eat_fs_RemoveDir
eat_fs_Rename
eat_fs_Seek
eat_fs_SetAttributes
eat_fs_Truncate
eat_fs_Write
int(* const eat_fs_FindNext)(FS_HANDLE FileHandle, EAT_FS_DOSDirEntry *FileInfo, WCHAR *FileName, UINT MaxLength)

To find more files with the same search criteria as a preceding call to eat_fs_FindFirst.

Parameters
[in] | FileHandle | Handle returned by a previous successful call to eat_fs_FindFirst.
[in,out] | FileInfo | It is a pointer to EAT_FS_DOSDirEntry structure (may be NULL).
[in] | FileName | It is a pointer to a string buffer to receive a file name without path
[in] | MaxLength | Size in bytes of the buffer pointed to by FileName.
Returns
If the function succeeds, the return value is FS_NO_ERROR.
If the function fails or no more files are found, the return value is a negative error code.If the function succeeds, *FileInfo and *FileName will be filled with the directory entry and name of the file found.
Header
#include "eat_fs.h"


eat_fs_FindClose

  • FS Function
eat_fs_Close
eat_fs_Commit
eat_fs_CreateDir
eat_fs_Delete
eat_fs_FindClose
eat_fs_FindFirst
eat_fs_FindNext
eat_fs_GetAttributes
eat_fs_GetDiskFreeSize
eat_fs_GetDiskSize
eat_fs_GetFilePosition
eat_fs_GetFileSize
eat_fs_GetFolderSize
eat_fs_Open
eat_fs_Read
eat_fs_RemoveDir
eat_fs_Rename
eat_fs_Seek
eat_fs_SetAttributes
eat_fs_Truncate
eat_fs_Write
int(* const eat_fs_FindClose)(FS_HANDLE FileHandle)

To close the handle of eat_fs_FindFirst.

Parameters
[in] FileHandle The handle of eat_fs_FindFirst.
Returns
Successful EAT_FS_NO_ERROR
Failed Please refer to eat_fs_error_enum.
Header
#include "eat_fs.h"


FS Error Type

Enumerations
FS Error Type
FILESYSTEM

Enumerations

enum eat_fs_error_enum {
EAT_FS_NO_ERROR = 0,
EAT_FS_ERROR_RESERVED = -1,
EAT_FS_PARAM_ERROR = -2,
EAT_FS_INVALID_FILENAME = -3,
EAT_FS_DRIVE_NOT_FOUND = -4,
EAT_FS_TOO_MANY_FILES = -5,
EAT_FS_NO_MORE_FILES = -6,
EAT_FS_WRONG_MEDIA = -7,
EAT_FS_INVALID_FILE_SYSTEM = -8,
EAT_FS_FILE_NOT_FOUND = -9,
EAT_FS_INVALID_FILE_HANDLE = -10,
EAT_FS_UNSUPPORTED_DEVICE = -11,
EAT_FS_UNSUPPORTED_DRIVER_FUNCTION = -12,
EAT_FS_CORRUPTED_PARTITION_TABLE = -13,
EAT_FS_TOO_MANY_DRIVES = -14,
EAT_FS_INVALID_FILE_POS = -15,
EAT_FS_ACCESS_DENIED = -16,
EAT_FS_STRING_BUFFER_TOO_SMALL = -17,
EAT_FS_GENERAL_FAILURE = -18,
EAT_FS_PATH_NOT_FOUND = -19,
EAT_FS_FAT_ALLOC_ERROR = -20,
EAT_FS_ROOT_DIR_FULL = -21,
EAT_FS_DISK_FULL = -22,
EAT_FS_TIMEOUT = -23,
EAT_FS_BAD_SECTOR = -24,
EAT_FS_DATA_ERROR = -25,
EAT_FS_MEDIA_CHANGED = -26,
EAT_FS_SECTOR_NOT_FOUND = -27,
EAT_FS_ADDRESS_MARK_NOT_FOUND = -28,
EAT_FS_DRIVE_NOT_READY = -29,
EAT_FS_WRITE_PROTECTION = -30,
EAT_FS_DMA_OVERRUN = -31,
EAT_FS_CRC_ERROR = -32,
EAT_FS_DEVICE_RESOURCE_ERROR = -33,
EAT_FS_INVALID_SECTOR_SIZE = -34,
EAT_FS_OUT_OF_BUFFERS = -35,
EAT_FS_FILE_EXISTS = -36,
EAT_FS_LONG_FILE_POS = -37,
EAT_FS_FILE_TOO_LARGE = -38,
EAT_FS_BAD_DIR_ENTRY = -39,
EAT_FS_ATTR_CONFLICT = -40,
EAT_FS_CHECKDISK_RETRY = -41,
EAT_FS_LACK_OF_PROTECTION_SPACE = -42,
EAT_FS_SYSTEM_CRASH = -43,
EAT_FS_FAIL_GET_MEM = -44,
EAT_FS_READ_ONLY_ERROR = -45,
EAT_FS_DEVICE_BUSY = -46,
EAT_FS_ABORTED_ERROR = -47,
EAT_FS_QUOTA_OVER_DISK_SPACE = -48,
EAT_FS_PATH_OVER_LEN_ERROR = -49,
EAT_FS_APP_QUOTA_FULL = -50,
EAT_FS_VF_MAP_ERROR = -51,
EAT_FS_DEVICE_EXPORTED_ERROR = -52,
EAT_FS_DISK_FRAGMENT = -53,
EAT_FS_DIRCACHE_EXPIRED = -54,
EAT_FS_QUOTA_USAGE_WARNING = -55,
EAT_FS_ERR_DIRDATA_LOCKED = -56,
EAT_FS_INVALID_OPERATION = -57,
EAT_FS_MSDC_MOUNT_ERROR = -100,
EAT_FS_MSDC_READ_SECTOR_ERROR = -101,
EAT_FS_MSDC_WRITE_SECTOR_ERROR = -102,
EAT_FS_MSDC_DISCARD_SECTOR_ERROR = -103,
EAT_FS_MSDC_PRESNET_NOT_READY = -104,
EAT_FS_MSDC_NOT_PRESENT = -105,
EAT_FS_EXTERNAL_DEVICE_NOT_PRESENT = -106,
EAT_FS_HIGH_LEVEL_FORMAT_ERROR = -107,
EAT_FS_CARD_BATCHCOUNT_NOT_PRESENT = -110,
EAT_FS_FLASH_MOUNT_ERROR = -120,
EAT_FS_FLASH_ERASE_BUSY = -121,
EAT_FS_NAND_DEVICE_NOT_SUPPORTED = -122,
EAT_FS_FLASH_OTP_UNKNOWERR = -123,
EAT_FS_FLASH_OTP_OVERSCOPE = -124,
EAT_FS_FLASH_OTP_WRITEFAIL = -125,
EAT_FS_FDM_VERSION_MISMATCH = -126,
EAT_FS_FLASH_OTP_LOCK_ALREADY = -127,
EAT_FS_FDM_FORMAT_ERROR = -128,
EAT_FS_FDM_USER_DRIVE_BROKEN = -129,
EAT_FS_FDM_SYS_DRIVE_BROKEN = -130,
EAT_FS_FDM_MULTIPLE_BROKEN = -131,
EAT_FS_LOCK_MUTEX_FAIL = -141,
EAT_FS_NO_NONBLOCKMODE = -142,
EAT_FS_NO_PROTECTIONMODE = -143,
EAT_FS_DISK_SIZE_TOO_LARGE = (EAT_FS_MSDC_MOUNT_ERROR),
EAT_FS_MINIMUM_ERROR_CODE = -65536
}

Detailed Description

Fs_Error type defination.


eat_fs_error_enum

  • FS Error Type
eat_fs_error_enum
enum eat_fs_error_enum

File System error codes

Enumerator:
EAT_FS_NO_ERROR

Success

EAT_FS_ERROR_RESERVED

Reserved error code. Could be the initial value of result

EAT_FS_PARAM_ERROR

Given parameters for current called FS function is wrong

EAT_FS_INVALID_FILENAME

Given path for current called FS function is wrong

EAT_FS_DRIVE_NOT_FOUND

Can't find specified drive

EAT_FS_TOO_MANY_FILES

Too many files are opened

EAT_FS_NO_MORE_FILES

There is no more files could be found.

EAT_FS_WRONG_MEDIA

Fatal: FS_WRONG_MEDIA

EAT_FS_INVALID_FILE_SYSTEM

Fatal: FS_INVALID_FILE_SYSTEM

EAT_FS_FILE_NOT_FOUND

Can't find specified file

EAT_FS_INVALID_FILE_HANDLE

Given handle for current called FS function is wrong

EAT_FS_UNSUPPORTED_DEVICE

Specified device is not supported.

EAT_FS_UNSUPPORTED_DRIVER_FUNCTION

Specified device function is not supported.

EAT_FS_CORRUPTED_PARTITION_TABLE

fatal: FS_CORRUPTED_PARTITION_TABLE

EAT_FS_TOO_MANY_DRIVES

Obsolete: FS_TOO_MANY_DRIVES

EAT_FS_INVALID_FILE_POS

Given file position to seek is wrong

EAT_FS_ACCESS_DENIED

Access denied.

EAT_FS_STRING_BUFFER_TOO_SMALL

Given buffer is too small

EAT_FS_GENERAL_FAILURE

Normal: FS_GENERAL_FAILURE

EAT_FS_PATH_NOT_FOUND

Can't find specified path(folder)

EAT_FS_FAT_ALLOC_ERROR

Fatal: disk crash

EAT_FS_ROOT_DIR_FULL

Root directory is full.

EAT_FS_DISK_FULL

Disk is full.

EAT_FS_TIMEOUT

Normal: FS_CloseMSDC with nonblock

EAT_FS_BAD_SECTOR

Normal: NAND flash bad block(sector)

EAT_FS_DATA_ERROR

Normal: NAND flash bad block(data)

EAT_FS_MEDIA_CHANGED

Hot-plug storge is removed.

EAT_FS_SECTOR_NOT_FOUND

Specified location is not found.

EAT_FS_ADDRESS_MARK_NOT_FOUND

Obsolete: not use so far

EAT_FS_DRIVE_NOT_READY

The specified device is not ready yet.

EAT_FS_WRITE_PROTECTION

Target media is protected from writing. Only for MSDC

EAT_FS_DMA_OVERRUN

Obsolete: not use so far

EAT_FS_CRC_ERROR

Obsolete: not use so far

EAT_FS_DEVICE_RESOURCE_ERROR

Fatal: Device crash

EAT_FS_INVALID_SECTOR_SIZE

Invalid sector size of the target media. It will cause mount failure.

EAT_FS_OUT_OF_BUFFERS

FS internal buffer is run out.

EAT_FS_FILE_EXISTS

Specified file already exists.

EAT_FS_LONG_FILE_POS

User : FS_Seek new pos over sizeof int

EAT_FS_FILE_TOO_LARGE

User: filesize + pos over sizeof int

EAT_FS_BAD_DIR_ENTRY

The specified directory entry, file or folder, is invalid.

EAT_FS_ATTR_CONFLICT

User: Can't specify FS_PROTECTION_MODE and FS_NONBLOCK_MOD

EAT_FS_CHECKDISK_RETRY

System: don't care

EAT_FS_LACK_OF_PROTECTION_SPACE

Fatal: Device crash

EAT_FS_SYSTEM_CRASH

Normal: FS_SYSTEM_CRASH

EAT_FS_FAIL_GET_MEM

FS fails to get memory for the operation.

EAT_FS_READ_ONLY_ERROR

Caller is trying to write a read-only file.

EAT_FS_DEVICE_BUSY

The target media is busy.

EAT_FS_ABORTED_ERROR

The operation was aborted.

EAT_FS_QUOTA_OVER_DISK_SPACE

Quota configuration mistake

EAT_FS_PATH_OVER_LEN_ERROR

The length of given path is over than spec.

EAT_FS_APP_QUOTA_FULL

App's folder is full.

EAT_FS_VF_MAP_ERROR

Virtual file is invalid.

EAT_FS_DEVICE_EXPORTED_ERROR

The target media is exported to PC.

EAT_FS_DISK_FRAGMENT

There are fragmentations in the target media.

EAT_FS_DIRCACHE_EXPIRED

The target file/folder is changed by some other background event.

EAT_FS_QUOTA_USAGE_WARNING

System Drive Free Space Not Enought

EAT_FS_ERR_DIRDATA_LOCKED

Normal

EAT_FS_INVALID_OPERATION

Normal

EAT_FS_MSDC_MOUNT_ERROR

Fail to mount memory card.

EAT_FS_MSDC_READ_SECTOR_ERROR

Fail to read from memory card.

EAT_FS_MSDC_WRITE_SECTOR_ERROR

Fail to write to memory card.

EAT_FS_MSDC_DISCARD_SECTOR_ERROR

Fail to discard data from memory card.

EAT_FS_MSDC_PRESNET_NOT_READY

The memory card is inserted but not mouned yet.

EAT_FS_MSDC_NOT_PRESENT

The memory card isn't there.

EAT_FS_EXTERNAL_DEVICE_NOT_PRESENT

The card reader isn't there.

EAT_FS_HIGH_LEVEL_FORMAT_ERROR

Fail to format

EAT_FS_CARD_BATCHCOUNT_NOT_PRESENT

Obsolete: free cluster number is invalid.

EAT_FS_FLASH_MOUNT_ERROR

Fail to mount NOR/NAND flash.

EAT_FS_FLASH_ERASE_BUSY

Fail to erase from flash. Only for nonblock mode

EAT_FS_NAND_DEVICE_NOT_SUPPORTED

Configuration Mistake: NAND type is not supported.

EAT_FS_FLASH_OTP_UNKNOWERR

OTP unknown error.

EAT_FS_FLASH_OTP_OVERSCOPE

The write address or length to OTP is not correct.

EAT_FS_FLASH_OTP_WRITEFAIL

Fail to write to OTP. Might be written before

EAT_FS_FDM_VERSION_MISMATCH

FDM has been upgraded. Need to format.

EAT_FS_FLASH_OTP_LOCK_ALREADY

Fail to write to OTP because it's locked already

EAT_FS_FDM_FORMAT_ERROR

The format of the disk content is not correct

EAT_FS_FDM_USER_DRIVE_BROKEN

User drive unrecoverable errors are dectected

EAT_FS_FDM_SYS_DRIVE_BROKEN

System drive unrecoverable errors are dectected

EAT_FS_FDM_MULTIPLE_BROKEN

multiple unrecoverable errors are dectected on the flash device.

EAT_FS_LOCK_MUTEX_FAIL

FS fails to lock specific resource.

EAT_FS_NO_NONBLOCKMODE

User: try to call nonblock mode other than NOR flash

EAT_FS_NO_PROTECTIONMODE

User: try to call protection mode other than NOR flash

EAT_FS_DISK_SIZE_TOO_LARGE

If disk size exceeds FS_MAX_DISK_SIZE (unit is MB, defined in custom_fs.h), FS_TestMSDC(), FS_GetDevStatus(FS_MOUNT_STATE_ENUM) and all access behaviors will get this error code.

EAT_FS_MINIMUM_ERROR_CODE

0xFFFF0000


FS Type
FILESYSTEM

Data Structures

struct EAT_FS_DOSDirEntry

Macros

#define FS_MAX_PATH 64

Typedefs

typedef unsigned short | WORD
typedef unsigned short | WCHAR
typedef unsigned int | UINT
typedef unsigned char | BYTE
typedef void * | HANDLE
typedef int | FS_HANDLE
struct {
unsigned int Second2:5
unsigned int Minute:6
unsigned int Hour:5
unsigned int Day:5
unsigned int Month:4
unsigned int Year1980:7
} EAT_FS_DOSDateTime

Enumerations

enum EAT_FS_SEEK_POS_ENUM {
EAT_FS_FILE_BEGIN,
EAT_FS_FILE_CURRENT,
EAT_FS_FILE_END
}
enum EatDisk_enum {
EAT_FS,
EAT_EXTERN,
EAT_NONE_DRIVE
}

Attributes of files or folders

#define | FS_ATTR_READ_ONLY 0x01
#define | FS_ATTR_HIDDEN 0x02
#define | FS_ATTR_SYSTEM 0x04
#define | FS_ATTR_VOLUME 0x08
#define | FS_ATTR_DIR 0x10
#define | FS_ATTR_ARCHIVE 0x20
#define | FS_LONGNAME_ATTR 0x0F

FS_open flags

#define | FS_READ_WRITE 0x00000000L
#define | FS_READ_ONLY 0x00000100L
#define | FS_OPEN_DIR 0x00000800L
#define | FS_CREATE 0x00010000L
#define | FS_CREATE_ALWAYS 0x00020000L
#define | FS_OPEN_NO_DIR 0x00000400L

Detailed Description

FS type defination.


EAT_FS_DOSDirEntry Struct Reference

Data Fields
EAT_FS_DOSDirEntry Struct Reference
FS Type

Data Fields

char | FileName [8]
__packed char | Extension [3]
__packed BYTE | Attributes
__packed BYTE | NTReserved
__packed BYTE | CreateTimeTenthSecond
EAT_FS_DOSDateTime CreateDateTime
__packed WORD | LastAccessDate
__packed WORD | FirstClusterHi
EAT_FS_DOSDateTime DateTime
__packed WORD | FirstCluster
__packed UINT | FileSize
UINT Cluster
UINT Index
UINT Stamp
UINT Drive
UINT SerialNumber


EAT_FS_DOSDirEntry::FileName

  • EAT_FS_DOSDirEntry
Attributes
Cluster
CreateDateTime
CreateTimeTenthSecond
DateTime
Drive
Extension
FileName
FileSize
FirstCluster
FirstClusterHi
Index
LastAccessDate
NTReserved
SerialNumber
Stamp
char EAT_FS_DOSDirEntry::FileName[8]


EAT_FS_DOSDirEntry::Extension

  • EAT_FS_DOSDirEntry
Attributes
Cluster
CreateDateTime
CreateTimeTenthSecond
DateTime
Drive
Extension
FileName
FileSize
FirstCluster
FirstClusterHi
Index
LastAccessDate
NTReserved
SerialNumber
Stamp
__packed char EAT_FS_DOSDirEntry::Extension[3]


EAT_FS_DOSDirEntry::Attributes

  • EAT_FS_DOSDirEntry
Attributes
Cluster
CreateDateTime
CreateTimeTenthSecond
DateTime
Drive
Extension
FileName
FileSize
FirstCluster
FirstClusterHi
Index
LastAccessDate
NTReserved
SerialNumber
Stamp
__packed BYTE EAT_FS_DOSDirEntry::Attributes


EAT_FS_DOSDirEntry::NTReserved

  • EAT_FS_DOSDirEntry
Attributes
Cluster
CreateDateTime
CreateTimeTenthSecond
DateTime
Drive
Extension
FileName
FileSize
FirstCluster
FirstClusterHi
Index
LastAccessDate
NTReserved
SerialNumber
Stamp
__packed BYTE EAT_FS_DOSDirEntry::NTReserved


EAT_FS_DOSDirEntry::CreateTimeTenthSecond

  • EAT_FS_DOSDirEntry
Attributes
Cluster
CreateDateTime
CreateTimeTenthSecond
DateTime
Drive
Extension
FileName
FileSize
FirstCluster
FirstClusterHi
Index
LastAccessDate
NTReserved
SerialNumber
Stamp
__packed BYTE EAT_FS_DOSDirEntry::CreateTimeTenthSecond


EAT_FS_DOSDirEntry::CreateDateTime

  • EAT_FS_DOSDirEntry
Attributes
Cluster
CreateDateTime
CreateTimeTenthSecond
DateTime
Drive
Extension
FileName
FileSize
FirstCluster
FirstClusterHi
Index
LastAccessDate
NTReserved
SerialNumber
Stamp
EAT_FS_DOSDateTime EAT_FS_DOSDirEntry::CreateDateTime


EAT_FS_DOSDirEntry::LastAccessDate

  • EAT_FS_DOSDirEntry
Attributes
Cluster
CreateDateTime
CreateTimeTenthSecond
DateTime
Drive
Extension
FileName
FileSize
FirstCluster
FirstClusterHi
Index
LastAccessDate
NTReserved
SerialNumber
Stamp
__packed WORD EAT_FS_DOSDirEntry::LastAccessDate


EAT_FS_DOSDirEntry::FirstClusterHi

  • EAT_FS_DOSDirEntry
Attributes
Cluster
CreateDateTime
CreateTimeTenthSecond
DateTime
Drive
Extension
FileName
FileSize
FirstCluster
FirstClusterHi
Index
LastAccessDate
NTReserved
SerialNumber
Stamp
__packed WORD EAT_FS_DOSDirEntry::FirstClusterHi


EAT_FS_DOSDirEntry::DateTime

  • EAT_FS_DOSDirEntry
Attributes
Cluster
CreateDateTime
CreateTimeTenthSecond
DateTime
Drive
Extension
FileName
FileSize
FirstCluster
FirstClusterHi
Index
LastAccessDate
NTReserved
SerialNumber
Stamp
EAT_FS_DOSDateTime EAT_FS_DOSDirEntry::DateTime


EAT_FS_DOSDirEntry::FirstCluster

  • EAT_FS_DOSDirEntry
Attributes
Cluster
CreateDateTime
CreateTimeTenthSecond
DateTime
Drive
Extension
FileName
FileSize
FirstCluster
FirstClusterHi
Index
LastAccessDate
NTReserved
SerialNumber
Stamp
__packed WORD EAT_FS_DOSDirEntry::FirstCluster


EAT_FS_DOSDirEntry::FileSize

  • EAT_FS_DOSDirEntry
Attributes
Cluster
CreateDateTime
CreateTimeTenthSecond
DateTime
Drive
Extension
FileName
FileSize
FirstCluster
FirstClusterHi
Index
LastAccessDate
NTReserved
SerialNumber
Stamp
__packed UINT EAT_FS_DOSDirEntry::FileSize


EAT_FS_DOSDirEntry::Cluster

  • EAT_FS_DOSDirEntry
Attributes
Cluster
CreateDateTime
CreateTimeTenthSecond
DateTime
Drive
Extension
FileName
FileSize
FirstCluster
FirstClusterHi
Index
LastAccessDate
NTReserved
SerialNumber
Stamp
UINT EAT_FS_DOSDirEntry::Cluster


EAT_FS_DOSDirEntry::Index

  • EAT_FS_DOSDirEntry
Attributes
Cluster
CreateDateTime
CreateTimeTenthSecond
DateTime
Drive
Extension
FileName
FileSize
FirstCluster
FirstClusterHi
Index
LastAccessDate
NTReserved
SerialNumber
Stamp
UINT EAT_FS_DOSDirEntry::Index


EAT_FS_DOSDirEntry::Stamp

  • EAT_FS_DOSDirEntry
Attributes
Cluster
CreateDateTime
CreateTimeTenthSecond
DateTime
Drive
Extension
FileName
FileSize
FirstCluster
FirstClusterHi
Index
LastAccessDate
NTReserved
SerialNumber
Stamp
UINT EAT_FS_DOSDirEntry::Stamp


EAT_FS_DOSDirEntry::Drive

  • EAT_FS_DOSDirEntry
Attributes
Cluster
CreateDateTime
CreateTimeTenthSecond
DateTime
Drive
Extension
FileName
FileSize
FirstCluster
FirstClusterHi
Index
LastAccessDate
NTReserved
SerialNumber
Stamp
UINT EAT_FS_DOSDirEntry::Drive


EAT_FS_DOSDirEntry::SerialNumber

  • EAT_FS_DOSDirEntry
Attributes
Cluster
CreateDateTime
CreateTimeTenthSecond
DateTime
Drive
Extension
FileName
FileSize
FirstCluster
FirstClusterHi
Index
LastAccessDate
NTReserved
SerialNumber
Stamp
UINT EAT_FS_DOSDirEntry::SerialNumber


FS_MAX_PATH

  • FS Type
BYTE
EAT_FS_DOSDateTime
EAT_FS_SEEK_POS_ENUM
EatDisk_enum
FS_ATTR_ARCHIVE
FS_ATTR_DIR
FS_ATTR_HIDDEN
FS_ATTR_READ_ONLY
FS_ATTR_SYSTEM
FS_ATTR_VOLUME
FS_CREATE
FS_CREATE_ALWAYS
FS_HANDLE
FS_LONGNAME_ATTR
FS_MAX_PATH
FS_OPEN_DIR
FS_OPEN_NO_DIR
FS_READ_ONLY
FS_READ_WRITE
HANDLE
UINT
WCHAR
WORD
#define FS_MAX_PATH 64

FS path name length


FS_ATTR_READ_ONLY

  • FS Type
BYTE
EAT_FS_DOSDateTime
EAT_FS_SEEK_POS_ENUM
EatDisk_enum
FS_ATTR_ARCHIVE
FS_ATTR_DIR
FS_ATTR_HIDDEN
FS_ATTR_READ_ONLY
FS_ATTR_SYSTEM
FS_ATTR_VOLUME
FS_CREATE
FS_CREATE_ALWAYS
FS_HANDLE
FS_LONGNAME_ATTR
FS_MAX_PATH
FS_OPEN_DIR
FS_OPEN_NO_DIR
FS_READ_ONLY
FS_READ_WRITE
HANDLE
UINT
WCHAR
WORD
#define FS_ATTR_READ_ONLY 0x01

The entry is read only. Any attempt to open it with read/write access will return error "access denied".


FS_ATTR_HIDDEN

  • FS Type
BYTE
EAT_FS_DOSDateTime
EAT_FS_SEEK_POS_ENUM
EatDisk_enum
FS_ATTR_ARCHIVE
FS_ATTR_DIR
FS_ATTR_HIDDEN
FS_ATTR_READ_ONLY
FS_ATTR_SYSTEM
FS_ATTR_VOLUME
FS_CREATE
FS_CREATE_ALWAYS
FS_HANDLE
FS_LONGNAME_ATTR
FS_MAX_PATH
FS_OPEN_DIR
FS_OPEN_NO_DIR
FS_READ_ONLY
FS_READ_WRITE
HANDLE
UINT
WCHAR
WORD
#define FS_ATTR_HIDDEN 0x02

The entry is marked as hidden. This attribute has no effect on any FS function.


FS_ATTR_SYSTEM

  • FS Type
BYTE
EAT_FS_DOSDateTime
EAT_FS_SEEK_POS_ENUM
EatDisk_enum
FS_ATTR_ARCHIVE
FS_ATTR_DIR
FS_ATTR_HIDDEN
FS_ATTR_READ_ONLY
FS_ATTR_SYSTEM
FS_ATTR_VOLUME
FS_CREATE
FS_CREATE_ALWAYS
FS_HANDLE
FS_LONGNAME_ATTR
FS_MAX_PATH
FS_OPEN_DIR
FS_OPEN_NO_DIR
FS_READ_ONLY
FS_READ_WRITE
HANDLE
UINT
WCHAR
WORD
#define FS_ATTR_SYSTEM 0x04

The entry is marked as being a system file. If a file in system drive brings this flag, file system will fix it if its size is abnormal instead of deleting it (default behavior).


FS_ATTR_VOLUME

  • FS Type
BYTE
EAT_FS_DOSDateTime
EAT_FS_SEEK_POS_ENUM
EatDisk_enum
FS_ATTR_ARCHIVE
FS_ATTR_DIR
FS_ATTR_HIDDEN
FS_ATTR_READ_ONLY
FS_ATTR_SYSTEM
FS_ATTR_VOLUME
FS_CREATE
FS_CREATE_ALWAYS
FS_HANDLE
FS_LONGNAME_ATTR
FS_MAX_PATH
FS_OPEN_DIR
FS_OPEN_NO_DIR
FS_READ_ONLY
FS_READ_WRITE
HANDLE
UINT
WCHAR
WORD
#define FS_ATTR_VOLUME 0x08

The entry is a volume label. Only a directory entry on a logical drive in the root directory can have this attribute set.


FS_ATTR_DIR

  • FS Type
BYTE
EAT_FS_DOSDateTime
EAT_FS_SEEK_POS_ENUM
EatDisk_enum
FS_ATTR_ARCHIVE
FS_ATTR_DIR
FS_ATTR_HIDDEN
FS_ATTR_READ_ONLY
FS_ATTR_SYSTEM
FS_ATTR_VOLUME
FS_CREATE
FS_CREATE_ALWAYS
FS_HANDLE
FS_LONGNAME_ATTR
FS_MAX_PATH
FS_OPEN_DIR
FS_OPEN_NO_DIR
FS_READ_ONLY
FS_READ_WRITE
HANDLE
UINT
WCHAR
WORD
#define FS_ATTR_DIR 0x10

The entry is a directory.


FS_ATTR_ARCHIVE

  • FS Type
BYTE
EAT_FS_DOSDateTime
EAT_FS_SEEK_POS_ENUM
EatDisk_enum
FS_ATTR_ARCHIVE
FS_ATTR_DIR
FS_ATTR_HIDDEN
FS_ATTR_READ_ONLY
FS_ATTR_SYSTEM
FS_ATTR_VOLUME
FS_CREATE
FS_CREATE_ALWAYS
FS_HANDLE
FS_LONGNAME_ATTR
FS_MAX_PATH
FS_OPEN_DIR
FS_OPEN_NO_DIR
FS_READ_ONLY
FS_READ_WRITE
HANDLE
UINT
WCHAR
WORD
#define FS_ATTR_ARCHIVE 0x20

The entry is marked as being backed up. This attribute has no effect on any FS function, but it is set on every write operation.


FS_LONGNAME_ATTR

  • FS Type
BYTE
EAT_FS_DOSDateTime
EAT_FS_SEEK_POS_ENUM
EatDisk_enum
FS_ATTR_ARCHIVE
FS_ATTR_DIR
FS_ATTR_HIDDEN
FS_ATTR_READ_ONLY
FS_ATTR_SYSTEM
FS_ATTR_VOLUME
FS_CREATE
FS_CREATE_ALWAYS
FS_HANDLE
FS_LONGNAME_ATTR
FS_MAX_PATH
FS_OPEN_DIR
FS_OPEN_NO_DIR
FS_READ_ONLY
FS_READ_WRITE
HANDLE
UINT
WCHAR
WORD
#define FS_LONGNAME_ATTR 0x0F

The entry is a long file name entry.


FS_READ_WRITE

  • FS Type
BYTE
EAT_FS_DOSDateTime
EAT_FS_SEEK_POS_ENUM
EatDisk_enum
FS_ATTR_ARCHIVE
FS_ATTR_DIR
FS_ATTR_HIDDEN
FS_ATTR_READ_ONLY
FS_ATTR_SYSTEM
FS_ATTR_VOLUME
FS_CREATE
FS_CREATE_ALWAYS
FS_HANDLE
FS_LONGNAME_ATTR
FS_MAX_PATH
FS_OPEN_DIR
FS_OPEN_NO_DIR
FS_READ_ONLY
FS_READ_WRITE
HANDLE
UINT
WCHAR
WORD
#define FS_READ_WRITE 0x00000000L

The file is opened for read and write access.


FS_READ_ONLY

  • FS Type
BYTE
EAT_FS_DOSDateTime
EAT_FS_SEEK_POS_ENUM
EatDisk_enum
FS_ATTR_ARCHIVE
FS_ATTR_DIR
FS_ATTR_HIDDEN
FS_ATTR_READ_ONLY
FS_ATTR_SYSTEM
FS_ATTR_VOLUME
FS_CREATE
FS_CREATE_ALWAYS
FS_HANDLE
FS_LONGNAME_ATTR
FS_MAX_PATH
FS_OPEN_DIR
FS_OPEN_NO_DIR
FS_READ_ONLY
FS_READ_WRITE
HANDLE
UINT
WCHAR
WORD
#define FS_READ_ONLY 0x00000100L

The file is opened for read only access.


FS_OPEN_DIR

  • FS Type
BYTE
EAT_FS_DOSDateTime
EAT_FS_SEEK_POS_ENUM
EatDisk_enum
FS_ATTR_ARCHIVE
FS_ATTR_DIR
FS_ATTR_HIDDEN
FS_ATTR_READ_ONLY
FS_ATTR_SYSTEM
FS_ATTR_VOLUME
FS_CREATE
FS_CREATE_ALWAYS
FS_HANDLE
FS_LONGNAME_ATTR
FS_MAX_PATH
FS_OPEN_DIR
FS_OPEN_NO_DIR
FS_READ_ONLY
FS_READ_WRITE
HANDLE
UINT
WCHAR
WORD
#define FS_OPEN_DIR 0x00000800L

Overrides flag FS_OPEN_NO_DIR and forces support for opening a directory. Directories can only be opened with read only access.


FS_CREATE

  • FS Type
BYTE
EAT_FS_DOSDateTime
EAT_FS_SEEK_POS_ENUM
EatDisk_enum
FS_ATTR_ARCHIVE
FS_ATTR_DIR
FS_ATTR_HIDDEN
FS_ATTR_READ_ONLY
FS_ATTR_SYSTEM
FS_ATTR_VOLUME
FS_CREATE
FS_CREATE_ALWAYS
FS_HANDLE
FS_LONGNAME_ATTR
FS_MAX_PATH
FS_OPEN_DIR
FS_OPEN_NO_DIR
FS_READ_ONLY
FS_READ_WRITE
HANDLE
UINT
WCHAR
WORD
#define FS_CREATE 0x00010000L

The file is opened for read and write access.


FS_CREATE_ALWAYS

  • FS Type
BYTE
EAT_FS_DOSDateTime
EAT_FS_SEEK_POS_ENUM
EatDisk_enum
FS_ATTR_ARCHIVE
FS_ATTR_DIR
FS_ATTR_HIDDEN
FS_ATTR_READ_ONLY
FS_ATTR_SYSTEM
FS_ATTR_VOLUME
FS_CREATE
FS_CREATE_ALWAYS
FS_HANDLE
FS_LONGNAME_ATTR
FS_MAX_PATH
FS_OPEN_DIR
FS_OPEN_NO_DIR
FS_READ_ONLY
FS_READ_WRITE
HANDLE
UINT
WCHAR
WORD
#define FS_CREATE_ALWAYS 0x00020000L

The file is opened for read and write access.


FS_OPEN_NO_DIR

  • FS Type
BYTE
EAT_FS_DOSDateTime
EAT_FS_SEEK_POS_ENUM
EatDisk_enum
FS_ATTR_ARCHIVE
FS_ATTR_DIR
FS_ATTR_HIDDEN
FS_ATTR_READ_ONLY
FS_ATTR_SYSTEM
FS_ATTR_VOLUME
FS_CREATE
FS_CREATE_ALWAYS
FS_HANDLE
FS_LONGNAME_ATTR
FS_MAX_PATH
FS_OPEN_DIR
FS_OPEN_NO_DIR
FS_READ_ONLY
FS_READ_WRITE
HANDLE
UINT
WCHAR
WORD
#define FS_OPEN_NO_DIR 0x00000400L

The file is opened for read and write access.


WORD

  • FS Type
BYTE
EAT_FS_DOSDateTime
EAT_FS_SEEK_POS_ENUM
EatDisk_enum
FS_ATTR_ARCHIVE
FS_ATTR_DIR
FS_ATTR_HIDDEN
FS_ATTR_READ_ONLY
FS_ATTR_SYSTEM
FS_ATTR_VOLUME
FS_CREATE
FS_CREATE_ALWAYS
FS_HANDLE
FS_LONGNAME_ATTR
FS_MAX_PATH
FS_OPEN_DIR
FS_OPEN_NO_DIR
FS_READ_ONLY
FS_READ_WRITE
HANDLE
UINT
WCHAR
WORD
typedef unsigned short WORD

Type Define


WCHAR

  • FS Type
BYTE
EAT_FS_DOSDateTime
EAT_FS_SEEK_POS_ENUM
EatDisk_enum
FS_ATTR_ARCHIVE
FS_ATTR_DIR
FS_ATTR_HIDDEN
FS_ATTR_READ_ONLY
FS_ATTR_SYSTEM
FS_ATTR_VOLUME
FS_CREATE
FS_CREATE_ALWAYS
FS_HANDLE
FS_LONGNAME_ATTR
FS_MAX_PATH
FS_OPEN_DIR
FS_OPEN_NO_DIR
FS_READ_ONLY
FS_READ_WRITE
HANDLE
UINT
WCHAR
WORD
typedef unsigned short WCHAR


UINT

  • FS Type
BYTE
EAT_FS_DOSDateTime
EAT_FS_SEEK_POS_ENUM
EatDisk_enum
FS_ATTR_ARCHIVE
FS_ATTR_DIR
FS_ATTR_HIDDEN
FS_ATTR_READ_ONLY
FS_ATTR_SYSTEM
FS_ATTR_VOLUME
FS_CREATE
FS_CREATE_ALWAYS
FS_HANDLE
FS_LONGNAME_ATTR
FS_MAX_PATH
FS_OPEN_DIR
FS_OPEN_NO_DIR
FS_READ_ONLY
FS_READ_WRITE
HANDLE
UINT
WCHAR
WORD
typedef unsigned int UINT


BYTE

  • FS Type
BYTE
EAT_FS_DOSDateTime
EAT_FS_SEEK_POS_ENUM
EatDisk_enum
FS_ATTR_ARCHIVE
FS_ATTR_DIR
FS_ATTR_HIDDEN
FS_ATTR_READ_ONLY
FS_ATTR_SYSTEM
FS_ATTR_VOLUME
FS_CREATE
FS_CREATE_ALWAYS
FS_HANDLE
FS_LONGNAME_ATTR
FS_MAX_PATH
FS_OPEN_DIR
FS_OPEN_NO_DIR
FS_READ_ONLY
FS_READ_WRITE
HANDLE
UINT
WCHAR
WORD
typedef unsigned char BYTE


HANDLE

  • FS Type
BYTE
EAT_FS_DOSDateTime
EAT_FS_SEEK_POS_ENUM
EatDisk_enum
FS_ATTR_ARCHIVE
FS_ATTR_DIR
FS_ATTR_HIDDEN
FS_ATTR_READ_ONLY
FS_ATTR_SYSTEM
FS_ATTR_VOLUME
FS_CREATE
FS_CREATE_ALWAYS
FS_HANDLE
FS_LONGNAME_ATTR
FS_MAX_PATH
FS_OPEN_DIR
FS_OPEN_NO_DIR
FS_READ_ONLY
FS_READ_WRITE
HANDLE
UINT
WCHAR
WORD
typedef void* HANDLE


FS_HANDLE

  • FS Type
BYTE
EAT_FS_DOSDateTime
EAT_FS_SEEK_POS_ENUM
EatDisk_enum
FS_ATTR_ARCHIVE
FS_ATTR_DIR
FS_ATTR_HIDDEN
FS_ATTR_READ_ONLY
FS_ATTR_SYSTEM
FS_ATTR_VOLUME
FS_CREATE
FS_CREATE_ALWAYS
FS_HANDLE
FS_LONGNAME_ATTR
FS_MAX_PATH
FS_OPEN_DIR
FS_OPEN_NO_DIR
FS_READ_ONLY
FS_READ_WRITE
HANDLE
UINT
WCHAR
WORD
typedef int FS_HANDLE


EAT_FS_DOSDateTime

  • FS Type
BYTE
EAT_FS_DOSDateTime
EAT_FS_SEEK_POS_ENUM
EatDisk_enum
FS_ATTR_ARCHIVE
FS_ATTR_DIR
FS_ATTR_HIDDEN
FS_ATTR_READ_ONLY
FS_ATTR_SYSTEM
FS_ATTR_VOLUME
FS_CREATE
FS_CREATE_ALWAYS
FS_HANDLE
FS_LONGNAME_ATTR
FS_MAX_PATH
FS_OPEN_DIR
FS_OPEN_NO_DIR
FS_READ_ONLY
FS_READ_WRITE
HANDLE
UINT
WCHAR
WORD
typedef { ... } EAT_FS_DOSDateTime


EAT_FS_SEEK_POS_ENUM

  • FS Type
BYTE
EAT_FS_DOSDateTime
EAT_FS_SEEK_POS_ENUM
EatDisk_enum
FS_ATTR_ARCHIVE
FS_ATTR_DIR
FS_ATTR_HIDDEN
FS_ATTR_READ_ONLY
FS_ATTR_SYSTEM
FS_ATTR_VOLUME
FS_CREATE
FS_CREATE_ALWAYS
FS_HANDLE
FS_LONGNAME_ATTR
FS_MAX_PATH
FS_OPEN_DIR
FS_OPEN_NO_DIR
FS_READ_ONLY
FS_READ_WRITE
HANDLE
UINT
WCHAR
WORD
enum EAT_FS_SEEK_POS_ENUM

FS_Seek Parameter

Enumerator:
EAT_FS_FILE_BEGIN
EAT_FS_FILE_CURRENT
EAT_FS_FILE_END


EatDisk_enum

  • FS Type
BYTE
EAT_FS_DOSDateTime
EAT_FS_SEEK_POS_ENUM
EatDisk_enum
FS_ATTR_ARCHIVE
FS_ATTR_DIR
FS_ATTR_HIDDEN
FS_ATTR_READ_ONLY
FS_ATTR_SYSTEM
FS_ATTR_VOLUME
FS_CREATE
FS_CREATE_ALWAYS
FS_HANDLE
FS_LONGNAME_ATTR
FS_MAX_PATH
FS_OPEN_DIR
FS_OPEN_NO_DIR
FS_READ_ONLY
FS_READ_WRITE
HANDLE
UINT
WCHAR
WORD
enum EatDisk_enum
Enumerator:
EAT_FS

internal file system

EAT_EXTERN

extern file system,fo rexample SD card

EAT_NONE_DRIVE


MEMORY

Modules
MEMORY

Modules

MEMORY Function

Detailed Description

This module offers the MEMORY operation API and type defination.

Author
JinGuangBo guang.nosp@m.bo.j.nosp@m.in@si.nosp@m.m.co.nosp@m.m
Date
2012/09/24
   Copyright (C) 2002-2012 Shanghai SIMCom Wireless Solutions Ltd.

   All rights reserved.


MEMORY Function

Variables
MEMORY Function
MEMORY

Variables

eat_bool(*const | eat_mem_init )(void *mem_addr, unsigned int size)
void *(*const | eat_mem_alloc )(unsigned int size)
void *(*const | eat_mem_free )(void *mem_addr)

Detailed Description

MEMORY funtion declaration.


eat_mem_init

  • MEMORY Function
eat_mem_alloc
eat_mem_free
eat_mem_init
eat_bool(* const eat_mem_init)(void *mem_addr, unsigned int size)

Initializes a piece of memory space.Then use function eat_mem_alloc() and eat_mem_free() to malloc and free memory space.

Parameters
[in] | *mem_addr | Starting memory address to be initialized
[in] | size | Memory size
Returns
Returns | Meaning
EAT_TRUE | Memory initialization success
EAT_FALSE | Memory initialization failed. Check whether initialized memory space is too large, more than residual memory size
Attention
Pay special attention please, this function can only be called once. If return value success, do not call it again,otherwise, the previous initialization space will be tied up at the same time can not be used
Header
#include "eat_mem.h"
Example
#include "eat_mem.h"
#define DYNAMIC_MEM_SIZE 1024*400
static unsigned char app_dynic_mem_test[DYNAMIC_MEM_SIZE];
void* mem_prt=EAT_NULL;
eat_bool mem_ini_flag=EAT_FALSE;
void eat_mem_test( void )
{
int size=100;
/*memory space initialize*/
if( EAT_FALSE == mem_ini_flag)
{
mem_ini_flag = eat_mem_init(app_dynic_mem_test, sizeof(app_dynic_mem_test));
if(EAT_TRUE == mem_ini_flag)
{
eat_trace("eat_mem_init() P\n");
}else
{
eat_trace("eat_mem_init() F\n");
}
}else
{
eat_trace("eat mem init already \n");
}
/*malloc space*/
mem_prt = eat_mem_alloc( size );
if(EAT_NULL == mem_prt)
{
eat_trace("eat_mem_alloc() F\n");
}else
{
eat_trace("eat_mem_alloc() size =%d\n",size);
}
/*free space*/
if(EAT_NULL != mem_prt)
{
/*set pointer NULL avoid free second time*/
eat_mem_free(mem_prt);
if(EAT_NULL !=mem_prt)
{
mem_prt = EAT_NULL;
eat_trace("eat_mem_free() P ");
}
}
}
Returns
eat_mem_init() P
eat_mem_alloc() size =100
eat_mem_free() P


eat_mem_alloc

  • MEMORY Function
eat_mem_alloc
eat_mem_free
eat_mem_init
void*(* const eat_mem_alloc)(unsigned int size)

Allocates memory space.

Parameters
[in] size Memory space size to allocate (byte unit)
Returns
void * Starting, address of the memory space. Failed, if the return value equals EAT_NULL
Attention
call this function after eat_mem_init()
Header
#include "eat_mem.h"
Example
See the example for eat_mem_init.


eat_mem_free

  • MEMORY Function
eat_mem_alloc
eat_mem_free
eat_mem_init
void*(* const eat_mem_free)(void *mem_addr)

Frees a memory space.

Parameters
[in] *mem_addr The starting address of the memory space to be released
Returns
void *, EAT_NULL always this value, ignore it
Attention
call this function after eat_mem_alloc()
Header
#include "eat_mem.h"
Example
See the example for eat_mem_init.


MODEM

Modules
MODEM

Modules

Modem Type
Modem Function

Detailed Description

This module offers the MODEM operation API and type defination.

Author
Maobin bin.m.nosp@m.ao@s.nosp@m.im.co.nosp@m.m
Date
2012/09/24
  Copyright (C) 2002-2012 Shanghai SIMCom Wireless Solutions Ltd.

  All rights reserved.


Modem Type

Data Structures
Modem Type
MODEM

Data Structures

struct EatMdmRi_st

Detailed Description

Modem type defination.


EatMdmRi_st Struct Reference

Data Fields
EatMdmRi_st Struct Reference
Modem Type

Data Fields

unsigned char level

Detailed Description

Modem Ring level


EatMdmRi_st::level

  • EatMdmRi_st
level
unsigned char EatMdmRi_st::level

0 - low; 1- high


Modem Function

Variables
Modem Function
MODEM

Variables

unsigned short(*const | eat_modem_write )(const unsigned char *data, unsigned short len)
unsigned short(*const | eat_modem_read )(unsigned char *data, unsigned short len)

Detailed Description

Modem funtion declaration.


eat_modem_write

  • Modem Function
eat_modem_read
eat_modem_write
unsigned short(* const eat_modem_write)(const unsigned char *data, unsigned short len)

Sends data to Core(Modem).

Parameters
[in] | data | unsigned char ,the pointer of sending buffer
[in] | len | unsigned short ,the length of sending data
Returns
unsigned short,the number of bytes actually written
Attention
  1. If the return length is less than "len",means core receiving buffer is already full, until received EAT_EVENT_MDM_READY_WR signal can continue to send.
  2. The Core receiving buffer is 5KB
Header
#include "eat_modem.h"
Example
#include "eat_interface.h"
#include "eat_modem.h"
extern void APP_InitRegions(void);
char uart_buf[2048] = {0};
void app_main(void *data)
{
u16 len, l;
EatEvent_st event;
APP_InitRegions();//Init app RAM
sprintf(uart_buf,"AT\r\n");
l = strlen(uart_buf);
len = eat_modem_write(uart_buf, l);
if(len != l)
{
eat_trace("Write to modem return len:%d", len);
}
while(EAT_TRUE)
{
eat_get_event(&event);
eat_trace("MSG id%x", event.event);
switch(event.event)
{
case EAT_EVENT_MDM_READY_RD:
{
len = eat_modem_read(uart_buf, 2048);
if(len != 0)
{
uart_buf[len] = '\0';
eat_trace("Read from modem: %s", uart_buf);
}else
{
eat_trace("Read modem fail!", eat_uart_main);
}
}
break;
case EAT_EVENT_MDM_READY_WR:
{
eat_trace("event :%s,can continue to write to modem", "EAT_EVENT_MDM_READY_WR");
}
break;
case EAT_EVENT_MDM_RI:
{
eat_trace("Ring level", event.data.mdm_ri);
}
break;
default:
break;
}
}
}


eat_modem_read

  • Modem Function
eat_modem_read
eat_modem_write
unsigned short(* const eat_modem_read)(unsigned char *data, unsigned short len)

Reads data from Core(Modem).

Parameters
[out] | data | unsigned char ,the pointer of receiving buffer
[in] | len | unsigned short ,the maximum number of bytes to read
Returns
unsigned short,the number of bytes read
Attention
The Core sending buffer is 5KB
Header
#include "eat_modem.h"
Example
See the example for eat_modem_write.


PERIPHERY

Modules
PERIPHERY

Modules

Periphery Type
Periphery Function

Detailed Description

This module offers the Periphery operation API and type defination.

Author
Fangshengchang sheng.nosp@m.chan.nosp@m.g.fan.nosp@m.g@si.nosp@m.m.com
Date
2012/09/26
   Copyright (C) 2002-2012 Shanghai SIMCom Wireless Solutions Ltd.

   All rights reserved.


Periphery Type
PERIPHERY

Data Structures

struct | EatKey_st
struct | EatInt_st
struct | EatAdc_st

Enumerations

enum EatPinName_enum {
EAT_PIN6_ADC0 = 6,
EAT_PIN8_GPIO1 = 8,
EAT_PIN9_I2C_SDA = 9,
EAT_PIN10_I2C_SCL = 10,
EAT_PIN11_KPLED = 11,
EAT_PIN16_NETLIGHT = 16,
EAT_PIN28_GPIO2 = 28,
EAT_PIN29_KBC5 = 29,
EAT_PIN30_KBC4 = 30,
EAT_PIN31_KBC3 = 31,
EAT_PIN32_KBC2 = 32,
EAT_PIN33_KBC1 = 33,
EAT_PIN34_KBC0 = 34,
EAT_PIN35_KBR5 = 35,
EAT_PIN36_KBR4 = 36,
EAT_PIN37_KBR3 = 37,
EAT_PIN38_KBR2 = 38,
EAT_PIN39_KBR1 = 39,
EAT_PIN40_KBR0 = 40,
EAT_PIN45_GPIO3 = 45,
EAT_PIN46_DISP_DATA = 46,
EAT_PIN47_DISP_CLK = 47,
EAT_PIN48_DISP_RST = 48,
EAT_PIN49_DISP_DC = 49,
EAT_PIN50_DISP_CS = 50,
EAT_PIN51_VDD_EXT = 51,
EAT_PIN52_PCM_SYNC = 52,
EAT_PIN53_PCM_IN = 53,
EAT_PIN54_PCM_CLK = 54,
EAT_PIN55_PCM_OUT = 55,
EAT_PIN57_GPIO4 = 57,
EAT_PIN58_RXD3 = 58,
EAT_PIN59_TXD3 = 59,
EAT_PIN60_RXD = 60,
EAT_PIN61_TXD = 61,
EAT_PIN62_DBG_RXD = 62,
EAT_PIN63_DBG_TXD = 63,
EAT_PIN65_LCD_LIGHT = 65,
EAT_PIN_NUM = 68
}
enum EatKey_enum {
EAT_KEY_C0R0,
EAT_KEY_C0R1,
EAT_KEY_C0R2,
EAT_KEY_C0R3,
EAT_KEY_C0R4,
EAT_KEY_C0R5,
EAT_KEY_C1R0,
EAT_KEY_C1R1,
EAT_KEY_C1R2,
EAT_KEY_C1R3,
EAT_KEY_C1R4,
EAT_KEY_C1R5,
EAT_KEY_C2R0,
EAT_KEY_C2R1,
EAT_KEY_C2R2,
EAT_KEY_C2R3,
EAT_KEY_C2R4,
EAT_KEY_C2R5,
EAT_KEY_C3R0,
EAT_KEY_C3R1,
EAT_KEY_C3R2,
EAT_KEY_C3R3,
EAT_KEY_C3R4,
EAT_KEY_C3R5,
EAT_KEY_C4R0,
EAT_KEY_C4R1,
EAT_KEY_C4R2,
EAT_KEY_C4R3,
EAT_KEY_C4R4,
EAT_KEY_C4R5,
EAT_KEY_C5R0,
EAT_KEY_C5R1,
EAT_KEY_C5R2,
EAT_KEY_C5R3,
EAT_KEY_C5R4,
EAT_KEY_C5R5,
EAT_KEY_POWER,
EAT_KEY_NUM
}
enum EatGpioLevel_enum {
EAT_GPIO_LEVEL_LOW,
EAT_GPIO_LEVEL_HIGH
}
enum EatGpioDir_enum {
EAT_GPIO_DIR_INPUT,
EAT_GPIO_DIR_OUTPUT
}
enum EatIntTrigger_enum {
EAT_INT_TRIGGER_HIGH_LEVEL,
EAT_INT_TRIGGER_LOW_LEVEL,
EAT_INT_TRIGGER_RISING_EDGE,
EAT_INT_TRIGGER_FALLING_EDGE,
EAT_INT_TRIGGER_NUM
}
enum EatSpiWire_enum {
EAT_SPI_3WIRE,
EAT_SPI_4WIRE
}
enum EatSpiClk_enum {
EAT_SPI_CLK_52M = 1,
EAT_SPI_CLK_26M = 2,
EAT_SPI_CLK_13M = 4
}
enum EatSpiBit_enum {
EAT_SPI_BIT8,
EAT_SPI_BIT9,
EAT_SPI_BIT16,
EAT_SPI_BIT24,
EAT_SPI_BIT32
}
enum EatPinMode_enum {
EAT_PIN_MODE_GPIO,
EAT_PIN_MODE_KEY,
EAT_PIN_MODE_EINT,
EAT_PIN_MODE_UART,
EAT_PIN_MODE_SPI,
EAT_PIN_MODE_PWM,
EAT_PIN_MODE_I2C,
EAT_PIN_MODE_CLK,
EAT_PIN_MODE_NUM
}

Detailed Description

Periphery Pin type defination.


EatKey_st Struct Reference

Data Fields
EatKey_st Struct Reference
Periphery Type

Data Fields

EatKey_enum key_value
eat_bool is_pressed

Detailed Description

EAT KEY configuration structure.


EatKey_st::key_value

  • EatKey_st
is_pressed
key_value
EatKey_enum EatKey_st::key_value

key value


EatKey_st::is_pressed

  • EatKey_st
is_pressed
key_value
eat_bool EatKey_st::is_pressed

1-key press down; 0-key release up


EatInt_st Struct Reference

Data Fields
EatInt_st Struct Reference
Periphery Type

Data Fields

EatPinName_enum pin
EatGpioLevel_enum level

Detailed Description

EAT INT configuration structure.


EatInt_st::pin

  • EatInt_st
level
pin
EatPinName_enum EatInt_st::pin

the pin


EatInt_st::level

  • EatInt_st
level
pin
EatGpioLevel_enum EatInt_st::level

1-high level; 0-low level


EatAdc_st Struct Reference

Data Fields
EatAdc_st Struct Reference
Periphery Type

Data Fields

EatPinName_enum pin
unsigned int v

Detailed Description

EAT ADC configuration structure.


EatAdc_st::pin

  • EatAdc_st
pin
v
EatPinName_enum EatAdc_st::pin

the pin


EatAdc_st::v

  • EatAdc_st
pin
v
unsigned int EatAdc_st::v

ADC value,unit is mv


EatPinName_enum

  • Periphery Type
EatGpioDir_enum
EatGpioLevel_enum
EatIntTrigger_enum
EatKey_enum
EatPinMode_enum
EatPinName_enum
EatSpiBit_enum
EatSpiClk_enum
EatSpiWire_enum
enum EatPinName_enum

This enumerate all the Periphery Pin!

Enumerator:
EAT_PIN6_ADC0

ADC

EAT_PIN8_GPIO1

GPIO

EAT_PIN9_I2C_SDA

GPIO, KEY_ROW, EINT, I2C_SDA

EAT_PIN10_I2C_SCL

GPIO, KEY_COL, I2C_SCL

EAT_PIN11_KPLED

KPLED

EAT_PIN16_NETLIGHT

GPIO, PWM

EAT_PIN28_GPIO2

GPIO, EINT

EAT_PIN29_KBC5

GPIO, KEY_COL, EINT

EAT_PIN30_KBC4

GPIO, KEY_COL

EAT_PIN31_KBC3

GPIO, KEY_COL

EAT_PIN32_KBC2

GPIO, KEY_COL

EAT_PIN33_KBC1

GPIO, KEY_COL

EAT_PIN34_KBC0

GPIO, KEY_COL

EAT_PIN35_KBR5

GPIO, KEY_ROW, EINT

EAT_PIN36_KBR4

GPIO, KEY_ROW

EAT_PIN37_KBR3

GPIO, KEY_ROW

EAT_PIN38_KBR2

GPIO, KEY_ROW

EAT_PIN39_KBR1

GPIO, KEY_ROW

EAT_PIN40_KBR0

GPIO, KEY_ROW, SPI_LSDI

EAT_PIN45_GPIO3

GPIO, EINT

EAT_PIN46_DISP_DATA

GPIO, SPI_LSDA

EAT_PIN47_DISP_CLK

GPIO, SPI_SCK

EAT_PIN48_DISP_RST

GPIO

EAT_PIN49_DISP_DC

GPIO, KEY_ROW, SPI_LSA

EAT_PIN50_DISP_CS

GPIO, SPI_LSCE

EAT_PIN51_VDD_EXT

VDD_EXT

EAT_PIN52_PCM_SYNC

GPIO

EAT_PIN53_PCM_IN

GPIO

EAT_PIN54_PCM_CLK

GPIO

EAT_PIN55_PCM_OUT

GPIO

EAT_PIN57_GPIO4

GPIO, KEY_COL, EINT

EAT_PIN58_RXD3

GPIO, UART3

EAT_PIN59_TXD3

GPIO, UART3

EAT_PIN60_RXD

UART1

EAT_PIN61_TXD

UART1

EAT_PIN62_DBG_RXD

GPIO, UART2

EAT_PIN63_DBG_TXD

GPIO, UART2

EAT_PIN65_LCD_LIGHT

LCD_LIGTH

EAT_PIN_NUM


EatKey_enum

  • Periphery Type
EatGpioDir_enum
EatGpioLevel_enum
EatIntTrigger_enum
EatKey_enum
EatPinMode_enum
EatPinName_enum
EatSpiBit_enum
EatSpiClk_enum
EatSpiWire_enum
enum EatKey_enum

This enumerate all the Key Value !

Enumerator:
EAT_KEY_C0R0
EAT_KEY_C0R1
EAT_KEY_C0R2
EAT_KEY_C0R3
EAT_KEY_C0R4
EAT_KEY_C0R5
EAT_KEY_C1R0
EAT_KEY_C1R1
EAT_KEY_C1R2
EAT_KEY_C1R3
EAT_KEY_C1R4
EAT_KEY_C1R5
EAT_KEY_C2R0
EAT_KEY_C2R1
EAT_KEY_C2R2
EAT_KEY_C2R3
EAT_KEY_C2R4
EAT_KEY_C2R5
EAT_KEY_C3R0
EAT_KEY_C3R1
EAT_KEY_C3R2
EAT_KEY_C3R3
EAT_KEY_C3R4
EAT_KEY_C3R5
EAT_KEY_C4R0
EAT_KEY_C4R1
EAT_KEY_C4R2
EAT_KEY_C4R3
EAT_KEY_C4R4
EAT_KEY_C4R5
EAT_KEY_C5R0
EAT_KEY_C5R1
EAT_KEY_C5R2
EAT_KEY_C5R3
EAT_KEY_C5R4
EAT_KEY_C5R5
EAT_KEY_POWER
EAT_KEY_NUM


EatGpioLevel_enum

  • Periphery Type
EatGpioDir_enum
EatGpioLevel_enum
EatIntTrigger_enum
EatKey_enum
EatPinMode_enum
EatPinName_enum
EatSpiBit_enum
EatSpiClk_enum
EatSpiWire_enum
enum EatGpioLevel_enum

GPIO LEVEL type.

Enumerator:
EAT_GPIO_LEVEL_LOW

low level

EAT_GPIO_LEVEL_HIGH

high levle


EatGpioDir_enum

  • Periphery Type
EatGpioDir_enum
EatGpioLevel_enum
EatIntTrigger_enum
EatKey_enum
EatPinMode_enum
EatPinName_enum
EatSpiBit_enum
EatSpiClk_enum
EatSpiWire_enum
enum EatGpioDir_enum

GPIO MODE type.

Enumerator:
EAT_GPIO_DIR_INPUT

input

EAT_GPIO_DIR_OUTPUT

output


EatIntTrigger_enum

  • Periphery Type
EatGpioDir_enum
EatGpioLevel_enum
EatIntTrigger_enum
EatKey_enum
EatPinMode_enum
EatPinName_enum
EatSpiBit_enum
EatSpiClk_enum
EatSpiWire_enum
enum EatIntTrigger_enum

The GPIO EINT trigger mode.

Enumerator:
EAT_INT_TRIGGER_HIGH_LEVEL

high level

EAT_INT_TRIGGER_LOW_LEVEL

low level

EAT_INT_TRIGGER_RISING_EDGE

rising edge

EAT_INT_TRIGGER_FALLING_EDGE

falling edge

EAT_INT_TRIGGER_NUM


EatSpiWire_enum

  • Periphery Type
EatGpioDir_enum
EatGpioLevel_enum
EatIntTrigger_enum
EatKey_enum
EatPinMode_enum
EatPinName_enum
EatSpiBit_enum
EatSpiClk_enum
EatSpiWire_enum
enum EatSpiWire_enum

SPI Wire type.

Enumerator:
EAT_SPI_3WIRE

3 wire SPI

EAT_SPI_4WIRE

4 wire SPI


EatSpiClk_enum

  • Periphery Type
EatGpioDir_enum
EatGpioLevel_enum
EatIntTrigger_enum
EatKey_enum
EatPinMode_enum
EatPinName_enum
EatSpiBit_enum
EatSpiClk_enum
EatSpiWire_enum
enum EatSpiClk_enum

SPI Clock type.

Enumerator:
EAT_SPI_CLK_52M

52M clock

EAT_SPI_CLK_26M

26M clock

EAT_SPI_CLK_13M

13M clock


EatSpiBit_enum

  • Periphery Type
EatGpioDir_enum
EatGpioLevel_enum
EatIntTrigger_enum
EatKey_enum
EatPinMode_enum
EatPinName_enum
EatSpiBit_enum
EatSpiClk_enum
EatSpiWire_enum
enum EatSpiBit_enum

SPI Bit type.

Enumerator:
EAT_SPI_BIT8

8 bit

EAT_SPI_BIT9

9 bit

EAT_SPI_BIT16

16 bit

EAT_SPI_BIT24

24 bit

EAT_SPI_BIT32

32 bit


EatPinMode_enum

  • Periphery Type
EatGpioDir_enum
EatGpioLevel_enum
EatIntTrigger_enum
EatKey_enum
EatPinMode_enum
EatPinName_enum
EatSpiBit_enum
EatSpiClk_enum
EatSpiWire_enum
enum EatPinMode_enum

EAT pin mode.

Enumerator:
EAT_PIN_MODE_GPIO

GPIO ENUM

EAT_PIN_MODE_KEY

KEY ENUM

EAT_PIN_MODE_EINT

EINT ENUM

EAT_PIN_MODE_UART

UART ENUM

EAT_PIN_MODE_SPI

SPI ENUM

EAT_PIN_MODE_PWM

PWM ENUM

EAT_PIN_MODE_I2C

I2C ENUM

EAT_PIN_MODE_CLK

CLK ENUM

EAT_PIN_MODE_NUM


Periphery Function
PERIPHERY

Typedefs

typedef void(* | eat_gpio_int_callback_func )(EatInt_st *interrupt)
typedef void(* | eat_adc_callback_func )(EatAdc_st *adc)

Variables

eat_bool(*const | eat_gpio_setup )(EatPinName_enum pin, EatGpioDir_enum dir, EatGpioLevel_enum level)
eat_bool(*const | eat_gpio_write )(EatPinName_enum pin, EatGpioLevel_enum level)
eat_bool(*const | eat_gpio_write_ext )(EatPinName_enum pin, EatGpioLevel_enum level)
EatGpioLevel_enum(*const | eat_gpio_read )(EatPinName_enum pin)
eat_bool(*const | eat_pin_set_mode )(EatPinName_enum pin, EatPinMode_enum mode)
eat_bool(*const | eat_int_setup )(EatPinName_enum pin, EatIntTrigger_enum trigger, unsigned int debounce_ms, eat_gpio_int_callback_func callback)
eat_bool(*const | eat_int_set_trigger )(EatPinName_enum pin, EatIntTrigger_enum trigger)
eat_bool(*const | eat_spi_init )(EatSpiClk_enum clk, EatSpiWire_enum wire, EatSpiBit_enum bit, eat_bool enable_SDI, eat_bool enable_cs)
eat_bool(*const | eat_spi_write )(const unsigned char *data, unsigned char len, eat_bool is_command)
unsigned char(*const | eat_spi_read )(unsigned char *data, unsigned char len)
void(*const | eat_lcd_light_sw )(eat_bool sw)
void(*const | eat_kpled_sw )(eat_bool sw)
eat_bool(*const | eat_adc_get )(EatPinName_enum pin, unsigned int period, eat_adc_callback_func callback)
void(*const | eat_pwm_start )(unsigned int freq, unsigned char duty)
void(*const | eat_pwm_stop )()
void(*const | eat_poweroff_key_sw )(eat_bool sw)

Detailed Description

Periphery funtion declaration.


eat_gpio_int_callback_func

  • Periphery Function
eat_adc_callback_func
eat_adc_get
eat_gpio_int_callback_func
eat_gpio_read
eat_gpio_setup
eat_gpio_write
eat_gpio_write_ext
eat_int_set_trigger
eat_int_setup
eat_kpled_sw
eat_lcd_light_sw
eat_pin_set_mode
eat_poweroff_key_sw
eat_pwm_start
eat_pwm_stop
eat_spi_init
eat_spi_read
eat_spi_write
typedef void(* eat_gpio_int_callback_func)(EatInt_st *interrupt)

The callback function of the eat_int_setup.

Parameters
[in] interrupt The EatInt_st struct point.
Returns
No returen value (void).
Header
#include "eat_periphery.h"
Example
See the example for eat_int_setup.


eat_adc_callback_func

  • Periphery Function
eat_adc_callback_func
eat_adc_get
eat_gpio_int_callback_func
eat_gpio_read
eat_gpio_setup
eat_gpio_write
eat_gpio_write_ext
eat_int_set_trigger
eat_int_setup
eat_kpled_sw
eat_lcd_light_sw
eat_pin_set_mode
eat_poweroff_key_sw
eat_pwm_start
eat_pwm_stop
eat_spi_init
eat_spi_read
eat_spi_write
typedef void(* eat_adc_callback_func)(EatAdc_st *adc)

The callback function of the eat_adc_get.

Parameters
[in] adc The EatAdc_st struct point.
Returns
No returen value (void)
Header
#include "eat_periphery.h"
Example
See the example for eat_adc_get.


eat_gpio_setup

  • Periphery Function
eat_adc_callback_func
eat_adc_get
eat_gpio_int_callback_func
eat_gpio_read
eat_gpio_setup
eat_gpio_write
eat_gpio_write_ext
eat_int_set_trigger
eat_int_setup
eat_kpled_sw
eat_lcd_light_sw
eat_pin_set_mode
eat_poweroff_key_sw
eat_pwm_start
eat_pwm_stop
eat_spi_init
eat_spi_read
eat_spi_write
eat_bool(* const eat_gpio_setup)(EatPinName_enum pin, EatGpioDir_enum dir, EatGpioLevel_enum level)

Sets the pin as gpio mode.

Parameters
[in] | pin | The pin want to set,please see EatPinName_enum.
[in] | dir | The input or output mode want to set,please see EatGpioDir_enum.
[in] | level | The level want to set,please see EatGpioLevel_enum.
Returns
EAT_TRUE if success, otherwise EAT_FALSE.
Returns | Meaning
EAT_TRUE | success
EAT_FALSE | errors
Header
#include "eat_periphery.h"
Example
eat_gpio_setup(EAT_PIN52_PCM_SYNC,EAT_GPIO_DIR_OUTPUT, EAT_GPIO_LEVEL_LOW);


eat_gpio_write

  • Periphery Function
eat_adc_callback_func
eat_adc_get
eat_gpio_int_callback_func
eat_gpio_read
eat_gpio_setup
eat_gpio_write
eat_gpio_write_ext
eat_int_set_trigger
eat_int_setup
eat_kpled_sw
eat_lcd_light_sw
eat_pin_set_mode
eat_poweroff_key_sw
eat_pwm_start
eat_pwm_stop
eat_spi_init
eat_spi_read
eat_spi_write
eat_bool(* const eat_gpio_write)(EatPinName_enum pin, EatGpioLevel_enum level)

Sets the level of the pin.

Parameters
[in] | pin | The pin want to set,please see EatPinName_enum.
[in] | level | The level want to set,please see EatGpioLevel_enum.
Returns
EAT_TRUE if success, otherwise EAT_FALSE.
Header
#include "eat_periphery.h"
Example
eat_gpio_write(EAT_PIN52_PCM_SYNC, EAT_GPIO_LEVEL_HIGH);


eat_gpio_write_ext

  • Periphery Function
eat_adc_callback_func
eat_adc_get
eat_gpio_int_callback_func
eat_gpio_read
eat_gpio_setup
eat_gpio_write
eat_gpio_write_ext
eat_int_set_trigger
eat_int_setup
eat_kpled_sw
eat_lcd_light_sw
eat_pin_set_mode
eat_poweroff_key_sw
eat_pwm_start
eat_pwm_stop
eat_spi_init
eat_spi_read
eat_spi_write
eat_bool(* const eat_gpio_write_ext)(EatPinName_enum pin, EatGpioLevel_enum level)

Sets the level of the pin.

Parameters
[in] | pin | The pin want to set,please see EatPinName_enum.
[in] | level | The level want to set,please see EatGpioLevel_enum.
Returns
EAT_TRUE if success, otherwise EAT_FALSE.
Header
#include "eat_periphery.h"
Example
eat_gpio_write_ext(EAT_PIN53_PCM_IN, EAT_GPIO_LEVEL_HIGH);


eat_gpio_read

  • Periphery Function
eat_adc_callback_func
eat_adc_get
eat_gpio_int_callback_func
eat_gpio_read
eat_gpio_setup
eat_gpio_write
eat_gpio_write_ext
eat_int_set_trigger
eat_int_setup
eat_kpled_sw
eat_lcd_light_sw
eat_pin_set_mode
eat_poweroff_key_sw
eat_pwm_start
eat_pwm_stop
eat_spi_init
eat_spi_read
eat_spi_write
EatGpioLevel_enum(* const eat_gpio_read)(EatPinName_enum pin)

Reads the GPIO Level.

Parameters
[in] pin The pin wan to write to read,please see EatPinName_enum.
Returns
EAT_GPIO_LEVEL_LOW the low Level, EAT_GPIO_LEVEL_HIGH the high Level.
Returns | Meaning
EAT_GPIO_LEVEL_LOW | low Level
EAT_GPIO_LEVEL_HIGH | high Level
Header
#include "eat_periphery.h"
Example
EatGpioLevel_enum gpio_level;
gpio_level = eat_gpio_read (EAT_PIN52_PCM_SYNC);


eat_pin_set_mode

  • Periphery Function
eat_adc_callback_func
eat_adc_get
eat_gpio_int_callback_func
eat_gpio_read
eat_gpio_setup
eat_gpio_write
eat_gpio_write_ext
eat_int_set_trigger
eat_int_setup
eat_kpled_sw
eat_lcd_light_sw
eat_pin_set_mode
eat_poweroff_key_sw
eat_pwm_start
eat_pwm_stop
eat_spi_init
eat_spi_read
eat_spi_write
eat_bool(* const eat_pin_set_mode)(EatPinName_enum pin, EatPinMode_enum mode)

Sets the mode of the pin :

Parameters
[in] | pin | The pin The pin want to set
[in] | mode | The pin The mode want to set
Returns
EAT_TRUE if success, otherwise EAT_FALSE.
Header
#include "eat_periphery.h"
Example
eat_pin_set_mode(EAT_PIN40_KBR0, EAT_PIN_MODE_KEY);


eat_int_setup

  • Periphery Function
eat_adc_callback_func
eat_adc_get
eat_gpio_int_callback_func
eat_gpio_read
eat_gpio_setup
eat_gpio_write
eat_gpio_write_ext
eat_int_set_trigger
eat_int_setup
eat_kpled_sw
eat_lcd_light_sw
eat_pin_set_mode
eat_poweroff_key_sw
eat_pwm_start
eat_pwm_stop
eat_spi_init
eat_spi_read
eat_spi_write
eat_bool(* const eat_int_setup)(EatPinName_enum pin, EatIntTrigger_enum trigger, unsigned int debounce_ms, eat_gpio_int_callback_func callback)

Sets the pin as interrupt mode.

Parameters
[in] | pin | The interrupt pin want to set,please see EatPinName_enum
[in] | trigger | The trigger mode want to set,please see EatIntTrigger_enum
[in] | debounce_ms | The debounce ,uint is 10ms,such as debounce_ms:10 means about 100ms.
[in] | callback | The callback function,if NULL,will send EAT_EVENT_INT to App when EINT triggered.if not NULL,will call the callback function when EINT triggered.
Returns
EAT_TRUE if success, otherwise EAT_FALSE.
Header
#include "eat_periphery.h"
Example
#include "eat_periphery.h"
#include "eat_interface.h"
void test_handler_int(EatInt_st *interrupt)
{
if(interrupt->level)
{
//set low level trigger
eat_int_set_trigger(EAT_PIN45_GPIO3, EAT_INT_TRIGGER_LOW_LEVEL);
eat_trace("System interrupt by PIN%d TRIGGER_HIGH_LEVEL",interrupt->pin);
}else
{
//set high level trigger
eat_int_set_trigger(EAT_PIN45_GPIO3, EAT_INT_TRIGGER_HIGH_LEVEL);
eat_trace("System interrupt by PIN%d TRIGGER_LOW_LEVEL",interrupt->pin);
}
}
void test_handler_event(EatPinName_enum pin, EatGpioLevel_enum level)
{
if(level)
{
eat_int_set_trigger(EAT_PIN45_GPIO3, EAT_INT_TRIGGER_FALLING_EDGE);
eat_trace("System interrupt by PIN%d TRIGGER_RISING_EDGE",pin);
}else
{
eat_int_set_trigger(EAT_PIN45_GPIO3, EAT_INT_TRIGGER_FALLING_EDGE);
eat_trace("System interrupt by PIN%d TRIGGER_FALLING_EDGE",pin);
}
}
typedef void (*app_user_func)(void*);
void app_main(void *data)
{
EatEvent_st event;
APP_InitRegions();//Init app RAM
eat_trace(" app_main ENTRY");
eat_gpio_setup(EAT_PIN45_GPIO3, EAT_GPIO_DIR_INPUT, EAT_GPIO_LEVEL_LOW);
eat_gpio_setup(EAT_PIN57_GPIO4, EAT_GPIO_DIR_INPUT, EAT_GPIO_LEVEL_LOW);
// register int
eat_int_setup(EAT_PIN45_GPIO3, EAT_INT_TRIGGER_LOW_LEVEL, 10, test_handler_int);
eat_int_setup(EAT_PIN57_GPIO4, EAT_INT_TRIGGER_RISING_EDGE, 10, NULL);
while(EAT_TRUE)
{
eat_get_event(&event);
eat_trace("MSG id%x", event.event);
if (event.event == EAT_EVENT_NULL || event.event >= EAT_EVENT_NUM)
{
eat_trace("[%s] invalid event type", __FUNCTION__, event.event);
continue;
}
switch(event.event)
{
case EAT_EVENT_INT :
{
//GPIO INT EVENT
test_handler_event(event.data.interrupt.level);
}
break;
case EAT_EVENT_MDM_READY_WR:
case EAT_EVENT_UART_READY_RD:
break;
case EAT_EVENT_UART_SEND_COMPLETE :
break;
default:
break;
}
}
}


eat_int_set_trigger

  • Periphery Function
eat_adc_callback_func
eat_adc_get
eat_gpio_int_callback_func
eat_gpio_read
eat_gpio_setup
eat_gpio_write
eat_gpio_write_ext
eat_int_set_trigger
eat_int_setup
eat_kpled_sw
eat_lcd_light_sw
eat_pin_set_mode
eat_poweroff_key_sw
eat_pwm_start
eat_pwm_stop
eat_spi_init
eat_spi_read
eat_spi_write
eat_bool(* const eat_int_set_trigger)(EatPinName_enum pin, EatIntTrigger_enum trigger)

Sets the trigger mode of the interrupt.

Parameters
[in] | pin | The interrupt pin want to set,please see EatPinName_enum.
[in] | trigger | The trigger mode want to set,please see EatIntTrigger_enum.
Returns
EAT_TRUE if success, otherwise EAT_FALSE.
Header
#include "eat_periphery.h"
Example
eat_int_set_trigger(EAT_PIN45_GPIO3, EAT_INT_TRIGGER_RISING_EDGE);


eat_spi_init

  • Periphery Function
eat_adc_callback_func
eat_adc_get
eat_gpio_int_callback_func
eat_gpio_read
eat_gpio_setup
eat_gpio_write
eat_gpio_write_ext
eat_int_set_trigger
eat_int_setup
eat_kpled_sw
eat_lcd_light_sw
eat_pin_set_mode
eat_poweroff_key_sw
eat_pwm_start
eat_pwm_stop
eat_spi_init
eat_spi_read
eat_spi_write
eat_bool(* const eat_spi_init)(EatSpiClk_enum clk, EatSpiWire_enum wire, EatSpiBit_enum bit, eat_bool enable_SDI, eat_bool enable_cs)

Initializes the SPI.

Parameters
[in] | clk | The freg of the DISP_CLK pin,you can also turn down,please see EatSpiClk_enum.
[in] | wire | Connect mode,4 wire will use DISP_CS pin,3 wire not use,please see EatSpiWire_enum.
[in] | bit | The transmit speed,please see EatSpiBit_enum.
[in] | enable_SDI | Whether use KBR0 pin as SDI.
[in] | enable_cs | Whether use DISP_CS control when read or write SPI,if not,can control by APP.
Returns
EAT_TRUE if success, otherwise EAT_FALSE.
Header
#include "eat_periphery.h"
Example
void eat_periphery_init()
{
eat_spi_init(EAT_SPI_CLK_13M, EAT_SPI_4WIRE,EAT_SPI_BIT8, EAT_FALSE, EAT_TRUE);
}


eat_spi_write

  • Periphery Function
eat_adc_callback_func
eat_adc_get
eat_gpio_int_callback_func
eat_gpio_read
eat_gpio_setup
eat_gpio_write
eat_gpio_write_ext
eat_int_set_trigger
eat_int_setup
eat_kpled_sw
eat_lcd_light_sw
eat_pin_set_mode
eat_poweroff_key_sw
eat_pwm_start
eat_pwm_stop
eat_spi_init
eat_spi_read
eat_spi_write
eat_bool(* const eat_spi_write)(const unsigned char *data, unsigned char len, eat_bool is_command)

Writes data or command to the spi.

Parameters
[in] | data | unsigned char* ,the data buffer point,wan to write to spi.
[in] | len | unsigned char, the length of the data want to write.
[in] is_command eat_bool, The type want to write
1- command
0- data
Returns
EAT_TRUE if success, otherwise EAT_FALSE.
Header
#include "eat_periphery.h"
Example
static void lcd_write_cmd(unsigned char cmd)
{
eat_spi_write(&cmd, 1, EAT_TRUE);
}
static void lcd_write_data(unsigned char data)
{
eat_spi_write(&data, 1, EAT_FALSE);
}


eat_spi_read

  • Periphery Function
eat_adc_callback_func
eat_adc_get
eat_gpio_int_callback_func
eat_gpio_read
eat_gpio_setup
eat_gpio_write
eat_gpio_write_ext
eat_int_set_trigger
eat_int_setup
eat_kpled_sw
eat_lcd_light_sw
eat_pin_set_mode
eat_poweroff_key_sw
eat_pwm_start
eat_pwm_stop
eat_spi_init
eat_spi_read
eat_spi_write
unsigned char(* const eat_spi_read)(unsigned char *data, unsigned char len)

Reads data from the spi.

Parameters
[out] | data | The buffer point,the data read from spi will save in this buffer.
[in] | len | The length of the data want to read.
Returns
The length of the data having read.
Header
#include "eat_periphery.h"
Example
static void lcd_read_data(unsigned char *data, unsigned char len)
{
eat_spi_read(data,len);
}


eat_lcd_light_sw

  • Periphery Function
eat_adc_callback_func
eat_adc_get
eat_gpio_int_callback_func
eat_gpio_read
eat_gpio_setup
eat_gpio_write
eat_gpio_write_ext
eat_int_set_trigger
eat_int_setup
eat_kpled_sw
eat_lcd_light_sw
eat_pin_set_mode
eat_poweroff_key_sw
eat_pwm_start
eat_pwm_stop
eat_spi_init
eat_spi_read
eat_spi_write
void(* const eat_lcd_light_sw)(eat_bool sw)

Controls switch of the lcd backlight This function control the lcd backlight turn on or turn off.

Parameters
[in] sw the control switch.
sw:0 off
sw:1 on
Returns
No returen value (void).
Header
#include "eat_periphery.h"
Example
eat_lcd_light_sw(EAT_TRUE);


eat_kpled_sw

  • Periphery Function
eat_adc_callback_func
eat_adc_get
eat_gpio_int_callback_func
eat_gpio_read
eat_gpio_setup
eat_gpio_write
eat_gpio_write_ext
eat_int_set_trigger
eat_int_setup
eat_kpled_sw
eat_lcd_light_sw
eat_pin_set_mode
eat_poweroff_key_sw
eat_pwm_start
eat_pwm_stop
eat_spi_init
eat_spi_read
eat_spi_write
void(* const eat_kpled_sw)(eat_bool sw)

Controls the keypad led turn on or turn off.

Parameters
[in] sw the control switch.
sw:0 off
sw:1 on
Returns
No returen value (void)
Header
#include "eat_periphery.h"
Example
eat_kpled_sw(EAT_TRUE);


eat_adc_get

  • Periphery Function
eat_adc_callback_func
eat_adc_get
eat_gpio_int_callback_func
eat_gpio_read
eat_gpio_setup
eat_gpio_write
eat_gpio_write_ext
eat_int_set_trigger
eat_int_setup
eat_kpled_sw
eat_lcd_light_sw
eat_pin_set_mode
eat_poweroff_key_sw
eat_pwm_start
eat_pwm_stop
eat_spi_init
eat_spi_read
eat_spi_write
eat_bool(* const eat_adc_get)(EatPinName_enum pin, unsigned int period, eat_adc_callback_func callback)

Reads the ADC value of the EAT_PIN6_ADC0.

Parameters
[in] pin The pin want to read ADC,note is only in EAT_PIN6_ADC0 .
[in] period The mode want to read .
0: Read once
other: Periodically read,the unit is ms .
such as : period=1000 read the adc one time in one second.
[in] callback The callback function,if NULL,will send EAT_EVENT_ADC to App when read the value.if not NULL,
will call the callback function when read the value.
Returns
EAT_TRUE if success, otherwise EAT_FALSE.
Header
#include "eat_periphery.h"
Example
#include "eat_periphery.h"
#include "eat_interface.h"
void adc_proc(EatEvent_st *event)
{
if(event->data.adc.pin == EAT_PIN6_ADC0)
{
eat_trace("EAT_PIN6_ADC0 = %d",event->data.adc.v);
}
else
{
eat_trace("EAT_PIN7_TEMP_BAT = %d",event->data.adc.v);
}
}
typedef void (*app_user_func)(void*);
void app_main(void *data)
{
EatEvent_st event;
APP_InitRegions();//Init app RAM
eat_trace(" app_main ENTRY");
eat_adc_get(EAT_PIN6_ADC0, 3000, adc_proc);
eat_adc_get(EAT_PIN7_TEMP_BAT, 3000, NULL);
while(EAT_TRUE)
{
eat_get_event(&event);
eat_trace("MSG id%x", event.event);
if (event.event == EAT_EVENT_NULL || event.event >= EAT_EVENT_NUM)
{
eat_trace("[%s] invalid event type", __FUNCTION__, event.event);
continue;
}
switch(event.event)
{
case EAT_EVENT_ADC :
{
//put adc value
if(event.data.adc.pin == EAT_PIN6_ADC0)
{
eat_trace("EAT_PIN6_ADC0 = %d",event.data.adc.v);
}
else
{
eat_trace("EAT_PIN7_TEMP_BAT = %d",event.data.adc.v);
}
}
break;
case EAT_EVENT_MDM_READY_WR:
case EAT_EVENT_UART_READY_RD:
break;
case EAT_EVENT_UART_SEND_COMPLETE :
break;
default:
break;
}
}
}


eat_pwm_start

  • Periphery Function
eat_adc_callback_func
eat_adc_get
eat_gpio_int_callback_func
eat_gpio_read
eat_gpio_setup
eat_gpio_write
eat_gpio_write_ext
eat_int_set_trigger
eat_int_setup
eat_kpled_sw
eat_lcd_light_sw
eat_pin_set_mode
eat_poweroff_key_sw
eat_pwm_start
eat_pwm_stop
eat_spi_init
eat_spi_read
eat_spi_write
void(* const eat_pwm_start)(unsigned int freq, unsigned char duty)

Exports the PWM in EAT_PIN16_NETLIGHT.

Parameters
[in] | freq | The freq of the PWM want to export.
[in] | duty | The duty of the PWM want to export 0–100.
Returns
No returen value (void)
Header
#include "eat_periphery.h"
Example
eat_pwm_start(200,50);


eat_pwm_stop

  • Periphery Function
eat_adc_callback_func
eat_adc_get
eat_gpio_int_callback_func
eat_gpio_read
eat_gpio_setup
eat_gpio_write
eat_gpio_write_ext
eat_int_set_trigger
eat_int_setup
eat_kpled_sw
eat_lcd_light_sw
eat_pin_set_mode
eat_poweroff_key_sw
eat_pwm_start
eat_pwm_stop
eat_spi_init
eat_spi_read
eat_spi_write
void(* const eat_pwm_stop)()

Stops the export of the PWM.

No parameters (void)

Returns
No returen value (void)
Header
#include "eat_periphery.h"
Example
eat_pwm_stop();


eat_poweroff_key_sw

  • Periphery Function
eat_adc_callback_func
eat_adc_get
eat_gpio_int_callback_func
eat_gpio_read
eat_gpio_setup
eat_gpio_write
eat_gpio_write_ext
eat_int_set_trigger
eat_int_setup
eat_kpled_sw
eat_lcd_light_sw
eat_pin_set_mode
eat_poweroff_key_sw
eat_pwm_start
eat_pwm_stop
eat_spi_init
eat_spi_read
eat_spi_write
void(* const eat_poweroff_key_sw)(eat_bool sw)

Controls the powerkey shutdown turn on or turn off.

Parameters
[in] sw eat_bool the control switch
KAL_TRUE: enable long press Powerkey shutdown
KAL_FALSE: disable.
Returns
No returen value (void)
Header
#include "eat_periphery.h"
Example
eat_poweroff_key_sw(EAT_TRUE);


SOCKET

Modules

SOCKET Type
SOCKET Function

Macros

#define | MAX_SOCK_ADDR_LEN (28)
#define | MAX_IP_SOCKET_NUM (8)
#define | SOC_IPPROTO_ICMP (1)
#define | SOC_IPPROTO_RAW (255)

Detailed Description

This module offers the SOCKET operation API and type defination

Author
Jumping zhang.nosp@m.ping.nosp@m.@sim..nosp@m.com
Date
2013/12/12
   Copyright (C) 2002-2012 Shanghai SIMCom Wireless Solutions Ltd.

   All rights reserved.


SOCKET Type
SOCKET

Data Structures

struct | sockaddr_struct
struct | soc_fd_set
struct | soc_timeval_struct
struct | soc_linger_struct

Typedefs

typedef void(* | eat_soc_notify )(s8 s, soc_event_enum event, eat_bool result, u16 ack_size)
typedef void(* | eat_bear_notify )(cbm_bearer_state_enum state, u8 ip_addr[4])
typedef void(* | eat_hostname_notify )(u32 request_id, eat_bool result, u8 ip_addr[4])

Enumerations

enum cbm_bearer_state_enum {
CBM_DEACTIVATED = 0x01,
CBM_ACTIVATING = 0x02,
CBM_ACTIVATED = 0x04,
CBM_DEACTIVATING = 0x08,
CBM_CSD_AUTO_DISC_TIMEOUT = 0x10,
CBM_GPRS_AUTO_DISC_TIMEOUT = 0x20,
CBM_NWK_NEG_QOS_MODIFY = 0x040,
CBM_WIFI_STA_INFO_MODIFY = 0x080,
CBM_BEARER_STATE_TOTAL
}
enum soc_error_enum {
SOC_SUCCESS = 0,
SOC_ERROR = -1,
SOC_WOULDBLOCK = -2,
SOC_LIMIT_RESOURCE = -3,
SOC_INVALID_SOCKET = -4,
SOC_INVALID_ACCOUNT = -5,
SOC_NAMETOOLONG = -6,
SOC_ALREADY = -7,
SOC_OPNOTSUPP = -8,
SOC_CONNABORTED = -9,
SOC_INVAL = -10,
SOC_PIPE = -11,
SOC_NOTCONN = -12,
SOC_MSGSIZE = -13,
SOC_BEARER_FAIL = -14,
SOC_CONNRESET = -15,
SOC_DHCP_ERROR = -16,
SOC_IP_CHANGED = -17,
SOC_ADDRINUSE = -18,
SOC_CANCEL_ACT_BEARER = -19
}
enum cbm_result_error_enum {
CBM_OK = 0,
CBM_ERROR = -1,
CBM_WOULDBLOCK = -2,
CBM_LIMIT_RESOURCE = -3,
CBM_INVALID_ACCT_ID = -4,
CBM_INVALID_AP_ID = -5,
CBM_INVALID_SIM_ID = -6,
CBM_BEARER_FAIL = -7,
CBM_DHCP_ERROR = -8,
CBM_CANCEL_ACT_BEARER = -9,
CBM_DISC_BY_CM = -10
}
enum socket_type_enum {
SOC_SOCK_STREAM = 0,
SOC_SOCK_DGRAM,
SOC_SOCK_SMS,
SOC_SOCK_RAW
}
enum soc_option_enum {
SOC_OOBINLINE = 0x01 << 0,
SOC_LINGER = 0x01 << 1,
SOC_NBIO = 0x01 << 2,
SOC_ASYNC = 0x01 << 3,
SOC_NODELAY = 0x01 << 4,
SOC_KEEPALIVE = 0x01 << 5,
SOC_RCVBUF = 0x01 << 6,
SOC_SENDBUF = 0x01 << 7,
SOC_NREAD = 0x01 << 8,
SOC_PKT_SIZE = 0x01 << 9,
SOC_SILENT_LISTEN = 0x01 << 10,
SOC_QOS = 0x01 << 11,
SOC_TCP_MAXSEG = 0x01 << 12,
SOC_IP_TTL = 0x01 << 13,
SOC_LISTEN_BEARER = 0x01 << 14,
SOC_UDP_ANY_FPORT = 0x01 << 15,
SOC_WIFI_NOWAKEUP = 0x01 << 16,
SOC_UDP_NEED_ICMP = 0x01 << 17,
SOC_IP_HDRINCL = 0x01 << 18,
SOC_IPSEC_POLICY = 0x01 << 19,
SOC_TCP_ACKED_DATA = 0x01 << 20,
SOC_TCP_DELAYED_ACK = 0x01 << 21,
SOC_TCP_SACK = 0x01 << 22,
SOC_TCP_TIME_STAMP = 0x01 << 23,
SOC_TCP_ACK_MSEG = 0x01 << 24
}
enum soc_event_enum {
SOC_READ = 0x01,
SOC_WRITE = 0x02,
SOC_ACCEPT = 0x04,
SOC_CONNECT = 0x08,
SOC_CLOSE = 0x10,
SOC_ACKED = 0x20
}

Detailed Description


sockaddr_struct Struct Reference

Data Fields
sockaddr_struct Struct Reference
SOCKET Type

Data Fields

socket_type_enum sock_type
s16 | addr_len
u16 | port
u8 | addr [MAX_SOCK_ADDR_LEN]

Detailed Description

socket address structure


sockaddr_struct::sock_type

  • sockaddr_struct
addr
addr_len
port
sock_type
socket_type_enum sockaddr_struct::sock_type

socket type


sockaddr_struct::addr_len

  • sockaddr_struct
addr
addr_len
port
sock_type
s16 sockaddr_struct::addr_len

address length


sockaddr_struct::port

  • sockaddr_struct
addr
addr_len
port
sock_type
u16 sockaddr_struct::port

port number


sockaddr_struct::addr

  • sockaddr_struct
addr
addr_len
port
sock_type
u8 sockaddr_struct::addr[MAX_SOCK_ADDR_LEN]

IP address. For keep the 4-type boundary, please do not declare other variables above "addr"


soc_fd_set Struct Reference

Data Fields
soc_fd_set Struct Reference
SOCKET Type

Data Fields

u8 fds_bits [MAX_IP_SOCKET_NUM]

Detailed Description

Macros for SOC_SELECT


soc_fd_set::fds_bits

  • soc_fd_set
fds_bits
u8 soc_fd_set::fds_bits[MAX_IP_SOCKET_NUM]

select set based on socket id


soc_timeval_struct Struct Reference

Data Fields
soc_timeval_struct Struct Reference
SOCKET Type

Data Fields

u32 | tv_sec
u32 | tv_usec

Detailed Description

select timeout structure


soc_timeval_struct::tv_sec

  • soc_timeval_struct
tv_sec
tv_usec
u32 soc_timeval_struct::tv_sec

select timeout no. of second


soc_timeval_struct::tv_usec

  • soc_timeval_struct
tv_sec
tv_usec
u32 soc_timeval_struct::tv_usec

select timeout no. of microsecond


soc_linger_struct Struct Reference

Data Fields
soc_linger_struct Struct Reference
SOCKET Type

Data Fields

eat_bool | onoff
u16 | linger_time

Detailed Description

socket linger timeout structure


soc_linger_struct::onoff

  • soc_linger_struct
linger_time
onoff
eat_bool soc_linger_struct::onoff


soc_linger_struct::linger_time

  • soc_linger_struct
linger_time
onoff
u16 soc_linger_struct::linger_time

TRUE enable linger timeout FALSE disable linger timeout


eat_soc_notify

  • SOCKET Type
cbm_bearer_state_enum
cbm_result_error_enum
eat_bear_notify
eat_hostname_notify
eat_soc_notify
soc_error_enum
soc_event_enum
soc_option_enum
socket_type_enum
typedef void(* eat_soc_notify)(s8 s, soc_event_enum event, eat_bool result, u16 ack_size)

call back function about soc_create

Parameters
[in] | s | the socket ID
[in] | event | the notify event about current socket, please refer to soc_event_enum
[in] | result | if event is SOC_CONNECT, this paramter indicate the result of connect
[in] | ack_size | if event is SOC_ACKED, this parameter is valid, it indicate the acked size for send data.


eat_bear_notify

  • SOCKET Type
cbm_bearer_state_enum
cbm_result_error_enum
eat_bear_notify
eat_hostname_notify
eat_soc_notify
soc_error_enum
soc_event_enum
soc_option_enum
socket_type_enum
typedef void(* eat_bear_notify)(cbm_bearer_state_enum state, u8 ip_addr[4])

call back function about eat_gprs_bearer_open

Parameters
[in] | state | the current state about bearer, please refer to cbm_bearer_state_enum
[in] | ip_addr[4] | if state is CBM_ACTIVATED, this parameter is valid, it indicate the local IP address.


eat_hostname_notify

  • SOCKET Type
cbm_bearer_state_enum
cbm_result_error_enum
eat_bear_notify
eat_hostname_notify
eat_soc_notify
soc_error_enum
soc_event_enum
soc_option_enum
socket_type_enum
typedef void(* eat_hostname_notify)(u32 request_id, eat_bool result, u8 ip_addr[4])

call back function about eat_soc_gethostbyname

Parameters
[in] | request_id | it set by eat_soc_gethostbyname
[in] | result | the result about gethostname.
[in] | ip_addr[4] | if the result is TRUE, this parameter indicate the IP address of hostname.


cbm_bearer_state_enum

  • SOCKET Type
cbm_bearer_state_enum
cbm_result_error_enum
eat_bear_notify
eat_hostname_notify
eat_soc_notify
soc_error_enum
soc_event_enum
soc_option_enum
socket_type_enum
enum cbm_bearer_state_enum

Bearer state

Enumerator:
CBM_DEACTIVATED

deactivated

CBM_ACTIVATING

activating

CBM_ACTIVATED

activated

CBM_DEACTIVATING

deactivating

CBM_CSD_AUTO_DISC_TIMEOUT

csd auto disconnection timeout

CBM_GPRS_AUTO_DISC_TIMEOUT

gprs auto disconnection timeout

CBM_NWK_NEG_QOS_MODIFY

negotiated network qos modify notification

CBM_WIFI_STA_INFO_MODIFY

wifi hot spot sta number is changed

CBM_BEARER_STATE_TOTAL


soc_error_enum

  • SOCKET Type
cbm_bearer_state_enum
cbm_result_error_enum
eat_bear_notify
eat_hostname_notify
eat_soc_notify
soc_error_enum
soc_event_enum
soc_option_enum
socket_type_enum
enum soc_error_enum

Socket return codes, negative values stand for errors

Enumerator:
SOC_SUCCESS

success

SOC_ERROR

error

SOC_WOULDBLOCK

not done yet

SOC_LIMIT_RESOURCE

limited resource

SOC_INVALID_SOCKET

invalid socket

SOC_INVALID_ACCOUNT

invalid account id

SOC_NAMETOOLONG

address too long

SOC_ALREADY

operation already in progress

SOC_OPNOTSUPP

operation not support

SOC_CONNABORTED

Software caused connection abort

SOC_INVAL

invalid argument

SOC_PIPE

broken pipe

SOC_NOTCONN

socket is not connected

SOC_MSGSIZE

msg is too long

SOC_BEARER_FAIL

bearer is broken

SOC_CONNRESET

TCP half-write close, i.e., FINED

SOC_DHCP_ERROR

DHCP error

SOC_IP_CHANGED

IP has changed

SOC_ADDRINUSE

address already in use

SOC_CANCEL_ACT_BEARER

cancel the activation of bearer


cbm_result_error_enum

  • SOCKET Type
cbm_bearer_state_enum
cbm_result_error_enum
eat_bear_notify
eat_hostname_notify
eat_soc_notify
soc_error_enum
soc_event_enum
soc_option_enum
socket_type_enum
enum cbm_result_error_enum

error cause

Enumerator:
CBM_OK

success

CBM_ERROR

error

CBM_WOULDBLOCK

would block

CBM_LIMIT_RESOURCE

limited resource

CBM_INVALID_ACCT_ID

invalid account id

CBM_INVALID_AP_ID

invalid application id

CBM_INVALID_SIM_ID

invalid SIM id

CBM_BEARER_FAIL

bearer fail

CBM_DHCP_ERROR

DHCP get IP error

CBM_CANCEL_ACT_BEARER

cancel the account query screen, such as always ask or bearer fallback screen

CBM_DISC_BY_CM

bearer is deactivated by the connection management


socket_type_enum

  • SOCKET Type
cbm_bearer_state_enum
cbm_result_error_enum
eat_bear_notify
eat_hostname_notify
eat_soc_notify
soc_error_enum
soc_event_enum
soc_option_enum
socket_type_enum
enum socket_type_enum

Socket Type

Enumerator:
SOC_SOCK_STREAM

stream socket, TCP

SOC_SOCK_DGRAM

datagram socket, UDP

SOC_SOCK_SMS

SMS bearer

SOC_SOCK_RAW

raw socket


soc_option_enum

  • SOCKET Type
cbm_bearer_state_enum
cbm_result_error_enum
eat_bear_notify
eat_hostname_notify
eat_soc_notify
soc_error_enum
soc_event_enum
soc_option_enum
socket_type_enum
enum soc_option_enum

Socket Options

Enumerator:
SOC_OOBINLINE

not support yet

SOC_LINGER

linger on close

SOC_NBIO

Nonblocking

SOC_ASYNC

Asynchronous notification

SOC_NODELAY

disable Nagle algorithm or not

SOC_KEEPALIVE

enable/disable the keepalive

SOC_RCVBUF

set the socket receive buffer size

SOC_SENDBUF

set the socket send buffer size

SOC_NREAD

no. of bytes for read, only for soc_getsockopt

SOC_PKT_SIZE

datagram max packet size

SOC_SILENT_LISTEN

SOC_SOCK_SMS property

SOC_QOS

set the socket qos

SOC_TCP_MAXSEG

set the max segmemnt size

SOC_IP_TTL

set the IP TTL value

SOC_LISTEN_BEARER

enable listen bearer

SOC_UDP_ANY_FPORT

enable UDP any foreign port

SOC_WIFI_NOWAKEUP

send packet in power saving mode

SOC_UDP_NEED_ICMP

deliver NOTIFY(close) for ICMP error

SOC_IP_HDRINCL

IP header included for raw sockets

SOC_IPSEC_POLICY

ip security policy

SOC_TCP_ACKED_DATA

TCPIP acked data

SOC_TCP_DELAYED_ACK

TCP delayed ack

SOC_TCP_SACK

TCP selective ack

SOC_TCP_TIME_STAMP

TCP time stamp

SOC_TCP_ACK_MSEG

TCP ACK multiple segment


soc_event_enum

  • SOCKET Type
cbm_bearer_state_enum
cbm_result_error_enum
eat_bear_notify
eat_hostname_notify
eat_soc_notify
soc_error_enum
soc_event_enum
soc_option_enum
socket_type_enum
enum soc_event_enum

event

Enumerator:
SOC_READ

Notify for read

SOC_WRITE

Notify for write

SOC_ACCEPT

Notify for accept

SOC_CONNECT

Notify for connect

SOC_CLOSE

Notify for close

SOC_ACKED

Notify for acked


SOCKET Function

Functions
SOCKET Function
SOCKET

Functions

s8 | eat_gprs_bearer_open (u8 *apn, u8 *user, u8 *password, eat_bear_notify call_back)
s8 | eat_gprs_bearer_hold ()
s8 | eat_gprs_bearer_release ()
s8 | eat_soc_create (socket_type_enum type, u8 protocol)
void | eat_soc_notify_register (eat_soc_notify call_back)
s8 | eat_soc_connect (s8 s, sockaddr_struct *addr)
s8 | eat_soc_setsockopt (s8 s, u32 option, void *val, u8 val_size)
s8 | eat_soc_getsockopt (s8 s, u32 option, void *val, u8 val_size)
s8 | eat_soc_bind (s8 s, sockaddr_struct *addr)
s8 | eat_soc_listen (s8 s, u8 backlog)
s8 | eat_soc_accept (s8 s, sockaddr_struct *addr)
s32 | eat_soc_send (s8 s, const void *buf, s32 len)
s32 | eat_soc_recv (s8 s, void *buf, s32 len)
s32 | eat_soc_sendto (s8 s, const void *buf, s32 len, sockaddr_struct *addr)
s32 | eat_soc_recvfrom (s8 s, void *buf, s32 len, sockaddr_struct *fromaddr)
s8 | eat_soc_select (u8 ndesc, soc_fd_set *in, soc_fd_set *out, soc_fd_set *ex, soc_timeval_struct *tv)
void | eat_soc_fd_set (u8 s, soc_fd_set *p)
s8 | eat_soc_gethostbyname (const char *domain_name, u8 *addr, u8 *addr_len, u32 request_id)
void | eat_soc_gethost_notify_register (eat_hostname_notify call_back)
s8 | eat_soc_getsockaddr (s8 s, eat_bool is_local, sockaddr_struct *addr)
s8 | eat_soc_close (s8 s)

Detailed Description

SOCKET funtion declaration.


eat_gprs_bearer_open

  • SOCKET Function
eat_gprs_bearer_hold
eat_gprs_bearer_open
eat_gprs_bearer_release
eat_soc_accept
eat_soc_bind
eat_soc_close
eat_soc_connect
eat_soc_create
eat_soc_fd_set
eat_soc_gethost_notify_register
eat_soc_gethostbyname
eat_soc_getsockaddr
eat_soc_getsockopt
eat_soc_listen
eat_soc_notify_register
eat_soc_recv
eat_soc_recvfrom
eat_soc_select
eat_soc_send
eat_soc_sendto
eat_soc_setsockopt
s8 eat_gprs_bearer_open | ( | u8 * | apn,
 |  | u8 * | user,
 |  | u8 * | password,
 |  | eat_bear_notify | call_back
 | ) |  |

open the gprs bearer

Parameters
[in] | apn | apn name
[in] | user | user name
[in] | password | password
[in] | all_back | bearer notify call back function.it will report the status of current bearer,include ip address.
Return values
CBM_OK | bearer is in activated state.
CBM_INVALID_AP_ID | invalid application id.
CBM_INVALID_ACCT_ID | invalid network account id.
CBM_WOULDBLOCK | the bearer is in deactivating state and the bearer info will be reported later.


eat_gprs_bearer_hold

  • SOCKET Function
eat_gprs_bearer_hold
eat_gprs_bearer_open
eat_gprs_bearer_release
eat_soc_accept
eat_soc_bind
eat_soc_close
eat_soc_connect
eat_soc_create
eat_soc_fd_set
eat_soc_gethost_notify_register
eat_soc_gethostbyname
eat_soc_getsockaddr
eat_soc_getsockopt
eat_soc_listen
eat_soc_notify_register
eat_soc_recv
eat_soc_recvfrom
eat_soc_select
eat_soc_send
eat_soc_sendto
eat_soc_setsockopt
s8 eat_gprs_bearer_hold ( )

Application can use this API to hold the bearer if it doesn't want the bearer to be automatically deactivated.

Return values
CBM_OK | open the bearer successfully.
CBM_INVALID_AP_ID | invalid application id.
CBM_LIMIT_RESOURCE | limited resource.


eat_gprs_bearer_release

  • SOCKET Function
eat_gprs_bearer_hold
eat_gprs_bearer_open
eat_gprs_bearer_release
eat_soc_accept
eat_soc_bind
eat_soc_close
eat_soc_connect
eat_soc_create
eat_soc_fd_set
eat_soc_gethost_notify_register
eat_soc_gethostbyname
eat_soc_getsockaddr
eat_soc_getsockopt
eat_soc_listen
eat_soc_notify_register
eat_soc_recv
eat_soc_recvfrom
eat_soc_select
eat_soc_send
eat_soc_sendto
eat_soc_setsockopt
s8 eat_gprs_bearer_release ( )

release the bearer

Return values
CBM_OK | bearer is in deactivated state.
CBM_INVALID_AP_ID | invalid application id.
CBM_WOULDBLOCK | the bearer is in deactivating state and the bearer info will be reported later. any socket is actived, it will be blocked.


eat_soc_create

  • SOCKET Function
eat_gprs_bearer_hold
eat_gprs_bearer_open
eat_gprs_bearer_release
eat_soc_accept
eat_soc_bind
eat_soc_close
eat_soc_connect
eat_soc_create
eat_soc_fd_set
eat_soc_gethost_notify_register
eat_soc_gethostbyname
eat_soc_getsockaddr
eat_soc_getsockopt
eat_soc_listen
eat_soc_notify_register
eat_soc_recv
eat_soc_recvfrom
eat_soc_select
eat_soc_send
eat_soc_sendto
eat_soc_setsockopt
s8 eat_soc_create | ( | socket_type_enum | type,
 |  | u8 | protocol
 | ) |  |

create a socket

Parameters
[in] | type | Socket type. please take the reference of soc_type_enum.
[in] | protocolSocket | protocol. This one shall set to zero except type is SOC_SOCK_RAW. When type is SOC_SOCK_RAW, the protocol can be SOC_IPPROTO_ICMP or SOC_IPPROTO_RAW.
Return values
>=0 | socket id
SOC_INVAL | wrong parameters, domain, type, protocol
SOC_INVALID_ACCOUNT | wrong account id, nwk_account_id
SOC_LIMIT_RESOURCE | no socket available
SOC_BEARER_FAIL | bearer broken


eat_soc_notify_register

  • SOCKET Function
eat_gprs_bearer_hold
eat_gprs_bearer_open
eat_gprs_bearer_release
eat_soc_accept
eat_soc_bind
eat_soc_close
eat_soc_connect
eat_soc_create
eat_soc_fd_set
eat_soc_gethost_notify_register
eat_soc_gethostbyname
eat_soc_getsockaddr
eat_soc_getsockopt
eat_soc_listen
eat_soc_notify_register
eat_soc_recv
eat_soc_recvfrom
eat_soc_select
eat_soc_send
eat_soc_sendto
eat_soc_setsockopt
void eat_soc_notify_register ( eat_soc_notify call_back )

registe call back function while socket notify

Parameters
[in] call_back the socket call back function, it will report the status of socket.


eat_soc_connect

  • SOCKET Function
eat_gprs_bearer_hold
eat_gprs_bearer_open
eat_gprs_bearer_release
eat_soc_accept
eat_soc_bind
eat_soc_close
eat_soc_connect
eat_soc_create
eat_soc_fd_set
eat_soc_gethost_notify_register
eat_soc_gethostbyname
eat_soc_getsockaddr
eat_soc_getsockopt
eat_soc_listen
eat_soc_notify_register
eat_soc_recv
eat_soc_recvfrom
eat_soc_select
eat_soc_send
eat_soc_sendto
eat_soc_setsockopt
s8 eat_soc_connect | ( | s8 | s,
 |  | sockaddr_struct * | addr
 | ) |  |

This function connects to the server

Parameters
[in] | s | socket id
[in] | addr | pointer of server address
Return values
>=0 | socket id of new connection
SOC_INVALID_SOCKET | invalid socket id
SOC_INVAL | addr is NULL
SOC_WOULDBLOCK | in progressing
SOC_ALREADY | already connected or connecting (only happened for non-blocking)
SOC_BEARER_FAIL | bearer broken
SOC_OPNOTSUPP | the socket is already be listened
SOC_ERROR | unspecified error


eat_soc_setsockopt

  • SOCKET Function
eat_gprs_bearer_hold
eat_gprs_bearer_open
eat_gprs_bearer_release
eat_soc_accept
eat_soc_bind
eat_soc_close
eat_soc_connect
eat_soc_create
eat_soc_fd_set
eat_soc_gethost_notify_register
eat_soc_gethostbyname
eat_soc_getsockaddr
eat_soc_getsockopt
eat_soc_listen
eat_soc_notify_register
eat_soc_recv
eat_soc_recvfrom
eat_soc_select
eat_soc_send
eat_soc_sendto
eat_soc_setsockopt
s8 eat_soc_setsockopt | ( | s8 | s,
 |  | u32 | option,
 |  | void * | val,
 |  | u8 | val_size
 | ) |  |

Description This function gets the socket options.

Parameters
[in] | s | socket id
[in] | option | option type (soc_option_enum)
[in] | val | option value
[in] | val_size | option value size
Return values
SOC_SUCCESS | success
SOC_INVALID_SOCKET | invalid socket id
SOC_INVAL | invalid arguments option, val and val_size
SOC_ERROR | unspecified error

SOC_NBIO this option must to be set if you want to use the non-blocking mode or non-blocking plus asyn mode. val contains KAL_TRUE indicates non-blocking shall be adopted, KAL_FALSE indicates blocking mode shall be adopted. For example, set a socket to non-blocking mode kal_bool val = KAL_TRUE; soc_setsockopt(s, SOC_NBIO, &val, sizeof(kal_bool));

SOC_SILENT_LISTEN val contains KAL_TRUE indicates the silent listen shall be adopted, KAL_FALSE indicates non-silent listen shall be adopted. This is SOC_SOCK_SMS property. For example, if you want to let the socket be the passive to activate the bear, you can set a socket to silent listen mode For example kal_bool val = KAL_TRUE; soc_setsockopt(s, SOC_SILENT_LISTEN, &val, sizeof(kal_bool))

SOC_UDP_NEED_ICMP This option is used to deliver NOTIFY(close) for ICMP error. val contains KAL_TRUE indicates this option shall be enabled, KAL_FALSE indicates this option shall be disabled. For example, if you want to let set a socket to UDP NEED ICMP mode kal_bool val = KAL_TRUE; soc_setsockopt(s, SOC_UDP_NEED_ICMP, &val, sizeof(kal_bool))

SOC_ASYNC this option needs to be set if you want to use the non-blocking plus asyn mode. val contains the events application wants to receive. For example, if application wants to receive READ/WRITE/CLOSE/CONNECT events, it shall call soc_setsockopt like the following kal_uint8 val = 0; val = SOC_READ | SOC_WRITE | SOC_CLOSE | SOC_CONNECT; soc_setsockopt(s, SOC_ASYNC, &val, sizeof(kal_uint8)); P.S. if you are using the server socket, please remember to set the SOC_ACCPET event. SOC_TCP_MAXSEG A process can only decrease the MSS. When a TCP socket is created, the default MSS is set to 512. The MSS is updated according to the value announced from peer TCP after the socket completes TCP three-way handshake. Therefore, after a socket is created but before connected, a process can only decrease the MSS from its default of 512. After a connection is established, the process can decrease the MSS from the new updated value.

The value of TCP MSS is reduced to fit the interface MTU if the application set an unacceptable large value. For example kal_uint8 val = 512; soc_setsockopt(s, SOC_TCP_MAXSEG, &val, sizeof(kal_uint8));

SOC_LISTEN_BEARER val contains bear type indicates which kind of bear we want to receive packets from. For example, set a socket to receive the WiFi bear kal_uint8 val = SOC_BEARER_WIFI; soc_setsockopt(s, SOC_LISTEN_BEARER, &val, sizeof(kal_uint8));

SOC_WIFI_NOWAKEUP val contains KAL_TRUE indicates this option shall be enabled, KAL_FALSE indicates this option shall be disabled. This option is to make WNDRV sends outgoing packet to in power saving mode. For example kal_bool val = KAL_TRUE; soc_setsockopt(s, SOC_WIFI_NOWAKEUP, &val, sizeof(kal_bool))

SOC_IP_HDRINCL val contains KAL_TRUE indicates this option shall be enabled, KAL_FALSE indicates this option shall be disabled. If this option is set for a raw IP socket, we must build our own IP header for all the datagrams that we send on the raw socket. We can only set this socket option if the socket type in soc_create is SOC_SOCK_RAW(raw socket) and protocol in soc_create is not SOC_IPPROTO_ICMP. For example kal_bool val = KAL_TRUE; soc_setsockopt(s, SOC_IP_HDRINCL, &val, sizeof(kal_bool))

SOC_UDP_ANY_FPORT val contains KAL_TRUE indicates this option shall be enabled, KAL_FALSE indicates this option shall be disabled. For a connected UDP socket, this option makes socket deliver incoming packet from the same remote address but different remote port. For example kal_bool val = KAL_TRUE; soc_setsockopt(s, SOC_UDP_ANY_FPORT, &val, sizeof(kal_bool))

SOC_IP_TTL val contains the TTL values . If you want to change the default TTL (64), you can set this option. For example kal_uint8 val = 128; soc_setsockopt(s, SOC_IP_TTL, &val, sizeof(kal_uint8))

SOC_QOS val contains the TOS values . If you want to set the TOS values, you can set this option. For example kal_uint8 val = 0x80; soc_setsockopt(s, SOC_QOS, &val, sizeof(kal_uint8))

SOC_KEEPALIVE val contains KAL_TRUE indicates this option shall be enabled, KAL_FALSE indicates this option shall be disabled. You can use this option to enable or disable the keep-alive timer in TCP. For example kal_bool val = KAL_TRUE; soc_setsockopt(s, SOC_KEEPALIVE, &val, sizeof(kal_bool))

SOC_NODELAY val contains KAL_TRUE indicates this option shall be enabled, KAL_FALSE indicates this option shall be disabled. If you want to send the packet directly without waiting a packet size larger than MSS, you can set this option. For example kal_bool val = KAL_TRUE; soc_setsockopt(s, SOC_NODELAY, &val, sizeof(kal_bool))

SOC_SENDBUF val contains the value of send buffer's high water mark. If you want to set the high water mark, you can set this option. If the value you set is smaller than the MSS, the mss would be adjusted to this value. The value must be greater than 0 and smaller than the SSPDU + SSPDU_GROW. For example kal_uint32 val = 1024; soc_setsockopt(s, SOC_SENDBUF, &val, sizeof(kal_uint32))

SOC_RECVBUF val contains the value of receive buffer's high water mark. If you want to set the high water mark, you can set this option. This value must be greater than 0 and smaller than the SRPDU size. For example kal_uint32 val = 4096; soc_setsockopt(s, SOC_RECVBUF, &val, sizeof(kal_uint32))

SOC_LINGER val contains the value of enable/diable LINGER option and the value of LINGER time. This option is used in linger on close. For example soc_linger_struct val; val.onoff = KAL_TRUE; val. linger_time = 3; (sec) soc_setsockopt(s, SOC_LINGER, &val, sizeof(soc_linger_struct_val));

SOC_IPSEC_POLICY val contains sadb_x_policy structure content. You can set this option to set the IPSEC policy. If you want to get the IPSEC policy, you can set this option. For example struct sadb_x_policy policy; policy.sadb_x_policy_len = PFKEY_UNIT64(sizeof(policy)); policy.sadb_x_policy_exttype = SADB_X_EXT_POLICY; policy.sadb_x_policy_type = 4; // IPSEC_POLICY_BYPASS; policy.sadb_x_policy_dir = 1; // IPSEC_DIR_INBOUND; soc_setsockopt(s, SOC_IPSEC_POLICY, &policy, sizeof(sadb_x_policy))

SOC_TCP_DELAYED_ACK The SOC_TCP_DELAYED_ACK function is enable by default. That is to say, if you don't set this option. The default SOC_TCP_DELAYED_ACK value is TRUE. val contains KAL_TRUE indicates this option shall be enabled, KAL_FALSE indicates this option shall be disabled. If you want to enable the "TCP no delay" function, you can set this option. For example kal_bool val = KAL_TRUE; soc_setsockopt(s, SOC_TCP_DELAYED_ACK, &val, sizeof(kal_bool))

SOC_TCP_SACK The SOC_TCP_SACK function is enable by default. That is to say, if you don't set this option. The default SOC_TCP_SACK value is TRUE. val contains KAL_TRUE indicates this option shall be enabled, KAL_FALSE indicates this option shall be disabled. If you want to enable the "TCP SACK" function, you can set this option. For example kal_bool val = KAL_TRUE; soc_setsockopt(s, SOC_TCP_SACK, &val, sizeof(kal_bool))

SOC_TCP_TIME_STAMP The SOC_TCP_TIME_STAMP function is enable by default. That is to say, if you don't set this option. The default SOC_TCP_TIME_STAMP value is TRUE. val contains KAL_TRUE indicates this option shall be enabled, KAL_FALSE indicates this option shall be disabled. If you want to enable the "TCP TIME STAMP" function, you can set this option. For example kal_bool val = KAL_TRUE; soc_setsockopt(s, SOC_TCP_TIME_STAMP, &val, sizeof(kal_bool))


eat_soc_getsockopt

  • SOCKET Function
eat_gprs_bearer_hold
eat_gprs_bearer_open
eat_gprs_bearer_release
eat_soc_accept
eat_soc_bind
eat_soc_close
eat_soc_connect
eat_soc_create
eat_soc_fd_set
eat_soc_gethost_notify_register
eat_soc_gethostbyname
eat_soc_getsockaddr
eat_soc_getsockopt
eat_soc_listen
eat_soc_notify_register
eat_soc_recv
eat_soc_recvfrom
eat_soc_select
eat_soc_send
eat_soc_sendto
eat_soc_setsockopt
s8 eat_soc_getsockopt | ( | s8 | s,
 |  | u32 | option,
 |  | void * | val,
 |  | u8 | val_size
 | ) |  |

This function sets the socket options.

Parameters
[in] | s | socket id
[in] | option | option type (soc_option_enum)
[in] | val | option value (soc_event_enum for SOC_ASYNC)
[in] | val_size | option value size
Return values
SOC_SUCCESS | success
SOC_INVALID_SOCKET | invalid socket id
SOC_INVAL | invalid arguments option, val and val_size
SOC_ERROR | unspecified error


eat_soc_bind

  • SOCKET Function
eat_gprs_bearer_hold
eat_gprs_bearer_open
eat_gprs_bearer_release
eat_soc_accept
eat_soc_bind
eat_soc_close
eat_soc_connect
eat_soc_create
eat_soc_fd_set
eat_soc_gethost_notify_register
eat_soc_gethostbyname
eat_soc_getsockaddr
eat_soc_getsockopt
eat_soc_listen
eat_soc_notify_register
eat_soc_recv
eat_soc_recvfrom
eat_soc_select
eat_soc_send
eat_soc_sendto
eat_soc_setsockopt
s8 eat_soc_bind | ( | s8 | s,
 |  | sockaddr_struct * | addr
 | ) |  |

This function binds a local address which contain IP and port to a socket

Parameters
[in] | s | socket id
[in] | addr | local addr to be binded
Return values
SOC_SUCCESS | success
SOC_INVALID_SOCKET | invalid socket id
SOC_BEARER_FAIL | bearer broken
SOC_ERROR | unspecified error
SOC_ADDRINUSE | the local port has been bound by other socket


eat_soc_listen

  • SOCKET Function
eat_gprs_bearer_hold
eat_gprs_bearer_open
eat_gprs_bearer_release
eat_soc_accept
eat_soc_bind
eat_soc_close
eat_soc_connect
eat_soc_create
eat_soc_fd_set
eat_soc_gethost_notify_register
eat_soc_gethostbyname
eat_soc_getsockaddr
eat_soc_getsockopt
eat_soc_listen
eat_soc_notify_register
eat_soc_recv
eat_soc_recvfrom
eat_soc_select
eat_soc_send
eat_soc_sendto
eat_soc_setsockopt
s8 eat_soc_listen | ( | s8 | s,
 |  | u8 | backlog
 | ) |  |

makes a socket to a server socket to wait client connections.

Parameters
[in] | s | socket id
[in] | backlog | max number of connections
Return values
SOC_SUCCESS | success
SOC_INVALID_SOCKET | invalid socket id
SOC_BEARER_FAIL | bearer broken
SOC_OPNOTSUPP | only TCP can be listened
SOC_ALREADY | already listened
SOC_ERROR | unspecified error
SOC_BEARER_FAIL | bearer broken


eat_soc_accept

  • SOCKET Function
eat_gprs_bearer_hold
eat_gprs_bearer_open
eat_gprs_bearer_release
eat_soc_accept
eat_soc_bind
eat_soc_close
eat_soc_connect
eat_soc_create
eat_soc_fd_set
eat_soc_gethost_notify_register
eat_soc_gethostbyname
eat_soc_getsockaddr
eat_soc_getsockopt
eat_soc_listen
eat_soc_notify_register
eat_soc_recv
eat_soc_recvfrom
eat_soc_select
eat_soc_send
eat_soc_sendto
eat_soc_setsockopt
s8 eat_soc_accept | ( | s8 | s,
 |  | sockaddr_struct * | addr
 | ) |  |

waits for the incoming connections and return a socket id of new connection.

Parameters
[in] | s | socket id
[in] | backlog | max number of connections
Return values
>=0 | socket id of new connection
SOC_INVALID_SOCKET | invalid socket id
SOC_INVAL | socket is not calling soc_listen
SOC_WOULDBLOCK | non-blocking
SOC_CONNABORTED | server socket cannot receive anymore
SOC_BEARER_FAIL | bearer broken
SOC_ERROR | unspecified error


eat_soc_send

  • SOCKET Function
eat_gprs_bearer_hold
eat_gprs_bearer_open
eat_gprs_bearer_release
eat_soc_accept
eat_soc_bind
eat_soc_close
eat_soc_connect
eat_soc_create
eat_soc_fd_set
eat_soc_gethost_notify_register
eat_soc_gethostbyname
eat_soc_getsockaddr
eat_soc_getsockopt
eat_soc_listen
eat_soc_notify_register
eat_soc_recv
eat_soc_recvfrom
eat_soc_select
eat_soc_send
eat_soc_sendto
eat_soc_setsockopt
s32 eat_soc_send | ( | s8 | s,
 |  | const void * | buf,
 |  | s32 | len
 | ) |  |

Send the data to the destination

Parameters
[in] | s | socket id
[in] | buf | contain data to be sent
[in] | len | data length
Return values
>=0 | SUCCESS
SOC_INVALID_SOCKET | invalid socket id
SOC_INVAL | buf is NULL or len equals to zero
SOC_WOULDBLOCK | buffer not available or bearer is establishing
SOC_BEARER_FAIL | bearer broken
SOC_NOTCONN | socket is not connected in case of TCP
SOC_PIPE | socket is already been shutdown
SOC_MSGSIZE | message is too long
SOC_ERROR | unspecified error
SOC_NOTBIND | in case of sending ICMP Echo Request, shall bind before


eat_soc_recv

  • SOCKET Function
eat_gprs_bearer_hold
eat_gprs_bearer_open
eat_gprs_bearer_release
eat_soc_accept
eat_soc_bind
eat_soc_close
eat_soc_connect
eat_soc_create
eat_soc_fd_set
eat_soc_gethost_notify_register
eat_soc_gethostbyname
eat_soc_getsockaddr
eat_soc_getsockopt
eat_soc_listen
eat_soc_notify_register
eat_soc_recv
eat_soc_recvfrom
eat_soc_select
eat_soc_send
eat_soc_sendto
eat_soc_setsockopt
s32 eat_soc_recv | ( | s8 | s,
 |  | void * | buf,
 |  | s32 | len
 | ) |  |

Receive data and return the source address.

Parameters
[in] | s | socket id
[in] | buf | buffer for receiving data
[in] | len | buffer size
[in] | flags
Return values
0 | receive the FIN from the server
SOC_INVALID_SOCKET | invalid socket id
SOC_INVAL | buf is NULL or len equals to zero
SOC_WOULDBLOCK | no data available
SOC_BEARER_FAIL | bearer broken
SOC_NOTCONN | socket is not connected in case of TCP
SOC_PIPE | socket is already been shutdown
SOC_ERROR | unspecified error


eat_soc_sendto

  • SOCKET Function
eat_gprs_bearer_hold
eat_gprs_bearer_open
eat_gprs_bearer_release
eat_soc_accept
eat_soc_bind
eat_soc_close
eat_soc_connect
eat_soc_create
eat_soc_fd_set
eat_soc_gethost_notify_register
eat_soc_gethostbyname
eat_soc_getsockaddr
eat_soc_getsockopt
eat_soc_listen
eat_soc_notify_register
eat_soc_recv
eat_soc_recvfrom
eat_soc_select
eat_soc_send
eat_soc_sendto
eat_soc_setsockopt
s32 eat_soc_sendto | ( | s8 | s,
 |  | const void * | buf,
 |  | s32 | len,
 |  | sockaddr_struct * | addr
 | ) |  |

Send the data to the destination.

Parameters
[in] | s | socket id
[in] | buf | contain data to be sent
[in] | len | data length
[in] | addr | destination address
Return values
>=0 | SUCCESS
SOC_INVALID_SOCKET | invalid socket id
SOC_INVAL | buf is NULL or len equals to zero
SOC_WOULDBLOCK | buffer not available or bearer is establishing
SOC_BEARER_FAIL | bearer broken
SOC_NOTCONN | socket is not connected in case of TCP
SOC_PIPE | socket is already been shutdown
SOC_MSGSIZE | message is too long
SOC_ERROR | unspecified error
SOC_NOTBIND | in case of sending ICMP Echo Request, shall bind before


eat_soc_recvfrom

  • SOCKET Function
eat_gprs_bearer_hold
eat_gprs_bearer_open
eat_gprs_bearer_release
eat_soc_accept
eat_soc_bind
eat_soc_close
eat_soc_connect
eat_soc_create
eat_soc_fd_set
eat_soc_gethost_notify_register
eat_soc_gethostbyname
eat_soc_getsockaddr
eat_soc_getsockopt
eat_soc_listen
eat_soc_notify_register
eat_soc_recv
eat_soc_recvfrom
eat_soc_select
eat_soc_send
eat_soc_sendto
eat_soc_setsockopt
s32 eat_soc_recvfrom | ( | s8 | s,
 |  | void * | buf,
 |  | s32 | len,
 |  | sockaddr_struct * | fromaddr
 | ) |  |

Receive data and return the source address.

Parameters
[in] | s | socket id
[in] | buf | buffer for receiving data
[in] | len | buffer size
[in] | fromaddr | remote addess
Return values
0 | receive the FIN from the server
SOC_INVALID_SOCKET | invalid socket id
SOC_INVAL | buf is NULL or len equals to zero
SOC_WOULDBLOCK | no data available
SOC_BEARER_FAIL | bearer broken
SOC_NOTCONN | socket is not connected in case of TCP
SOC_PIPE | socket is already been shutdown
SOC_ERROR | unspecified error


eat_soc_select

  • SOCKET Function
eat_gprs_bearer_hold
eat_gprs_bearer_open
eat_gprs_bearer_release
eat_soc_accept
eat_soc_bind
eat_soc_close
eat_soc_connect
eat_soc_create
eat_soc_fd_set
eat_soc_gethost_notify_register
eat_soc_gethostbyname
eat_soc_getsockaddr
eat_soc_getsockopt
eat_soc_listen
eat_soc_notify_register
eat_soc_recv
eat_soc_recvfrom
eat_soc_select
eat_soc_send
eat_soc_sendto
eat_soc_setsockopt
s8 eat_soc_select | ( | u8 | ndesc,
 |  | soc_fd_set * | in,
 |  | soc_fd_set * | out,
 |  | soc_fd_set * | ex,
 |  | soc_timeval_struct * | tv
 | ) |  |

Allow the application to query the status of multiple sockets.

Parameters
[in] | ndesc | max selected socket id plus 1
[in] | in | input soc_fd_set (readfds)
[in] | out | output soc_fd_set (writefds)
[in] | ex | exception soc_fd_set (exceptfds)
[in] | tv | specify the timeout value, tv == NULL block until ready tv != NULL && value == 0 return immediately tv != NULL && value != 0 return after timeout
Return values
>0 | number of ready sockets
0 | timeout expires before anything interesting happens
SOC_INVALID_SOCKET | selected sockets are not belong to this module
SOC_INVAL | invalid arguments ndesc, in, out, ex
SOC_WOULDBLOCK | non-blocking
SOC_BEARER_FAIL | bearer broken
SOC_ERROR | unspecified error


eat_soc_fd_set

  • SOCKET Function
eat_gprs_bearer_hold
eat_gprs_bearer_open
eat_gprs_bearer_release
eat_soc_accept
eat_soc_bind
eat_soc_close
eat_soc_connect
eat_soc_create
eat_soc_fd_set
eat_soc_gethost_notify_register
eat_soc_gethostbyname
eat_soc_getsockaddr
eat_soc_getsockopt
eat_soc_listen
eat_soc_notify_register
eat_soc_recv
eat_soc_recvfrom
eat_soc_select
eat_soc_send
eat_soc_sendto
eat_soc_setsockopt
void eat_soc_fd_set | ( | u8 | s,
 |  | soc_fd_set * | p
 | ) |  |

set the socket id which you want to select

Parameters
[in] | s | socket id
[in] | p


eat_soc_gethostbyname

  • SOCKET Function
eat_gprs_bearer_hold
eat_gprs_bearer_open
eat_gprs_bearer_release
eat_soc_accept
eat_soc_bind
eat_soc_close
eat_soc_connect
eat_soc_create
eat_soc_fd_set
eat_soc_gethost_notify_register
eat_soc_gethostbyname
eat_soc_getsockaddr
eat_soc_getsockopt
eat_soc_listen
eat_soc_notify_register
eat_soc_recv
eat_soc_recvfrom
eat_soc_select
eat_soc_send
eat_soc_sendto
eat_soc_setsockopt
s8 eat_soc_gethostbyname | ( | const char * | domain_name,
 |  | u8 * | addr,
 |  | u8 * | addr_len,
 |  | u32 | request_id
 | ) |  |

This function gets the IP of the given domain name.

Parameters
[in] | domain_name | Domain_name
[in] | addr | resolved address
[in] | addr_len | address length
[in] | request_idembedded | in call back function
Return values
SOC_SUCCESS | Get IP address successfully
SOC_INVAL | invalid arguments null domain_name, etc.
SOC_ERROR | unspecified error
SOC_WOULDBLOCK | wait response from network
SOC_LIMIT_RESOURCE | socket resources not available


eat_soc_gethost_notify_register

  • SOCKET Function
eat_gprs_bearer_hold
eat_gprs_bearer_open
eat_gprs_bearer_release
eat_soc_accept
eat_soc_bind
eat_soc_close
eat_soc_connect
eat_soc_create
eat_soc_fd_set
eat_soc_gethost_notify_register
eat_soc_gethostbyname
eat_soc_getsockaddr
eat_soc_getsockopt
eat_soc_listen
eat_soc_notify_register
eat_soc_recv
eat_soc_recvfrom
eat_soc_select
eat_soc_send
eat_soc_sendto
eat_soc_setsockopt
void eat_soc_gethost_notify_register ( eat_hostname_notify call_back )

set call back function about eat_soc_gethostbyname

Parameters
[in] call_back if SOC_WOULDBLOCK return when call eat_soc_gethostbyname, th ip address will get from this call back function.


eat_soc_getsockaddr

  • SOCKET Function
eat_gprs_bearer_hold
eat_gprs_bearer_open
eat_gprs_bearer_release
eat_soc_accept
eat_soc_bind
eat_soc_close
eat_soc_connect
eat_soc_create
eat_soc_fd_set
eat_soc_gethost_notify_register
eat_soc_gethostbyname
eat_soc_getsockaddr
eat_soc_getsockopt
eat_soc_listen
eat_soc_notify_register
eat_soc_recv
eat_soc_recvfrom
eat_soc_select
eat_soc_send
eat_soc_sendto
eat_soc_setsockopt
s8 eat_soc_getsockaddr | ( | s8 | s,
 |  | eat_bool | is_local,
 |  | sockaddr_struct * | addr
 | ) |  |

returns the remote or local address assoicated with given socket

Parameters
[in] | s | socket id
[in] | is_local | true local false remote
[out] | addr | copy the addres
Return values
SOC_SUCCESS | success
SOC_INVAL | invalid argument
SOC_INVALID_SOCKET | not a valid socket
SOC_PIPE | socket is broken
SOC_NOTCONN | not a connected socket
SOC_ERROR | cannot found corresponding DNS query (or socket not bound for SOC_SOCK_SMS)


eat_soc_close

  • SOCKET Function
eat_gprs_bearer_hold
eat_gprs_bearer_open
eat_gprs_bearer_release
eat_soc_accept
eat_soc_bind
eat_soc_close
eat_soc_connect
eat_soc_create
eat_soc_fd_set
eat_soc_gethost_notify_register
eat_soc_gethostbyname
eat_soc_getsockaddr
eat_soc_getsockopt
eat_soc_listen
eat_soc_notify_register
eat_soc_recv
eat_soc_recvfrom
eat_soc_select
eat_soc_send
eat_soc_sendto
eat_soc_setsockopt
s8 eat_soc_close ( s8 s )

Close the socket.

Parameters
[in] s socket id
Return values
SOC_SUCCESS | success
SOC_INVALID_SOCKET | invalid socket id


MAX_SOCK_ADDR_LEN

  • SOCKET
MAX_IP_SOCKET_NUM
MAX_SOCK_ADDR_LEN
SOC_IPPROTO_ICMP
SOC_IPPROTO_RAW
#define MAX_SOCK_ADDR_LEN (28)

max socket address length


MAX_IP_SOCKET_NUM

  • SOCKET
MAX_IP_SOCKET_NUM
MAX_SOCK_ADDR_LEN
SOC_IPPROTO_ICMP
SOC_IPPROTO_RAW
#define MAX_IP_SOCKET_NUM (8)

Max IP socket number


SOC_IPPROTO_ICMP

  • SOCKET
MAX_IP_SOCKET_NUM
MAX_SOCK_ADDR_LEN
SOC_IPPROTO_ICMP
SOC_IPPROTO_RAW
#define SOC_IPPROTO_ICMP (1)

Control message protocol. Currently, only allow applicaion to set this type when RAW_SOCKET is used


SOC_IPPROTO_RAW

  • SOCKET
MAX_IP_SOCKET_NUM
MAX_SOCK_ADDR_LEN
SOC_IPPROTO_ICMP
SOC_IPPROTO_RAW
#define SOC_IPPROTO_RAW (255)

raw IP packet


SYSTEM

Modules
SYSTEM

Modules

SYSTEM Type
SYSTEM Function

Detailed Description

This module offers the SYSTEM operation API and type defination.

Author
JinGuangBo guang.nosp@m.bo.j.nosp@m.in@si.nosp@m.m.co.nosp@m.m
Date
2012/09/24
   Copyright (C) 2002-2012 Shanghai SIMCom Wireless Solutions Ltd.

   All rights reserved.


SYSTEM Type
SYSTEM

Data Structures

struct | EatSemId_st
struct | EatUserMsg_st
union | EatEventData_union
struct | EatEvent_st
struct | EatEntryPara_st
struct | EatEntry_st

Enumerations

enum EatWaitMode_enum {
EAT_NO_WAIT,
EAT_INFINITE_WAIT
}
enum EatEvent_enum {
EAT_EVENT_NULL = 0,
EAT_EVENT_TIMER,
EAT_EVENT_KEY,
EAT_EVENT_INT,
EAT_EVENT_MDM_READY_RD,
EAT_EVENT_MDM_READY_WR,
EAT_EVENT_MDM_RI,
EAT_EVENT_UART_READY_RD,
EAT_EVENT_UART_READY_WR,
EAT_EVENT_ADC,
EAT_EVENT_UART_SEND_COMPLETE,
EAT_EVENT_USER_MSG,
EAT_EVENT_NUM
}
enum EatUser_enum {
EAT_USER_0,
EAT_USER_1,
EAT_USER_2,
EAT_USER_3,
EAT_USER_4,
EAT_USER_5,
EAT_USER_6,
EAT_USER_7,
EAT_USER_8,
EAT_USER_NUM
}

Detailed Description

SYSTEM type defination.


EatSemId_st Struct Reference

Data Fields
EatSemId_st Struct Reference
SYSTEM Type

Data Fields

u8 unused

Detailed Description

sem ID structure


EatSemId_st::unused

  • EatSemId_st
unused
u8 EatSemId_st::unused


EatUserMsg_st Struct Reference

Data Fields
EatUserMsg_st Struct Reference
SYSTEM Type

Data Fields

EatUser_enum src
eat_bool | use_point
unsigned char | len
unsigned char | data [EAT_USER_MSG_MAX_SIZE]
const void * | data_p


EatUserMsg_st::src

  • EatUserMsg_st
data
data_p
len
src
use_point
EatUser_enum EatUserMsg_st::src


EatUserMsg_st::use_point

  • EatUserMsg_st
data
data_p
len
src
use_point
eat_bool EatUserMsg_st::use_point


EatUserMsg_st::len

  • EatUserMsg_st
data
data_p
len
src
use_point
unsigned char EatUserMsg_st::len


EatUserMsg_st::data

  • EatUserMsg_st
data
data_p
len
src
use_point
unsigned char EatUserMsg_st::data[EAT_USER_MSG_MAX_SIZE]


EatUserMsg_st::data_p

  • EatUserMsg_st
data
data_p
len
src
use_point
const void* EatUserMsg_st::data_p


EatEventData_union Union Reference

Data Fields
EatEventData_union Union Reference
SYSTEM Type

Data Fields

EatTimer_st timer
EatKey_st key
EatInt_st interrupt
EatMdmRi_st mdm_ri
EatUart_st uart
EatAdc_st adc
EatUserMsg_st user_msg


EatEventData_union::timer

  • EatEventData_union
adc
interrupt
key
mdm_ri
timer
uart
user_msg
EatTimer_st EatEventData_union::timer


EatEventData_union::key

  • EatEventData_union
adc
interrupt
key
mdm_ri
timer
uart
user_msg
EatKey_st EatEventData_union::key


EatEventData_union::interrupt

  • EatEventData_union
adc
interrupt
key
mdm_ri
timer
uart
user_msg
EatInt_st EatEventData_union::interrupt


EatEventData_union::mdm_ri

  • EatEventData_union
adc
interrupt
key
mdm_ri
timer
uart
user_msg
EatMdmRi_st EatEventData_union::mdm_ri


EatEventData_union::uart

  • EatEventData_union
adc
interrupt
key
mdm_ri
timer
uart
user_msg
EatUart_st EatEventData_union::uart


EatEventData_union::adc

  • EatEventData_union
adc
interrupt
key
mdm_ri
timer
uart
user_msg
EatAdc_st EatEventData_union::adc


EatEventData_union::user_msg

  • EatEventData_union
adc
interrupt
key
mdm_ri
timer
uart
user_msg
EatUserMsg_st EatEventData_union::user_msg


EatEvent_st Struct Reference

Data Fields
EatEvent_st Struct Reference
SYSTEM Type

Data Fields

EatEvent_enum event
EatEventData_union data

Detailed Description

Modem send APP EVENT structure


EatEvent_st::event

  • EatEvent_st
data
event
EatEvent_enum EatEvent_st::event


EatEvent_st::data

  • EatEvent_st
data
event
EatEventData_union EatEvent_st::data


EatEntryPara_st Struct Reference

Data Fields
EatEntryPara_st Struct Reference
SYSTEM Type

Data Fields

eat_bool | is_update_app
eat_bool | update_app_result


EatEntryPara_st::is_update_app

  • EatEntryPara_st
is_update_app
update_app_result
eat_bool EatEntryPara_st::is_update_app


EatEntryPara_st::update_app_result

  • EatEntryPara_st
is_update_app
update_app_result
eat_bool EatEntryPara_st::update_app_result

when is_update_app equal EAT_TRUE, update_app_result can index update result


EatEntry_st Struct Reference

Data Fields
EatEntry_st Struct Reference
SYSTEM Type

Data Fields

void(* | entry )(void *data)
void(* | func_ext1 )(void *data)
void(* | entry_user1 )(void *data)
void(* | entry_user2 )(void *data)
void(* | entry_user3 )(void *data)
void(* | entry_user4 )(void *data)
void(* | entry_user5 )(void *data)
void(* | entry_user6 )(void *data)
void(* | entry_user7 )(void *data)
void(* | entry_user8 )(void *data)
void(* | func_ext2 )(void *data)
void(* | func_ext3 )(void *data)
void(* | func_ext4 )(void *data)
void(* | func_ext5 )(void *data)
void(* | func_ext6 )(void *data)
void(* | func_ext7 )(void *data)

Detailed Description

all task entry


EatEntry_st::entry

  • EatEntry_st
entry
entry_user1
entry_user2
entry_user3
entry_user4
entry_user5
entry_user6
entry_user7
entry_user8
func_ext1
func_ext2
func_ext3
func_ext4
func_ext5
func_ext6
func_ext7
void(* EatEntry_st::entry)(void *data)

App entry


EatEntry_st::func_ext1

  • EatEntry_st
entry
entry_user1
entry_user2
entry_user3
entry_user4
entry_user5
entry_user6
entry_user7
entry_user8
func_ext1
func_ext2
func_ext3
func_ext4
func_ext5
func_ext6
func_ext7
void(* EatEntry_st::func_ext1)(void *data)

called during boot stage, can used to init GPIO, UART ...


EatEntry_st::entry_user1

  • EatEntry_st
entry
entry_user1
entry_user2
entry_user3
entry_user4
entry_user5
entry_user6
entry_user7
entry_user8
func_ext1
func_ext2
func_ext3
func_ext4
func_ext5
func_ext6
func_ext7
void(* EatEntry_st::entry_user1)(void *data)


EatEntry_st::entry_user2

  • EatEntry_st
entry
entry_user1
entry_user2
entry_user3
entry_user4
entry_user5
entry_user6
entry_user7
entry_user8
func_ext1
func_ext2
func_ext3
func_ext4
func_ext5
func_ext6
func_ext7
void(* EatEntry_st::entry_user2)(void *data)


EatEntry_st::entry_user3

  • EatEntry_st
entry
entry_user1
entry_user2
entry_user3
entry_user4
entry_user5
entry_user6
entry_user7
entry_user8
func_ext1
func_ext2
func_ext3
func_ext4
func_ext5
func_ext6
func_ext7
void(* EatEntry_st::entry_user3)(void *data)


EatEntry_st::entry_user4

  • EatEntry_st
entry
entry_user1
entry_user2
entry_user3
entry_user4
entry_user5
entry_user6
entry_user7
entry_user8
func_ext1
func_ext2
func_ext3
func_ext4
func_ext5
func_ext6
func_ext7
void(* EatEntry_st::entry_user4)(void *data)


EatEntry_st::entry_user5

  • EatEntry_st
entry
entry_user1
entry_user2
entry_user3
entry_user4
entry_user5
entry_user6
entry_user7
entry_user8
func_ext1
func_ext2
func_ext3
func_ext4
func_ext5
func_ext6
func_ext7
void(* EatEntry_st::entry_user5)(void *data)


EatEntry_st::entry_user6

  • EatEntry_st
entry
entry_user1
entry_user2
entry_user3
entry_user4
entry_user5
entry_user6
entry_user7
entry_user8
func_ext1
func_ext2
func_ext3
func_ext4
func_ext5
func_ext6
func_ext7
void(* EatEntry_st::entry_user6)(void *data)


EatEntry_st::entry_user7

  • EatEntry_st
entry
entry_user1
entry_user2
entry_user3
entry_user4
entry_user5
entry_user6
entry_user7
entry_user8
func_ext1
func_ext2
func_ext3
func_ext4
func_ext5
func_ext6
func_ext7
void(* EatEntry_st::entry_user7)(void *data)


EatEntry_st::entry_user8

  • EatEntry_st
entry
entry_user1
entry_user2
entry_user3
entry_user4
entry_user5
entry_user6
entry_user7
entry_user8
func_ext1
func_ext2
func_ext3
func_ext4
func_ext5
func_ext6
func_ext7
void(* EatEntry_st::entry_user8)(void *data)


EatEntry_st::func_ext2

  • EatEntry_st
entry
entry_user1
entry_user2
entry_user3
entry_user4
entry_user5
entry_user6
entry_user7
entry_user8
func_ext1
func_ext2
func_ext3
func_ext4
func_ext5
func_ext6
func_ext7
void(* EatEntry_st::func_ext2)(void *data)


EatEntry_st::func_ext3

  • EatEntry_st
entry
entry_user1
entry_user2
entry_user3
entry_user4
entry_user5
entry_user6
entry_user7
entry_user8
func_ext1
func_ext2
func_ext3
func_ext4
func_ext5
func_ext6
func_ext7
void(* EatEntry_st::func_ext3)(void *data)


EatEntry_st::func_ext4

  • EatEntry_st
entry
entry_user1
entry_user2
entry_user3
entry_user4
entry_user5
entry_user6
entry_user7
entry_user8
func_ext1
func_ext2
func_ext3
func_ext4
func_ext5
func_ext6
func_ext7
void(* EatEntry_st::func_ext4)(void *data)


EatEntry_st::func_ext5

  • EatEntry_st
entry
entry_user1
entry_user2
entry_user3
entry_user4
entry_user5
entry_user6
entry_user7
entry_user8
func_ext1
func_ext2
func_ext3
func_ext4
func_ext5
func_ext6
func_ext7
void(* EatEntry_st::func_ext5)(void *data)


EatEntry_st::func_ext6

  • EatEntry_st
entry
entry_user1
entry_user2
entry_user3
entry_user4
entry_user5
entry_user6
entry_user7
entry_user8
func_ext1
func_ext2
func_ext3
func_ext4
func_ext5
func_ext6
func_ext7
void(* EatEntry_st::func_ext6)(void *data)


EatEntry_st::func_ext7

  • EatEntry_st
entry
entry_user1
entry_user2
entry_user3
entry_user4
entry_user5
entry_user6
entry_user7
entry_user8
func_ext1
func_ext2
func_ext3
func_ext4
func_ext5
func_ext6
func_ext7
void(* EatEntry_st::func_ext7)(void *data)


EatWaitMode_enum

  • SYSTEM Type
EatEvent_enum
EatUser_enum
EatWaitMode_enum
enum EatWaitMode_enum
Enumerator:
EAT_NO_WAIT

return immediately

EAT_INFINITE_WAIT

return only when get a semaphore value


EatEvent_enum

  • SYSTEM Type
EatEvent_enum
EatUser_enum
EatWaitMode_enum
enum EatEvent_enum
Enumerator:
EAT_EVENT_NULL
EAT_EVENT_TIMER

timeout

EAT_EVENT_KEY

key press

EAT_EVENT_INT

GPIO interrupt

EAT_EVENT_MDM_READY_RD

receive Modem data

EAT_EVENT_MDM_READY_WR

Modem is ready for receive data

EAT_EVENT_MDM_RI

Modem RI index

EAT_EVENT_UART_READY_RD

uart data read ready

EAT_EVENT_UART_READY_WR

uart data write ready

EAT_EVENT_ADC
EAT_EVENT_UART_SEND_COMPLETE

send data complete

EAT_EVENT_USER_MSG
EAT_EVENT_NUM


EatUser_enum

  • SYSTEM Type
EatEvent_enum
EatUser_enum
EatWaitMode_enum
enum EatUser_enum

enum value for user task

Enumerator:
EAT_USER_0
EAT_USER_1
EAT_USER_2
EAT_USER_3
EAT_USER_4
EAT_USER_5
EAT_USER_6
EAT_USER_7
EAT_USER_8
EAT_USER_NUM


SYSTEM Function

Variables
SYSTEM Function
SYSTEM

Variables

unsigned char(*const | eat_get_event )(EatEvent_st *event)
unsigned int(*const | eat_get_event_num )(void)
eat_bool(*const | eat_reset_module )(void)
const char *(*const | eat_get_version )(void)
const char *(*const | eat_get_buildtime )(void)
const char *(*const | eat_get_buildno )(void)
eat_bool(*const | eat_get_event_for_user )(EatUser_enum user, EatEvent_st *event)
unsigned int(*const | eat_get_event_num_for_user )(EatUser_enum user)
eat_bool(*const | eat_send_msg_to_user )(EatUser_enum user_src, EatUser_enum user_dst, eat_bool use_point, unsigned char len, const unsigned char *data, const unsigned char **data_p)
eat_bool(*const | eat_sleep_enable )(eat_bool en)
EatSemId_st(*const | eat_create_sem )(unsigned char *sem_name_ptr, int initial_count)
eat_bool(*const | eat_sem_get )(EatSemId_st sem_id, EatWaitMode_enum wait_mode)
void(*const | eat_sem_put )(EatSemId_st sem_id)
int(*const | eat_sem_query )(EatSemId_st sem_id)
void(*const | eat_power_down )(void)

Detailed Description

SYSTEM funtion declaration.


eat_get_event

  • SYSTEM Function
eat_create_sem
eat_get_buildno
eat_get_buildtime
eat_get_event
eat_get_event_for_user
eat_get_event_num
eat_get_event_num_for_user
eat_get_version
eat_power_down
eat_reset_module
eat_sem_get
eat_sem_put
eat_sem_query
eat_send_msg_to_user
eat_sleep_enable
unsigned char(* const eat_get_event)(EatEvent_st *event)

Gets system EVENTs from the core side tasks. When there is no event in customer task's event queue, the task will enter suspend status.

Parameters
[in,out] *event The pointer to get a particular event
Returns
unsigned char,be always 1
Attention
this function can only be used in app_main() function
Header
#include "eat_interface.h"


eat_get_event_num

  • SYSTEM Function
eat_create_sem
eat_get_buildno
eat_get_buildtime
eat_get_event
eat_get_event_for_user
eat_get_event_num
eat_get_event_num_for_user
eat_get_version
eat_power_down
eat_reset_module
eat_sem_get
eat_sem_put
eat_sem_query
eat_send_msg_to_user
eat_sleep_enable
unsigned int(* const eat_get_event_num)(void)

Gets event number.

Parameters
void
Returns
unsigned int : current event number
Attention
this function can only be used in app_main() function
Header
#include "eat_interface.h"


eat_reset_module

  • SYSTEM Function
eat_create_sem
eat_get_buildno
eat_get_buildtime
eat_get_event
eat_get_event_for_user
eat_get_event_num
eat_get_event_num_for_user
eat_get_version
eat_power_down
eat_reset_module
eat_sem_get
eat_sem_put
eat_sem_query
eat_send_msg_to_user
eat_sleep_enable
eat_bool(* const eat_reset_module)(void)

Module reset.

Parameters
void
Returns
Returns | Meaning
EAT_TRUE | reset module success
EAT_FALSE | reset module failed
Header
#include "eat_interface.h"
Example
#include "eat_interface.h"
void eat_reset_test( void )
{
eat_reset_module();
eat_trace("module_reset_test");
}
Returns
module_reset_test
module_reset_test
module_reset_test
...


eat_get_version

  • SYSTEM Function
eat_create_sem
eat_get_buildno
eat_get_buildtime
eat_get_event
eat_get_event_for_user
eat_get_event_num
eat_get_event_num_for_user
eat_get_version
eat_power_down
eat_reset_module
eat_sem_get
eat_sem_put
eat_sem_query
eat_send_msg_to_user
eat_sleep_enable
const char*(*const eat_get_version)(void)

Gets verion, return value is the same as the AT command "AT+ATI".

Parameters
void
Returns
const char * : version
Header
#include "eat_interface.h"
Example
#include "eat_interface.h"
void eat_version_test( void )
{
eat_trace("eat_get_version=%s",eat_get_version());
}
Returns
eat_get_version=1116B01SIM840W64_WINBOND_EMBEDDEDAT


eat_get_buildtime

  • SYSTEM Function
eat_create_sem
eat_get_buildno
eat_get_buildtime
eat_get_event
eat_get_event_for_user
eat_get_event_num
eat_get_event_num_for_user
eat_get_version
eat_power_down
eat_reset_module
eat_sem_get
eat_sem_put
eat_sem_query
eat_send_msg_to_user
eat_sleep_enable
const char*(*const eat_get_buildtime)(void)

Gets core bin code build time.

Parameters
void
Returns
const char * : build time
Header
#include "eat_interface.h"
Example
#include "eat_interface.h"
void eat_get_bt_test( void )
{
eat_trace("eat_get_buildtime=%s",eat_get_buildtime());
}
Returns
eat_get_buildtime=2012/09/27 16:27


eat_get_buildno

  • SYSTEM Function
eat_create_sem
eat_get_buildno
eat_get_buildtime
eat_get_event
eat_get_event_for_user
eat_get_event_num
eat_get_event_num_for_user
eat_get_version
eat_power_down
eat_reset_module
eat_sem_get
eat_sem_put
eat_sem_query
eat_send_msg_to_user
eat_sleep_enable
const char*(*const eat_get_buildno)(void)

Gets build inner version number,return value is the same as the AT command "AT+CSUB".

Parameters
void
Returns
const char * : inner version number
Header
#include "eat_interface.h"
Example
#include "eat_interface.h"
void eat_get_bn_test( void )
{
eat_trace("eat_get_buildno=%s",eat_get_buildno());
}
Returns
eat_get_buildno=V02


eat_get_event_for_user

  • SYSTEM Function
eat_create_sem
eat_get_buildno
eat_get_buildtime
eat_get_event
eat_get_event_for_user
eat_get_event_num
eat_get_event_num_for_user
eat_get_version
eat_power_down
eat_reset_module
eat_sem_get
eat_sem_put
eat_sem_query
eat_send_msg_to_user
eat_sleep_enable
eat_bool(* const eat_get_event_for_user)(EatUser_enum user, EatEvent_st *event)

Used to get event in user task(app_user1,app_user2...app_user8),event is fixed, it's value is EAT_EVENT_USER_MSG,This function gets message sent by eat_send_msg_to_user().

Parameters
[in] user
current task user | ID Value
(app_user_func)EAT_NULL,//app_user1 | EAT_USER_1
(app_user_func)EAT_NULL,//app_user2 | EAT_USER_2
(app_user_func)EAT_NULL,//app_user3 | EAT_USER_3
(app_user_func)EAT_NULL,//app_user4 | EAT_USER_4
(app_user_func)EAT_NULL,//app_user5 | EAT_USER_5
(app_user_func)EAT_NULL,//app_user6 | EAT_USER_6
(app_user_func)EAT_NULL,//app_user7 | EAT_USER_7
(app_user_func)EAT_NULL,//app_user8 | EAT_USER_8
[in] *event Event body
Returns
Returns | Meaning
EAT_TRUE | get an event
EAT_FALSE | please check "param1 EatUser_enum user"
Header
#include "eat_interface.h"
Example
#include "eat_interface.h"
void eat_msg_test( void )
{
u8* msg_ptr=EAT_NULL;
msg_ptr = eat_mem_alloc(4);
memcpy(msg_ptr, "1_8", 4);
eat_send_msg_to_user(EAT_USER_1, EAT_USER_8, EAT_TRUE, 4, EAT_NULL, &msg_ptr);
eat_send_msg_to_user(EAT_USER_1, EAT_USER_7, EAT_FALSE, 60, "000000000011111111112222222222333333333344444444445555555555", EAT_NULL);
eat_send_msg_to_user(EAT_USER_1, EAT_USER_7, EAT_FALSE, 70, "0000000000111111111122222222223333333333444444444455555555556666666666", EAT_NULL);
}
void app_user7(void *data)
{
EatEvent_st event;
while(1)
{
eat_get_event_for_user(EAT_USER_7, &event);
if(event.event == EAT_EVENT_USER_MSG)
{
eat_trace("app_user7: %d %d %d %s %x", event.data.user_msg.src, event.data.user_msg.use_point,
event.data.user_msg.len, event.data.user_msg.data, event.data.user_msg.data_p);
}
}
}
void app_user8(void *data)
{
u32 num,num1;
EatEvent_st event;
while(1)
{
num1= eat_get_event_num_for_user(EAT_USER_8);
eat_get_event_for_user(EAT_USER_8, &event);
num= eat_get_event_num_for_user(EAT_USER_8);
eat_trace("user8: event num =%d,%d",num1,num);
if(event.event == EAT_EVENT_USER_MSG)
{
eat_trace("user8: %d %d %d %s %x", event.data.user_msg.src, event.data.user_msg.use_point,
event.data.user_msg.len, event.data.user_msg.data, event.data.user_msg.data_p);
}
eat_mem_free((void *)event.data.user_msg.data_p);
}
}
Returns
user8: event num =0,0
user8: 1 1 4 f01700a4
app_user7: 1 0 60 000000000011111111112222222222333333333344444444445555555555 0
app_user7: 1 0 70 000000000011111111112222222222333333333344444444445555555555666 0


eat_get_event_num_for_user

  • SYSTEM Function
eat_create_sem
eat_get_buildno
eat_get_buildtime
eat_get_event
eat_get_event_for_user
eat_get_event_num
eat_get_event_num_for_user
eat_get_version
eat_power_down
eat_reset_module
eat_sem_get
eat_sem_put
eat_sem_query
eat_send_msg_to_user
eat_sleep_enable
unsigned int(* const eat_get_event_num_for_user)(EatUser_enum user)

Gets user task(app_user1,app_user2...app_user8) event number.

Parameters
[in] user EatUser_enum
Returns
unsigned int : event number in current task's queue
Header
#include "eat_interface.h"
Example
See the example for eat_get_event_for_user.


eat_send_msg_to_user

  • SYSTEM Function
eat_create_sem
eat_get_buildno
eat_get_buildtime
eat_get_event
eat_get_event_for_user
eat_get_event_num
eat_get_event_num_for_user
eat_get_version
eat_power_down
eat_reset_module
eat_sem_get
eat_sem_put
eat_sem_query
eat_send_msg_to_user
eat_sleep_enable
eat_bool(* const eat_send_msg_to_user)(EatUser_enum user_src, EatUser_enum user_dst, eat_bool use_point, unsigned char len, const unsigned char *data, const unsigned char **data_p)

App_main is the system main task.Other eight tasks are user task , this interface is used to send messages between these tasks.

task | ID
app_main | EAT_USER_0
(app_user_func)EAT_NULL,//app_user1 | EAT_USER_1
(app_user_func)EAT_NULL,//app_user2 | EAT_USER_2
(app_user_func)EAT_NULL,//app_user3 | EAT_USER_3
(app_user_func)EAT_NULL,//app_user4 | EAT_USER_4
(app_user_func)EAT_NULL,//app_user5 | EAT_USER_5
(app_user_func)EAT_NULL,//app_user6 | EAT_USER_6
(app_user_func)EAT_NULL,//app_user7 | EAT_USER_7
(app_user_func)EAT_NULL,//app_user8 | EAT_USER_8
Parameters
[in] | user_src | Sending messages task ID, corresponding relation as above, app_user1 corresponding EAT_USER_1...
[in] | user_dst | Receiving messages task ID, corresponding relation with the same user_src
[in] use_point If the value is EAT_TRUE, user apply space to keep news content, message data directly use const unsigned char * * data_p space;
If the value is EAT_FALSE, use function internal space to save news content, max size is EAT_USER_MSG_MAX_SIZE-1 byte, more than EAT_USER_MSG_MAX_SIZE-1 byte of data will be discarded off.
[in] | len | Message data length
[in] | *data | Message data body parts, if eat_bool use_point EAT_FALSE, function will copy pointer space data, or will not use it
[in] | **data_p | Message data section, if eat_bool use_point EAT_TRUE, function will use the pointer , so user should apply and release the space
Returns
Returns | Meaning
EAT_TRUE | send message successfully
EAT_FALSE | send message failed,please check whether user_src user_dst is valid
Header
#include "eat_interface.h"
Example
See the example for eat_get_event_for_user.


eat_sleep_enable

  • SYSTEM Function
eat_create_sem
eat_get_buildno
eat_get_buildtime
eat_get_event
eat_get_event_for_user
eat_get_event_num
eat_get_event_num_for_user
eat_get_version
eat_power_down
eat_reset_module
eat_sem_get
eat_sem_put
eat_sem_query
eat_send_msg_to_user
eat_sleep_enable
eat_bool(*const eat_sleep_enable)(eat_bool en)

Enables module to enter sleep mode.

Parameters
[in] en eat_bool
EAT_TRUE enable module to enter sleep mode;
EAT_FALSE disable module to enter sleep mode
Returns
eat_bool en: EAT_TRUE
Header
#include "eat_interface.h"


eat_create_sem

  • SYSTEM Function
eat_create_sem
eat_get_buildno
eat_get_buildtime
eat_get_event
eat_get_event_for_user
eat_get_event_num
eat_get_event_num_for_user
eat_get_version
eat_power_down
eat_reset_module
eat_sem_get
eat_sem_put
eat_sem_query
eat_send_msg_to_user
eat_sleep_enable
EatSemId_st(* const eat_create_sem)(unsigned char *sem_name_ptr, int initial_count)

Creates a semaphore.

Parameters
[in] | *sem_name_ptr | Semaphore name
[in] | initial_count | Default semaphore value
Returns
EatSemId_st: semaphore id
Header
#include "eat_interface.h"
Example
#include "eat_interface.h"
EatSemId_st sem_id_user1=EAT_NULL;
void eat_sem_test( void )
{
if( EAT_NULL != sem_id_user1)
{
eat_sem_put(sem_id_user1);
}
}
void app_user1(void *data)
{
EatEvent_st event;
int sem_val;
eat_bool ret;
sem_id_user1 = eat_create_sem("eat_test",0);
ret = eat_sem_get(sem_id_user1,EAT_NO_WAIT);
if( EAT_TRUE == ret )
{
eat_trace("EAT_NO_WAIT:get one sem");
}else
{
eat_trace("EAT_NO_WAIT:get none sem");
}
eat_sem_put(sem_id_user1);
sem_val = eat_sem_query(sem_id_user1);
eat_trace("sem value:%d",sem_val);
do
{ eat_trace("EAT_INFINITE_WAIT: ");
eat_sem_get(sem_id_user1,EAT_INFINITE_WAIT);
eat_trace("EAT_INFINITE_WAIT: get one sem");
}while(1);
}
Returns
EAT_NO_WAIT:get none sem
sem value:1
EAT_INFINITE_WAIT:
EAT_INFINITE_WAIT: get one sem
EAT_INFINITE_WAIT:


eat_sem_get

  • SYSTEM Function
eat_create_sem
eat_get_buildno
eat_get_buildtime
eat_get_event
eat_get_event_for_user
eat_get_event_num
eat_get_event_num_for_user
eat_get_version
eat_power_down
eat_reset_module
eat_sem_get
eat_sem_put
eat_sem_query
eat_send_msg_to_user
eat_sleep_enable
eat_bool(* const eat_sem_get)(EatSemId_st sem_id, EatWaitMode_enum wait_mode)

Gets a semaphore.

Parameters
[in] | sem_id | Created by eat_create_sem()
[in] | wait_mode | Wait mode
Returns
Returns | Meaning
EAT_TRUE | get one semaphore
EAT_FALSE | get semaphore failed,the reason may be invalid sem_id or current semaphore value equal zero
Header
#include "eat_interface.h"
Example
See the example for eat_create_sem.


eat_sem_put

  • SYSTEM Function
eat_create_sem
eat_get_buildno
eat_get_buildtime
eat_get_event
eat_get_event_for_user
eat_get_event_num
eat_get_event_num_for_user
eat_get_version
eat_power_down
eat_reset_module
eat_sem_get
eat_sem_put
eat_sem_query
eat_send_msg_to_user
eat_sleep_enable
void(* const eat_sem_put)(EatSemId_st sem_id)

Adds semaphore value by one.

Parameters
[in] sem_id Semaphore id
Returns
Header
#include "eat_interface.h"
Example
See the example for eat_create_sem.


eat_sem_query

  • SYSTEM Function
eat_create_sem
eat_get_buildno
eat_get_buildtime
eat_get_event
eat_get_event_for_user
eat_get_event_num
eat_get_event_num_for_user
eat_get_version
eat_power_down
eat_reset_module
eat_sem_get
eat_sem_put
eat_sem_query
eat_send_msg_to_user
eat_sleep_enable
int(* const eat_sem_query)(EatSemId_st sem_id)

Queries current semaphore value

Parameters
[in] sem_id Semaphore id
Returns
int: semaphore value
Header
#include "eat_interface.h"
Example
See the example for eat_create_sem.


eat_power_down

  • SYSTEM Function
eat_create_sem
eat_get_buildno
eat_get_buildtime
eat_get_event
eat_get_event_for_user
eat_get_event_num
eat_get_event_num_for_user
eat_get_version
eat_power_down
eat_reset_module
eat_sem_get
eat_sem_put
eat_sem_query
eat_send_msg_to_user
eat_sleep_enable
void(* const eat_power_down)(void)

This function turns off the system. It has the same effect as the AT command "AT+CPOWD=1". When the system is powered down successfully, "NORMAL POWER DOWN" will be sent to the serial port.

Parameters
void
Returns
void
Header
#include "eat_interface.h"
Example
#include "eat_interface.h"
void eat_powdown_test( void )
{
eat_power_down();
}
Returns
at terminal output: NORMAL POWER DOWN


TIMER

Modules
TIMER

Modules

TIMER Type
TIMER Function

Detailed Description

This module offers the TIMER operation API and type defination.

Author
Maobin bin.m.nosp@m.ao@s.nosp@m.im.co.nosp@m.m
Date
2012/09/24
  Copyright (C) 2002-2012 Shanghai SIMCom Wireless Solutions Ltd.

  All rights reserved.


TIMER Type
TIMER

Data Structures

struct | EatTimer_st
struct | EatRtc_st

Enumerations

enum EatTimer_enum {
EAT_TIMER_1,
EAT_TIMER_2,
EAT_TIMER_3,
EAT_TIMER_4,
EAT_TIMER_5,
EAT_TIMER_6,
EAT_TIMER_7,
EAT_TIMER_8,
EAT_TIMER_9,
EAT_TIMER_10,
EAT_TIMER_11,
EAT_TIMER_12,
EAT_TIMER_13,
EAT_TIMER_14,
EAT_TIMER_15,
EAT_TIMER_16,
EAT_TIMER_NUM
}

Detailed Description

TIMER type defination.


EatTimer_st Struct Reference

Data Fields
EatTimer_st Struct Reference
TIMER Type

Data Fields

EatTimer_enum timer_id

Detailed Description

EAT_EVENT_TIMER data


EatTimer_st::timer_id

  • EatTimer_st
timer_id
EatTimer_enum EatTimer_st::timer_id

timer id


EatRtc_st Struct Reference

Data Fields
EatRtc_st Struct Reference
TIMER Type

Data Fields

unsigned char | sec
unsigned char | min
unsigned char | hour
unsigned char | day
unsigned char | mon
unsigned char | wday
unsigned char | year

Detailed Description

Timer RTC struct definition


EatRtc_st::sec

  • EatRtc_st
day
hour
min
mon
sec
wday
year
unsigned char EatRtc_st::sec

second, range [0, 59]


EatRtc_st::min

  • EatRtc_st
day
hour
min
mon
sec
wday
year
unsigned char EatRtc_st::min

minute, range[0,59]


EatRtc_st::hour

  • EatRtc_st
day
hour
min
mon
sec
wday
year
unsigned char EatRtc_st::hour

hour, range[0,23]


EatRtc_st::day

  • EatRtc_st
day
hour
min
mon
sec
wday
year
unsigned char EatRtc_st::day

day, range[1,31]


EatRtc_st::mon

  • EatRtc_st
day
hour
min
mon
sec
wday
year
unsigned char EatRtc_st::mon

month, range[1,12]


EatRtc_st::wday

  • EatRtc_st
day
hour
min
mon
sec
wday
year
unsigned char EatRtc_st::wday

day of the week, range[1,7]


EatRtc_st::year

  • EatRtc_st
day
hour
min
mon
sec
wday
year
unsigned char EatRtc_st::year

year, range[0,127]


EatTimer_enum

  • TIMER Type
EatTimer_enum
enum EatTimer_enum

Timer ID

Enumerator:
EAT_TIMER_1
EAT_TIMER_2
EAT_TIMER_3
EAT_TIMER_4
EAT_TIMER_5
EAT_TIMER_6
EAT_TIMER_7
EAT_TIMER_8
EAT_TIMER_9
EAT_TIMER_10
EAT_TIMER_11
EAT_TIMER_12
EAT_TIMER_13
EAT_TIMER_14
EAT_TIMER_15
EAT_TIMER_16
EAT_TIMER_NUM


TIMER Function
TIMER

Typedefs

typedef void(* eat_gpt_callback_func )(void)

Variables

eat_bool(*const | eat_timer_start )(EatTimer_enum id, unsigned int period)
eat_bool(*const | eat_timer_stop )(EatTimer_enum id)
unsigned int(*const | eat_get_current_time )(void)
unsigned int(*const | eat_get_duration_ms )(unsigned int previous_time)
unsigned int(*const | eat_get_duration_us )(unsigned int previous_time)
void(*const | eat_sleep )(unsigned int delay)
eat_bool(*const | eat_get_rtc )(EatRtc_st *rtc)
eat_bool(*const | eat_set_rtc )(const EatRtc_st *rtc)
eat_bool(*const | eat_gpt_start )(unsigned int period, eat_bool loop, eat_gpt_callback_func callback)
eat_bool(*const | eat_gpt_stop )(void)

Detailed Description

TIMER funtion declaration.


eat_gpt_callback_func

  • TIMER Function
eat_get_current_time
eat_get_duration_ms
eat_get_duration_us
eat_get_rtc
eat_gpt_callback_func
eat_gpt_start
eat_gpt_stop
eat_set_rtc
eat_sleep
eat_timer_start
eat_timer_stop
typedef void(* eat_gpt_callback_func)(void)

GPT callback function


eat_timer_start

  • TIMER Function
eat_get_current_time
eat_get_duration_ms
eat_get_duration_us
eat_get_rtc
eat_gpt_callback_func
eat_gpt_start
eat_gpt_stop
eat_set_rtc
eat_sleep
eat_timer_start
eat_timer_stop
eat_bool(* const eat_timer_start)(EatTimer_enum id, unsigned int period)

Starts the timer.

Parameters
[in] | id | The ID of the timer
[in] | period | The period ,units millisecond,the minimum value is 5ms
Returns
Returns | Meaning
EAT_TRUE | success
EAT_FALSE | failure
if fail, please check the id value
Attention
The minimum time is 5ms. If the period is less than 5 while setting,the expiry message will be sent to EAT module after 5ms also.
Header
#include "eat_timer.h"
Example
#include "eat_interface.h"
#include "eat_timer.h"
extern void APP_InitRegions(void);
void app_main(void *data)
{
EatEvent_st event;
APP_InitRegions();//Init app RAM
eat_timer_start(EAT_TIMER_1, 1000);
eat_timer_start(EAT_TIMER_2, 2000);
eat_timer_start(EAT_TIMER_3, 3000);
while(EAT_TRUE)
{
eat_get_event(&event);
eat_trace("MSG id%x", event.event);
switch(event.event)
{
case EAT_EVENT_TIMER :
{
//Restart timer
eat_timer_start(event.data.timer.timer_id, 3000);
eat_trace("Timer test , timer ID:%d", event.data.timer.timer_id);
}
break;
default:
break;
}
}
}


eat_timer_stop

  • TIMER Function
eat_get_current_time
eat_get_duration_ms
eat_get_duration_us
eat_get_rtc
eat_gpt_callback_func
eat_gpt_start
eat_gpt_stop
eat_set_rtc
eat_sleep
eat_timer_start
eat_timer_stop
eat_bool(* const eat_timer_stop)(EatTimer_enum id)

Stops the timer.

Parameters
[in] id The ID of the timer
Returns
Returns | Meaning
EAT_TRUE | success
EAT_FALSE | failure

if fail, please check the id value

Header
#include "eat_timer.h"
Example
See the example for eat_timer_start.


eat_get_current_time

  • TIMER Function
eat_get_current_time
eat_get_duration_ms
eat_get_duration_us
eat_get_rtc
eat_gpt_callback_func
eat_gpt_start
eat_gpt_stop
eat_set_rtc
eat_sleep
eat_timer_start
eat_timer_stop
unsigned int(* const eat_get_current_time)(void)

Gets current time value.

Parameters
void
Returns
unsigned int, each unit is 31.25us,from 0 to 0x1000000
Header
#include "eat_timer.h"
Example
See the example for eat_get_duration_ms.


eat_get_duration_ms

  • TIMER Function
eat_get_current_time
eat_get_duration_ms
eat_get_duration_us
eat_get_rtc
eat_gpt_callback_func
eat_gpt_start
eat_gpt_stop
eat_set_rtc
eat_sleep
eat_timer_start
eat_timer_stop
unsigned int(* const eat_get_duration_ms)(unsigned int previous_time)

Obtaines with the current time interval.

Parameters
[in] previous_time The value of eat_get_current_time()
Returns
unsigned int,the interval time,units millisecond(ms = 1/1000 second)
Attention
The return value is millsecond(ms).
Header
#include "eat_timer.h"
Example
#include "eat_interface.h"
#include "eat_timer.h"
void eat_get_time_testing(void)
{
u32 time1=0,time2 = 0;
time1 = eat_get_current_time();
eat_sleep(10);
time2 = eat_get_duration_ms(time1);
eat_trace("Timer test , interval time(ms):%d",time2);
time2 = eat_get_duration_us(time1);
eat_trace("Timer test , interval time(us):%d",time2);
}


eat_get_duration_us

  • TIMER Function
eat_get_current_time
eat_get_duration_ms
eat_get_duration_us
eat_get_rtc
eat_gpt_callback_func
eat_gpt_start
eat_gpt_stop
eat_set_rtc
eat_sleep
eat_timer_start
eat_timer_stop
unsigned int(* const eat_get_duration_us)(unsigned int previous_time)

Obtaines with the current time interval.

Parameters
[in] previous_time The value of eat_get_current_time()
Returns
unsigned int,the interval time,units microsecond(us = 1/1000000 second)
Attention
The return value is microsecond(us).
Header
#include "eat_timer.h"
Example
See the example for eat_get_duration_ms.


eat_sleep

  • TIMER Function
eat_get_current_time
eat_get_duration_ms
eat_get_duration_us
eat_get_rtc
eat_gpt_callback_func
eat_gpt_start
eat_gpt_stop
eat_set_rtc
eat_sleep
eat_timer_start
eat_timer_stop
void(* const eat_sleep)(unsigned int delay)

Forces a task to sleep for a duration.

Parameters
[in] delay The delay,unit is 1 millisecond,the minimum value is 5ms
Returns
void
Attention
The minimum time is 5ms. If the delay is less than 5,also set 5 in kernel.
Header
#include "eat_timer.h"


eat_get_rtc

  • TIMER Function
eat_get_current_time
eat_get_duration_ms
eat_get_duration_us
eat_get_rtc
eat_gpt_callback_func
eat_gpt_start
eat_gpt_stop
eat_set_rtc
eat_sleep
eat_timer_start
eat_timer_stop
eat_bool(* const eat_get_rtc)(EatRtc_st *rtc)

Gets the RTC value.

Parameters
[in] rtc The rtc value,refer to construction EatRtc_st
Returns
Returns | Meaning
EAT_TRUE | success
Others | failure
Header
#include "eat_timer.h"
Example
void eat_rtc_fun_test(u8 param)
{
eat_bool result ;
EatRtc_st rtc = {0};
if( 1 == param)
{
//get rtc value
result = eat_get_rtc(&rtc);
if( result )
{
eat_trace("Timer test get rtc value:%d/%d/%d %02d:%02d:%02d",
rtc.year,rtc.mon,rtc.day,rtc.hour,rtc.min,rtc.sec);
}else
{
eat_trace("Timer test get rtc fail");
}
}else if( 2 == param )
{
rtc.year = 12;
rtc.mon = 10;
rtc.day = 10;
rtc.hour = 11;
rtc.min = 11;
rtc.sec = 59;
//set rtc
result = eat_set_rtc(&rtc);
if( result )
{
eat_trace("Timer test rtc set succeed");
}else
{
eat_trace("Timer test rtc set fail");
}
}
}


eat_set_rtc

  • TIMER Function
eat_get_current_time
eat_get_duration_ms
eat_get_duration_us
eat_get_rtc
eat_gpt_callback_func
eat_gpt_start
eat_gpt_stop
eat_set_rtc
eat_sleep
eat_timer_start
eat_timer_stop
eat_bool(* const eat_set_rtc)(const EatRtc_st *rtc)

Sets the RTC value.

Parameters
[in] rtc The rtc value,refer to construction EatRtc_st
Returns
Returns | Meaning
EAT_TRUE | success
Others | failure
Header
#include "eat_timer.h"
Example
See the example for eat_get_rtc.


eat_gpt_start

  • TIMER Function
eat_get_current_time
eat_get_duration_ms
eat_get_duration_us
eat_get_rtc
eat_gpt_callback_func
eat_gpt_start
eat_gpt_stop
eat_set_rtc
eat_sleep
eat_timer_start
eat_timer_stop
eat_bool(* const eat_gpt_start)(unsigned int period, eat_bool loop, eat_gpt_callback_func callback)

Starts gpt timer.

Parameters
[in] period The timeout value ,echo unit is 61.035(1000000/16384)us, from 0 to 0xffff.
If timing one second,the "period" parameter is 16384.
[in] loop eat_bool
Param | Meaning
EAT_TRUE | auto-repeat
EAT_FALSE | once
[in] callback The callback function pointer
Returns
Returns | Meaning
EAT_TRUE | success
EAT_FALSE | failure
Attention
The GPT timer is a hardware timer, don't execute blocking function in the callback function,
such as sleep, get semaphores, allocation memory and so on , and execution time as far as possible short.
Header
#include "eat_timer.h"
Example
static u32 gpt_timer_counter = 0;
void eat_gpt_cb_fun(void)
{
gpt_timer_counter ++;
}
void eat_gpt_timer_testing_start(void)
{
//clear counter
gpt_timer_counter = 0;
//start gpt timer, auto-repeat, (62.5*1000)us
eat_gpt_start(1000,EAT_TRUE, eat_gpt_cb_fun);
eat_trace("Timer test , GPT timer start");
}
void eat_gpt_timer_testing_stop(void)
{
//stop gpt timer
eat_gpt_stop();
eat_trace("Timer test , GPT timer counter:%d",gpt_timer_counter);
}


eat_gpt_stop

  • TIMER Function
eat_get_current_time
eat_get_duration_ms
eat_get_duration_us
eat_get_rtc
eat_gpt_callback_func
eat_gpt_start
eat_gpt_stop
eat_set_rtc
eat_sleep
eat_timer_start
eat_timer_stop
eat_bool(* const eat_gpt_stop)(void)

Stops gpt timer.

 @param  void
Returns
Returns | Meaning
EAT_TRUE | success
EAT_FALSE | failure
Header
#include "eat_timer.h"
Example
See the example for eat_gpt_start.


UART

Modules
UART

Modules

UART Type
UART Function

Detailed Description

This module offers the UART operation API and type defination.

Author
Yangming yang..nosp@m.ming.nosp@m.@sim..nosp@m.com
Date
2012/09/24
   Copyright (C) 2002-2012 Shanghai SIMCom Wireless Solutions Ltd.

   All rights reserved.


UART Type
UART

Data Structures

struct | EatUart_st
struct | EatUartConfig_st

Enumerations

enum EatUart_enum {
EAT_UART_1,
EAT_UART_2,
EAT_UART_3,
EAT_UART_NUM,
EAT_UART_NULL = 99
}
enum EatUartBaudrate {
EAT_UART_BAUD_9600 =9600,
EAT_UART_BAUD_19200 =19200,
EAT_UART_BAUD_38400 =38400,
EAT_UART_BAUD_57600 =57600,
EAT_UART_BAUD_115200 =115200
}
enum EatUartDataBits_enum {
EAT_UART_DATA_BITS_5 =5,
EAT_UART_DATA_BITS_6,
EAT_UART_DATA_BITS_7,
EAT_UART_DATA_BITS_8
}
enum EatUartStopBits_enum {
EAT_UART_STOP_BITS_1 =1,
EAT_UART_STOP_BITS_2,
EAT_UART_STOP_BITS_1_5
}
enum EatUartParity_enum {
EAT_UART_PARITY_NONE =0,
EAT_UART_PARITY_ODD,
EAT_UART_PARITY_EVEN,
EAT_UART_PARITY_SPACE
}

Detailed Description

UART type defination.


EatUart_st Struct Reference

Data Fields
EatUart_st Struct Reference
UART Type

Data Fields

EatUart_enum uart

Detailed Description

This struct block carries the UART port for EAT_EVENT_UART_READY_RD and EAT_EVENT_UART_READY_WR.


EatUart_st::uart

  • EatUart_st
uart
EatUart_enum EatUart_st::uart

UART port delivered from UART related events


EatUartConfig_st Struct Reference

Data Fields
EatUartConfig_st Struct Reference
UART Type

Data Fields

EatUartBaudrate baud
EatUartDataBits_enum dataBits
EatUartStopBits_enum stopBits
EatUartParity_enum parity

Detailed Description

EAT UART configuration structure.


EatUartConfig_st::baud

  • EatUartConfig_st
baud
dataBits
parity
stopBits
EatUartBaudrate EatUartConfig_st::baud

bandrate, typically EAT_UART_BAUD_115200


EatUartConfig_st::dataBits

  • EatUartConfig_st
baud
dataBits
parity
stopBits
EatUartDataBits_enum EatUartConfig_st::dataBits

data bits mode, typically EAT_UART_DATA_BITS_8


EatUartConfig_st::stopBits

  • EatUartConfig_st
baud
dataBits
parity
stopBits
EatUartStopBits_enum EatUartConfig_st::stopBits

stop bits mode, typically EAT_UART_STOP_BITS_1


EatUartConfig_st::parity

  • EatUartConfig_st
baud
dataBits
parity
stopBits
EatUartParity_enum EatUartConfig_st::parity

parity bits mode, typically EAT_UART_PARITY_NONE


EatUart_enum

  • UART Type
EatUart_enum
EatUartBaudrate
EatUartDataBits_enum
EatUartParity_enum
EatUartStopBits_enum
enum EatUart_enum

This enumerate all the UART ports!

Enumerator:
EAT_UART_1

represents physical UART port 1

EAT_UART_2

represents physical UART port 2

EAT_UART_3

represents physical UART port 3

EAT_UART_NUM

not a valid port, just verifying input parameter for API call.

Warning
Do not use this for any API.
EAT_UART_NULL

it's used for disable some UART functionality, like debug port, at port,etc.


EatUartBaudrate

  • UART Type
EatUart_enum
EatUartBaudrate
EatUartDataBits_enum
EatUartParity_enum
EatUartStopBits_enum
enum EatUartBaudrate

EAT UART bandrate type.

Enumerator:
EAT_UART_BAUD_9600
EAT_UART_BAUD_19200
EAT_UART_BAUD_38400
EAT_UART_BAUD_57600
EAT_UART_BAUD_115200


EatUartDataBits_enum

  • UART Type
EatUart_enum
EatUartBaudrate
EatUartDataBits_enum
EatUartParity_enum
EatUartStopBits_enum
enum EatUartDataBits_enum

EAT UART data bits mode.

Enumerator:
EAT_UART_DATA_BITS_5
EAT_UART_DATA_BITS_6
EAT_UART_DATA_BITS_7
EAT_UART_DATA_BITS_8


EatUartStopBits_enum

  • UART Type
EatUart_enum
EatUartBaudrate
EatUartDataBits_enum
EatUartParity_enum
EatUartStopBits_enum
enum EatUartStopBits_enum

EAT UART stop bits mode.

Enumerator:
EAT_UART_STOP_BITS_1
EAT_UART_STOP_BITS_2
EAT_UART_STOP_BITS_1_5


EatUartParity_enum

  • UART Type
EatUart_enum
EatUartBaudrate
EatUartDataBits_enum
EatUartParity_enum
EatUartStopBits_enum
enum EatUartParity_enum

EAT UART parity bits mode.

Enumerator:
EAT_UART_PARITY_NONE
EAT_UART_PARITY_ODD
EAT_UART_PARITY_EVEN
EAT_UART_PARITY_SPACE


UART Function

Variables
UART Function
UART

Variables

eat_bool(*const | eat_uart_open )(EatUart_enum uart)
eat_bool(*const | eat_uart_close )(EatUart_enum uart)
eat_bool(*const | eat_uart_set_config )(EatUart_enum uart, const EatUartConfig_st *config)
eat_bool(*const | eat_uart_get_config )(EatUart_enum uart, EatUartConfig_st *config)
eat_bool(*const | eat_uart_set_baudrate )(EatUart_enum uart, EatUartBaudrate baudrate)
EatUartBaudrate(*const | eat_uart_get_baudrate )(EatUart_enum uart)
unsigned short(*const | eat_uart_write )(EatUart_enum uart, const unsigned char *data, unsigned short len)
unsigned short(*const | eat_uart_read )(EatUart_enum uart, unsigned char *data, unsigned short len)
eat_bool(*const | eat_uart_set_debug )(EatUart_enum uart)
eat_bool(*const | eat_uart_set_at_port )(EatUart_enum uart)
eat_bool(*const | eat_uart_set_send_complete_event )(EatUart_enum uart, eat_bool send)
eat_bool(*const | eat_uart_get_send_complete_status )(EatUart_enum uart)
unsigned short(*const | eat_uart_get_free_space )(EatUart_enum uart)

Detailed Description

UART funtion declaration.


eat_uart_open

  • UART Function
eat_uart_close
eat_uart_get_baudrate
eat_uart_get_config
eat_uart_get_free_space
eat_uart_get_send_complete_status
eat_uart_open
eat_uart_read
eat_uart_set_at_port
eat_uart_set_baudrate
eat_uart_set_config
eat_uart_set_debug
eat_uart_set_send_complete_event
eat_uart_write
eat_bool(* const eat_uart_open)(EatUart_enum uart)

Opens a uart port.Allocates memory in the UART driver, refreshes UART FIFO, enables UART interrupt, etc.

Parameters
[in] uart UART port, can be following value:
  • EAT_UART_1
  • EAT_UART_2
  • EAT_UART_3
Returns
EAT_TRUE if success, otherwise EAT_FALSE.
Returns | Meaning
EAT_TRUE | success
EAT_FALSE | errors
Header
#include "eat_uart.h"
Example
#include "Eat_uart.h"
#define EAT_UART_RX_BUF_LEN_MAX 2048
static void uart_rx_proc(const EatEvent_st* event)
{
u16 len;
u8 rx_buf[EAT_UART_RX_BUF_LEN_MAX];
EatUart_enum uart = event->data.uart.uart;
len = eat_uart_read(uart, rx_buf, EAT_UART_RX_BUF_LEN_MAX);
if(len != 0)
{
//write back
eat_uart_write(uart, rx_buf, len);
}
}
static void uart_send_complete_proc(const EatEvent_st* event)
{
eat_trace("[%s] uart(%d) send complete", __FUNCTION__, event->data.uart.uart);
}
static void app_main(void *data)
{
EatUartConfig_st uart_config;
EatUart_enum eat_uart_main = EAT_UART_1;
EatEvent_st event;
if(eat_uart_open(eat_uart_main ) == EAT_FALSE)
{
eat_trace("[%s] uart(%d) open fail!", __FUNCTION__, eat_uart_main);
}
uart_config.baud = 115200;
uart_config.dataBits = EAT_UART_DATA_BITS_8;
uart_config.parity = EAT_UART_PARITY_NONE;
uart_config.stopBits = EAT_UART_STOP_BITS_1;
if(EAT_FALSE == eat_uart_set_config(eat_uart_main, &uart_config))
{
eat_trace("[%s] uart(%d) set config fail!", __FUNCTION__, eat_uart_main);
}
eat_uart_set_send_complete_event(eat_uart_main, EAT_TRUE);
while(1)
{
eat_get_event(&event);
eat_trace("[%s] event_id=%d", __FUNCTION__, event.event);
if (event.event == EAT_EVENT_NULL || event.event >= EAT_EVENT_NUM)
{
eat_trace("[%s] invalid event type", __FUNCTION__, event.event);
continue;
}
switch (event.event)
{
case EAT_EVENT_UART_READY_RD:
uart_rx_proc(&event);
break;
case EAT_EVENT_UART_SEND_COMPLETE:
uart_send_complete_proc(&event);
break;
default:
break;
}
}
}


eat_uart_close

  • UART Function
eat_uart_close
eat_uart_get_baudrate
eat_uart_get_config
eat_uart_get_free_space
eat_uart_get_send_complete_status
eat_uart_open
eat_uart_read
eat_uart_set_at_port
eat_uart_set_baudrate
eat_uart_set_config
eat_uart_set_debug
eat_uart_set_send_complete_event
eat_uart_write
eat_bool(* const eat_uart_close)(EatUart_enum uart)

Close a uart port. Frees any memory allocated by eat_uart_open, disables UART interrupt, etc. This function is called when the EAT application no longer uses the UART port.

Parameters
[in] uart UART port.
Returns
EAT_TRUE if success, otherwise EAT_FALSE.
Header
#include "eat_uart.h"
Example
See the example for eat_uart_open.


eat_uart_set_config

  • UART Function
eat_uart_close
eat_uart_get_baudrate
eat_uart_get_config
eat_uart_get_free_space
eat_uart_get_send_complete_status
eat_uart_open
eat_uart_read
eat_uart_set_at_port
eat_uart_set_baudrate
eat_uart_set_config
eat_uart_set_debug
eat_uart_set_send_complete_event
eat_uart_write
eat_bool(* const eat_uart_set_config)(EatUart_enum uart, const EatUartConfig_st *config)

The parameters are specified in a EatUartConfig_st structure type. The user must allocate memory for the configuration and the UART driver sets the parameters. The UART driver keeps a local copy of the configuration content.

Parameters
[in] | uart | UART port.
[in] | config | Pointer to UART configuration block.
Returns
EAT_TRUE if success, otherwise EAT_FALSE.
Header
#include "eat_uart.h"
Example
See the example for eat_uart_open.


eat_uart_get_config

  • UART Function
eat_uart_close
eat_uart_get_baudrate
eat_uart_get_config
eat_uart_get_free_space
eat_uart_get_send_complete_status
eat_uart_open
eat_uart_read
eat_uart_set_at_port
eat_uart_set_baudrate
eat_uart_set_config
eat_uart_set_debug
eat_uart_set_send_complete_event
eat_uart_write
eat_bool(* const eat_uart_get_config)(EatUart_enum uart, EatUartConfig_st *config)

The parameters are specified in a EatUartConfig_st structure type. The user must allocate memory for the configuration, and the UART driver copies the content of the current configuration to the address to which the EatUartConfig_st* type parameter points.

Parameters
[in] | uart | UART port.
[out] | config | Pointer to UART configuration block.
Returns
EAT_TRUE if success, otherwise EAT_FALSE.
Header
#include "eat_uart.h"
Example
EatUartConfig_st uart_config;
if(EAT_TRUE == eat_uart_get_config( EAT_UART_1, &uart_config))
{
...
}


eat_uart_set_baudrate

  • UART Function
eat_uart_close
eat_uart_get_baudrate
eat_uart_get_config
eat_uart_get_free_space
eat_uart_get_send_complete_status
eat_uart_open
eat_uart_read
eat_uart_set_at_port
eat_uart_set_baudrate
eat_uart_set_config
eat_uart_set_debug
eat_uart_set_send_complete_event
eat_uart_write
eat_bool(* const eat_uart_set_baudrate)(EatUart_enum uart, EatUartBaudrate baudrate)

Sets the baudrate configuration.

Parameters
[in] | uart | UART port.
[in] | baudrate | New baudrate. See EatUartBaudrate.
Returns
EAT_TRUE if success, otherwise EAT_FALSE.
Header
#include "eat_uart.h"
Example
eat_uart_set_baudrate(EAT_UART_1, EAT_UART_BAUD_115200);


eat_uart_get_baudrate

  • UART Function
eat_uart_close
eat_uart_get_baudrate
eat_uart_get_config
eat_uart_get_free_space
eat_uart_get_send_complete_status
eat_uart_open
eat_uart_read
eat_uart_set_at_port
eat_uart_set_baudrate
eat_uart_set_config
eat_uart_set_debug
eat_uart_set_send_complete_event
eat_uart_write
EatUartBaudrate(* const eat_uart_get_baudrate)(EatUart_enum uart)

Gets the baudrate configuration.

Parameters
[in] uart UART port.
Returns
The actual baudrate
Header
#include "eat_uart.h"
Example
EatUartBaudrate baudrate;
baudrate = eat_uart_get_baudrate(EAT_UART_1);


eat_uart_write

  • UART Function
eat_uart_close
eat_uart_get_baudrate
eat_uart_get_config
eat_uart_get_free_space
eat_uart_get_send_complete_status
eat_uart_open
eat_uart_read
eat_uart_set_at_port
eat_uart_set_baudrate
eat_uart_set_config
eat_uart_set_debug
eat_uart_set_send_complete_event
eat_uart_write
unsigned short(* const eat_uart_write)(EatUart_enum uart, const unsigned char *data, unsigned short len)

Sends data to the UART.

Parameters
[in] | uart | UART port.
[in] | data | Pointer to the data address.
[in] | len | Maximum length.
Returns
The actual length of the bytes transmitted. If it's small than parameter len, means that UART driver's receive buffer is full. UART driver will trigger EAT_EVENT_UART_READY_WR when receive buffer get some free space.
Header
#include "eat_uart.h"
Example
See the example for eat_uart_open.


eat_uart_read

  • UART Function
eat_uart_close
eat_uart_get_baudrate
eat_uart_get_config
eat_uart_get_free_space
eat_uart_get_send_complete_status
eat_uart_open
eat_uart_read
eat_uart_set_at_port
eat_uart_set_baudrate
eat_uart_set_config
eat_uart_set_debug
eat_uart_set_send_complete_event
eat_uart_write
unsigned short(* const eat_uart_read)(EatUart_enum uart, unsigned char *data, unsigned short len)

Receives data from the UART.

Parameters
[in] | uart | UART port.
[out] | data | Pointer to the data address.
[in] | len | Maximum length.
Returns
The actual length of the bytes received. If it's small than parameter len, means that no more data transmitted. UART driver will trigger EAT_EVENT_UART_READY_RD when receives data.
Header
#include "eat_uart.h"
Example
See the example for eat_uart_open.


eat_uart_set_debug

  • UART Function
eat_uart_close
eat_uart_get_baudrate
eat_uart_get_config
eat_uart_get_free_space
eat_uart_get_send_complete_status
eat_uart_open
eat_uart_read
eat_uart_set_at_port
eat_uart_set_baudrate
eat_uart_set_config
eat_uart_set_debug
eat_uart_set_send_complete_event
eat_uart_write
eat_bool(* const eat_uart_set_debug)(EatUart_enum uart)

Sets the UART debug port.

Parameters
[in] uart UART port.
Returns
EAT_TRUE if success, otherwise EAT_FALSE.
Attention
This function must be called in function that specified by func_ext1 in structure EatEntry_st.
Header
#include "eat_uart.h"
Example
extern void APP_InitRegions(void);
static void app_func_ext1(void *data)
{
APP_InitRegions();
eat_uart_set_at_port(EAT_UART_1);
eat_uart_set_debug(EAT_UART_2);
}
#pragma arm section rodata="APPENTRY"
const EatEntry_st AppEntry =
{
app_main,
app_func_ext1,
EAT_NULL, //app_user1,
EAT_NULL, //app_user2,
EAT_NULL, //app_user3,
EAT_NULL, //app_user4,
EAT_NULL, //app_user5,
EAT_NULL, //app_user6,
EAT_NULL, //app_user7,
EAT_NULL, //app_user8,
EAT_NULL,
EAT_NULL,
EAT_NULL,
EAT_NULL,
EAT_NULL,
EAT_NULL
};
#pragma arm section rodata


eat_uart_set_at_port

  • UART Function
eat_uart_close
eat_uart_get_baudrate
eat_uart_get_config
eat_uart_get_free_space
eat_uart_get_send_complete_status
eat_uart_open
eat_uart_read
eat_uart_set_at_port
eat_uart_set_baudrate
eat_uart_set_config
eat_uart_set_debug
eat_uart_set_send_complete_event
eat_uart_write
eat_bool(* const eat_uart_set_at_port)(EatUart_enum uart)

Sets the SIMCOM Core AT port.

Parameters
[in] uart UART port.
Returns
EAT_TRUE if success, otherwise EAT_FALSE.
Attention
  1. This function must be called in function that specified by func_ext1 in structure EatEntry_st.
  2. This function is invalid in 1116B02 version and V01 buildno.
    The version query see the eat_get_version and eat_get_buildno, or send AT command AT+CGMR and AT+CSUB.
Header
#include "eat_uart.h"
Example
See the example for eat_uart_set_debug.


eat_uart_set_send_complete_event

  • UART Function
eat_uart_close
eat_uart_get_baudrate
eat_uart_get_config
eat_uart_get_free_space
eat_uart_get_send_complete_status
eat_uart_open
eat_uart_read
eat_uart_set_at_port
eat_uart_set_baudrate
eat_uart_set_config
eat_uart_set_debug
eat_uart_set_send_complete_event
eat_uart_write
eat_bool(* const eat_uart_set_send_complete_event)(EatUart_enum uart, eat_bool send)

Enable/Disable the UART driver event EAT_EVENT_UART_SEND_COMPLETE.

Parameters
[in] uart UART port.
[in] send Enable, can be one of the following values:
  • EAT_TRUE Enalbe the event
  • EAT_FALSE Disable the event
Returns
EAT_TRUE if success, otherwise EAT_FALSE.
Header
#include "eat_uart.h"
Example
See the example for eat_uart_open.


eat_uart_get_send_complete_status

  • UART Function
eat_uart_close
eat_uart_get_baudrate
eat_uart_get_config
eat_uart_get_free_space
eat_uart_get_send_complete_status
eat_uart_open
eat_uart_read
eat_uart_set_at_port
eat_uart_set_baudrate
eat_uart_set_config
eat_uart_set_debug
eat_uart_set_send_complete_event
eat_uart_write
eat_bool(* const eat_uart_get_send_complete_status)(EatUart_enum uart)

Checks if the transmitting has been completed.

Parameters
[in] uart UART port.
Returns
EAT_TRUE if success, otherwise EAT_FALSE.
Header
#include "eat_uart.h"


eat_uart_get_free_space

  • UART Function
eat_uart_close
eat_uart_get_baudrate
eat_uart_get_config
eat_uart_get_free_space
eat_uart_get_send_complete_status
eat_uart_open
eat_uart_read
eat_uart_set_at_port
eat_uart_set_baudrate
eat_uart_set_config
eat_uart_set_debug
eat_uart_set_send_complete_event
eat_uart_write
unsigned short(* const eat_uart_get_free_space)(EatUart_enum uart)

Queries the free space of UART transmitting buffer.

Parameters
[in] uart UART port.
Returns
The actual free space of UART transmitting buffer.
Header
#include "eat_uart.h"


Data Structures
Here are the data structures with brief descriptions:
o C EAT_FS_DOSDirEntry
o C EatAdc_st
o C EatAudioToneData_st
o C EatAudioToneTable_st
o C EatEntry_st
o C EatEntryPara_st
o C EatEvent_st
o C EatEventData_union
o C EatInt_st
o C EatKey_st
o C EatMdmRi_st
o C EatRtc_st
o C EatSemId_st
o C EatTimer_st
o C EatUart_st
o C EatUartConfig_st
o C EatUserMsg_st
o C soc_fd_set
o C soc_linger_struct
o C soc_timeval_struct
\ C sockaddr_struct


Data Fields

Here is a list of all struct and union fields with links to the structures/unions they belong to:

- a -

  • adc : EatEventData_union
  • addr : sockaddr_struct
  • addr_len : sockaddr_struct
  • Attributes : EAT_FS_DOSDirEntry

- b -

  • baud : EatUartConfig_st

- c -

  • Cluster : EAT_FS_DOSDirEntry
  • CreateDateTime : EAT_FS_DOSDirEntry
  • CreateTimeTenthSecond : EAT_FS_DOSDirEntry

- d -

  • data : EatUserMsg_st , EatEvent_st
  • data_p : EatUserMsg_st
  • dataBits : EatUartConfig_st
  • DateTime : EAT_FS_DOSDirEntry
  • day : EatRtc_st
  • Drive : EAT_FS_DOSDirEntry

- e -

  • entry : EatEntry_st
  • entry_user1 : EatEntry_st
  • entry_user2 : EatEntry_st
  • entry_user3 : EatEntry_st
  • entry_user4 : EatEntry_st
  • entry_user5 : EatEntry_st
  • entry_user6 : EatEntry_st
  • entry_user7 : EatEntry_st
  • entry_user8 : EatEntry_st
  • event : EatEvent_st
  • Extension : EAT_FS_DOSDirEntry

- f -

  • fds_bits : soc_fd_set
  • FileName : EAT_FS_DOSDirEntry
  • FileSize : EAT_FS_DOSDirEntry
  • FirstCluster : EAT_FS_DOSDirEntry
  • FirstClusterHi : EAT_FS_DOSDirEntry
  • freq1 : EatAudioToneData_st
  • freq2 : EatAudioToneData_st
  • func_ext1 : EatEntry_st
  • func_ext2 : EatEntry_st
  • func_ext3 : EatEntry_st
  • func_ext4 : EatEntry_st
  • func_ext5 : EatEntry_st
  • func_ext6 : EatEntry_st
  • func_ext7 : EatEntry_st

- h -

  • hour : EatRtc_st

- i -

  • Index : EAT_FS_DOSDirEntry
  • interrupt : EatEventData_union
  • is_pressed : EatKey_st
  • is_update_app : EatEntryPara_st

- k -

  • key : EatEventData_union
  • key_value : EatKey_st

- l -

  • LastAccessDate : EAT_FS_DOSDirEntry
  • len : EatUserMsg_st
  • level : EatInt_st , EatMdmRi_st
  • linger_time : soc_linger_struct

- m -

  • mdm_ri : EatEventData_union
  • min : EatRtc_st
  • mon : EatRtc_st

- n -

  • next_operation : EatAudioToneData_st
  • NTReserved : EAT_FS_DOSDirEntry

- o -

  • off_duration : EatAudioToneData_st
  • on_duration : EatAudioToneData_st
  • onoff : soc_linger_struct

- p -

  • parity : EatUartConfig_st
  • pin : EatInt_st , EatAdc_st
  • port : sockaddr_struct

- s -

  • sec : EatRtc_st
  • SerialNumber : EAT_FS_DOSDirEntry
  • sock_type : sockaddr_struct
  • src : EatUserMsg_st
  • Stamp : EAT_FS_DOSDirEntry
  • stopBits : EatUartConfig_st

- t -

  • timer : EatEventData_union
  • timer_id : EatTimer_st
  • tone : EatAudioToneTable_st
  • tv_sec : soc_timeval_struct
  • tv_usec : soc_timeval_struct

- u -

  • uart : EatEventData_union , EatUart_st
  • unused : EatSemId_st
  • update_app_result : EatEntryPara_st
  • use_point : EatUserMsg_st
  • user_msg : EatEventData_union

- v -

  • v : EatAdc_st

- w -

  • wday : EatRtc_st

- y -

  • year : EatRtc_st


Data Fields - Variables

- a -

  • adc : EatEventData_union
  • addr : sockaddr_struct
  • addr_len : sockaddr_struct
  • Attributes : EAT_FS_DOSDirEntry

- b -

  • baud : EatUartConfig_st

- c -

  • Cluster : EAT_FS_DOSDirEntry
  • CreateDateTime : EAT_FS_DOSDirEntry
  • CreateTimeTenthSecond : EAT_FS_DOSDirEntry

- d -

  • data : EatUserMsg_st , EatEvent_st
  • data_p : EatUserMsg_st
  • dataBits : EatUartConfig_st
  • DateTime : EAT_FS_DOSDirEntry
  • day : EatRtc_st
  • Drive : EAT_FS_DOSDirEntry

- e -

  • entry : EatEntry_st
  • entry_user1 : EatEntry_st
  • entry_user2 : EatEntry_st
  • entry_user3 : EatEntry_st
  • entry_user4 : EatEntry_st
  • entry_user5 : EatEntry_st
  • entry_user6 : EatEntry_st
  • entry_user7 : EatEntry_st
  • entry_user8 : EatEntry_st
  • event : EatEvent_st
  • Extension : EAT_FS_DOSDirEntry

- f -

  • fds_bits : soc_fd_set
  • FileName : EAT_FS_DOSDirEntry
  • FileSize : EAT_FS_DOSDirEntry
  • FirstCluster : EAT_FS_DOSDirEntry
  • FirstClusterHi : EAT_FS_DOSDirEntry
  • freq1 : EatAudioToneData_st
  • freq2 : EatAudioToneData_st
  • func_ext1 : EatEntry_st
  • func_ext2 : EatEntry_st
  • func_ext3 : EatEntry_st
  • func_ext4 : EatEntry_st
  • func_ext5 : EatEntry_st
  • func_ext6 : EatEntry_st
  • func_ext7 : EatEntry_st

- h -

  • hour : EatRtc_st

- i -

  • Index : EAT_FS_DOSDirEntry
  • interrupt : EatEventData_union
  • is_pressed : EatKey_st
  • is_update_app : EatEntryPara_st

- k -

  • key : EatEventData_union
  • key_value : EatKey_st

- l -

  • LastAccessDate : EAT_FS_DOSDirEntry
  • len : EatUserMsg_st
  • level : EatInt_st , EatMdmRi_st
  • linger_time : soc_linger_struct

- m -

  • mdm_ri : EatEventData_union
  • min : EatRtc_st
  • mon : EatRtc_st

- n -

  • next_operation : EatAudioToneData_st
  • NTReserved : EAT_FS_DOSDirEntry

- o -

  • off_duration : EatAudioToneData_st
  • on_duration : EatAudioToneData_st
  • onoff : soc_linger_struct

- p -

  • parity : EatUartConfig_st
  • pin : EatInt_st , EatAdc_st
  • port : sockaddr_struct

- s -

  • sec : EatRtc_st
  • SerialNumber : EAT_FS_DOSDirEntry
  • sock_type : sockaddr_struct
  • src : EatUserMsg_st
  • Stamp : EAT_FS_DOSDirEntry
  • stopBits : EatUartConfig_st

- t -

  • timer : EatEventData_union
  • timer_id : EatTimer_st
  • tone : EatAudioToneTable_st
  • tv_sec : soc_timeval_struct
  • tv_usec : soc_timeval_struct

- u -

  • uart : EatEventData_union , EatUart_st
  • unused : EatSemId_st
  • update_app_result : EatEntryPara_st
  • use_point : EatUserMsg_st
  • user_msg : EatEventData_union

- v -

  • v : EatAdc_st

- w -

  • wday : EatRtc_st

- y -

  • year : EatRtc_st


Data Structure Index
E | S
E
EatAudioToneTable_st EatInt_st EatTimer_st soc_linger_struct
EatEntry_st EatKey_st EatUart_st soc_timeval_struct
EAT_FS_DOSDirEntry EatEntryPara_st EatMdmRi_st EatUartConfig_st sockaddr_struct
EatAdc_st EatEvent_st EatRtc_st EatUserMsg_st
EatAudioToneData_st EatEventData_union EatSemId_st
S
soc_fd_set


SIM800_Embedded AT Application Note
v1.03
Copyright (C) 2002-2013 Shanghai SIMCom Wireless Solutions Ltd.

SIMCom offers this information as a service to its customers, to support application and engineering efforts that use the products designed by SIMCom. The information provided is based upon requirements specifically provided to SIMCom by the customers. SIMCom has not undertaken any independent search for additional relevant information, including any information that may be in the customer's possession. Furthermore, system validation of this product designed by SIMCom within a larger electronic system remains the responsibility of the customer or the customer's system integrator. All specifications supplied herein are subject to change.

Copyright

This document contains proprietary technical information which is the property of SIMCom Limited., copying of this document and giving it to others and the using or communication of the contents thereof, are forbidden without express authority. Offenders are liable to the payment of damages. All rights reserved in the event of grant of a patent or the registration of a utility model or design. All specification supplied herein are subject to change without notice at any time.


Related Pages
Here is a list of all related documentation pages:
o Introduction
\ Description