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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( b# h2 g- P6 J- y
  1. [code]EDMA sample test application
    # h9 F  C" }  s% s, `
  2. /*0 G( Y& d% v8 F3 E0 d( G
  3. * edma_test.c! ?6 Q. f7 M# `
  4. *" C8 l  K) G" M9 }- g
  5. * brief  EDMA3 Test Application8 F& |, K4 ^$ q& W7 g9 @! |
  6. *
    0 I- J4 M7 A3 p( T9 B- L4 C
  7. *   This file contains EDMA3 Test code.
    # x8 _5 y1 N. c* {: N. U
  8. *
    " k1 u, o2 ^' O6 ]
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, U0 I. Q7 x) u; K
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 M. o- h' v) |! ^# _% T/ p
  11. *         TO CHANGE.- b8 X# O6 V1 Y& o" g8 u8 _
  12. *
    3 S4 n8 T2 c9 \0 v+ @
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ' k- v) K' Q5 ^. r
  14. *: q. M1 S- j: y% m" O; P
  15. * This program is free software; you can redistribute it and/or/ T8 b$ M- H0 z' ~
  16. * modify it under the terms of the GNU General Public License as
    ! c+ x9 ]5 L" A4 p, x# l( ^- b8 c! V
  17. * published by the Free Software Foundation version 2.5 K+ }+ S/ q0 g3 O. f
  18. *
    ; z  y: @% X2 R0 b, N7 G
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    / l. O8 ~+ R% U+ R- R
  20. * kind, whether express or implied; without even the implied warranty
    * y6 q/ ?) Z3 S6 I/ K
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    $ Z% m2 @. Z- E. v; r
  22. * GNU General Public License for more details.
    7 E; v0 V2 `8 r+ j. n* o5 Q4 {
  23. */
    . g+ c! x$ G3 c/ |2 L
  24. 8 ?! i, ~2 P  t; A
  25. #include <linux/module.h>+ D1 L/ V* P4 F' g5 z) v; |; @
  26. #include <linux/init.h>
    " Y7 u, i$ u# G; c# N9 N+ E
  27. #include <linux/errno.h>' C+ L# p$ L( n( U: v& Z; \
  28. #include <linux/types.h>  x+ o( h( `" ]; g
  29. #include <linux/interrupt.h>
    ! k. y9 @4 G# h( b7 O. J6 J# j
  30. #include <asm/io.h>
    1 T9 @  s. }- P  Y
  31. #include <linux/moduleparam.h>
    / ~! s7 m: k. W4 n
  32. #include <linux/sysctl.h>
    * K$ P5 C: Y! t- ^, s" f
  33. #include <linux/mm.h>7 A% F6 T6 _9 M# o
  34. #include <linux/dma-mapping.h>9 S! S! {  t; n, b) g- L" n0 a

  35. * l1 J# u7 c6 }, w1 L/ W! [9 Y6 \
  36. #include <mach/memory.h>
    ( h0 t% p& V0 t! B* {% W, G5 \
  37. #include <mach/hardware.h>3 Z  b: g) |- ~! z: Q/ O" g
  38. #include <mach/irqs.h>. ]9 ~, |9 J! ]% A- d- @
  39. #include <asm/hardware/edma.h>
    1 e- f1 [! G9 D" U4 d
  40. / s4 A/ n( }* n+ G% d2 d
  41. #undef EDMA3_DEBUG0 Y; N: z3 V$ o: q1 ?' g8 h+ ^
  42. /*#define EDMA3_DEBUG*/
    7 O; n. ~2 F" V* @# t0 _
  43. 1 Z* D3 K: f. v: A: M
  44. #ifdef EDMA3_DEBUG
    ; w  h' o4 ?" C: c  e- G3 R
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); I* M6 v3 ]) o. s
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); D  a- j& M( }& P, U0 o) Q" m+ G, Y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    , Y/ o2 T. r" R+ F
  48. #else1 e8 K; o: i! C& p* H. P! J! C
  49. #define DMA_PRINTK( x... ): `/ \; A) ~/ u- g  \- X
  50. #define DMA_FN_IN
    1 r- j# y/ N/ y) w, {  A  M
  51. #define DMA_FN_OUT: F! k" q/ f- a' F
  52. #endif
    # H% t9 A( @: A+ ?7 o* U/ e
  53. + j' W1 b0 x& u
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    & g; G4 K( W- W# A# ]
  55. #define STATIC_SHIFT                3" k- T  N! ^1 q4 P7 ]! i" S
  56. #define TCINTEN_SHIFT               20$ w$ V7 q7 C+ C* d5 y
  57. #define ITCINTEN_SHIFT              21! d( k  o# n8 R+ O6 H8 ]
  58. #define TCCHEN_SHIFT                22  Z2 N& f/ _* |0 ~- H! c
  59. #define ITCCHEN_SHIFT               23
    0 P3 m. [' N8 J

  60. 5 B/ M& M3 ?+ J  k6 A" l& Y
  61. static volatile int irqraised1 = 0;
    & k* C& d* ^. e" ^$ R- o" X- z
  62. static volatile int irqraised2 = 0;8 U' l$ _, I& }' ]2 s5 V# A
  63. # S4 z' u; n; C0 C( |
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 S' X# m  B6 m8 M6 p
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ ^* L) L6 M  e5 a
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* r% ]7 ~3 q' I( l1 J4 V) S/ \

  67. : v7 D+ H" W0 y5 L: R; k
  68. dma_addr_t dmaphyssrc1 = 0;2 w' g& ]/ R  |4 z" V! I
  69. dma_addr_t dmaphyssrc2 = 0;/ C/ u; I* [! @' ^9 ]# N4 T
  70. dma_addr_t dmaphysdest1 = 0;+ C# j- \" ~4 J1 }: E
  71. dma_addr_t dmaphysdest2 = 0;
    * [9 z4 N- R5 g  \. y: D5 k

  72. ' d! E, x" K! S2 _, P2 U
  73. char *dmabufsrc1 = NULL;
    " u9 z, B+ [$ x1 |* v: v
  74. char *dmabufsrc2 = NULL;
    " g  U6 u" {4 k& }* J4 ?$ b
  75. char *dmabufdest1 = NULL;
    : j2 B9 M, U% G# _6 P
  76. char *dmabufdest2 = NULL;  q& @5 I7 U5 O: C+ M# u( d' r

  77. 3 R  ~) X# u& u
  78. static int acnt = 512;
    7 w% t& f. r1 @) h! K) L3 L
  79. static int bcnt = 8;
    5 T/ T; ^2 l$ I4 F+ I
  80. static int ccnt = 8;3 ~0 C6 f: F+ k4 t" `& ?9 f$ _

  81. 7 F  v$ F( @/ p
  82. module_param(acnt, int, S_IRUGO);
    7 F- u! g7 m2 b3 l. t2 a4 N8 ]/ A- ~
  83. module_param(bcnt, int, S_IRUGO);
    - Y9 a* s8 y4 B4 [1 f
  84. module_param(ccnt, int, S_IRUGO);
复制代码

5 `* y: q1 M% F& S. X; ]) b$ K' @) B* v7 C3 \
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 s9 \2 E  {8 q9 g( u3 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# z0 D: l. H* w3 L
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! k$ o. j) E* w* z) t
) y2 ]% b! z$ r' s# s: D
( J8 S: E' V4 W1 K3 x/ Q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-16 04:47 , Processed in 0.039897 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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