OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站
点击跳转“创龙科技服务通”

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 12955|回复: 0
打印 上一主题 下一主题

[未解决] OMAPL138如何在Linux下使用EDMA3驱动

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. e, d! k+ \/ ]( Z
  1. [code]EDMA sample test application0 n- {0 P  P' `0 }! C( z/ S; r
  2. /*& h+ U8 e& M$ O: G9 w% W& d
  3. * edma_test.c" j/ Z. X7 \7 u& c
  4. *
    7 Q2 W  ~* m( l" y) [& g
  5. * brief  EDMA3 Test Application
    " x! @% o9 F7 E0 k4 w  M* h
  6. *
    2 i# f! ^# y3 ?0 U9 X" C
  7. *   This file contains EDMA3 Test code.
    0 g5 y( l! a6 \
  8. *
    / t2 P1 g0 A. T: t1 r8 p- g
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 u3 h9 l& h5 E4 n% x
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" V! D% f/ p( z
  11. *         TO CHANGE.
    / w: F1 Q3 n6 {2 |1 G( Z) u
  12. *0 N8 Z5 M5 {: G# A9 V( w2 U
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ( _3 i! t, R5 u- Q
  14. *' j6 ^+ a' k8 q8 C( Q8 @
  15. * This program is free software; you can redistribute it and/or. ^5 J. E/ s/ Y. e* R0 H  \
  16. * modify it under the terms of the GNU General Public License as
    4 P3 n3 T; ^5 N' {3 h+ v* c
  17. * published by the Free Software Foundation version 2.
    / n$ l, h. k0 C/ W( j
  18. *
    * Y2 ]1 W! o7 `
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 h! O, E( y' {0 ?0 J6 T6 X3 [
  20. * kind, whether express or implied; without even the implied warranty
    7 L% D9 {: X4 [* \; ?
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    - D( i. O' n* @& j# G* j: R+ e2 v
  22. * GNU General Public License for more details.7 b5 u0 Y7 I4 C8 S: M2 v, G$ z
  23. */
    : `2 W$ m& `$ i! E
  24. ( w( n- a& z  R" n
  25. #include <linux/module.h>
    3 z& j  Z0 v9 |
  26. #include <linux/init.h>( P  F! t5 Y" B; ?" \1 @; s% n
  27. #include <linux/errno.h>" Q- `& H" g0 j/ O( E- D- G6 V0 R2 r
  28. #include <linux/types.h>/ K0 }  L6 q. Y) X5 Y" u2 S
  29. #include <linux/interrupt.h>
    - w0 Z% E+ ~# K& O
  30. #include <asm/io.h>, M. z. `! C6 g1 z1 e
  31. #include <linux/moduleparam.h>
    4 e, Q! i$ Q$ |0 p% `  n* Y
  32. #include <linux/sysctl.h>3 h2 c. ]" p. V! ]' c2 J5 i
  33. #include <linux/mm.h>- ^6 o, d! ^5 f
  34. #include <linux/dma-mapping.h>6 l) S8 a( [9 z4 }

  35. 1 F7 J! O2 m& C5 @! ]2 V
  36. #include <mach/memory.h>
    , O% R& \! U) I9 m8 ^/ G, D
  37. #include <mach/hardware.h>7 g  @* T; O1 u1 n. E6 ]7 H+ F
  38. #include <mach/irqs.h>$ z7 Q# h) T8 Z! A0 D
  39. #include <asm/hardware/edma.h>
    6 T1 k3 j! ?7 W7 B7 Z
  40. ' L7 f6 ?5 D* k- E/ J& P$ Y  X2 ]
  41. #undef EDMA3_DEBUG
    6 e2 {; n$ R+ W+ i0 P# q
  42. /*#define EDMA3_DEBUG*/
    2 ^% S  y% C3 f8 U, y9 x7 \

  43. " T! L; V" J! n0 I+ _
  44. #ifdef EDMA3_DEBUG1 U3 _. {; u" B* L' f
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 p: ]* |- ?9 r" ?/ E
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); u! e" W, h* l% c! m! l: ~
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    9 y7 k1 W  X6 B
  48. #else
    ! m# _$ y/ F2 @; [
  49. #define DMA_PRINTK( x... )
    3 {! Q/ O# p3 n" a1 u$ P( e4 E
  50. #define DMA_FN_IN
    1 G" z, T5 W5 a! |* h
  51. #define DMA_FN_OUT$ m. }' Y" {! U& {1 ?0 C6 A
  52. #endif+ N3 ]+ H$ P6 X. O/ m) Y

  53. 8 |% G. C- B0 L- L
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)+ I2 E  E6 e, L+ C; |+ I
  55. #define STATIC_SHIFT                3
    6 R9 ^$ k: d$ G3 H% K
  56. #define TCINTEN_SHIFT               20: }3 |, c# u7 _7 k% y, B
  57. #define ITCINTEN_SHIFT              213 e5 q$ @) Z7 W. ]& C6 O9 G
  58. #define TCCHEN_SHIFT                22+ d  z/ n; t' d3 f" H0 N3 q2 o
  59. #define ITCCHEN_SHIFT               23
    + T/ C  Q6 z0 U% G  c* r
  60. + o, [% X8 E# y, A' n4 R+ x1 J
  61. static volatile int irqraised1 = 0;
    $ K1 h& ]3 k8 t% J& S
  62. static volatile int irqraised2 = 0;" p" n& _; C, `6 V# ]8 |, l
  63. / n4 V- ?1 _9 s' E0 u/ c
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 {; B/ ^" i6 D# s$ G) w
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 M$ X! E8 k9 b, f+ j
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , H0 E( H) G/ A$ l/ j$ ~8 S

  67. $ `2 w! a6 V! E- n/ Y
  68. dma_addr_t dmaphyssrc1 = 0;, x$ u- B2 k6 a7 x# V* s5 k# c  n  ?
  69. dma_addr_t dmaphyssrc2 = 0;- D$ m# r; W* b/ a; M3 I
  70. dma_addr_t dmaphysdest1 = 0;
    1 v" @: M7 |1 [: k0 {
  71. dma_addr_t dmaphysdest2 = 0;  M  {" O! [2 R. N7 O! q, e; u
  72. & j9 R+ K( o! @8 F. e, O  O* a/ C
  73. char *dmabufsrc1 = NULL;
    , K2 g- ~0 R+ T# R5 w/ ^1 m
  74. char *dmabufsrc2 = NULL;
    1 O( K1 H- T' L
  75. char *dmabufdest1 = NULL;5 A, }7 d4 W* ~) A+ ~" U
  76. char *dmabufdest2 = NULL;
    8 B( Q1 k# |5 _; @
  77. 3 l& D' \2 n6 B# @. j3 W
  78. static int acnt = 512;
    - p: j+ t1 \6 m5 Q! H3 E
  79. static int bcnt = 8;! e+ H% n: h- x) z7 M
  80. static int ccnt = 8;
    / j; k( |8 R' b- E/ w/ _7 T
  81. 1 c# g8 V4 M% [3 x1 B
  82. module_param(acnt, int, S_IRUGO);, V* {0 _. }' Z
  83. module_param(bcnt, int, S_IRUGO);
      w1 T% S6 ^; o  c2 x# t$ x
  84. module_param(ccnt, int, S_IRUGO);
复制代码

8 r* U) `( Z% |8 Q2 Y: y. [) E
( c' C+ R1 p! Y, V- n  A      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 f0 ]) W4 E* U) V8 c* Karm-none-linux-gnueabi-gcc  -I /home/tl/omapl138/linux-3.3/arch/arm/include -I /home/tl/omapl138/linux-3.3/include  EDMA3test.cpp -o EDMA3这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# V# D* m: `, @, ]
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 b6 |( x. x- ?- M+ o- e( K* U& ]2 I0 s0 u4 O' |* ?1 |& l

; Q+ i' }) o0 F8 n$ A, M
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

点击跳转“创龙科技服务通”

QQ|手机版|小黑屋|嵌入式开发者社区 ( 粤ICP备15055271号

GMT+8, 2026-3-28 04:07 , Processed in 0.038596 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

快速回复 返回顶部 返回列表