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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 k/ ~. l5 \# ~
  1. [code]EDMA sample test application' P: m: i9 B. ?- O, ]7 K) C2 j
  2. /*' a1 P$ x0 Q3 d. [! P, [" o: d  ]6 u2 ^
  3. * edma_test.c$ u* k- J7 T) @, W& Q) H/ f
  4. *
    ' C5 _# x) J3 t3 t  c: R
  5. * brief  EDMA3 Test Application# D7 e) z& {% Q- b; t2 a
  6. *
    ( c3 o. T8 v' X& t8 ^: x
  7. *   This file contains EDMA3 Test code.6 [0 y! z& t, U% D. s1 q
  8. *
    % j+ D. ]: g) Y4 {; s: Q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    # ^+ O. u/ c$ E- i) a7 j
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    9 E7 M, m- A! G* l! R. B4 @( J
  11. *         TO CHANGE." n0 _5 W5 f5 f9 b2 {0 B2 g$ D
  12. *3 Z6 {. G4 S" a/ l: e; k
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, n$ N- L' L6 k& Y
  14. *$ g6 ^, q, ~7 e" T' Q& X. |
  15. * This program is free software; you can redistribute it and/or7 W9 J$ B9 k2 `5 e" s
  16. * modify it under the terms of the GNU General Public License as
    $ N9 Q2 a0 F( c  ^4 @' Q# A) g0 J8 _* |! C
  17. * published by the Free Software Foundation version 2.; _3 _; w: |$ ^5 r/ m+ G
  18. *
    7 W; F' _4 P8 ~9 g: {* I1 x; K; P6 j
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    # \( l7 Z1 h) W* \/ B. \& G
  20. * kind, whether express or implied; without even the implied warranty' _. G, A) P4 D  S/ ~
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    / |5 b+ Q9 J9 _2 F8 r
  22. * GNU General Public License for more details.
    4 G7 R5 C) E% m! w( @! P9 a0 A
  23. */. E6 d) b( R1 Q( d- a  I4 B
  24. , ?- w: ^( G0 j, k
  25. #include <linux/module.h>  {4 z: `# w5 O( f. d9 ^$ o
  26. #include <linux/init.h>( u& R* S! G7 _
  27. #include <linux/errno.h>6 V) a% E, t$ y2 `* Q" _
  28. #include <linux/types.h>& v# K" Q* R: d3 x! P6 D. B8 t
  29. #include <linux/interrupt.h>
    2 M" v9 O+ ]: k9 d# Z3 F
  30. #include <asm/io.h>
    * A7 O9 n0 Z( s3 v
  31. #include <linux/moduleparam.h>6 p( X' O3 e, d) }" x$ P# B6 K$ |8 N
  32. #include <linux/sysctl.h>
    * ^1 X; N2 o. l2 q
  33. #include <linux/mm.h>
    # P+ n* [! K1 j8 w, ~0 `$ y
  34. #include <linux/dma-mapping.h>
    % V, r6 L3 ^: ^- h$ g+ S
  35. / v. ~8 P. @, `# C) Z
  36. #include <mach/memory.h>" L) t7 ^0 o6 p6 P* z: b+ f8 |
  37. #include <mach/hardware.h>3 d7 H, ]7 s& Q
  38. #include <mach/irqs.h>
    0 `3 L3 Q. G) T6 Y$ I
  39. #include <asm/hardware/edma.h>; E3 q* W. g( y+ c8 ~
  40. 8 B, }7 M5 `, `7 }% V0 X3 q* j
  41. #undef EDMA3_DEBUG
    0 [7 H# o; o6 o
  42. /*#define EDMA3_DEBUG*/
    3 L" e% r# _5 n0 E
  43. 6 o1 ~# ]) i; o! J
  44. #ifdef EDMA3_DEBUG+ i8 i' Z1 Y5 R' e& T$ @& p
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ' \4 |3 A1 C* N7 a, p4 }: T
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): w7 `* |1 e6 u: ]) N
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% ^& ^; W  W9 L7 U
  48. #else# Y+ t0 }1 P; d
  49. #define DMA_PRINTK( x... )
    * F% i4 O. S- Y1 `
  50. #define DMA_FN_IN
    - T# ]: }+ p/ B( Y- G$ Q& c
  51. #define DMA_FN_OUT
    6 u" D. G% k$ H) \! Z0 f
  52. #endif( g' _# x/ d- {) q1 u, l9 v

  53. 8 s( {. k1 \, V; _' s0 E
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    & l9 `- G0 b$ Q1 J1 u# ?9 b
  55. #define STATIC_SHIFT                3
    9 b, `4 s$ C  m% B/ w
  56. #define TCINTEN_SHIFT               208 Z1 i+ z) P* H8 n  y) T1 H0 U
  57. #define ITCINTEN_SHIFT              21; R5 H# P  _2 J5 A. c
  58. #define TCCHEN_SHIFT                22
    * @4 H1 [% W# p; U
  59. #define ITCCHEN_SHIFT               23/ T$ h6 b5 T$ q) y% a, e

  60. " ^3 _; j/ I0 B
  61. static volatile int irqraised1 = 0;1 F" |; C0 x* y+ i  b  Y) n9 S
  62. static volatile int irqraised2 = 0;9 ^7 g: ~- s4 f

  63. ) I( I9 P3 C' s4 b  m
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ o9 G3 k  V2 X9 v2 Z" [
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* W# T% k' `. Q1 r9 @6 M8 e
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 r; ]& o4 [0 M5 F
  67. % N" i2 ?, j9 ^3 w7 s2 f
  68. dma_addr_t dmaphyssrc1 = 0;
    3 E. h, Z4 P% A, t7 h0 q
  69. dma_addr_t dmaphyssrc2 = 0;4 l; c- [8 D3 {6 g$ p# S
  70. dma_addr_t dmaphysdest1 = 0;
    , W8 \4 r! V9 I1 X, g3 ?. w, H
  71. dma_addr_t dmaphysdest2 = 0;1 A' B' w4 l- u, M5 B! S: z
  72. ( e. j8 L/ ]0 U- `* F% v  B
  73. char *dmabufsrc1 = NULL;
    5 k  d2 N* y% Y; i' i* ^6 `
  74. char *dmabufsrc2 = NULL;
    : N; Y* u+ v9 v$ d
  75. char *dmabufdest1 = NULL;
      ?4 w, J% L$ {: {
  76. char *dmabufdest2 = NULL;
    ) T. B7 E9 l' Z+ Z4 c) a, y+ f

  77. # _: C; `, o% h# ^/ l
  78. static int acnt = 512;
    ( {; u+ T1 S( k7 e7 ]
  79. static int bcnt = 8;! Q: C# H. U- U+ O- F
  80. static int ccnt = 8;% _9 r) M, R+ [( u7 p* a
  81. 7 i( x& |8 t) {$ ]" _' q( S( g6 A
  82. module_param(acnt, int, S_IRUGO);0 `: t0 h- h3 Q2 u: {/ `% `
  83. module_param(bcnt, int, S_IRUGO);
    0 o6 C& Y" e( O$ r( v5 B
  84. module_param(ccnt, int, S_IRUGO);
复制代码
! j6 h+ P+ o7 Z9 W2 L
" x4 N3 v; q' T+ W; H8 t
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. E" M5 A' s( t3 earm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ _, L5 o* G& B3 h' _0 m- _* u     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ s' j, ?$ G2 ^& W3 J" s
6 A8 q. J, H1 G; Y

0 A3 T9 O) Z1 H! P8 l3 z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-6-16 10:13 , Processed in 0.042172 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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