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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 s8 j2 q$ X5 ]% O; L
  1. [code]EDMA sample test application& R4 h& Y5 J" k' j% K+ x
  2. /*9 U, p/ y+ v! R% @2 X9 h
  3. * edma_test.c; ^) z) h. {- F5 w
  4. *+ A) s9 I2 u3 ^+ C
  5. * brief  EDMA3 Test Application
    ! ^; N" @- V8 Q$ H+ @, K
  6. *- n% o% ~& b* C4 D, O# d0 H' i
  7. *   This file contains EDMA3 Test code.
    3 N+ L- L  U* B- ^
  8. *
    $ f, ]) ]2 Z0 r' F
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    1 N  H4 Y: N& F+ f: ]
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ! g& @6 \. A  C- ?) q: ^1 ~
  11. *         TO CHANGE.+ ]8 s  {, P" c/ o3 ~+ ]3 P
  12. *7 W% ]; g" m0 T( T& T
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    4 z/ P1 j0 s; J: x
  14. *) l8 x1 N* P7 C
  15. * This program is free software; you can redistribute it and/or8 ]; S* w! J% L3 }0 \( E, R: Y
  16. * modify it under the terms of the GNU General Public License as
    % S+ d  S4 E9 T# F! C+ F4 s5 h
  17. * published by the Free Software Foundation version 2.7 j4 x2 f6 ^8 T9 R
  18. *6 Q- c: t5 g* R0 r/ f
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    & X5 s% E* m# m0 X" j4 W" C# C9 R
  20. * kind, whether express or implied; without even the implied warranty) H! W0 _* D4 O+ Z/ v
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the2 A6 l* K: A- j/ w% x; U
  22. * GNU General Public License for more details.
    & p& R# I2 X9 G: I; ], f$ G& r+ l
  23. */& ~. y1 v2 d  X. j2 O: g, M

  24. 4 g6 p+ l8 b8 b$ Y2 }' b; j/ t) [- f
  25. #include <linux/module.h>% _  T/ A+ R0 y, A
  26. #include <linux/init.h>
    ) L" t9 N- w1 U, O
  27. #include <linux/errno.h>- H7 T  A. ~; B3 h6 m# |& c7 Z, e9 Q
  28. #include <linux/types.h>4 L) Z# ~7 A. ?8 ^7 W0 R) _' q
  29. #include <linux/interrupt.h>0 u" |5 c; X& D" k/ w( j
  30. #include <asm/io.h>
    ; f& q; l) j) d
  31. #include <linux/moduleparam.h>
    # n  W' _9 i! o
  32. #include <linux/sysctl.h>
    . y. B" h: K8 L' W. k
  33. #include <linux/mm.h>
    # F  ]# G& z. b+ r5 F  p
  34. #include <linux/dma-mapping.h>& S" [  L5 f) R& q9 n- l. Y

  35. , r: w1 V1 s5 t' Z& `% I6 L
  36. #include <mach/memory.h>5 V( w4 j& k% _3 Y
  37. #include <mach/hardware.h>4 C; U7 Y# \; A7 {; A" d& x7 A
  38. #include <mach/irqs.h>
    4 Q$ F! H7 Q! b' i% g4 P- ?
  39. #include <asm/hardware/edma.h>
    8 U% q6 i6 G; U; X# b6 f& _
  40. 9 R: j5 ?% p6 X, |
  41. #undef EDMA3_DEBUG7 _* z0 {/ ?9 Q' [4 O  I! o
  42. /*#define EDMA3_DEBUG*/9 d* e( o3 P: P5 C! P* V) E7 Y0 @" t
  43. " e6 _% d* [6 Y; M
  44. #ifdef EDMA3_DEBUG) a4 t/ i/ l0 Y; \+ K6 ^- j
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
      ^2 _. z3 v  O# i9 ]' l
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 f: z: k8 O6 l% u
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) n; L; c8 |6 U- z$ g
  48. #else
    5 O. e  A9 W& a: ~" g8 Z
  49. #define DMA_PRINTK( x... )
    2 n5 ^6 _& _2 U8 y( S/ y# s, ?
  50. #define DMA_FN_IN
    ) B2 |0 ~5 V3 H; l. h+ D& k4 M6 o
  51. #define DMA_FN_OUT
    & G  y. j, S/ D
  52. #endif& W2 `/ Z  j, i. y
  53. - n" u6 W% n1 H) k" y2 j
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    3 r  f' W4 x  Z/ G$ |
  55. #define STATIC_SHIFT                3! s% u0 B) y. D, \' o
  56. #define TCINTEN_SHIFT               20
    $ I! u) c; ^& q# C8 m' O
  57. #define ITCINTEN_SHIFT              21
    ; I0 @& a8 m+ A
  58. #define TCCHEN_SHIFT                22
    2 O1 q/ }8 [/ n2 f% n* k+ ]' X6 v
  59. #define ITCCHEN_SHIFT               232 r/ p* T+ Q  F- W! K
  60. , J2 z& I) z2 y' U7 B1 @
  61. static volatile int irqraised1 = 0;
    8 `. s: d5 ~- t1 ]* ~; \
  62. static volatile int irqraised2 = 0;
    ! c, Q$ i7 K" {" Y# Q5 F- [; t

  63. , s7 G8 z# p0 |
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) x# Y. e0 B0 A( T8 n* x
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & ?# A1 j, d0 h- i
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# C6 S% @3 O# N$ l

  67. . A& G) t! s/ S1 v8 b% O  Q$ Z
  68. dma_addr_t dmaphyssrc1 = 0;! s% ?! k3 d- {  w
  69. dma_addr_t dmaphyssrc2 = 0;& z) a+ m! Y: K1 |
  70. dma_addr_t dmaphysdest1 = 0;. G4 @: }0 x3 i! t& I
  71. dma_addr_t dmaphysdest2 = 0;
    8 T" M+ w& z8 f+ `8 A- ^
  72. : d/ h( r$ Y7 _6 ^9 c/ f
  73. char *dmabufsrc1 = NULL;- I6 V- ~. A8 s. U, m) Y
  74. char *dmabufsrc2 = NULL;
    9 T& D# [# ?3 _/ X& s: w/ L3 W
  75. char *dmabufdest1 = NULL;" O% K5 Y, f3 ~, e+ Y& g8 P9 z; F
  76. char *dmabufdest2 = NULL;
    + B: A6 [; u% ^$ F& ]

  77. 4 k$ ]5 ^5 i( l1 m& ]4 D
  78. static int acnt = 512;1 w& n0 Q3 u* i( K; F- e$ I, ?
  79. static int bcnt = 8;
    4 k& I& j; B  m) R4 O
  80. static int ccnt = 8;
    " E& r) D2 l6 h3 {! _' H
  81. 5 Y& [5 n6 ]0 v0 O
  82. module_param(acnt, int, S_IRUGO);# e& |1 o( L) a# O
  83. module_param(bcnt, int, S_IRUGO);; n: `( X, \+ A" g* ^4 R+ r: z
  84. module_param(ccnt, int, S_IRUGO);
复制代码

  K6 t; ]9 P; a4 _& \  Q3 ?6 r! P& C9 w8 o& ?1 I; s& Z) S; U
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
  O- `! n' ^9 Iarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 o0 Y( a9 M* }" u     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
  L  c$ R% X8 B- O& j
8 n: J/ Z- c6 ?8 e" a" I! P* g5 J- p
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-21 17:54 , Processed in 0.039345 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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