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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 I# d, j. Q- r: a/ q  F1 b
  1. [code]EDMA sample test application
      Z8 P7 {0 f  B( t$ }" P
  2. /*
    4 ?4 X* N1 q$ T
  3. * edma_test.c
    & @2 w, |) l% D9 i
  4. *
    ' F* N# {8 S) S) V9 S9 X8 F! @3 U
  5. * brief  EDMA3 Test Application
    : Q+ D+ u, @7 _4 X, _
  6. *
    " q: k3 M8 `$ y; F
  7. *   This file contains EDMA3 Test code.
    + d' r' S9 h7 w7 X6 I& h0 a/ Q
  8. *
      ]* g3 U+ ]$ `5 F
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    , T9 `/ c2 S$ _1 t* j# y6 @
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) D3 l* I( m. O
  11. *         TO CHANGE.
    8 n7 y, _- c. a* N  {' U3 [  x
  12. *
    - c* z1 r- z6 X; i& K* g
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    2 Q& C3 u5 M* u
  14. *  ^0 Q/ Y5 a- V! q
  15. * This program is free software; you can redistribute it and/or2 A2 A) m" u6 Y) M: N! C. M4 d
  16. * modify it under the terms of the GNU General Public License as( C: q! f7 x  `# K2 L
  17. * published by the Free Software Foundation version 2.
    3 ~- W: u' k9 ^; Q$ Y0 s
  18. ** U. i& q; x. F5 V* X/ ~
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 W/ [, ^+ U- o8 n
  20. * kind, whether express or implied; without even the implied warranty
    + K1 a  d* ]. C3 p
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the! b1 [8 f  t3 @  R  q$ L/ y" R
  22. * GNU General Public License for more details.
    1 ?3 y8 [  b3 i
  23. */* E+ m' Y4 d1 ^$ c7 J& k
  24. 9 H- d4 y$ b  K2 n7 d0 p1 W! {
  25. #include <linux/module.h>
    5 E( D6 K' g# V0 @2 D
  26. #include <linux/init.h>/ R" L) W5 r; T3 D0 G9 Z* M
  27. #include <linux/errno.h>9 W. l/ [/ A: U, I3 {" L% [" b
  28. #include <linux/types.h>
      |+ K9 |% M2 ^) Q# |
  29. #include <linux/interrupt.h>8 {' W8 @' M. r+ D8 x& }+ }
  30. #include <asm/io.h>6 p$ u" a# ?5 s
  31. #include <linux/moduleparam.h>
    9 ]& O0 T3 N1 I" Z3 c: V- F9 F
  32. #include <linux/sysctl.h>& P% {. W; T5 C" A7 h
  33. #include <linux/mm.h>5 a0 n/ U/ v: I% b
  34. #include <linux/dma-mapping.h>( H# R5 [5 y2 }7 U' Q+ Y

  35. ' t/ q8 O. N5 ?$ B
  36. #include <mach/memory.h>. I8 ]2 Q- |* I% a+ w9 Y# H
  37. #include <mach/hardware.h>& H4 c& F; J+ K# j' T% \: o
  38. #include <mach/irqs.h>: x$ [# e0 q# U7 X$ d. o! z; v
  39. #include <asm/hardware/edma.h>& a4 f  J: j4 R3 W  a7 S9 }* k

  40. ! X& @4 p# o+ [( K/ `& f4 _5 V0 u. V! R
  41. #undef EDMA3_DEBUG
    + L: N+ n8 }; S" t" a" H* p
  42. /*#define EDMA3_DEBUG*/# M5 p$ G! ], S0 p2 a
  43. 5 [7 P  X5 L' {' `. l
  44. #ifdef EDMA3_DEBUG
    . S' r! j$ O- o' _9 X4 A
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 D8 H9 s+ d+ E; p- _5 P* V! C6 l
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    - N+ o& {6 q) W9 U$ A1 O
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 R( Y; Z6 |5 |2 i7 V& a& \! `
  48. #else
    # T2 Z; V! b4 H1 B0 n) x& W
  49. #define DMA_PRINTK( x... ); t0 P* g! c# K# A' j4 C$ X$ O
  50. #define DMA_FN_IN
    1 f9 p1 C, x, M* B
  51. #define DMA_FN_OUT
    % v# v# Z) S$ H  |. r5 j9 v
  52. #endif2 h1 d5 r$ C- R% `, Y; D7 B' S. d
  53. ( |7 j( j) e$ s7 n' m% _6 C
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768), C5 c# ]8 ^2 {! b8 j0 L
  55. #define STATIC_SHIFT                3
    % ]- L* T( n! ]1 s1 Q3 |/ E9 l
  56. #define TCINTEN_SHIFT               20
    . K' P; m5 Y1 `
  57. #define ITCINTEN_SHIFT              21$ i" Y8 \4 O7 X; B6 o  ~
  58. #define TCCHEN_SHIFT                228 @. y* g: J9 e& v
  59. #define ITCCHEN_SHIFT               23
    ! f  q. ^) m, j! f( i+ K, b

  60. ! k* |9 ~) R" f/ q1 K: Z  \; o
  61. static volatile int irqraised1 = 0;
    9 E% P; W/ b" t1 U6 x7 V
  62. static volatile int irqraised2 = 0;$ g; U$ t& j- P: T( C4 h8 z4 x( S

  63. $ ~( A, a, ~+ M4 _
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . D1 H7 j; h" G: I
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 a! f% h/ o& l' u# x, D& O* a
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 I: @' u1 x. f6 c9 Z2 h
  67. ) |( ~6 Z2 s3 I5 a
  68. dma_addr_t dmaphyssrc1 = 0;, m! U; ~0 l: A0 L& e
  69. dma_addr_t dmaphyssrc2 = 0;$ w2 h8 F- X! V
  70. dma_addr_t dmaphysdest1 = 0;8 ~8 w6 u2 C" M7 N3 ~
  71. dma_addr_t dmaphysdest2 = 0;' U' U9 C/ K! g, p
  72. 3 u' `. n, `! U" C
  73. char *dmabufsrc1 = NULL;. F" j, C2 |0 q
  74. char *dmabufsrc2 = NULL;3 i  v" H  S5 b
  75. char *dmabufdest1 = NULL;
    6 c5 `1 h2 D! H  j0 y" O( e0 }' `
  76. char *dmabufdest2 = NULL;4 P9 ~" C) r* `2 `. q" u" |; c+ {
  77. : p1 B2 N8 j2 ]- g5 y: d6 _- C
  78. static int acnt = 512;
    ' Z3 p- b* p% @) `6 ?
  79. static int bcnt = 8;
    & Z1 K9 N# W: v: L( Y8 y* G+ B
  80. static int ccnt = 8;
    $ f. y& ]2 h6 y
  81. + Y6 t8 }9 O) w" R- t& f5 r
  82. module_param(acnt, int, S_IRUGO);7 k% `8 G' L# p) ^- ?8 ~
  83. module_param(bcnt, int, S_IRUGO);
    - r/ ^5 V, g) m: a  q2 b! O$ V
  84. module_param(ccnt, int, S_IRUGO);
复制代码
4 z: L3 ?  ]3 U: f$ I
. N* l9 c" F. H
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: R1 s8 L! `: V2 D! w' B8 \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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 ]  q9 {% ]( h5 w6 t
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 Q+ G) m( z- \4 Q1 l6 _
3 |3 A6 y3 G5 G/ O# m+ s9 ?( W
  X) L+ O. P8 g! L8 d4 O  N
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-16 10:49 , Processed in 0.039190 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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