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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ h+ Z/ Z% Q/ K/ t
  1. [code]EDMA sample test application% y$ {" k; b- z2 v% q1 `2 R
  2. /*5 O" ]% R' X# ]5 B! r. A* j
  3. * edma_test.c1 K: \0 H7 D  Y% Z. g! y
  4. *2 U: \- ]& R' l& k8 M
  5. * brief  EDMA3 Test Application& q! U3 r+ v' Y* z( j4 ^) s; T
  6. *
      f( R+ c7 {: @4 \& d0 c
  7. *   This file contains EDMA3 Test code.9 l4 h  C9 y& k3 K' `/ O7 S' v
  8. *
    $ e$ `/ g5 S/ ~" P7 u9 `
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    , |$ a! ], a0 w4 S' m6 A; t
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! T+ }' F$ [! S3 P
  11. *         TO CHANGE.: W  F: n5 @% f7 `$ Y
  12. *% i+ Y7 u' C, J; |
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ; f5 b- G$ t. z+ u0 N
  14. *: O; u! p( w: @
  15. * This program is free software; you can redistribute it and/or
    , M$ i7 j  x1 T0 J- ~
  16. * modify it under the terms of the GNU General Public License as6 N8 P* F/ u  K8 B5 i
  17. * published by the Free Software Foundation version 2.
    5 L$ U0 U8 L, S
  18. *
    : s5 L$ y+ w+ L( \& v: F4 q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any( W+ V+ W/ F4 a: j  q
  20. * kind, whether express or implied; without even the implied warranty
    8 T6 `) K7 s# F, L
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ! V; a! y& ^, l9 \% K+ H& ~0 ^& n
  22. * GNU General Public License for more details.
    9 v" \& x- G$ V1 p9 T. p
  23. */
    8 g# x8 w- _& g7 N7 P# M* i% E. b
  24. , K0 ?1 j" L4 A
  25. #include <linux/module.h>
    . V" p5 H' S( p0 O! W5 t
  26. #include <linux/init.h>
    ) Q) h6 |& a! n+ ]  v7 D
  27. #include <linux/errno.h>
    & V. c$ s2 m% i* D- P4 M3 d
  28. #include <linux/types.h>
    & G5 S" ]$ F6 o! O
  29. #include <linux/interrupt.h>9 i# K- t3 X- ^; \$ m
  30. #include <asm/io.h>% W2 V' {6 K# i
  31. #include <linux/moduleparam.h>
    $ o2 F  p/ |8 _0 D4 D6 c  K) i/ f
  32. #include <linux/sysctl.h># I' H+ z  l6 ]' Y- g/ O4 j
  33. #include <linux/mm.h>( y, z0 u# U% Y( e( }$ r
  34. #include <linux/dma-mapping.h>
    $ q/ i/ L% W9 M# E. _

  35. 8 I% d2 {" a1 [2 Z) P
  36. #include <mach/memory.h>( l0 i) O3 |, r9 q6 ^' ?
  37. #include <mach/hardware.h>; e7 l  d2 @1 a8 @
  38. #include <mach/irqs.h>; N7 \* V3 Q7 b8 K, f0 ?! s# h& N' U
  39. #include <asm/hardware/edma.h>
      ^- h$ \! Q$ G+ Z6 F9 H# C) c
  40.   b0 C7 h3 Z, y. U) B: E* e
  41. #undef EDMA3_DEBUG# [( j) d8 v; B* ]' o. I) I
  42. /*#define EDMA3_DEBUG*/9 H; A2 X, e7 @' \6 Z0 K9 s

  43. + V7 V: |5 w/ J% r; Q8 u# g+ A
  44. #ifdef EDMA3_DEBUG
    8 I$ d& A7 a$ C# F* ?; p
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    8 ~1 i2 G$ }* ?- a* i* Y& Z$ W0 F
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' [+ r/ ~; _0 x" p8 c5 g
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) k9 m# P( q' u+ W
  48. #else
    - v. d$ p" a' E: J$ {3 q
  49. #define DMA_PRINTK( x... )
    ) [. b" ?! T9 Y* m
  50. #define DMA_FN_IN( o, j) O0 E% H- m
  51. #define DMA_FN_OUT
    ' u3 x) o, Z3 I5 r; _- d4 f
  52. #endif
    $ O5 Y: J& q5 H/ ?( G9 s
  53. # K6 U, M- f* r# B- \. H/ \
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)  s9 Z4 \: f% G8 d- S
  55. #define STATIC_SHIFT                3
    " i- B: m; M, B  M
  56. #define TCINTEN_SHIFT               20
    4 e" P, e# X" o% Q  ~- I* c; W3 e
  57. #define ITCINTEN_SHIFT              21
    ! {3 F7 _: N: a& [) A4 |& K* P
  58. #define TCCHEN_SHIFT                22
    $ z: z) [7 l+ b. q- i
  59. #define ITCCHEN_SHIFT               239 O% k+ A; W3 I* L) R3 }
  60. 2 M/ g) p' M6 d- X2 d  a
  61. static volatile int irqraised1 = 0;
    ( K& w( k; [; w  x) K
  62. static volatile int irqraised2 = 0;% x8 N& H2 t; h/ ]) L

  63. ' h: P: T- d, [8 Y( b  e
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' N8 G0 d  }1 D3 e3 h
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ S" k( s9 t( O/ d
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- R  \  u; G' I
  67. " u4 o" Q( B$ q( L* T3 \
  68. dma_addr_t dmaphyssrc1 = 0;; F1 ^/ d* ?) h
  69. dma_addr_t dmaphyssrc2 = 0;) i9 a# Q* t7 }# T
  70. dma_addr_t dmaphysdest1 = 0;6 J$ \2 I) r: E
  71. dma_addr_t dmaphysdest2 = 0;, K5 [8 ?9 i4 B0 i

  72.   O8 x+ E# r4 l7 d* w
  73. char *dmabufsrc1 = NULL;
    3 r; |. x& Z) X2 C3 z$ D2 |
  74. char *dmabufsrc2 = NULL;5 u6 b7 h+ s# b( |& W' H) n
  75. char *dmabufdest1 = NULL;
    0 _5 L. T5 H% v! y6 K0 ?6 @9 n
  76. char *dmabufdest2 = NULL;
    0 T* ?7 P5 I1 j" @+ }- T  u

  77. 9 E& |, E. l+ i4 s% e
  78. static int acnt = 512;1 w/ J7 ~$ i2 B0 b
  79. static int bcnt = 8;1 ]" A% q- U+ X
  80. static int ccnt = 8;
    ; R9 o$ `8 \) T! ^6 c, R
  81. + Y; q& e0 F# b$ u* f+ a
  82. module_param(acnt, int, S_IRUGO);% K/ M  F9 S6 T7 y" a) x' M
  83. module_param(bcnt, int, S_IRUGO);
    ( U+ y* w6 w# r3 {# N5 y
  84. module_param(ccnt, int, S_IRUGO);
复制代码

( E# {3 X* P' T& q5 {# l% X6 a: N" Y4 g' C3 w# U
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- R1 y8 }& ?2 b; m5 o* n+ ^. M
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
  U' R* E0 T" ?8 `# c& @     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; l1 g, ^; \9 Q! J; K( A) w% e0 o4 ^2 t2 V

# J6 u4 d3 r$ r7 @* ^- v) T
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-26 15:27 , Processed in 0.042225 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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