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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , e& `3 O- d8 L) b: z
  1. [code]EDMA sample test application
    3 p4 V, s- U6 T& R) e
  2. /*0 K! Y  ~7 X3 Q% n
  3. * edma_test.c) V1 F3 N+ l4 m- l" D9 Y
  4. *
    % y9 e7 K2 O3 i) }5 B* N( ~' t
  5. * brief  EDMA3 Test Application
    0 m# ]1 \# l. F  @+ I  i
  6. *
    ) H. L: v, B; f( J
  7. *   This file contains EDMA3 Test code.: W4 s; h' g) R( j/ i
  8. *0 q5 @3 f+ i& _* d
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% N2 @) ~3 m4 B6 B: o4 O8 ^
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 D3 I! g1 t$ R0 h
  11. *         TO CHANGE.
    1 h, o* I9 e7 j: K! v( v) x
  12. *7 |/ D2 B2 ~9 B
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    / `6 D: @3 e1 |9 W2 F4 E7 E
  14. *
    0 {# H# X8 x: ^' C  \, V
  15. * This program is free software; you can redistribute it and/or" Z; c# n6 m; r& o: w$ |
  16. * modify it under the terms of the GNU General Public License as. K7 W0 E$ d. e3 v, B$ ~
  17. * published by the Free Software Foundation version 2.
    ' C! V% H7 c, H
  18. *  r& k( T6 M' o9 P, }2 @+ X
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    $ J3 [* t5 v- K1 L1 a7 K) G
  20. * kind, whether express or implied; without even the implied warranty
    . m9 S6 E) G: G
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the7 V- E' B" q2 s8 `$ L3 O% e2 O
  22. * GNU General Public License for more details.' t% x4 o. [# d: C
  23. */
    4 a4 H% D  x8 a5 T
  24. : J' \2 b! b$ r# Q% z' H( R
  25. #include <linux/module.h>& s6 _3 X8 C# Z. o. x
  26. #include <linux/init.h>
    5 o) r+ [2 z2 W# @3 r, k+ |
  27. #include <linux/errno.h>5 j* L+ E7 u1 w' w4 @
  28. #include <linux/types.h>. Q& F$ b. k, K$ k. |8 ?" l1 ?
  29. #include <linux/interrupt.h>9 d" R3 _6 A+ f! ?2 I
  30. #include <asm/io.h>9 R. E1 O) d6 S% z3 @& ?9 y
  31. #include <linux/moduleparam.h>
    / h3 {5 i1 _3 M2 B6 n+ S9 T1 P
  32. #include <linux/sysctl.h>1 B4 v4 s4 @% H
  33. #include <linux/mm.h>2 Z; J) U- n5 O
  34. #include <linux/dma-mapping.h>
    7 i0 }$ W  F+ \; i0 e

  35. . m/ U; e1 z% ]* z( N, T) n
  36. #include <mach/memory.h>
    + ^4 U+ O; q+ L- g" ^( P
  37. #include <mach/hardware.h>3 c* ]7 Q7 I) r- j- G' b4 Y. U
  38. #include <mach/irqs.h># N" n4 _% K. E2 E- p& c/ ^2 ?
  39. #include <asm/hardware/edma.h>
    2 G: M9 S9 Q6 Z; C# n

  40. 6 T& c: C* ^4 H9 y
  41. #undef EDMA3_DEBUG
    8 r1 z0 N' i' C+ D% b
  42. /*#define EDMA3_DEBUG*/
    % Q) B# D$ y! E0 E5 z
  43. 2 ~1 B8 _, W' n" r2 Y
  44. #ifdef EDMA3_DEBUG
    5 S8 \2 u: D0 y  X1 r
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ( Q* S" O. ^' b$ e, i7 r( ~" `0 A
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    , V, v6 ^' {* G
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    + Q. a* U" [; l9 I" F: g
  48. #else
    * E6 J. Q' d9 L* E4 |. e6 u. l
  49. #define DMA_PRINTK( x... )9 u4 [- `1 p: s) s6 X# N
  50. #define DMA_FN_IN7 j  i) F. o! w( f7 |' U
  51. #define DMA_FN_OUT
    " a8 O; t% K8 Y: v. u) x
  52. #endif6 Z$ l! W5 ^" T: F! q

  53. - C' r- t2 Q' C! @5 @2 E
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)$ r: Q: c: R' Q. o0 b# x
  55. #define STATIC_SHIFT                3
    6 d% e* ]6 e: e; F
  56. #define TCINTEN_SHIFT               20- E: B/ g( _( e! U' Y
  57. #define ITCINTEN_SHIFT              21
    : C" s6 v* d' k0 w
  58. #define TCCHEN_SHIFT                22
    ( K# B+ c8 H# C9 c
  59. #define ITCCHEN_SHIFT               23
    + W/ {: X$ f/ X2 z  J. C

  60. 0 V8 K* n/ U6 e9 z6 C
  61. static volatile int irqraised1 = 0;# G6 v- f& d  w! a
  62. static volatile int irqraised2 = 0;& a9 }/ P% q: _' w5 W

  63. ( Z0 R! r! e' Q" b3 n' G
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' Y7 Q% @5 I/ L0 k# t1 m
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" E$ v6 X3 [1 C( z% X: T# G6 Q
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' j7 j) ?: b' c. c4 F% W
  67. 0 @$ {, I- j6 ?, A2 r
  68. dma_addr_t dmaphyssrc1 = 0;
    ' ?' A- R8 ?( x4 k2 M  D
  69. dma_addr_t dmaphyssrc2 = 0;
    , i: s" s' v" a! b* A- T) M
  70. dma_addr_t dmaphysdest1 = 0;
    + K4 D) }% c2 u
  71. dma_addr_t dmaphysdest2 = 0;
    4 P3 q3 ~/ z4 U( K2 j- F
  72. % F. g% G0 n# E: p4 J. t
  73. char *dmabufsrc1 = NULL;; Q% r9 d4 e: d* n3 G3 p7 R
  74. char *dmabufsrc2 = NULL;
      z! K. d" s- I( |# o' S7 ]
  75. char *dmabufdest1 = NULL;
    + O! i9 B) S5 T% Y$ U7 P
  76. char *dmabufdest2 = NULL;
    ' Z" X3 |) N0 ]6 g  `' I2 ^
  77. , c5 Y. f7 O# n
  78. static int acnt = 512;6 J/ j' N7 C( A" s
  79. static int bcnt = 8;
    9 e1 i; J/ N% s5 A* t
  80. static int ccnt = 8;* U" w% B5 y' i$ v7 X
  81. 5 ^  {' n2 r: o, w: ~
  82. module_param(acnt, int, S_IRUGO);
    ! A! w: m9 O. I  ~5 f. C
  83. module_param(bcnt, int, S_IRUGO);
    * y, L  a. U& W
  84. module_param(ccnt, int, S_IRUGO);
复制代码

- Z& {% v" ^& y2 G) H7 _1 ?" k+ x, l0 m2 G8 v' T9 o# B
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# }% I/ r" @4 D$ T$ D
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! F  q1 q, z! r# j; W
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 k$ I7 p% P5 T- _
( L6 ?: H. }6 H% E& A$ a* R2 R- E0 g+ T; [6 s) S, L
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-9 20:43 , Processed in 0.041874 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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