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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 o/ d5 t2 T/ Y3 f* I
  1. [code]EDMA sample test application
    7 k! n- m5 A6 ?- J( u' a  h
  2. /*
    0 U( g# k3 K! J9 P& t! `
  3. * edma_test.c& ^- n/ b: K$ ^/ D' J% A
  4. *
    9 ]0 K, g- l% @* M$ U! N
  5. * brief  EDMA3 Test Application
    $ j# v! _; x3 d" D( F, t: A7 X
  6. *
    9 W! z- z' k2 P0 d
  7. *   This file contains EDMA3 Test code.- `* m  H5 q  B2 F% }3 W
  8. *! q) F, \/ |- o' ?7 d( u- a5 A
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ y5 o; I- G3 O3 k8 `
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, u& }8 b6 W  C( o. r' r9 O
  11. *         TO CHANGE.
    % |8 \8 e' ^* H$ Q9 x6 s
  12. *3 P$ w# E( T) C& E8 A/ F* H
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 U" f& s4 \& c6 _# w4 V
  14. *, Z" I! a( N2 A. p
  15. * This program is free software; you can redistribute it and/or
    % T. H5 b! N6 m& w. a. d
  16. * modify it under the terms of the GNU General Public License as1 c* ~+ X9 U% w, |
  17. * published by the Free Software Foundation version 2.
    . Y$ `6 H1 k+ O( L5 ]! u  [
  18. *
    0 y5 A" T/ u; O0 n
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any& L1 k7 G5 Z) O, I1 ~8 \
  20. * kind, whether express or implied; without even the implied warranty( v. z' I! m$ k" i  V
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ' I0 T6 ?) u# m* |
  22. * GNU General Public License for more details.1 L3 D2 i' s8 p' l* E" j
  23. */- ^+ b9 M# F$ ^3 `
  24. ' {' T- h' c! P0 S5 V* y
  25. #include <linux/module.h>% ?" g+ D* d/ N$ f! D) j- X# i! N
  26. #include <linux/init.h>& |4 J3 {0 i/ |6 r* O8 e7 O
  27. #include <linux/errno.h>
    # d0 ^/ x  v  k  H) ~. U
  28. #include <linux/types.h>
    - w8 I3 @5 G6 ^: z
  29. #include <linux/interrupt.h>
    9 D2 S; E3 e+ E1 i7 j4 g
  30. #include <asm/io.h>
    " v. ^5 c. m$ C) G
  31. #include <linux/moduleparam.h>! p* A9 k' f3 t; V1 u% U
  32. #include <linux/sysctl.h>
      b/ H  X, h2 A, x% Y
  33. #include <linux/mm.h>3 g% ~, L4 H1 Q5 W2 [& \% F
  34. #include <linux/dma-mapping.h>' ]- V, P/ v! [4 c: g

  35. & n( t6 `) i- d' Q/ P# y
  36. #include <mach/memory.h>  U4 a6 |2 j5 G# q9 u) p% z
  37. #include <mach/hardware.h>) i- I7 s# @; |; J" |" N$ S  x
  38. #include <mach/irqs.h>9 ~2 i7 Y! D' |' P9 q0 Z
  39. #include <asm/hardware/edma.h>
    , m6 X$ Q5 ]0 r) o! S& K
  40.   Z$ I) r3 }' |5 y6 O
  41. #undef EDMA3_DEBUG
    2 x; @- @7 F5 s2 v) e
  42. /*#define EDMA3_DEBUG*/6 n4 P% p& ?( d0 L) Z- J
  43.   h8 C2 r+ F; `, Y. ?8 K& y1 S
  44. #ifdef EDMA3_DEBUG  b0 x! c! t$ T$ o
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), E8 I- A5 c  A
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 {& W1 G3 l% n9 o
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    4 M6 _- K6 B  @, a$ Y
  48. #else
      t4 f( W- C+ L$ X1 Q
  49. #define DMA_PRINTK( x... )
    . R1 _% m1 Z0 G4 y/ ]
  50. #define DMA_FN_IN
    1 \- H9 Z5 I7 s' ~
  51. #define DMA_FN_OUT7 k4 Q6 A( w3 _/ e
  52. #endif
    , Q, b5 b; s/ Y6 [: k

  53. 2 ~5 ^8 f5 D2 R# @% O5 ?1 m0 O$ h- t
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768); ~0 |" m* C6 O
  55. #define STATIC_SHIFT                3
    ) Y. c) ~) p- N' G) [: I
  56. #define TCINTEN_SHIFT               20
    4 t' J) v1 W% N+ L
  57. #define ITCINTEN_SHIFT              21
    / F: Z- L( S4 W1 Z: a4 m, L  s
  58. #define TCCHEN_SHIFT                22
    9 o1 u( K# [# e! m' O6 u
  59. #define ITCCHEN_SHIFT               23
    ) D) i2 u! c# U! g" T2 p

  60. " G+ E3 B5 ^: l3 K4 O
  61. static volatile int irqraised1 = 0;+ ~- e; f0 l5 G7 R0 ^
  62. static volatile int irqraised2 = 0;9 f$ M3 Y/ f) K: i4 U: G/ s; t7 N
  63. 2 M% \% S2 p& A2 ?" y& H
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) F( \0 o4 H# K& E5 ]- N4 U
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " P. [: m# `/ P3 w
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . U. s) Y5 E% q& ?& F

  67. ; ^8 I$ l6 R" L0 d5 j
  68. dma_addr_t dmaphyssrc1 = 0;
    8 M( q8 u+ |1 n, f
  69. dma_addr_t dmaphyssrc2 = 0;
    : l* C) P, u- j% Q% h
  70. dma_addr_t dmaphysdest1 = 0;# V5 c& W: g" }
  71. dma_addr_t dmaphysdest2 = 0;
    1 ~+ ~2 X1 @7 |* x1 T

  72. + y, ]) }" M- s! j3 ?
  73. char *dmabufsrc1 = NULL;
    $ h6 ]( |0 ^8 @5 R& x9 f+ {* V
  74. char *dmabufsrc2 = NULL;6 E8 c- ^# L# x3 ]1 X. a
  75. char *dmabufdest1 = NULL;
    ; w3 s. Q6 A, D. \. b& B' h% `% t, K
  76. char *dmabufdest2 = NULL;% ^! _  K, x9 m

  77. " p7 }! S  X- |7 j1 }" c5 d
  78. static int acnt = 512;. `6 k( D& S: B$ J' _
  79. static int bcnt = 8;
    ' A' {2 R: C! U1 B1 F# w9 Y
  80. static int ccnt = 8;
    # y( B" f; |. J( B" W" ^

  81. ' ], ?/ u+ s- ?2 P
  82. module_param(acnt, int, S_IRUGO);& b! |# b* Z* n* n
  83. module_param(bcnt, int, S_IRUGO);" D( `- F' o0 v& Q3 i+ Y
  84. module_param(ccnt, int, S_IRUGO);
复制代码

0 V6 f! \( a; M# Z
6 v$ O, Y# H! q, r2 i! M" m* x      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) i) g7 V6 Y: p/ L7 |. l
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" N8 G6 `5 v; e& Z$ J- d     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 R# d, l; [% n% X9 s3 ~7 O% }" K) s: Z) L7 }3 X  c( c& i0 ^

& I3 P& h7 \3 {( c' z8 v4 o* w0 z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-15 03:04 , Processed in 0.039709 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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