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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 d8 n0 i) n8 ?
  1. [code]EDMA sample test application
    9 a/ A2 s' s2 U! n" K
  2. /*
    ( Y) t! x. \8 `) [( D$ m+ D" ]1 `3 [
  3. * edma_test.c4 [9 \; q, M- F4 b- S3 v' f
  4. *$ F3 f1 G$ M5 a( X
  5. * brief  EDMA3 Test Application
    ' O0 {6 I* P( ~+ O& s1 O1 w
  6. *7 ~1 f( i( O" w1 R9 U
  7. *   This file contains EDMA3 Test code.3 `8 X% z  J  T8 |. [5 Y
  8. *
    6 X) k) q- y9 K1 }3 R& t8 |
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 ~& X* A1 H7 s3 L
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    6 D. K- W& a3 I8 q5 Q  k# y
  11. *         TO CHANGE., {. Y* J  M6 E8 D# ]8 O
  12. *( {7 o' R, k) i+ [) B1 y$ d/ y# ~' m. @
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 \3 p9 p% ]8 l  l  y3 S: |% H  s
  14. *
    # c. e1 e. A# l' e1 V
  15. * This program is free software; you can redistribute it and/or
    3 k0 K, h$ q& x6 ?1 Q: ^
  16. * modify it under the terms of the GNU General Public License as
    " X: p+ a& Z6 X, b- {
  17. * published by the Free Software Foundation version 2.
    8 F, G2 G9 W3 U  Z  ~( W
  18. *+ i: X8 x5 b# |; y! c  e- S7 T% i
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any, `/ ~. I- U6 n* @
  20. * kind, whether express or implied; without even the implied warranty# N0 j+ J5 p8 H; z2 _
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the: R3 W9 |6 }. ~! p! i/ ^% B6 b
  22. * GNU General Public License for more details.3 a6 @! l; K4 T" j! F
  23. */
    ! r! J5 G5 B5 J9 e6 k0 u* v8 T

  24. 9 y9 M- |& X8 U# s' r9 i5 v, i
  25. #include <linux/module.h>; X4 v' J- t" U4 I
  26. #include <linux/init.h>
    $ b' h1 e5 B+ W% [& k9 {
  27. #include <linux/errno.h>; l8 c7 F6 v+ ?  v- P" d. \4 ^0 u) f
  28. #include <linux/types.h>
    " i7 |7 q( _; |; q. [
  29. #include <linux/interrupt.h>
    % V. Y  x" u! y4 i: D4 Q
  30. #include <asm/io.h>: M; d* J* |2 t4 \' q2 s5 S/ o
  31. #include <linux/moduleparam.h>
    ; I6 F' j) D9 I$ L
  32. #include <linux/sysctl.h>% B" |/ Y  C9 h2 d6 U- B
  33. #include <linux/mm.h>
    1 h+ _. `5 X- x; x: `( D
  34. #include <linux/dma-mapping.h>% N& M7 {2 e' n) g
  35. 5 B- _2 q; v6 C  y* s% I- e) P
  36. #include <mach/memory.h>
    ! d1 w. w. z* r
  37. #include <mach/hardware.h># g$ c4 Y- }5 G# B' `+ t
  38. #include <mach/irqs.h>$ b+ C/ h# k. m, [; a
  39. #include <asm/hardware/edma.h>: h! t$ G! \; }

  40. ; p8 _* j6 J, B! [! s6 a
  41. #undef EDMA3_DEBUG
    * C3 o" X4 d4 D/ B
  42. /*#define EDMA3_DEBUG*/8 G7 g+ u& v) R! G$ H9 T. d

  43. % n0 B4 C' Q9 m9 M& p7 w% Z6 x
  44. #ifdef EDMA3_DEBUG
    6 F3 t$ E# x% `5 ]" c
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ) L: i( w3 ^* Y! n3 Y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    # ^6 n4 y" O& T3 o7 J0 N
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 _! R: S% Q% D. G
  48. #else
    4 A# ^" @( Q) m1 O3 _/ E" W
  49. #define DMA_PRINTK( x... )
    ; _0 E$ f# b6 @6 Z- H; n
  50. #define DMA_FN_IN
    , Y; e+ l1 r* V
  51. #define DMA_FN_OUT
    5 s3 ^! K& A% A5 ]
  52. #endif: M. Y) G+ a' J+ \4 K

  53. : P, d+ z5 X1 m, C0 |2 [3 ?; I
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    : w- p  |1 d- M# F  w
  55. #define STATIC_SHIFT                3  W7 ]. b' j3 `) {# Z
  56. #define TCINTEN_SHIFT               20
    / S# |. h! E: ^* R% m, E
  57. #define ITCINTEN_SHIFT              21
    7 m+ w' j, v! E: E6 x% A
  58. #define TCCHEN_SHIFT                22" Q$ [& ~+ e! N# N" d
  59. #define ITCCHEN_SHIFT               23
    ! ~  T( M: U0 y& V1 C/ G

  60.   r( Y; }- o& {' r
  61. static volatile int irqraised1 = 0;8 Q* T) Q' [6 ?' w
  62. static volatile int irqraised2 = 0;4 f# C: H# Y5 Z
  63. 9 |' Y! }+ y- e; T0 n& x
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' L4 y/ ]- J. r; h: Q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! u" m, B, H* L$ @- J
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " ~) a% \: \2 G- @! g% h, o3 \

  67. 9 ~. R1 [9 z' [2 K
  68. dma_addr_t dmaphyssrc1 = 0;# Y& i4 Y- U: w
  69. dma_addr_t dmaphyssrc2 = 0;% |! X, ~7 R. i$ y2 Y- \2 C
  70. dma_addr_t dmaphysdest1 = 0;" j9 \9 r7 h% {1 f5 ~
  71. dma_addr_t dmaphysdest2 = 0;9 O2 j5 a0 i% I+ M( W9 \# }

  72. ( C: L7 S) }6 j' Q- \/ j
  73. char *dmabufsrc1 = NULL;# |  o. C# b9 f2 ^
  74. char *dmabufsrc2 = NULL;# N3 [" Q  {) G- A; B; G( z# `% I$ M
  75. char *dmabufdest1 = NULL;, m. z5 |4 s3 o; _& t
  76. char *dmabufdest2 = NULL;9 M0 _& s, A+ a; E8 b  I& p
  77. & x3 ^9 N) t/ T0 G5 ^) M
  78. static int acnt = 512;# i, e8 l" M7 t! o5 P6 W
  79. static int bcnt = 8;
    / Y9 [: v* O- L% x
  80. static int ccnt = 8;
    3 s" x7 I) Q! ^' O  p! o
  81. 6 b7 I8 {) r6 i3 }1 `6 I
  82. module_param(acnt, int, S_IRUGO);# y# S4 b" ?" |) V  H" v
  83. module_param(bcnt, int, S_IRUGO);, x5 i9 M6 U$ q: X
  84. module_param(ccnt, int, S_IRUGO);
复制代码

9 g, y) n! A7 h( c
, w0 _5 u+ i& _2 A/ D      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. ?5 T; S5 Z8 y2 ]& Q8 y0 Rarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( e( g: ^3 r0 `5 _0 S3 X* M     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 j$ J9 |7 J8 }# S6 e+ a
% u. p# F% `6 |

$ O, I6 E6 F$ [5 e6 n$ D+ o$ p
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-9-22 20:15 , Processed in 0.038611 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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