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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , C, r9 n" D. f. a( v5 }
  1. [code]EDMA sample test application
    2 v6 x! c+ S6 l. e1 E4 z
  2. /*2 I! F% Q/ ]+ j- u% ^- d: }6 x
  3. * edma_test.c
    3 ^( W8 l! |$ p; k. n1 X' P
  4. *
    1 \% l+ s6 H2 b5 j. h
  5. * brief  EDMA3 Test Application
    6 q$ j$ W0 W+ F2 ^5 T+ s: D
  6. *
    ' _2 G3 Y6 k9 O* K
  7. *   This file contains EDMA3 Test code.
    6 V# I* c9 y8 |3 m# m
  8. *
    " Q" {, t) r* W. L6 }/ u/ Z
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: g. T' d3 h5 z; h
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! M1 |& v9 E1 Q0 J" k& M" j
  11. *         TO CHANGE.# |! h# `* y8 v* _# W2 Y
  12. *
    # p7 z& ]' _1 N! G
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 M6 u4 ~" E+ _
  14. *1 D: A6 `* V) Y8 ?1 K
  15. * This program is free software; you can redistribute it and/or8 @/ c! f& d! Z, x0 B
  16. * modify it under the terms of the GNU General Public License as9 l& J* `1 q* S% ?% v+ P2 f1 a
  17. * published by the Free Software Foundation version 2.
    - l7 G) z% y2 t2 \! e
  18. *
    , f+ ^2 ^8 A/ L9 E1 g# z, b/ n% n
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any' B# [; h" B0 b6 g( a
  20. * kind, whether express or implied; without even the implied warranty
      o0 U6 r* |4 ~/ Z2 U  B
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1 }1 S9 j/ s* n. }5 y
  22. * GNU General Public License for more details./ B* T. W0 ]( W( P3 p! x7 k# n+ O
  23. */0 Z7 ~0 G9 e- Y! U) q$ a
  24. 7 t- c7 {& C1 F: R, a# l  P: e
  25. #include <linux/module.h>
    7 L8 y* r* F; w; G7 _5 p
  26. #include <linux/init.h>
    , C# b! H3 w( ?8 k  t  j% B; r
  27. #include <linux/errno.h>
    ! G# i' }" @3 H7 e
  28. #include <linux/types.h>
    ) B7 n# O$ R% g3 k
  29. #include <linux/interrupt.h>
    + ?. W7 E  h* A9 V: O5 _" P
  30. #include <asm/io.h>
    8 F4 ?5 ?7 s+ D
  31. #include <linux/moduleparam.h># g4 E- ?7 T: I" O  o! [4 y& ?  M
  32. #include <linux/sysctl.h>! |3 Y% s. \/ q$ W7 D% P
  33. #include <linux/mm.h>
      g& {6 q, x7 F1 |/ U
  34. #include <linux/dma-mapping.h>8 |+ [  W' H6 l

  35. 5 L6 D, t  x& S0 K0 G5 \4 {
  36. #include <mach/memory.h>! }3 E" R# C* J  p& T
  37. #include <mach/hardware.h>& O/ F6 a9 j( Q1 {- ]7 w
  38. #include <mach/irqs.h>
    ; L- ^& `. A4 t. l
  39. #include <asm/hardware/edma.h>$ I% d  s; N* g8 q; N
  40. ( w9 E) L8 {: Z
  41. #undef EDMA3_DEBUG
    ; L% u0 c! [0 [/ v* T
  42. /*#define EDMA3_DEBUG*/
    ! F" G( ]; x9 @, |9 Y2 c
  43. * g  B9 U: `9 Q4 N. _% N6 q
  44. #ifdef EDMA3_DEBUG
    5 _: t) B+ x' {
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* e: N2 w, r# L- F3 u! R& ~. |
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* s" p- _4 H. ]) J+ ^) v6 v
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* j5 T" u' T) U! ^4 ]
  48. #else
    / Q- d! v6 T# B# \
  49. #define DMA_PRINTK( x... )
    & R3 I( v  _! I- ]5 Y! L" Y
  50. #define DMA_FN_IN2 u4 c( i" z2 J
  51. #define DMA_FN_OUT
    & N& \* S6 ?9 b- Y. r2 `
  52. #endif9 i' Z! f* f! [5 c* r1 k0 g( R- _
  53. 3 }& l: G# {, J4 i7 Y) f
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    + n: f+ x( `* s3 V& j
  55. #define STATIC_SHIFT                37 ^6 \! R. L# f" v3 v
  56. #define TCINTEN_SHIFT               20
    * r; w9 b- z4 h- K( V2 f
  57. #define ITCINTEN_SHIFT              21
    + p1 H7 L( P  J# T3 r
  58. #define TCCHEN_SHIFT                22
    & |4 n, m0 q  p( k) I8 o: i& ]
  59. #define ITCCHEN_SHIFT               23
    1 `3 h5 h6 U/ L" N: E# o% Z/ w

  60. 9 S9 X$ S9 v) K! Y' O) I
  61. static volatile int irqraised1 = 0;% Y# [7 g) z0 B* K+ _; Y3 ^
  62. static volatile int irqraised2 = 0;& p$ _  C3 q. r$ `! T
  63.   a; E  e. Y9 b& n) L
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : ^) `7 N  U# b, J4 A+ M* h
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & [9 ^% q0 g* y& s% t/ o! ~7 G" H. x
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * Z/ T3 Q& Z% m, k

  67. 2 t# e6 T" p4 s  o
  68. dma_addr_t dmaphyssrc1 = 0;
    : \( f, Q3 \' n# w* }4 A& r
  69. dma_addr_t dmaphyssrc2 = 0;6 `" F' e8 {1 F2 @* z8 C0 h
  70. dma_addr_t dmaphysdest1 = 0;
    7 O1 q0 g# d; {1 P6 B7 q" Q8 l0 `0 ]
  71. dma_addr_t dmaphysdest2 = 0;0 Y6 k% d  q, i2 _* w( j

  72. 7 {3 U# s5 @6 I
  73. char *dmabufsrc1 = NULL;
    3 _3 k) V4 t! U/ e" C
  74. char *dmabufsrc2 = NULL;- `- G8 @4 A" {% V9 z
  75. char *dmabufdest1 = NULL;3 e2 `+ `, i6 j; `& O1 ~
  76. char *dmabufdest2 = NULL;/ n( j& Q, [" ]8 n/ o6 U* r2 M
  77. 5 t' I$ d! f8 U* K" H0 a
  78. static int acnt = 512;
    ! ~7 ~2 L  N- Y! U
  79. static int bcnt = 8;
    ' D1 A4 v3 X4 }8 @. ~! V; N
  80. static int ccnt = 8;2 T7 f, W# v0 J6 ]
  81. % N4 S: R" ~+ d' {7 f
  82. module_param(acnt, int, S_IRUGO);
    + s) |) j  h0 n# k
  83. module_param(bcnt, int, S_IRUGO);
    9 ~9 V5 U1 h7 A( E: ~, r
  84. module_param(ccnt, int, S_IRUGO);
复制代码
6 _- e* b2 r: T. V6 s5 b  A
) a' ^, C, ]! Y% G. q4 v* y  Z
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( s& k: L4 ~/ z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" V; L1 ?6 m0 `  p: Z8 A* _' q4 e     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 I  k' P0 }# n  y* A& A& ?4 e& b0 Z6 }& t" R
0 J8 Y7 W: e3 b3 k
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-15 13:20 , Processed in 0.039482 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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