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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ R/ W7 Y- I9 k; R1 K% |8 p
  1. [code]EDMA sample test application
    8 r& n# I, y6 W2 Q
  2. /*+ l! ]( i" g' J
  3. * edma_test.c
    + [& R2 v) U% s' N7 m/ ^
  4. *
    9 t9 Z9 o) q7 S3 I! F  u, r  k
  5. * brief  EDMA3 Test Application* A& s1 P( p8 C
  6. ** k$ l+ C, R8 ?3 K: Y( W2 B, K
  7. *   This file contains EDMA3 Test code.
    , D5 _  R/ F0 h
  8. *
    9 `  r# A' m( C# Q4 [, M
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE6 y3 K3 @3 {/ q8 ]8 K; z
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    - k9 _, Z/ s  G# K9 P/ r9 C
  11. *         TO CHANGE.1 H& Q/ J$ x  k2 n; G7 n% F
  12. *% C% ^7 _0 k; b$ o& T; m
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 b9 U' o! t6 J: `' S2 z
  14. *
    ( s8 ^6 H- R0 `; P1 R
  15. * This program is free software; you can redistribute it and/or* g4 `* D) u! H, }7 l+ \. P2 F% S
  16. * modify it under the terms of the GNU General Public License as" N" N, Q  ?. O0 p# L* z2 f
  17. * published by the Free Software Foundation version 2.
    7 a: g; c; j" @& E8 [
  18. *
    9 Z' \. G0 `$ r; N/ A
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any* U; L* [+ Z0 F6 K9 `
  20. * kind, whether express or implied; without even the implied warranty
    . A" i0 F3 i5 L( S. ?7 R
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the: u+ t. l7 {: @( ]2 P  e
  22. * GNU General Public License for more details.' ?7 X! X, l1 s
  23. */
    , |; }" @3 W: X; S2 S2 D

  24. : R7 ~; f2 y0 G7 U
  25. #include <linux/module.h>* A  c  j- A" X, {7 u+ _
  26. #include <linux/init.h>& [2 c& T* F+ F9 i4 D% q) ?+ e* N
  27. #include <linux/errno.h># _8 Y1 o1 O# N/ k4 ?
  28. #include <linux/types.h>8 r' s: n5 }" x% ~$ m8 k0 Q) u
  29. #include <linux/interrupt.h>
    4 E# F' K6 Q# Q
  30. #include <asm/io.h>
    3 n, r, q8 W+ V; p+ B9 ?! K6 M5 O3 e) N
  31. #include <linux/moduleparam.h>; q4 D- b1 ^5 O% |8 c" J  o
  32. #include <linux/sysctl.h>3 |# n6 v9 h1 }, i
  33. #include <linux/mm.h>) M3 I# _0 Y: z; u! g' o- ~
  34. #include <linux/dma-mapping.h>
    ' M" F; i# K2 y5 J) ^& s

  35. ' g/ |# K5 u; q' f1 \4 z: \) A
  36. #include <mach/memory.h>
    ; b) c( ]7 b! {6 x: c
  37. #include <mach/hardware.h>5 U+ F& ?% a- c
  38. #include <mach/irqs.h>/ C9 k! w" ^3 l" p( n
  39. #include <asm/hardware/edma.h>
    3 T( h5 U# M9 l8 y- ^$ ^; [
  40. & ?! o! y3 @/ ~9 m- @
  41. #undef EDMA3_DEBUG
    0 z6 i9 {5 K, V4 g" Y
  42. /*#define EDMA3_DEBUG*/. g; `: L. P: ^+ W: t+ r

  43. $ F. E8 Z; z! C2 V3 y
  44. #ifdef EDMA3_DEBUG
    ) t0 G0 |7 |& m0 X- G8 U6 w
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); J1 ~7 N1 U9 Q
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)  z) Y5 K5 M& C3 I0 T; F+ F
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ' a0 Z8 X: Q/ t4 {
  48. #else( @( a0 R( Y7 m0 Z5 l! C6 P" H7 T
  49. #define DMA_PRINTK( x... )7 h. B4 B3 H. |5 F0 G
  50. #define DMA_FN_IN# F; P$ m6 R  G5 D' s
  51. #define DMA_FN_OUT
    6 s2 R% R4 d6 H  ^3 b2 A6 u
  52. #endif" g" P( B+ I6 a( Q1 A/ V3 Y% p8 C# l, W

  53. " [7 J5 H* I. f& S' E6 v
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    # E  I( X7 A( B  x* N
  55. #define STATIC_SHIFT                3" [6 Y- K9 k) w) B/ ?
  56. #define TCINTEN_SHIFT               20
    7 F; L" @, q: Q7 }
  57. #define ITCINTEN_SHIFT              21" |" e7 N- g" R; V/ h
  58. #define TCCHEN_SHIFT                22
    * H$ i. P" p* ]/ ^" @' U
  59. #define ITCCHEN_SHIFT               23& I6 X. ~* E7 {5 t

  60. ) |$ o0 m7 f  |0 r3 B, I6 y
  61. static volatile int irqraised1 = 0;
    5 u. z- C/ ]6 B/ h  Q- \
  62. static volatile int irqraised2 = 0;# a2 a- p8 J; v4 M: K

  63. $ q. ?$ c  s. d- C, a
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % ^) U% W) l/ i  L  W' W& U
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, X+ P) j4 o% k% n  C, _' N* e
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 C0 ^& R; A- X; N  n) F
  67. 5 ]. w: D+ b6 i- q. P. @; _
  68. dma_addr_t dmaphyssrc1 = 0;
    , Z4 W% U+ J1 q# G. B& b$ n
  69. dma_addr_t dmaphyssrc2 = 0;
    & f6 l/ M% |. x6 w- I* @
  70. dma_addr_t dmaphysdest1 = 0;
    3 [; C) H. b& n5 j& l
  71. dma_addr_t dmaphysdest2 = 0;0 ^* P3 @% y4 K% o

  72. 6 k4 v: J+ g3 w$ ~
  73. char *dmabufsrc1 = NULL;
    4 J% R0 k$ h8 f! `  p  J
  74. char *dmabufsrc2 = NULL;
    ' l9 y& B2 m% f! l. q0 Z/ E
  75. char *dmabufdest1 = NULL;
    " l  n/ }% o! P7 g! D. ~
  76. char *dmabufdest2 = NULL;
      B* V1 B. r$ o% \7 I

  77. ) B6 V' b! x. W4 v5 S( W
  78. static int acnt = 512;
    . @2 H1 P* Z. ]; W; n& P
  79. static int bcnt = 8;
    5 a$ U" }, e  A( e
  80. static int ccnt = 8;
    ( d. h; m* i. B% _1 ^
  81. 8 C) z: u+ g6 N
  82. module_param(acnt, int, S_IRUGO);# i# V8 k# e- l
  83. module_param(bcnt, int, S_IRUGO);6 c8 I# h5 g! ^$ h0 p
  84. module_param(ccnt, int, S_IRUGO);
复制代码

6 x$ `5 h; z/ u  |! K0 H
+ H: ]$ \. v1 c6 ?" g      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) o3 s/ N' Q8 g# aarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# k6 d) {8 V0 H4 g9 ?/ d' W
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 b- X& E: o: Z" l' s
/ }7 E5 I1 @$ U

' B; p$ z6 |: D# C/ y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-23 16:00 , Processed in 0.038524 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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