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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% M; q1 m! {  Z; v5 N7 }0 a
  1. [code]EDMA sample test application6 J6 n  P3 L) F5 x
  2. /*3 H5 m; G# D' A
  3. * edma_test.c# _" G* F( D' b& [, }! s
  4. *
    , w+ ^+ e$ g3 K2 B, Z9 o( ?
  5. * brief  EDMA3 Test Application
    6 c4 D) q* B- p- k6 k( i! @
  6. */ ~& ]) @$ |6 t) J5 }  C. A9 X
  7. *   This file contains EDMA3 Test code.% d5 B2 |6 U' y3 a1 ?  c
  8. *
    5 p4 Q  i  |3 y0 ]9 ~
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; P, `( J- v* A+ K$ u
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ( f4 F" P. r" @: C( Z: B
  11. *         TO CHANGE.
    6 U/ \( x+ o/ s! r# F# ^
  12. *1 y, G5 S0 `# B+ [9 \
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 n7 w  @( u* X$ R
  14. *
    * W' f& I" Y" M" D
  15. * This program is free software; you can redistribute it and/or
    . q7 G/ k$ }$ e" y. X+ S
  16. * modify it under the terms of the GNU General Public License as
      Y( j" Z! f% f7 n9 q0 c+ e8 [
  17. * published by the Free Software Foundation version 2.4 r+ p0 Y+ `; _0 {8 V- L$ j* H/ Z
  18. *
    6 K2 u7 o! w5 J2 C. \+ D
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any* X4 A* u' D$ i# Z5 y
  20. * kind, whether express or implied; without even the implied warranty. m, D5 n% y3 A- m: F% h
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ( _2 f, m1 F' i
  22. * GNU General Public License for more details.
    5 n) u" ?* o: c5 A1 e+ _) @6 G
  23. */
    3 e3 n+ B8 w4 B+ V$ C% L4 Q% l
  24. ( r$ d9 b$ p, _: Z9 t% L, f5 T
  25. #include <linux/module.h>
    ) |' B) h- |+ j1 ^  \' i
  26. #include <linux/init.h>
    ; v6 S0 k2 M- `' j) R+ Y" U6 h) i
  27. #include <linux/errno.h>6 q, [0 X% |/ y: D/ F
  28. #include <linux/types.h>$ ?) [* h) m! c: w6 Z
  29. #include <linux/interrupt.h># ~( G# y5 Z! @3 L
  30. #include <asm/io.h>; r3 s( b( n$ c) `' R' L' `
  31. #include <linux/moduleparam.h>
      T+ `- ^5 i2 @" U: W
  32. #include <linux/sysctl.h>) D  G; _5 E# [6 d2 V
  33. #include <linux/mm.h>" @. G0 G# f& ]. W7 r" _6 r
  34. #include <linux/dma-mapping.h>9 u. j. k  H$ z4 d$ q

  35. - A) k  j$ V. K5 S, v+ \! P+ x
  36. #include <mach/memory.h>
    & @8 P* I5 P( n' K$ J4 [+ s
  37. #include <mach/hardware.h>; Z' B- B) c4 d$ _
  38. #include <mach/irqs.h>
    . y8 t5 `) u! g0 ]
  39. #include <asm/hardware/edma.h>
    ! P+ j# i/ s$ U& n: R4 [
  40. 1 V/ K& R- ]" M! W8 E
  41. #undef EDMA3_DEBUG
    ; @' w8 L' v4 T, N( C
  42. /*#define EDMA3_DEBUG*/# s7 w! D( J$ w" K3 r, d# f5 l

  43. 5 Z4 g3 F  B0 n7 Z( E( j8 O% z
  44. #ifdef EDMA3_DEBUG
    5 U  x% c. [( l  b- q& G
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ F" `7 l: ~- P9 f
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% Y2 T1 ~3 E* P' g8 C$ F  ]* F
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    & e; w1 k7 f# @9 ?$ _. Q
  48. #else
    ( B4 ?0 C0 I  Y( n9 L
  49. #define DMA_PRINTK( x... )
    * ^! z# I9 T' U5 G
  50. #define DMA_FN_IN, X9 ?6 s6 e; f, ]$ q
  51. #define DMA_FN_OUT
    + t9 |8 O: [" j  [8 \% E% ^
  52. #endif* y& W: V5 P- T$ d2 p
  53. . Z0 k6 ?9 S# g9 d' O
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)* c2 v" _' D7 V% [4 N! E  k- |
  55. #define STATIC_SHIFT                3) \  E- t2 Y) o2 T% A3 V
  56. #define TCINTEN_SHIFT               20
    * f2 X7 L% |, A  m4 r9 g/ B/ U
  57. #define ITCINTEN_SHIFT              217 F6 w. I- T, o" v2 K" e; L) U
  58. #define TCCHEN_SHIFT                22
    : k* R5 l! }. e% @: |
  59. #define ITCCHEN_SHIFT               23! ^: T+ x/ Q+ d

  60. ; j  e$ c% ^8 X  x
  61. static volatile int irqraised1 = 0;, [2 o) g" \5 }& L, A
  62. static volatile int irqraised2 = 0;: m) q- a8 z9 T" s

  63. 5 N9 l0 q' G& l: N) D" E; |
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% @2 }# J$ K- {; f4 q; |
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - ]$ c1 I2 H8 `. L
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- T) l6 }9 |3 V& f

  67. # ]& e( e5 H1 f4 D! `
  68. dma_addr_t dmaphyssrc1 = 0;
    & G" ]" s, V/ `" J2 h# q( Y
  69. dma_addr_t dmaphyssrc2 = 0;/ f9 M0 V5 ?. _% G% j0 I' |
  70. dma_addr_t dmaphysdest1 = 0;
    . \( q7 P# R7 K  a: r  o
  71. dma_addr_t dmaphysdest2 = 0;
    $ c/ K1 m& x0 A# e9 ~% @

  72. & ^" N0 @; f( F7 `4 N$ U2 b
  73. char *dmabufsrc1 = NULL;
    " ]9 T6 ~& Y% @+ ^$ i$ q2 Q
  74. char *dmabufsrc2 = NULL;( Z8 l* C( M$ [# S
  75. char *dmabufdest1 = NULL;/ [, p9 |+ j: B/ x. c- `
  76. char *dmabufdest2 = NULL;
    # A4 f0 w) G4 j% F) j: Z, v0 o2 U0 @
  77. 0 b0 [8 M: s  Y2 i6 S$ G6 I  S  j2 R
  78. static int acnt = 512;( I0 p( t0 z% N8 L% n: Z8 z
  79. static int bcnt = 8;- q4 J8 j4 O8 T2 J7 _  X+ b/ D
  80. static int ccnt = 8;
    ( ^9 R' V6 c! k9 a  K) O
  81. $ I& k% A' e7 R9 t* D  w
  82. module_param(acnt, int, S_IRUGO);
    $ L5 U1 O7 z" _7 U% P8 t
  83. module_param(bcnt, int, S_IRUGO);
    ; r, U7 y2 n. q) E- w* H; j2 p9 R' U
  84. module_param(ccnt, int, S_IRUGO);
复制代码

% S+ s' a) B0 y7 m: f* v" O' T/ ^; T3 t4 |& G8 D& M
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' p) ]: w6 T" p& Q+ ]
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 \  g9 p( y/ ^3 g) R) h" O
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# e) [" R) d. r: R
' `, p/ M: l9 q* `" o" U! G
0 I5 b4 p" o. t3 e
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-16 04:23 , Processed in 0.039940 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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