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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) Y; E3 R7 l# U* p# L/ x
  1. [code]EDMA sample test application
    6 }' }  |7 C! N: f6 s  T2 I
  2. /*/ u: }1 u: t5 {' l" b+ @+ V
  3. * edma_test.c
    * M; ~4 R* j/ x- }+ p
  4. *
    9 `( O( K  ?# N+ m# V" r4 ]
  5. * brief  EDMA3 Test Application; J# U& V' _" Z9 W% @4 Q
  6. *
    3 k4 }- W( @. j/ y5 `' O3 I
  7. *   This file contains EDMA3 Test code.
    ) z! b9 K' I1 m! E9 M
  8. *5 ^. T) O7 w! }% g& G
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. h3 D1 Q; d+ I: l
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    0 x  E4 f! v5 I* j* P! ?
  11. *         TO CHANGE.8 }3 B1 e9 [- q. T2 C5 M1 y) U
  12. *. H, W/ w0 A  h0 I0 `& t* L
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    " Y  L. _( Z5 B# F3 i$ Y3 o# \# @: {
  14. *
    9 O& [* w1 ]" R) T  Q$ q1 q) N
  15. * This program is free software; you can redistribute it and/or1 s* ~3 ?, E- A
  16. * modify it under the terms of the GNU General Public License as
    9 E3 F8 Z$ A6 K' [
  17. * published by the Free Software Foundation version 2.
    * V9 [4 p9 N# o4 U
  18. *
    ' {! Z& U$ o0 @/ f
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any, c9 E% E# |, v+ f$ A8 ~& B' P( A
  20. * kind, whether express or implied; without even the implied warranty
    ! H, D3 ]0 e8 k" q4 N5 [  N
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the. d: ^+ n0 [7 ?; ?* ~+ m3 c+ \9 E
  22. * GNU General Public License for more details.
    # [/ p  u6 k- b1 `7 B" O8 @
  23. */# [6 n2 n) F- g: H, x; D3 i

  24. / m/ f0 W" V0 s1 b& A! X' ?' w: ~0 C
  25. #include <linux/module.h>) m) v5 [& v0 Y4 j" V+ S# W
  26. #include <linux/init.h>
    4 h  Y  w$ F: M3 Z+ F, M  q3 W
  27. #include <linux/errno.h>4 c7 Z2 w6 l* L, m" U
  28. #include <linux/types.h>( d3 k2 D! Q8 Q5 z1 ]- S/ C1 H5 I4 l/ [
  29. #include <linux/interrupt.h>
    & k7 W- E1 v6 L/ E/ l+ l
  30. #include <asm/io.h>
    ) r3 ]! G# \6 _/ D/ p8 N- i
  31. #include <linux/moduleparam.h>) }; J# N: G2 m: `
  32. #include <linux/sysctl.h>: M. p3 x6 L3 x
  33. #include <linux/mm.h>8 A  N! c6 _) v5 j1 E" Y! X1 ]  c
  34. #include <linux/dma-mapping.h>+ t1 g. [$ \8 `$ M4 K6 ^2 g
  35. ; v# \1 E( K, I% [2 i: n% u8 |: V1 ?
  36. #include <mach/memory.h>; ~' |2 [, H: V: M- L% D0 J6 V
  37. #include <mach/hardware.h>
    5 V, l9 ]1 Y0 g2 |* N) U8 e
  38. #include <mach/irqs.h>) S8 B  w* T; ~) l5 p
  39. #include <asm/hardware/edma.h>: ?" D6 A9 T* f2 U# g3 n
  40. ; M7 T5 d3 i3 a& V; N
  41. #undef EDMA3_DEBUG
    8 K$ `/ n4 M" D2 u  z
  42. /*#define EDMA3_DEBUG*/) ^6 z5 Q) v3 w, J3 y% B* U5 u

  43. # W, f9 a1 a0 P1 \
  44. #ifdef EDMA3_DEBUG
    7 ^- V8 F. J' d, p# o
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    * g& ?5 B% Z2 K/ C6 c9 K1 f
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    - ]. f2 R  p$ I
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 {1 r0 L( o" `' j% ]
  48. #else, L" @0 w. J" K% f' Z
  49. #define DMA_PRINTK( x... )
    6 g; V0 m' \2 k9 M' E7 D8 }% L
  50. #define DMA_FN_IN7 y1 L* |9 `- ~* R9 d2 v* g7 T
  51. #define DMA_FN_OUT- }! b; V. p: g9 @# W7 P/ A
  52. #endif
    9 w2 z+ f* H; a5 u6 r* V" {% X% |6 w: h
  53. . V% k" K" A2 b3 M$ p3 q( [
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    8 n6 W0 k/ y/ k8 y2 z: R. l* F
  55. #define STATIC_SHIFT                34 I' \7 z6 S/ l9 F4 h5 e* [
  56. #define TCINTEN_SHIFT               20( [1 n" V9 y; r6 j- Y$ `7 P
  57. #define ITCINTEN_SHIFT              215 Z9 k0 f3 u$ b4 }, n- F  b8 _
  58. #define TCCHEN_SHIFT                22
    " y3 \! R0 f1 U7 e; K
  59. #define ITCCHEN_SHIFT               23
    8 n. f6 E0 ?. [7 _- E# y9 T/ L
  60. + ~- g& x3 E+ e& ]' t
  61. static volatile int irqraised1 = 0;' W- S* A" H' R; U$ @, Y6 R
  62. static volatile int irqraised2 = 0;' ~$ N" D8 l0 _8 D$ A
  63. : g5 m2 v7 Q6 m0 m( Z% J
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * X/ e2 k0 d# ]' q/ Z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 }$ Y0 P! Z* G& z0 f
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 t# `# b9 t' f& g2 S

  67. ' ?0 `& B4 G5 h( _" L: c; _
  68. dma_addr_t dmaphyssrc1 = 0;+ S% y, B: S1 c( Y6 W8 ^
  69. dma_addr_t dmaphyssrc2 = 0;* q2 g% m7 v) H8 Q1 [
  70. dma_addr_t dmaphysdest1 = 0;
    8 t+ C- m; M  X6 o% q
  71. dma_addr_t dmaphysdest2 = 0;
    " w3 E, b2 q: d) k: z7 Z. Y
  72. - ~& X3 h5 n. j, L8 g6 h
  73. char *dmabufsrc1 = NULL;
    3 [# x: r- t7 U+ j3 T0 r
  74. char *dmabufsrc2 = NULL;
    0 ^4 [/ G& t- ?3 D9 p
  75. char *dmabufdest1 = NULL;
    5 N. ^- I. ?- u! [0 r- U
  76. char *dmabufdest2 = NULL;, ]* u- b: ~4 k5 b' s7 c
  77. $ q$ E, m% M0 ]  \/ h3 v
  78. static int acnt = 512;
    " V6 l  o3 S, t# e: j5 p' X9 z
  79. static int bcnt = 8;" Z+ w' k. y' t6 L# d, E
  80. static int ccnt = 8;
    7 ^/ j3 h8 |, H1 v! t7 j) v- ~
  81. : U' |4 e0 e5 c% e+ M$ x5 u
  82. module_param(acnt, int, S_IRUGO);
    $ ^3 |6 L4 ], H" l
  83. module_param(bcnt, int, S_IRUGO);% m7 @7 X" M1 }* M, ^) v
  84. module_param(ccnt, int, S_IRUGO);
复制代码
# I' F7 p. g# l+ W9 U5 D: i

) m: E7 }6 R9 a8 |) ?$ ]; G8 [1 _7 k      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. n' j& e% O3 {( K4 ^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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 t7 @2 [, ^3 v) L  H  n     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; F1 B6 i3 D% J# e* Y9 N$ o. t; Z! ]
! m  L- B! W) c; D# ~" K5 f7 ~/ U! I5 |# [- W
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-24 03:36 , Processed in 0.039441 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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