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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 h8 i- A$ ], Y# F/ u* }2 w0 w+ j
  1. [code]EDMA sample test application) _# d8 I  P5 T+ b1 L
  2. /*
    " i9 q: F/ u" r4 l
  3. * edma_test.c
    0 j4 _& |$ y# _7 O# L% T0 {
  4. *) z4 M8 [) ]' o1 D# h( h# W
  5. * brief  EDMA3 Test Application
    ( E) k& @, {! Q/ @$ z  g
  6. *, V) m/ ]& i. S2 i/ A0 N6 B
  7. *   This file contains EDMA3 Test code.
    7 R( X. G7 C9 b8 g' O" U- G/ ]
  8. *" I* o! ^# S8 T0 J
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 X3 i9 m5 G5 O9 [' m
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 |' M% Z1 n5 W* [! w3 F8 b
  11. *         TO CHANGE., x8 `% P' |; N/ M  L
  12. *
    ( N* f; {$ t2 Q- V& c
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    % m4 m! @! g, H
  14. *
    ' `$ T" B: Q6 j4 r) S. B
  15. * This program is free software; you can redistribute it and/or- s1 _: o5 J: `2 d# @* P2 }; B
  16. * modify it under the terms of the GNU General Public License as4 G$ ^3 o1 V3 n: Z
  17. * published by the Free Software Foundation version 2.
    4 A* e5 w' C( C* z0 H2 b1 |: d
  18. *
    ! X  K; K7 b# z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    # x! n4 ]3 z% k2 S' @% A: z$ c
  20. * kind, whether express or implied; without even the implied warranty
    - ?, m: f6 e7 _- S* i# }% {1 T
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ; N; P+ z/ c1 }0 a- u0 z
  22. * GNU General Public License for more details.. g2 E5 ~8 H( Z# f* h3 E
  23. */
    . N7 |! O3 Z# Z( q

  24. $ V7 ?# s2 v9 w8 n' }. z  z8 G
  25. #include <linux/module.h>
    + e/ c) l* c0 i' w  A* e& Q# i3 P  s
  26. #include <linux/init.h>
    ' I' N% l$ Q; H6 P1 w
  27. #include <linux/errno.h>
    2 S. R, F0 W8 |9 u
  28. #include <linux/types.h>
    0 ^5 t! C& h  f8 l3 A4 v% L1 x! v
  29. #include <linux/interrupt.h>
    ! q5 N4 W# z$ X
  30. #include <asm/io.h>0 e0 _4 I  v! r' D
  31. #include <linux/moduleparam.h>
    ) }( A3 C9 `, D. N9 |3 p* o: t+ k
  32. #include <linux/sysctl.h>
    5 R) ~- x5 S2 [1 r5 T% t
  33. #include <linux/mm.h>4 z5 K; k& I  C( a& J( {
  34. #include <linux/dma-mapping.h>! N. B. |# [" Z  ^6 J( s

  35. + Q( g/ ^! O' D) [; [. D( h
  36. #include <mach/memory.h>
    / b* ^8 }0 _) H  r) W: c
  37. #include <mach/hardware.h>
    + X8 k: S* R$ X4 x% b& \6 C
  38. #include <mach/irqs.h>
    % u  O  N3 K% r4 b! X( s6 b
  39. #include <asm/hardware/edma.h>2 J) r9 `* Z6 \
  40. ( \& n" X/ [% B  l
  41. #undef EDMA3_DEBUG" G$ F, N% ]2 n: W9 s
  42. /*#define EDMA3_DEBUG*/
    * e! o" f$ m4 N7 O" _3 t

  43. 7 b, |7 s% U! o- @5 _  d
  44. #ifdef EDMA3_DEBUG: o2 S5 N: g! j" W, v
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    0 c. v, G2 f% k6 f7 E4 E
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    7 C! n6 |7 o) f% Q8 v# ^
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 |; I; }' M/ h% S1 y; c9 u% R6 S
  48. #else, }  l$ ^4 B. R  ]
  49. #define DMA_PRINTK( x... )
    / ?/ G1 G, F  |5 m5 ]4 c' t
  50. #define DMA_FN_IN
    . w- p$ ?" O4 B
  51. #define DMA_FN_OUT
    ! [# X* M7 ^: {1 U' |- d. Y
  52. #endif
    % x# [" b1 i7 Y$ V8 ~# \- j* ~
  53. 5 E$ m/ L9 w- T$ n2 G" a
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)  _7 {" {" H- c: [. I5 O& I
  55. #define STATIC_SHIFT                3% t7 k  O5 b9 _" s1 l, ~( k
  56. #define TCINTEN_SHIFT               20
    # g# X1 a, l3 J9 ^8 \# y0 i
  57. #define ITCINTEN_SHIFT              21
    3 j* O2 `; R5 y+ m
  58. #define TCCHEN_SHIFT                220 y3 ~& A1 Q1 ?1 W* ^1 u
  59. #define ITCCHEN_SHIFT               23
    8 J$ a. C+ J; ]" _" L$ @
  60. 3 K4 ~, z; t7 D, u# K( U5 j1 q' S
  61. static volatile int irqraised1 = 0;
    4 e% Q5 {6 r$ q+ ?9 z
  62. static volatile int irqraised2 = 0;! Q1 O8 V  z/ B9 j5 E3 `) n

  63. . c4 r' e) G  G* n6 y5 S! M! O+ ^
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 ^& ~. U: A0 T; d5 X* @! @
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 i! U: j+ K3 n: Y% v9 R
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ Z0 ^. E7 {! W2 p, e3 g

  67. : b* }8 A. ^0 b3 Z# C( M1 U' N/ P. @
  68. dma_addr_t dmaphyssrc1 = 0;& u7 l3 x1 e( D
  69. dma_addr_t dmaphyssrc2 = 0;
    - ^7 c/ P( P6 Z" V6 c$ s
  70. dma_addr_t dmaphysdest1 = 0;  N# c: u% V9 T" u- k/ I( Z0 a
  71. dma_addr_t dmaphysdest2 = 0;* n3 [1 f2 m% g+ `
  72. # d' d4 o5 s9 L
  73. char *dmabufsrc1 = NULL;' B$ [" V& b( P6 }  t& p: m
  74. char *dmabufsrc2 = NULL;, _$ e* V% B9 U. {' c; g
  75. char *dmabufdest1 = NULL;+ L! \& h& w/ ?8 H5 p" q0 V) |
  76. char *dmabufdest2 = NULL;
    / w6 @# {& Q9 q$ l
  77. ; B  q* q& F) D# J- m
  78. static int acnt = 512;
    ' l5 r3 z1 s  V, n) U- R
  79. static int bcnt = 8;4 G7 j4 L  ~  }9 P' b
  80. static int ccnt = 8;
    : P' d( u. }+ }$ K) s+ ^/ u" X5 o% t
  81. $ C% s$ n2 t& g5 E. V; ~
  82. module_param(acnt, int, S_IRUGO);
    * q' U9 h+ C3 h' k1 m2 w4 r
  83. module_param(bcnt, int, S_IRUGO);9 [  o1 B1 \* \& Z/ _" i! E
  84. module_param(ccnt, int, S_IRUGO);
复制代码

8 y& a/ K0 N* j2 G0 |% c' A0 V. ^- u4 ~0 r, X
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 q$ G) n# f# U5 r. b4 _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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
5 Y3 x& D$ p6 [3 U) O! x# a! X2 q0 g     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: b. ~( g: M3 d9 y

7 U. o# S6 j  [) E; P
: Y/ o7 ?5 M% o8 ?  I4 H
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-16 20:55 , Processed in 0.041269 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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