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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 Y3 ]  _1 Y) N6 g- k
  1. [code]EDMA sample test application" c$ o( a1 e( w' @, f8 ?
  2. /*4 S5 Q$ `9 `7 [. O. j' c3 R
  3. * edma_test.c, H: M: X5 S1 I3 t4 N
  4. *
    / v, F# P/ z( v6 d
  5. * brief  EDMA3 Test Application
    " r/ |' Y9 L0 }. T9 D
  6. ** E6 n0 P' U% D7 U
  7. *   This file contains EDMA3 Test code.
    / E& L7 n* {# q+ b% S# F- [
  8. *2 N" o: o: ~( M* X! n; v
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" x! L& q2 x# ^/ j; ~1 m; o
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    & h; S( j  b. p3 [! z
  11. *         TO CHANGE.4 Z# g6 B3 Q. N3 F4 ?2 i: z
  12. *
    ) b5 L, T& w0 `/ r5 a6 R+ C. o
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 S- E2 D4 w$ [$ W6 w; p# K
  14. *9 ?! t9 X7 X: Z  K& n
  15. * This program is free software; you can redistribute it and/or( ?# x; u4 t4 M9 V6 w
  16. * modify it under the terms of the GNU General Public License as3 p  {0 t4 V7 a) v& y
  17. * published by the Free Software Foundation version 2.- ?. m6 H) o' E6 ?) Z& |, ~3 i
  18. *
    # o+ y% F; r$ i: c& H  ]
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    . |/ h( ?4 p6 b0 g& j
  20. * kind, whether express or implied; without even the implied warranty
    5 a+ r4 Y8 G! _3 d7 U# a1 ^: G
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the4 S* t) Z- A4 q2 `6 q/ M) o0 J
  22. * GNU General Public License for more details.2 o9 o# K; O7 a7 E2 a1 I/ }/ l. H
  23. */
    # h: P  s% x6 O; \& J# c# B
  24. & q# ^: e2 F! j2 w5 h/ y3 v  c
  25. #include <linux/module.h>
    9 S. L* q, I0 H4 r1 X& @/ V
  26. #include <linux/init.h>
    7 m4 W4 w4 n( _3 t
  27. #include <linux/errno.h>
    ( }( |" _& f6 A
  28. #include <linux/types.h>
    : X+ |+ U; q1 X  k4 ?
  29. #include <linux/interrupt.h>! G/ b; c/ r9 ~: v* r9 e
  30. #include <asm/io.h>' k1 H8 q! G2 X, K
  31. #include <linux/moduleparam.h>" l% |% V" d' [( o: |) x, @6 [9 {4 T* t; ~
  32. #include <linux/sysctl.h>. H, i) l# F: @( y4 j" a3 @# g+ G7 J. x
  33. #include <linux/mm.h>5 s- o/ G+ W$ L( T/ e5 G2 r, R
  34. #include <linux/dma-mapping.h>
    5 I- o2 a! Q! c8 q4 f
  35. # q5 l) k1 F- _4 D6 t
  36. #include <mach/memory.h>, L0 G+ A. `6 z
  37. #include <mach/hardware.h>
    ; F: x9 F! c3 g
  38. #include <mach/irqs.h># l; ?) s# I2 q8 T# r- O
  39. #include <asm/hardware/edma.h>
    + p7 S0 O; P  n( E; t
  40. % A8 r) e* u1 j# L2 l, B
  41. #undef EDMA3_DEBUG+ m, S2 x# ~3 U
  42. /*#define EDMA3_DEBUG*/
    6 i# Z; z3 n1 A; x' U7 X# d5 \

  43. - y) V- d5 R% l0 X
  44. #ifdef EDMA3_DEBUG. j) F2 @/ u$ {) D
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    $ ]. ?# W9 [5 F
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
      G" r! W2 ]7 S0 v
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    7 V1 l# M* j  L1 A: W0 ~
  48. #else
    3 i' N9 u* M( ?3 n0 i0 S# Q/ a8 D, B
  49. #define DMA_PRINTK( x... )( n6 \9 J7 I5 k. [, ^8 ?
  50. #define DMA_FN_IN$ k7 c; V( C# [$ \
  51. #define DMA_FN_OUT
    0 j6 y* A+ c& U' t( Q
  52. #endif
    , D  {/ h: T" k$ w$ P* q

  53. 1 ^) ]; A% @5 D+ b; c: d
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    / e6 ^. b# _0 M2 w) b
  55. #define STATIC_SHIFT                3# |) i5 p% Y( ^0 {' w/ w
  56. #define TCINTEN_SHIFT               20
    9 ^6 [2 L  d; W; i) Q3 a* L# y* l
  57. #define ITCINTEN_SHIFT              21
    * ^0 k; t, I7 I* @$ N5 h
  58. #define TCCHEN_SHIFT                22- g# ?$ p7 a+ |
  59. #define ITCCHEN_SHIFT               23
    9 s3 x/ R' j* d% P/ a7 }

  60. 4 O5 J' `( V& \4 o/ \
  61. static volatile int irqraised1 = 0;5 ~# `( i8 g4 k7 [# }( q! G
  62. static volatile int irqraised2 = 0;
    1 V* |+ x8 {4 w% w* a& C
  63. 5 @$ H4 _; d9 k5 Y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( G" ]$ e8 l  D  j( r$ y7 w) C9 h6 J
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 m( E+ q6 n, I- h% o6 e. W
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % i1 K/ u6 v# @- }* _0 r

  67. , o# E2 }6 H) f# C+ _/ ^
  68. dma_addr_t dmaphyssrc1 = 0;
    ' H- i8 f) b, N
  69. dma_addr_t dmaphyssrc2 = 0;+ J' H9 Z7 }7 k" S9 b0 S
  70. dma_addr_t dmaphysdest1 = 0;
    + b- b* [' O2 j1 N6 O  [4 x: e! z
  71. dma_addr_t dmaphysdest2 = 0;
    7 X; G, }  [9 ~$ ^  x
  72. ! M& s# Y. c7 L* P: M; j  u
  73. char *dmabufsrc1 = NULL;
    : I4 n: T: c9 T  ~; B3 V, |1 X: i
  74. char *dmabufsrc2 = NULL;
    - _. g$ H$ J$ S1 t; L6 k
  75. char *dmabufdest1 = NULL;; E! N$ |# O! a$ K, ^2 C, f9 O7 Q
  76. char *dmabufdest2 = NULL;
    9 p6 ^) F) k6 m* m4 _. g
  77. / Q7 m  |+ K$ q- P" _# R5 c
  78. static int acnt = 512;
    * s% s3 E5 H" l0 e- {" y% ~6 Y
  79. static int bcnt = 8;
    4 @1 V* B  ]0 G1 ]/ W3 Q/ [# H! X
  80. static int ccnt = 8;/ [* T0 E7 Y( Y. ?/ p3 g

  81. - O- E- x" U7 J1 ^, E& r
  82. module_param(acnt, int, S_IRUGO);
    * Z0 M6 J, X+ I- J# Y0 Z' F/ z5 u
  83. module_param(bcnt, int, S_IRUGO);
    . m) }1 s8 v' z, m
  84. module_param(ccnt, int, S_IRUGO);
复制代码

& b# K- m5 s/ S7 E1 ?# [- s0 @: c5 Z# k, z
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
9 C2 |4 O& ?9 g4 D# x& _# U# b! d' Zarm-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 |, i& T8 h' ?  ?. [) U
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: x- z: ]5 K; R. _: P% @

- V; e5 v0 D- ^) ?8 g2 ?9 |0 s/ o0 A' v5 @  A  Y1 ^) I5 J+ l
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-7-12 14:04 , Processed in 0.041423 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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