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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ O5 u5 a3 b8 p: g$ ^
  1. [code]EDMA sample test application
    8 N6 ?6 a- h3 S% D
  2. /*
    2 u: n' p2 M' X2 N1 b$ Z% ~2 \  ?3 d
  3. * edma_test.c) m3 R0 X9 x1 i2 h2 N( g7 |$ @  o
  4. *! P  U' F2 y" c4 e5 Q9 V! ]  Z# n
  5. * brief  EDMA3 Test Application% C4 U8 l6 t! `& Z7 ~
  6. *" k$ j, e: G; U- d, q. Z0 l
  7. *   This file contains EDMA3 Test code.% u) _! R/ P9 z. q) K
  8. *
    2 z! g+ m  e# Y. v
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. \4 ?' `- ]; i6 G. j
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ! X& `: K" V  V
  11. *         TO CHANGE.8 [9 {4 H( [8 F3 `1 ^* J2 j* [; A5 U9 [
  12. *4 {/ p" \  D) H, G% z' @
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 S6 W  S( [1 X5 [) a, Q7 |" t6 P
  14. *
    : [; X2 n' d1 R, s$ F
  15. * This program is free software; you can redistribute it and/or
    " T- W- {" ]' k/ ?2 z
  16. * modify it under the terms of the GNU General Public License as9 n$ V8 t  [( W9 u
  17. * published by the Free Software Foundation version 2.
    ( R+ G; e( `2 R5 A0 k
  18. *, i7 P; H  @6 [3 ]  _9 r6 d. F/ E
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    2 N' _' h. b& h" \, g
  20. * kind, whether express or implied; without even the implied warranty
    # H* d/ Z& i# Z3 f
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    : L6 L$ f1 G- P
  22. * GNU General Public License for more details.
    6 e! q' g" D2 r; ], F
  23. */% T2 x7 {" O% s* B9 e" B
  24. + C. o* {/ ?! h" W  U0 k- R
  25. #include <linux/module.h>
    ' q, m* H* t7 d. ]
  26. #include <linux/init.h>- w1 {% C0 B/ z$ Z; U' g
  27. #include <linux/errno.h>( G1 X( [3 E  r, y( A
  28. #include <linux/types.h>
    6 J% ]! ?" ?5 Q/ }  u8 Y+ k4 D
  29. #include <linux/interrupt.h>
    % t9 L4 R- u( C  D3 Q
  30. #include <asm/io.h>0 r5 c1 P/ n& M! C/ ]% [
  31. #include <linux/moduleparam.h>- g5 I; U& P, s4 s3 ~2 [& E: J; H
  32. #include <linux/sysctl.h>
    & j. L9 ?' k: V1 F$ K
  33. #include <linux/mm.h>/ t( x! Q/ n8 i7 Z
  34. #include <linux/dma-mapping.h>
    - h) E7 C9 [" X3 h

  35. 6 m. N: H3 ]! o- I
  36. #include <mach/memory.h>) e( @' P! n8 h  d, P# T
  37. #include <mach/hardware.h>
    2 p7 n2 V/ o- |  p. L
  38. #include <mach/irqs.h>4 ?* G, y1 V( D+ k! [& j
  39. #include <asm/hardware/edma.h>+ T$ u% x8 P" l. A2 V$ l
  40. 0 g* V: e8 e* [0 j. {- N$ }
  41. #undef EDMA3_DEBUG
    / ~  b1 O4 z# T- w# f" s
  42. /*#define EDMA3_DEBUG*/
    7 V4 y! }# r( x! G* D! e) L
  43. ! Z0 C" c) b  J# b' y
  44. #ifdef EDMA3_DEBUG& P" B: s0 ^) Y( g4 d; R
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    2 `: P' o  g6 J' c% F1 z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    0 ^% s, h3 L+ S; J* |
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    $ B+ s; Z2 J. p1 i
  48. #else- S' a9 \7 s/ ^$ f! U* F" M) P
  49. #define DMA_PRINTK( x... ): I& }8 K' U8 h' k- m! F9 o% U5 o
  50. #define DMA_FN_IN
    5 L! X6 y0 Z! E5 O- F' e& {
  51. #define DMA_FN_OUT' _0 }. P( ~0 Z! G, P# m/ J) |) N
  52. #endif
    2 u/ q: D9 u% T( v: \; p  x; n
  53. " c4 G* Z+ X+ }* `' {
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    0 E8 |) W# I3 G6 O/ b; P3 B8 z
  55. #define STATIC_SHIFT                3" o! F3 s  _" @1 H  K& \1 Q
  56. #define TCINTEN_SHIFT               20
    + y' W7 ]5 \, P( B% s
  57. #define ITCINTEN_SHIFT              21" d# k0 K" G; U/ q+ o' Q( S4 Q
  58. #define TCCHEN_SHIFT                22
    / x3 {+ o! I% _6 W& U1 M. E
  59. #define ITCCHEN_SHIFT               23( R( T2 G) D4 z& L
  60. - Z6 H3 P' t2 _8 z0 i
  61. static volatile int irqraised1 = 0;& p9 V' q) Q1 E8 n, R
  62. static volatile int irqraised2 = 0;: E* O" W1 I3 U; }+ o

  63. 3 m7 w" P6 j/ \, w2 K
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # y! T' m, l$ d3 X' r5 x
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; b  x. D1 h9 k/ t
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      D; ~4 D; c- {, ?  W" B
  67. 8 b9 z) u  M% ^: C5 V8 [
  68. dma_addr_t dmaphyssrc1 = 0;& K$ S! J0 e& c3 |- K
  69. dma_addr_t dmaphyssrc2 = 0;
    - m9 P5 B" p/ y& h/ p$ D  a7 j# j  E
  70. dma_addr_t dmaphysdest1 = 0;
    : L& Z. ~9 N  T* f
  71. dma_addr_t dmaphysdest2 = 0;
    . l8 E1 p3 J7 i3 J0 q* W* I0 E2 l

  72. 6 z$ [& X$ l6 o0 r# Z  H4 a
  73. char *dmabufsrc1 = NULL;
    7 ^0 g6 v; x* Q6 J
  74. char *dmabufsrc2 = NULL;- }" n7 h; w/ ^! Z5 o4 P
  75. char *dmabufdest1 = NULL;: a2 W1 A; l+ C% i" V! M
  76. char *dmabufdest2 = NULL;+ C' m: j7 M: q# |& c# D

  77. 5 N: N/ m; t  }" o
  78. static int acnt = 512;) ^$ ]) J' i# w2 s" E" @
  79. static int bcnt = 8;& S7 Q3 c7 K+ {; S
  80. static int ccnt = 8;- d# H/ t! N9 c2 {( R

  81. ! S$ S1 L# Y! X( x5 B/ B. B
  82. module_param(acnt, int, S_IRUGO);
    7 A7 `& r5 Y6 R/ w6 _2 _3 y
  83. module_param(bcnt, int, S_IRUGO);4 O* S6 T9 H9 k* z; y
  84. module_param(ccnt, int, S_IRUGO);
复制代码
9 q* n& a& [; q( w$ S& [
- S7 z1 s- v+ W; B  x; P9 A7 m. x
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& e$ }/ D* [  M7 `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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! A% {( R+ w% f1 _1 S. \
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ }1 _0 `$ w5 }! S7 V2 \6 Y6 R

; i" n- [, E8 {2 T- l6 N& Q- C1 \1 F& U* b
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-5-30 07:44 , Processed in 0.041351 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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