|
|
How to Create a New Build Target For the i.MX233IntroductionThe i.MX233 port handles the following families of chips:
firmware/arm/imx233/mydap/ where
mydap is the name of the new target.
Configuration FileBe sure to read PortingHowToConfigFile before reading this. Like for other targets, you should create a configuration file infirmware/export/config/ and include it
in firmware/target/config.h . In addition to the many standard defines, you must define the following:
SubtargetTheIMX233_SUBTARGET will condition every driver of the imx233 tree, so be sure to get it right. There are mostly three possibilities:
#define IMX233_SUBTARGET 3700 PackageTheIMX233_PACKAGE will condition a number of standard pins. At the moment, only BGA169 is supported even though many values are defined:
#define IMX233_PACKAGE IMX233_BGA169 PartitionOn most targets, the storage layer provides access to the whole disc but part of it is reserved for firmware and system. The partition schemes tells the code what is the scheme used to hide this and provide a view of the user data only. It is handled byfirmware/target/imx233/partition-imx233.c and new scheme might be added in the future. The possible values are:
#define IMX233_PARTITIONS IMX233_CREATIVE Freescale Partition Scheme (ATA/SD/MMC)On those target, Freescale uses a root MBR with four partitions: one firmware (type 53), two system and one logical (type 5). The logical one is the actual partition shown to the user. It needs to be handle specially because the type 5 is not normally used for logical partition and thus not understand by any OS.Creative Partition SchemeCreative uses a very weird scheme with a proprietary partition table called the MBLK. It is located at a fixed address in the drive (which can be changed in the partition driver) and provide named entries. The usual entries are:
cfs partition and you need to reformat it to FAT.
Button driverBe sure to read PortingHowToButtonDriver before reading this. The button driver should be namedbutton-mydap.c and you must provide an header named button-target.h .
The imx233 provides code for common cases such as:
Touchscreen/TouchpadIf your target has a touchscreen or touchpad wired to the LRADC controller (usually it's a 4 wire touchscreen), you can make sure of thetouchscreen-imx233.c driver.
In order to properly use it, you must:
void button_init_device(void) { // blabla imx233_touchscreen_init(); imx233_touchscreen_enable(true); } static int touch_to_pixels(int *val_x, int *val_y) { // for you to implement: does raw value -> pixel translation } void touchscreen_enable_device(bool en) { imx233_touchscreen_enable(en); } static int touchscreen_read_device(int *data) { int x, y; if(!imx233_touchscreen_get_touch(&x, &y)) return 0; if(data) *data = touch_to_pixels(&x, &y); return touchscreen_to_pixels(x, y, data); } int button_read_device(int *data) { int res = 0; /* read other buttons */ return res | touchscreen_read_device(data); } Resistor Ladders / ADC buttonsIf your target implements some buttons using a resistor ladder and a voltage plugged into the LRADC, you can use thebutton-lradc-imx233.c driver which
already implements all the boring stuff such as proper lradc config, debouncing and so on. Of course it needs a few defines and init. You are advised to
read button-lradc-imx233.h and you must:
HAS_BUTTON_HOLD in button-target.h like for any target and you must tell the driver how to detect it.
It supports several methods controlled by IMX233_BUTTON_LRADC_HOLD_DET :
imx233_button_lradc_read_raw function which gives you the raw LRADC value.
Example:
/* in button-target.h */ #define HAS_BUTTON_HOLD #define IMX233_BUTTON_LRADC_HOLD_DET BLH_GPIO #define BLH_GPIO_BANK 0 #define BLH_GPIO_PIN 9 #define BLH_GPIO_INVERTED #define BLH_GPIO_PULLUP /* in button-mydap.c */ struct imx233_button_lradc_mapping_t imx233_button_lradc_mapping[] = { {1095, BUTTON_BACK}, {1470, BUTTON_PLAY}, {1845, BUTTON_RIGHT}, {2185, BUTTON_LEFT}, {2525, BUTTON_UP}, {2870, BUTTON_DOWN}, {3400, 0}, {0, IMX233_BUTTON_LRADC_END}, }; void button_init_device(void) { imx233_button_lradc_init(); } bool button_hold(void) { return imx233_button_lradc_hold(); } int button_read_device(void) { int res = 0; if(imx233_power_read_pswitch() == 3) res |= BUTTON_POWER; return imx233_button_lradc_read(res); } PSWITCHIf you need the PSWITCH value, you can callimx233_power_read_pswitch which will provide you with it.
Example:
if(imx233_power_read_pswitch() == 1) btn |= BUTTON_POWER; FM RadioBe sure to read PortingHowToFMRadio before reading this. If your target uses has a FM tuner, you will need to provide a few functions for the driver to work: mostly i2c routines and tuner power. These are usually boring to write so you can use thefmradio-imx233.c driver to simplify most of it. Of course it needs a few defines. You are advised to
read fmradio-imx233.h and you must put all the defines into fmradio-target.h . You can also optionally add some code into fmradio-mydap.c for
unsupported functionality like RDS which is not handled by this driver. You must define:
fmradio-imx233.c driver will completely implement tuner_power and fmradio_i2c_{read,write} so you don't need and must not write wrappers for them.
Example:
#define IMX233_FMRADIO_I2C FMI_SW #define FMI_SW_SDA_BANK 1 #define FMI_SW_SDA_PIN 24 #define FMI_SW_SCL_BANK 1 #define FMI_SW_SCL_PIN 22 #define IMX233_FMRADIO_POWER FMP_GPIO #define FMP_GPIO_BANK 0 #define FMP_GPIO_PIN 29 #define FMP_GPIO_DELAY (HZ / 10) Power ManagementBe sure to read PortingHowToPowerManagement before reading this. Theimx233 features a very complex power management unit implemented in powermgmt-imx233.c and it should not be attempted to alter its behaviour.
Instead, the driver relies on the existence on a few defines in powermgmt-target.h :
#define IMX233_CHARGE_CURRENT 200 #define IMX233_STOP_CURRENT 30 #define IMX233_TOPOFF_TIMEOUT (30 * 60 * HZ) #define IMX233_CHARGING_TIMEOUT (4 * 3600 * HZ) Audio DriverBe sure to read PortingHowToAudio before reading this. The handling of audio in Rockbox is pretty complicated, being spread accross many areas such as codecs, routing and gating. For this reason, it is recommended to always use theaudio-imx233.c driver and the corresponding imx233-codec.c codec.
These drivers will take care of the gory details about the builtin codec. You are advised to
read audio-imx233.h . In order to work correctly, you must always define in audio-target.h :
#define IMX233_AUDIO_HP_GATE_BANK 1 #define IMX233_AUDIO_HP_GATE_PIN 30 #define IMX233_AUDIO_SPKR_GATE_BANK 1 #define IMX233_AUDIO_SPKR_GATE_PIN 22 #define IMX233_AUDIO_COUPLING_MODE ACM_CAPLESS-- AmauryPouly - 25 Nov 2013 r7 - 02 Apr 2021 - 20:46:07 - UnknownUser
Copyright © by the contributing authors.
|