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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; @: W+ i$ b4 b- y0 |0 m: x
  1. [code]EDMA sample test application9 b3 x6 p/ O/ \+ P8 n) v% }- X# [; W: {
  2. /*5 \# G2 ~( ^0 s9 k) O" _/ Y
  3. * edma_test.c. Z1 F( D' N9 N% p, G% }0 w
  4. *# i4 E1 D0 p9 m8 b. L+ X. U9 Z6 O
  5. * brief  EDMA3 Test Application' q5 N& L; F$ k" h
  6. *3 Z( y* Q& R' J, y7 N- _
  7. *   This file contains EDMA3 Test code.- z. o) j1 |- j) v: f& I5 e3 U
  8. *- |3 |8 [$ S( |/ t- q; N- l! B
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    7 \: }% J. N4 y/ e- ]: J
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    5 y8 u: [4 Q' U; \1 g& u
  11. *         TO CHANGE.
    6 f- F( W& Q- H3 ~8 M: D( }
  12. *: B, U# ]  F7 ~2 a( X
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    / C' Y% d' Q( m& Z5 R' n
  14. *
    7 M8 ~: h/ L; }/ t1 u  y: @
  15. * This program is free software; you can redistribute it and/or9 d, `  ^+ M  A3 K0 L4 T& F
  16. * modify it under the terms of the GNU General Public License as8 v) w( t0 ^- p4 Z) i6 S2 D" B
  17. * published by the Free Software Foundation version 2.
    & W- f. }: m  {" o2 z
  18. *
    8 S/ K' [* l" c. K2 N
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any' ^1 X' t2 R# f
  20. * kind, whether express or implied; without even the implied warranty
    % e2 [; Y$ v3 N' e( q: n& h
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    8 z0 l8 U. @+ O5 B5 x
  22. * GNU General Public License for more details.
    6 Z) U7 M4 S$ I4 u
  23. */7 J2 Y9 u/ d' z+ ?' G% a# o
  24. , s, {# t1 W9 Z# b; ?/ o
  25. #include <linux/module.h># m) X0 E) ]% f, ?/ J) ~
  26. #include <linux/init.h>
    . ~; q+ V, c* b9 w' n. I
  27. #include <linux/errno.h>/ _# j  p9 |) w
  28. #include <linux/types.h>
    3 v6 r8 y  f0 F4 ]. V  j$ X
  29. #include <linux/interrupt.h>5 k4 U9 ?9 a# ?1 `5 }6 d, R
  30. #include <asm/io.h>
    4 h+ {) U( x* Y. u
  31. #include <linux/moduleparam.h>
    7 S6 u* _& u& c2 `' u+ @
  32. #include <linux/sysctl.h>
    & l$ Z$ q" D$ T
  33. #include <linux/mm.h>
    $ L1 O: N7 h% S7 l  f
  34. #include <linux/dma-mapping.h>, ~) ^9 @: x7 A, w# Z: z
  35. - T/ {% G; T2 z9 B4 y3 i" I
  36. #include <mach/memory.h>" g. g$ H1 w7 f  S) u: ]& L/ L
  37. #include <mach/hardware.h>
    . C2 X, J+ [) l& _4 F2 P1 m- Q8 x
  38. #include <mach/irqs.h>
    0 }0 M9 V" s: c8 `" m$ m
  39. #include <asm/hardware/edma.h>
    - L# b9 I# D+ \( \" s1 b
  40. , t7 j  p% U: |9 J: O
  41. #undef EDMA3_DEBUG0 o5 Y, U, p: H/ E
  42. /*#define EDMA3_DEBUG*/( h5 ?" L9 M6 q, V6 N

  43. ' i/ Y) R6 G. g6 y6 Q# M
  44. #ifdef EDMA3_DEBUG
    * \' _7 v8 p& k  g+ L( w9 `( h
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    / X' j# Z& f  O& i3 d
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" q+ w2 J; [6 A0 g- f5 \" Z* ^
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ! ^! {( e3 o! B0 \8 |; K/ P7 l
  48. #else' P. ~+ a, n, S8 }) |6 P
  49. #define DMA_PRINTK( x... )" K1 y+ ^6 {, I  {% P9 x
  50. #define DMA_FN_IN4 b4 J: x: y) h; }
  51. #define DMA_FN_OUT6 `+ `4 s3 R4 r7 E
  52. #endif
    : e& g! d; M+ f% z) O; _# R

  53. ! d; a1 {( Q8 L) e% L- y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)# w8 Y3 `" N" [+ ^% N
  55. #define STATIC_SHIFT                3& l) x* ]- M. @! x
  56. #define TCINTEN_SHIFT               20
    3 j: X3 ]( k- S( T
  57. #define ITCINTEN_SHIFT              21
    ; k# G' M: l- H
  58. #define TCCHEN_SHIFT                22# L7 X0 o0 v- N1 {, J1 h& b7 X$ O1 i
  59. #define ITCCHEN_SHIFT               23
    - j& N$ m. q( E$ B
  60. $ P5 E% C' e0 Z
  61. static volatile int irqraised1 = 0;- N* `- _' e3 [
  62. static volatile int irqraised2 = 0;
    $ s) ?6 l3 `7 D" F4 j

  63. 9 _8 T- ?" ?5 |" J' U0 D
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, R: a7 D2 ?: `4 j- t" F1 |; F* ?
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , d0 g6 t# U6 L3 Z- v, \5 Z! x
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ [8 ?3 x% M1 g
  67. , F1 g* r6 v, ^2 X& m
  68. dma_addr_t dmaphyssrc1 = 0;6 r3 \$ W  J! G
  69. dma_addr_t dmaphyssrc2 = 0;( m' @# C; i' |. j! P
  70. dma_addr_t dmaphysdest1 = 0;
    ! V5 ^+ z) I( y; @5 v/ w
  71. dma_addr_t dmaphysdest2 = 0;% A8 G- `9 X5 |! S# _6 [$ V4 J  K- [

  72. ) R3 [6 N' T& b7 d, n; h
  73. char *dmabufsrc1 = NULL;$ g. p8 Q$ R& P) W7 Z+ X# B, _. h
  74. char *dmabufsrc2 = NULL;$ h$ k  c7 B) A7 h2 K8 m8 K8 N  L5 a7 H
  75. char *dmabufdest1 = NULL;' R8 u  u" H  g7 k3 f8 [5 \
  76. char *dmabufdest2 = NULL;
    0 _+ ]0 s" E/ J

  77. % E5 w/ [. C( T# R, `
  78. static int acnt = 512;, F* x% L4 v( K5 I( N( T1 d* W
  79. static int bcnt = 8;6 J; {) Y! ?  A* d
  80. static int ccnt = 8;$ t0 f7 K/ B' m( L. U
  81. 6 H" |3 b. b/ p& h* e8 O) H" T
  82. module_param(acnt, int, S_IRUGO);
    # q0 M; j6 r, u) ^7 R
  83. module_param(bcnt, int, S_IRUGO);; n5 @. G$ y" d' Z! p5 u6 _
  84. module_param(ccnt, int, S_IRUGO);
复制代码
% m- x& B& Z- u* k# v
0 y, i! |. s2 c4 I  r
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( j2 f7 d% V+ K( z* E) \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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- E: b& K/ j4 [     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 u, q! W: A: H' O) `
* O- m1 S; F0 y# r1 `& r
+ {5 K" b( c6 \
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-4 05:18 , Processed in 0.049848 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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