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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 x* q# P6 R$ o4 C( [& G
  1. [code]EDMA sample test application% |1 Q% _$ p$ [$ P, {$ ^
  2. /*
    7 `* @$ f8 _  k" A2 D4 y
  3. * edma_test.c
    ! `7 {8 K! s0 b  O; C, c
  4. *- X! a5 }! F8 f* h' \
  5. * brief  EDMA3 Test Application
    & n% f3 Y8 a: C# u2 w0 d# e; V
  6. *
    + N8 d- L; s6 I$ P) y) i
  7. *   This file contains EDMA3 Test code./ y8 c0 R! L* O6 E$ b) ^
  8. *
    8 y( u! Y6 s7 A$ b. r
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. g* L$ I0 X6 L
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    : K& ~5 l! `. u3 E
  11. *         TO CHANGE.
    - P( g3 q. y2 a5 x: n! Z1 \# l
  12. *
    8 C: U1 v% O" u5 [1 y; w
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    2 \, C6 ~# w* }( v, |- Y$ e% X/ H
  14. *
    7 a% R3 D2 [) D4 l
  15. * This program is free software; you can redistribute it and/or4 B0 Z" b& B% I. Q' ?2 d- _
  16. * modify it under the terms of the GNU General Public License as5 Y, ?& n% b& }( b' Y; R% O
  17. * published by the Free Software Foundation version 2.
    / _4 s* f) g# p5 M, [
  18. *
    . ]% f/ D: S2 p6 S% z1 k
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ q/ E7 F3 S  U
  20. * kind, whether express or implied; without even the implied warranty& e5 g# r4 b( R' S' w* @
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the3 p: c6 d' |6 q! o0 F' y$ d6 g0 T
  22. * GNU General Public License for more details.$ a6 z9 z6 k; F. S# X
  23. */* F: m/ `. B8 N; z% b1 H' R6 _, b
  24. , W; l% ~  `8 M8 L( l+ h
  25. #include <linux/module.h>
    # P- q9 x& [, ^% `8 ^7 Y$ c
  26. #include <linux/init.h>
    9 ]! S" X* l; g
  27. #include <linux/errno.h>
    0 W: f9 \9 ?" s0 a
  28. #include <linux/types.h># k, C% Z7 P0 }; Y& f5 Z+ u# ]5 e* E' y
  29. #include <linux/interrupt.h>
    - ?- ]2 O/ V# `$ I2 u
  30. #include <asm/io.h>
    . n- y+ Y% ~/ f/ r
  31. #include <linux/moduleparam.h>
    % M$ S$ u2 ^' J( n; f3 l  k" w
  32. #include <linux/sysctl.h>
    6 B) q' e; d4 \+ B
  33. #include <linux/mm.h>
    ' t& V! e% C5 s5 W1 j
  34. #include <linux/dma-mapping.h>
    2 P' D5 f5 I) m% u" a$ C3 f
  35. # [) h6 _; m# f& i, A2 Y/ Z
  36. #include <mach/memory.h>
    % o6 ^# j1 V) o% H; A* A
  37. #include <mach/hardware.h>, ^0 ]' }. r* o
  38. #include <mach/irqs.h>
    $ q' A1 c# a0 {. U  k
  39. #include <asm/hardware/edma.h>! d# h' L" f+ v3 g  u
  40. : j) ~/ d% A+ K1 ^
  41. #undef EDMA3_DEBUG
      u. o7 a( H9 Y* z6 ^; j
  42. /*#define EDMA3_DEBUG*/; F  K4 E. {7 l3 {

  43. & D' y- h/ C. x2 K
  44. #ifdef EDMA3_DEBUG8 Z$ g, x) |+ h0 B) O; q7 W
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 g7 s' ?- Q" L( H& I9 s" Z. v
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    1 ^5 f% V2 i: @' F. B
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 I) `- E2 k, Z9 |
  48. #else
    ) Y3 D+ T  P2 y3 L; F( l6 D  B
  49. #define DMA_PRINTK( x... )
    : l% j- B' G* ]: L! Z4 y& u
  50. #define DMA_FN_IN7 n0 ^+ P4 s/ v6 j- X" L
  51. #define DMA_FN_OUT
    4 l2 y, s7 V& G# m5 y: ^5 ^( N
  52. #endif" H8 ~, [  A7 w  ^

  53. * v. z6 ?" W8 x& j& k7 B
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    9 H: p3 R' g: }3 {7 f" A
  55. #define STATIC_SHIFT                3
    3 X5 G9 _5 C1 ^- s
  56. #define TCINTEN_SHIFT               20% W: b: J/ ?! R  Y; S6 v% N
  57. #define ITCINTEN_SHIFT              21; Z: C- J/ A8 i" N9 z) t$ B7 z0 m
  58. #define TCCHEN_SHIFT                22
    , {# C0 K( L- w9 v1 c
  59. #define ITCCHEN_SHIFT               238 `$ _% a: L- T( s5 o' I

  60. 1 r5 J' Y* Q3 ?' e+ z$ X2 p4 u
  61. static volatile int irqraised1 = 0;9 H2 x7 z4 }2 B# z0 L1 O
  62. static volatile int irqraised2 = 0;
    2 x9 q8 ?& V) t5 O$ ?' ]

  63. 8 }& J" F& r' \' y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 Z9 K, u# b/ R& q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# ~; q- y. m! |! }% v- m+ M' g
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 y# S7 u+ w2 L* v

  67. ' R- K# s, Q2 c+ W# C3 K/ Q
  68. dma_addr_t dmaphyssrc1 = 0;
    & }' l4 v1 ^0 c0 I. n! k. g
  69. dma_addr_t dmaphyssrc2 = 0;$ v0 b8 F$ b1 c- f) Y
  70. dma_addr_t dmaphysdest1 = 0;& a3 P9 T5 k9 s! \
  71. dma_addr_t dmaphysdest2 = 0;1 S; X' X2 ~$ c0 U$ [, }. g
  72.   T% N- e9 b# K2 u$ u
  73. char *dmabufsrc1 = NULL;: n5 o2 v! }* `; x) L
  74. char *dmabufsrc2 = NULL;& w$ q& z  w4 n& G! f( P. W
  75. char *dmabufdest1 = NULL;( Z1 H. r8 y" x+ @. T  R9 S
  76. char *dmabufdest2 = NULL;
    0 ^5 |3 K" x5 d; ]1 }
  77. " X& i0 G+ k- d6 Z/ Z* S& ]! N# p+ a  p
  78. static int acnt = 512;
    - j/ p( u) o, r: B: I) C
  79. static int bcnt = 8;) x2 S. W& x, l4 ?
  80. static int ccnt = 8;
    4 P" |3 z% }4 |
  81. 4 p: D3 a& E  i) G5 B
  82. module_param(acnt, int, S_IRUGO);1 s* R& h3 [$ W  |/ x5 s
  83. module_param(bcnt, int, S_IRUGO);
      Z4 W% H* \+ \- d& \- j) L
  84. module_param(ccnt, int, S_IRUGO);
复制代码

' f0 A+ O! _. a8 w$ ?1 f
  h( W. j% r' Z, R0 Z      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 s( B' O/ T1 h; parm-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% q% v1 v: w- k' i) N6 h     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# W1 F/ P& {$ {. p0 ?

  d( s& d, A  c1 W8 P) @( G( L# E5 _8 `. l. S9 N
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-2 19:53 , Processed in 0.041548 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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