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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & T1 P* T/ [/ F1 R% }- _
  1. [code]EDMA sample test application$ b, j% _. t5 W$ f: M
  2. /*8 k" S3 c, ]4 c! s. c. {7 _( Q
  3. * edma_test.c
    6 j1 R+ l# q# {; v; Y+ S
  4. *
    . L" {, P. t8 {; K; L9 {
  5. * brief  EDMA3 Test Application
    . f5 k7 q% L/ w% ?- q# L
  6. *
    : T) J2 v, v' p
  7. *   This file contains EDMA3 Test code.) j' w6 j: W5 y  I+ p% C
  8. *" |6 I$ k* Z3 Y1 N$ Y; L
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( x, n  j& E; d/ `- i
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ! q# [# _) S) @% V4 ]
  11. *         TO CHANGE.
    / U/ M# H4 i' {4 T6 i
  12. *
      p! z. A& ~4 u3 M/ I; ~9 b- v' A
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ( b% z0 e: [4 P7 F
  14. *" k4 u$ k0 R9 f3 a. v3 [; t
  15. * This program is free software; you can redistribute it and/or- y  c2 A" b/ G3 T( ?5 j) x
  16. * modify it under the terms of the GNU General Public License as
    * }& A- ?3 U! l( \8 _8 @9 r
  17. * published by the Free Software Foundation version 2.
    8 b  k" D3 \4 Y& m9 B
  18. *# r) q! R2 r- z4 O" \
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 J4 T) h# h$ B! D! \  z6 U  V
  20. * kind, whether express or implied; without even the implied warranty
    " n. {3 C/ i2 g/ I+ j
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    7 m- Z' J- o% T& @2 p  U' b# Y. d
  22. * GNU General Public License for more details.
    $ V5 @+ b% i* v; Z8 G
  23. */" ^: x& _' Z; z' ?4 D

  24. 5 w  C+ S  k- T8 W! O
  25. #include <linux/module.h>+ V7 K# }: P1 ]2 @! O, K9 B, J
  26. #include <linux/init.h>
    / G. K. r" A" i  Z
  27. #include <linux/errno.h>5 o9 C, q" z- R2 @
  28. #include <linux/types.h>
    , S: _4 `' U& A( ?
  29. #include <linux/interrupt.h>' C, Z9 P9 b& E$ @+ m" z) z8 c0 I
  30. #include <asm/io.h>
    7 r+ s6 S) F, N
  31. #include <linux/moduleparam.h>
    4 v( v3 x+ ]/ [* S( [+ I
  32. #include <linux/sysctl.h>8 ~- R# ?1 x2 @/ Z+ @7 u0 Z
  33. #include <linux/mm.h>
    2 \+ |- C. a/ m1 ?& s  [: v) a  C
  34. #include <linux/dma-mapping.h>
    ' N$ U' i: d& S9 L' _
  35. 8 `+ `1 u- D- n" b
  36. #include <mach/memory.h># S: ^6 G+ b- |. d5 D1 Z
  37. #include <mach/hardware.h>- @# i2 A  n1 Z( ]
  38. #include <mach/irqs.h>* \0 p# J6 o$ F, j7 I
  39. #include <asm/hardware/edma.h>
    % g, l7 G# E' f7 [. x
  40. " i( d4 i9 _; S! D% `/ f( C
  41. #undef EDMA3_DEBUG7 J+ `4 \" {; o; v" O& V8 }1 v5 Y
  42. /*#define EDMA3_DEBUG*/4 B# J4 c4 @! a2 `7 Z, m( ~

  43. ! [4 l# B, @, V4 i% k2 Z
  44. #ifdef EDMA3_DEBUG
    - ~) ?; v* v( c; n6 e# i
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" j1 m( b% Z9 u: Y/ s) u& j! T. W
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! Q, H- j5 S$ X
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& x$ b9 I; v% E! k% R; \
  48. #else0 ~) R" [% O; i( t7 \+ a! U
  49. #define DMA_PRINTK( x... )6 D0 j6 i7 C' p
  50. #define DMA_FN_IN
    0 Q& Y# m- A$ A9 A0 e
  51. #define DMA_FN_OUT1 [* p/ p1 X( p
  52. #endif1 z2 f0 Q. Q9 l# X3 F
  53. " O1 K! _3 c2 `; F8 _. m
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    . p/ N  ]( x) S) m
  55. #define STATIC_SHIFT                30 G* J9 `6 R+ l* f
  56. #define TCINTEN_SHIFT               20
    # Z: s- E, w' S' w: i
  57. #define ITCINTEN_SHIFT              21
    : I: H0 F' c  l9 Y
  58. #define TCCHEN_SHIFT                22& d4 [* F5 q' ]; D1 r
  59. #define ITCCHEN_SHIFT               23
    $ {( L( w5 P' w2 ?5 G2 K& ?

  60. , M. I; ?: h+ K! b
  61. static volatile int irqraised1 = 0;  ]* L8 d/ ^9 Y( ~
  62. static volatile int irqraised2 = 0;
    , S7 p5 i0 r  D# x* g8 x
  63. 9 l+ u) E7 e" F( P
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 J3 _0 x; `3 }
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 A+ Y3 ]/ R+ n, p/ F) G$ D* c
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) L! G2 J+ z% X
  67. 4 F) a8 [, N* z; t1 D) C5 }: M
  68. dma_addr_t dmaphyssrc1 = 0;
    * Z/ O" T: L# Y, K) E
  69. dma_addr_t dmaphyssrc2 = 0;. I4 {- i1 K; N5 w, P7 W* D" ^! [2 e
  70. dma_addr_t dmaphysdest1 = 0;) H5 [& B) A$ i
  71. dma_addr_t dmaphysdest2 = 0;
      y2 M; N) g3 G* _8 L# P7 c2 U
  72. , m6 ?) U6 Q* W4 M0 i
  73. char *dmabufsrc1 = NULL;
    : E' P" r6 c, v0 b; Y+ b. W1 T
  74. char *dmabufsrc2 = NULL;% j% P) d9 ?9 ]. n
  75. char *dmabufdest1 = NULL;
    % N8 R+ K# v" q. \# s9 Y% Q
  76. char *dmabufdest2 = NULL;
    & H- o! y: @0 l$ c: m3 y

  77. 3 E( u  Y5 ]& z: z
  78. static int acnt = 512;6 E2 \) x/ l4 u, Z4 G
  79. static int bcnt = 8;% o, Z8 Y$ J4 H; S. C5 Q
  80. static int ccnt = 8;- A6 c! b3 d9 X1 y
  81. 2 D2 e7 p% a6 m# ?. C
  82. module_param(acnt, int, S_IRUGO);
    + V' D8 f, Y2 [# r0 L6 O% Q
  83. module_param(bcnt, int, S_IRUGO);! o" J+ `) j* c3 `
  84. module_param(ccnt, int, S_IRUGO);
复制代码
: E# o) v% y) j# m( u$ G0 O
* g0 ]4 }, m3 @; f  N# k: E
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' O7 \7 `% f3 Q; P3 B; d3 Tarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 ~2 ]( I# G2 ]) g* _7 `2 _
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! h% O* T# U& n9 S; G4 o! }2 Q8 }
! w( A2 `# |! m# d1 R- \
6 ~9 R( i3 D: S# V# z! H6 ]3 a
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-5-8 00:05 , Processed in 0.042596 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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