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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" u- q$ A- S7 o1 F2 P- q
  1. [code]EDMA sample test application
    ) |1 x9 b* z4 h6 U1 @
  2. /*5 l4 E! z- I2 g) J+ \
  3. * edma_test.c
    0 |- k' R9 {2 y% }
  4. *: a% ^/ p$ S; |+ ^% X
  5. * brief  EDMA3 Test Application: Z9 a  n' M- H5 ?
  6. *
    ! F/ g, y6 E! `* r; e
  7. *   This file contains EDMA3 Test code.
    1 s" O$ Z$ J# }$ {5 E
  8. *% i% Q1 Q# ?" m3 y
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    . Y4 ^) U# X1 D
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. U! o6 V& v; N& f$ q1 F, Y
  11. *         TO CHANGE.
    $ U) K; h5 y4 d  E1 Z$ I
  12. *
    $ ?3 ]& _' F& z7 e6 A, `# u1 q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 m6 S  u6 M: R2 x' j
  14. *3 `$ v' a. }0 M8 Q: x! j1 y
  15. * This program is free software; you can redistribute it and/or6 ~+ d& H" I5 Q( \
  16. * modify it under the terms of the GNU General Public License as
    ! T/ Q1 y: Q4 N2 [& n5 c  i/ X
  17. * published by the Free Software Foundation version 2.. }. `9 V$ I" I; K% L
  18. *. ?: e! x* C' B0 s
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    + ^$ p; E9 [4 j' O# X
  20. * kind, whether express or implied; without even the implied warranty5 U  V; s4 \( Q  e, ]
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the. P. E% W' c7 H: g7 _/ ^
  22. * GNU General Public License for more details.
    # U2 t. ~/ }; `% u# C5 B
  23. */) H3 U" |# d! C" c8 X' P! U" i
  24. 3 }) P6 A4 }5 Z8 p( K7 s$ r6 a. e
  25. #include <linux/module.h>
    & f- |: @6 Z6 [5 {4 I. Z$ i1 @. ~
  26. #include <linux/init.h>
    ( z* a4 m% T0 `7 n. M! j0 u
  27. #include <linux/errno.h>
    " b' f6 O# W& C% Y  _0 L
  28. #include <linux/types.h>
    . h2 c; R* O& h+ t
  29. #include <linux/interrupt.h>1 |* B' `/ R2 L9 v
  30. #include <asm/io.h>
    / a  v" P( K0 E$ D4 G; _
  31. #include <linux/moduleparam.h>
      M: b. l4 [+ t. U% M
  32. #include <linux/sysctl.h>7 z2 L- h  }, W* d2 o
  33. #include <linux/mm.h>
    ! \2 p9 E0 h$ d
  34. #include <linux/dma-mapping.h>0 |% k2 h7 A8 `$ P; h' y* C1 v

  35. * s3 ~' u' Z0 D  L" p+ B  Y" [! [5 S
  36. #include <mach/memory.h>
    0 ^6 l% p) t" I2 [% r2 h0 E
  37. #include <mach/hardware.h>/ P1 r8 B. u8 C: }0 }' [
  38. #include <mach/irqs.h># d6 A. p* s4 m" |
  39. #include <asm/hardware/edma.h># c8 E1 f* u+ K- x: q, E4 ?5 z( G" W' [

  40. / a( f! A# N( o5 M9 n  Y% Q2 F( A
  41. #undef EDMA3_DEBUG
    * o0 m/ F  c" `7 D5 l7 _8 c7 N
  42. /*#define EDMA3_DEBUG*/! r2 \3 O0 u0 h* N8 c( A
  43. " D( H4 e, J5 r+ s
  44. #ifdef EDMA3_DEBUG
    5 P$ a  y+ Q- Y% ^. ?- J
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    6 b3 H: i; W& L1 _8 Z, |
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ) Z' P( t% _/ u  K) G) P
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& `$ e0 M% M; D# ^$ e* j4 j# ]
  48. #else
    5 l/ i. T3 g& \7 ~$ q: U
  49. #define DMA_PRINTK( x... )
    5 b- M5 P1 {1 D( m' ^! P; H
  50. #define DMA_FN_IN
    1 M* P% w6 B0 z/ g% U2 C3 U
  51. #define DMA_FN_OUT
    0 ?6 b* ^0 p0 h* Z2 c$ ?
  52. #endif6 b; p& A3 ^8 l6 l! C$ x1 L( J+ ~
  53. : p: U9 H, [8 Y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    % z# t1 R* t( X
  55. #define STATIC_SHIFT                36 m3 u1 N. `9 d
  56. #define TCINTEN_SHIFT               207 q4 Y& T" T. [: g2 B
  57. #define ITCINTEN_SHIFT              21, u' t& G1 c: W2 \
  58. #define TCCHEN_SHIFT                22
      U+ {- Y1 G& i3 T; }9 \4 V& E
  59. #define ITCCHEN_SHIFT               23/ z6 j4 n& \# d& }& `9 u( F
  60. ! t- u2 U3 F3 H, j/ W. K7 H( D6 {/ {
  61. static volatile int irqraised1 = 0;
    9 J' y  C( w- |
  62. static volatile int irqraised2 = 0;/ y: Q) _) v, F7 ]/ D3 i6 J
  63. - z/ }  S7 X5 J% j' ]% C
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 u( {: C  I% g4 E/ |
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 v" T) {; w! E9 j* ~, T; \
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; g6 m7 M; I, l+ ^

  67.   U3 E. P- O$ y6 p- @. }2 r. ~2 c8 S6 \
  68. dma_addr_t dmaphyssrc1 = 0;
    & T( X* H, Q* k9 l( Z
  69. dma_addr_t dmaphyssrc2 = 0;
    ! @/ ~3 Z# F" h& }& o$ {
  70. dma_addr_t dmaphysdest1 = 0;, {4 p  K" o/ I7 t) W
  71. dma_addr_t dmaphysdest2 = 0;
    1 J* [: H4 N7 [/ [5 O

  72. 6 _( M" R! s" z
  73. char *dmabufsrc1 = NULL;' v( A8 B- E; s/ L1 }+ F
  74. char *dmabufsrc2 = NULL;
    1 V: R5 ?3 X. S- s' K
  75. char *dmabufdest1 = NULL;
    / n' K  U5 N7 I, Y
  76. char *dmabufdest2 = NULL;7 \) P5 S  q7 {7 i0 z( M9 X
  77. 3 [: z/ `, r# X
  78. static int acnt = 512;% l) w0 S$ _, Y5 X$ _, v% G
  79. static int bcnt = 8;
    . {6 T$ O0 `( @& k- J" G
  80. static int ccnt = 8;. z: H" r: D: P  L, B
  81. 9 k* v8 H; _* A, }9 b
  82. module_param(acnt, int, S_IRUGO);4 a) S: W! m' V9 P! {# G
  83. module_param(bcnt, int, S_IRUGO);
    ' o7 m' s( L: Z* ], W2 D$ e
  84. module_param(ccnt, int, S_IRUGO);
复制代码
; z! I7 Y  R" d3 T  V: X1 s7 m
0 t9 p5 K; O# i( D- A/ p/ Z
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- a1 z  U) U5 t9 P+ k) G/ O  ^+ N% X. b
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
  x- T( ^8 Y% u" I2 T     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ I# T3 q8 }0 F
7 y$ H9 ]  X7 {- P! j0 r, j9 l# r) j7 J  _, n' _
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-6 02:30 , Processed in 0.046244 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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