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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 T) i- C6 X+ }& {7 `. ^
  1. [code]EDMA sample test application
    # m+ C# f2 M: S3 m! G: v2 X: t4 w
  2. /*  H- H8 y  Q: Y; N. i- l; f
  3. * edma_test.c
    7 s8 l( @- l9 l+ d7 P! s
  4. *
    8 z% H$ H6 Y, \' w/ }' k0 X0 J
  5. * brief  EDMA3 Test Application
    / Q6 \  U- f5 v. r+ s& P
  6. *, g$ B0 Z; E  ~1 S: b9 p- r2 J- c
  7. *   This file contains EDMA3 Test code.
    4 x, m2 o5 y- W) o; b6 R- t
  8. *
    8 [3 x; g4 W: m( L0 r2 M
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ @& ~0 H. u- @- X! I
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& ~% E3 @% G9 h
  11. *         TO CHANGE.
    , F1 @) \2 e- [8 d2 c
  12. *6 ~6 d& ~  ?# ~# X$ ]2 U
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* v: g! R: a/ ^; M- G2 j& Q
  14. *% U# |% z' l% D9 m! w# k; _
  15. * This program is free software; you can redistribute it and/or& F4 Q- k/ f, v6 w" @( k1 ~- \" X
  16. * modify it under the terms of the GNU General Public License as
      r. _( R0 m$ |6 `* l6 ~! }
  17. * published by the Free Software Foundation version 2.
    # b8 C. X9 u& {5 a  x
  18. *3 c, _  H' K" ?$ h# _  {; i
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    3 p  G1 }. O$ A9 W1 O  z" t
  20. * kind, whether express or implied; without even the implied warranty. S3 ]5 g0 T& K; C& U- ]' a
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the2 @# |6 W1 V; c
  22. * GNU General Public License for more details.
    & {- J& E6 S9 G1 V2 U
  23. */9 R& L# H: r1 q

  24. / t9 c! |0 }/ i5 P0 I
  25. #include <linux/module.h>
    , H  _0 ]; I) Z' s- r
  26. #include <linux/init.h># g* I5 z- R# v! w+ w- ]3 ?
  27. #include <linux/errno.h>
    & Y9 U9 ]! T' a  p/ n8 o7 {$ G
  28. #include <linux/types.h>- ~6 l# q* z0 f
  29. #include <linux/interrupt.h>6 f% N2 p7 T( s; Z5 |6 J; {  r2 k! W8 H
  30. #include <asm/io.h>
    5 l- a% V2 ]% \* l' Q0 B5 }/ X
  31. #include <linux/moduleparam.h>& f0 l- u* ]2 `8 n, ^% w
  32. #include <linux/sysctl.h>! m* Q2 b/ i0 j) Q
  33. #include <linux/mm.h>
    ' ?& G' P8 h- G, l# _7 q
  34. #include <linux/dma-mapping.h>
    - @" d& e% m( J5 Y7 ^
  35. 3 p9 k1 u+ `7 \" @
  36. #include <mach/memory.h>
    3 D4 \0 N7 S5 X/ v" z' b3 a! E
  37. #include <mach/hardware.h>
    - r( R4 S8 ~& _# V
  38. #include <mach/irqs.h>
    % `  _% \$ `/ n1 f2 b$ [
  39. #include <asm/hardware/edma.h>; i! ]% e! r( G+ A
  40. 6 u' e4 K9 h- P6 ^. N7 S
  41. #undef EDMA3_DEBUG$ w0 ?- I4 }" W/ m) }
  42. /*#define EDMA3_DEBUG*/. X; A! g. [9 Q1 \- @, b
  43. 4 L+ h1 x- N5 S0 B3 k7 Y
  44. #ifdef EDMA3_DEBUG# X: E- ?# l& ?0 V9 p1 }
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    9 d( A6 q+ W* B; X  {
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ! E$ R# U5 m. f2 p2 D; }" Y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    & k3 _- s( u! L: W+ ^0 k
  48. #else( ^. s/ b1 ^9 l* t8 V! H% M
  49. #define DMA_PRINTK( x... )
    ! X# p0 e+ m( o. T4 N
  50. #define DMA_FN_IN
    ' X+ T7 q, }/ Q# S( f
  51. #define DMA_FN_OUT! L8 p& `. {8 ?. g8 y1 L% E6 \( I6 `
  52. #endif3 l8 K; D& c+ z! r: g  |6 R

  53. / ~4 Z% V& W; U1 p. [- s
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)6 e% n% ^$ }" I+ j* l
  55. #define STATIC_SHIFT                3
    4 `: D" h0 n: g$ X
  56. #define TCINTEN_SHIFT               20  C! }! U5 v- J# t- {
  57. #define ITCINTEN_SHIFT              21
    ' Y0 I: T5 w8 Q: X4 p
  58. #define TCCHEN_SHIFT                22( h+ U/ L( U( G# d+ j
  59. #define ITCCHEN_SHIFT               23
    4 w0 d/ Z- Z) ~( s& F. ]( }" V

  60. , Z1 b: @9 Z6 X# O, D) W
  61. static volatile int irqraised1 = 0;# l! d5 q+ @# {- V/ i
  62. static volatile int irqraised2 = 0;' I' J( Z" N# ^9 f( Y4 c8 Z0 E

  63. ' S% z& H; ~: I1 T" b; T& E" n+ e+ w
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . x# U; I( s/ l
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 q* E8 E8 U* o- a- |3 @6 v; T" H
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; m6 D* W) s6 M$ R4 [
  67. : ~: d% f! i. U( ^' w: b* n5 W
  68. dma_addr_t dmaphyssrc1 = 0;- u! [9 z9 V2 b! f8 v
  69. dma_addr_t dmaphyssrc2 = 0;# d) s  T, s" \# g" N# `& R
  70. dma_addr_t dmaphysdest1 = 0;. S. f4 q' ~! z1 ]# j3 }# @- p1 I
  71. dma_addr_t dmaphysdest2 = 0;1 T9 [' v; `7 m$ h( ~+ q+ z) a

  72. , d; h1 {. F1 M
  73. char *dmabufsrc1 = NULL;
    # M3 m7 n5 Z4 ~5 H
  74. char *dmabufsrc2 = NULL;
    ' M, D. y; q8 j: y" i- y: S
  75. char *dmabufdest1 = NULL;* `# l6 D/ B7 x0 f& E
  76. char *dmabufdest2 = NULL;- ?$ X7 ~6 f9 C" _  p

  77. 9 @5 [4 [9 _; N7 p  `5 M
  78. static int acnt = 512;
    ) U6 T" z! v- R" e
  79. static int bcnt = 8;1 k8 {& j0 O# s$ [3 O$ B" g
  80. static int ccnt = 8;
    / w) ]' X& b8 s5 I7 P0 T. o

  81. ; Y$ H; E4 u0 h) |) Q2 m( g
  82. module_param(acnt, int, S_IRUGO);
    6 ^8 d4 z! f3 [2 q6 s
  83. module_param(bcnt, int, S_IRUGO);
    # F( D# S" F, t+ L( Q6 B2 v
  84. module_param(ccnt, int, S_IRUGO);
复制代码
3 u! N9 L# \, b7 X9 a( E6 @
- }4 p: p3 C; W4 p" z+ i7 q2 ^! O
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 J1 U$ N$ y6 D2 S2 X8 F% [; H  y2 Z- warm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& x3 V8 {7 g2 i1 v2 J" d3 K
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! L, C: r# }1 B) t! ?' `7 X% M. V0 T1 K/ C0 e4 S1 g
+ c; c6 d* X, k+ A9 ~. N4 X+ {: Q! F
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-6-23 14:54 , Processed in 0.055595 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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