OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 ^1 o  J2 _" Y5 T% J$ l- q6 a
  1. [code]EDMA sample test application
    ' P) H6 r( f/ n" S! g, ]
  2. /*; M: R' i2 v# L" ]6 q9 G
  3. * edma_test.c) a9 G+ h2 S3 A+ R1 B9 i
  4. *
    2 K9 K* z/ \. ]7 y; a- R+ Q
  5. * brief  EDMA3 Test Application
    ; L0 Z" j1 x) q! e3 s5 ~" a7 _
  6. *
    3 w1 }' E! p0 d0 Z9 z. u5 j
  7. *   This file contains EDMA3 Test code.
    ) e6 ?) [  F6 M+ ^- |; `
  8. *
    + |0 f. W5 u0 }! c
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    7 s( E& C" T* i2 q2 I
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
      n; g+ `* E  h; c- `2 f( D! ~# N
  11. *         TO CHANGE.% D( P3 K( m9 w+ o: C
  12. *& }& o; x1 Y/ j# u5 K! t8 u
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    , i; C( y; n4 F% A0 S
  14. *. m5 Q" R* U8 s( |" E
  15. * This program is free software; you can redistribute it and/or
    0 B- j) {) B" f; E5 _
  16. * modify it under the terms of the GNU General Public License as
    6 \: ?8 @+ I$ V/ M6 K( g
  17. * published by the Free Software Foundation version 2.
    - p: L/ s; M# @& ~& @7 H/ g
  18. *
    ; F, T2 F, c; O$ b8 W- s7 r, M
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    " p; ~& W( I/ G: S8 C; j; _: f8 b
  20. * kind, whether express or implied; without even the implied warranty' |. a& U" ?% C- V. p6 \# m
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the3 L' g* a8 i" P% B/ \
  22. * GNU General Public License for more details.
    ) |" G3 \4 w4 Z, ], K  }8 ?
  23. */- X( E: l/ q+ O) Y: Q' n7 b

  24. + P2 U$ h# J$ g2 B# ~
  25. #include <linux/module.h>& b: Y5 M1 x6 ~4 z: h# Y* z* e
  26. #include <linux/init.h>! l2 \2 I6 K1 n/ `
  27. #include <linux/errno.h>
    ' W+ v' d4 l1 M7 {
  28. #include <linux/types.h>9 j! D: b# }/ @( q/ r& v4 |3 i% k
  29. #include <linux/interrupt.h>+ U, L" Z+ h2 l
  30. #include <asm/io.h>7 y$ K. v1 w5 U3 h, F1 ~2 |; D
  31. #include <linux/moduleparam.h>2 p+ G0 N* M7 n
  32. #include <linux/sysctl.h>* U9 A( m. \7 i, @# g
  33. #include <linux/mm.h>. j& L0 p. R" P% }( y
  34. #include <linux/dma-mapping.h>) S7 f' a6 m5 |/ O+ F8 k
  35. 7 }' o1 a5 z$ `% U8 r
  36. #include <mach/memory.h>+ n$ E9 _+ Y1 V. `
  37. #include <mach/hardware.h>6 V" D$ B; ^' t2 d
  38. #include <mach/irqs.h>
    $ {5 }/ }# @0 ~
  39. #include <asm/hardware/edma.h>5 S$ A+ v: R/ ]& G, b: k
  40. 6 J, T! c, J# p/ s  z6 y* K
  41. #undef EDMA3_DEBUG
    ; m# ?& d6 \/ Q0 f
  42. /*#define EDMA3_DEBUG*/2 z, y! H$ N* Q  L" F

  43. 2 o" M1 r! j* y( T
  44. #ifdef EDMA3_DEBUG, {' B. o; X) W7 c
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    7 b  m& C2 f; }+ d7 \* \+ a
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 |6 `/ H/ c* v% b- K8 h/ D" ?# d6 s: F
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" s" t! {, ?* v" P  O& c, N: T
  48. #else2 V: q! o( Q1 L6 _9 m$ K- E
  49. #define DMA_PRINTK( x... )0 t4 I! A6 g- B2 D/ S" \
  50. #define DMA_FN_IN
    4 f! ?7 X% `" X4 X6 e7 g
  51. #define DMA_FN_OUT
    + d& w; N% x4 n% s2 m
  52. #endif
    " F% T. R$ @- ?9 W# _" R% X0 Y6 r
  53. ; G9 }; A1 S5 u9 Y3 T$ D& z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    & D9 m3 m: k1 U# s2 J4 m) n
  55. #define STATIC_SHIFT                3
    " r4 e7 w1 F, F( @. Q6 n1 s
  56. #define TCINTEN_SHIFT               20* p  o+ z$ G+ u; s
  57. #define ITCINTEN_SHIFT              210 V$ M/ B. C! B2 i, Q! k
  58. #define TCCHEN_SHIFT                222 K5 i0 i. ?. h, |, O+ g5 f
  59. #define ITCCHEN_SHIFT               23
    8 L1 u) o; ~2 r" f) z9 _, I7 {
  60. & a/ U) B. ~+ y2 V' ?* \
  61. static volatile int irqraised1 = 0;
    , H  ]  b5 [- t+ V) {( s" O  A7 V: E; @
  62. static volatile int irqraised2 = 0;
    7 _1 p2 D1 ~1 u8 P
  63. . w! J7 [: L/ R* ?# S" P- ^
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 y3 q* k7 H, T
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : t' S6 z3 R& H1 i& }
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 O: b/ R- e0 W0 [. j! c, B

  67. " J% x8 W/ Q$ {3 q# r* z, b. g
  68. dma_addr_t dmaphyssrc1 = 0;) g% b& L: p& B
  69. dma_addr_t dmaphyssrc2 = 0;
    4 e9 ^9 {) v7 i6 T& Z& w' _0 G3 D) @
  70. dma_addr_t dmaphysdest1 = 0;2 {5 @; C8 G. R9 F+ P  f  K( `
  71. dma_addr_t dmaphysdest2 = 0;$ U4 i- ~3 A/ b5 u7 R

  72. + J8 E, o1 b+ i" w1 C4 n, b
  73. char *dmabufsrc1 = NULL;
    4 N/ }" H+ u& d, ~' x4 U+ P3 p6 i0 T7 j
  74. char *dmabufsrc2 = NULL;
    ) L2 l- {) w$ G8 Z, w" s. x
  75. char *dmabufdest1 = NULL;0 D  x4 Z6 t: x7 `9 o, P; Y
  76. char *dmabufdest2 = NULL;2 x: o1 O6 j/ r9 ^
  77. $ x1 l( q) q/ `4 s
  78. static int acnt = 512;; X8 u' B3 l  V
  79. static int bcnt = 8;
    ' @2 o* }$ M5 K- }) b3 u
  80. static int ccnt = 8;5 M- [! S/ @" r& c& r
  81. ! Q8 |( S  Q1 s4 r; y- }( E) ^
  82. module_param(acnt, int, S_IRUGO);
    8 s- w2 j, Y; m
  83. module_param(bcnt, int, S_IRUGO);) K2 O. E7 j% s  b6 P5 h
  84. module_param(ccnt, int, S_IRUGO);
复制代码

9 N8 e1 n! Q/ U- F( u1 ]* i5 S! I0 e. k# P, w
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ F! o( |) x# ?* Karm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ g4 P/ L' l1 m0 ^     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, k8 T* J' Q( ^6 _# Q

) z5 q; G" ^* `+ X0 {# P8 k! K* y: U, u+ }% K
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-20 06:17 , Processed in 0.038870 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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