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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 o8 I$ A; y6 W4 n
  1. [code]EDMA sample test application/ w; [0 P+ E7 [8 U
  2. /*
    8 w4 q3 t- Q# ]  ~2 W+ {5 z  d
  3. * edma_test.c- ~2 C' v) y) r2 I
  4. */ ], t0 m8 g1 Q8 {+ x8 y4 d
  5. * brief  EDMA3 Test Application
    " B: J5 x, X, Y7 x
  6. *; v8 D1 Y* `5 w/ Q$ H% C: ?
  7. *   This file contains EDMA3 Test code.0 c  p! X# x. |) L  ]7 e+ i4 I6 W
  8. *
    ; D1 `+ B0 p+ j0 M1 }& ^8 M
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ p2 r+ Q, o4 f, k! i/ A5 p7 K
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    8 d) U/ k. L  d8 r( D/ R" i
  11. *         TO CHANGE.
    * e+ w$ m: J! v
  12. *
    / e4 t/ w$ s  t8 Y" y
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 j0 E& U+ K% z  z  E2 O* u
  14. *: L. Y4 a6 b7 s7 g9 L0 k( g; M
  15. * This program is free software; you can redistribute it and/or9 ~) W+ V8 L5 E/ Y$ x! |
  16. * modify it under the terms of the GNU General Public License as/ ]7 h+ k* f3 k. P, U
  17. * published by the Free Software Foundation version 2.- B: d% P) c  w+ b
  18. *! f( b% x  r4 P$ E0 [
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ! P2 @+ ?7 d8 s+ d8 y3 l
  20. * kind, whether express or implied; without even the implied warranty
    ! ~" W" |/ _9 e' m" |) G, T
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    4 G5 _) w. h6 G$ ]' ?# b
  22. * GNU General Public License for more details." I+ h* V$ Z0 Z$ F
  23. */. X! r  F. ]; b+ C5 S4 u$ X

  24. - u+ @& Y+ m1 v7 E7 y* y# p
  25. #include <linux/module.h>- k. A' q2 s/ ^/ B8 s
  26. #include <linux/init.h>
    , G8 B# v2 d6 L6 P# e: H
  27. #include <linux/errno.h>1 r: l+ y9 p% G% V2 G8 R7 L
  28. #include <linux/types.h>
    0 Y! q- d1 j1 k1 J8 n
  29. #include <linux/interrupt.h>" X! |) D2 a1 J. T7 a% p
  30. #include <asm/io.h>
    ; m$ E+ R, a. s4 z6 m
  31. #include <linux/moduleparam.h>
    " ?. f9 A% `  x; m1 `9 ~
  32. #include <linux/sysctl.h>6 _  Y! V- K: c3 v! h
  33. #include <linux/mm.h>
    5 U. G, t+ C, b6 d( z3 D
  34. #include <linux/dma-mapping.h>
    & p. t' @$ ?2 c
  35. 3 j3 j0 D- E! g& @6 }
  36. #include <mach/memory.h>
    & h% q9 d, F' G- G3 h
  37. #include <mach/hardware.h>+ B/ I6 e3 W4 M+ i& ]" E: U# `
  38. #include <mach/irqs.h>
    1 K# A/ ]( |5 f- O1 m4 _- A
  39. #include <asm/hardware/edma.h>2 O  U. ~/ N0 m5 ^
  40. 6 B) H# U% L3 q8 S
  41. #undef EDMA3_DEBUG
    : L" M+ t; ^) U$ B
  42. /*#define EDMA3_DEBUG*/2 K; {. h5 i  u; W
  43. . V+ }& U4 q7 {* e0 f
  44. #ifdef EDMA3_DEBUG
    + H* e$ d1 x! M) W3 l" j
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    % y+ E$ q+ d( h! K0 O
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    $ W  S  S6 r0 L8 E# J1 o) ?4 K4 |. w
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); B3 K# Q5 A, z' C) _0 _0 D
  48. #else
    0 s3 g7 R4 Q. d" d) i! j* {# ^7 w
  49. #define DMA_PRINTK( x... )
    1 T0 R  Q: b! U6 Y
  50. #define DMA_FN_IN2 W# V1 y1 I8 G# ~
  51. #define DMA_FN_OUT
    - t: ^! b9 w, B/ u% o$ P& m. s* e: r
  52. #endif: N5 P2 s! F/ Z+ I1 W

  53. - Z1 u, S# z" G! Q" |: h; a) _! z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)$ Q$ T$ H9 r  R  T0 F& i5 I! \
  55. #define STATIC_SHIFT                3+ G$ \* O7 L7 K  T! v/ N
  56. #define TCINTEN_SHIFT               20
    ) ^. s5 I5 \/ g' S3 n- y( R
  57. #define ITCINTEN_SHIFT              21- p/ d$ D0 T1 y1 \/ S! O: z% `8 N0 D
  58. #define TCCHEN_SHIFT                22+ u- \- r, E8 W( z( |# s
  59. #define ITCCHEN_SHIFT               23, h; }) V# W# M5 L9 t
  60.   Z5 G  D8 U# R
  61. static volatile int irqraised1 = 0;
    3 O, J3 Z6 j9 J" V% X4 f
  62. static volatile int irqraised2 = 0;+ v; j0 f2 [, O* M9 w+ n% y5 Z% |

  63. 6 q* B5 s/ V# `( r4 }/ R6 z3 H
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 i$ A7 w. x. L4 M0 g+ e2 d1 @! Y0 E
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 Q1 g/ H. T% J; [
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( B9 S8 n* a$ b7 B0 W4 o
  67. 2 Q& P- s& g* u2 h! ~
  68. dma_addr_t dmaphyssrc1 = 0;
    ' }, h  ^2 t+ h# g' X0 G9 q$ G# q
  69. dma_addr_t dmaphyssrc2 = 0;
    2 ?5 e6 @$ l. Q" ]
  70. dma_addr_t dmaphysdest1 = 0;+ l3 h* k, D/ y
  71. dma_addr_t dmaphysdest2 = 0;
    ) q8 v0 J3 _! G3 ~2 a5 U

  72. + D. v% ^4 Z9 L( Q, J5 g' N: _
  73. char *dmabufsrc1 = NULL;) p5 B" [) F& f7 E
  74. char *dmabufsrc2 = NULL;
      y7 y# }! x. m! l
  75. char *dmabufdest1 = NULL;! _! h% {! z* F! {1 ~9 ?# c
  76. char *dmabufdest2 = NULL;
    4 K- ^+ P, X" x$ h5 ~4 i
  77. * W  J" v+ @+ g% [4 v) W8 U
  78. static int acnt = 512;5 W" I% J" \& L
  79. static int bcnt = 8;0 |7 s: ~( F6 j" ?
  80. static int ccnt = 8;7 b. G+ k+ T$ s
  81. % v1 @+ H4 G1 a
  82. module_param(acnt, int, S_IRUGO);
    " h8 ^5 c6 I1 x' J3 O
  83. module_param(bcnt, int, S_IRUGO);
    4 z$ u# `: v& C
  84. module_param(ccnt, int, S_IRUGO);
复制代码

$ s0 E" c  q: ]5 A9 ]$ |1 G
/ D4 i1 f* O- V* H1 n) ?8 h      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ _. J" P) A8 B5 M- `
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; c$ q4 e$ H( ]6 K1 d3 W% {' U     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' w6 N0 ?1 N. V
  r3 S& b: Z% N, R
, J9 O0 U2 m" p# |
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-26 03:39 , Processed in 0.044248 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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