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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + Y+ N) `9 y9 o* A5 t
  1. [code]EDMA sample test application
    2 k/ `' H& P( F0 x6 K8 U
  2. /*  ~" ]3 N  l6 ?* U, N
  3. * edma_test.c4 C+ `% X2 y* t8 m  q! E" o) Y
  4. *1 b1 ^0 z+ X  |  @  D4 t& Z$ c' ]
  5. * brief  EDMA3 Test Application
    5 y( G$ U/ q3 w) t$ |. |$ Y9 A
  6. *
    + E$ d' X5 j' c
  7. *   This file contains EDMA3 Test code.
    - w- \4 a& @2 f8 G! Z  e" i
  8. *
    1 Y# o3 n( A$ p
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    8 E! N* O4 Y6 R2 c
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# r/ t/ v, q! W" I. {8 t% s
  11. *         TO CHANGE.  ]9 T3 W: T, ~3 n4 [& r' W: a
  12. *& e, x8 _3 M2 w  c1 r3 O6 @
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( S* U* {; M3 ^0 H" X1 I
  14. *
    * D0 v9 E- t8 h( y
  15. * This program is free software; you can redistribute it and/or/ @+ G" B  ^7 _+ q
  16. * modify it under the terms of the GNU General Public License as% a/ o3 g* o% s& w
  17. * published by the Free Software Foundation version 2.! Q/ E5 j: R( i3 h1 j
  18. *8 I  K" R0 d- t7 |( b3 X7 G9 G& Q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    $ n7 Q' e$ f; V* {
  20. * kind, whether express or implied; without even the implied warranty" S6 |* O0 B" t& H2 [+ F
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the, y1 `) s& M; Y3 t0 P
  22. * GNU General Public License for more details.
    * X, O0 e6 _) R% Y* B7 Q* n. l* W
  23. */
    # I- f2 S! q( b" w1 ~! l0 f- F
  24. - f- R. K. O5 q: F
  25. #include <linux/module.h>) W! H. T" ~2 w; m
  26. #include <linux/init.h>
    & `. `2 a8 L* k$ R& }& h
  27. #include <linux/errno.h>
    0 D8 y( H( ]/ e
  28. #include <linux/types.h>
    + a& }( g( l; Z+ f
  29. #include <linux/interrupt.h>
    : n4 I  F4 }2 E7 P
  30. #include <asm/io.h>& ^0 T6 O) N6 I& b6 v# G3 ]7 ?* w
  31. #include <linux/moduleparam.h>0 d- {# y9 @1 A6 Z. w8 h( Y8 W9 ]1 [
  32. #include <linux/sysctl.h>; y2 D) S- i% `. u
  33. #include <linux/mm.h>- t& o, W2 |" m( F- A. g
  34. #include <linux/dma-mapping.h>
    4 Z2 ~1 _- P) g
  35. ; E2 l) _8 T  j# m
  36. #include <mach/memory.h>5 T4 W+ m7 B1 g8 V# d  u
  37. #include <mach/hardware.h>% S# d% Z' M- Q& A
  38. #include <mach/irqs.h>
    - N5 d2 J( P3 W
  39. #include <asm/hardware/edma.h>
    + X8 J1 Y, @2 q3 K, X
  40. & U8 w8 `; t, J3 M8 A
  41. #undef EDMA3_DEBUG7 o5 R2 {1 Q" E$ d% d. F: H
  42. /*#define EDMA3_DEBUG*/
    8 m4 k9 u$ @% \

  43. ! ^$ x& G2 d5 j1 t
  44. #ifdef EDMA3_DEBUG
    8 g! n$ l  A7 h5 d
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    - f  N& W0 X7 v  ^! ~) j  T. d
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ! {; q& b1 R1 h! v
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" n2 b! y2 i7 N+ D# j' V/ @
  48. #else
    2 v- e4 M$ y! e9 H: o. D% l. V
  49. #define DMA_PRINTK( x... )  c- `) y+ R( ?& y
  50. #define DMA_FN_IN
    ; ~1 ?+ I+ V0 D& j9 x
  51. #define DMA_FN_OUT  o2 }1 A: \0 s8 u6 R
  52. #endif0 @5 Q: k/ o( ~' h. @1 Z

  53. ; }& x& J, C8 i( t) R2 J: x2 a
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    3 ?  a% x0 n% Y3 P- F! \& q) M
  55. #define STATIC_SHIFT                3
    + U. G$ u* {  _* c
  56. #define TCINTEN_SHIFT               20- `: G5 O$ U6 t) P2 Q4 {, }
  57. #define ITCINTEN_SHIFT              21" t* E- d/ q4 o" f! E) O
  58. #define TCCHEN_SHIFT                22: x0 X! D8 J% z( d3 \+ ^% s0 q
  59. #define ITCCHEN_SHIFT               238 I9 [" R% `* @) m7 t- G7 z0 G

  60. / A1 k$ d5 [$ v0 V
  61. static volatile int irqraised1 = 0;
    9 ^0 {; @4 n/ _. a7 d' A3 j$ w8 t9 m
  62. static volatile int irqraised2 = 0;) R5 {0 e/ b  v5 I3 D/ W) y
  63. 9 B: _1 ^4 d7 J( R7 K& B, r
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " l# n! R! A4 E' h+ Y4 W5 c
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" P3 ^/ `! j5 r0 a$ u' G1 ^, {- W
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- @3 \( y4 _: b0 y1 _( p' |4 c
  67. : X. p. ?* ?: W# |' p. X" D/ u2 e
  68. dma_addr_t dmaphyssrc1 = 0;
    1 ]3 K& [! x2 y% r9 l
  69. dma_addr_t dmaphyssrc2 = 0;
    2 K7 N5 _; P4 I- n& k8 J' T
  70. dma_addr_t dmaphysdest1 = 0;
    " e1 M* b# q! L. Z/ o4 r8 c
  71. dma_addr_t dmaphysdest2 = 0;
    . O. C: B2 ?- z* q; C' Y, D

  72. 3 @! F5 W& ?$ @% x6 K8 F; B6 z
  73. char *dmabufsrc1 = NULL;/ S1 X7 J% u4 I8 d
  74. char *dmabufsrc2 = NULL;
    - Y2 a" Y* |- @  X# C
  75. char *dmabufdest1 = NULL;
    2 ]' \" m( q0 Q6 W) H0 k6 ^# v
  76. char *dmabufdest2 = NULL;
    6 V# @2 _7 Y9 _" |4 T5 V4 H
  77. : T+ }# J- x5 u$ ?) h; Z9 N& P
  78. static int acnt = 512;
    # [. Y" I7 E0 w  `4 q$ N
  79. static int bcnt = 8;
    3 y$ i# P$ g- [  K: U: D7 w
  80. static int ccnt = 8;; U/ ]; _9 t0 k1 D* n) h4 G0 z
  81. + Y! _% G( V/ b  X$ t8 _/ U
  82. module_param(acnt, int, S_IRUGO);" b( t$ ]2 \( ^
  83. module_param(bcnt, int, S_IRUGO);6 J4 e* l( e6 D& x
  84. module_param(ccnt, int, S_IRUGO);
复制代码

& S- H4 ^, u6 m. e' _- H8 x4 S: D+ Y4 N( G* I$ z. o. ]3 q0 x
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ F% e, M0 w1 A) }2 U8 _
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 ]; c, C1 A# d* h8 b1 \4 z
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。  {# H# h! G! X8 i# `

( ^0 M% ~0 O% ]' ^/ ~! L" I: {7 T! |
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-14 12:48 , Processed in 0.039768 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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