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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # m7 c: f- U9 \- P$ H  u& I
  1. [code]EDMA sample test application% n) M* a; F; B, p
  2. /*
    + t) ]) H, Y- e% h9 e
  3. * edma_test.c" ?* J, M. ^# N, q$ P# P: ?6 J! v
  4. *
    : o6 Q& C" w6 A/ Y1 H' _
  5. * brief  EDMA3 Test Application
    5 g) f+ T# f9 J. g! H( n+ Y$ O
  6. *4 q  `) `- ~+ n1 [( h
  7. *   This file contains EDMA3 Test code.
    1 F7 e; p" R* ~1 g) @- {
  8. *
    " i; q; W% W( \
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- `% |: z8 e" c$ L- j
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
      V& W" u, _! V- p# ?0 O' w' d1 |4 _
  11. *         TO CHANGE., j& y* F8 C* [& n  T' H% \
  12. *
    # p+ p' r# b2 H2 p9 [6 n  p0 N$ {
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 i6 M6 Q  E) b9 r# z
  14. *( J, h$ g! a! G8 }
  15. * This program is free software; you can redistribute it and/or
    7 T' |2 S4 R! {- W/ ^
  16. * modify it under the terms of the GNU General Public License as) o5 ]! j' R: |3 z0 }
  17. * published by the Free Software Foundation version 2.
    * e- I1 x: ~% Z6 y5 ~6 o% R, {
  18. *
    / A: b- P$ G6 n2 K
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 y% U9 n( B  @2 H
  20. * kind, whether express or implied; without even the implied warranty
    9 g$ E, f1 C& V0 z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the7 ~, r  y" B- S
  22. * GNU General Public License for more details.
    4 g) w9 q5 s( a$ I1 H8 C9 G
  23. */
    ! o1 U& ^# F* q7 @5 t: U6 a

  24. " R& g" G/ n6 A2 ]
  25. #include <linux/module.h>
    " B1 u# Q- P9 C
  26. #include <linux/init.h>
    " g% d) R% W8 @! o  `: D0 w' d
  27. #include <linux/errno.h>
    + {& D% K4 F4 o3 h$ b" `' d( y
  28. #include <linux/types.h>
    9 U3 _6 @; A' e7 W
  29. #include <linux/interrupt.h>
    6 T; _, |: h) q8 Z( i' `* m- X, _
  30. #include <asm/io.h>
    / _9 \5 Q* ^% e; c& r/ \- w
  31. #include <linux/moduleparam.h>% [* `* S' R( m0 _  [
  32. #include <linux/sysctl.h>
      y. C7 d, z  ]" E" i& }9 I
  33. #include <linux/mm.h>
    3 I- [- d% L# c
  34. #include <linux/dma-mapping.h>
    ! L# i4 G4 P, G' f1 C

  35. 4 p) `: W: _. P) F+ W) h2 f7 i2 |
  36. #include <mach/memory.h>
      {2 @& E! ~4 ^- m' U
  37. #include <mach/hardware.h>
    4 J6 ?6 \. S1 p+ E" \+ s$ K8 h
  38. #include <mach/irqs.h>
    ' G: F4 }. z8 @6 d$ T0 c0 b, m
  39. #include <asm/hardware/edma.h>
    ( o/ S4 C3 h2 t. I, U( N

  40. % r: S& b+ C( I0 ~& C' s
  41. #undef EDMA3_DEBUG
    0 _3 N4 f- I2 L9 N
  42. /*#define EDMA3_DEBUG*/
    % C$ Z+ @8 ?* A5 I8 x& I$ T
  43. ! g  z; d4 M+ ]8 V
  44. #ifdef EDMA3_DEBUG. j7 w( ~- G( s! H6 J/ i
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 d1 H% N: V$ q$ Q! M7 B
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ H0 s, H& x7 l* M
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ; F* P; T( b0 t5 Q8 j/ Z
  48. #else
    9 Q, K) f5 p) \
  49. #define DMA_PRINTK( x... )
    - ]8 Y3 m9 \* N, c6 x
  50. #define DMA_FN_IN1 S  L) I9 e5 s* P" t4 D% l
  51. #define DMA_FN_OUT' g. y( Z! j5 f+ C2 p3 k9 E- i
  52. #endif
    ) n+ |2 @) j, `
  53. : }! [8 T' Y& w8 x1 f: i
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)) e. ?6 o& M( B$ Z9 E
  55. #define STATIC_SHIFT                3' }( Q- s( X7 @/ i+ p  n
  56. #define TCINTEN_SHIFT               208 y' b6 x7 t& Y3 A9 z) C1 E5 [
  57. #define ITCINTEN_SHIFT              21
    7 P5 Z  c8 m" }: X( {4 u- j( n% A
  58. #define TCCHEN_SHIFT                221 Z6 t% N+ H$ l2 C! D
  59. #define ITCCHEN_SHIFT               23, a: E! s; L1 |) Z9 O. j

  60. , q+ }  g5 d' @$ R
  61. static volatile int irqraised1 = 0;# F% ]  l$ I; e* H: E$ @3 D9 z- }
  62. static volatile int irqraised2 = 0;
    ( C6 A; m& n& L8 r! d

  63. + V: y! N% K5 h$ p# r
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      d% }. y  F0 J; k; L, h
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 ]. \, k8 U( H! z( F; R
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 E% ~& V3 `/ `/ C9 u: p

  67. ; i: e: {1 s4 n+ ^' E* @8 j9 x; u
  68. dma_addr_t dmaphyssrc1 = 0;
    + k4 X$ c& o2 e" e7 ?' \
  69. dma_addr_t dmaphyssrc2 = 0;
    . k! h0 j! U/ Z6 \+ \; A4 Q" X: b
  70. dma_addr_t dmaphysdest1 = 0;+ z: O6 l" q# w' ^3 b6 }4 ]1 G* `
  71. dma_addr_t dmaphysdest2 = 0;
    ; U" M7 h- f# W" ?  ~- D8 [! C

  72. ! l/ x( V8 H- G4 `. `6 o
  73. char *dmabufsrc1 = NULL;
    / k' _  w  r+ L6 r0 |9 A
  74. char *dmabufsrc2 = NULL;( N# H# ^- Q% k  F9 ?: p( }1 O7 \
  75. char *dmabufdest1 = NULL;/ J6 {# Y( V" ^9 N2 u8 P' t
  76. char *dmabufdest2 = NULL;
    % e( n- M; @% N- J

  77. 9 u- M+ t, l- |6 r) w
  78. static int acnt = 512;/ p( n- O, u0 l, ~  G, N0 j" ^0 v. D* A
  79. static int bcnt = 8;
    2 V2 w( u4 p# V. a5 K8 N
  80. static int ccnt = 8;
    * d( O+ W, G5 @5 u) I$ _

  81. 0 ?6 m8 ^" x9 d( j: w
  82. module_param(acnt, int, S_IRUGO);
    * @3 C% O- K2 [
  83. module_param(bcnt, int, S_IRUGO);# ]/ z& E5 h' ~0 X6 ~
  84. module_param(ccnt, int, S_IRUGO);
复制代码

! L- s% G# |9 |; U$ P; w+ L; y# ]0 e; T; A  _; q" |0 Q% \! ~
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 b& D$ w  b* ?/ carm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ N# J4 L6 `& a# B     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- G9 s! S1 k0 T3 j! G

5 I3 R/ i  O- R7 g  {" t4 h; G* l: B+ k8 D
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-7 04:30 , Processed in 0.040076 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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