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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( B/ S/ G; C5 N
  1. [code]EDMA sample test application
    4 u# p5 x# l$ z  A' ^6 r" r
  2. /*! W9 Z: U* I! i, W
  3. * edma_test.c
    & I/ {3 h8 N3 [( t2 B
  4. *
    3 x! M1 a7 I3 n( j
  5. * brief  EDMA3 Test Application
    # m" y. g" ^& L( S( s4 f. y8 i
  6. *1 S3 |6 R- H2 p2 D' p$ G
  7. *   This file contains EDMA3 Test code.
    * R& r! e' W" b6 z
  8. *1 Z8 i* b7 F, L( G; p3 C
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    " ^" }% a7 x" W( I4 h4 Z
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    % _* w% }8 I: W6 X
  11. *         TO CHANGE.
    ) i0 b3 Q( a& E" c" V
  12. *% _0 ^3 m5 p0 u8 b
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 R! z$ _& J1 y* y$ C" W
  14. *, t6 W/ F$ d$ y- c" d! v
  15. * This program is free software; you can redistribute it and/or# s% Y/ C$ S0 l$ N2 T
  16. * modify it under the terms of the GNU General Public License as6 _* A6 {8 T! H% i& u* g) l' _
  17. * published by the Free Software Foundation version 2.% o" g- @# E+ s. d
  18. *
    % z3 s$ k. B- n6 z6 M
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 e0 B$ a/ x5 _+ `" l2 s
  20. * kind, whether express or implied; without even the implied warranty
    $ C$ L- k) N" W. z; f* {2 t
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the. m( J; i( a1 f( o) p3 B! e+ V
  22. * GNU General Public License for more details.
    0 P9 Q6 Z" R8 E5 z" }
  23. */* K- d# m, L8 O5 a' D1 `
  24. 5 e, P' }# C$ \6 X+ z9 ]- r
  25. #include <linux/module.h>
    % w5 J9 O$ ^& F5 n0 P" _
  26. #include <linux/init.h>6 `1 D. p- n% l3 S
  27. #include <linux/errno.h>
    & {5 c7 o0 I; U$ o% U
  28. #include <linux/types.h>3 Q# N% R3 s. l, N
  29. #include <linux/interrupt.h>9 S, _. m- X  M/ ^# q( N& `' U
  30. #include <asm/io.h>
    " N; o2 X4 _9 t( v/ y' j8 u
  31. #include <linux/moduleparam.h>
    3 B9 s: X9 Q/ T) J. ^( T
  32. #include <linux/sysctl.h>' z6 b' F5 Q. ~
  33. #include <linux/mm.h>
      v: b+ c! y' Y& u' x7 L. X( ^
  34. #include <linux/dma-mapping.h>
    $ E8 L4 Q# ]) J9 |! }
  35. / E" O4 s+ B& d& |/ E0 c6 X
  36. #include <mach/memory.h>. |# c+ ?) t, M$ F/ q
  37. #include <mach/hardware.h>
    * e% F7 p$ ^2 V8 Z4 F% k0 u6 T6 ^& V
  38. #include <mach/irqs.h>0 S) o2 k7 w, W2 h6 p6 i( q' i% t6 @
  39. #include <asm/hardware/edma.h>
    2 V8 V; u1 M( ^+ M5 K5 c
  40. $ F7 i8 y1 ?/ Z7 s) s4 M- b6 D; h
  41. #undef EDMA3_DEBUG& {- v5 M. a6 y+ w9 C
  42. /*#define EDMA3_DEBUG*/
    7 y) \/ |( p  `; O0 N4 h

  43. 1 j# h- ~7 S$ p. D$ X" k: k9 w
  44. #ifdef EDMA3_DEBUG, J  N+ w9 U: t0 V6 _5 \3 I: P
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    5 N% R* ?* l  s
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). Q) ^  x! f/ L
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 y' W/ X4 t& l" K) e9 A  k7 X3 U/ C; }
  48. #else
    ) L( u0 |- g6 t( c
  49. #define DMA_PRINTK( x... )
    ' n& d* ]- y* s. U; W8 t
  50. #define DMA_FN_IN3 j+ ?# {4 w, u0 G! A+ ]6 b
  51. #define DMA_FN_OUT
    5 K- K& Y3 g! F+ _. H. D! X
  52. #endif
    + L% U( J. l5 l, J3 f: y( \* x9 l* u
  53. ) R/ e3 ^2 e: T; C; g
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ' @- }8 Q1 N5 ~7 f
  55. #define STATIC_SHIFT                36 v2 Y- D$ F8 R# n+ z- {& h4 h
  56. #define TCINTEN_SHIFT               20
    5 [2 Z( _. W( ?9 g
  57. #define ITCINTEN_SHIFT              21# e3 h: @* k* d+ V
  58. #define TCCHEN_SHIFT                22
    . J4 w0 X! i" p6 f: p
  59. #define ITCCHEN_SHIFT               23( i$ n& f9 j% O" t  y6 s
  60. 3 r- u1 L* G4 M& C8 w
  61. static volatile int irqraised1 = 0;
    ( l& O( n* x& F7 a4 G
  62. static volatile int irqraised2 = 0;
    ! P8 a, B2 a7 C( Z* a! {! T9 i

  63. 5 X$ N' U' d( \3 b8 |
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! j1 V3 P% s& ?4 l. J9 ?- B+ g
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 L0 a3 d+ w' k( e& _; S: p0 \
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # I9 C5 d& {2 m$ I$ ?
  67. 0 V; z# g: N- N2 d
  68. dma_addr_t dmaphyssrc1 = 0;) p, b/ p! A  O5 O! g7 I
  69. dma_addr_t dmaphyssrc2 = 0;
    9 f! t0 \, j( ?0 E& H
  70. dma_addr_t dmaphysdest1 = 0;6 t& r+ W. x' |8 `, p5 B
  71. dma_addr_t dmaphysdest2 = 0;
    . j" s9 e9 t# {% Z4 e

  72. % p5 G' k+ Q& P$ z4 e  Z% f( ]
  73. char *dmabufsrc1 = NULL;& l1 w. e* V+ S3 \
  74. char *dmabufsrc2 = NULL;% n5 m3 J# `2 O& V0 \% c
  75. char *dmabufdest1 = NULL;
    4 a8 [6 D* q% Z; I
  76. char *dmabufdest2 = NULL;
    5 [1 Q4 ^$ Y/ r1 s) N8 R5 G

  77. * b/ D9 j9 R0 ]+ B2 L4 P- Y3 R
  78. static int acnt = 512;, ]0 {  b& I7 w) k0 ~
  79. static int bcnt = 8;0 E$ L( h0 ^. j' m5 [0 h6 z
  80. static int ccnt = 8;/ m: n. i1 Q6 U) E
  81. ( G/ I6 ^" E8 B& d) R  a4 p' b
  82. module_param(acnt, int, S_IRUGO);; G5 n  J% Z2 K* L
  83. module_param(bcnt, int, S_IRUGO);; Q  @4 g) F  A% R% X9 _
  84. module_param(ccnt, int, S_IRUGO);
复制代码

* @0 Y8 e: N$ G! D/ \
& ^' {  {: m, X6 l6 T+ Y      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, Z  W4 k* e! R" @/ p" U
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 M4 p0 j3 O& ?. o: y& B
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# O- ]& q+ t0 @: o9 e& l/ m
* }: S2 B8 I1 e
* @. _! R' e' o9 S" p$ P+ U$ N
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-5 04:27 , Processed in 0.040233 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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