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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) t/ I+ p* [- Z( \+ K5 y2 V
  1. [code]EDMA sample test application( `+ ]4 U. D& E+ t
  2. /*
    6 {5 S' |( t$ C! G
  3. * edma_test.c0 w+ h$ F) G' P3 a+ C+ Z% D3 N
  4. *$ s8 B' O0 P" p9 N
  5. * brief  EDMA3 Test Application
    + E! u, O7 ]: F. i4 x' M# Q$ u
  6. *
    - H5 R. ]! |$ a; _
  7. *   This file contains EDMA3 Test code.- G5 q1 S8 J7 }# W+ L/ C
  8. *$ w% S* u0 w3 R
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    1 H5 F7 E7 {: c
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; H) R; {' d7 P% Z4 i, d" o! \1 [
  11. *         TO CHANGE.# z0 M1 {  n& B4 B+ U; f
  12. *
    6 i% J3 u' t& q7 N! _
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    3 A4 t" J0 G2 p: v  ]
  14. *
    4 v% l: D2 Y5 I+ _# ]
  15. * This program is free software; you can redistribute it and/or
    4 ~# b  o: z- m3 S+ p
  16. * modify it under the terms of the GNU General Public License as: H; h5 Q8 F/ z6 k% ]
  17. * published by the Free Software Foundation version 2.
    6 _" j! \2 C$ O0 X5 ^% [
  18. *) e, `& |# B& e" [, I) m& o
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    0 v  V% U3 x4 ?$ M
  20. * kind, whether express or implied; without even the implied warranty" K  f. W+ [- j8 ~6 z" s- t
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1 t* l, o! p# z! y
  22. * GNU General Public License for more details.- N) v7 j1 M2 u2 \8 X0 D# a/ L
  23. */( F, q1 Q% A1 W# L$ K
  24. ( [9 |7 ~7 e# I/ Y
  25. #include <linux/module.h>8 n3 ~# ~' p7 a  W, y
  26. #include <linux/init.h>
    9 m1 U2 P3 H: S  {) Q* Q
  27. #include <linux/errno.h>2 c7 y4 J6 X$ {/ E
  28. #include <linux/types.h>5 s) D' u9 ~* ~# q2 K
  29. #include <linux/interrupt.h>0 n* r4 @1 M# X. t( ~3 h0 k8 w
  30. #include <asm/io.h>
    2 d" B3 N7 q1 M+ i2 V
  31. #include <linux/moduleparam.h>
    ; Z) o. U3 N# s- |, l
  32. #include <linux/sysctl.h>
    , C1 P( D2 c" l* F! Y
  33. #include <linux/mm.h>0 `4 ^, ~, v0 T7 q
  34. #include <linux/dma-mapping.h>
    0 c3 u% J2 J+ Z0 F

  35. ) k: s% \4 @, f. C: G
  36. #include <mach/memory.h>
    2 `$ `. s2 p" F5 I
  37. #include <mach/hardware.h>
    + T( d# F4 d# f* K% a+ k" h
  38. #include <mach/irqs.h>
    9 M+ \% X' l, `- |$ c$ S7 k
  39. #include <asm/hardware/edma.h>
    / N; O8 a$ ?( |4 c

  40. # w3 v$ q( D* M/ F
  41. #undef EDMA3_DEBUG, c1 c; R/ M1 G' }1 H5 R
  42. /*#define EDMA3_DEBUG*/
    " y! ]( o/ P' u2 F6 X7 |

  43. 8 B2 g! Z- E: I; m
  44. #ifdef EDMA3_DEBUG6 Y" ^4 Z0 j4 m/ g
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    2 a8 g# C! @* C* Y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    2 K$ q) v, h5 o: y. @  h1 I
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    - O5 ^+ e5 Y9 n) ~0 k
  48. #else% _/ a" a/ P& x; b; p
  49. #define DMA_PRINTK( x... )& R  u0 {4 H. Z* I8 \, }8 u, O
  50. #define DMA_FN_IN
    + m0 o- q& O; E$ _
  51. #define DMA_FN_OUT
    % o6 B& d5 K# s0 i
  52. #endif% j1 m2 W, ~7 k0 ]

  53. / [$ p3 f; y: K- k5 a7 g
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)9 F: q$ I& j/ T& ]6 V& }/ T
  55. #define STATIC_SHIFT                3
    * x$ ]5 `! {  ]$ {, ]
  56. #define TCINTEN_SHIFT               20& E9 {- S# U# N) g  d  O6 B7 V5 t
  57. #define ITCINTEN_SHIFT              21% \  m; X; Y5 P  h" J3 d: t: f
  58. #define TCCHEN_SHIFT                22
    / N4 A) G; @* f! X8 K
  59. #define ITCCHEN_SHIFT               23$ Q! W, {. }+ b; S4 h  r

  60. 5 c) y7 e: p( i  J9 W6 J8 [
  61. static volatile int irqraised1 = 0;5 x/ |. E9 ]3 ^* f$ M
  62. static volatile int irqraised2 = 0;
    : Z( M9 w) x; _7 L! n
  63. 1 O9 ?( \5 ]; L+ T: p
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " E) k  u1 T; P1 a
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 C7 ?# M9 O) X0 \
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 n# B$ M( ~+ Y- R

  67. 9 ?% [5 }3 P, y' o
  68. dma_addr_t dmaphyssrc1 = 0;
    - v$ Z2 I# D+ F0 i  R
  69. dma_addr_t dmaphyssrc2 = 0;. T1 c3 q, U! G0 B6 t/ z
  70. dma_addr_t dmaphysdest1 = 0;
    " s5 e1 a4 H8 X) X9 x
  71. dma_addr_t dmaphysdest2 = 0;
    0 }/ X$ G2 l7 O- ]

  72. 6 A1 M/ Y; q% j" j
  73. char *dmabufsrc1 = NULL;1 s: x+ J8 {6 K$ d5 ^- W+ H
  74. char *dmabufsrc2 = NULL;
    5 W; n1 @& T9 L# M
  75. char *dmabufdest1 = NULL;
    7 N: c6 i8 O2 ^' {$ ~
  76. char *dmabufdest2 = NULL;/ O8 u" f  c6 S3 I
  77. ( ^9 G" G) m, j( i, e
  78. static int acnt = 512;$ o: b# G# E/ M& u; x7 J
  79. static int bcnt = 8;; c0 [8 B7 H- t7 \9 i$ p7 b
  80. static int ccnt = 8;
    4 T+ E$ `' F. j
  81. ; ~+ ~. q1 E7 m4 e0 F2 P2 x. A
  82. module_param(acnt, int, S_IRUGO);1 _$ T  d, L, n; X
  83. module_param(bcnt, int, S_IRUGO);% X4 d8 i: `. e: }. p$ ?) U
  84. module_param(ccnt, int, S_IRUGO);
复制代码

/ h) M# q+ i" R, @! z+ |, C4 S0 {8 e! m) L% ^( W1 R
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" S1 K7 I8 T6 M; L; n# Aarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ Z5 I) W" Y" b) u& h: Z, q
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: b& V( y6 y" \) s0 l
2 u$ W7 f1 G* ~  O! a. Q" [
+ D/ Q0 C! T/ V
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-20 06:02 , Processed in 0.039368 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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