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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 C- h2 J/ `* f" _6 V% B  |+ e: a& J
  1. [code]EDMA sample test application) }  ?0 p8 P5 G* T5 c7 Z- Y/ K
  2. /*/ |7 W. R: s7 C. ]+ N
  3. * edma_test.c3 v% h, }  o8 K9 u8 Y
  4. *
    . w: V" ?, L9 g& ]/ I9 P
  5. * brief  EDMA3 Test Application0 a  j/ O7 a+ T2 Z7 X! A
  6. *
    4 l2 T: t. h/ i5 W6 Q
  7. *   This file contains EDMA3 Test code.& k- F4 M; r  O% \9 u/ S( I
  8. *! R5 t( Q% M' E, h$ w
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, n5 c) `) i2 q
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 h9 y8 i; b: g! \! A
  11. *         TO CHANGE." R- O7 P& _4 f3 i" l
  12. *8 ~, I1 V  j* R. _, `
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    8 r/ v8 R* P! Q0 ~9 C1 [
  14. *$ e8 G# {# W5 z4 A! N
  15. * This program is free software; you can redistribute it and/or6 f( m) g9 m  F1 T% K1 l
  16. * modify it under the terms of the GNU General Public License as1 N6 I" i; {7 ^
  17. * published by the Free Software Foundation version 2.: J+ ?# a: z  a; c$ A
  18. *
    # b( N0 h" ~/ v3 s7 g
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ( i5 C& I# z+ h$ W6 I$ Z+ S" Y
  20. * kind, whether express or implied; without even the implied warranty
    / f0 C2 a6 ~# Y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    4 M  X3 @( `/ ^2 I4 ~+ d7 B
  22. * GNU General Public License for more details.& ~  t: Y4 ]9 U. L' y3 s
  23. */- A. l% [; H" _1 f- @
  24. 3 p: n( o% |8 S7 \7 ]% x; X- E
  25. #include <linux/module.h>7 B2 s2 y6 R* n  c: `0 Q. T8 [
  26. #include <linux/init.h># G1 {% w, {+ e
  27. #include <linux/errno.h>
    6 w5 b5 C9 T# t; H' A( Z; R2 L
  28. #include <linux/types.h>& @7 [7 S* q+ H$ U8 }' |: S3 n
  29. #include <linux/interrupt.h>: p% G. c9 u- o0 _  `6 G, ?& {
  30. #include <asm/io.h>  M& \. j# v5 M0 j( H' w, G
  31. #include <linux/moduleparam.h>
    , w% S/ R) C" [
  32. #include <linux/sysctl.h>
    & }4 m- ]" J3 j( X6 G3 x2 K, a
  33. #include <linux/mm.h>
    - @( b  O! E4 h" S3 `! e0 S
  34. #include <linux/dma-mapping.h>
    * x0 A6 J' H; q# u" p# _  Z1 o
  35. # C1 a2 q% j! d- A2 j( F
  36. #include <mach/memory.h>" t/ V2 p" ^; i4 {
  37. #include <mach/hardware.h>
    * f$ b7 ]- [% Q; Y7 }& {: V
  38. #include <mach/irqs.h>; B) N2 {- x7 a3 E- E! y8 t
  39. #include <asm/hardware/edma.h>
    " N& J5 q5 a* q. G6 i( ?# y

  40. 2 P! o; X! d& r3 e) h4 R
  41. #undef EDMA3_DEBUG
    * Q& K) W& ?5 ]. T1 C, U5 d' U
  42. /*#define EDMA3_DEBUG*/
    ' G" K9 z8 f5 Y6 ]+ }$ Q
  43. 0 G! X3 y! U% f- V( |2 g( t
  44. #ifdef EDMA3_DEBUG
    , ^4 Q8 q* H' e
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    % U/ q: c+ A1 Y/ b# g. g
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    0 e# j) B4 ^0 @! Q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    " ~* f4 ~" A) n
  48. #else* H* }9 @/ L' p( O  j- J2 R+ W
  49. #define DMA_PRINTK( x... )
    ) ~% ~) i" ?4 I1 Y% e
  50. #define DMA_FN_IN
    , {9 O. G; _) D. }% {- B
  51. #define DMA_FN_OUT) u9 s5 }0 L3 F# S: i, F" @
  52. #endif
    ( n! }6 ~2 z% w7 ?; Y* B0 _

  53. ! ^% K, ^8 ?, v1 r9 K, ?! E3 Z, v
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)+ t! O# k4 I9 L1 o" N# I: g2 K8 d6 @
  55. #define STATIC_SHIFT                3; u* k. q- p8 L6 S3 S) n
  56. #define TCINTEN_SHIFT               20* A* t2 z0 c' A8 ~
  57. #define ITCINTEN_SHIFT              21
    - B: W# H) m" E) [" [" X
  58. #define TCCHEN_SHIFT                22
    # I- F, R* u1 H4 l0 i' W! q
  59. #define ITCCHEN_SHIFT               23. d: |2 S- R: O! |: K: u# O
  60. , Z; i% @/ p$ \( p3 M% u( m
  61. static volatile int irqraised1 = 0;
    " Q) x% m+ k/ E, }# K. ]; g  t
  62. static volatile int irqraised2 = 0;8 |; D8 }2 V! V0 e# W# X
  63. . E6 F8 e0 }  D" C) O6 Z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 O( D7 X4 K, g# x- S6 z* z8 ?
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 L5 u4 A4 s* j
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 w1 ~* r4 b9 Q& `" }" H
  67. # |. ~$ M2 V9 G" @- a) U/ ]
  68. dma_addr_t dmaphyssrc1 = 0;
      z4 |7 l+ Z% ]
  69. dma_addr_t dmaphyssrc2 = 0;) n5 I1 \8 s% B+ h4 Y
  70. dma_addr_t dmaphysdest1 = 0;
    ! w  y4 G7 {0 X. |+ G, b
  71. dma_addr_t dmaphysdest2 = 0;
    2 y  T) u0 u$ L, f0 z' i9 ^3 O. ^

  72. - W. T- M$ B; d* h" ^
  73. char *dmabufsrc1 = NULL;
    ( i6 P  r+ Y! a# N4 _& n! y
  74. char *dmabufsrc2 = NULL;& P0 O0 d8 e1 l7 X
  75. char *dmabufdest1 = NULL;7 F. x0 Z3 I- Y& k7 M2 w
  76. char *dmabufdest2 = NULL;
    * r% h: |( H4 T4 s1 l0 e6 `9 }
  77. ! U& C* j1 g5 O6 J( k2 g
  78. static int acnt = 512;: Q9 n7 q7 B# K; F) ~' R
  79. static int bcnt = 8;! e: I) k! @& }
  80. static int ccnt = 8;
    1 s9 d. t: A2 u

  81. ! p1 P4 d4 w1 {) T. I+ H
  82. module_param(acnt, int, S_IRUGO);
    9 D: H+ [# ^: O' S* X
  83. module_param(bcnt, int, S_IRUGO);* b/ M* u1 O% Y! v& k$ Q
  84. module_param(ccnt, int, S_IRUGO);
复制代码

# K+ ~8 C; s4 W; h+ N
! Z1 {1 P9 l2 _% v- O0 O; \  K1 l      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ M. D3 J7 M  }* m
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 O: u5 s9 F( Q& N; [! c* n: s     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 h4 t/ p! K, Y' q8 k8 o, V
) I% B. \" v; h" N' r* S9 z' F

# A& R  N6 K& P0 i* o8 i+ O- S+ g% P
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-18 22:14 , Processed in 0.048550 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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