OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
  y9 U2 F$ j% K% j5 x
  1. [code]EDMA sample test application% W2 L- u+ u* u2 X: V& R. K
  2. /*" }5 i9 }# v, D
  3. * edma_test.c0 X% B# v) X2 A0 A7 Q4 }
  4. *
    # f. \& c; m  b" Y: w
  5. * brief  EDMA3 Test Application" ?: W# h6 F9 v. `. {! e
  6. *
    * }" ]1 S0 q$ y* T: D
  7. *   This file contains EDMA3 Test code.) l# O" w- `0 N3 [/ Z% p  g
  8. *
    $ ]2 @6 C2 \/ [0 L; i# o
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: M1 {3 J) l: W$ s3 g5 A
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ! B+ w/ r1 ^$ _, ~9 {- \
  11. *         TO CHANGE.
    ) e/ g: d! N  r( [6 K
  12. *
    , K9 b/ X+ B# N4 H3 e# t
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    5 Y/ `- S4 Y$ v- ^% C' ]
  14. *: ]/ O# B( _9 N/ N# D
  15. * This program is free software; you can redistribute it and/or, B' t! S7 \" P. K
  16. * modify it under the terms of the GNU General Public License as
    / y: r  m! i: f4 D1 J) ~
  17. * published by the Free Software Foundation version 2.1 v0 F& t, C8 D# F; n/ T
  18. *
    $ `% k# |4 ]( h2 a
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 c! @" x: e! p0 t
  20. * kind, whether express or implied; without even the implied warranty5 z0 _" x6 z! h0 `7 S
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the$ o9 _: j4 R! C  y( _! ~
  22. * GNU General Public License for more details.
    1 W* A3 A2 {; _( C; S9 _/ n, e
  23. */
    2 k( ~( R- E: O& i$ p* W" ?
  24. 1 |* @" H, @3 e4 @- F+ _, r
  25. #include <linux/module.h>  v* X+ V* m$ W1 l, f2 s
  26. #include <linux/init.h>
    : a) N; h4 |# a8 h2 g$ G
  27. #include <linux/errno.h>
    ' [) g4 N, m, w7 H3 p7 W+ r& Z
  28. #include <linux/types.h>5 N" O+ U7 S8 @
  29. #include <linux/interrupt.h>! ?# ]3 H, K  o4 w% @4 \
  30. #include <asm/io.h>- V) _' B  ^; h
  31. #include <linux/moduleparam.h>2 }7 }4 B9 d. K0 i7 ~+ ~
  32. #include <linux/sysctl.h>7 p9 d, f) d* h6 Z1 i0 n
  33. #include <linux/mm.h>- o# p: `& A, e0 O# q
  34. #include <linux/dma-mapping.h>
    8 {( x( l4 R. Q5 K% u
  35. 8 N, ~8 G. J- p6 P
  36. #include <mach/memory.h>8 w) l1 ^- n0 K  o
  37. #include <mach/hardware.h>
    2 i+ R# J& u  d+ h0 \4 a
  38. #include <mach/irqs.h>' s# v. }9 \( l, Z9 o* }. S
  39. #include <asm/hardware/edma.h>
    1 B5 }1 F% F* V2 l" ^; U: E

  40. * @* E* b. o2 `2 Y% _/ h- E# V7 J
  41. #undef EDMA3_DEBUG7 x) [0 X+ d1 S! g
  42. /*#define EDMA3_DEBUG*/7 ]) }2 ~( k0 L. w: |# `: D5 N
  43. 5 s! H% N2 y# v% e" o
  44. #ifdef EDMA3_DEBUG
    9 G' [" @" C4 q4 C0 X+ N
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ) S: M8 i- R) c
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( y& ~! @2 R6 W1 h! [' r7 i
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- I% G1 y9 S4 @
  48. #else
    , m% X* A/ X6 q& O- O/ @
  49. #define DMA_PRINTK( x... )- i% {: g# S. Z+ H3 d' P
  50. #define DMA_FN_IN1 k) C- \* x4 z; y7 n/ o4 B" I
  51. #define DMA_FN_OUT2 i$ w& U% q* `- ?- `, G; s6 m
  52. #endif
    4 b8 m1 t) X8 J, L0 Z6 E
  53. $ l2 F2 j5 j# O& j/ ^6 }5 R3 P, [
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    + L$ x5 m3 E) _. M0 X
  55. #define STATIC_SHIFT                3% R5 W' c1 F) S5 h7 T' @
  56. #define TCINTEN_SHIFT               20" }4 y! ~; w, ]. D* x$ |
  57. #define ITCINTEN_SHIFT              21" |# i" V9 Y* a, s
  58. #define TCCHEN_SHIFT                22/ V( q# {6 {8 ^% b& Q
  59. #define ITCCHEN_SHIFT               23
    . x; u8 P6 v3 \) q

  60. " B8 ^7 n: E$ x% M4 I6 [
  61. static volatile int irqraised1 = 0;% Q, i, k' G3 C: @; c2 L
  62. static volatile int irqraised2 = 0;
    9 O3 V2 ~/ i, c7 V- C
  63. 0 J+ R, y0 b% C! l* a* ^+ ^) ~
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( m5 R+ {2 y* _! O6 Y1 L* s" f
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " U! E- \' ~: E* w( `* G
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ q5 x5 r2 A( \& V8 d3 }* P

  67. 5 ?8 ~( p7 D9 \2 b8 ~
  68. dma_addr_t dmaphyssrc1 = 0;
    ) J* Y5 S9 A5 Z( B% m) a
  69. dma_addr_t dmaphyssrc2 = 0;
    7 p) F6 d  J; d5 O$ T5 L! e' u, I
  70. dma_addr_t dmaphysdest1 = 0;
    8 w, E! Z( c0 z5 t' n% [5 T
  71. dma_addr_t dmaphysdest2 = 0;
    4 S) y& W: j: O6 ^

  72. 4 h5 t. F. C; f, K/ V
  73. char *dmabufsrc1 = NULL;
    " Q1 c0 w5 p* j" u5 J/ |/ K% m
  74. char *dmabufsrc2 = NULL;
    + }% v# O, a2 b
  75. char *dmabufdest1 = NULL;
    + C  S2 _' [' n: q! [4 V/ q
  76. char *dmabufdest2 = NULL;$ Q* T% B  _/ V2 @9 u
  77. : m0 r) J( e' e- E7 e% P2 q
  78. static int acnt = 512;7 E* ]3 L) D3 w. p5 s2 O- R
  79. static int bcnt = 8;
    7 b+ U# S; P4 F2 i
  80. static int ccnt = 8;
    ) _3 L  }3 x2 M8 v* r; A7 i4 \1 B* ~
  81. 3 Z9 R2 B' A9 X7 n
  82. module_param(acnt, int, S_IRUGO);
    9 ?( ~* b, v- s# G
  83. module_param(bcnt, int, S_IRUGO);8 x$ d, q3 q3 M" `; F! j; R
  84. module_param(ccnt, int, S_IRUGO);
复制代码

3 Z% x0 j* U4 J! j+ ~) b% o
' f& ^3 ?+ ?/ ?1 j1 {* _+ @& q      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, X- v- W: v4 e# o4 A( ^
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
: W% W% n3 y. a7 P     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% {- q3 v' u6 k9 Q8 M6 V9 a$ b3 ^; f! i( L, |* G
7 I1 o$ Z5 Q7 w# Z! O0 J3 L" M
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-23 03:58 , Processed in 0.045240 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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