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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % \( U: o# k: X
  1. [code]EDMA sample test application
    ' N) S& R+ W. |* f4 T
  2. /*, B% L. u/ |! `) v+ [, N4 q% W
  3. * edma_test.c
    5 ~2 i4 M3 j3 A( l8 S) c
  4. *
    6 \2 w1 d: D  \/ A! w. d3 }
  5. * brief  EDMA3 Test Application% ^1 x* I8 w& a' m
  6. *
    1 L4 \: a9 b* G2 w) P! b; P
  7. *   This file contains EDMA3 Test code.
    0 ?7 }: v0 ]* n! ~; P% o
  8. *+ O4 a, |' u* \" z& E
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    6 {! N$ _! N4 i' r1 _+ C
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* H6 i/ W" `8 ?  G
  11. *         TO CHANGE.
    : q7 K; W7 L, l# c
  12. *7 h3 _" ?% H0 m
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    , p0 Y9 H/ f* `
  14. *1 k) @( w$ O0 q" K& ]
  15. * This program is free software; you can redistribute it and/or
    : i9 `0 Z5 }; Y( n
  16. * modify it under the terms of the GNU General Public License as
    - H3 ^2 L$ @! ^7 J. X
  17. * published by the Free Software Foundation version 2.
    / M" _' \; H& Z2 P% [% t& v
  18. *
    8 Z6 E) I$ ~) `3 p0 W5 E/ W' {
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    0 W; s8 B6 D* E; z5 Z( M* A& G
  20. * kind, whether express or implied; without even the implied warranty
    % F  b9 r7 ]2 ~! V/ p
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    % G2 y" {- y0 Z8 e7 d9 G6 _
  22. * GNU General Public License for more details.
    - w* g# V7 t+ O
  23. */! P; }7 y, D0 j/ Q2 C& b3 F  O0 H

  24. ( u* d& r3 X3 a
  25. #include <linux/module.h>5 Z( F5 H2 H! M# s% f
  26. #include <linux/init.h>% A8 B4 f, s! i% c
  27. #include <linux/errno.h>
    ) x: f3 U& ~' J. O1 z
  28. #include <linux/types.h>/ w' W, B: {' \4 }& j
  29. #include <linux/interrupt.h>5 N6 X+ E  q7 X  A2 U# O, G
  30. #include <asm/io.h>
    3 K: U/ B: T- y
  31. #include <linux/moduleparam.h>
    * T7 n  V' {3 I) m
  32. #include <linux/sysctl.h>; h# Q2 a  S4 ~* R& T- l
  33. #include <linux/mm.h>( C/ g; j; C+ Q6 o" @+ j
  34. #include <linux/dma-mapping.h>  \5 e* L* p# B8 M
  35.   D9 u. }% T7 l) H  L- B7 x7 N
  36. #include <mach/memory.h>+ ^4 D4 b5 [0 x5 A- X" {
  37. #include <mach/hardware.h>0 ]) T$ q) z" G1 @7 _
  38. #include <mach/irqs.h>
    1 s/ Y2 w" F# O. J6 j0 y. P7 j
  39. #include <asm/hardware/edma.h>
    & l% F5 {. n5 W  {9 x0 N0 X+ E/ g- X

  40. $ T  E2 j, G$ c. \' z" h
  41. #undef EDMA3_DEBUG9 L4 {1 }% i  v0 b, s( P1 I
  42. /*#define EDMA3_DEBUG*/4 ]9 D+ B5 v: f$ v, O
  43. 6 I& T2 v2 n" \" y# O
  44. #ifdef EDMA3_DEBUG3 G6 f* Q, ]3 H  P
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ; b9 x/ {& E3 v. Q
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
      p* ?+ G- x2 K, V/ l# Y1 o
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)  [" R- a6 R+ D, g+ b
  48. #else3 E5 k# X9 H/ C7 l
  49. #define DMA_PRINTK( x... )
    % Q4 f* x3 s0 f* i# ]6 F
  50. #define DMA_FN_IN
    * v7 r" {# {6 J0 z+ d& z* Z) v
  51. #define DMA_FN_OUT: c$ S* N- D7 G9 {0 [  u! T
  52. #endif# q! q/ P# d& X& d
  53. , z% D6 A9 E; S1 u
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)4 @5 T0 a5 H. u& W6 J. _
  55. #define STATIC_SHIFT                3
    0 E' s& A/ ?9 m' A6 h
  56. #define TCINTEN_SHIFT               20
    ( {# ]6 X6 J' `6 R% k7 o" f9 e; `
  57. #define ITCINTEN_SHIFT              21% o& V9 V' C+ d. i& M  U
  58. #define TCCHEN_SHIFT                225 f0 I: D2 A. w2 U' O
  59. #define ITCCHEN_SHIFT               23
    . t4 j& t8 i' F' }1 @8 h" c
  60. $ z$ C/ q  n2 s) `
  61. static volatile int irqraised1 = 0;
    , m9 i# Q$ h1 ?1 @
  62. static volatile int irqraised2 = 0;2 b0 R7 J( A$ f' \. Q9 P* W

  63. # a; z: Q( ]- E  n) J+ Q* \" O
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: W. G% i4 ]- S
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 ?' z$ W4 b" e! u" ]1 |7 d. K
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: l: T  z$ k1 n1 B6 b

  67. - b% A& X6 O; U! u% B' _
  68. dma_addr_t dmaphyssrc1 = 0;
    - |1 C  P, r. m5 p* H
  69. dma_addr_t dmaphyssrc2 = 0;
    1 T8 f" q9 t' ^0 y9 l1 N1 H
  70. dma_addr_t dmaphysdest1 = 0;
    7 P) y! \! B8 \; K+ ~! h
  71. dma_addr_t dmaphysdest2 = 0;
    6 a. }9 R$ Q5 t" l9 {2 n

  72. 6 A) U- ?1 O. \
  73. char *dmabufsrc1 = NULL;% V- f/ `- s$ x- k
  74. char *dmabufsrc2 = NULL;' E5 a2 W- Q- ?% M1 G. l2 e
  75. char *dmabufdest1 = NULL;3 \  X/ O: D7 j5 P
  76. char *dmabufdest2 = NULL;
    ! v5 Z8 U  S* ^+ S
  77. : X, n, l) ^7 q+ g, G# x4 _
  78. static int acnt = 512;* |5 ?5 H2 W1 a
  79. static int bcnt = 8;
    ! L$ D1 M7 I) w$ S8 ?% [
  80. static int ccnt = 8;7 S; Y: L4 g9 H% P$ p
  81. 7 j9 }8 t# k' f- U
  82. module_param(acnt, int, S_IRUGO);/ M5 M3 f" A. b6 u5 X  C0 z
  83. module_param(bcnt, int, S_IRUGO);
    2 o$ W" c) e  x( g9 i* M4 F
  84. module_param(ccnt, int, S_IRUGO);
复制代码

6 u  p% h' \0 Z" c! z' s; q8 F: r, i0 ^' w1 ^5 d
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& ~7 T) m2 A. Oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ @6 X/ P3 u3 Z* @     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 o% c  N$ t8 e9 t
3 e5 G' f- O2 F7 A+ w. W4 ]0 B2 e6 K7 u1 q, w' n0 }+ c
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-8 03:33 , Processed in 0.039900 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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