OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* t  Z" c7 x4 e. k. B0 w" P
  1. [code]EDMA sample test application% y8 s  S: F  }* c: u5 h4 u( g" {
  2. /*
    % T. k/ I3 I% |& T
  3. * edma_test.c
    4 _5 C0 g4 M- W: k
  4. *
    9 {( o6 S) L1 X7 v. ?! U
  5. * brief  EDMA3 Test Application; u7 {: ]& ?/ k# n6 A6 M
  6. *
    5 S8 o6 j0 r( W( L/ }
  7. *   This file contains EDMA3 Test code.
    0 x+ n. X: D: w' Y) z0 j7 D6 W8 q2 Z
  8. *8 E% e' |( q& V- n
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    4 Y& a- h1 b7 b0 F/ S
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 F1 A& y; c* @: p7 F
  11. *         TO CHANGE.
    9 G! Q& Z8 ?& Z+ P- A( m
  12. *" s( o  z! ~& s% k) Z" l
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: T# u7 Y" e5 d* i! u, y5 ^1 B
  14. *9 Q- d1 W& v4 p
  15. * This program is free software; you can redistribute it and/or/ j, e' ~3 `9 h1 @
  16. * modify it under the terms of the GNU General Public License as4 K6 k1 u4 R) n
  17. * published by the Free Software Foundation version 2.
    9 f0 @+ u/ w6 l0 C
  18. *; d- S8 Q; R0 M: e* i+ k2 Q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 ?& X# e( c; a  b0 |+ p9 P
  20. * kind, whether express or implied; without even the implied warranty
    $ ^* b- K$ _# o6 m$ m: Z9 K
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the8 F$ |' F- w) ?. V  f7 V
  22. * GNU General Public License for more details.! v. ~+ V3 j+ P$ }
  23. */
    8 [2 |  N( |2 p5 I/ j

  24.   g2 U) w$ ^. t' l& ]: v
  25. #include <linux/module.h>& l! m7 f6 |( }
  26. #include <linux/init.h>5 h: i1 o1 |; v! a! Y1 k. e" j" I
  27. #include <linux/errno.h>
    4 Z* F$ }( ]& `$ Z6 `* F, q# K+ `" Q2 s
  28. #include <linux/types.h>8 e+ D) h' v% Z2 D2 s; t! v, N
  29. #include <linux/interrupt.h>
    : I8 l4 Q, a7 a6 H4 f6 H
  30. #include <asm/io.h>
    ) a/ o/ G. W& v3 C6 q
  31. #include <linux/moduleparam.h>
    8 o% n8 k- J& E9 u0 l' V5 h0 L2 @1 t
  32. #include <linux/sysctl.h>
    * Z6 ~6 d# N# e" W( v, G; \
  33. #include <linux/mm.h>
    * ^6 o& v* F0 E+ z
  34. #include <linux/dma-mapping.h>6 k% M9 [  C' \0 I7 E

  35.   n5 n8 Z# d$ V# ?5 V0 ?
  36. #include <mach/memory.h>
    9 \: z. y9 B! M4 U# D  _
  37. #include <mach/hardware.h>
    ! U! k5 H( Q- _+ x2 ~; X
  38. #include <mach/irqs.h>1 c( m! H4 {8 u+ }6 p
  39. #include <asm/hardware/edma.h>7 m0 c5 @1 K: o9 R9 X1 x1 p
  40. 3 g9 V/ F. o/ E5 M4 A3 T" e3 I! d9 f
  41. #undef EDMA3_DEBUG
    3 Z. Q* w' v+ w/ h' ?: P
  42. /*#define EDMA3_DEBUG*/
    % Q) O# s9 U6 |/ \- O/ P( E

  43. $ d3 r. u- X! \" d; k& e7 Q
  44. #ifdef EDMA3_DEBUG
    7 @$ H9 v+ o/ p" G9 s) a. y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    / k5 @# q8 E  h+ p/ d) {; x
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    3 ]4 b+ E, ]1 J  {* i( f/ I9 u! {
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), y6 X7 i9 o2 y* W- d# `. o
  48. #else
    : Y* Z+ x% _2 y; n
  49. #define DMA_PRINTK( x... ), q+ X4 s* B! i- D, t& d4 h: j
  50. #define DMA_FN_IN; }2 [' `+ b1 i5 ^
  51. #define DMA_FN_OUT
      V& Y3 k0 J) C! M( k* r6 {
  52. #endif
    : B$ F' u) Y) k3 x& A2 N4 O
  53. 8 d' E* r& q6 D# O8 V, I$ l% R6 _
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768), b3 C( d: s6 \% n
  55. #define STATIC_SHIFT                3
    - b+ s1 q) @8 o; o* @, h6 ^
  56. #define TCINTEN_SHIFT               20- D& Y* E/ K/ L5 Q8 h, b+ s9 i3 K
  57. #define ITCINTEN_SHIFT              214 h: w7 a' w0 ^' j
  58. #define TCCHEN_SHIFT                22! j! U, B, m! u$ P' n
  59. #define ITCCHEN_SHIFT               23$ q& G* h2 I# J; l4 z! u- m3 H
  60. , d$ s& |. ?' j6 ~1 V* W
  61. static volatile int irqraised1 = 0;* k, u' b# E# g0 k6 A
  62. static volatile int irqraised2 = 0;8 I# R# P* \+ {5 Y8 v

  63. 8 l" H! K: y$ H; [
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 k+ h1 b4 T2 c0 Y6 U, g1 b
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ _* b7 r5 I  B
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 f" W8 y6 s1 W5 {# G& a

  67. ! ]+ L4 p$ n7 j! h
  68. dma_addr_t dmaphyssrc1 = 0;
    . S3 k+ O* k$ y: p
  69. dma_addr_t dmaphyssrc2 = 0;, X/ {1 {! j; I2 ?
  70. dma_addr_t dmaphysdest1 = 0;) `' s" j1 Q. f( r
  71. dma_addr_t dmaphysdest2 = 0;. N8 J' p- ~% N, ?7 T0 m" [

  72. * x$ |9 V( P- F
  73. char *dmabufsrc1 = NULL;
    + q6 K% N+ O# }# l9 X! p
  74. char *dmabufsrc2 = NULL;
      f. P0 ?9 G4 Y
  75. char *dmabufdest1 = NULL;
    ( B- J$ a# q7 n- L/ b) @7 k
  76. char *dmabufdest2 = NULL;: F5 z4 G( G5 B- ]( V% E6 R  j; O
  77. , V0 D- B+ `! j4 H
  78. static int acnt = 512;- G2 l7 N* J1 V$ W
  79. static int bcnt = 8;
    6 u- q7 e$ Y, G/ `3 v
  80. static int ccnt = 8;' V4 P( |' X6 A9 G

  81. 8 K, J1 _, l$ U; L% o% h2 D/ }
  82. module_param(acnt, int, S_IRUGO);3 S( b' B0 h# }4 Z* ~' }7 x. u# _5 C
  83. module_param(bcnt, int, S_IRUGO);2 N" _9 S- c/ M* B2 |$ C8 r+ i
  84. module_param(ccnt, int, S_IRUGO);
复制代码

% |% b) L* C( u! p0 S/ Q: Q1 [. m7 s3 E7 s& I( Z2 R# a
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ V8 b5 S6 ^  J3 d) ]5 x: w
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 O" Z8 ]+ g- }1 B; [, O$ O
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 M" f" d5 N7 l/ `# \- u+ _

" R1 [/ p2 ?# m% C
1 b, x: w0 f& x8 N7 Y0 Q: i
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-13 10:54 , Processed in 0.038764 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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