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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; S6 X3 m) M* U* u- f
  1. [code]EDMA sample test application
    8 ~2 i* J7 g* w/ ~
  2. /*
    ) J; O- |$ x0 R4 U; R/ m
  3. * edma_test.c
    8 M1 m) K9 Z9 P0 m
  4. *
    ' {- q' N1 {, F, W' M) C+ E
  5. * brief  EDMA3 Test Application% Z2 x2 a7 z! ~( f4 J7 k; N8 J
  6. *: K, A3 v; F8 `5 \! o1 s; J! t
  7. *   This file contains EDMA3 Test code.
    ) g4 }: R1 ~$ S1 V& z
  8. *
    4 D/ Y' h' m: i3 S' a1 K
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    8 x% j9 e. S* s2 y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ G) n' n1 z1 m* }/ t- w  z
  11. *         TO CHANGE.
    / z' o. c% y  |3 \: F
  12. *+ h4 u9 P( H& V; l) F# h: V
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ Z, H. O3 p0 U9 T
  14. *7 X6 @. g  a) c  x4 Q( P& i
  15. * This program is free software; you can redistribute it and/or$ u) z$ f- Y" c) ]" P) O
  16. * modify it under the terms of the GNU General Public License as6 Z  i% v' f0 h* R
  17. * published by the Free Software Foundation version 2.' }  l$ p# J7 K( }+ ]( p
  18. *
    4 q! }5 d: _8 V" f: W9 P
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any% U2 Z' B. i9 ?
  20. * kind, whether express or implied; without even the implied warranty
    % }: Y7 R7 ]1 R* ?* e# `& k, [
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the9 j: j/ \/ o3 d, A1 L
  22. * GNU General Public License for more details.3 r; U+ ]: a7 y/ r1 m
  23. */* m" p4 T6 e  ~0 U0 D/ l
  24. - G, G7 D$ ^4 C' E
  25. #include <linux/module.h>
    8 Z& U0 t3 s9 X# n
  26. #include <linux/init.h>
    - ]% @# ?8 t6 S0 W* n( e
  27. #include <linux/errno.h>
    2 Q* ^8 x" f: I( l. @! j
  28. #include <linux/types.h>0 w" W5 ~. s- i9 c3 v
  29. #include <linux/interrupt.h>$ i! l3 d( \, K. b
  30. #include <asm/io.h>
    1 e% A2 B/ W! {
  31. #include <linux/moduleparam.h>
    0 |( r* S( j  a; G& O3 S! ?
  32. #include <linux/sysctl.h>8 H. [) ~. x* T& d" V
  33. #include <linux/mm.h>
    4 a. \" ?/ c9 \) x5 |8 e
  34. #include <linux/dma-mapping.h>
    ( K% h' E- R* C  b. L- @

  35. 4 {: c9 `( ^9 z. ~
  36. #include <mach/memory.h>
    4 m3 R: s) N+ A- V) e9 S% ?! o
  37. #include <mach/hardware.h>: u: V  z& n# n( j, ?: P7 g
  38. #include <mach/irqs.h>: N9 L% G) L( ~. P
  39. #include <asm/hardware/edma.h>
    2 `% h* i4 f2 a& O" U

  40. , a7 r* ]- x( l3 d
  41. #undef EDMA3_DEBUG
    5 ]" J. n" }) L) s2 M
  42. /*#define EDMA3_DEBUG*/
    ( y' I6 A- o7 h' _+ E1 q) |% f
  43. 7 G3 o1 D4 y& z
  44. #ifdef EDMA3_DEBUG
    " A" c, C; j1 W  T+ t; y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 a  s$ E. ?1 w
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 r* y5 b- n+ @
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 i4 G3 I& L, _1 z2 ]3 c7 l
  48. #else
    7 j7 N7 Z& V0 R$ }' q5 x5 f
  49. #define DMA_PRINTK( x... )
    . \% X% `2 ]% r8 i/ t
  50. #define DMA_FN_IN
    3 j% L- {9 z7 O  T6 J7 L$ {
  51. #define DMA_FN_OUT
    & Y9 Z" s3 {* x7 c/ K% E; X) r
  52. #endif
    , [  X: e: f1 L# E

  53. 6 ?  e5 A# U! w
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ' @1 s7 M! F- b
  55. #define STATIC_SHIFT                3% F/ Y% I2 \- s
  56. #define TCINTEN_SHIFT               20
    / Y/ e7 @! F! x* D1 h8 n* M5 R& f
  57. #define ITCINTEN_SHIFT              21  `4 u" ]3 P$ W8 r9 L. o$ v7 U8 T, M
  58. #define TCCHEN_SHIFT                22
    ( Q& V+ E& e9 `1 [: b: x) I
  59. #define ITCCHEN_SHIFT               23: e) U* r* ]: V" n
  60. ) n4 K) s0 i0 _4 m9 Z
  61. static volatile int irqraised1 = 0;
    . G8 J# b& V5 U# H
  62. static volatile int irqraised2 = 0;
    . p% e: K; u( w& `" Z

  63. ' L0 a, s+ E  E+ p) P
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, ?6 n  u4 Y* w/ i) `2 F7 o( }9 n1 t( Y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 y) q7 H7 ~8 s3 M% N0 H- p$ |
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 w9 j4 ^8 R( ?% S

  67. ' j9 H2 N0 Q# ]
  68. dma_addr_t dmaphyssrc1 = 0;: |5 V7 @/ c) M; e% W( \; v
  69. dma_addr_t dmaphyssrc2 = 0;, [8 ^6 o8 G# Q9 j* ?1 j. F
  70. dma_addr_t dmaphysdest1 = 0;
    6 C# v+ Z" B7 p( T8 P
  71. dma_addr_t dmaphysdest2 = 0;0 Y; X' m0 z5 F/ i9 B/ t/ d

  72.   ~9 ^9 B3 R: t" E& _
  73. char *dmabufsrc1 = NULL;  E. Q% f" Q7 x' n7 J5 L+ e! p
  74. char *dmabufsrc2 = NULL;9 ], b) X: H. {& |; e
  75. char *dmabufdest1 = NULL;
    0 Q/ |( l) ], P! z
  76. char *dmabufdest2 = NULL;
    8 G9 K8 @- X* l1 \
  77. . O# g& ?+ a# g2 M' h& l9 o
  78. static int acnt = 512;
    2 V4 O' Q' m) @2 K0 y
  79. static int bcnt = 8;3 {: X' M2 e& e0 ~/ W
  80. static int ccnt = 8;% ^. C" G+ i! t8 ?
  81.   P5 }, d3 l2 v6 B$ S0 U8 C8 i. Z
  82. module_param(acnt, int, S_IRUGO);
    + {1 K4 Z" q2 r8 ?
  83. module_param(bcnt, int, S_IRUGO);1 W4 Y, L  g0 ~  J) N2 e
  84. module_param(ccnt, int, S_IRUGO);
复制代码
+ F* ~- }2 i! \( ^9 g- g

, K: l) V7 O' ^0 d      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 U  r0 r7 c+ ^3 B! ?/ 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, A6 t. Q; W- c' ~( s     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 v/ M3 l5 s( s2 d; M- L4 z
7 m1 q8 n" e* m5 J8 _3 d' {4 ^, h* Y4 J( g/ Z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-15 07:14 , Processed in 0.042707 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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