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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 @+ }/ K& c" O
  1. [code]EDMA sample test application
    $ Z7 |) x0 R5 r2 W( h- O
  2. /*) x3 `! j" Z' @7 f9 c) ~+ A9 E8 }( t
  3. * edma_test.c
    % @  p  t( O  h! ^/ b
  4. */ {, ?9 n" W+ [, U
  5. * brief  EDMA3 Test Application1 a/ ~( @; A% e# z. s0 i
  6. *0 U5 \4 f: }8 @% _; ~, D2 x
  7. *   This file contains EDMA3 Test code.
    5 _8 E( J) L6 ]  S7 y2 S
  8. *
    ! @! \! a' i  ~5 P$ I0 |* S: `
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    $ j* q4 O4 n8 o% X
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    % F+ o& m2 c% n7 L7 T2 }- }6 ^  }
  11. *         TO CHANGE.! i6 \- d4 _3 D8 i
  12. *2 p+ `: P5 g0 f/ e
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* [' t4 b; t+ d# L+ J6 \7 j
  14. *
    / {# M9 I  L; C$ e8 l4 e; I
  15. * This program is free software; you can redistribute it and/or4 x5 ]! K7 T" C2 o: O- ^0 j
  16. * modify it under the terms of the GNU General Public License as
    3 q7 w4 L9 y7 W5 ^. J3 E; m
  17. * published by the Free Software Foundation version 2.! W+ g  L0 O2 t
  18. *
    9 _3 C- i5 b+ x; v, O
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ( U3 @; t: L1 a6 N# H
  20. * kind, whether express or implied; without even the implied warranty
    7 M% `0 {5 ^( _) T3 j( v1 `
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the. J) S, w3 E' b; s7 Z4 T" Q  g
  22. * GNU General Public License for more details.$ _& b. v* [" I: w/ ^% Q5 a/ O$ ~
  23. */
    3 e: N3 @' y2 I

  24. & ]# M, G, K8 g8 v
  25. #include <linux/module.h>
    * `5 _. E1 r/ U. E
  26. #include <linux/init.h>
    & z- s6 t, c. X( x# h
  27. #include <linux/errno.h>
    6 J+ K6 U* A3 a( k" a+ C3 o
  28. #include <linux/types.h>
    & E: ^6 S9 W  [! |
  29. #include <linux/interrupt.h>
    # P( R( R, Z, D/ w
  30. #include <asm/io.h>: m+ \$ O# T# B9 @
  31. #include <linux/moduleparam.h>7 E" f5 N' J# E( j
  32. #include <linux/sysctl.h>4 |4 m# v9 B) e, C8 J( Y$ S
  33. #include <linux/mm.h>. A0 H. a2 n' N/ {" q+ g
  34. #include <linux/dma-mapping.h>" c$ \3 n( `! ^: A4 {

  35. . H9 b. n+ U  g$ f+ c; H) u% t4 ~) m  L
  36. #include <mach/memory.h>
    + c8 e2 D( q1 T' Y/ E! u9 J# i' R4 w
  37. #include <mach/hardware.h>0 O, M7 |3 M' T( D/ V
  38. #include <mach/irqs.h>1 |% s' P; e8 O. t! d
  39. #include <asm/hardware/edma.h>5 T/ h; p, n) F3 ~: Q
  40.   W, F$ W5 {4 \. D
  41. #undef EDMA3_DEBUG
    : ~2 e1 \5 ?3 y" R+ A
  42. /*#define EDMA3_DEBUG*/5 U5 N, }5 [5 \& H# w; x2 I
  43. # z- t! R' r! Q  K' V( M+ O! w% R6 t
  44. #ifdef EDMA3_DEBUG
    - ~. Y% g3 m$ t2 m3 R6 K
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" g5 Q; l8 p8 O
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" D, P5 T- c' J  K4 O5 y7 m6 l/ _' T
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ! c# y: P! M2 J  Z$ q8 k4 Q- [) X/ ?8 F
  48. #else
    7 _$ z& J; [2 n4 A0 T  o8 m
  49. #define DMA_PRINTK( x... )8 h7 q5 s/ o8 E" t% `3 V
  50. #define DMA_FN_IN. F% R1 J3 t" k# o6 y0 D
  51. #define DMA_FN_OUT
    3 u! N4 l4 H* |# v
  52. #endif. q( Z7 u6 r# Y$ |7 b
  53. 8 C9 O2 [( Y/ n$ _; x1 G
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)0 q! c8 f) H8 q9 I. b5 m/ `
  55. #define STATIC_SHIFT                3
      Y+ [; A8 k0 g1 L7 n  e
  56. #define TCINTEN_SHIFT               20
    & _, v& k- P+ P' o% e$ t
  57. #define ITCINTEN_SHIFT              21* b. I- y  F# X7 i& h# _# N
  58. #define TCCHEN_SHIFT                22
    : A# C: I* y  p$ f% b
  59. #define ITCCHEN_SHIFT               23/ l# u- C& w# r- Y
  60. 6 @) t6 d8 {$ J7 Q! I: m
  61. static volatile int irqraised1 = 0;
    2 @$ \& e7 x$ u1 Y# X5 @* Z' J
  62. static volatile int irqraised2 = 0;
    , W+ @5 B, ~# E% L0 @2 q( X3 Y

  63. - L; n+ ?! L5 {; ~, g+ p
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ H1 ]. r2 z* C
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 L0 V' \) ~4 {6 G9 r
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 N6 P* f/ Y) v
  67. " s4 [2 ]3 ]2 Y% ~
  68. dma_addr_t dmaphyssrc1 = 0;
    ( i+ F4 D! ?3 I* M# ^3 B% ?
  69. dma_addr_t dmaphyssrc2 = 0;
    2 c" q7 ?$ \$ k( e
  70. dma_addr_t dmaphysdest1 = 0;2 K( l7 _: e0 C% s
  71. dma_addr_t dmaphysdest2 = 0;# B6 g9 L* p2 ^0 D/ o
  72. 9 I9 ^- I1 F# C% Q' v
  73. char *dmabufsrc1 = NULL;
    ( t% [+ v+ d/ \. {# ?& \: O
  74. char *dmabufsrc2 = NULL;
    8 _) B4 J' h# ]( j. s
  75. char *dmabufdest1 = NULL;
    ( x7 s7 H$ ~: q0 S" S
  76. char *dmabufdest2 = NULL;; j3 |; k) d+ ?
  77. ; e. S' B0 l8 ^* `& g. P
  78. static int acnt = 512;$ C! n( H/ G( i& y6 R# w5 w! s- s0 K
  79. static int bcnt = 8;
    ( }# `2 U: M# v" S
  80. static int ccnt = 8;9 `0 R. E$ f2 ]. F

  81. : b8 V& c% U; \% Q5 ~2 q8 j$ x! F
  82. module_param(acnt, int, S_IRUGO);% y( k! w, d; W3 O, h
  83. module_param(bcnt, int, S_IRUGO);7 y# M6 I" R$ k0 }7 q) ]5 d
  84. module_param(ccnt, int, S_IRUGO);
复制代码

: `% D% B+ A% Z) h* y: n# ?  t7 m1 L; F, e$ B# T
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: I( n: D3 Q# `0 M( ~2 |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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# Y" e0 H+ z6 L' C- ~+ j% G5 Z
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ t2 }* l# t( i( q1 ~  Y
0 U; ~) {6 d7 ]2 w" b
; b. t! T* g( j" I" ~
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-2 09:23 , Processed in 0.057596 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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