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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ d# }% }' g7 O' j# u
  1. [code]EDMA sample test application
    3 Y% M' o7 Y" R: \% ?8 x
  2. /*
    8 n6 c' V# h6 }
  3. * edma_test.c
    5 e9 q: h5 N9 D) ~4 ^( A6 d
  4. *6 k0 f+ O9 ]! F( b! M
  5. * brief  EDMA3 Test Application
    $ ?7 e# y) O6 }& Y8 u- Y
  6. *
    & C  P5 _" G% h8 R7 q7 S$ e1 ?
  7. *   This file contains EDMA3 Test code.8 R% j3 c& f& b9 o; H
  8. *8 h) `* l  o; D
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    # k8 p% `1 _* V3 u! Q1 ?7 [
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    1 }6 W) U6 ~3 i7 d5 P! a: J- j
  11. *         TO CHANGE.6 c5 L" I2 ]7 Q' k$ Z: e0 i
  12. *0 Y! Q2 q. O( Y4 h# R2 D
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" b+ }, u$ N' q# `
  14. *
    ) x; g/ J) u2 `
  15. * This program is free software; you can redistribute it and/or
    - \# w7 b) \- M( L
  16. * modify it under the terms of the GNU General Public License as
    ) z5 e, P% n$ ^% G+ [, K1 \, w
  17. * published by the Free Software Foundation version 2.
    : r) o' ~; e6 ~( S8 @. V5 I% h, O
  18. *
    4 O& {- k& b! Y- a
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    8 [; V, R. \9 e* m
  20. * kind, whether express or implied; without even the implied warranty
    2 P2 w8 B8 Z# O+ ^1 x, E! ^
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    / u7 |: S4 N! m( Z
  22. * GNU General Public License for more details.2 U4 `. R; @& S1 Q
  23. */
    0 c0 z! `" E2 Y! I

  24. 1 P$ V+ J' _, e$ m# ?5 o4 t4 _0 S+ y3 e
  25. #include <linux/module.h>
    0 o7 |6 [) o; k, J: H5 W
  26. #include <linux/init.h>6 B  P$ B, z% }. V
  27. #include <linux/errno.h>( F0 @1 P" O: f) N7 i& F8 V/ J* {
  28. #include <linux/types.h>
    0 z: T9 ^9 i( I9 ?9 u0 f  s8 a
  29. #include <linux/interrupt.h>
      ~1 v, s1 Z  w  E, H
  30. #include <asm/io.h>0 ?! d5 Z# z0 K6 J0 j/ Y
  31. #include <linux/moduleparam.h>% f- V/ o: Z) K  `. ?$ D1 H9 J
  32. #include <linux/sysctl.h>
    6 ^( A# u, P: ?/ P0 y4 W  E
  33. #include <linux/mm.h>
    5 k" J- p2 V4 \. t. C* m' R# X1 J
  34. #include <linux/dma-mapping.h>
    ( N, _+ ^2 X4 N2 R6 M

  35. ! f; z" Z8 p1 k, a( n
  36. #include <mach/memory.h>
    7 p  ?  D+ O" J) M4 z
  37. #include <mach/hardware.h>
    : A% _9 k0 M% V, ^; L& h+ E6 Y
  38. #include <mach/irqs.h>& z9 f& }/ M  J
  39. #include <asm/hardware/edma.h>+ _' M: ]2 x- I' h

  40. * `2 n+ |' F" D
  41. #undef EDMA3_DEBUG+ J6 }' V! A2 m5 R, S, q
  42. /*#define EDMA3_DEBUG*/, A0 h0 g. Z5 `" W# R: d
  43. # H5 U+ n0 @1 [- S( ]- D
  44. #ifdef EDMA3_DEBUG, I' H' |, c) H9 v$ }9 _9 }6 C
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    + Y# k  k) `$ i5 i+ N, _" u8 w( W
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): K  J; V) U2 r/ q7 Z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    : k, M, |! p7 ?; J" f( x
  48. #else
    9 k2 ?3 D& G$ ^' }( x: T3 d
  49. #define DMA_PRINTK( x... )# s6 D3 g; |" `8 T# v+ [
  50. #define DMA_FN_IN
    + t2 H- a& Z# u8 d0 l, F
  51. #define DMA_FN_OUT7 U9 [$ c: P+ b9 }- z/ N
  52. #endif
      ]( C5 O- i3 r. a7 R& Y- X+ b3 l
  53. 2 \+ T' c. m% h3 X
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    # ~9 a' {" `( V; K' }+ D
  55. #define STATIC_SHIFT                3
    : {3 r* V- m6 e  t
  56. #define TCINTEN_SHIFT               20
    & P( V& Q* m/ k6 B5 E
  57. #define ITCINTEN_SHIFT              21
    7 l# g* v7 K8 T$ K% q+ U6 X6 u
  58. #define TCCHEN_SHIFT                229 D  i: m% p& @0 \# {
  59. #define ITCCHEN_SHIFT               23
    ) i3 O( G1 V" ~: v  _  e# ?

  60. - n- f, j' a% V. }: b# e
  61. static volatile int irqraised1 = 0;
    / n. K  @* P" O, ]
  62. static volatile int irqraised2 = 0;
    5 p7 D1 }8 b) s3 R9 Y

  63. ; |( G6 d( Y" g4 T+ L# Y0 @
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* j% Z& g0 A5 Y% D, z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 f! p# D1 l% A( Z( g1 s, J9 T
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / k( P& d, ~( V, s
  67. ( W  A" w1 |+ D+ y
  68. dma_addr_t dmaphyssrc1 = 0;) t8 Y" o! J; v2 G2 p/ c
  69. dma_addr_t dmaphyssrc2 = 0;: o' z- _2 t% w/ ~0 Q/ ^
  70. dma_addr_t dmaphysdest1 = 0;/ b' U3 g+ D: C+ x& J3 g
  71. dma_addr_t dmaphysdest2 = 0;9 f9 S0 r" \9 a) s6 k" P
  72. & o4 F* x9 D6 e% v" d0 f
  73. char *dmabufsrc1 = NULL;* @% M  w0 w7 Q1 R( B( ~9 U. J( n
  74. char *dmabufsrc2 = NULL;; r  a% P. N" w; E  e& ]3 D
  75. char *dmabufdest1 = NULL;: i2 v* S0 H# N/ ?8 I
  76. char *dmabufdest2 = NULL;
    ( {( S! Q& A. _# u. o6 u: M

  77. % l7 b- m  u% G# g0 Y* p
  78. static int acnt = 512;( p( J) Y2 E( T5 r% E
  79. static int bcnt = 8;/ U# c$ _- W3 B% G& G6 E- B* n4 D
  80. static int ccnt = 8;
    * |( M% r) p5 C! Q: O1 A

  81. 8 a% o; b! v4 b$ u4 {. E
  82. module_param(acnt, int, S_IRUGO);0 Y9 E8 C4 S- t$ M, u# J
  83. module_param(bcnt, int, S_IRUGO);! r, g3 Q) B8 v$ w: k
  84. module_param(ccnt, int, S_IRUGO);
复制代码

  L: J! C) @- Z6 q! i0 \% `5 b
6 Z4 i1 I7 n3 G* v5 e- H      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ r* J2 _9 N% s2 P/ \  j* Q
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; g1 E4 \; V8 m
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 g/ d; J/ X  f% [0 n- Q
- P* ?0 ~7 ^; v% q1 X: l. K3 A; ~5 a' y* _& M# ^3 S! q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-24 02:56 , Processed in 0.038355 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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