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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 v/ E6 |6 x$ A: G9 C9 [
  1. [code]EDMA sample test application
    . W5 l8 D5 _+ ?0 c
  2. /*
    9 A/ F  @" G( A6 P% j
  3. * edma_test.c9 R( z( \0 B$ w7 k. m3 S* r$ F
  4. *# V9 ^1 \$ U6 p+ ~0 c
  5. * brief  EDMA3 Test Application
    0 s$ I: \& v. D
  6. *- k5 p6 L, {* t* I- w  @8 r' q
  7. *   This file contains EDMA3 Test code.( b. X( v* x% D( I% ]1 B1 x# E
  8. *
    1 x9 W9 D2 B. P- ]5 A3 Y3 q' q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    / m& T& s) ^- h* m
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT  j7 Z: l% [2 B+ T
  11. *         TO CHANGE.
    ) l0 _/ w2 B. z. [) I
  12. *0 t( }  \; m) s: c4 a3 P/ G( o: n% j
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    * k! a$ e( {4 @0 j
  14. *! M8 t+ d, J" C6 L5 D1 ^4 T- d2 J' _
  15. * This program is free software; you can redistribute it and/or# }5 j) u1 x7 \# c* r3 ]9 y
  16. * modify it under the terms of the GNU General Public License as- T0 h/ W0 j" t$ y, j9 J$ \
  17. * published by the Free Software Foundation version 2.% P; q* Q. `1 O. G
  18. *
    8 J1 ?: I% U$ @, s% m
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ C2 i" |) S$ i9 w/ q& W% {1 Q
  20. * kind, whether express or implied; without even the implied warranty6 |# E9 ?: c7 G! D2 K9 b% g
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the" }$ E1 a1 X5 O4 u6 Y
  22. * GNU General Public License for more details.
      F5 M$ `4 U; t- y/ Q) x
  23. */
      j+ j" E, H) K
  24. / p8 `% c* T9 m. U' T' E! B
  25. #include <linux/module.h>
    : y! A9 }/ G6 ?* U3 D! Y
  26. #include <linux/init.h>) x- B8 t0 \: K& g/ E- a$ `
  27. #include <linux/errno.h>$ {& c: N, B1 M/ {
  28. #include <linux/types.h>) g. g3 a8 e/ Z, B! S
  29. #include <linux/interrupt.h>
    7 _. l$ _  x: ^# |# s7 M
  30. #include <asm/io.h>- }3 O/ S/ d* R1 n" k; _: g% j
  31. #include <linux/moduleparam.h>3 I3 b7 L. Z9 W$ u2 r& E4 X
  32. #include <linux/sysctl.h>
    " l. F9 e/ K- n0 R( E
  33. #include <linux/mm.h>" a+ ]" `1 |! M+ T  o
  34. #include <linux/dma-mapping.h>7 Q" Y( t2 _% u- P1 k! F7 ]: ]
  35. 2 w0 s3 U- F8 `6 N* `
  36. #include <mach/memory.h>
    ( t5 b; L' ?1 X2 q5 U: O3 G# _
  37. #include <mach/hardware.h>4 Y; d, }) A8 {& Z9 }- Q
  38. #include <mach/irqs.h>& [- A# }+ [( l8 v0 M
  39. #include <asm/hardware/edma.h>
    4 E6 ?$ c* F' b" F( s$ _
  40. , @) j9 D' i5 v4 n, m
  41. #undef EDMA3_DEBUG
    ! ]. ?; _- `! U& V
  42. /*#define EDMA3_DEBUG*/
    / M* p. g" h4 e" t6 _) Q! x

  43. 2 a$ g# l6 w1 N- g
  44. #ifdef EDMA3_DEBUG
    $ u4 w5 y8 [9 L" `8 c: i
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    # V2 x# d/ r2 @
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" W0 f; Q, t; p' e$ @
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    9 c# t/ {0 R# z! Q8 |  H
  48. #else
      y4 w; Z$ k/ p4 ^' f
  49. #define DMA_PRINTK( x... )
    & X/ e- L4 _/ f% s+ x% d
  50. #define DMA_FN_IN) r5 F( W; Q1 I! c- z: k1 q
  51. #define DMA_FN_OUT: d: i5 m* i+ A2 O
  52. #endif+ R+ f/ n0 }' ]0 \: y6 p
  53. $ w- X6 R6 l% f" D$ ~
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    , K# O$ q# F, n% l0 S: F$ E
  55. #define STATIC_SHIFT                3' l! J3 [" z  g& X# |6 e) v, T: |# _
  56. #define TCINTEN_SHIFT               20
    - {' M7 ?% k* \7 e& k
  57. #define ITCINTEN_SHIFT              21$ N* t/ E& e3 L" m$ _- E- ^" U5 |
  58. #define TCCHEN_SHIFT                22
    3 X- \7 k* I5 O% o2 s
  59. #define ITCCHEN_SHIFT               23( F8 }* q/ i9 Q. r
  60. 7 \# n8 W7 q  S6 G/ [4 L8 @
  61. static volatile int irqraised1 = 0;
    0 _# R- A  c# Y- |6 s: s9 k+ x
  62. static volatile int irqraised2 = 0;
      o; P9 `7 W, n( H3 r

  63. 0 i! [0 F$ V7 g9 N1 f7 t% d
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ `/ _$ Z5 A; z* Q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * Z1 M9 ?# S9 j- B: c/ [& v3 E" Y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 B( v, |5 K0 W1 l& P

  67. $ x  l. u0 W1 Z% s
  68. dma_addr_t dmaphyssrc1 = 0;
    / P% _) `5 l" _, p
  69. dma_addr_t dmaphyssrc2 = 0;4 F' E/ p% U0 N; K
  70. dma_addr_t dmaphysdest1 = 0;' m( K$ I- H9 ~
  71. dma_addr_t dmaphysdest2 = 0;2 h* X7 B* {2 k

  72. 8 ]1 \) d$ c7 |  w* c- t5 X
  73. char *dmabufsrc1 = NULL;
    8 e) A6 E, j  o9 E( N% ^% w. U% ?
  74. char *dmabufsrc2 = NULL;
    , n. _  @$ a1 y/ l
  75. char *dmabufdest1 = NULL;7 x! B' j9 x/ [; K' q
  76. char *dmabufdest2 = NULL;1 Z- l" U$ e2 E5 c2 |+ S
  77. , K/ G3 z5 S0 J, G* A
  78. static int acnt = 512;0 o8 x/ ^5 q! a
  79. static int bcnt = 8;" u3 v9 v8 }' O6 J4 a
  80. static int ccnt = 8;
    5 T! t% H4 ^% B4 e) @
  81. % t  C: J8 J$ M- y; I
  82. module_param(acnt, int, S_IRUGO);' h9 q! `% W. j+ q
  83. module_param(bcnt, int, S_IRUGO);
    + D/ V; ?6 n# F
  84. module_param(ccnt, int, S_IRUGO);
复制代码
$ i) l% N% t* v4 k/ k+ ^

$ h8 r3 I5 J/ f' ]  b& K      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# p7 E: ]5 I  ]4 q& O+ e3 B0 ~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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. ]6 _; J) c: w. C1 k
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% @4 p  N) [# T9 ~4 e  ?
' l; b+ s% S" n3 m: s, Z4 u+ G9 S5 o0 r8 W9 R' p
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-23 02:55 , Processed in 0.040420 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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