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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - W3 m9 }0 q: |) F4 a
  1. [code]EDMA sample test application
    - ?: G1 R, [" h' v0 N" {. R+ e
  2. /*" u% }- }( |; n1 P' J) P" @
  3. * edma_test.c, Y. D# }2 x0 L2 j7 ?
  4. *6 g' M% G5 M* K6 t6 n7 m
  5. * brief  EDMA3 Test Application6 W3 m4 y& G3 T$ w, ^5 E
  6. *
    / C1 N, I1 z/ K6 W1 q
  7. *   This file contains EDMA3 Test code.
    3 W# G6 Y  g8 P
  8. *8 k- [$ J# M  b
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    5 E: d: \; u4 B( T' L
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    & J/ I4 `3 @% Z9 a
  11. *         TO CHANGE.# c3 B# @3 {/ k) W( z+ N6 g
  12. *
    + [% s3 [: t) f- _. G
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
      {* r/ P8 J7 ~" U, R
  14. *6 c; h2 q7 \' v
  15. * This program is free software; you can redistribute it and/or4 c6 |2 D$ P8 }5 c# v
  16. * modify it under the terms of the GNU General Public License as
    ) F" d. z% @% a  ~9 K
  17. * published by the Free Software Foundation version 2.
    ( y4 A& L1 i1 g! y+ B
  18. *
    5 x) R/ N5 v0 m4 _7 O
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ n" k8 j) l' k2 ]$ S5 k; \
  20. * kind, whether express or implied; without even the implied warranty
    ! P) m, b3 Z* E
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    % X# C. f, S& {$ }# ]) q
  22. * GNU General Public License for more details.6 P  [2 {& j. J8 G3 w
  23. */
    * F0 `; w% f7 k0 e
  24. 3 Y( R: s1 D4 \: V0 R7 L
  25. #include <linux/module.h>
    1 h/ E- L# h6 z- V+ Z: P
  26. #include <linux/init.h>
    - V, V, Y; G) F+ u( {9 H3 Q' y1 I
  27. #include <linux/errno.h>6 T8 E3 |& I; Q7 g- o2 e
  28. #include <linux/types.h>4 p+ b& C: u- e/ q1 s
  29. #include <linux/interrupt.h>7 B* |$ R/ o7 t4 }* X- K" @" O
  30. #include <asm/io.h>" K8 p$ l7 U$ c; T" i7 k
  31. #include <linux/moduleparam.h>
    4 y. O8 \2 g4 [% N
  32. #include <linux/sysctl.h>
    0 A3 D0 _4 ?7 T( q' |
  33. #include <linux/mm.h>
    $ G: z9 A# w* y: E) F
  34. #include <linux/dma-mapping.h>
    $ e* w  |0 ^! `; l. G
  35. : Y( Y# U8 b6 N* S/ T+ T9 p
  36. #include <mach/memory.h># X1 a4 V2 {+ L5 M2 m0 j. e
  37. #include <mach/hardware.h>
    6 g5 Z* ?; ]; P! n. n- L9 F
  38. #include <mach/irqs.h>. d; y5 ]' l7 n  U9 c
  39. #include <asm/hardware/edma.h>
    9 Y5 T8 W2 |6 u

  40. 7 e  q2 U# `" H0 |3 S, T2 d
  41. #undef EDMA3_DEBUG
    7 z$ S( H, l4 f+ H
  42. /*#define EDMA3_DEBUG*/
    8 |( r" p2 W* @. `" a( |
  43. 4 k/ e- A& N0 o- Y: l
  44. #ifdef EDMA3_DEBUG
    + f" [! m% b4 `9 o. H- W9 s
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    & M6 @, q- W& d* G3 H4 I
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ E* U+ k& e+ T9 i5 F
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    & n& h* ^; i1 v2 H' k5 D9 s2 Q3 f/ _" U
  48. #else1 m3 \2 P0 {& u2 q/ ]
  49. #define DMA_PRINTK( x... )# X2 N5 X' }) h1 Q
  50. #define DMA_FN_IN
    6 ]. {( y2 o$ p$ b4 M1 r
  51. #define DMA_FN_OUT
    . k. W+ ?3 R3 U" S* K0 v
  52. #endif# T# C7 V+ p' g/ @) R2 r$ R: \
  53. ) s  P8 X- [5 F! l7 x
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    2 m) |4 Y  i' t# P
  55. #define STATIC_SHIFT                30 i" {+ a/ }; e! l, N' U8 E# p0 Y
  56. #define TCINTEN_SHIFT               20
    3 A  y. s+ }) G7 c4 R9 Z
  57. #define ITCINTEN_SHIFT              219 t4 w4 {4 ^. I, M  x% o
  58. #define TCCHEN_SHIFT                22+ z# s" c7 A8 C! B1 G9 E
  59. #define ITCCHEN_SHIFT               23
    6 q( E4 Y7 {3 G4 ?0 Y& H7 _  K

  60. ) a+ p8 |+ o$ g1 t' s& L8 p* A( z
  61. static volatile int irqraised1 = 0;! y- k+ k0 p5 O6 |8 Q4 W
  62. static volatile int irqraised2 = 0;$ w7 D! w$ E" I9 `

  63. 4 M" O8 A+ i, l6 v
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ X  Z5 x+ i* G
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & u- C9 p, r: ?) ?% }
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( l) O4 y! E: d  G4 K$ v
  67. ' B' C" t: d2 Z. F4 V1 I; G
  68. dma_addr_t dmaphyssrc1 = 0;
    ) C# w8 H  J' Q8 z
  69. dma_addr_t dmaphyssrc2 = 0;& }7 D" {, g" b
  70. dma_addr_t dmaphysdest1 = 0;! H* u/ e( W. M3 b6 r- c# X
  71. dma_addr_t dmaphysdest2 = 0;
    ' Y, P' @& b6 H
  72. ! v$ v% c# N" l7 N' g  ]
  73. char *dmabufsrc1 = NULL;
    % y, O  ~* }$ V4 B9 q
  74. char *dmabufsrc2 = NULL;
    # e. Q  T$ u" E7 M5 z  b$ T
  75. char *dmabufdest1 = NULL;
    5 I6 K$ q: h( P  R, l+ h3 z9 e3 ]
  76. char *dmabufdest2 = NULL;6 F$ F! P: o, U, K- v! F

  77. 9 z4 b* J1 E, T# D% w
  78. static int acnt = 512;4 i. n, @  d" n- {+ Z$ y
  79. static int bcnt = 8;
    5 p- B7 e! _3 Q
  80. static int ccnt = 8;0 p( E7 j4 W. j$ t& I3 A

  81. / q0 L9 \4 F4 ^) T* p+ }
  82. module_param(acnt, int, S_IRUGO);
    & C: z& J2 `6 C# i- Z1 L* j, `
  83. module_param(bcnt, int, S_IRUGO);
    ( I3 v/ q$ I5 O% P
  84. module_param(ccnt, int, S_IRUGO);
复制代码
! \. _, r; m  g4 F5 P2 O$ r/ u
- X! ^' s% E8 x, e) Y& }5 {0 G  x
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% v1 d! p+ N6 o) T' S4 v% Q0 darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 g3 B1 M4 B6 {+ A
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. t7 [5 }* E! s' Y% {7 y" T; G9 P. d
% F% l1 N3 Y1 T' x
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-5-24 04:13 , Processed in 0.041618 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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