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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! z) ]+ l* |/ p
  1. [code]EDMA sample test application3 z7 [3 g, f: X5 A
  2. /*
    3 z2 f4 q6 x5 G. V- x
  3. * edma_test.c
    $ f. b/ X# ~% G+ T: Q4 T
  4. *; I8 s" p" c' N2 ^
  5. * brief  EDMA3 Test Application! K. G6 M; T' K6 y" I5 h
  6. *
    $ K' J3 W/ z( H
  7. *   This file contains EDMA3 Test code.* L8 f" l) n; @, w. Y, K0 N+ G) @! v
  8. *& K, h1 P' q% L' x2 q4 U% g
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: P( k: I! T" E, T, r
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    / P$ |9 f/ Q" t' {9 T# R7 Z+ F( h
  11. *         TO CHANGE.
    % U0 M* `( d/ S* L, @0 a
  12. *
    : X  e* v  P: y& ?6 o8 {
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 o9 Q  ?6 O! ]3 {) g
  14. *
    ; h/ E/ z8 e9 W- Y9 i4 Q
  15. * This program is free software; you can redistribute it and/or. e/ O& ~) S% H; v( Z0 P
  16. * modify it under the terms of the GNU General Public License as% ]! ~* a7 d& c; V- v' ^7 d
  17. * published by the Free Software Foundation version 2.: F9 N9 B+ b: o& D9 N
  18. *# a( x- L+ A2 u" X% t
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any( H! F3 K% \+ Y% n7 n! i
  20. * kind, whether express or implied; without even the implied warranty! i) l! D' J: k6 x5 X8 T5 z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1 [- ~' I% K" z( {
  22. * GNU General Public License for more details.
    * h5 E. \' ]. A6 X2 [' t2 l
  23. */
      N% _. `4 K5 R3 T0 A( M& G

  24. ' @' t4 r9 ]* L# o2 b: m2 ?& F8 ?
  25. #include <linux/module.h>
    / ^  D& c4 b1 c. V8 B
  26. #include <linux/init.h>$ K, {3 f; s9 ^8 U: G4 \+ [: {
  27. #include <linux/errno.h>
    6 M# R$ `) Y( ]' @8 e
  28. #include <linux/types.h>
    " X: q1 E2 Z; h; Q# _/ A
  29. #include <linux/interrupt.h>+ Y2 P5 |. w" L5 {% p2 y
  30. #include <asm/io.h>7 S$ X1 e7 U/ [
  31. #include <linux/moduleparam.h>+ [5 @0 R$ ~5 Y9 {' X8 x4 K, b
  32. #include <linux/sysctl.h>$ f6 V4 ^1 N( \3 J  z
  33. #include <linux/mm.h>& d) z+ u6 i8 d" U3 G
  34. #include <linux/dma-mapping.h>
    9 N0 Q7 r  R, O8 J/ S2 q, E

  35. 5 i9 F  W5 R5 _5 m9 x
  36. #include <mach/memory.h>
      |; i: Z0 A& a7 i  S1 A
  37. #include <mach/hardware.h>
    3 F; D. ^; g' c/ r
  38. #include <mach/irqs.h>
    6 ?. W6 i% [$ v* w
  39. #include <asm/hardware/edma.h>4 z( o8 j8 f: n  L+ m9 y

  40. 7 j6 Z# t2 }6 h) M! o
  41. #undef EDMA3_DEBUG3 b. k* F# P. Z' q- U, Z3 I
  42. /*#define EDMA3_DEBUG*/
    6 e# J6 U$ W6 k1 f2 q- Q1 _
  43. # p( M6 M7 i, Q1 M7 E3 W' l  k
  44. #ifdef EDMA3_DEBUG
    7 W. k- y$ A9 L) |, q$ r
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    1 A7 g7 e- s5 E
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ {+ o) P3 R3 N2 x6 A/ D- g' l
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 [# T2 ^6 `6 c9 r0 I; ^2 ^, `7 u
  48. #else1 l! b+ I) a! `2 e. `
  49. #define DMA_PRINTK( x... )4 ^2 L, v; K5 |
  50. #define DMA_FN_IN% E2 s# J  z1 j4 f1 S, \
  51. #define DMA_FN_OUT
    : \7 e7 @5 O. A6 e) c* B
  52. #endif/ P' w6 i6 {2 K1 O

  53. ( c: `$ |  Z5 R  T' f0 V2 r5 {
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)# s/ Y% a8 l3 v" U. w' d; W4 }
  55. #define STATIC_SHIFT                3
    $ ?3 c. s5 V% D
  56. #define TCINTEN_SHIFT               20
    4 d0 Y8 d& ?( W  d6 _
  57. #define ITCINTEN_SHIFT              21
    & c+ H0 ?  H/ y7 g7 }& X8 Q
  58. #define TCCHEN_SHIFT                22; A1 Q# B8 e  }) P" R$ h
  59. #define ITCCHEN_SHIFT               23
    + o7 @$ l: M; Y
  60. : I$ G  B6 j5 p( @% n& [+ K3 D2 V
  61. static volatile int irqraised1 = 0;
    2 o. O+ q6 n8 d3 Q" R
  62. static volatile int irqraised2 = 0;: ]5 k% `" l5 d; V/ A2 ?

  63. $ g3 I* |3 b5 N2 x2 \
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* z) b% `$ x4 V
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 d% {# U+ R0 z% M, H+ B! `
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 o6 h( k/ m7 w3 }6 L, u0 K4 D
  67. # J: E: u* O/ B; v% N
  68. dma_addr_t dmaphyssrc1 = 0;
    ; H- U* B# v* O5 N& i- G3 J: D3 @
  69. dma_addr_t dmaphyssrc2 = 0;
    5 A1 x6 D" I! W
  70. dma_addr_t dmaphysdest1 = 0;
    / x/ P- h7 ?/ d0 `
  71. dma_addr_t dmaphysdest2 = 0;! k2 m7 ]( T4 z6 Y

  72. 7 z: ~: g- Y6 p( ]- o+ ?: c
  73. char *dmabufsrc1 = NULL;9 t4 L! P4 t, Q! [8 Q! R5 \
  74. char *dmabufsrc2 = NULL;# P8 r- x9 i& N4 c8 x7 \" I
  75. char *dmabufdest1 = NULL;
    $ J$ x; s1 ^; [2 `9 h! X" D  ]4 d! ~
  76. char *dmabufdest2 = NULL;+ T& {1 l1 G6 j8 Q9 q2 y
  77. * K3 Y4 d. m3 C" G
  78. static int acnt = 512;
    / }9 T: z6 r4 D
  79. static int bcnt = 8;
    ! t4 a1 ~4 Q8 T6 ?
  80. static int ccnt = 8;
    % N* j' b' \0 S
  81. + ^8 V; P+ R4 A1 r
  82. module_param(acnt, int, S_IRUGO);
    . p' @  T0 z8 k8 V6 i9 C  \
  83. module_param(bcnt, int, S_IRUGO);
    ! D' H: v8 p# G+ x2 r# l
  84. module_param(ccnt, int, S_IRUGO);
复制代码

% H% w0 t5 y0 w3 m( h8 i# l" R5 F# ~7 ^% I$ i: e/ L2 D9 Z
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. L$ ^+ ~& q  I7 g" \, s/ Zarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- H. {$ W4 M: L0 S" [1 ?     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# p# a/ n7 ]! Q! J9 Q
4 E  |4 g0 h/ `* g" q+ s) u* _8 g9 e0 Z6 v
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-20 22:43 , Processed in 0.041415 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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