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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 |/ S4 l% }( C% \
  1. [code]EDMA sample test application
    - [: G2 I6 H. N, |9 K4 k
  2. /*
    6 o' ]8 b; `: N) Z2 Q- S5 r+ _
  3. * edma_test.c7 ~4 u& Y; ]6 x" H0 g, {
  4. *9 G" c: }2 N; ?' e
  5. * brief  EDMA3 Test Application* k4 ]# y3 t4 a; f* U
  6. *
    & i8 p& x! k# D9 K
  7. *   This file contains EDMA3 Test code.0 \) G2 d, f$ {4 U( b
  8. *5 x9 I6 {' \  D+ x9 h
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    , P2 L3 c8 ?. n) o, s& m
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 x: Z& n0 M' j/ z9 J8 q9 s
  11. *         TO CHANGE.
    , K" ]- n/ H4 \3 o9 I* v
  12. *) S  U% O3 u  C2 f3 a
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 e- j  ~, C/ V" R7 t
  14. *
    . T* j! W# E/ j* m, S$ j
  15. * This program is free software; you can redistribute it and/or/ l. c! k! H& `6 i. T& @, n& T
  16. * modify it under the terms of the GNU General Public License as3 ~7 V1 K; F- f6 A  x) [
  17. * published by the Free Software Foundation version 2.( N4 M) m& E9 s- U! E8 K* `7 t
  18. *
    # K5 a/ p8 l& a  G# i* n5 @
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 w; R" ^& r6 F. U& T, `. v  @
  20. * kind, whether express or implied; without even the implied warranty
    " s; {: I" s/ d  q7 L1 I" |
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the, \4 p( t6 @! v3 O) x3 a: I
  22. * GNU General Public License for more details.
    7 R* B4 e7 P* ^9 v3 ~: L/ f6 b# V
  23. */
    9 g1 s' i/ {9 |4 }3 Z9 b- E& `

  24. 4 r% r/ ~5 `; a
  25. #include <linux/module.h>
    ) Q8 t# ^- k/ i, t% S" x: J* ?6 b- |
  26. #include <linux/init.h>; q4 C4 y7 Y' C3 o" |! C) I& |% V
  27. #include <linux/errno.h>
    2 a9 B5 |" X. s. T
  28. #include <linux/types.h>
    ) V% i5 s' D, D3 K! Y
  29. #include <linux/interrupt.h>
      o2 \* M8 N6 b
  30. #include <asm/io.h>% o9 z& z% q. A% J' W
  31. #include <linux/moduleparam.h>
    # I' v, b3 K! E  U+ v3 V7 ~( X- Y
  32. #include <linux/sysctl.h>
    ! ~1 l$ B: U$ ?; B  t
  33. #include <linux/mm.h>
    5 F. R! {- k" m9 \/ E* F
  34. #include <linux/dma-mapping.h>( Z( K. ]+ n: w+ U
  35. 9 Q' G( b1 @1 `+ S0 k
  36. #include <mach/memory.h>3 e5 q. v' g  D3 f/ i/ A, u( ]5 M
  37. #include <mach/hardware.h>/ r8 Z" `& |% P  J- f
  38. #include <mach/irqs.h>  _5 L+ L/ n- Y! ]8 I- _+ `
  39. #include <asm/hardware/edma.h>
    3 E. E" N/ z" @- [
  40. # J- {! c3 g, C0 j. O, c, z
  41. #undef EDMA3_DEBUG. L) o. n0 T% N* }
  42. /*#define EDMA3_DEBUG*/% T: o: K  w  n) W/ U' c
  43. 3 ~# H/ n* g  h/ V. g3 c
  44. #ifdef EDMA3_DEBUG' R# s" E$ S) e6 Q; @
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* \! J8 b; x; c, K& l$ M4 z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    2 S! b. L" ]2 N7 N  N
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    , w3 D4 I  Y" |  r) @5 y- G8 d; d1 h- }
  48. #else- X3 t8 P5 @  Q) ^  N$ `( Q! M
  49. #define DMA_PRINTK( x... )$ P- `/ P. ?1 o8 e7 V8 q( q5 `
  50. #define DMA_FN_IN
    7 ~+ Q: S8 f$ K2 R9 ^8 T$ L$ L1 d  `
  51. #define DMA_FN_OUT
    % g, O. }0 g( B2 t) o* N/ w& i" Q
  52. #endif
    6 r4 W7 i+ V# g* Q8 R& C: D
  53. 7 Q% X9 e/ e1 M4 v' U
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    , M9 f/ r9 o* |. o& u1 L
  55. #define STATIC_SHIFT                3' w- l( f8 p# K7 P
  56. #define TCINTEN_SHIFT               20
    & @; X% G6 n/ b
  57. #define ITCINTEN_SHIFT              21
    + r, D0 ]+ K% y2 j. U8 ]- l
  58. #define TCCHEN_SHIFT                227 s7 S0 w0 W% l7 E  g  {/ L5 k
  59. #define ITCCHEN_SHIFT               23/ H* O* C. [$ n

  60. 4 t8 g8 G& J( i4 Y% k7 T$ T7 i
  61. static volatile int irqraised1 = 0;+ G/ r( P9 I, |( H& V
  62. static volatile int irqraised2 = 0;
    4 [; U& t  b8 z! _+ r# i, ]+ P
  63. ( I' i, h: a: F0 ^- i1 H8 B
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' D" S2 T( _+ a+ c& p
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 |+ i) G! h. s# f2 Z1 z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( N" V7 R2 g! F5 T8 f

  67. % j- A& t$ o4 O% {- }
  68. dma_addr_t dmaphyssrc1 = 0;
    1 P0 c- j. ]  c) y
  69. dma_addr_t dmaphyssrc2 = 0;
    1 _+ v1 h" J) e5 _1 }
  70. dma_addr_t dmaphysdest1 = 0;5 j" k* T! |" |* L
  71. dma_addr_t dmaphysdest2 = 0;
    : Y- b  B% Q; }- _- X

  72. 4 B4 R  y; a0 `& {7 o5 l
  73. char *dmabufsrc1 = NULL;; \. k  v/ ~7 p, x: `& K
  74. char *dmabufsrc2 = NULL;( E1 S0 p; V, u! }
  75. char *dmabufdest1 = NULL;
    + @& J: `6 {  d* ~. C" |8 T
  76. char *dmabufdest2 = NULL;3 Z8 y! K3 Y8 |( r) C

  77. ! a6 A. E+ E7 y4 }4 F2 R
  78. static int acnt = 512;- _& C. M! f& j( }+ C# p" Y: h
  79. static int bcnt = 8;  |# p! A3 a, a: N# o  p
  80. static int ccnt = 8;1 i' q$ H3 {0 f" O& U; e  w

  81. : L0 ], \7 G7 }" r" w" d! D) w
  82. module_param(acnt, int, S_IRUGO);0 e7 w4 s* S$ Y
  83. module_param(bcnt, int, S_IRUGO);: X/ J% {+ k) e' a
  84. module_param(ccnt, int, S_IRUGO);
复制代码

3 x/ N. W+ {' _, ]  n, [; J' M$ r& w/ n
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( X# q" P2 v3 l8 |% u. y$ 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ X' Z5 L3 N4 y
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ ^: H5 L2 k1 v& i8 D2 C8 |, s
- Z( Y$ k8 l; M8 C1 A; {$ d
" D/ ?4 l7 w# h' N& E
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-18 14:57 , Processed in 0.037605 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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