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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( U( q( f) F' H1 G3 ]
  1. [code]EDMA sample test application
    , S5 F  m$ {# w, M. @2 W+ S  [
  2. /*' ~- {" e+ }0 m& a- h2 b3 @3 [
  3. * edma_test.c- m) \6 m& C+ {6 ?# |
  4. *% V: X! C$ h: P; q6 \0 L
  5. * brief  EDMA3 Test Application: Z, D0 O6 R& _, h# @( ^' C
  6. *. R3 h5 i$ ^6 g- s# E# `% d
  7. *   This file contains EDMA3 Test code.
    ' O4 B# `7 ^$ t8 L& t
  8. *6 g6 y7 e' Y0 P# ]/ P3 p8 i3 ?4 [: }
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    1 W. K0 A1 U  r! |- v
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    & y+ `6 _/ p& O1 l* r
  11. *         TO CHANGE.
    * |+ ]9 g4 {: q) D; r! i
  12. *- r/ D% ]. Z& }' U: m, C2 g
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    5 s7 C1 A; l2 y4 ]1 Z
  14. *  G; I' j5 W. c0 q6 Y
  15. * This program is free software; you can redistribute it and/or& b% B/ Z, C9 ?3 X) F: l6 C5 C2 i% f7 ~
  16. * modify it under the terms of the GNU General Public License as# t# `$ s0 A' W/ Y, @
  17. * published by the Free Software Foundation version 2.
    + l$ [, \2 g& d
  18. *
    - Z! q$ J2 r# E0 a5 E
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    1 r9 T8 y, R  c; y9 V- z& d
  20. * kind, whether express or implied; without even the implied warranty
    0 \: M2 ?6 D/ ^$ C1 |9 W) ~
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the+ E7 T# |' ^( b6 D- z
  22. * GNU General Public License for more details.
    0 Y. z; I' u. Y; d' a( ~
  23. */3 O( `5 ^1 u+ s6 ~$ N( u0 ^8 u) r

  24. 1 W8 ^& h" O% z; V/ v! d( S
  25. #include <linux/module.h>
    - S) o, f( z0 l1 J. y+ m/ R* i' S8 |
  26. #include <linux/init.h>
    * {" {6 \# K9 m3 E7 J
  27. #include <linux/errno.h>* c) o+ o, @7 H/ [, L" w1 S
  28. #include <linux/types.h>
    7 F% v, n6 H: c0 U* t; r' F
  29. #include <linux/interrupt.h>
    # Y/ \/ n2 F1 s( y1 {
  30. #include <asm/io.h>. S7 [) _% s2 A5 f1 }# Y9 \- _) v
  31. #include <linux/moduleparam.h>0 @/ W& e2 X9 j, @. P, d
  32. #include <linux/sysctl.h>
    6 |9 }9 {5 I' \* {! p- S0 p7 C
  33. #include <linux/mm.h>" L5 `: [* P$ t2 O! [  n' k
  34. #include <linux/dma-mapping.h>
    - F" t) E7 Z( Y$ _1 A7 ?

  35. 9 z# L2 e# A  [. Y
  36. #include <mach/memory.h>
    - T& p( z; P. l1 z2 C& Z8 b, e
  37. #include <mach/hardware.h>* K# d$ V6 X, E& e* S* y
  38. #include <mach/irqs.h>
    ; T0 U$ o8 P8 w; w( _1 n
  39. #include <asm/hardware/edma.h>3 t2 o: k6 U, C& W, n4 |

  40. / S7 c9 i; [2 ?7 R/ P. C7 z
  41. #undef EDMA3_DEBUG
    : j% @, z. O# r& C# t* E
  42. /*#define EDMA3_DEBUG*/$ \; a, R( y! ]! D3 U
  43. . D5 Y# t6 B8 ]0 y2 ~1 X5 }: ^% Z
  44. #ifdef EDMA3_DEBUG
    ' M- Z% A8 F' H" d8 M
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# b5 d. ~9 m- W, T, }; j: U$ |8 N
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ P2 N6 @! b1 n2 v
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ W( ?$ f9 X: @6 G$ _3 S
  48. #else
    : f1 N8 \0 U: f3 n# \- g
  49. #define DMA_PRINTK( x... ): U. y+ k) k/ j1 w
  50. #define DMA_FN_IN# ]. H: ^- ~. e+ S
  51. #define DMA_FN_OUT2 m' F8 ^2 B( \0 [, O6 ]- u
  52. #endif, |* J' I1 ^8 F; v
  53. / |0 X, t' S! P# H5 l
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)/ _  U9 ?' a" |
  55. #define STATIC_SHIFT                3
    . m! u9 G4 V' T; T3 N3 O% [
  56. #define TCINTEN_SHIFT               20
    ( q: T. b' l* k9 s0 _; S8 w
  57. #define ITCINTEN_SHIFT              21. r3 `4 m1 a4 l) h' m0 i: s
  58. #define TCCHEN_SHIFT                22
    ( J; S( v. {. R2 F5 T% D. p9 Z2 p
  59. #define ITCCHEN_SHIFT               236 |& G! p& T0 L4 ~, Z, b

  60. ! U2 K( D; L: ^3 V, K7 ?3 u+ s
  61. static volatile int irqraised1 = 0;
    ! P' n; I; n1 v8 t2 s, X: q% O
  62. static volatile int irqraised2 = 0;
    , J1 B) Q  ~4 L( B8 b/ ]: m
  63. $ w1 U! Y% F; m- \& G! Y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 U7 @( m4 h8 L/ A: S
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' Z, b0 X% Y7 |, Y( w9 s3 [
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * a) Q/ l8 j( P% I$ h" m
  67. * J1 p+ C/ a' b$ W- Z
  68. dma_addr_t dmaphyssrc1 = 0;
    8 }0 M& u. ^% c
  69. dma_addr_t dmaphyssrc2 = 0;
    + a) X1 {2 e; \! e% x& K, o' I- I2 X
  70. dma_addr_t dmaphysdest1 = 0;/ c; d% r  ^& C7 {" \
  71. dma_addr_t dmaphysdest2 = 0;
    / ?# O1 _+ u% Y3 f- G" v
  72. 8 ]8 |- g- d/ O+ [$ }6 t5 _$ K9 U
  73. char *dmabufsrc1 = NULL;
    ' w0 k  y- t" B
  74. char *dmabufsrc2 = NULL;0 h2 g: W) q) y
  75. char *dmabufdest1 = NULL;4 a0 E( F4 b! ]
  76. char *dmabufdest2 = NULL;
    ' W; j3 b5 F$ }) k  ~) M8 g/ E/ `

  77. - {6 i* M; R: ~+ n# U0 J+ ?
  78. static int acnt = 512;
    8 X1 l6 z- [3 c7 s0 @
  79. static int bcnt = 8;' ^) _  r$ x/ z1 Y
  80. static int ccnt = 8;
    & ]. e9 B+ ?$ w1 e' U- ]5 j$ q
  81. - r! K3 k) C+ v2 _# ?
  82. module_param(acnt, int, S_IRUGO);
    9 y6 I7 B. P5 I4 L' S: b2 x- I( `# ~
  83. module_param(bcnt, int, S_IRUGO);1 n% n% @$ U( `
  84. module_param(ccnt, int, S_IRUGO);
复制代码

/ N9 s5 }9 `8 I  t. M5 K$ d' s' R8 a8 \, M5 C2 P9 O3 E
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) E  H: l0 r+ ]! x
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: A% n3 l- e, @: V. O2 |
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 ?/ E( H. O2 E# p' F; n" W* d8 N1 |# p! f8 }

% l4 S1 W# a9 _+ N, \6 P
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-17 23:06 , Processed in 0.040357 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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