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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ O! g2 G" [' t* s
  1. [code]EDMA sample test application& K8 N/ n$ }8 ^
  2. /*
    0 ^. M4 ^# |3 ^% J
  3. * edma_test.c
    0 I1 Z3 x$ p# ^- c$ i4 l5 W6 p
  4. *2 X5 V& O% Z" q
  5. * brief  EDMA3 Test Application0 P& e7 M5 M5 X3 P9 h5 O
  6. *. j9 J1 r$ @1 Z+ y% _
  7. *   This file contains EDMA3 Test code.
    4 I' s: R$ }" G/ X$ T
  8. *1 C1 h$ f- V/ @1 w$ d
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    4 t; G1 x" S( j- [0 ^; I; V
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    + n! ]. e5 F: Z7 M- H/ u4 @- L* E
  11. *         TO CHANGE.
    : y# n* O9 _5 Z/ m& G
  12. *6 M& x* \" P& v, E- q' f4 ?( Z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    6 S( P9 p6 Q* s, ?" Z" a) V9 r
  14. *9 \5 g# k. Q! {& V8 _# Z( h# v0 K
  15. * This program is free software; you can redistribute it and/or
    9 F% O7 R& M2 P& p/ j$ o( x
  16. * modify it under the terms of the GNU General Public License as& z) ?3 C- Q# A9 g( v
  17. * published by the Free Software Foundation version 2.
    4 v: W  h' j% o8 y
  18. *: q% Y& {% l+ L. x  S6 N: B
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any; H6 a' O! f9 O
  20. * kind, whether express or implied; without even the implied warranty  i9 T" r/ J  J. V2 C5 X! A
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the7 x6 d$ |  P% F& K# F
  22. * GNU General Public License for more details.
    ; Q7 O8 h( a( V+ d* U% H2 `
  23. */4 I  Q9 Q0 e% s1 Y, j
  24. ; r, G3 J1 _2 u4 U0 C0 T3 ~' L
  25. #include <linux/module.h>
    3 m0 y9 `& Q: y$ O
  26. #include <linux/init.h>
    2 D; v5 x( M; g
  27. #include <linux/errno.h>) d, u, A: I$ w7 q! p
  28. #include <linux/types.h>
    + f) c# m, j# k7 J# T
  29. #include <linux/interrupt.h>, [( p$ ~0 N/ |, h) F. n
  30. #include <asm/io.h>1 |4 Z0 m. E2 q: p$ j" _9 P
  31. #include <linux/moduleparam.h>2 I6 h7 r" T0 m. W+ M
  32. #include <linux/sysctl.h>/ f1 H' }1 {& l% a
  33. #include <linux/mm.h>; F$ c& u0 n8 l6 B: b5 b( v  v
  34. #include <linux/dma-mapping.h>
    # W# H7 d  ^# b( g- `

  35. ' ~# A( e3 D; N
  36. #include <mach/memory.h>/ n1 c+ z1 |. u5 }
  37. #include <mach/hardware.h>5 Q  m' f$ ~9 \! c9 O  q8 f3 a: t
  38. #include <mach/irqs.h>; u5 U* b8 t) H
  39. #include <asm/hardware/edma.h>8 ?% n( [  S$ I8 q5 c  G, E0 Z, _
  40. 2 n) p. `6 u7 B% E
  41. #undef EDMA3_DEBUG1 K8 `4 d5 q+ D- Q* ^$ D; Y
  42. /*#define EDMA3_DEBUG*/# U( J( ?* q  }3 t' K% @
  43. 2 G- E2 s% M, N0 X1 i
  44. #ifdef EDMA3_DEBUG% W: A# D% e  r( a
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    4 W, @5 X- K: {2 g% G- a
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    : `0 z7 r2 X# w. S
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    % R4 T" j  n) p8 t* N& B
  48. #else
    $ k; i4 r) O6 m' h- T7 B0 q
  49. #define DMA_PRINTK( x... )
    / _; N& k, l) n
  50. #define DMA_FN_IN# ]2 k2 j( b# k/ f2 Q  D; h  H# V% z3 O
  51. #define DMA_FN_OUT
      {' _  K. p% ?/ V# Y# I
  52. #endif- [4 i% ]. o# g& ?: _9 q6 x

  53. 8 Y  j% A; o" ^( x3 L" V. p1 p, N
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)' i" a0 I; @; A$ n
  55. #define STATIC_SHIFT                3, s; Z7 W- V- Z: ~9 f1 ~
  56. #define TCINTEN_SHIFT               203 a* z1 V4 o7 c
  57. #define ITCINTEN_SHIFT              21" S: M: _' b% M0 b6 @: z
  58. #define TCCHEN_SHIFT                22! n! P4 o+ _/ z4 R
  59. #define ITCCHEN_SHIFT               23
    . q' h* y5 n6 r* a$ \  n) _- A

  60. $ d# Y0 E1 J" o4 h2 B/ p9 ^
  61. static volatile int irqraised1 = 0;: _& ^1 Z" e4 u7 p6 b# f
  62. static volatile int irqraised2 = 0;
    : ]% l( T' {$ M: U
  63. . B2 b1 v( D8 M( ^
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ ]: Y( ^2 o0 |3 ?
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& a+ U, C1 g% ?& A; Q
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % R, f6 {6 i1 O& H& I

  67. : d8 U' z9 H: E8 M% L
  68. dma_addr_t dmaphyssrc1 = 0;
    ! V! x: N$ _$ a3 W& s
  69. dma_addr_t dmaphyssrc2 = 0;7 a# u0 v  A) ?
  70. dma_addr_t dmaphysdest1 = 0;
    % t( r# E3 Q# q3 d7 E: v
  71. dma_addr_t dmaphysdest2 = 0;6 ]0 B* U2 V9 z: V

  72. 5 r) j  T# V; P
  73. char *dmabufsrc1 = NULL;/ P/ q  y" \! T% s  e# ~
  74. char *dmabufsrc2 = NULL;* R9 q& R$ Z8 d6 W  ~
  75. char *dmabufdest1 = NULL;! M2 l' D# N5 n
  76. char *dmabufdest2 = NULL;# }0 ~" t9 _! z" R/ A% W
  77. " T- V. i: r0 e; |
  78. static int acnt = 512;
    ; D- j0 i! f8 j" J4 ]6 H8 h
  79. static int bcnt = 8;
    ) \4 X& g+ u. c- _. J$ q) d7 v6 R
  80. static int ccnt = 8;
    ( c% \; A/ L) b- m( k/ @

  81. % o; z% a0 Z; B  m; ]8 L5 a, K
  82. module_param(acnt, int, S_IRUGO);
    ) K/ o7 R% e2 L' o
  83. module_param(bcnt, int, S_IRUGO);: p6 J) |- [" y
  84. module_param(ccnt, int, S_IRUGO);
复制代码

, F1 K/ X/ d! V" L# D9 S2 i# _4 u5 l! O- ]0 p9 w
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用; z  G0 q7 E8 H
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, W+ S( f( c  q% [6 _     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% @3 t' L5 O  G/ S' Z. n8 a7 p

) s, b4 Z! b2 i. D, M3 l
! t& f* @9 R* d" `9 b- e; ]
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-16 14:02 , Processed in 0.039501 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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