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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # z  v7 z  e7 Y. m5 c0 ^* o) z
  1. [code]EDMA sample test application! f7 U, M! u8 S
  2. /*' ]$ W  V  u% @* o9 i8 M/ v
  3. * edma_test.c$ f4 s7 V; U3 x+ n2 _* F
  4. *
    : h- n( d" D: i$ f
  5. * brief  EDMA3 Test Application
    6 Z4 Q; |% Y# H# A, h
  6. *' e  `  A/ M" ^: `8 C% a
  7. *   This file contains EDMA3 Test code.1 `& r2 l' Y; k( R) U
  8. *( f! R: `- ?" a# k
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    6 I( c3 R  D+ s6 d9 W. @5 C
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ( L4 U/ `$ b: R% {
  11. *         TO CHANGE.: h3 X; Q: P* g  N4 r, ^
  12. *  k+ e% p- V# m; ]4 n3 W; w1 T; P
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; a: E- p. }1 O. u/ k# K
  14. *2 K4 Z9 @0 d* j* ^9 Q1 Q  f! H
  15. * This program is free software; you can redistribute it and/or9 I' M7 ?' q- V# @9 H# `( y5 W
  16. * modify it under the terms of the GNU General Public License as; E: U5 i  Y$ @; J$ \/ V
  17. * published by the Free Software Foundation version 2.& t; H; {3 o7 h1 z
  18. *
    4 a& A5 N0 }; |: T' y' E' `: P
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 o+ u! d) f# V5 H, _+ ~. g) E
  20. * kind, whether express or implied; without even the implied warranty  V9 H* L' R7 R0 O, [8 b, ?5 Y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ' l5 A) }+ _  s
  22. * GNU General Public License for more details.
    & {  P" R8 e. ?
  23. */7 [9 j* z+ z  X( w9 L) ~

  24. - g" P( D$ e! w0 V
  25. #include <linux/module.h>) P8 Y8 M$ `" C! {# C! `) T1 E! d
  26. #include <linux/init.h>; o; q6 z7 I/ b; ~* z
  27. #include <linux/errno.h>2 \9 f( R3 a) w
  28. #include <linux/types.h>
    5 c! g. N0 U% Y6 r4 V
  29. #include <linux/interrupt.h>
    ! T0 `. |+ F2 c  ~
  30. #include <asm/io.h>
    / \' z5 t. W* y7 b0 @1 m
  31. #include <linux/moduleparam.h>
    0 }1 y) X; q1 W, @" l* i
  32. #include <linux/sysctl.h>  `0 j5 l' W  I7 C) e
  33. #include <linux/mm.h>" p0 `  ]1 b5 G$ W% k/ ]' `6 r! o" q
  34. #include <linux/dma-mapping.h>; q" w8 g, k6 u. }, U/ N

  35. 1 @2 M0 g. V5 @" x2 `
  36. #include <mach/memory.h>
    5 m# y( w  I! U, p
  37. #include <mach/hardware.h>
    2 p+ _" c6 T; w" M/ ?1 E6 _$ x
  38. #include <mach/irqs.h>6 `# F6 j- c2 D* x+ Z
  39. #include <asm/hardware/edma.h>
    2 {. n- g7 c+ `7 n9 Q( V) n; }' t! h

  40. 8 W( r4 N& i  C6 w, g' a0 O) c( G
  41. #undef EDMA3_DEBUG; Q/ a2 G  S& y; q0 V$ x. n& j
  42. /*#define EDMA3_DEBUG*/
    % U# k. @+ q- z9 c

  43. 0 x. Q9 J+ s2 s; R
  44. #ifdef EDMA3_DEBUG
    2 o. @8 f+ N3 d+ Z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    7 P( _: {9 n/ W' ~8 F. @; y  _- Q" {
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    + _! v  Q' @% h& q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    - w4 R+ V5 Y: a
  48. #else
    # k; x( m0 P+ B  [7 Q8 @
  49. #define DMA_PRINTK( x... )* U) B% R4 x- ^
  50. #define DMA_FN_IN, d! W+ p5 h7 C- T& R  M# h
  51. #define DMA_FN_OUT
    2 a) ?1 x1 H! o, \; j' l1 X
  52. #endif
    8 q3 p6 D! V+ }3 V7 k3 D
  53. 9 Y; [) X; e* Z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)1 o& h; ]$ j2 @" K; r& d" S  P& F
  55. #define STATIC_SHIFT                3
    9 s7 T1 N" B: \+ S0 U8 W# z
  56. #define TCINTEN_SHIFT               204 R3 L$ h; X# e! X
  57. #define ITCINTEN_SHIFT              21
    ' V+ X9 r$ u4 @. x" Y1 Z
  58. #define TCCHEN_SHIFT                220 v* o+ V5 M* \/ ~1 ^# u
  59. #define ITCCHEN_SHIFT               235 ?" U& u% j3 s$ I" C

  60. 0 W" {2 x' Z. ~
  61. static volatile int irqraised1 = 0;7 H/ M5 T1 C8 X2 L2 f1 |
  62. static volatile int irqraised2 = 0;* H& \: A, k' F4 k6 V( [1 j- K3 [

  63. 2 i" |( M) k; D  u% ?# A+ z5 C
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * O( Z2 X0 m  Z) t1 x
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( K% g& r" \0 K9 _# v$ E
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - |1 O  r: x. c" F, T# p

  67. : J2 X* m' }8 J9 ^/ \
  68. dma_addr_t dmaphyssrc1 = 0;
    ' w  w* s3 E& m0 [/ T" ?# ~( D" ]1 E
  69. dma_addr_t dmaphyssrc2 = 0;% f" n* Y, `7 @5 u, a' M
  70. dma_addr_t dmaphysdest1 = 0;) m5 z1 [9 D/ W: _5 g
  71. dma_addr_t dmaphysdest2 = 0;5 ^) y4 _1 U; e: R; l% y1 v/ [% G

  72. ; h3 h2 t6 G$ A4 q: _
  73. char *dmabufsrc1 = NULL;
    8 J1 e6 e& g5 q$ v" B
  74. char *dmabufsrc2 = NULL;
    6 N. |4 r8 D2 a9 p" U' V
  75. char *dmabufdest1 = NULL;8 Q. R7 l3 l; W4 D+ G4 \. {
  76. char *dmabufdest2 = NULL;1 c/ e2 ^# A8 j) q  J
  77. . Q/ I, r6 z9 L: i& i4 ^5 ?
  78. static int acnt = 512;+ U0 t9 A+ S0 A5 T9 p
  79. static int bcnt = 8;
    1 S2 t9 C3 \6 z+ K- _5 g
  80. static int ccnt = 8;
    . O7 _% V; X7 j& {+ z7 |( Z4 A

  81. $ C) J  r$ e1 G. T& A
  82. module_param(acnt, int, S_IRUGO);
    , T- |* C) \4 X- K/ c
  83. module_param(bcnt, int, S_IRUGO);
    - s5 Z. }3 g% T( l
  84. module_param(ccnt, int, S_IRUGO);
复制代码

6 P" L/ {+ t; I: v' i3 _) P7 ?' s+ P; e2 N7 r7 U4 f0 H3 @, G
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' S- n, O4 f5 D, M0 m! a' ~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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 _* d4 p1 O: [! l
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" u' Y2 K5 I& g
/ x' C" z3 V- F2 g' J
: D. u1 V; c! ~& ~9 Z( O
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-20 20:36 , Processed in 0.049546 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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