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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, ~" H3 t8 _7 z/ m
  1. [code]EDMA sample test application
    ' |4 D3 D2 ~/ z$ V7 R- h) @
  2. /*
    ! U4 L, ~/ A  `. u5 {
  3. * edma_test.c% W6 [. o0 t3 i+ M. c, w
  4. *
    % X: O& |7 a: o- L4 [
  5. * brief  EDMA3 Test Application
    0 z4 w+ \* V5 S6 F' _" Q
  6. *
    3 ?; ]& W' Z% L; V
  7. *   This file contains EDMA3 Test code.
    $ V8 P7 a0 H: W( X
  8. *+ m4 n; ]6 t, D, y$ ]/ Q# n
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    * Z! M. i: K2 i' B; I" p
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( I8 Q' b) o" _* T) A1 S
  11. *         TO CHANGE.) V/ h7 ~# I2 L8 u' h& I
  12. *
    + W6 Q3 h: S; b$ X  G) S8 P
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    - e3 W" T* b# u6 u
  14. *1 ]! g5 p0 G, Q- V$ q7 J2 t8 h
  15. * This program is free software; you can redistribute it and/or% @5 @  x! S1 L" P& ?0 d
  16. * modify it under the terms of the GNU General Public License as
    / T2 O* c! A2 ?' V' N
  17. * published by the Free Software Foundation version 2./ I  M1 I/ e. V4 b& l
  18. *, _- ]. V& U8 q  P) ~4 E% D
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ( \/ ^$ \: x4 L9 h, X4 R  s
  20. * kind, whether express or implied; without even the implied warranty/ z1 q# h0 _7 p2 v7 U+ i
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the6 @7 |4 y  Y$ |- R5 B3 Y' {
  22. * GNU General Public License for more details.0 `3 B' I! I3 D2 w7 L+ A
  23. */5 u8 d$ d% b4 g  \% p) U

  24. 5 }( R3 ~- r) w1 Q3 @2 k  r
  25. #include <linux/module.h>
    5 p2 h. x4 R7 w& s7 f
  26. #include <linux/init.h>/ N7 U0 I& w8 M- h, O  q  c
  27. #include <linux/errno.h>
    2 h9 ?: Z# m0 r  _/ ?8 a7 m
  28. #include <linux/types.h>
    : f: d! M+ w, G, ?: M) w
  29. #include <linux/interrupt.h>
    & g; p9 ?$ }2 l
  30. #include <asm/io.h>
    % t3 x, G8 ^4 ^* P* M
  31. #include <linux/moduleparam.h>
    ( G' b& Z. [# ^2 N; ~$ U) W
  32. #include <linux/sysctl.h>' X2 j. l5 }8 a/ V4 g% A+ Q
  33. #include <linux/mm.h>
    6 p7 p7 S9 J/ b3 A+ s2 v
  34. #include <linux/dma-mapping.h>& ?; ~0 w4 C' U; V! m1 a1 `

  35. ( t/ o" S: V5 S9 d# n
  36. #include <mach/memory.h>; S; N8 {# r0 m
  37. #include <mach/hardware.h>: H" _9 {1 f" K- m9 U9 n
  38. #include <mach/irqs.h>
    ) t. c+ j, h; Q% l3 O" B& O5 E
  39. #include <asm/hardware/edma.h>" \) @5 t) H# p
  40. : l6 ?2 b4 t; `2 V# j4 B
  41. #undef EDMA3_DEBUG
    / v9 ]6 q" u  M! F; C" G* Z
  42. /*#define EDMA3_DEBUG*/
    + L/ X- }' S6 e

  43. ) P7 g  N5 z- h3 B+ ^9 {
  44. #ifdef EDMA3_DEBUG
    % ?9 t$ }9 A2 p
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ! z2 o; B+ V* q  ]9 `" r( F
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ) |1 q+ [8 ~7 I. Q5 q6 C5 \' n
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 G$ K3 V: l  r! W9 Y. y' B3 b
  48. #else) C2 B; y1 d( [  F3 Z
  49. #define DMA_PRINTK( x... ), Z+ R+ G! Z- ?. B# u# c* X5 t& ^
  50. #define DMA_FN_IN
      v( f: ^+ x5 B
  51. #define DMA_FN_OUT8 z5 Y! M  m& C' |% p/ c
  52. #endif
    1 _' {  A& S) B
  53. 6 [7 w6 d1 b$ @- E; w% x, [: {
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)1 T* p, d6 q( I# h2 d, E
  55. #define STATIC_SHIFT                3% T& O; N$ ~2 ^) z$ R& J
  56. #define TCINTEN_SHIFT               200 C! a$ ]% ^, ?# H+ r) F% T
  57. #define ITCINTEN_SHIFT              215 X; Y. A0 F8 {: Z0 e
  58. #define TCCHEN_SHIFT                22
    - U1 r; {' n% G. e3 N$ N# g6 n
  59. #define ITCCHEN_SHIFT               233 @7 f; P) q1 [; c
  60. , N/ t# t0 c: n7 r
  61. static volatile int irqraised1 = 0;( T) Z# o' r$ d7 O6 e$ v
  62. static volatile int irqraised2 = 0;
    * ?, I/ Q6 R/ ?- u$ k2 a
  63. ' @9 r3 P: i: d
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( ~" r- Z/ n$ Q/ w+ a0 M( z" U+ D
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ V% l0 Y7 C' K+ Q
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, \9 I" B* J) r2 _
  67. * w$ u; ^* Z8 c0 n: V; L
  68. dma_addr_t dmaphyssrc1 = 0;* ?) f3 L( |: f0 e  h, c
  69. dma_addr_t dmaphyssrc2 = 0;* ]9 u' q; ~( y5 b
  70. dma_addr_t dmaphysdest1 = 0;
    ( T) \* j4 X( s: D# s- Y# L# |: c
  71. dma_addr_t dmaphysdest2 = 0;
    . ~6 ~( h, [. ^$ ~6 u4 i
  72. : K/ w, u- p4 [, O' C& S
  73. char *dmabufsrc1 = NULL;! |; C, p3 M( M
  74. char *dmabufsrc2 = NULL;' I+ y/ Q) x8 U2 y. N5 Z
  75. char *dmabufdest1 = NULL;: A% X8 F! E4 l- Y' N( {
  76. char *dmabufdest2 = NULL;
    ; P+ C- Z$ A+ h: ~. h
  77. . M( l! q; A& l
  78. static int acnt = 512;
    / ?( U3 ~# L$ R# E3 _- j
  79. static int bcnt = 8;
    / V; Z/ M! {1 f& ^
  80. static int ccnt = 8;
    8 z4 `* O( D, ]5 |) Z4 {7 ^

  81. 8 x& o# T* a4 r( s/ m% g
  82. module_param(acnt, int, S_IRUGO);, |! z1 i* s( V; [
  83. module_param(bcnt, int, S_IRUGO);2 Y* X  Z: J3 x3 g% L# ]# X( `& v
  84. module_param(ccnt, int, S_IRUGO);
复制代码
! @# Y1 \5 _! R5 T2 K3 A( a0 b
* i* X$ U0 \8 s' D' U! u' `! O4 E
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 t; \+ H4 }. Qarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( j3 X8 {; A& ~2 ~2 W     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) _0 f5 ]" ^4 k/ k

# S/ d: E, R$ P; Y2 _' o5 t7 G# ^; D
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-22 18:36 , Processed in 0.041336 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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