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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : q" X3 x3 [) M, I* L! q
  1. [code]EDMA sample test application
    1 e2 _+ L: a/ K* F+ s
  2. /*
    + ?" g/ J# }& G+ f8 y
  3. * edma_test.c2 n. m; s: d4 Z& M; T0 E
  4. *5 c  M3 d- t" w
  5. * brief  EDMA3 Test Application; C5 K+ o  ]0 `" P% i- G
  6. *5 l6 E$ y/ w4 h  m/ d8 E
  7. *   This file contains EDMA3 Test code.
    / @! V0 ^7 P# t( i) K  J
  8. *
    4 E" F6 `  T) ]; f
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    1 ?* k, E! @8 a: D( {. J, X2 R
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    . g5 N! J0 S1 q! a! v( U
  11. *         TO CHANGE.
    $ A: m/ q4 |6 U) U# h) ?/ t- G1 x
  12. *1 P8 O4 ^. u" L" f
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 i/ p  T; S  T$ A. U4 c; d
  14. *
    & R, Q( o1 N$ w* j" f* ]% |! b
  15. * This program is free software; you can redistribute it and/or
    + @/ t  L6 Z! ?; U8 O0 D
  16. * modify it under the terms of the GNU General Public License as
    * c7 u5 f- |3 H
  17. * published by the Free Software Foundation version 2.
    ' i# _  }0 i1 k
  18. *2 N' v+ H7 V# a! {. h9 K' _
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    - ^8 x6 J% J! m
  20. * kind, whether express or implied; without even the implied warranty
    ! f  R( }$ k/ V' J( w
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the( n) B7 a4 c4 A% O2 t. V2 p  J
  22. * GNU General Public License for more details.4 Y2 h' f) k; g; K
  23. */# t6 V' H  J5 Z% R1 {$ J9 `# }
  24. # n$ Z; w  l6 J
  25. #include <linux/module.h>
    4 `4 O* c8 n8 g8 U% [+ e! [$ I  V
  26. #include <linux/init.h>
    + S% I! Q$ w( }6 ^7 v
  27. #include <linux/errno.h>
    ( j; }$ [: J# c( o: H
  28. #include <linux/types.h>$ ]( V, r% W! d+ F* g! Z
  29. #include <linux/interrupt.h>5 ~& P( N$ `) W4 D; w# _
  30. #include <asm/io.h>
    9 ?' ?9 p- ~$ [* X& ^( J! k# I
  31. #include <linux/moduleparam.h>
    1 ~: V; W+ H* g( E" C
  32. #include <linux/sysctl.h>
    - B$ t# G; H3 ~/ _
  33. #include <linux/mm.h>  ]8 S$ b- ]7 M0 a( j2 U" r
  34. #include <linux/dma-mapping.h>
    ' g0 B% K3 H% }. n1 ^  O! E/ L$ X
  35. # ^) n3 b" G9 K6 a
  36. #include <mach/memory.h>2 w* i, f/ f" n$ g2 t+ [" J
  37. #include <mach/hardware.h>; \5 d/ L) [1 B( I' u- i
  38. #include <mach/irqs.h>- N6 q' M5 [9 u+ o+ I
  39. #include <asm/hardware/edma.h>) t& t/ \6 g5 X0 i7 q+ ]

  40. * x) K( `) Q. v/ \% e
  41. #undef EDMA3_DEBUG) h- ?- a) C2 ?- N4 S9 r* A
  42. /*#define EDMA3_DEBUG*/# C: a8 B+ ]& S- G6 G

  43. , ~7 L( D2 u5 V/ M
  44. #ifdef EDMA3_DEBUG
    9 b1 b6 G' r1 V# v7 G: W0 Z5 s9 N8 u
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
      q/ v& u. g' P" v% _
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 K  p' F$ ?) {, |' `: w# W
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    : @( O8 O! H4 U
  48. #else
    1 x& y/ v( g: E% V) o5 x
  49. #define DMA_PRINTK( x... )6 Y0 B+ h3 h) M
  50. #define DMA_FN_IN, K( h# q1 D6 e% W0 P+ s8 z  ~
  51. #define DMA_FN_OUT" G1 M& ^4 q7 M4 s$ K: ^
  52. #endif
    2 R) b# Q% i/ R% N5 ~7 Z* c4 j) o

  53. 8 c8 V- \2 f; t( K$ i
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768); z; R! {3 d: E7 Q2 ^7 u/ P
  55. #define STATIC_SHIFT                3
    ( c8 X, G) r- N9 V
  56. #define TCINTEN_SHIFT               204 `  J6 I) p  J2 A
  57. #define ITCINTEN_SHIFT              21$ A! ~* D5 K2 t! k( n: p0 z
  58. #define TCCHEN_SHIFT                225 K! F" C* y: ^% _( K
  59. #define ITCCHEN_SHIFT               23
    4 ~6 U6 i/ C+ D6 P9 h4 B

  60. 5 q5 A" h6 o. N( V  i. h, V) ^! h
  61. static volatile int irqraised1 = 0;9 m2 A6 f( X* j- B; m2 A
  62. static volatile int irqraised2 = 0;
    - W4 ?" x2 q( V% {) E$ {9 w* s

  63. . Q  B: R4 d4 x% R' @  J
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; w9 M/ Z- M5 ]
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 ?: e- D) ^$ d% l2 \. e
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 n# I  c1 ~- }) B! L) }

  67. 2 f, B& p0 y9 x9 u$ o* ?! C
  68. dma_addr_t dmaphyssrc1 = 0;
    ' J! b+ c. k7 D9 p. J( _( o
  69. dma_addr_t dmaphyssrc2 = 0;
    . ~6 A- C6 k  \1 H* F  c
  70. dma_addr_t dmaphysdest1 = 0;% u; q4 t2 \1 C$ }
  71. dma_addr_t dmaphysdest2 = 0;. A8 I! h" ^. z" C# M6 s' J" P
  72. , Q, k* I  \, q5 O
  73. char *dmabufsrc1 = NULL;# Y7 c# d4 {& I! ]6 v; H( ]* ~$ q1 l
  74. char *dmabufsrc2 = NULL;
    ' j) [# G! ^/ M: a0 c3 j" z
  75. char *dmabufdest1 = NULL;% l! G( I9 N" m/ P% N; o+ Z& y: `, I
  76. char *dmabufdest2 = NULL;
    5 y. y" V7 _3 h: _" _" \

  77. 3 S. _% K, a% v1 N# A  C
  78. static int acnt = 512;
      g2 h# T6 {8 d/ k1 O
  79. static int bcnt = 8;0 H( i4 V8 ]" j  X  n" `
  80. static int ccnt = 8;
    " m$ d' A9 K$ a% U- x

  81.   E) s2 m' G+ t$ y, F7 z7 k
  82. module_param(acnt, int, S_IRUGO);
    ( s2 f8 B" s7 m( W, Z# [4 q
  83. module_param(bcnt, int, S_IRUGO);# h) k4 @  T# z+ I  V* A
  84. module_param(ccnt, int, S_IRUGO);
复制代码
, P/ {. h9 H: ?9 X
4 o" }$ w% E  k6 s
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" P1 \9 ]" @8 v0 u# }- q& x
arm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 F: @$ t: T5 Z! M+ t
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 K1 T6 y# _# N* \

0 a. c; {4 j+ O, D1 b% a8 A: j  u+ y! `  z. S+ d  u
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-9 23:21 , Processed in 0.053177 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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