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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% g3 n' H0 p1 l8 K, `/ y' A
  1. [code]EDMA sample test application
    " B& u& P+ E  E# [8 L+ U
  2. /*$ M% o  Q+ ~. a+ W% P8 e, n
  3. * edma_test.c
    * l0 V! C1 w: }. ^
  4. *1 R+ ]4 o2 y. Q! Y; W
  5. * brief  EDMA3 Test Application( v* U  m8 n( B# p) K
  6. *
    / T% ?4 y" x$ }+ P$ a) A
  7. *   This file contains EDMA3 Test code.
    & b& ~! ]; l0 H- E
  8. *
    . _6 b; a/ f5 r, |' M
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    8 n$ M6 D+ H. [. d1 {# f
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    0 W. g- S% ^( S) f- |+ A
  11. *         TO CHANGE.5 @2 z' ?$ o9 l+ X6 y9 l' Y
  12. *4 @& N! g. o8 S+ d0 ]* |
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    0 T9 Z3 R* f. o* Q) I" c
  14. *
    ! o6 f% h! {$ p' \% S
  15. * This program is free software; you can redistribute it and/or) G. J9 p$ t% C; u/ z# w
  16. * modify it under the terms of the GNU General Public License as
    - \! \# C/ E+ {2 e
  17. * published by the Free Software Foundation version 2.3 v2 ?6 |* ?& U0 v- l. b; G/ G) F
  18. *& r% U# _8 n, p" r- j
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 {7 A! u7 {- x3 c9 X( ^- ?: {
  20. * kind, whether express or implied; without even the implied warranty  e2 M6 @* q. u( {
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the5 X7 ]' f, o( ]0 Q) ~. `$ e  M* i) o  \
  22. * GNU General Public License for more details., e2 Y* V# M; [/ h
  23. */
    ; v+ k" @2 h( S) ]- J

  24.   v- ~8 J' V+ B8 u2 t
  25. #include <linux/module.h>9 x+ F* i; c) H* z+ t2 A$ @4 ]
  26. #include <linux/init.h>
    8 _5 o: T) W! P: \
  27. #include <linux/errno.h>$ W. N- J* U5 L: f0 w6 a" f6 M& \; J
  28. #include <linux/types.h>
    " g( z2 [, a6 x- F) m2 y$ X
  29. #include <linux/interrupt.h>
    5 G: z- s; s# }3 V% t# z: a
  30. #include <asm/io.h>
    9 Y% P+ q# J& v0 n
  31. #include <linux/moduleparam.h>
    ' l) t$ U$ t" i: l
  32. #include <linux/sysctl.h>
    8 |  m1 U  x8 \4 O- N% N# e
  33. #include <linux/mm.h>. a1 J/ K. J  A: Q3 f: c
  34. #include <linux/dma-mapping.h>
    * u* z1 ^4 U: D$ u# A" G% F* T

  35. 4 C' h& @+ b3 C6 {/ H
  36. #include <mach/memory.h>2 L, o0 F6 F9 z' a, W
  37. #include <mach/hardware.h># e- O9 n& L. N! s
  38. #include <mach/irqs.h>
    8 L, X0 N8 N6 [3 q/ X
  39. #include <asm/hardware/edma.h>
    " v# @4 o6 x$ M! C/ |3 _# ~

  40. ) b% ^/ h/ R! J6 S3 \5 M1 j8 t
  41. #undef EDMA3_DEBUG0 }: a$ [$ K7 `+ ]3 G5 c
  42. /*#define EDMA3_DEBUG*/
    5 v+ [3 |4 c5 K+ s0 m# E6 k

  43. 9 L. K8 M# B0 o' N, Q( h
  44. #ifdef EDMA3_DEBUG
    3 h9 m9 }1 T0 w$ x9 N  ]
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) D, A3 d) ?# d4 A+ l6 _
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 V, _2 |9 x* d! W+ v$ z/ ?; k* M. V
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ' J" X  {2 n" n& {
  48. #else
    2 o7 b+ o$ v$ u5 l" ]
  49. #define DMA_PRINTK( x... )
    " V. P8 B7 R' ?4 m: _9 \; O
  50. #define DMA_FN_IN
    / @9 Y% f, v3 w% y
  51. #define DMA_FN_OUT3 J# j7 ]# Y  L0 r; T
  52. #endif
    / s" n: P/ d& s& ^& s
  53. ) f) \1 D5 _2 P3 D' U0 }
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)% N2 J- t& w/ _7 \4 e, a
  55. #define STATIC_SHIFT                3
    & e2 T' y* Z- ^' V/ L+ O% {
  56. #define TCINTEN_SHIFT               20
    8 @) p5 _3 Y3 ^& T4 \
  57. #define ITCINTEN_SHIFT              21* f$ N& Y4 ?. l" _4 \6 x
  58. #define TCCHEN_SHIFT                22" \% ^4 v0 n  d5 s* G0 P4 Y0 {
  59. #define ITCCHEN_SHIFT               23
    / B$ Z9 O$ P7 @/ e. _
  60. % D, o" }# Y" z2 Z
  61. static volatile int irqraised1 = 0;
    4 q3 K1 j" w; i7 l4 F2 a0 Y
  62. static volatile int irqraised2 = 0;
    ' i  c* S+ p7 f% e  ~* z

  63. ' q* l9 y" t. i" j
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 W- f0 J" Y7 H0 I4 R
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& x3 Q0 a$ |9 q, C+ w  ~
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 _5 B) H. }' ]* L3 p3 i
  67. - }8 @1 ~0 y  g7 Z
  68. dma_addr_t dmaphyssrc1 = 0;3 j) W3 R- X4 A
  69. dma_addr_t dmaphyssrc2 = 0;/ x  D* @  Y- g, _( w* R: q
  70. dma_addr_t dmaphysdest1 = 0;; h$ B5 K" `6 e" e6 H4 }
  71. dma_addr_t dmaphysdest2 = 0;
    + ?; Z& D, w/ I8 ], o/ A
  72. 7 M' N6 r1 m& Z
  73. char *dmabufsrc1 = NULL;
    7 O2 [0 D0 E. F/ v! s* y: _3 c; y
  74. char *dmabufsrc2 = NULL;
    - z8 ^3 y  t9 N2 D) t/ T
  75. char *dmabufdest1 = NULL;7 ~; q( V: S$ U* b. ^+ T
  76. char *dmabufdest2 = NULL;7 T7 T% g4 m) h4 q" u" X5 I. Q, g

  77. ! m! t; r0 f* t& [
  78. static int acnt = 512;
    * L( n# h- e0 n( c6 d" r0 c, s( `% C5 I
  79. static int bcnt = 8;
    + X* e7 T3 X$ s% E- e' u* q
  80. static int ccnt = 8;
    & _. W8 R# N$ `. M
  81. + Q1 j: {. \1 s/ I* X0 t2 k
  82. module_param(acnt, int, S_IRUGO);/ D- F8 @- U! f4 R( ^& B
  83. module_param(bcnt, int, S_IRUGO);, ^4 N2 L" S! z
  84. module_param(ccnt, int, S_IRUGO);
复制代码

1 j% H4 |$ F5 x( [! n8 i! M/ Y
- k& U# N) Y0 E8 M9 H      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 Q/ v/ p2 o/ H" D9 `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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% U3 b* l: _) {- V9 s2 c     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 N# j8 B( d9 i; i' r+ i* d7 P6 J1 p( i

; d  ]& K" Z4 T' d0 a
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-23 16:26 , Processed in 0.050650 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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