OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. Z6 T4 d) D) E7 D( ]5 o
  1. [code]EDMA sample test application8 v. w' H) j6 H" I; A6 F5 q8 F% h1 T7 W
  2. /*
    , v: ^# F4 s# r; q, V
  3. * edma_test.c& A- T+ b1 z! p3 e: ^
  4. *
    / l3 [& g" G; J; n; ]
  5. * brief  EDMA3 Test Application
    & M1 x6 R/ d8 Y
  6. *  i6 h; E+ [, `7 s) @+ }* u7 n$ c( f
  7. *   This file contains EDMA3 Test code.
    ' C/ A8 Y, s6 X# x; \& l
  8. ** C+ f' W" ]- Q0 n8 L
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& y' Y$ U/ {7 q+ _3 Y0 d% [6 X
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    $ }2 j$ l( S2 |( @
  11. *         TO CHANGE.
    8 x+ k# g6 ]5 c+ y; t* t) {
  12. *. m* `, b0 u! p  p4 {' S. ?
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/  X% |- e* j5 c1 c" j7 L
  14. *
    # p* Z4 B$ k, R( t+ g. \# v
  15. * This program is free software; you can redistribute it and/or" P; u3 \3 }( J5 k. H( f7 ^
  16. * modify it under the terms of the GNU General Public License as
    * ^& G# k/ Q- S' c
  17. * published by the Free Software Foundation version 2.' `0 P, g! L+ S, ?$ X
  18. *2 T7 x& X5 m$ ?3 `" N/ ]+ x
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 ]4 b, h, N/ G
  20. * kind, whether express or implied; without even the implied warranty+ C5 \% J  w5 G, w# g# i8 C
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the# A; l- w, f. o
  22. * GNU General Public License for more details.
    1 ], C" c* ?' Y
  23. */# C5 f5 @+ }' ~* y/ o0 u$ c

  24. " w& R( W; I( W1 K9 C0 l2 j
  25. #include <linux/module.h>
    0 x) P& F1 J4 s) E
  26. #include <linux/init.h>
    ; Z- u. c7 s1 l4 B+ Q
  27. #include <linux/errno.h>0 N1 e: c0 j  C+ z
  28. #include <linux/types.h>& [- M$ g0 ^( L3 |  ?
  29. #include <linux/interrupt.h>
    4 s0 |* _7 n  f
  30. #include <asm/io.h>8 H- S' _7 O* x. S* j
  31. #include <linux/moduleparam.h>
    # @! W' v' d# j- v
  32. #include <linux/sysctl.h>
    # K6 t. @3 P1 Z$ n0 j& A
  33. #include <linux/mm.h>
    + i3 w4 x% G, I$ S
  34. #include <linux/dma-mapping.h>
    0 I) N6 ?) O6 R
  35. : l, V' L: E5 W1 V9 F# x  z" N2 T
  36. #include <mach/memory.h># L9 x, Q9 b& ]" o6 y
  37. #include <mach/hardware.h>
    $ W8 y1 x0 `& x& o
  38. #include <mach/irqs.h>
    , a: |4 Q* M/ [* C& R, J
  39. #include <asm/hardware/edma.h>
    " x7 e% Z% K1 v5 Z
  40. 1 Z4 |  W' r$ A, s. `
  41. #undef EDMA3_DEBUG
    $ p( F( L2 \, k# I
  42. /*#define EDMA3_DEBUG*/9 p0 [1 c) M# l$ f

  43. / f$ U* N% c& F$ _
  44. #ifdef EDMA3_DEBUG
    % O3 a# V1 i4 J( e3 E$ Y2 K- x
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
      G' O! ^3 O5 V& K& l
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( b1 Y9 k6 _5 L- T
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ' g/ t2 a. c5 h5 ~
  48. #else, t$ h1 H) |; w, Y% d
  49. #define DMA_PRINTK( x... )
    ( x/ f/ q6 W& {. C$ ^) H
  50. #define DMA_FN_IN
    0 P* }; F+ L0 H# z. J
  51. #define DMA_FN_OUT& I- N. u$ `) V% |3 ?
  52. #endif
    . c* @# h2 U" `$ ^" `1 z

  53. ; S# D2 ^0 l* G- f! y! o
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)( j* a( }& h4 d$ o. C- d
  55. #define STATIC_SHIFT                3
    ! `! i! a- j; Z# ]+ c
  56. #define TCINTEN_SHIFT               20
    ! j' P6 z, ~3 L# ?( M! h
  57. #define ITCINTEN_SHIFT              21
    : q- G! g* B! n2 b+ U+ E3 ~# H
  58. #define TCCHEN_SHIFT                22; w* k5 k2 G5 e
  59. #define ITCCHEN_SHIFT               23* C* [( O5 d+ E3 r. C, Q% U0 x
  60.   m0 {: w7 ^7 }0 i: C% R" m
  61. static volatile int irqraised1 = 0;
    3 |$ f! K; O! O
  62. static volatile int irqraised2 = 0;# |- G4 X% m2 i8 O7 @4 i9 \# P2 d
  63. ; s2 P0 R# [# ?( m7 T
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 P$ Z+ j) D9 G/ b( y1 w4 B" d6 c
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' `: ^$ ~; |% R& @
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  [$ c, c. K% S! @) u0 T3 h

  67. 1 l. }. q' S) X$ L) N1 _
  68. dma_addr_t dmaphyssrc1 = 0;0 ~( ~) z7 ?# `2 \
  69. dma_addr_t dmaphyssrc2 = 0;  ~2 V# ^- `5 W) s, s+ }
  70. dma_addr_t dmaphysdest1 = 0;/ T) _! G& u# @( |
  71. dma_addr_t dmaphysdest2 = 0;% n0 {) S8 J- c+ u% p  X# e* D* J! y

  72. 9 F* p7 S, m9 r0 B5 N
  73. char *dmabufsrc1 = NULL;
    / e; ?! v+ M. R* A
  74. char *dmabufsrc2 = NULL;: r3 H7 T/ [' w3 {; M* c
  75. char *dmabufdest1 = NULL;
      b. u! M" l& J- w
  76. char *dmabufdest2 = NULL;
    $ o3 O) U; l: w' a

  77. 3 ^1 `* I" M' ?4 G8 v7 U, N
  78. static int acnt = 512;
    : v/ b2 R1 o* @
  79. static int bcnt = 8;
    ( H* {* j# }% ^+ f5 v
  80. static int ccnt = 8;
    ; ]4 ?/ {5 R5 A8 o" ~

  81. 8 E$ L, `/ d+ R4 {. }$ M) T' y
  82. module_param(acnt, int, S_IRUGO);! f/ d) U3 ]+ K) K4 q* ~; a
  83. module_param(bcnt, int, S_IRUGO);
    2 E4 |$ I$ ]) s, y3 }. [+ I* e, U
  84. module_param(ccnt, int, S_IRUGO);
复制代码
: d1 t2 j6 `3 _* `1 c- ]$ |

& d' T; h2 e1 E$ W      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- J$ `; u5 Q- `* d$ T8 g/ c5 k
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* n% a) s! a) J4 f) |: u# y     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& i  A+ ^8 Q( B& x7 a8 c
3 w  N7 [; ~! m4 ^8 R0 W
/ ]/ L0 g  [# L+ s
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则


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

GMT+8, 2026-1-10 03:41 , Processed in 0.046468 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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