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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 K$ I# T. t+ V0 n  \
  1. [code]EDMA sample test application# b1 k! y4 A/ Y. h, J
  2. /** E6 o) Y+ ]0 V3 M
  3. * edma_test.c9 Y6 ~- E4 J% E" s. S
  4. *
    ) }0 r2 ]% e# G4 {& B
  5. * brief  EDMA3 Test Application' _' w% c' @* e
  6. *+ k7 K+ M( j! g1 r" P1 f; P/ Y+ |
  7. *   This file contains EDMA3 Test code.3 s& W) T5 v8 }6 B* F% g0 N
  8. */ ^  L$ n8 h5 y& g+ k, t
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 E" y" x) \( G1 ]7 c
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ( v2 e% I0 n  y
  11. *         TO CHANGE.5 c. Z1 W* `1 U; k. X+ H3 E
  12. *  s* `# |% ~1 a2 \9 d8 J
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    - `* d! J4 M$ c) c1 P2 z* C) H
  14. *6 q6 j: w3 t& [& ]7 d; [2 t4 f
  15. * This program is free software; you can redistribute it and/or
    " Z4 c6 _. h$ ]
  16. * modify it under the terms of the GNU General Public License as$ I6 C. I6 X& K' d$ g5 l
  17. * published by the Free Software Foundation version 2.
    ! [/ {, \2 T8 ^5 j- @# T" E
  18. *
    * z' Q# V( `- K! P8 @' v
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ! F* ~. U0 |( S- z  |
  20. * kind, whether express or implied; without even the implied warranty- C0 u' F, M. T' {
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the3 c4 p1 e* X' k
  22. * GNU General Public License for more details.. I1 [7 ]' G5 t: X  \6 R
  23. */
    ! W+ N2 K) `6 k" |5 m; p5 ~) Y# C
  24. * e: }9 X3 J3 o& @# C7 T2 v
  25. #include <linux/module.h>9 m6 U7 U/ k( I9 v
  26. #include <linux/init.h>2 _$ U( m# l& U
  27. #include <linux/errno.h>* n7 \- i4 M* O5 {
  28. #include <linux/types.h>5 R# s9 b$ Q' c. h' ^, X
  29. #include <linux/interrupt.h>4 t& a8 }6 {% P
  30. #include <asm/io.h>; d- G6 a9 Z, U0 c
  31. #include <linux/moduleparam.h>) V$ u" b" i# z* [
  32. #include <linux/sysctl.h>6 V( k. D* [( a# l4 w* ^( ~3 K
  33. #include <linux/mm.h>* C9 a6 Y" L6 Q& v8 K# x
  34. #include <linux/dma-mapping.h>
    . M. M# z) {, ?$ G7 j
  35. ! M) ~: P: ^9 r! d
  36. #include <mach/memory.h>
    . V2 m6 |0 M- P: p4 q
  37. #include <mach/hardware.h>! h1 x/ }( s: s; n
  38. #include <mach/irqs.h>8 z" e0 ], {2 L
  39. #include <asm/hardware/edma.h>) H5 h! @! f, J, W% n
  40. . M2 i! Y5 \, k, l6 Q- v) L
  41. #undef EDMA3_DEBUG% A+ F3 g! A4 L/ e5 O% ]
  42. /*#define EDMA3_DEBUG*/
    # q; I6 Y5 F3 q& h' v
  43. - G7 f; z( U4 l
  44. #ifdef EDMA3_DEBUG
    0 W  ^( ]7 W! q: o/ n. r& p
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ ]$ F7 q  e7 e& k# F# u
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    7 ]9 V; d4 y: F
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); w: j% l7 Q- T% i0 M
  48. #else; W$ \# q4 Z* r. T- ~2 s1 j* `
  49. #define DMA_PRINTK( x... )# X( R. K% [  Z$ X% s
  50. #define DMA_FN_IN
    ; X& X7 q' z: n; M$ R
  51. #define DMA_FN_OUT
    5 J) t6 s, a# Y
  52. #endif5 V7 w& N' k# T! P7 J

  53. " q* `' N. V0 n* T. S# G
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)( l* Q1 Q. w& B$ H+ W3 ?
  55. #define STATIC_SHIFT                3$ U7 x2 m& f6 g( P% r/ W* J6 Y, c- i& G
  56. #define TCINTEN_SHIFT               20
    ' d; Q5 l8 |  G4 q
  57. #define ITCINTEN_SHIFT              21$ c" d& u4 I. P3 v
  58. #define TCCHEN_SHIFT                229 h* R& o; G% b! o
  59. #define ITCCHEN_SHIFT               23, m7 a1 B, ?9 ?+ I" q
  60. 3 X5 b" J9 i$ i8 }+ C: m; `
  61. static volatile int irqraised1 = 0;
    / E. X$ }' u% L0 p4 O8 {- s9 j
  62. static volatile int irqraised2 = 0;
    . C% B) o/ L6 b8 @1 Y! |# W# O+ ]: _0 W
  63. 9 E( o2 c) K0 C! F. Z  F& G
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , g9 d, [' p- L: c, `# E6 j& J
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; X! x5 l9 Z$ m+ `% z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ R% d5 K* h; d3 l: y: r
  67. ; j. X3 K( N% C* d
  68. dma_addr_t dmaphyssrc1 = 0;8 _* o& i: H" O* p
  69. dma_addr_t dmaphyssrc2 = 0;+ m8 D& L' `! `; P& b* `/ t1 o9 C
  70. dma_addr_t dmaphysdest1 = 0;
    : s8 D2 X/ v0 F3 R7 P1 v9 ?. m
  71. dma_addr_t dmaphysdest2 = 0;3 w; \% M( f) c$ g: o. X$ T- r& s" l
  72. ! T2 z# q3 s# m, S' }) H) A0 _; C
  73. char *dmabufsrc1 = NULL;5 Z; a& i/ E, Q: H) s3 e+ J
  74. char *dmabufsrc2 = NULL;
    / g. l# r* T0 V4 v- n
  75. char *dmabufdest1 = NULL;+ w; Q( Q% H+ ?6 t6 k2 M/ k. S
  76. char *dmabufdest2 = NULL;! e  U' \) I+ y( D

  77. : J% ^3 y' A# H) w; f  i$ W
  78. static int acnt = 512;
    1 F$ V' g- h: j  ?. n- z; n
  79. static int bcnt = 8;8 ?! a. r; D0 \) H  N7 `) _
  80. static int ccnt = 8;
    1 r' E8 V) A( S& |" C) G' Z
  81. / E2 O; `- m  u2 w4 P9 P9 ^( G) L
  82. module_param(acnt, int, S_IRUGO);
    ( n6 s6 d! y4 A
  83. module_param(bcnt, int, S_IRUGO);" U% M' r1 h8 i7 s$ `
  84. module_param(ccnt, int, S_IRUGO);
复制代码
" T' U' }: E: O

/ v  R+ J9 S  B      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, F8 @/ D4 v$ y+ V+ j/ v
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% G& a+ b1 Q2 q7 u6 x: @     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 ?. d) K! g5 \* c8 s; P; z. H% @+ O5 b& y

) D5 j5 d9 {" ?' _! D
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-24 19:05 , Processed in 0.038812 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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