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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 x) g3 i1 D+ Y- h, O; U  r$ g
  1. [code]EDMA sample test application# B7 Y1 @! D5 x0 \
  2. /*/ y/ k# G% ?5 w$ A$ U, j! ]: o
  3. * edma_test.c
    , ~& {+ n4 k8 b; k
  4. *
    # ~% V* ~! y. I4 X# D( ?( i2 r8 T
  5. * brief  EDMA3 Test Application
    . j* f5 L8 |- x0 F9 \
  6. *
    5 b6 j, O6 `( T5 i" J) g: G& C. }+ x
  7. *   This file contains EDMA3 Test code.6 s8 I' H6 u$ W. L+ P, v" z+ P
  8. *
    ! t1 Y+ U% o- G* V2 x
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ; h% z/ Z3 o$ X. K
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    8 X- E1 l- ^1 R4 A9 U' U1 f
  11. *         TO CHANGE.- F4 b8 H  w8 k+ O
  12. *$ o$ k2 A: B* ]- P
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// U: A. }6 I1 U/ t3 m0 R
  14. */ [2 o" w6 @0 t7 ^! N) {2 _  n0 H$ P; R
  15. * This program is free software; you can redistribute it and/or( e2 X* r3 w( k0 ~, p7 @) e
  16. * modify it under the terms of the GNU General Public License as
    ( `2 g' R1 @/ K! c% x
  17. * published by the Free Software Foundation version 2.( |* _1 d4 g* a9 \, O' `8 d
  18. *
    5 c& `0 g. c" U* i( N
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 G5 z# ?) u, N+ F/ d
  20. * kind, whether express or implied; without even the implied warranty
    9 z+ a+ i% s  N% [/ J
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the. y" G4 c" [( U+ \5 \/ }) z4 I
  22. * GNU General Public License for more details.
    5 @$ ?7 h1 M, \, a, d2 ^5 Q) u5 ?$ r
  23. */
    $ w; c7 A1 O" D4 ^, x$ ]: {
  24. " X# N6 V- }+ ^
  25. #include <linux/module.h>
    # e, V/ Q. b! a) N8 o
  26. #include <linux/init.h>  t9 O& Y+ u. J% |; i" Y
  27. #include <linux/errno.h>4 I8 n$ C0 u8 z6 i# j
  28. #include <linux/types.h>
    9 t2 h" Y; x- n4 f9 Y( |
  29. #include <linux/interrupt.h>! j/ e: P! u8 o
  30. #include <asm/io.h>9 V. S/ [4 U; p' N8 G" @2 n
  31. #include <linux/moduleparam.h>7 T/ v( n7 g+ n, e9 a8 H
  32. #include <linux/sysctl.h># s3 v9 T5 x( ~: x: {2 a3 k
  33. #include <linux/mm.h>$ {4 {' u- W  e* k5 s
  34. #include <linux/dma-mapping.h>- _9 |4 ^4 A9 a/ y. s0 K4 L! J
  35. 6 Q; n% n1 c0 k' f. j
  36. #include <mach/memory.h>
    1 \! l0 I0 C' s. O$ p2 k! j: O
  37. #include <mach/hardware.h>9 j, x! k  f, _
  38. #include <mach/irqs.h>
      @, a# X. Y* o; w: d
  39. #include <asm/hardware/edma.h>
    4 y7 B) v( d# w* V1 |

  40. . w$ K& N+ w! n  k9 l1 M
  41. #undef EDMA3_DEBUG
    1 w8 V4 G4 G* B6 z) u! @0 o
  42. /*#define EDMA3_DEBUG*/
      `6 Z% k( ~* n" V2 ?+ D4 e

  43. + n" f2 o, O7 K' f# u, X5 J
  44. #ifdef EDMA3_DEBUG
    " r9 l5 J7 P) e& V
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    7 i% R4 x7 t, v/ o9 h5 f  u
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    3 v7 s; D/ P0 o) k+ ^
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): V* N1 L2 _/ I; f1 ~0 D
  48. #else, S, r" _1 H8 s2 ~! |0 |
  49. #define DMA_PRINTK( x... )" n7 F) u$ z! \
  50. #define DMA_FN_IN+ j' }! Z, J9 x. \5 Y
  51. #define DMA_FN_OUT* O5 o5 E. N  A; |  e
  52. #endif9 p. {) I- E9 f3 G+ l

  53. + ^/ l+ F% x* n) m1 r3 N: s
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
      V4 M) b) Q% ^$ M0 T) t* m1 `
  55. #define STATIC_SHIFT                3
    ( ]; h  ~& n$ {4 h/ V: B  o/ d7 N
  56. #define TCINTEN_SHIFT               20
    + ]' x  y) c2 z# \. l5 Z
  57. #define ITCINTEN_SHIFT              21
    0 \- |0 Q- R! L( Y3 q5 Q
  58. #define TCCHEN_SHIFT                22+ @4 G0 {" `" Z9 z/ j
  59. #define ITCCHEN_SHIFT               23  `0 p) F. \9 n: S9 A  E7 d- N
  60. & @6 O! O) R5 L# Y) M
  61. static volatile int irqraised1 = 0;
    . U: e  H0 S, l: {7 y+ H0 @7 d7 a$ x' B
  62. static volatile int irqraised2 = 0;
    3 @/ Z0 J8 k5 B) P

  63. 3 u8 C$ _/ u: g6 q. y; S
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 P- e. [( x1 l" e
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 d9 C& R5 S7 R6 A; o
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 {0 v- {1 L; t: k4 j! V- b* g% `
  67. 0 U, @& \; h- W- g
  68. dma_addr_t dmaphyssrc1 = 0;
    % Q# ]) f6 g0 }3 v* C' K
  69. dma_addr_t dmaphyssrc2 = 0;
    6 G9 A0 w' g& ?) a( R: a
  70. dma_addr_t dmaphysdest1 = 0;& {' K0 V* B3 ~8 n% j  B! C
  71. dma_addr_t dmaphysdest2 = 0;
    + o* \0 _9 H$ y/ s
  72. % \) ]" ?% j, o- M7 Y9 q
  73. char *dmabufsrc1 = NULL;
    : I# [" R7 g! l7 [. p3 m! @4 g  C
  74. char *dmabufsrc2 = NULL;
    / w/ e2 W# Q  Y6 B" u1 l
  75. char *dmabufdest1 = NULL;, D3 [0 r' t) o3 m2 p) w6 o! f- U2 O
  76. char *dmabufdest2 = NULL;
    # {5 s1 F2 n) Z4 ]) k4 l/ e
  77. 6 L, E* Y& e6 d+ \0 l
  78. static int acnt = 512;
      e/ V8 b( B: ?% R( c, j0 v
  79. static int bcnt = 8;0 b7 |2 n4 g) n* S0 }$ ?
  80. static int ccnt = 8;$ p0 u: x* ]" T6 }+ _  |
  81. 2 G' z. w( D. E  ^( z2 D" R
  82. module_param(acnt, int, S_IRUGO);
    2 a, G2 `% p2 i2 c8 T
  83. module_param(bcnt, int, S_IRUGO);9 `' V- y! N$ Q" W  F
  84. module_param(ccnt, int, S_IRUGO);
复制代码

9 Q( W% ]+ t' |7 y1 I( W
6 ]+ z2 W8 ?9 e# {      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 L* y9 b5 M, A7 }' a
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 j! B6 @2 c' x! B  L# ~8 d' d) d
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 h( }, z  x7 @/ Y, }! X% `
% w+ l; G; u8 I& z7 U
  @1 x; E6 N; _! j
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-8 03:40 , Processed in 0.046923 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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