TWIペリフェラルを使ってI2Cプロトコルを制御する
Revisión | 87042c4ae2f1c64ba864a8181a1ad25f1200e2e9 (tree) |
---|---|
Tiempo | 2012-09-13 23:36:27 |
Autor | takemasa <suikan@user...> |
Commiter | takemasa |
複数のプロセッサに対応
@@ -116,10 +116,10 @@ UTASK_CFG = $(UNAME).cfg | ||
116 | 116 | UTASK_DIR = $(SRCDIR)/library |
117 | 117 | UTASK_ASMOBJS = |
118 | 118 | ifdef USE_CXX |
119 | - UTASK_CXXOBJS = $(UNAME).o i2c_subsystem.o | |
119 | + UTASK_CXXOBJS = $(UNAME).o | |
120 | 120 | UTASK_COBJS = |
121 | 121 | else |
122 | - UTASK_COBJS = $(UNAME).o i2c_subsystem.o | |
122 | + UTASK_COBJS = $(UNAME).o | |
123 | 123 | endif |
124 | 124 | UTASK_CFLAGS = |
125 | 125 | UTASK_LIBS = |
@@ -209,6 +209,52 @@ chip_dump.o: \ | ||
209 | 209 | kernel/config/blackfin/_common_bf592/chip_config.h \ |
210 | 210 | kernel/include/itron.h \ |
211 | 211 | /opt/uClinux2011R1RC4/bfin-elf/bin/../lib/gcc/bfin-elf/4.3.5/include/stddef.h |
212 | +i2c_subsystem.o: \ | |
213 | + /opt/uClinux2011R1RC4/bfin-elf/bin/../lib/gcc/bfin-elf/4.3.5/../../../../bfin-elf/include/defBF59x_base.h \ | |
214 | + kernel/config/blackfin/cpu_defs.h \ | |
215 | + /opt/uClinux2011R1RC4/bfin-elf/bin/../lib/gcc/bfin-elf/4.3.5/../../../../bfin-elf/include/newlib.h \ | |
216 | + kernel/include/serial.h kernel/config/blackfin/tool_config.h \ | |
217 | + ./kernel_id.h \ | |
218 | + /opt/uClinux2011R1RC4/bfin-elf/bin/../lib/gcc/bfin-elf/4.3.5/../../../../bfin-elf/include/cdefBF59x_base.h \ | |
219 | + /opt/uClinux2011R1RC4/bfin-elf/bin/../lib/gcc/bfin-elf/4.3.5/../../../../bfin-elf/include/machine/_default_types.h \ | |
220 | + kernel/include/t_stddef.h \ | |
221 | + /opt/uClinux2011R1RC4/bfin-elf/bin/../lib/gcc/bfin-elf/4.3.5/../../../../bfin-elf/include/stdlib.h \ | |
222 | + kernel/config/blackfin/tool_defs.h \ | |
223 | + /opt/uClinux2011R1RC4/bfin-elf/bin/../lib/gcc/bfin-elf/4.3.5/../../../../bfin-elf/include/builtins.h \ | |
224 | + /opt/uClinux2011R1RC4/bfin-elf/bin/../lib/gcc/bfin-elf/4.3.5/../../../../bfin-elf/include/ccblkfn.h \ | |
225 | + /opt/uClinux2011R1RC4/bfin-elf/bin/../lib/gcc/bfin-elf/4.3.5/../../../../bfin-elf/include/_ansi.h \ | |
226 | + kernel/include/s_services.h \ | |
227 | + kernel/config/blackfin/acb_bf592/sys_config.h \ | |
228 | + kernel/config/blackfin/_common_bf592/chip_config.h \ | |
229 | + /opt/uClinux2011R1RC4/bfin-elf/bin/../lib/gcc/bfin-elf/4.3.5/../../../../bfin-elf/include/sys/features.h \ | |
230 | + /opt/uClinux2011R1RC4/bfin-elf/bin/../lib/gcc/bfin-elf/4.3.5/../../../../bfin-elf/include/alloca.h \ | |
231 | + /opt/uClinux2011R1RC4/bfin-elf/bin/../lib/gcc/bfin-elf/4.3.5/../../../../bfin-elf/include/sys/mc_typedef.h \ | |
232 | + /opt/uClinux2011R1RC4/bfin-elf/bin/../lib/gcc/bfin-elf/4.3.5/../../../../bfin-elf/include/sys/reent.h \ | |
233 | + /opt/uClinux2011R1RC4/bfin-elf/bin/../lib/gcc/bfin-elf/4.3.5/../../../../bfin-elf/include/sys/anomaly_macros_rtl.h \ | |
234 | + kernel/include/kernel.h \ | |
235 | + /opt/uClinux2011R1RC4/bfin-elf/bin/../lib/gcc/bfin-elf/4.3.5/../../../../bfin-elf/include/sys/config.h \ | |
236 | + /opt/uClinux2011R1RC4/bfin-elf/bin/../lib/gcc/bfin-elf/4.3.5/../../../../bfin-elf/include/sys/lock.h \ | |
237 | + kernel/config/blackfin/_common_bf592/chip_defs.h \ | |
238 | + /opt/uClinux2011R1RC4/bfin-elf/bin/../lib/gcc/bfin-elf/4.3.5/../../../../bfin-elf/include/stdint.h \ | |
239 | + /opt/uClinux2011R1RC4/bfin-elf/bin/../lib/gcc/bfin-elf/4.3.5/../../../../bfin-elf/include/cdef_LPBlackfin.h \ | |
240 | + /opt/uClinux2011R1RC4/bfin-elf/bin/../lib/gcc/bfin-elf/4.3.5/../../../../bfin-elf/include/machine/_types.h \ | |
241 | + kernel/include/t_config.h \ | |
242 | + kernel/config/blackfin/_common_bf592/sys_rename.h \ | |
243 | + /opt/uClinux2011R1RC4/bfin-elf/bin/../lib/gcc/bfin-elf/4.3.5/../../../../bfin-elf/include/defBF592-A.h \ | |
244 | + kernel/config/blackfin/acb_bf592/i2c_subsystem.h \ | |
245 | + /opt/uClinux2011R1RC4/bfin-elf/bin/../lib/gcc/bfin-elf/4.3.5/../../../../bfin-elf/include/cdefBF592-A.h \ | |
246 | + kernel/config/blackfin/cpu_rename.h kernel/include/sil.h \ | |
247 | + kernel/include/t_services.h \ | |
248 | + /opt/uClinux2011R1RC4/bfin-elf/bin/../lib/gcc/bfin-elf/4.3.5/../../../../bfin-elf/include/def_LPBlackfin.h \ | |
249 | + /opt/uClinux2011R1RC4/bfin-elf/bin/../lib/gcc/bfin-elf/4.3.5/../../../../bfin-elf/include/machine/stdlib.h \ | |
250 | + /opt/uClinux2011R1RC4/bfin-elf/bin/../lib/gcc/bfin-elf/4.3.5/include-fixed/limits.h \ | |
251 | + kernel/include/t_syslog.h \ | |
252 | + /opt/uClinux2011R1RC4/bfin-elf/bin/../lib/gcc/bfin-elf/4.3.5/../../../../bfin-elf/include/machine/ieeefp.h \ | |
253 | + /opt/uClinux2011R1RC4/bfin-elf/bin/../lib/gcc/bfin-elf/4.3.5/../../../../bfin-elf/include/sys/_types.h \ | |
254 | + kernel/config/blackfin/acb_bf592/sys_defs.h \ | |
255 | + kernel/config/blackfin/cpu_config.h kernel/include/itron.h \ | |
256 | + /opt/uClinux2011R1RC4/bfin-elf/bin/../lib/gcc/bfin-elf/4.3.5/include/stddef.h \ | |
257 | + kernel/config/blackfin/acb_bf592/i2c_subsystem.c | |
212 | 258 | cpu_config.o: kernel/include/kernel.h \ |
213 | 259 | kernel/config/blackfin/cpu_defs.h \ |
214 | 260 | kernel/config/blackfin/_common_bf592/chip_defs.h \ |
@@ -612,56 +658,11 @@ i2c-test.o: kernel/include/kernel.h kernel/include/t_services.h \ | ||
612 | 658 | /opt/uClinux2011R1RC4/bfin-elf/bin/../lib/gcc/bfin-elf/4.3.5/include-fixed/limits.h \ |
613 | 659 | kernel/include/t_syslog.h kernel/config/blackfin/tool_defs.h \ |
614 | 660 | i2c-test.c kernel/include/serial.h \ |
615 | - kernel/config/blackfin/acb_bf592/sys_defs.h i2c_subsystem.h \ | |
616 | - kernel_id.h kernel/include/itron.h \ | |
617 | - /opt/uClinux2011R1RC4/bfin-elf/bin/../lib/gcc/bfin-elf/4.3.5/include/stddef.h \ | |
618 | - kernel/include/t_stddef.h | |
619 | -i2c_subsystem.o: \ | |
620 | - /opt/uClinux2011R1RC4/bfin-elf/bin/../lib/gcc/bfin-elf/4.3.5/../../../../bfin-elf/include/defBF59x_base.h \ | |
621 | - kernel/config/blackfin/cpu_defs.h \ | |
622 | - /opt/uClinux2011R1RC4/bfin-elf/bin/../lib/gcc/bfin-elf/4.3.5/../../../../bfin-elf/include/newlib.h \ | |
623 | - kernel/include/serial.h kernel/config/blackfin/tool_config.h \ | |
624 | - i2c_subsystem.c \ | |
625 | - /opt/uClinux2011R1RC4/bfin-elf/bin/../lib/gcc/bfin-elf/4.3.5/../../../../bfin-elf/include/cdefBF59x_base.h \ | |
626 | - /opt/uClinux2011R1RC4/bfin-elf/bin/../lib/gcc/bfin-elf/4.3.5/../../../../bfin-elf/include/machine/_default_types.h \ | |
627 | - kernel/include/t_stddef.h \ | |
628 | - /opt/uClinux2011R1RC4/bfin-elf/bin/../lib/gcc/bfin-elf/4.3.5/../../../../bfin-elf/include/stdlib.h \ | |
629 | - kernel/config/blackfin/tool_defs.h \ | |
630 | - /opt/uClinux2011R1RC4/bfin-elf/bin/../lib/gcc/bfin-elf/4.3.5/../../../../bfin-elf/include/builtins.h \ | |
631 | - /opt/uClinux2011R1RC4/bfin-elf/bin/../lib/gcc/bfin-elf/4.3.5/../../../../bfin-elf/include/ccblkfn.h \ | |
632 | - /opt/uClinux2011R1RC4/bfin-elf/bin/../lib/gcc/bfin-elf/4.3.5/../../../../bfin-elf/include/_ansi.h \ | |
633 | - kernel/include/s_services.h \ | |
634 | - kernel/config/blackfin/acb_bf592/sys_config.h \ | |
635 | - kernel/config/blackfin/_common_bf592/chip_config.h \ | |
636 | - /opt/uClinux2011R1RC4/bfin-elf/bin/../lib/gcc/bfin-elf/4.3.5/../../../../bfin-elf/include/sys/features.h \ | |
637 | - /opt/uClinux2011R1RC4/bfin-elf/bin/../lib/gcc/bfin-elf/4.3.5/../../../../bfin-elf/include/alloca.h \ | |
638 | - /opt/uClinux2011R1RC4/bfin-elf/bin/../lib/gcc/bfin-elf/4.3.5/../../../../bfin-elf/include/sys/mc_typedef.h \ | |
639 | - /opt/uClinux2011R1RC4/bfin-elf/bin/../lib/gcc/bfin-elf/4.3.5/../../../../bfin-elf/include/sys/reent.h \ | |
640 | - /opt/uClinux2011R1RC4/bfin-elf/bin/../lib/gcc/bfin-elf/4.3.5/../../../../bfin-elf/include/sys/anomaly_macros_rtl.h \ | |
641 | - kernel/include/kernel.h \ | |
642 | - /opt/uClinux2011R1RC4/bfin-elf/bin/../lib/gcc/bfin-elf/4.3.5/../../../../bfin-elf/include/sys/config.h \ | |
643 | - /opt/uClinux2011R1RC4/bfin-elf/bin/../lib/gcc/bfin-elf/4.3.5/../../../../bfin-elf/include/sys/lock.h \ | |
644 | - kernel/config/blackfin/_common_bf592/chip_defs.h \ | |
645 | - /opt/uClinux2011R1RC4/bfin-elf/bin/../lib/gcc/bfin-elf/4.3.5/../../../../bfin-elf/include/stdint.h \ | |
646 | - /opt/uClinux2011R1RC4/bfin-elf/bin/../lib/gcc/bfin-elf/4.3.5/../../../../bfin-elf/include/cdef_LPBlackfin.h \ | |
647 | - /opt/uClinux2011R1RC4/bfin-elf/bin/../lib/gcc/bfin-elf/4.3.5/../../../../bfin-elf/include/machine/_types.h \ | |
648 | - kernel/include/t_config.h \ | |
649 | - kernel/config/blackfin/_common_bf592/sys_rename.h \ | |
650 | - /opt/uClinux2011R1RC4/bfin-elf/bin/../lib/gcc/bfin-elf/4.3.5/../../../../bfin-elf/include/defBF592-A.h \ | |
651 | - i2c_subsystem.h \ | |
652 | - /opt/uClinux2011R1RC4/bfin-elf/bin/../lib/gcc/bfin-elf/4.3.5/../../../../bfin-elf/include/cdefBF592-A.h \ | |
653 | - kernel/config/blackfin/cpu_rename.h kernel/include/sil.h \ | |
654 | - kernel/include/t_services.h \ | |
655 | - /opt/uClinux2011R1RC4/bfin-elf/bin/../lib/gcc/bfin-elf/4.3.5/../../../../bfin-elf/include/def_LPBlackfin.h \ | |
656 | - /opt/uClinux2011R1RC4/bfin-elf/bin/../lib/gcc/bfin-elf/4.3.5/../../../../bfin-elf/include/machine/stdlib.h \ | |
657 | - /opt/uClinux2011R1RC4/bfin-elf/bin/../lib/gcc/bfin-elf/4.3.5/include-fixed/limits.h \ | |
658 | - kernel/include/t_syslog.h \ | |
659 | - /opt/uClinux2011R1RC4/bfin-elf/bin/../lib/gcc/bfin-elf/4.3.5/../../../../bfin-elf/include/machine/ieeefp.h \ | |
660 | - /opt/uClinux2011R1RC4/bfin-elf/bin/../lib/gcc/bfin-elf/4.3.5/../../../../bfin-elf/include/sys/_types.h \ | |
661 | 661 | kernel/config/blackfin/acb_bf592/sys_defs.h \ |
662 | - kernel/config/blackfin/cpu_config.h kernel_id.h \ | |
662 | + kernel/config/blackfin/acb_bf592/i2c_subsystem.h kernel_id.h \ | |
663 | 663 | kernel/include/itron.h \ |
664 | - /opt/uClinux2011R1RC4/bfin-elf/bin/../lib/gcc/bfin-elf/4.3.5/include/stddef.h | |
664 | + /opt/uClinux2011R1RC4/bfin-elf/bin/../lib/gcc/bfin-elf/4.3.5/include/stddef.h \ | |
665 | + kernel/include/t_stddef.h | |
665 | 666 | timer.o: \ |
666 | 667 | /opt/uClinux2011R1RC4/bfin-elf/bin/../lib/gcc/bfin-elf/4.3.5/../../../../bfin-elf/include/defBF59x_base.h \ |
667 | 668 | kernel/include/kernel.h kernel/include/timer.h \ |
@@ -796,7 +797,8 @@ kernel_cfg.o: \ | ||
796 | 797 | kernel/include/t_config.h \ |
797 | 798 | kernel/config/blackfin/_common_bf592/sys_rename.h \ |
798 | 799 | /opt/uClinux2011R1RC4/bfin-elf/bin/../lib/gcc/bfin-elf/4.3.5/../../../../bfin-elf/include/defBF592-A.h \ |
799 | - kernel/include/../kernel/eventflag.h i2c_subsystem.h \ | |
800 | + kernel/include/../kernel/eventflag.h \ | |
801 | + kernel/config/blackfin/acb_bf592/i2c_subsystem.h \ | |
800 | 802 | /opt/uClinux2011R1RC4/bfin-elf/bin/../lib/gcc/bfin-elf/4.3.5/../../../../bfin-elf/include/cdefBF592-A.h \ |
801 | 803 | kernel/config/blackfin/cpu_rename.h \ |
802 | 804 | /opt/uClinux2011R1RC4/bfin-elf/bin/../lib/gcc/bfin-elf/4.3.5/../../../../bfin-elf/include/def_LPBlackfin.h \ |
@@ -1 +1 @@ | ||
1 | -kernel/configure -C blackfin -S acb_bf592 -A i2c-test -U "i2c_subsystem.o" | |
1 | +kernel/configure -C blackfin -S acb_bf592 -A i2c-test |
@@ -16,7 +16,7 @@ LDFLAGS := $(LDFLAGS) | ||
16 | 16 | # |
17 | 17 | KERNEL_DIR := $(KERNEL_DIR) :$(SRCDIR)/config/$(CPU)/$(SYS) :$(SRCDIR)/config/$(CPU)/_common_bf592 :$(SRCDIR)/pdic/simple_sio |
18 | 18 | KERNEL_ASMOBJS := $(KERNEL_ASMOBJS) |
19 | -KERNEL_COBJS := $(KERNEL_COBJS) chip_config.o uart.o chip_debugboot.o chip_dump.o | |
19 | +KERNEL_COBJS := $(KERNEL_COBJS) chip_config.o uart.o chip_debugboot.o chip_dump.o i2c_subsystem.o | |
20 | 20 | |
21 | 21 | |
22 | 22 | # |
@@ -11,6 +11,12 @@ | ||
11 | 11 | |
12 | 12 | #ifdef _COMMON_BF592 |
13 | 13 | #include <cdefBF592-A.h> |
14 | +#elif defined(_COMMON_BF506) | |
15 | +#include <cdefBF506F.h> | |
16 | +#elif defined(_COMMON_BF518) | |
17 | +#include <cdefBF518.h> | |
18 | +#elif defined(_COMMON_BF537) | |
19 | +#include <cdefBF537.h> | |
14 | 20 | #else |
15 | 21 | #error "This processor is not supported" |
16 | 22 | #endif |
@@ -61,18 +67,18 @@ struct I2C_MASTER_CONTROL_TYPE { | ||
61 | 67 | ID signal; /**< データの送受信が全部終わったときに割り込みハンドラからタスクに知らせるためのセマフォ */ |
62 | 68 | ID blocking; /**< I2Cペリフェラルへの排他アクセスのためのセマフォ */ |
63 | 69 | unsigned short intr_state; /**< TWIペリフェラルの割り込みステータスのコピー **/ |
64 | - volatile uint16_t * clkdiv; /**< TWI_CLCKDIVレジスタのアドレス **/ | |
65 | - volatile uint16_t * control; /**< TWI_CONTROLレジスタのアドレス **/ | |
66 | - volatile uint16_t * master_ctl; /**< TWI_MASTER_CTLレジスタのアドレス **/ | |
67 | - volatile uint16_t * master_stat; /**< TWI_MASTER_STATレジスタのアドレス **/ | |
68 | - volatile uint16_t * master_addr; /**< TWI_MASTER_ADDRレジスタのアドレス **/ | |
69 | - volatile uint16_t * int_stat; /**< TWI_MASTER_STATレジスタのアドレス **/ | |
70 | - volatile uint16_t * int_mask; /**< TWI_INT_MASKレジスタのアドレス **/ | |
71 | - volatile uint16_t * fifo_ctl; /**< TWI_FIFO_CTLレジスタのアドレス **/ | |
72 | - volatile uint16_t * fifo_stat; /**< TWI_FIFO_STATレジスタのアドレス **/ | |
73 | - volatile uint16_t * xmt_data8; /**< TWI_XMT_DATA8レジスタのアドレス **/ | |
74 | - volatile uint16_t * rcv_data8; /**< TWI_RCV_DATA8レジスタのアドレス **/ | |
75 | - volatile uint16_t * slave_ctl; /**< TWI_MASTER_CTLレジスタのアドレス **/ | |
70 | + volatile unsigned short * clkdiv; /**< TWI_CLCKDIVレジスタのアドレス **/ | |
71 | + volatile unsigned short * control; /**< TWI_CONTROLレジスタのアドレス **/ | |
72 | + volatile unsigned short * master_ctl; /**< TWI_MASTER_CTLレジスタのアドレス **/ | |
73 | + volatile unsigned short * master_stat; /**< TWI_MASTER_STATレジスタのアドレス **/ | |
74 | + volatile unsigned short * master_addr; /**< TWI_MASTER_ADDRレジスタのアドレス **/ | |
75 | + volatile unsigned short * int_stat; /**< TWI_MASTER_STATレジスタのアドレス **/ | |
76 | + volatile unsigned short * int_mask; /**< TWI_INT_MASKレジスタのアドレス **/ | |
77 | + volatile unsigned short * fifo_ctl; /**< TWI_FIFO_CTLレジスタのアドレス **/ | |
78 | + volatile unsigned short * fifo_stat; /**< TWI_FIFO_STATレジスタのアドレス **/ | |
79 | + volatile unsigned short * xmt_data8; /**< TWI_XMT_DATA8レジスタのアドレス **/ | |
80 | + volatile unsigned short * rcv_data8; /**< TWI_RCV_DATA8レジスタのアドレス **/ | |
81 | + volatile unsigned short * slave_ctl; /**< TWI_MASTER_CTLレジスタのアドレス **/ | |
76 | 82 | |
77 | 83 | }; |
78 | 84 |