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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 R+ m4 I% r, b' T$ t4 ?
  1. [code]EDMA sample test application) \# I% |: E- A1 K* [
  2. /*
    2 r/ o/ K/ D) g: |/ D6 K0 @
  3. * edma_test.c
    $ {1 |' E; e1 c: N+ l' I+ t3 j
  4. *
      o- c" c9 J4 F8 ^7 m+ U* d9 q0 A
  5. * brief  EDMA3 Test Application  ]8 s! H2 N) {) U' e
  6. *0 D9 V3 m% d- G  n1 ^! t
  7. *   This file contains EDMA3 Test code.: Z4 J+ w6 C+ ?# ~' |
  8. *8 j2 |- s7 a, F8 X1 \
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    : g% m# _8 B, S7 k  x
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( ?; c; N: b& Q) B$ j6 B8 T
  11. *         TO CHANGE.
    & J6 |% b7 E* T. T; @0 z  G" I
  12. *
    9 w$ Q. u* E" q/ [5 y
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    5 _& w( b7 k5 g) w
  14. *, u4 `, H/ e2 l2 }; O; F
  15. * This program is free software; you can redistribute it and/or
    8 U! A( [  ~1 r+ I4 r
  16. * modify it under the terms of the GNU General Public License as
    : s  `0 [! y+ {  m) d4 y
  17. * published by the Free Software Foundation version 2.
    8 F- R( H* X) s  w; c, Y) O% X
  18. *
    9 ^+ h7 r: G, o6 u! l3 j* D& k
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 V; B7 u# v+ g
  20. * kind, whether express or implied; without even the implied warranty
    2 z9 B- h3 e- d0 w$ e5 ~
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ) r# @; w' O% h3 P# t6 x5 H) R
  22. * GNU General Public License for more details.# n( i6 G2 `- {
  23. */
    ( b% ^$ E- r5 t1 f* p) }' p/ j
  24. ) z  ~9 o' ^- R& p: M" Q
  25. #include <linux/module.h>
    : F3 x6 @% r: x
  26. #include <linux/init.h>* u/ q% B4 \) a& h3 U9 G
  27. #include <linux/errno.h>
    $ `" U- z7 m# w0 S
  28. #include <linux/types.h>. `0 N9 v+ E7 c  y% {9 @* l
  29. #include <linux/interrupt.h>
    8 t. W% b8 E5 X+ g. U" I2 {
  30. #include <asm/io.h>6 l* y5 |3 y- D. V! E) n* n: J3 e& s
  31. #include <linux/moduleparam.h>0 s  L  L* d+ K6 U
  32. #include <linux/sysctl.h>8 Y9 ^2 ~5 E1 v) W
  33. #include <linux/mm.h>
    # [& B* y, W8 F4 k8 C
  34. #include <linux/dma-mapping.h>3 \5 b4 Y& I  _( q
  35. / Y: w% Z: l4 ?( {% W
  36. #include <mach/memory.h>* g$ T4 p( {. \% T6 J! ?2 O7 V4 @/ ^
  37. #include <mach/hardware.h>
    , U1 f; u8 B3 Q- {! v2 S/ D
  38. #include <mach/irqs.h>4 |  u1 [6 E! ^5 H
  39. #include <asm/hardware/edma.h>
    2 I3 M+ F# |2 Y  B" M
  40. + r+ m0 A, u' f% g9 ^3 O3 j
  41. #undef EDMA3_DEBUG
    ' I: {% e5 ^% ]$ J9 w' n' R1 p
  42. /*#define EDMA3_DEBUG*// Y# v# w& {7 G
  43. * J9 T3 x7 ^! G2 }7 E
  44. #ifdef EDMA3_DEBUG) i; o* t7 J6 t/ |& ?6 n$ m
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ k% h, s* L! b: b' `3 R4 A
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ! N) i2 q+ K, t, D  `: g
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    $ G* G7 i) C) Q- U- m1 u5 ~6 p
  48. #else  j9 ~# b4 E7 }: c9 x
  49. #define DMA_PRINTK( x... )  w; n: X* z; s7 X$ A2 x9 y
  50. #define DMA_FN_IN
      S) O8 @' o( i- [0 D4 K
  51. #define DMA_FN_OUT$ W. |' q" v5 v( i5 \$ C
  52. #endif
    $ w/ ]# K! c0 O( b" e5 l

  53. 2 X  r" `4 r" a( }
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)1 `- S) s: {% b) y9 k; e, @: N
  55. #define STATIC_SHIFT                3" g# a% J  u7 B; X  R) |
  56. #define TCINTEN_SHIFT               20
    , [2 S, [9 I$ `# H6 |4 ]7 c
  57. #define ITCINTEN_SHIFT              21
    4 M+ c% e5 {% r, F1 R+ Q* Z% m
  58. #define TCCHEN_SHIFT                22& d4 K8 u) A1 ]- e# R1 [
  59. #define ITCCHEN_SHIFT               232 f, }, b, N4 A9 C# {! d

  60. ! J3 n) n% j0 B. L3 {5 S' b7 Y
  61. static volatile int irqraised1 = 0;$ a" j) @; Z/ e
  62. static volatile int irqraised2 = 0;
    4 v) [7 d3 B" Z' R8 r( V0 N! |9 \2 l
  63. 6 x* ]0 @) M) t7 f- C3 H
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) M2 G. r0 P* ~
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % h) L, i6 Z( D! v/ M* E
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 ?3 T" k: X  ~, K7 T3 }  p
  67. # ^$ f3 V7 g1 w( f& P
  68. dma_addr_t dmaphyssrc1 = 0;
    5 ~: y8 D' t3 ?
  69. dma_addr_t dmaphyssrc2 = 0;9 g, ~! O7 U% s, Y7 k
  70. dma_addr_t dmaphysdest1 = 0;2 t' F8 m% ^! [& O
  71. dma_addr_t dmaphysdest2 = 0;4 B; C8 L6 V2 ~7 W
  72. ) D7 y( S* q! E9 u4 f  J  b9 ~
  73. char *dmabufsrc1 = NULL;
    9 m2 V3 j: K% x7 V
  74. char *dmabufsrc2 = NULL;% F/ q2 s. h8 ]- h+ ^. x  P( Z
  75. char *dmabufdest1 = NULL;+ ]. C, G) C5 h, f, g" t/ S
  76. char *dmabufdest2 = NULL;
    / u% \" ~: Q2 F6 p( n

  77. & O7 F/ r& I; t: x- a8 ?
  78. static int acnt = 512;
    ' S+ p6 ?. t. C, `
  79. static int bcnt = 8;
    : n4 o% W: m6 p% b
  80. static int ccnt = 8;
    . T5 W* a+ P  D1 \) T0 d: @

  81. 5 w0 J! f/ Q: e. n$ U' D/ i% R4 Y
  82. module_param(acnt, int, S_IRUGO);& L: g' L. V1 e/ ^: g: P; V
  83. module_param(bcnt, int, S_IRUGO);
    " z' \2 N3 Z' h8 `) Z% T9 m
  84. module_param(ccnt, int, S_IRUGO);
复制代码

, A8 v7 @; n' l& Q5 [; n0 Z" g+ H% n0 U+ ]/ i9 @9 n4 f
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" X) p5 L2 u5 P" O+ {
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" V8 v. O' M6 h& ~. S5 t     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# v/ \) C5 K) M
7 O9 D- S5 }) i) V) `+ R/ C+ {8 R
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-9 23:08 , Processed in 0.038933 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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