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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) I, i: W2 f* r& a2 o( @5 b6 R, a" [
  1. [code]EDMA sample test application
    1 }& M* W/ [* Y- C' b! [6 N4 x
  2. /*
    2 U+ k3 F. Z6 O9 w0 G7 A
  3. * edma_test.c
    1 P* L+ U+ m' i9 t* s; f) \4 w: A; ~
  4. *
    ! v, f2 j8 U9 T* \6 k& C& \
  5. * brief  EDMA3 Test Application
    ; r/ V# H( X0 z' ?" h
  6. *2 m5 B  u, B5 B  Y/ P
  7. *   This file contains EDMA3 Test code." T; N4 \, F" J3 \6 z
  8. *
    ' y. T# q" D/ _8 q  M- `2 x
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ' x3 r6 \, T% [- _9 A
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 f, g% p+ `) Q# U& A, v# U# I. y
  11. *         TO CHANGE.) K4 t$ v; _6 \9 Z1 b8 n
  12. *
    - H: P' Q+ {! R1 e" |/ M1 |: @" Y8 Z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    . z+ [" q7 t5 ^
  14. *
    8 Q6 p9 s- K0 N
  15. * This program is free software; you can redistribute it and/or
    5 m8 P4 j* f& C# O- e, A5 w. G
  16. * modify it under the terms of the GNU General Public License as
    * a7 f8 M) N8 U/ ?0 \: d
  17. * published by the Free Software Foundation version 2.
    , b- f7 r$ f( z- g+ `: q
  18. *. l4 v" U0 |# S( m+ i
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 ~$ Y8 g' K4 l6 |3 r" \$ F4 }
  20. * kind, whether express or implied; without even the implied warranty
    - L- {! \: o, w: ?, `! }
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    3 v$ l, @8 p6 h0 ^2 `
  22. * GNU General Public License for more details.
    * U- P/ D) S+ e$ z- l6 e
  23. */
    2 Y( l4 P. ?* C4 w# U( F( _
  24. . j& j' q- G  ~! y
  25. #include <linux/module.h>
    3 t, N/ D9 g- I# K1 g6 E
  26. #include <linux/init.h>
    1 {8 u3 P6 A0 U" F
  27. #include <linux/errno.h>. K6 ]2 b* O" ~0 w: ~2 H
  28. #include <linux/types.h>7 j5 {" u: r) S/ N$ u$ f
  29. #include <linux/interrupt.h>
    1 Z2 z- |+ n; e6 C4 Q0 H$ p
  30. #include <asm/io.h>9 T* P) o9 P' g/ [) U
  31. #include <linux/moduleparam.h>& G6 f3 L/ v# K; D% Q
  32. #include <linux/sysctl.h>
    1 @% X& T$ ]- U% J, m% q
  33. #include <linux/mm.h>
    6 M) R# `% B5 n# Q9 |2 w9 l8 X' w  m
  34. #include <linux/dma-mapping.h>8 G2 E$ _% c6 p6 o6 W

  35. 0 |2 a& k0 ~% G( }, j' w
  36. #include <mach/memory.h>$ F# o' V8 k0 @3 m% y
  37. #include <mach/hardware.h>9 ?3 O# d3 C) u% U% l: W' h# q7 [
  38. #include <mach/irqs.h>5 I/ r$ _# I8 O* W- i
  39. #include <asm/hardware/edma.h>
    : g  N) @8 a; u, [5 f9 _2 @6 @; g5 O

  40. & A, O$ b- D  ]  f8 K. s# E
  41. #undef EDMA3_DEBUG3 R+ H4 e* g0 m. s% p
  42. /*#define EDMA3_DEBUG*/
    ; Y7 q8 S+ M+ x% J

  43. ! h) s* E* [; l9 h6 H
  44. #ifdef EDMA3_DEBUG/ {0 {% X3 r+ o- [
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    3 X4 n+ y: Q0 a4 G$ s. E: I
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    : Q8 e# `: G+ g6 H& V2 ?5 Z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    + j9 {( q+ `' E0 ?8 E) y0 Y/ ~' Z+ v; u" [
  48. #else
    . ]/ B* {9 F  y( X2 \$ A8 L
  49. #define DMA_PRINTK( x... )
    ( h1 E; l8 h# s
  50. #define DMA_FN_IN: l3 e# E* p, ]/ C5 X
  51. #define DMA_FN_OUT+ E4 r' A/ W9 c
  52. #endif
    , ~2 [( v8 V, w! }! q; J; Y& W
  53. 6 f8 r/ s$ o7 |, i) x
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)$ C6 P" f- c/ \/ d1 `3 {% s
  55. #define STATIC_SHIFT                3+ z  ?$ m4 I- z9 ~* C  Q% ]2 n* E
  56. #define TCINTEN_SHIFT               20
    - l1 N: L+ l7 e5 C# ]" F  Y
  57. #define ITCINTEN_SHIFT              21
    5 E1 d) ]" z4 Q: K
  58. #define TCCHEN_SHIFT                22! i4 g+ L3 s% K) w
  59. #define ITCCHEN_SHIFT               233 w3 _# A8 q6 |) O
  60. 2 f4 T( y! f' k( v$ }+ f
  61. static volatile int irqraised1 = 0;
    9 t, U2 \" d( G, I+ M2 ?5 P
  62. static volatile int irqraised2 = 0;) E* ~. z% {0 n
  63. 3 j! H& D' j$ ]; C$ w) d! Q0 j5 x) Q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: r' n6 B* O6 q/ w0 p  I) A( S: i
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 F  N8 ^# B, O- G0 T( a+ B& o8 n
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 F# C1 H5 P, G: F
  67. 6 _0 I' p( K0 u4 ?# T
  68. dma_addr_t dmaphyssrc1 = 0;
    2 A6 o9 l  N/ w4 L- d. p
  69. dma_addr_t dmaphyssrc2 = 0;
    7 }; f: H% T. c: w  {7 ]* a& d8 p* Y
  70. dma_addr_t dmaphysdest1 = 0;! B& P2 z1 _$ `* g' L1 K. ?
  71. dma_addr_t dmaphysdest2 = 0;/ }' W6 |) X$ H. x

  72. . I( s+ V# O3 }# J
  73. char *dmabufsrc1 = NULL;3 m* o! V1 f0 F& t* l8 t
  74. char *dmabufsrc2 = NULL;
    * x* y' f0 {1 e# Q$ u
  75. char *dmabufdest1 = NULL;8 j! I! a8 X9 ?0 x6 z9 y0 s7 l
  76. char *dmabufdest2 = NULL;$ h% J+ }& d8 _" E6 N- E
  77. * r* S$ I, ~1 B1 h) ]
  78. static int acnt = 512;9 v9 j  `9 P( ^, y& r/ C7 P! \( n
  79. static int bcnt = 8;$ O& L' U" ^3 a' l$ V
  80. static int ccnt = 8;
    4 U3 E! R8 k& m! o  m4 J5 G

  81.   |: P7 }4 j! ^* ?0 V& N
  82. module_param(acnt, int, S_IRUGO);) n! q) _' A! i7 x3 l
  83. module_param(bcnt, int, S_IRUGO);+ u  O" u  ^2 c0 z- K/ z
  84. module_param(ccnt, int, S_IRUGO);
复制代码

, ~/ h. u9 B9 J1 y1 ]2 o3 }* j- @) r4 ]! I5 O! }
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) G' S: V. V: m- Uarm-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+ b) @& o# c
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ Q3 G+ I) |" K% i. ?7 s
) Y1 K  |+ X- [9 p  l' |5 _5 n- `- m! N7 b' o7 E
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-12 06:58 , Processed in 0.054025 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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