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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 [; Q2 ~, \0 y) G7 J* a
  1. [code]EDMA sample test application4 X0 a. n( p8 u
  2. /*2 ]3 W" c  X0 i" S7 `2 p  {" Y* `
  3. * edma_test.c" \' @3 v. ~- X; _2 ]
  4. *
    ; ^/ Q; C4 u6 A  i# m
  5. * brief  EDMA3 Test Application6 T8 M6 J6 y/ q2 X
  6. *( U: {; Y5 O5 v+ {( q: Q* G$ S! Q
  7. *   This file contains EDMA3 Test code.  W( a% p. ^) g) A: M5 i
  8. *
    2 h* B/ O+ ]. F$ {8 M1 P
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE  v4 [( G: O. @( r/ T& Y& B
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! c& D# \+ H& `
  11. *         TO CHANGE.
    * a/ T8 N+ y( z( D) _
  12. *% Y) N& Q1 o6 ^8 \9 `0 N9 Z; C" }
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    - h& E. d9 x% A; M' L3 t. E, w3 h
  14. *
    , q, }* P2 a9 r! z3 a- F
  15. * This program is free software; you can redistribute it and/or) Z6 K  }  h) ^* L9 x. ]3 ^6 f
  16. * modify it under the terms of the GNU General Public License as
    0 @! G; N# |+ L
  17. * published by the Free Software Foundation version 2.2 i) Z- X- l' Q" k* [) O. J% L
  18. *
    $ |# T/ b, [8 \: {) n
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    . T# E. e5 c0 P$ H9 c( r8 C  Z
  20. * kind, whether express or implied; without even the implied warranty- c! S0 ?- i  C- q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the! Z9 I+ [* r' W% d/ K( f6 w
  22. * GNU General Public License for more details.
    0 \8 k. p! z. [5 |5 s
  23. */# b, p/ k" x; N% |4 n

  24. . J3 G$ O0 Y- q  Y& T7 \
  25. #include <linux/module.h>
    & Y: b9 K% K/ v6 u! l- G
  26. #include <linux/init.h>
    4 C7 l+ r$ |( B$ G* i
  27. #include <linux/errno.h>4 c3 \9 {4 ]: ^9 I, |6 a7 s: K
  28. #include <linux/types.h>! v  P2 ]$ j) _" |" J
  29. #include <linux/interrupt.h>$ A! g  c  `; s! U9 t3 W
  30. #include <asm/io.h>
    ! A! |4 Z6 o$ g# Y
  31. #include <linux/moduleparam.h>& g0 S( N+ I1 O( {, q# ]7 t
  32. #include <linux/sysctl.h>  r/ D) o- t4 b9 R. L3 V, Q6 R; v
  33. #include <linux/mm.h>: y% C6 T3 ]/ q# ?. m6 q
  34. #include <linux/dma-mapping.h>" h/ o% B# [7 Q% }! A
  35. / e& V7 ]" i8 X; f( A  c. v" L
  36. #include <mach/memory.h>
    - A6 K+ d) g% ]: R7 ~% o
  37. #include <mach/hardware.h>
    7 s. B7 i+ E/ g7 n0 ~
  38. #include <mach/irqs.h>' L  M/ v% z! c; b! c# d+ U
  39. #include <asm/hardware/edma.h>
    % I  v+ ?! T! x

  40. , p: y! ~5 I, |
  41. #undef EDMA3_DEBUG
    6 I" G9 [+ C9 ^+ C1 w) L
  42. /*#define EDMA3_DEBUG*/( R3 v% W& e& c  t

  43. , g& P+ I; j. |( Q! J# t
  44. #ifdef EDMA3_DEBUG
    * x& ?) a8 N( }2 }! c9 ?
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# f7 Q  Y& j# r7 O1 [# Y3 f
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    . v) _3 _/ r$ x8 G5 c' Y& k
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' t8 f* o% D  y0 B; T7 S# V0 |
  48. #else
    & p- K* t% ]$ Z: E5 U. X4 I
  49. #define DMA_PRINTK( x... )+ U9 d: }2 x/ w9 l3 D2 w
  50. #define DMA_FN_IN
    - L3 `  v, w- x9 A$ F* e( p- M; R
  51. #define DMA_FN_OUT+ N# ]# z% |+ y9 \1 w7 x
  52. #endif+ r; Y" A1 |# d9 p% E0 j
  53. 2 W1 U. T; H8 ]1 O
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)( g8 L& g: B. e9 C
  55. #define STATIC_SHIFT                3
    $ i! G0 K$ b0 T4 Q* I6 u
  56. #define TCINTEN_SHIFT               206 ~8 z4 |% d2 k8 N
  57. #define ITCINTEN_SHIFT              21
    9 C; c6 s7 m6 w
  58. #define TCCHEN_SHIFT                22' f8 j/ f, C/ V# ^8 X/ {; K
  59. #define ITCCHEN_SHIFT               231 v* h& n& N3 K" m' M% E6 p

  60. : ~3 J2 |0 g, l" Y
  61. static volatile int irqraised1 = 0;3 {$ V# \: p5 J% ~0 _- z
  62. static volatile int irqraised2 = 0;/ \: I0 V: ^/ F9 x
  63. ' i  G# {2 g5 y, \6 D
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 r, v3 u, _, s8 ?- e* }6 W/ \
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / k. X3 t" v0 e
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " C8 o6 t. g+ Y, w' o

  67. " n( f- @3 {5 ]/ H
  68. dma_addr_t dmaphyssrc1 = 0;8 p+ R0 X& o- a; I9 N0 Y
  69. dma_addr_t dmaphyssrc2 = 0;7 s1 `7 T- Q  Z+ K# r
  70. dma_addr_t dmaphysdest1 = 0;' K, k# S9 m! o6 i1 @) |1 j
  71. dma_addr_t dmaphysdest2 = 0;9 m! `% \  w  n5 }. u3 L. ]
  72. 5 ?4 g  H/ y( O  |% k( x
  73. char *dmabufsrc1 = NULL;, A! N6 j1 S" P4 V
  74. char *dmabufsrc2 = NULL;
    8 U# I& y6 V' j( W
  75. char *dmabufdest1 = NULL;
    # T# n- [1 n7 E; J* P1 D
  76. char *dmabufdest2 = NULL;% N" L2 U% X0 K

  77.   c# z1 W1 _9 Y0 s
  78. static int acnt = 512;
    . ^* i1 d0 U7 S0 |3 p7 V* {: K# e
  79. static int bcnt = 8;! U+ o- F! R4 h# m: }
  80. static int ccnt = 8;9 V3 A* {- ]7 e, F
  81. : x0 a3 y0 n* Z" Y& r' N- C  ~9 h
  82. module_param(acnt, int, S_IRUGO);
    3 G  l+ C0 q8 J( y4 h9 P
  83. module_param(bcnt, int, S_IRUGO);2 Z9 H2 b9 @1 Y
  84. module_param(ccnt, int, S_IRUGO);
复制代码

& `) ]9 D! A2 @) O, ]  g8 g
5 C) B6 Y. p# m0 K& J1 E+ b$ C      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( X- d+ Q/ L1 k* H7 F5 [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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: y( o' `6 \; s3 d) i
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# G9 C$ M( h9 `8 U/ B$ c! ]3 W5 E( b+ q, T8 m* H" O
: J3 l; }9 U8 i+ ?# X
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-4 22:59 , Processed in 0.038151 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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