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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# X* o# v2 H0 }4 p1 I9 Z' L# R# @  F
  1. [code]EDMA sample test application5 {! S4 W' _5 E$ e2 X# v' V) {8 |
  2. /*% z  _# d3 g& F3 ~- o" J
  3. * edma_test.c' X+ ?5 C( P# d8 s  y7 Q+ j( G
  4. *7 c1 }0 J% C+ M( E4 I
  5. * brief  EDMA3 Test Application! W: I4 n/ I$ \. I. y" l4 K
  6. *, [  G3 e! @, P  B$ H7 @& w) w5 Y
  7. *   This file contains EDMA3 Test code.! G& b2 @! Z: e2 P& \; s4 B: g
  8. *
    5 `. }: Z; t+ A
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    % }7 V( F4 z3 K6 `+ i
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    1 @% _: U6 H+ o' p3 [% _
  11. *         TO CHANGE.5 G0 R% r  M% H* \
  12. *" W3 y: B2 w8 W
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    8 s9 D' g( _+ h  o: w6 b" X) o
  14. *) K3 h( ?" C# i+ t- s+ ]) H
  15. * This program is free software; you can redistribute it and/or3 b) M$ d  X* l& n- p
  16. * modify it under the terms of the GNU General Public License as
    " s* o/ c* P+ A, d" A
  17. * published by the Free Software Foundation version 2., ^+ l9 A* Z# O  g( p+ @% I* ?
  18. *
    # J: `' m8 B! [' B$ c
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    5 N8 `3 P8 {9 Q3 Y
  20. * kind, whether express or implied; without even the implied warranty5 m. [6 Y1 x7 g' @8 t% P0 N* P
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the6 d1 o$ t. B* u- [) Z; }
  22. * GNU General Public License for more details.; W4 E4 `) J8 w, G) u' ?; k% Q3 G  d
  23. */
    8 Z: z0 p$ C5 `8 a

  24. : a  W- d# j3 W7 E, ]
  25. #include <linux/module.h>
    , f5 L6 u. M: l/ S. v$ }5 P
  26. #include <linux/init.h>; j) ]- c8 t* ~, O; _
  27. #include <linux/errno.h>( [, f- a* L! X: N9 ?7 b
  28. #include <linux/types.h>
    , }1 b: L: E5 y4 @) H
  29. #include <linux/interrupt.h>
    % l/ e& n5 c7 W  k% ^* a: X+ ?
  30. #include <asm/io.h>% F' x; H; P, l! ~8 h
  31. #include <linux/moduleparam.h>
    ) X+ {& C$ |9 S5 h$ [# d# i# A# Q
  32. #include <linux/sysctl.h>
    - z/ f& H: z+ ^/ q4 ]( Z
  33. #include <linux/mm.h>! |/ |; l1 `1 W2 q  T7 S8 T
  34. #include <linux/dma-mapping.h>
    ) B. P' ?' {( S! S
  35.   f4 Y& R) W- K0 Q
  36. #include <mach/memory.h>" @: ^( l: K8 y8 s- e$ m
  37. #include <mach/hardware.h>
    7 T& v; y- \3 B
  38. #include <mach/irqs.h>  z# V2 y, z# {0 f! y
  39. #include <asm/hardware/edma.h>8 K( \' R+ q8 I6 F% k7 t
  40. 2 q- m; w/ [! x1 v- K( Z
  41. #undef EDMA3_DEBUG
    6 ~, A) C& w* e0 S
  42. /*#define EDMA3_DEBUG*/4 B, d" }! a# y1 R/ i

  43. * I4 B. y5 T& {7 R% L' P% I
  44. #ifdef EDMA3_DEBUG& L  u2 ^  E: T! v5 e
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 p/ M, C$ I+ F) ^! j
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). ^: @3 p! s$ y' ?3 m
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    8 B) M( ^2 i  n4 C8 }
  48. #else% ]- R4 D$ B& C* b1 z- t
  49. #define DMA_PRINTK( x... ). I9 s7 S& s* N
  50. #define DMA_FN_IN: C: [3 N5 J. |% O) X
  51. #define DMA_FN_OUT) A* k8 k6 x. Z2 w, u+ w
  52. #endif+ Y, s5 x/ l- Z3 o' K

  53. ! {0 J+ I* @6 W, K7 D( k5 A, r1 C
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ; M; A4 H: n) K4 y2 d: B/ V
  55. #define STATIC_SHIFT                3
    1 G8 Z4 }  l: E. ]$ p3 A1 T5 Z8 X
  56. #define TCINTEN_SHIFT               20
    5 o9 y9 ^" Z" O3 @
  57. #define ITCINTEN_SHIFT              21: F# T. N6 {- }0 |
  58. #define TCCHEN_SHIFT                22; M3 B8 I2 w8 e
  59. #define ITCCHEN_SHIFT               23, e- l4 l, T% D9 [
  60. 7 ]1 S2 N% n5 I0 L6 b% g: i* m+ b2 Z
  61. static volatile int irqraised1 = 0;
    ! @5 u& ]. c0 X7 ]6 E. ^6 I* p4 N
  62. static volatile int irqraised2 = 0;
    - y8 l" [  N5 `8 M" ]8 ?

  63. - q7 j3 B/ g; G' v8 p) A; z* C" w
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) r/ c7 d( {( P" O: Z; y" P
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- b2 S  e1 D( e5 U+ N. S
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 ?5 A4 m0 c' }
  67. 2 N1 X" N6 \! |. x
  68. dma_addr_t dmaphyssrc1 = 0;* ~; Q+ N* |. l' C% H* ?
  69. dma_addr_t dmaphyssrc2 = 0;; e) ]: J) F' d: C! E9 B/ i$ q
  70. dma_addr_t dmaphysdest1 = 0;
    + j2 w6 v  |6 T+ b, Y, J% r
  71. dma_addr_t dmaphysdest2 = 0;
    ; J- X7 _$ ^, j  b

  72. $ E5 R; o& k  z, [1 h: u
  73. char *dmabufsrc1 = NULL;3 ^4 B! Z/ [+ ?
  74. char *dmabufsrc2 = NULL;
    * L# F& J" x/ m; R* `5 H; t
  75. char *dmabufdest1 = NULL;
    & x& J" k, h$ E! U6 K$ B  k: y0 q
  76. char *dmabufdest2 = NULL;
    , R9 x$ m- _. a; E) s* ], T: k: a" n
  77. # m/ Z. d# _( C( B  h9 n. E
  78. static int acnt = 512;1 v0 ?" x* {$ a" K8 u. q
  79. static int bcnt = 8;: o, j6 n. T6 F3 G! H; q
  80. static int ccnt = 8;
    / {8 v$ U; `" k0 H  G, |
  81. 5 l1 ^4 z/ ~1 {) W- e5 b& g
  82. module_param(acnt, int, S_IRUGO);
    8 k0 E! ]% {9 ?5 i7 Z1 P
  83. module_param(bcnt, int, S_IRUGO);: `3 }( Y2 D1 L+ e; }1 d
  84. module_param(ccnt, int, S_IRUGO);
复制代码

/ ?/ {. V7 A  x* _& u. B" ^0 i0 M; O% {3 I$ K2 y% l  V- M, {
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& T* w9 z- w1 o5 Y: C
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ n+ M9 B& A& E% ]     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ s/ c2 A( Q9 c; ~( L7 o* q) m; ?- ~" m5 v( x" P! p5 U
  g# M  {) w! a) @% p* V+ C& L5 R; ?
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-3 20:49 , Processed in 0.038496 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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