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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , j9 B2 f8 L! W  Q7 K% B
  1. [code]EDMA sample test application
    2 Y" s; v# }8 @1 F+ o
  2. /*
      K% c3 C% v% \4 \6 {2 e
  3. * edma_test.c
    / D4 P: ~$ x1 p7 t  R  y% g( ^
  4. *5 w( I3 @' v% Q* a/ D
  5. * brief  EDMA3 Test Application
    $ i& ~3 |! y. r7 o6 J" u% B
  6. *  y& [, U; {7 W% v. d
  7. *   This file contains EDMA3 Test code.- i+ D, B6 P" q  [$ B; t
  8. *- W8 @  y% d7 ~1 z7 `  G
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    : p$ P. b9 f. b# H& @
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    5 c' a7 C$ o9 i5 O# M3 A6 m2 c6 |
  11. *         TO CHANGE.9 \, R; Y3 k- `. l9 d. ~. G  @4 c4 n
  12. *3 ?: \7 e% u1 \3 w( x" V  [" T
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    . T; U) U. l9 t+ r
  14. *& [5 ]' V8 U, N' @; M
  15. * This program is free software; you can redistribute it and/or
    # a% \% |8 v$ S2 x: A  P9 k
  16. * modify it under the terms of the GNU General Public License as
    8 S4 z; f! H+ v
  17. * published by the Free Software Foundation version 2.( l( E5 D8 G" a; }3 Q
  18. *. n; G! g+ q) [0 s: K
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ) A6 ~' @5 V7 o( X0 ]9 e2 ~
  20. * kind, whether express or implied; without even the implied warranty$ z' J0 V6 o; |+ S8 F* l
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the/ H) D( `: K4 }5 z8 N) T: I
  22. * GNU General Public License for more details.4 x* X0 w4 }; X* |4 S4 v
  23. */
    $ G* ^- c) U) j# o7 E

  24. 5 Z) z  M. ?. p: z) G/ w4 R) f+ a. O
  25. #include <linux/module.h>* t$ [( i8 }% q0 U
  26. #include <linux/init.h>, K+ d6 H) F0 z5 I2 D
  27. #include <linux/errno.h>+ B3 m$ }. M6 C4 n$ x: v% Y) b
  28. #include <linux/types.h>) C5 D& s* q( @. Z
  29. #include <linux/interrupt.h>
    , i5 X- G" `* W% z2 T7 R- v7 i- K
  30. #include <asm/io.h>
    ; w& P3 b3 o) Z, y" A9 K  {/ a
  31. #include <linux/moduleparam.h>
    ( [. V# R' q5 F" J0 I# m
  32. #include <linux/sysctl.h>
    % M% C4 E1 B" @2 d  G" ~
  33. #include <linux/mm.h>
    0 C7 \6 J* W" b3 n, W& C6 {# m% R
  34. #include <linux/dma-mapping.h>
      d$ U5 g2 }- L/ F6 N

  35. 1 d, D% Q% M0 W8 ]
  36. #include <mach/memory.h>
    0 P4 U) \9 E0 O  D' Q/ d& K: ^' z
  37. #include <mach/hardware.h>
    & D* z7 t9 b, F  r# n( t' H6 @6 ?/ S
  38. #include <mach/irqs.h>
    5 z1 n3 k& f) x* u' P
  39. #include <asm/hardware/edma.h>* c6 F- Q. l0 J. P9 f* p. {
  40. & P4 o  ^% K4 l5 H) \( S2 `
  41. #undef EDMA3_DEBUG+ P$ m. [7 L3 G4 a
  42. /*#define EDMA3_DEBUG*/7 F% g6 B- v$ n# O" l3 G

  43. , c* j+ M4 t' F4 |
  44. #ifdef EDMA3_DEBUG
    1 G; x  p" ~3 }& e( W
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). L7 k% H$ {4 v6 M  o3 T( i
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( g6 S  n4 p  L; X) G. z. a( P
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ! ^% k# J4 `& L% ^+ {* q
  48. #else
      m2 |+ A. V- k. H
  49. #define DMA_PRINTK( x... )6 n, Y  l8 y: _1 ]- j
  50. #define DMA_FN_IN
    7 _! y8 a& P6 R( Q8 m, [3 s$ k
  51. #define DMA_FN_OUT
      c4 a$ d  O5 m- y7 }# D' p+ U3 X
  52. #endif
    0 h  T. V, A# G# l: j' O
  53. 0 X; |4 l% @5 b! P
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)$ z# {8 M* }1 c- O; s
  55. #define STATIC_SHIFT                3! p% ~% j  i# [' G
  56. #define TCINTEN_SHIFT               20: {; _! U: u- ^: I  x; _; N8 r6 G
  57. #define ITCINTEN_SHIFT              21
    ! |) A  P7 Q. L+ c
  58. #define TCCHEN_SHIFT                229 w2 u  `, c! O2 o. S+ c3 B
  59. #define ITCCHEN_SHIFT               23" a. T  r# Y; ~5 _

  60. ' ]* {; W' }- D
  61. static volatile int irqraised1 = 0;
    / ?0 \3 s( I6 p8 n
  62. static volatile int irqraised2 = 0;, y8 s' r2 T, ~9 O2 t% f" _

  63. ( q2 O6 ^# _3 ~( c) J7 {+ L, P6 O: q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ ~+ l0 |: q: S( j, e5 |$ ~' q7 B6 o
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 y1 }. V+ \$ [0 S" Z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + ]$ r% I& |9 R

  67. 3 ?8 `: Q7 X, G* P  _1 D$ S
  68. dma_addr_t dmaphyssrc1 = 0;, {, c4 W6 @5 n8 J
  69. dma_addr_t dmaphyssrc2 = 0;
    8 u4 r$ {0 Y/ z. m9 r! {  [
  70. dma_addr_t dmaphysdest1 = 0;# p! }% T9 N1 V, v2 S
  71. dma_addr_t dmaphysdest2 = 0;( w4 O5 `2 S7 J' r
  72. 4 I/ a3 `. x+ A% n0 R9 a
  73. char *dmabufsrc1 = NULL;0 O3 P* e/ X/ T% z5 n& D7 J( v. M
  74. char *dmabufsrc2 = NULL;$ i- E: k1 H% T4 C
  75. char *dmabufdest1 = NULL;! X" {) I- Z) e
  76. char *dmabufdest2 = NULL;
    % C8 g2 r+ q! e3 W, D
  77. ; J2 @& K8 [4 o/ q5 K- d* u4 X
  78. static int acnt = 512;
    1 r" `3 G0 X: f! N
  79. static int bcnt = 8;6 b$ s1 y% Q7 D6 j
  80. static int ccnt = 8;( t' N, {# I. i9 M# x3 a
  81. ! h1 P& k. T1 d1 ]& k4 O) a
  82. module_param(acnt, int, S_IRUGO);2 D1 y; g5 v& U# i! O$ A: T
  83. module_param(bcnt, int, S_IRUGO);
    8 k4 `2 F/ \- S4 j4 P2 g+ J
  84. module_param(ccnt, int, S_IRUGO);
复制代码

$ h! {5 _$ d) j% p) Y6 ?3 M: t/ W
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- Z* \: f* W, i* ^% 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ Y$ g8 F1 g4 u) T- Y4 }4 n     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: b3 Y; @6 a9 h9 {3 e
% Q( E6 h% K$ r# ~( u; |8 C& U8 J
6 J# d5 y2 H. `
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-25 05:59 , Processed in 0.037562 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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