OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( l9 ]! \; D& E' v
  1. [code]EDMA sample test application1 M- v# W5 W: l* {
  2. /*" ^% ]3 h0 E, i0 G- ]9 L
  3. * edma_test.c
    1 M$ }: {/ m, V; q
  4. *4 c1 w1 B/ x( m5 M4 b
  5. * brief  EDMA3 Test Application
    4 f3 Z0 j! R: H6 ?) _7 y1 x
  6. *) o# n7 v3 T4 y- a  W1 b
  7. *   This file contains EDMA3 Test code.
    " E* W/ I- G' q( i! q
  8. *
    8 T( e4 q, m$ a! f# g0 D
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    6 S. L3 v% u# n! a% m) O. o  g
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ o! L" P6 ~, @$ J
  11. *         TO CHANGE.
    % D+ b3 C* B- [$ U; Z5 ~+ Y
  12. *& |6 Q9 Q5 @+ A! W' f4 ?
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% a6 g9 g3 `/ l4 i
  14. *
    ! i. L+ |, X8 ?, T
  15. * This program is free software; you can redistribute it and/or
    9 v" g4 F; c! P9 l
  16. * modify it under the terms of the GNU General Public License as! s  O' ^" X1 x- k  Y
  17. * published by the Free Software Foundation version 2.
    $ `( e1 h7 a: ~* I9 O1 V
  18. *
    . |' ~- \2 r& n  O8 c
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any: {  R! O" Z7 i) N
  20. * kind, whether express or implied; without even the implied warranty
    ( l/ f& i3 d. {2 f- n, l2 Q# c# E
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the+ E- E  m3 e- i5 [8 m9 q
  22. * GNU General Public License for more details.9 q* P2 h8 R! N# _% h0 y
  23. */
    4 Q/ |# }8 k; M& V9 ^1 U# ]! n

  24. ) V& ^: l) f0 K' g" V4 h
  25. #include <linux/module.h>4 z5 [0 U. j' m9 R- Q+ r
  26. #include <linux/init.h>
    6 r4 V, }+ p4 g1 @- C% g; q
  27. #include <linux/errno.h>( Q* M5 r3 U4 F4 z6 l: T/ }* Y3 W
  28. #include <linux/types.h>$ ~  B% w& t& e
  29. #include <linux/interrupt.h>$ k' O& [# G1 ~
  30. #include <asm/io.h>
    : n6 i9 I* g2 o) R: P4 g
  31. #include <linux/moduleparam.h>
    5 A, v4 j& @' P, Z& L  j
  32. #include <linux/sysctl.h>
    / A; j; X! j% z' B/ W
  33. #include <linux/mm.h>" J3 D  Z, D$ z
  34. #include <linux/dma-mapping.h>2 _' N% a' A6 \2 ?9 r1 j

  35. ) i5 K8 t& }8 E  ?
  36. #include <mach/memory.h>0 J/ J0 B6 q/ c% g
  37. #include <mach/hardware.h>- ?/ F7 t' [6 T  J4 F
  38. #include <mach/irqs.h>
    $ z& e" n8 C: y' r4 {- d
  39. #include <asm/hardware/edma.h>- ^3 p- O7 A" e0 a9 A6 }

  40. ( l2 a- y1 w+ Y! r0 k% f6 Y
  41. #undef EDMA3_DEBUG1 s, W, o5 ~: h% e% k: I: J. Z) D
  42. /*#define EDMA3_DEBUG*/% v2 t$ K$ z9 R  A% h6 I0 p
  43. . ^0 _: z# s0 w8 Y0 [1 H
  44. #ifdef EDMA3_DEBUG$ e: C+ R" v3 d9 b/ s3 \
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    3 Z5 z4 i  Z- I3 _( J0 i! A
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ _/ S# j% a$ g/ K8 z6 x3 E6 {3 q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    5 j0 v0 D: z/ }" E! Y2 B# ]' e
  48. #else
    2 K9 Q8 {' W# V9 i' Z: m+ p- m7 A
  49. #define DMA_PRINTK( x... )
    0 B) T. B6 F4 s
  50. #define DMA_FN_IN3 y6 c6 A" b& M/ K' r
  51. #define DMA_FN_OUT! k! G; T$ J6 ^" r8 P8 a! t4 L8 [
  52. #endif. t% \0 ~! E: p, X
  53. - s, `# v! i; x6 M( m9 O
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    " F! j3 D, h' A
  55. #define STATIC_SHIFT                3
    4 C8 G2 k& H4 w8 F. e
  56. #define TCINTEN_SHIFT               20/ [' Q$ d* \: O+ e0 M
  57. #define ITCINTEN_SHIFT              21. k, \  B  O' @8 [
  58. #define TCCHEN_SHIFT                220 ?- T) O" X! i. w' g
  59. #define ITCCHEN_SHIFT               23$ \; M# C. U9 q) c6 J4 \

  60. , a$ b! b% S5 X0 `2 P( v
  61. static volatile int irqraised1 = 0;9 R9 f3 d- Z) w, I" `  |$ B
  62. static volatile int irqraised2 = 0;
      J( ^# l0 Q* P/ V) B' {" {
  63. 3 x: B# y( |2 V1 n
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! S; T. {. w$ _7 ?
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ C" W  O% w+ i/ h( ~- f7 p. s
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) Q4 J, A- Y4 X
  67. ! S. g  i) J. z# [
  68. dma_addr_t dmaphyssrc1 = 0;1 z0 R2 q6 f2 S9 F2 r6 F! h
  69. dma_addr_t dmaphyssrc2 = 0;
    0 y4 l3 F. v  ?5 ]1 ^4 E6 X
  70. dma_addr_t dmaphysdest1 = 0;
    ; r+ x% X( w) N& P
  71. dma_addr_t dmaphysdest2 = 0;
    8 U' O- u( G- ?7 X0 j
  72. ) ?4 w- ~' V0 W  M' u
  73. char *dmabufsrc1 = NULL;% f( q+ M0 ~+ N
  74. char *dmabufsrc2 = NULL;8 q/ P# ?% g% N- g% P! X
  75. char *dmabufdest1 = NULL;
    $ m( E- K8 Z' d3 o- e
  76. char *dmabufdest2 = NULL;9 u% |5 ?# d9 t" Q  w4 `& E$ x
  77. ! ?- N9 E0 S! j0 h' M$ V1 j) b
  78. static int acnt = 512;
    1 O7 }8 m# R' a2 b1 B3 C; K: q
  79. static int bcnt = 8;$ u6 ]3 u8 P: d+ g0 b
  80. static int ccnt = 8;
      ]' `+ r7 p% f9 P/ B9 T8 p

  81. ' o5 b* N( A- @  N
  82. module_param(acnt, int, S_IRUGO);) I$ E+ B/ d% I3 j$ g& z
  83. module_param(bcnt, int, S_IRUGO);
    , j0 i" t& l0 g+ s! X
  84. module_param(ccnt, int, S_IRUGO);
复制代码
+ i- [3 `, E9 \; v1 @4 G

6 M4 q. c! P7 ~$ _5 E8 G  b      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* r% R9 x4 T2 U. b0 r5 C! S: uarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& q1 N5 Q' `- \% Z     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 d, }) C: v2 N+ b& H+ s/ S' d
- R9 ^1 n' G4 U8 I. O! I% F
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-20 09:41 , Processed in 0.058612 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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