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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + x9 \3 `/ ^2 V6 ~
  1. [code]EDMA sample test application9 P; q! ^5 X' e) ~' h5 v8 T
  2. /*
    9 L! e; ], w. C' H
  3. * edma_test.c8 @. M+ u/ X2 x$ }' M# q! m
  4. *5 m+ o7 e1 @! V3 v! P# q, c
  5. * brief  EDMA3 Test Application$ G' I0 z$ f9 l. |2 ]$ d9 c' z5 F
  6. *
    7 h6 _7 X, o! V: T: J: ?. c; y
  7. *   This file contains EDMA3 Test code.
    % \/ p9 ]' e: R, P1 h! v, C4 [/ w; h8 d
  8. *
    ( k% |; ^( E: l, n0 U
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    4 D2 c$ `5 z- C9 b! l) H/ m
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
      t3 q% E1 F4 `1 E2 K$ z7 h
  11. *         TO CHANGE.
    % K, a5 D% r! ]7 o  S
  12. *
    ) T1 z* x. \; o* R
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    5 p2 ^4 L) }1 h
  14. *2 N( D! U( ~1 D, Y( [9 t7 \
  15. * This program is free software; you can redistribute it and/or
    6 V& L" |6 }9 x9 ^
  16. * modify it under the terms of the GNU General Public License as
    ; s4 k* ^2 C2 _( m9 d8 Y+ q: H
  17. * published by the Free Software Foundation version 2.! r7 R) i. P9 K) S# Y: S
  18. *
    ) k9 K7 R( ~# h
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 M! S8 ~( |; X2 ?4 k  ?9 ]7 T
  20. * kind, whether express or implied; without even the implied warranty" N$ i7 t( @9 n( b
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    / S  `+ j. R8 d+ u8 d* E) `
  22. * GNU General Public License for more details.
    ! n9 F  M) P# r: \% _
  23. */9 g8 P: G1 a/ f3 I% J& _

  24. - _: k- {$ Y0 {
  25. #include <linux/module.h>% @# b* ?5 |2 s! l- K
  26. #include <linux/init.h>1 R# \3 s6 x' p3 X7 a$ x) S1 o- t/ J
  27. #include <linux/errno.h># t6 q. r6 E5 t7 F4 V
  28. #include <linux/types.h>
    % Z3 L- x3 a  |0 Z7 z  g
  29. #include <linux/interrupt.h>
    5 k# f4 q* X6 s1 h' G
  30. #include <asm/io.h>
    7 s0 w3 Z" D: W! n8 h
  31. #include <linux/moduleparam.h>5 X# \4 V3 w& ^, W8 T2 ]' v
  32. #include <linux/sysctl.h>
    - m9 V' S; x' E
  33. #include <linux/mm.h>  v) D8 N8 P( H  |+ M( @% C& I
  34. #include <linux/dma-mapping.h>
    , ~* E. u, o7 Q6 @' ^1 J* ?! Q
  35. - A; B: |: D) _5 D6 B. ?  D" @
  36. #include <mach/memory.h>7 E( V2 X0 I9 g+ B9 ~' }
  37. #include <mach/hardware.h>
    % A8 Q6 z, t0 R* u7 N
  38. #include <mach/irqs.h>$ P# X1 L; ?/ }2 Y
  39. #include <asm/hardware/edma.h>
    % h8 g7 |+ S; i0 r( V

  40.   V: l8 l, ^1 ?- ?) {9 w. `
  41. #undef EDMA3_DEBUG
    4 H( y# F0 V, p/ r5 u
  42. /*#define EDMA3_DEBUG*/: F; L- z' j2 E

  43. % ^* h: D- {$ W: ]  k) b. k
  44. #ifdef EDMA3_DEBUG$ ]5 r: n" V, Y5 K1 n
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    % ~; l1 ?; W1 L5 v- H* J, g
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    + P! |* u: Q1 t9 D
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' ?/ A# D, b2 @& D% c: o1 Q5 ]
  48. #else
    " S  ~% r  C: I7 n  f+ e0 ^
  49. #define DMA_PRINTK( x... )* d6 K, t: L' g0 E7 o6 d
  50. #define DMA_FN_IN- j! l8 h8 p; I- o- T
  51. #define DMA_FN_OUT
    : b2 K. {. q! A+ A
  52. #endif. {( F4 W! U; y* E& u3 E2 W9 ~

  53. $ o4 q% I$ q8 N& y9 f- ^# A: N
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768); m  R2 s# T0 U1 Q, E% o$ j
  55. #define STATIC_SHIFT                3$ d' v7 g9 t, b- e$ _# `5 N
  56. #define TCINTEN_SHIFT               20* R4 c  {; e7 `4 b% ^8 C
  57. #define ITCINTEN_SHIFT              21
    # z7 l$ q# P" M4 ?
  58. #define TCCHEN_SHIFT                22
    + H; b; S/ r) V$ j# f  \7 h$ e
  59. #define ITCCHEN_SHIFT               23
    2 Y; O% `* z3 r: U8 Z
  60. : N  x6 u7 y  E7 j) t
  61. static volatile int irqraised1 = 0;" `, E; f4 D# Y2 @$ U9 D
  62. static volatile int irqraised2 = 0;
    % a, b$ y+ ]2 O" ]0 Z: e5 h; n
  63. 3 V0 E# k, M0 g" B2 X% j
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 u6 q' H7 [' v
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 n' m+ `; Z4 [9 T
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! G' u' R! ], A2 `

  67. . Q/ p$ v7 i' b/ T" y  j
  68. dma_addr_t dmaphyssrc1 = 0;1 r3 p7 K4 r# [# ?# o+ k+ f: G
  69. dma_addr_t dmaphyssrc2 = 0;
    1 n( p' M( C0 k5 a# f* W
  70. dma_addr_t dmaphysdest1 = 0;
    0 w2 _+ g' F0 e$ ]
  71. dma_addr_t dmaphysdest2 = 0;0 L. D7 b' m- b
  72. 9 r. L7 ?6 y1 u- l# s' ^# R
  73. char *dmabufsrc1 = NULL;. D4 ]' D: f' \6 I  v5 M5 g/ b
  74. char *dmabufsrc2 = NULL;$ \& V, o  z5 u% K; Q7 X
  75. char *dmabufdest1 = NULL;# @1 t& H  u; K3 ~- K
  76. char *dmabufdest2 = NULL;) W. A9 ?- q: Q! R2 D3 d. w( u5 m
  77. $ t; E3 ]9 l* |7 H* J
  78. static int acnt = 512;
    * r& x" b) q7 `3 N" N; V, N
  79. static int bcnt = 8;
    : d0 i7 X- y9 Y2 O
  80. static int ccnt = 8;
    : ?7 K/ Q/ X: s8 X- f
  81.   N2 I/ Z6 ^: ~/ c# o- r
  82. module_param(acnt, int, S_IRUGO);
    ( f! E6 S$ H, G3 F$ @- x1 c
  83. module_param(bcnt, int, S_IRUGO);! e+ V5 K- K* d5 }
  84. module_param(ccnt, int, S_IRUGO);
复制代码
: x( ^7 q3 w* M- l- Z6 Q- Q+ S
& O. p( U: W2 r
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ c3 ]  R6 Z  ]6 Narm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
  ~7 L' T* u* |/ j3 x     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* @8 P& Y! a" M! e5 y; N1 b$ W; i/ O* f/ `
3 Q4 J3 \( X& U7 k6 Y' Y* @
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-3 00:10 , Processed in 0.047089 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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