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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
  Q4 J  B) S' q8 Z1 h+ N/ U5 T/ i! ?# N4 i
  1. [code]EDMA sample test application. J$ N0 I  u$ b5 L& W
  2. /*2 Q* |: `) Q6 C& ]! H
  3. * edma_test.c
    $ T" G! p# @5 ?! Q; n
  4. *
    ) P; M7 `% e) _
  5. * brief  EDMA3 Test Application) @8 S0 {+ s( |* f! E
  6. *
    & O$ V/ w1 M& c$ C+ A
  7. *   This file contains EDMA3 Test code.
    , k5 z  ]% z6 }- T" w6 ?; }; b
  8. *
    : W0 g" O% H+ b7 p9 P5 j3 |
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    6 R6 P3 v& d  w, ]
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) J4 j& G/ _3 o
  11. *         TO CHANGE.& n; L% A0 Y" \* w
  12. *! z: p6 n; d1 t" ]6 X: i8 m( Q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 z; Q% C7 x5 M8 p
  14. *
    * y/ x- Q/ A/ J4 Z, S7 \
  15. * This program is free software; you can redistribute it and/or& a1 v5 ~! h/ L+ A. q( k9 ~) L
  16. * modify it under the terms of the GNU General Public License as* I& C' F# V5 d; v5 I9 o
  17. * published by the Free Software Foundation version 2.# [! H. M# q; ]
  18. *
    # P4 ?/ i0 u) T' n2 U0 \' \
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any- L$ g& ?' U6 \4 O) r* _
  20. * kind, whether express or implied; without even the implied warranty
    ; o6 p- J) w6 N4 ~
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ) d! i0 Z% Z4 ]
  22. * GNU General Public License for more details.+ f2 ^5 N( E; c& z  r5 k
  23. */" c2 ^- E2 {* c

  24. - ~: r8 e) m! }& {- A
  25. #include <linux/module.h>; U* R4 ^9 X4 u9 Y
  26. #include <linux/init.h>; B6 |# Y# J( Z) |6 m$ _4 p
  27. #include <linux/errno.h>( ^& D* K  i' z* R3 N
  28. #include <linux/types.h>! s! |& X+ f2 ^: w  d% [# j7 B( l
  29. #include <linux/interrupt.h>* r0 H+ c1 f1 B4 G% S
  30. #include <asm/io.h>
    8 r  A" W6 C5 z1 {$ Y$ {3 i
  31. #include <linux/moduleparam.h>
    & C8 k, A0 b' \7 c. }0 E/ e6 I
  32. #include <linux/sysctl.h>
    $ U) V. L' o1 l# Q3 G) |3 B0 V, `
  33. #include <linux/mm.h>
    % M) z2 C3 x1 h
  34. #include <linux/dma-mapping.h>$ b, j+ r0 v( l  c! v" f: Z7 U; D
  35. $ h$ u1 |  I- z: t6 D. j
  36. #include <mach/memory.h>
    ' s5 _; ~/ F5 @! `3 q4 w
  37. #include <mach/hardware.h>
    : |" Y! b2 g) x; N
  38. #include <mach/irqs.h>: O; T7 D$ n, U1 @, D2 y
  39. #include <asm/hardware/edma.h>7 S& i+ E. Q3 {# b( m$ S

  40. 4 k; k8 w* o! k0 U) {+ |4 f+ N/ {  Q
  41. #undef EDMA3_DEBUG
    1 y1 z$ X7 O# E5 X6 ]- h) M$ I! `3 F
  42. /*#define EDMA3_DEBUG*/5 z$ A% D9 b. V2 n& `! W, [7 p; e
  43. + Q. ~  I5 }9 o
  44. #ifdef EDMA3_DEBUG. v0 e( [2 H9 y9 f
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ' |; z- c+ k+ ~4 l
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! ^6 N, S, ]  n  ?1 `+ A2 ^0 ~+ O
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    3 c; b# ^5 ]  L! @
  48. #else
    5 U6 q/ p! h; ^3 p4 X: J! y# |
  49. #define DMA_PRINTK( x... )- a) D7 i9 f3 H6 z7 T/ |, ~" E
  50. #define DMA_FN_IN
    / w5 b* [, V# g2 U4 [4 n; y4 T; \
  51. #define DMA_FN_OUT2 j& A, S' l- ~/ }+ B
  52. #endif# Y: M( E' Z* g
  53. 9 {% M& B' ?3 ]1 s0 M2 ]1 v
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)9 r$ `' s# N8 c
  55. #define STATIC_SHIFT                3; e0 S9 l! V1 |& w  a
  56. #define TCINTEN_SHIFT               20; k; W$ d; L1 N* W; R, T
  57. #define ITCINTEN_SHIFT              21
    . N9 C4 ?( z! t6 r+ F
  58. #define TCCHEN_SHIFT                22
    . J* s8 r# J8 V. d; ?4 _) e
  59. #define ITCCHEN_SHIFT               23" @1 k  ~+ A9 l% K' ?: {1 t1 h

  60. 6 n; F; T; i- f. e/ e
  61. static volatile int irqraised1 = 0;( ~2 C0 C% Z6 r) r
  62. static volatile int irqraised2 = 0;9 \( F3 P- x: t' t9 r
  63. 9 u( v: T4 o$ W
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ B" o* R/ J- q( C, v( `4 G
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' J" j$ E8 S$ L9 r: F3 M
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " a$ C' P! ^  C8 z- C- K8 B* ^
  67.   a& n0 Z% {. u8 p. N, n+ x4 k
  68. dma_addr_t dmaphyssrc1 = 0;$ R" u1 n2 L( @! q4 \8 ?$ ]! L
  69. dma_addr_t dmaphyssrc2 = 0;8 _/ `- Y! J  {/ c
  70. dma_addr_t dmaphysdest1 = 0;
    $ e2 G! ~7 s5 z4 }- P4 x1 r
  71. dma_addr_t dmaphysdest2 = 0;
    * c5 M$ z; V: p" N2 b( C

  72. . z! G9 e6 z- v) f/ r; t7 B: U8 n& `
  73. char *dmabufsrc1 = NULL;& ~5 C+ O+ i7 j+ u
  74. char *dmabufsrc2 = NULL;- v* j+ a' x# O/ [/ d; f
  75. char *dmabufdest1 = NULL;# L, H9 i" c! c; y( Z! b2 A$ D
  76. char *dmabufdest2 = NULL;' c" ]2 H# n/ A
  77. # U. z0 C7 ^7 ?6 r5 I. \
  78. static int acnt = 512;, v7 W4 e; \; \
  79. static int bcnt = 8;4 e! s* s- g. R3 B! @  E+ {+ ?
  80. static int ccnt = 8;
    8 M1 x9 B5 }: d; {
  81. & Q- |. h5 g6 Z6 k
  82. module_param(acnt, int, S_IRUGO);4 y% C7 m0 s6 s; x1 }1 x
  83. module_param(bcnt, int, S_IRUGO);% k, V6 r- X8 Z, C! e
  84. module_param(ccnt, int, S_IRUGO);
复制代码
0 N2 t/ S# |0 G4 n

0 ]7 n2 X6 F$ c4 w6 H* }      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' x% R6 Z* F6 U& narm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 f! q. V, a: K! s8 P' n4 X' p
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 E. S4 [& M; z* b$ V8 d; m8 W; w+ u
: K% s% X  f  y5 h+ G) {

1 d7 t7 C6 W/ C: Z! |! g1 l
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-29 00:56 , Processed in 0.038022 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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