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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& [# E# U/ H, R: E- g; `* X, B5 @7 f
  1. [code]EDMA sample test application
      w5 P2 O6 A0 e% N3 P; n
  2. /*
    - Y$ R& D9 j/ K6 ?3 [$ v. Z. H& i
  3. * edma_test.c% |  r7 G3 H  [  F/ C
  4. *7 |1 Y! @; Q/ L# B7 d& T8 ?+ Z
  5. * brief  EDMA3 Test Application
    3 o+ c% K# m; X7 k
  6. *' b- m  Y- K; \$ f* _/ y! [$ G; Z
  7. *   This file contains EDMA3 Test code.5 `- c' ^# o7 t" a# n/ ~
  8. *
    % [! o: P. D8 [0 W
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    7 G$ H6 X9 Q. o9 S2 K1 `3 Y; s
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ m. m6 P8 L6 t" f- W) t7 K& g
  11. *         TO CHANGE.& p" t* {7 X% f$ A4 B5 i
  12. *' D# v2 c: F1 Z- |4 f
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# @* f# ?2 g' a
  14. *
    ' m) _; N& }- L& v- ~
  15. * This program is free software; you can redistribute it and/or
    + k. f7 I) f/ Z' _1 B. `* S
  16. * modify it under the terms of the GNU General Public License as7 T7 T) [8 n4 W+ _! s
  17. * published by the Free Software Foundation version 2.7 m" W! T, q2 {3 y
  18. *
    ( B, Q( B! p' z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 p6 j2 ?' d5 R
  20. * kind, whether express or implied; without even the implied warranty
    ) K5 i/ o& ~: ]2 N* u
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    : l# W, d* n9 y2 [9 _
  22. * GNU General Public License for more details.1 r+ T5 S" t  _/ F+ ^
  23. */! e0 W9 p+ _% A% R
  24. $ Q; V6 f+ _0 N% L7 H
  25. #include <linux/module.h>
    5 G9 S6 R, D6 u/ ]5 w" ^
  26. #include <linux/init.h>% r( Y( S9 I- T! n7 C
  27. #include <linux/errno.h>2 @+ e' Y. b7 t: G; T6 `/ r% [' o0 V
  28. #include <linux/types.h>) X& ~' p: C  q
  29. #include <linux/interrupt.h>* \- k1 b. }$ i" x7 r
  30. #include <asm/io.h>, J" [6 ]3 X! {+ X9 I* K: J
  31. #include <linux/moduleparam.h>
    , X! T) X( t2 r$ A6 x
  32. #include <linux/sysctl.h>" |" E5 z/ y2 a" A' K' e
  33. #include <linux/mm.h>/ o4 E  G# c2 G6 Z# x9 `
  34. #include <linux/dma-mapping.h>. [+ @% m8 a/ s# g
  35. 7 k" S) r' e  l! m
  36. #include <mach/memory.h>! Y  ^# N% l: f8 q( Q; E6 t+ b+ y
  37. #include <mach/hardware.h>' J6 X( b* y1 A7 a+ |3 w7 S% b
  38. #include <mach/irqs.h>1 m* [" P* m/ c4 s/ X
  39. #include <asm/hardware/edma.h>, `) j) }9 t/ x' V
  40. . `4 J# p7 n: a( y
  41. #undef EDMA3_DEBUG
    , i4 y1 L& I. j
  42. /*#define EDMA3_DEBUG*/$ c$ N# h( O6 f# B, a
  43. . e9 J* h2 G+ c: S- j2 R' `  @% X
  44. #ifdef EDMA3_DEBUG5 Q$ r: `+ Z1 l9 ]
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 l2 ^7 R/ X1 C! ]) p
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    5 Y5 h6 ^4 T/ m
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    # G* V  {  _2 q8 _1 j% a  d
  48. #else- U0 ^% B! R' h& m) z
  49. #define DMA_PRINTK( x... )" R1 Z( }# S) d! W2 ^% \8 g. g7 z
  50. #define DMA_FN_IN7 I8 q9 n. ?6 z5 U
  51. #define DMA_FN_OUT! O  ]+ S! U+ r8 _0 \; n8 U
  52. #endif
    8 ~# o; l# p# M$ `1 P" ]

  53. 7 d# H3 x9 \( N6 _" R
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)& N" v# z2 r; D* c
  55. #define STATIC_SHIFT                3
    2 s9 v& _  k. x. a; l
  56. #define TCINTEN_SHIFT               20
    9 I! X; P' L& \3 a' Q
  57. #define ITCINTEN_SHIFT              21- i8 C7 [+ x4 v6 V
  58. #define TCCHEN_SHIFT                22: y: R" C5 p4 q: V
  59. #define ITCCHEN_SHIFT               23
    % o/ }' q5 x! t

  60. " k3 w. ^" c& \5 r1 y$ ~
  61. static volatile int irqraised1 = 0;0 A7 V! E( K8 o1 E' H/ Y
  62. static volatile int irqraised2 = 0;
    / W" F/ _7 G1 Y9 J$ \
  63. 2 |) K- h: j9 H/ h) {. B. s0 R
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + g2 d% V8 G# c, W' Z) t' j, R+ h
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; W3 K; ^0 Z" L5 l
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 v. r- t+ }! B2 @8 K% x$ ~

  67. ( u- n$ ^- K" k5 b% F
  68. dma_addr_t dmaphyssrc1 = 0;7 K- [0 o- N% T5 @1 p, h
  69. dma_addr_t dmaphyssrc2 = 0;/ x( j6 @) c! G/ y; N
  70. dma_addr_t dmaphysdest1 = 0;8 u1 d$ W; `! C6 y$ \6 S& X" E' y9 b
  71. dma_addr_t dmaphysdest2 = 0;' r* ?1 I& C& W3 E1 |/ ~7 b
  72. + T. N4 D2 q2 D1 {) e/ }( G
  73. char *dmabufsrc1 = NULL;
    ! s3 U* E; s. g8 Q3 x# ]8 q6 w3 Y
  74. char *dmabufsrc2 = NULL;  f  C0 i% Y. @! i" t
  75. char *dmabufdest1 = NULL;- m  A, u9 X- Y1 i# i: n
  76. char *dmabufdest2 = NULL;
    # G0 |3 J: B: y7 s

  77. 9 r# s, m6 r! K
  78. static int acnt = 512;
    5 x1 J8 ^- y) j4 @# K1 i' N
  79. static int bcnt = 8;0 @4 N6 u1 O. {" b( G0 x
  80. static int ccnt = 8;+ f. P$ m. |6 h4 w+ U- u7 A8 U

  81. * h0 _& D( ]7 x3 _1 \" ]( M; l
  82. module_param(acnt, int, S_IRUGO);
    * F6 o, M  A" l4 b7 {& S+ R  ~
  83. module_param(bcnt, int, S_IRUGO);
    3 w" k! d$ |$ R3 Y5 Y$ T
  84. module_param(ccnt, int, S_IRUGO);
复制代码

8 y' U- u1 P* R+ D8 L0 A; T' W6 R3 l; L- Q# }% k# l
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ B( p* U( x) U5 l+ p" @
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- c# a/ i2 u; y+ ]! M/ s+ D, M4 [1 f
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 S" S0 s& r+ u1 A) F) P
! D( ^' F& R3 P4 Q9 R2 |, ^: I; F& m) s1 D% O
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-26 15:06 , Processed in 0.036939 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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