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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ s- c7 e5 m) x+ E$ n! d
  1. [code]EDMA sample test application) {( A0 o# A) p9 a: ~! \* z% t) h
  2. /*1 K# U; O: _+ p# ^
  3. * edma_test.c
    : r- G( U0 J/ L& n" }
  4. ** L+ b; N- k' o& t* `
  5. * brief  EDMA3 Test Application3 K9 l; B8 J# ^0 {
  6. *
    + m4 q# E. j5 B  \. Q
  7. *   This file contains EDMA3 Test code.
    * S- D3 G! R1 |
  8. *
    ( Z% A! T. a& t( K' O; r1 I* D3 T
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" [2 f. x) C- T9 o! n! x
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( Q* T( A; W5 g2 t# F8 n0 [
  11. *         TO CHANGE.
    4 D2 ^% W' \5 {
  12. *
    " K8 n9 V) Y( K
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ' l: ?$ X4 R' M- i, K; x
  14. *& {5 O: n& t; U- y, q4 N
  15. * This program is free software; you can redistribute it and/or
    & \8 @* h" s# m6 B% z5 i
  16. * modify it under the terms of the GNU General Public License as
    ( q: v3 V8 J1 }
  17. * published by the Free Software Foundation version 2.
    4 b! ?; Q& [& k& T* n: [6 y; n
  18. *
    ! \6 w5 S; }( `( A
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any% J8 c/ p) {# \: K' u7 N
  20. * kind, whether express or implied; without even the implied warranty, q/ S# t0 f; E9 V) M9 t
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the$ l. s0 `& P2 B4 W( C  p9 ]
  22. * GNU General Public License for more details.
    9 E' b. V3 p% a8 I3 Z1 @
  23. */$ z( e9 [. D$ |. l6 y5 I0 M

  24. 9 M( K1 a" {% C
  25. #include <linux/module.h># V# F5 o/ f6 [9 G1 F
  26. #include <linux/init.h>5 y0 H" O8 k) i- [, r( S% U5 z1 }
  27. #include <linux/errno.h>7 ~4 v2 L# v& w5 D
  28. #include <linux/types.h>( N- Y, W$ X. a6 r/ E
  29. #include <linux/interrupt.h>- w- Y9 G' S- L8 s* J$ c) G
  30. #include <asm/io.h>
    3 p; H5 F0 \; u( d
  31. #include <linux/moduleparam.h>
    " b7 Y3 N2 t3 Z: m! E- F" h
  32. #include <linux/sysctl.h>: l8 L% O, L3 S2 a% v+ F
  33. #include <linux/mm.h>
    5 ?/ o7 s, m: {/ {' [
  34. #include <linux/dma-mapping.h>5 L5 y4 |. h( P

  35. $ y; b9 I: A' w) Y' l; _' Z- k6 X8 R! H
  36. #include <mach/memory.h>0 p/ q; |. p- _  S- Y
  37. #include <mach/hardware.h>5 n. o: |6 m% u+ y) z
  38. #include <mach/irqs.h>3 ?: G1 v& y2 T* C: G/ ?( X
  39. #include <asm/hardware/edma.h>6 q  R% t. @- p' X
  40. 3 x+ j- C( ~5 l- e( G) J
  41. #undef EDMA3_DEBUG4 N4 V: s$ {. i- h2 \
  42. /*#define EDMA3_DEBUG*/
    ' k' d3 l' n, k5 c: y+ X
  43. ( ?, n* K4 v3 h5 w1 f: ~* Z' D9 k0 B
  44. #ifdef EDMA3_DEBUG! S7 M, E7 T* h; y: o& O# S& J
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    . O. T0 U. {6 H) f! J& `
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    4 b% `6 R, }1 G$ z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    & @1 Y% ^6 W7 M' k9 @% X
  48. #else' D. J' \. U' G9 L4 x7 ~: z
  49. #define DMA_PRINTK( x... )
    ! a' z! `( X! r; D! |! u( I/ _3 G
  50. #define DMA_FN_IN
    . E9 ~4 ^5 I2 L' o. x' i
  51. #define DMA_FN_OUT. A# ~+ r5 W& \9 B$ r: f/ D
  52. #endif( e8 @9 L9 Z5 W9 E; J

  53. ; W' H, b2 I" T, q' r1 F
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)7 g2 F' |: U5 ?& I- Z+ ?% U% o( i: T7 K
  55. #define STATIC_SHIFT                3  _' n: N$ L2 c1 O1 D" F) U5 q7 b
  56. #define TCINTEN_SHIFT               201 a2 i' a& P0 U/ \- [3 J2 e
  57. #define ITCINTEN_SHIFT              21  d1 [$ J" O5 L3 X
  58. #define TCCHEN_SHIFT                229 L! c0 n& y( c# D! w' S
  59. #define ITCCHEN_SHIFT               23
    + Y! r$ }" [7 [( l8 F+ @& I$ z
  60. 4 N3 O) R! q" {( `( @& [
  61. static volatile int irqraised1 = 0;
    ) n- k& X  C  ^
  62. static volatile int irqraised2 = 0;9 X2 k, T: Y4 {. t$ d

  63. 0 ~9 _" ^$ u1 G. [
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ U4 A0 b& [& f, k
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& I# k0 ^# C5 E7 N
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + @( B# v2 D( G, h
  67. 1 m" T$ @# a" q( n$ X
  68. dma_addr_t dmaphyssrc1 = 0;8 y$ O5 B0 Y  r: F' N7 T
  69. dma_addr_t dmaphyssrc2 = 0;* m, G  S3 J1 |- Y8 M1 Q
  70. dma_addr_t dmaphysdest1 = 0;
    $ m- T( c) {2 C) F
  71. dma_addr_t dmaphysdest2 = 0;% a6 O# l' U+ v  z% H2 i: \5 H

  72. / i& t  J! A1 n) J+ ?
  73. char *dmabufsrc1 = NULL;
    , J. r7 I: T7 P$ _
  74. char *dmabufsrc2 = NULL;0 J' ~- f5 N+ s" X* x# E! v
  75. char *dmabufdest1 = NULL;9 a; O- }- P/ D$ i
  76. char *dmabufdest2 = NULL;
    - \# j# m! X' q/ k/ O3 B! I/ t
  77. ( \- l$ q0 S. Q" I  E, W9 w" h5 h* n
  78. static int acnt = 512;
    1 i; U: Q2 V! S5 v0 u. Q
  79. static int bcnt = 8;
    : P8 B+ v4 L3 O7 f" E
  80. static int ccnt = 8;
    7 t5 S* G) @7 f$ n; P
  81. $ G# q  b% g; \1 O& L8 m" a1 F" V$ r4 a$ ]
  82. module_param(acnt, int, S_IRUGO);: a8 b( y* G( [/ B# \: c' o
  83. module_param(bcnt, int, S_IRUGO);
    $ W+ K1 H4 ^# q( I
  84. module_param(ccnt, int, S_IRUGO);
复制代码
3 j& J" }# E3 G
6 B; K# O- e% _: K- e6 }" r
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用; q1 p9 f" _$ y; G  e, B1 O* }+ D
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ v( }! L% u, ^6 H6 U+ [     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: K( y5 W- H& m  F3 B7 Z
; J. E. V* n9 Q' i% X' K' S& z, K6 i/ B, C8 q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-8 20:52 , Processed in 0.044390 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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