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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 X1 C. u6 \5 Y7 I
  1. [code]EDMA sample test application
    $ u9 _1 T  e& p& L  j9 h" u
  2. /*
    8 d9 l% _( f& D( {2 l
  3. * edma_test.c
    % z1 g- _5 y3 {( `+ W
  4. *$ {  v! c1 [9 W
  5. * brief  EDMA3 Test Application
    ( ?3 u1 T- p5 g3 e$ Q- O( R
  6. *
    ; D% [  e! ~/ z9 Z' L. m
  7. *   This file contains EDMA3 Test code." F2 N! {: G6 k9 s& V; C, m
  8. *# F4 m4 \, Q, \! ?6 L  Y
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& C9 {7 L! d; l2 K9 H- l
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; n5 {; H; U9 q6 a5 w- s
  11. *         TO CHANGE.
    . |% T' `5 x+ W
  12. *' d8 j5 V$ `% h  b
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    4 Y1 V, f# u# h0 v% @# v8 y& A5 {" \  E
  14. *# @7 G3 l+ H% v, u+ Q
  15. * This program is free software; you can redistribute it and/or
    # Q1 C! ^9 r, k4 d& T- a* d
  16. * modify it under the terms of the GNU General Public License as
    ( P' F' U7 W  Y( F
  17. * published by the Free Software Foundation version 2.
    1 s3 D) t9 p1 y- T3 y
  18. *
      f. r  @8 h2 Z0 w+ R9 j, [
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    : |2 b2 B/ _; O/ G6 x
  20. * kind, whether express or implied; without even the implied warranty- w& z  \; q) g- E
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ; f# d4 O& c7 U4 N
  22. * GNU General Public License for more details.
    , m( Y$ p* h5 q+ v! `  R
  23. */3 r# \) p/ e- Q7 J5 f. S  `
  24. * r1 O2 y, l1 A  P8 x
  25. #include <linux/module.h>
    : c3 j6 i1 I. O
  26. #include <linux/init.h>
    " O1 H' S; d6 v& {+ a
  27. #include <linux/errno.h>1 C# R2 f3 m9 n2 T+ U
  28. #include <linux/types.h>3 ~% v7 T/ E; x9 v! n" V
  29. #include <linux/interrupt.h>
    3 s3 H" F: H3 ?2 k/ v  S4 g" X
  30. #include <asm/io.h>$ K, V; S' q3 G( {5 O" N
  31. #include <linux/moduleparam.h>* }6 q# b7 d8 l, v! T
  32. #include <linux/sysctl.h>8 s+ a* w4 b  E+ t, V4 d
  33. #include <linux/mm.h>  S% y% N! a8 Z
  34. #include <linux/dma-mapping.h>
    & s2 y" H- w% H7 h0 j. }
  35. 6 M- r, a! [8 q) c5 P  X
  36. #include <mach/memory.h>% i# ]& Q3 L+ M4 K/ c1 \
  37. #include <mach/hardware.h>
    * G% r- q% ?" ~9 v
  38. #include <mach/irqs.h>
    4 s5 l) [2 Y% p7 a7 O9 K# r
  39. #include <asm/hardware/edma.h>8 y0 s  w- |! ]9 F7 l; M2 B; [% [
  40. 1 r. g2 x$ O/ V2 K, i+ H
  41. #undef EDMA3_DEBUG# D5 b; \$ p. E& t- M7 N( n
  42. /*#define EDMA3_DEBUG*/7 F4 _: Q1 ]4 A, s' Z  R8 h
  43. 3 W) {0 B; }  }6 c+ ~% Z2 ^9 ~0 S
  44. #ifdef EDMA3_DEBUG! A, a! c3 ^& w  f; G6 a. A4 u
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    " b6 a( T, J5 @7 e* P) u2 f5 L
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' W3 S7 F8 X$ q+ T9 T/ d6 @, G
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 `) g3 s# ?' R
  48. #else
      T& E8 }0 F9 k
  49. #define DMA_PRINTK( x... )
    1 G" P4 a% i, K, t. y2 |. ?
  50. #define DMA_FN_IN8 i1 d  U; ^. \/ `
  51. #define DMA_FN_OUT5 V( b8 ?: U" U! k
  52. #endif: `! M. b; l0 K  X/ l
  53. 8 R9 l) p( K6 H9 B7 S& N( Q) ^" S
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)8 t; ~! A' v+ b! y; G
  55. #define STATIC_SHIFT                3, b1 b$ I$ B* I+ o
  56. #define TCINTEN_SHIFT               20
    7 f5 O" R2 b( r  E& P" d
  57. #define ITCINTEN_SHIFT              215 V) v1 `0 N$ k$ ~& C
  58. #define TCCHEN_SHIFT                22
    " g, W3 _* J, L2 M8 O$ s
  59. #define ITCCHEN_SHIFT               23
    ; G& ~0 H% z" N4 U7 p5 j1 R
  60. / j" c$ ], S; j) Z! q0 s7 F
  61. static volatile int irqraised1 = 0;
    5 s: P( p4 ]" Y* s' N2 M- u, w2 O/ i
  62. static volatile int irqraised2 = 0;( e6 e; ?" |* e0 C2 p
  63. $ m- R; `2 R) o; C8 d
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) g$ W0 t8 K5 {
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # Y5 Z, ~! D- `  t6 E+ K# P. D
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; G# I4 T: \; o7 O5 V/ u! a

  67. 2 M; q3 I+ Y6 c% _& i! G
  68. dma_addr_t dmaphyssrc1 = 0;
    ' B- P4 u1 ?' Q. \9 k$ `
  69. dma_addr_t dmaphyssrc2 = 0;
    # L( t! S/ a5 s* W+ _6 ^% {
  70. dma_addr_t dmaphysdest1 = 0;
    + [0 @6 g& p; t+ ^3 n# i* c
  71. dma_addr_t dmaphysdest2 = 0;  Y- a6 _4 e$ W- I" Y

  72. 1 T4 x/ I. V; ~( H( z
  73. char *dmabufsrc1 = NULL;4 Q4 A# i; O! M# @3 Q' z. ~
  74. char *dmabufsrc2 = NULL;
    7 s8 s! o& i, a
  75. char *dmabufdest1 = NULL;
    - f0 |) Z; {9 m- n1 D: q8 I
  76. char *dmabufdest2 = NULL;: c+ |. O# R, `; W8 {" x3 N

  77. ; x. V6 \" ?3 w$ v  H
  78. static int acnt = 512;
    " ]6 s, i0 E8 v& i' J
  79. static int bcnt = 8;/ P' P% n) T, b" w# i0 N7 d' ?* r, N
  80. static int ccnt = 8;
    , K% [/ Y3 r7 N, g$ e: ]$ N, p) I6 J
  81. / ]8 o& T5 f5 Y; l" `9 |
  82. module_param(acnt, int, S_IRUGO);$ m9 m6 |9 i5 y& Z
  83. module_param(bcnt, int, S_IRUGO);+ R! z; c% \5 T3 X. f1 c3 X3 A
  84. module_param(ccnt, int, S_IRUGO);
复制代码

, S# S, t* ?% j( h# A* b+ q; A; d) A+ A0 l( Q- }1 I9 ?
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 ^/ ?4 M0 b- Iarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( l% ^( X# a, F4 U3 r3 |     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) p; _- z: ^9 r7 J/ s8 p. K

6 i8 d  T0 C6 B1 i2 r0 k2 _, N$ u: l4 i" ^
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-23 02:31 , Processed in 0.035830 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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